/* High Stakes Trivia — phone controller.
   Neon night-casino style guide (matches the TV + logo):
   near-black bg, grape/purple neon, gold reserved for money. */

:root {
  --bg-1: #15151d;
  --bg-2: #0a0a10;
  --panel: rgba(10, 10, 18, 0.92);
  --lav: #b497f5;   /* logo lit-core lavender — bright accent (was cyan) */
  --grape: #6a2ed1; /* logo lit-body — deeper accent (was magenta) */
  --gold: #ffd977;
  --white: #ffffff;
  --muted: #8f8fa8;
  --green: #2ec98b;
  --red: #ff5b7a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  background: radial-gradient(ellipse 120% 80% at 50% -10%, #1b1428 0%, var(--bg-1) 45%, var(--bg-2) 100%);
  color: var(--white);
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}

.app {
  max-width: 460px;
  margin: 0 auto;
  padding: 18px 18px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100vh;
}

/* ---- Brand logos ---- */
/* Join screen: the standard stacked neon mark. */
.join-logo {
  display: block;
  width: min(72%, 280px);
  height: auto;
  margin: 6px auto 0;
}
/* Game screens: the horizontal lockup as a compact header. */
.game-logo {
  display: block;
  width: 100%;
  max-width: 230px;
  height: auto;
  margin: 0 auto 2px;
}
/* Studio credit, pinned to the bottom of the viewport on every screen. */
.studio { margin-top: auto; padding-top: 22px; text-align: center; }
.studio-logo { width: min(48%, 175px); height: auto; opacity: 0.7; }

/* ---- Screens ---- */
.screen { display: flex; flex-direction: column; gap: 16px; }
.hidden { display: none !important; }

h1 { font-size: 22px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; text-align: center; }

