/* ==========================================================================
   PHONE SCREEN
   Design brief: readable and tappable by a drunk person, in a dark room,
   holding a drink in the other hand. Huge targets. Few words. No scrolling
   to find the thing you need to press.
   ========================================================================== */

:root {
  --bg:      #0b0b12;
  --surface: #1b1b28;
  --line:    #2c2c3d;
  --text:    #f4f4fa;
  --muted:   #9a9ab0;
  --pink:    #ea587d;
  --gold:    #ebc95a;
  --green:   #3ddc97;
  --blue:    #67a3ec;
  --purple:  #ba91f1;
  --safe-b:  env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  padding: 20px 16px calc(20px + var(--safe-b));
  min-height: 100dvh;
}
.screen.active { display: flex; }

.center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
}

/* ---- shared bits -------------------------------------------------------- */

.btn {
  font-family: inherit;
  font-weight: 800;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  letter-spacing: .04em;
  transition: transform .06s var(--ease);
}
.btn:active { transform: scale(.97); }
.btn-full { width: 100%; padding: 20px; font-size: 1.15rem; }
.btn-primary {
  background: linear-gradient(180deg, var(--pink), #d51a49);
  color: #fff;
  box-shadow: 0 5px 0 #88112f;
}
.btn-primary:active { box-shadow: 0 2px 0 #88112f; }
.btn-primary:disabled { opacity: .4; box-shadow: none; }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 2px solid var(--line);
}

.big-status { font-size: 1.9rem; font-weight: 900; }
.sub-status { color: var(--muted); font-size: 1rem; line-height: 1.4; }
.sub-status.dim { opacity: .6; }

.logo {
  font-size: 2.2rem;
  font-weight: 900;
  line-height: .95;
  text-align: center;
  margin-bottom: 28px;
}
.logo span {
  display: block;
  background: linear-gradient(90deg, var(--pink), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---- join --------------------------------------------------------------- */

.join-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; }

.field { display: block; margin-bottom: 18px; }
.field span {
  display: block;
  font-size: .75rem;
  letter-spacing: .2em;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 700;
}
.field input {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  font-family: inherit;
  text-align: center;
}
.field input:focus { border-color: var(--pink); }
#codeInput { letter-spacing: .35em; text-transform: uppercase; }

.err { color: var(--pink); text-align: center; margin-top: 14px; font-weight: 700; min-height: 1.2em; }

/* ---- lobby -------------------------------------------------------------- */

.you-name {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--gold);
  background: var(--surface);
  border: 2px solid var(--gold);
  border-radius: 999px;
  padding: 10px 26px;
}
.player-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }
.player-chips span {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: .85rem;
  font-weight: 700;
}

/* ---- question ----------------------------------------------------------- */

.q-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.round-tag, .timer-tag {
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .15em;
  color: var(--muted);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 14px;
}
.timer-tag.urgent { color: #fff; background: var(--pink); }

.q-prompt {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
  margin-bottom: 18px;
}

.answer-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-content: stretch;
}
.answer-grid.two-col { grid-template-columns: 1fr 1fr; }

