/* Hugh's Hand — student app. One big button, calm, thumb-first. */

:root {
  --bg: #f6f7f9;
  --text: #1a1c1f;
  --text-dim: #5b6169;
  --surface: #fff;
  --border: #d9dde2;
  --down: #2563eb;
  --raised: #e8a71c;
  --called: #1e874b;
  --danger: #c0392b;
  --on: #fff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --text: #eceef1;
    --text-dim: #9aa2ad;
    --surface: #1e2126;
    --border: #343a43;
    --down: #4b8bff;
    --raised: #f2b53a;
    --called: #45c684;
    --danger: #ff6b5e;
    --on: #12141a;
  }
}

* { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: max(24px, env(safe-area-inset-top)) 24px calc(28px + env(safe-area-inset-bottom));
  text-align: center;
}
.loading { color: var(--text-dim); }

/* --- who --- */
.who { color: var(--text-dim); font-size: .95rem; }
.who strong { color: var(--text); font-size: 1.05rem; display: block; }

/* --- the hand button --- */
.hand {
  width: min(78vw, 320px);
  aspect-ratio: 1;
  border: none;
  border-radius: 50%;
  color: var(--on);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 22px;
  transition: transform .12s, background .2s;
  background: var(--down);
}
.hand .emoji { font-size: 2.8rem; line-height: 1; }
.hand .label { font: 700 1.4rem/1.25 system-ui, sans-serif; }
.hand:active { transform: scale(.96); }
.hand:disabled { cursor: default; }

.hand.state-down   { background: var(--down); }
.hand.state-raised { background: var(--raised); color: var(--on); }
.hand.state-called { background: var(--called); animation: pulse 1.4s ease-in-out infinite; }
.hand.state-closed { background: var(--border); color: var(--text-dim); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--called) 55%, transparent); }
  50%      { box-shadow: 0 0 0 22px color-mix(in srgb, var(--called) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .hand { animation: none !important; } }

.sub { color: var(--text-dim); min-height: 1.4em; }
.lower {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font: inherit;
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;
}

.foot { color: var(--text-dim); font-size: .82rem; margin-top: 4px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); opacity: .5; margin-right: 5px; vertical-align: middle; }
.dot.live { background: var(--called); opacity: 1; }
.linky { background: none; border: none; color: var(--text-dim); text-decoration: underline; font: inherit; font-size: inherit; cursor: pointer; padding: 4px; }

/* --- join screens --- */
.enter { display: flex; flex-direction: column; align-items: center; gap: 16px; width: min(88vw, 360px); }
.enter h1 { font-size: 1.3rem; }
.enter .hint { color: var(--text-dim); font-size: .92rem; }
.enter input {
  font: 600 1.6rem/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: .18em;
  text-align: center;
  width: 100%;
  padding: 16px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  text-transform: uppercase;
}
.enter .go {
  font: 600 1rem/1 system-ui, sans-serif;
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 14px;
  background: var(--down);
  color: #fff;
  cursor: pointer;
}
.enter .go:disabled { opacity: .5; }
.names { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.name {
  font: 500 1.05rem/1 system-ui, sans-serif;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.name:active { background: var(--bg); }
.err { color: var(--danger); font-size: .9rem; }

/* --- celebration --- */
.cheer { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.cheer-emoji { font-size: 4.5rem; animation: pop .5s cubic-bezier(.2,1.4,.4,1); }
.cheer-msg { font: 700 1.35rem/1.3 system-ui, sans-serif; }
@keyframes pop { 0% { transform: scale(0); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .cheer-emoji { animation: none; } }