/* ---- Join form ---- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field span { font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
input[type="text"] {
  background: var(--panel);
  border: 2px solid rgba(180, 151, 245, 0.55);
  border-radius: 12px; color: var(--white);
  font-size: 20px; font-weight: 700; padding: 14px 16px; outline: none;
  box-shadow: 0 0 10px rgba(180, 151, 245, 0.2);
}
input[type="text"]:focus { border-color: var(--lav); box-shadow: 0 0 14px rgba(180, 151, 245, 0.45); }
#room-input { text-transform: uppercase; letter-spacing: 0.35em; text-align: center; font-size: 30px; font-weight: 900; }

/* ---- Buttons ---- */
.btn {
  border: none; border-radius: 14px; font-size: 18px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.06em; padding: 16px; cursor: pointer; color: #0c0c14;
  width: 100%;
}
.btn.primary { background: linear-gradient(90deg, #5b21b6, #7c3aed); color: var(--white); box-shadow: 0 0 16px rgba(180, 151, 245, 0.5), 0 6px 18px rgba(0, 0, 0, 0.5); }
.btn.gold { background: linear-gradient(90deg, var(--gold), #e0b84a); box-shadow: 0 0 16px rgba(255, 217, 119, 0.4); }
.btn.ghost { background: transparent; color: var(--muted); border: 2px solid rgba(143,143,168,0.4); box-shadow: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; }

/* ---- Messages ---- */
.error { color: #ff9db0; font-size: 15px; font-weight: 700; min-height: 20px; text-align: center; }
.note { color: var(--muted); font-size: 13px; text-align: center; min-height: 18px; }

/* ---- Persistent in-game header ---- */
.you {
  background: var(--panel);
  border: 2px solid rgba(180, 151, 245, 0.6);
  border-radius: 16px; padding: 14px; text-align: center;
  box-shadow: 0 0 14px rgba(180, 151, 245, 0.3);
}
.you-name { font-size: 20px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.04em; }
.you-score { color: var(--gold); font-size: 26px; font-weight: 900; margin-top: 2px; text-shadow: 0 0 8px rgba(255, 217, 119, 0.5); }

/* ---- Panel shared ---- */
#panel { display: flex; flex-direction: column; gap: 16px; }
.category {
  text-align: center; font-size: 20px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--white); background: #0e0e16; border: 2px solid rgba(180,151,245,0.85);
  border-radius: 12px; padding: 12px; box-shadow: 0 0 12px rgba(180,151,245,0.4), 0 0 24px rgba(106,46,209,0.25);
}
.hint { color: var(--muted); font-size: 14px; text-align: center; }
.big-status { text-align: center; font-size: 18px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; }
.locked-badge {
  text-align: center; padding: 14px; border-radius: 12px;
  background: rgba(46,201,139,0.12); border: 2px solid rgba(46,201,139,0.6); color: var(--green);
  font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em;
}

/* ---- Player list (lobby) ---- */
.players { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.players li {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--panel); border: 1.5px solid rgba(180, 151, 245, 0.35);
  border-radius: 12px; padding: 12px 14px;
}
.players li.self { border-color: var(--grape); box-shadow: 0 0 10px rgba(106, 46, 209, 0.3); }
.players li.offline { opacity: 0.4; }
.players .pl-name { font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; }
.players .pl-tag { font-size: 11px; color: var(--lav); font-weight: 800; letter-spacing: 0.1em; }
.players .pl-score { color: var(--gold); font-weight: 800; }

/* ---- Stepper (self-bet + call amounts) ---- */
.stepper { display: flex; align-items: center; gap: 12px; justify-content: center; }
.stepper button {
  width: 56px; height: 56px; border-radius: 14px; border: 2px solid rgba(180,151,245,0.6);
  background: var(--panel); color: var(--white); font-size: 28px; font-weight: 900; cursor: pointer;
}
.stepper button:disabled { opacity: 0.35; }
.stepper .amount { color: var(--gold); font-size: 34px; font-weight: 900; min-width: 120px; text-align: center; text-shadow: 0 0 8px rgba(255,217,119,0.5); }
.meter { text-align: center; color: var(--muted); font-size: 13px; }
.meter b { color: var(--white); }
.bounds { text-align: center; color: var(--muted); font-size: 12px; letter-spacing: 0.05em; }

/* ---- Choice buttons (answer) ---- */
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--panel); border: 2px solid rgba(180,151,245,0.4); border-radius: 14px;
  padding: 16px; color: var(--white); font-size: 17px; font-weight: 700; cursor: pointer; width: 100%;
}
.choice .key {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  background: rgba(180,151,245,0.15); color: var(--lav); font-weight: 900;
}
.choice.chosen { border-color: var(--grape); box-shadow: 0 0 14px rgba(106,46,209,0.4); }
.choice.correct { border-color: var(--green); box-shadow: 0 0 14px rgba(46,201,139,0.5); }
.choice.correct .key { background: rgba(46,201,139,0.25); color: var(--green); }
.choice.wrong-pick { border-color: var(--red); opacity: 0.85; }
.prompt { font-size: 19px; font-weight: 800; line-height: 1.25; text-align: center; }

/* ---- Opponent calls ---- */
.call-row {
  background: var(--panel); border: 1.5px solid rgba(180,151,245,0.35); border-radius: 14px; padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.call-row .opp { font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; }
.sides { display: flex; gap: 8px; }
.side {
  flex: 1; padding: 12px; border-radius: 10px; border: 2px solid rgba(143,143,168,0.4);
  background: transparent; color: var(--muted); font-weight: 800; text-transform: uppercase; cursor: pointer; font-size: 14px;
}
.side.sel-right { border-color: var(--green); color: var(--green); background: rgba(46,201,139,0.12); }
.side.sel-wrong { border-color: var(--red); color: var(--red); background: rgba(255,91,122,0.12); }
.call-amt { display: flex; align-items: center; gap: 10px; justify-content: center; }
.call-amt button {
  width: 44px; height: 44px; border-radius: 10px; border: 2px solid rgba(180,151,245,0.5);
  background: var(--panel); color: var(--white); font-size: 22px; font-weight: 900; cursor: pointer;
}
.call-amt button:disabled { opacity: 0.35; }
.call-amt .amt { color: var(--gold); font-weight: 900; font-size: 20px; min-width: 80px; text-align: center; }

/* The spectrum types stack extra bet layers inside one opponent row: the band
   call, the over/under, and (numeric only) a single room-level duel below.
   Three layers is real cognitive load on a phone, so each layer is labelled and
   an un-opted-in one dims rather than disappears. */
.call-head { display: flex; flex-direction: column; gap: 2px; }
.call-head .opp-answer {
  color: var(--lav); font-size: 13px; font-weight: 700; letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}
.layer { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid rgba(180,151,245,0.18); }
.layer-name { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 800; }
.call-amt.dim { opacity: 0.35; }

.duel-box {
  background: var(--panel); border: 1.5px solid rgba(255,217,119,0.4); border-radius: 14px;
  padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.duel-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.duel-pick {
  flex: 1 1 40%; padding: 12px; border-radius: 10px; border: 2px solid rgba(143,143,168,0.4);
  background: transparent; color: var(--muted); font-weight: 800; text-transform: uppercase;
  cursor: pointer; font-size: 14px;
}
.duel-pick.chosen { border-color: var(--gold); color: var(--gold); background: rgba(255,217,119,0.12); }

/* ---- New question types ---- */
/* The rule that defines "right" for this question, shown from the self-bet phase
   on — you're betting on landing inside it before you've seen the question. */
.qtype-note {
  text-align: center; color: var(--lav); font-size: 13px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.06em;
  border: 1px dashed rgba(180,151,245,0.45); border-radius: 10px; padding: 6px 10px;
}
.media-cue {
  text-align: center; font-size: 15px; font-weight: 800; color: var(--gold);
  letter-spacing: 0.04em;
}
.choices.two-up { flex-direction: row; }
.choices.two-up .choice { flex: 1; justify-content: center; text-align: center; min-height: 96px; font-size: 17px; }

/* Numeric: slider or pad, with one big readout above either. */
.readout {
  text-align: center; color: var(--gold); font-size: 40px; font-weight: 900;
  text-shadow: 0 0 10px rgba(255,217,119,0.45); letter-spacing: 0.01em;
}
.readout.locked { opacity: 0.75; }
.num-slider { width: 100%; height: 44px; accent-color: var(--grape); }
.nudge { display: flex; gap: 8px; }
.nudge button {
  flex: 1; padding: 12px 0; border-radius: 10px; border: 2px solid rgba(180,151,245,0.5);
  background: var(--panel); color: var(--white); font-weight: 900; font-size: 15px; cursor: pointer;
}
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.numpad button {
  padding: 16px 0; border-radius: 12px; border: 2px solid rgba(180,151,245,0.4);
  background: var(--panel); color: var(--white); font-size: 22px; font-weight: 800; cursor: pointer;
}

/* Count: a private running tally plus the log of what you've thrown at it. */
.tally {
  text-align: center; color: var(--green); font-size: 44px; font-weight: 900;
  text-shadow: 0 0 12px rgba(46,201,139,0.45);
}
.count-form { display: flex; gap: 8px; }
.count-input {
  flex: 1; padding: 14px; border-radius: 12px; font-size: 17px;
  border: 2px solid rgba(180,151,245,0.5); background: var(--panel); color: var(--white);
}
.count-form .btn { width: auto; padding: 0 18px; }
.count-log { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.count-log li {
  display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 8px;
  font-size: 14px; background: rgba(10,10,18,0.7); border: 1px solid rgba(143,143,168,0.25);
}
.count-log li.hit { border-color: var(--green); color: var(--green); }
.count-log li.miss { color: var(--muted); }
.count-log li.dupe { color: var(--gold); border-color: rgba(255,217,119,0.35); }
.count-log .mark { font-weight: 900; }

/* Ordering: drag-to-reorder tiles (arrows are the fallback path). */
.order-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.order-tile {
  display: flex; align-items: center; gap: 10px; padding: 12px;
  background: var(--panel); border: 2px solid rgba(180,151,245,0.4); border-radius: 12px;
  touch-action: none;   /* we handle the drag ourselves via pointer events */
  user-select: none;
}
.order-tile.dragging { border-color: var(--gold); box-shadow: 0 0 16px rgba(255,217,119,0.4); opacity: 0.9; }
.order-tile .rank {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 8px; display: grid; place-items: center;
  background: rgba(180,151,245,0.18); color: var(--lav); font-weight: 900; font-size: 14px;
}
.order-tile .order-label { flex: 1; font-weight: 700; font-size: 15px; }
.order-arrows { display: flex; flex-direction: column; gap: 2px; }
.order-arrows button {
  width: 34px; height: 22px; border-radius: 6px; border: 1px solid rgba(180,151,245,0.5);
  background: transparent; color: var(--lav); font-size: 11px; cursor: pointer; line-height: 1;
}
.order-arrows button:disabled { opacity: 0.25; }
.order-list.locked .order-tile { opacity: 0.8; }

/* Predict: the Subject's over/under line on the room. */
.line-row { display: flex; align-items: center; gap: 12px; justify-content: center; }
.line-row button {
  width: 52px; height: 52px; border-radius: 12px; border: 2px solid rgba(180,151,245,0.5);
  background: var(--panel); color: var(--white); font-size: 26px; font-weight: 900; cursor: pointer;
}
.line-row button:disabled { opacity: 0.35; }
.line-row .amount {
  color: var(--lav); font-size: 44px; font-weight: 900; min-width: 90px; text-align: center;
  text-shadow: 0 0 10px rgba(180,151,245,0.5);
}

/* ---- Reveal ---- */
.reveal-result {
  text-align: center; padding: 18px; border-radius: 16px; font-weight: 900;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.reveal-result.win { background: rgba(46,201,139,0.14); border: 2px solid var(--green); color: var(--green); }
.reveal-result.lose { background: rgba(255,91,122,0.12); border: 2px solid var(--red); color: var(--red); }
.reveal-result .delta { display: block; font-size: 30px; margin-top: 4px; }
.reveal-answer { text-align: center; font-size: 16px; color: var(--muted); }
.reveal-answer b { color: var(--white); }
.standings { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.standings li { display: flex; justify-content: space-between; background: var(--panel); border-radius: 10px; padding: 10px 12px; border: 1px solid rgba(180,151,245,0.25); }
.standings li.self { border-color: var(--grape); }
.standings li.winner { border-color: var(--gold); box-shadow: 0 0 12px rgba(255,217,119,0.4); }
.standings .rank { color: var(--muted); font-weight: 800; margin-right: 8px; }
.standings .st-score { color: var(--gold); font-weight: 800; }

/* ---- Countdown strip ---- */
.timer-strip { display: flex; align-items: center; gap: 10px; }
.timer-strip .timer-bar {
  flex: 1; height: 10px; border-radius: 5px; background: #b9bdcf33;
  border: 1px solid rgba(180,151,245,0.3); overflow: hidden;
}
.timer-strip .timer-bar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--lav), var(--grape));
  box-shadow: 0 0 8px rgba(180,151,245,0.7);
  transition: width 1s linear;
}
.timer-strip .timer-num { color: var(--muted); font-weight: 800; font-size: 14px; min-width: 34px; text-align: right; }
.timer-strip.urgent .timer-bar i { background: var(--red); box-shadow: 0 0 8px rgba(255,91,122,0.8); }
.timer-strip.urgent .timer-num { color: var(--red); }

/* ---- Reconnect overlay ---- */
.reconnect {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(5,5,8,0.86); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.reconnect-card {
  background: var(--panel); border: 2px solid rgba(180,151,245,0.6); border-radius: 18px;
  padding: 28px 24px; text-align: center; max-width: 340px; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  box-shadow: 0 0 24px rgba(180,151,245,0.3);
}
.reconnect-card p { font-size: 18px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.reconnect-card .btn { width: auto; padding: 12px 22px; }

/* ---- Finale ---- */
.finale-banner {
  text-align: center; font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em;
  font-size: 16px; padding: 12px; border-radius: 12px;
  background: linear-gradient(90deg, rgba(180,151,245,0.16), rgba(106,46,209,0.16));
  border: 2px solid var(--gold); color: var(--gold);
  box-shadow: 0 0 14px rgba(255,217,119,0.35);
}

/* ---- Toast (transient errors) ---- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: rgba(255,91,122,0.16); border: 2px solid var(--red); color: #ffd0d8;
  padding: 12px 18px; border-radius: 12px; font-weight: 700; z-index: 50; max-width: 90%;
  box-shadow: 0 0 16px rgba(255,91,122,0.4);
}

/* ---- Auth (optional sign-in on the join screen) ---- */
.auth-bar { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.auth-who b { color: var(--white); }
.auth-link { background: none; border: none; color: var(--lav); font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; cursor: pointer; padding: 4px 2px; }
.auth-link:active { opacity: 0.7; }
.signin-panel { display: flex; flex-direction: column; gap: 10px; background: var(--panel); border: 1px solid rgba(180, 151, 245, 0.3); border-radius: 14px; padding: 14px; }
.auth-email { background: var(--bg-2); border: 2px solid rgba(180, 151, 245, 0.55); border-radius: 12px; color: var(--white); font-size: 16px; padding: 12px; }
.hint.dim { opacity: 0.6; font-size: 12px; }

/* ---- Modal (player stats) ---- */
.modal { position: fixed; inset: 0; background: rgba(5, 5, 10, 0.86); display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 50; }
.modal-card { background: linear-gradient(180deg, #171226, #0d0a16); border: 1px solid rgba(180, 151, 245, 0.4); border-radius: 18px; padding: 22px; width: 100%; max-width: 420px; max-height: 88vh; overflow-y: auto; box-shadow: 0 0 40px rgba(106, 46, 209, 0.4); position: relative; }
.modal-title { font-size: 20px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; text-align: center; margin-bottom: 14px; }
.modal-close { position: absolute; top: 12px; right: 14px; background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat-tile { background: var(--panel); border: 1px solid rgba(180, 151, 245, 0.25); border-radius: 12px; padding: 12px 6px; text-align: center; }
.stat-val { font-size: 20px; font-weight: 800; color: var(--lav); }
.stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-top: 4px; }
.auth-pitch { flex-basis: 100%; text-align: center; font-size: 12.5px; line-height: 1.55; color: var(--muted); margin-top: 2px; padding: 10px 12px; background: rgba(180, 151, 245, 0.07); border: 1px solid rgba(180, 151, 245, 0.22); border-radius: 12px; }
.auth-pitch b { color: var(--lav); font-weight: 800; }
.age-check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--white); cursor: pointer; user-select: none; padding: 4px 0; }
.age-check input { width: 20px; height: 20px; accent-color: var(--grape); flex: none; }