.answer {
  background: var(--surface);
  border: 3px solid var(--line);
  border-radius: 22px;
  color: var(--text);
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 800;
  padding: 18px 14px;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color .12s var(--ease), background-color .12s var(--ease), transform .12s var(--ease);
}
.answer:active { transform: scale(.97); }
.answer .letter {
  width: 32px; height: 32px;
  flex: none;
  display: grid; place-items: center;
  background: var(--line);
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 900;
}
.answer.picked {
  border-color: var(--pink);
  background: rgba(234,88,125,.18);
}
.answer.picked .letter { background: var(--pink); color: #fff; }
.answer:disabled { opacity: .45; }

/* ---- tap race ----------------------------------------------------------- */

.tap-zone { flex: 1; display: flex; padding: 10px 0; }
.tap-btn {
  flex: 1;
  border: none;
  border-radius: 22px;
  background: var(--surface);
  border: 4px solid var(--line);
  color: var(--muted);
  font-family: inherit;
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: .05em;
  cursor: pointer;
  transition: background .05s var(--ease);
}
.tap-btn.go {
  background: var(--green);
  border-color: #fff;
  color: #05291a;
}
.tap-btn.done { background: var(--surface); border-color: var(--blue); color: var(--blue); font-size: 1.4rem; }
.tap-btn.early { background: var(--pink); border-color: #fff; color: #fff; font-size: 1.6rem; }

/* ---- locked / reveal ---------------------------------------------------- */

.lock-icon { font-size: 4rem; }
.spinner {
  width: 44px; height: 44px;
  border: 4px solid var(--line);
  border-top-color: var(--pink);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.verdict { font-size: 5rem; line-height: 1; }
.verdict-text { font-size: 2.4rem; font-weight: 900; line-height: 1.1; }
.verdict-reason { color: var(--muted); font-size: 1rem; }

#p-reveal.drink { background: linear-gradient(180deg, rgba(234,88,125,.22), transparent 55%); }
#p-reveal.safe  { background: linear-gradient(180deg, rgba(61,220,151,.18), transparent 55%); }

.dare-box {
  background: var(--surface);
  border: 2px solid var(--blue);
  border-radius: 14px;
  padding: 18px;
  margin-top: 10px;
  color: var(--blue);
  font-weight: 700;
  font-size: 1.05rem;
}

/* ---- cards -------------------------------------------------------------- */

.cards-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.cards-head h2 { font-size: .8rem; letter-spacing: .2em; color: var(--muted); }

.hand { flex: 1; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }

.card {
  background: linear-gradient(150deg, #2a1f3d, var(--surface));
  border: 3px solid var(--purple);
  border-radius: 22px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  transition: transform .08s var(--ease);
}
.card:active { transform: scale(.97); }
.card .icon { font-size: 2.2rem; flex: none; }
.card .body { flex: 1; }
.card .name { font-size: 1.1rem; font-weight: 900; color: var(--purple); }
.card .desc { font-size: .85rem; color: var(--muted); margin-top: 3px; line-height: 1.3; }
.card.spent { opacity: .3; pointer-events: none; }

.empty-hand {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-align: center;
  gap: 10px;
}
.empty-hand .big { font-size: 2.6rem; opacity: .4; }

.target-head { text-align: center; margin-bottom: 16px; }
.target-head h2 { font-size: 1.2rem; font-weight: 900; }

/* ---- host bar / settings ------------------------------------------------ */

.host-bar {
  position: sticky;
  bottom: 0;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: linear-gradient(180deg, transparent, var(--bg) 30%);
}

.gear {
  position: fixed;
  top: 10px; right: 10px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  z-index: 40;
}

.sheet {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: flex-end;
  z-index: 60;
}
.sheet-inner {
  width: 100%;
  background: var(--surface);
  border-radius: 22px 24px 0 0;
  padding: 24px 20px calc(24px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sheet-inner h3 { font-size: 1.1rem; }
.toggle { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.toggle input { width: 26px; height: 26px; accent-color: var(--pink); }
.toggle-note { color: var(--muted); font-size: .85rem; line-height: 1.4; }

.final-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface);
  border-radius: 22px;
  padding: 18px 40px;
}
.final-stat span { font-size: 3rem; font-weight: 900; color: var(--gold); line-height: 1; }
.final-stat.alt span { color: var(--pink); }
.final-stat small { color: var(--muted); font-size: .8rem; letter-spacing: .15em; margin-top: 6px; }

.conn-warn {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: var(--pink);
  color: #fff;
  text-align: center;
  padding: 8px;
  font-weight: 800;
  font-size: .85rem;
  z-index: 70;
}

/* --------------------------------------------------------------------------
   Applied from the Web Interface Guidelines audit.
   -------------------------------------------------------------------------- */

/* Numbers that tick in place must not jitter as digit widths change. The tap
   counter updates several times a second; the countdown every second. */
.answered-pill, .score-list .val, .timer-tag, .round-pill,
.tug-count, .tc-score, .final-stat span, .card-counter,
.quip-results .qv, .tally-list b, .cr-guess b {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Stop single words dropping to their own line in big display type. */
.round-title, .question-text, .q-prompt, .reveal-answer,
.cards-title, .challenge-text, .ad-tag, .big-status, .verdict-text {
  text-wrap: balance;
}

/* Surfaces catch a light from above rather than sitting flat on the page.
   One inset hairline; no extra DOM. */
.player-list li, .vote-card, .team-card, .roster, .big-card, .option,
.punish-list li, .answer, .card, .tool-btn, .round-pill, .answered-pill,
.effect-chip, .bet-chip, .typing-list li, .clue, .dare-box, .final-stat {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}