/* gameroom.css — the room surface. Dark, plain, on-brand. Built to read at a
   glance across a noisy room: big code, big names, big leaderboard. Additive
   state: color + icon + text together, never color alone (universal design). */

:root {
  --bg: #0b1020;
  --panel: #141a2e;
  --panel-2: #1b2238;
  --ink: #e8ebf5;
  --muted: #9aa3bd;
  --line: #283150;
  --accent: #4f8cff;
  --accent-2: #7cc4ff;
  --good: #4ade80;
  --warn: #fbbf24;
  --gold: #ffd25c;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #16203b 0%, var(--bg) 60%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); }

.gr-wrap { max-width: 960px; margin: 0 auto; padding: 20px 16px 40px; min-height: 100%; }
.gr-screen { display: none; }
.gr-screen.is-active { display: block; animation: grfade .25s ease; }
@keyframes grfade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.gr-eyebrow { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-2); margin: 0 0 6px; }
.gr-h1 { font-size: clamp(26px, 6vw, 40px); margin: 0 0 6px; line-height: 1.05; }
.gr-sub { color: var(--muted); margin: 0 0 22px; font-size: 16px; }

.gr-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.gr-card + .gr-card { margin-top: 16px; }

.gr-field { display: block; margin: 0 0 14px; }
.gr-field label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.gr-input {
  width: 100%; padding: 14px 16px; font-size: 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
}
.gr-input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.gr-input--code { text-transform: uppercase; letter-spacing: .35em; text-align: center; font-weight: 700; font-size: 30px; font-family: "JetBrains Mono", ui-monospace, monospace; }

.gr-btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 0; cursor: pointer; font-size: 17px; font-weight: 600;
  padding: 14px 22px; border-radius: 12px; background: var(--accent); color: #fff;
  transition: transform .06s ease, background .15s ease;
}
.gr-btn:hover { background: #3f7af0; }
.gr-btn:active { transform: translateY(1px); }
.gr-btn[disabled] { opacity: .5; cursor: not-allowed; }
.gr-btn--ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.gr-btn--big { width: 100%; font-size: 19px; padding: 18px; }
.gr-btn--go { background: var(--good); color: #06231a; }
.gr-row { display: flex; gap: 12px; flex-wrap: wrap; }
.gr-row > * { flex: 1; }

/* Room code + QR */
.gr-codeblock { text-align: center; }
.gr-code { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: clamp(48px, 16vw, 96px); font-weight: 800; letter-spacing: .12em; line-height: 1; color: #fff; }
.gr-codehint { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.gr-qr { margin: 16px auto 0; width: 180px; height: 180px; background: #fff; border-radius: 14px; padding: 10px; }
.gr-qr img { width: 100%; height: 100%; image-rendering: pixelated; }

/* Roster */
.gr-roster { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.gr-player { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.gr-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.gr-player.is-off { opacity: .45; }
.gr-player .gr-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gr-host-badge { font-size: 11px; color: var(--gold); border: 1px solid var(--gold); border-radius: 999px; padding: 1px 7px; margin-left: auto; }

/* Game picker */
.gr-games { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gr-game { text-align: left; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; color: var(--ink); transition: border-color .15s; }
.gr-game:hover { border-color: var(--accent); }
.gr-game.is-picked { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.gr-game__emoji { font-size: 30px; }
.gr-game__name { font-weight: 700; margin: 6px 0 2px; }
.gr-game__blurb { font-size: 12px; color: var(--muted); }
.gr-game.is-locked { opacity: .5; cursor: not-allowed; }
.gr-game .gr-lock { font-size: 11px; color: var(--gold); }

/* Play screen */
.gr-playgrid { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
@media (max-width: 760px) { .gr-playgrid { grid-template-columns: 1fr; } }
.gr-stage { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 3 / 4; border: 1px solid var(--line); }
.gr-stage iframe { width: 100%; height: 100%; border: 0; display: block; }
.gr-timer { position: absolute; top: 10px; right: 12px; background: rgba(0,0,0,.6); color: #fff; font-weight: 700; font-family: "JetBrains Mono", monospace; padding: 6px 12px; border-radius: 10px; font-size: 18px; }
.gr-countdown { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(8,12,24,.86); z-index: 5; }
.gr-countdown__n { font-size: clamp(80px, 30vw, 180px); font-weight: 900; color: #fff; animation: grpop .9s ease; }
@keyframes grpop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Leaderboard */
.gr-lb { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.gr-lb h3 { margin: 0 0 10px; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.gr-lb ol { list-style: none; margin: 0; padding: 0; }
.gr-lb li { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 10px; }
.gr-lb li + li { margin-top: 2px; }
.gr-lb li.me { background: rgba(79,140,255,.14); }
.gr-lb .rk { width: 26px; text-align: center; font-weight: 800; color: var(--muted); }
.gr-lb li:nth-child(1) .rk { color: var(--gold); }
.gr-lb .nm { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gr-lb .sc { font-family: "JetBrains Mono", monospace; font-variant-numeric: tabular-nums; color: var(--accent-2); }
.gr-lb .pts { font-size: 12px; color: var(--good); width: 42px; text-align: right; }

/* Banners + misc */
.gr-banner { background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px; padding: 12px 14px; color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.gr-banner b { color: var(--ink); }
.gr-pill { display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.gr-pill--pro { color: var(--gold); border-color: var(--gold); }
.gr-status { font-size: 13px; color: var(--muted); margin: 12px 0 0; min-height: 18px; }
.gr-section-title { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; }
.gr-section-title h2 { font-size: 18px; margin: 0; }
.gr-muted { color: var(--muted); }
.gr-center { text-align: center; }
.gr-winner { font-size: 22px; font-weight: 800; }
.gr-winner .gr-medal { font-size: 30px; }
.gr-hide { display: none !important; }

/* ---- Tournament + tic-tac-toe board ---------------------------------- */
.tt-card { text-align: center; }
.tt-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 6px; }
.tt-vs { font-weight: 700; font-size: 17px; }
.tt-gameno { font-size: 12px; color: var(--muted); font-family: "JetBrains Mono", monospace; }
/* Touch / Sign segmented toggle — touch is the default; sign is the add-on. */
.tt-modes { display: inline-flex; gap: 4px; padding: 4px; margin: 0 auto 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; }
.tt-modebtn { border: 0; background: none; color: var(--muted); cursor: pointer; font: 600 13px/1 inherit; padding: 8px 16px; border-radius: 999px; transition: background .15s ease, color .15s ease; }
.tt-modebtn.is-on { background: var(--accent); color: #fff; }
.tt-modebtn:not(.is-on):hover { color: var(--ink); }
.tt-turn { font-weight: 700; color: var(--accent-2); min-height: 22px; margin: 0 0 12px; }
.tt-turn.is-mine { color: var(--good); }
.tt-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 320px; margin: 0 auto; aspect-ratio: 1; }
.tt-cell {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(34px, 12vw, 64px); font-weight: 800; cursor: default; color: var(--ink);
  transition: transform .08s ease, background .15s ease, box-shadow .15s ease; user-select: none;
}
.tt-cell.x { color: var(--accent-2); }
.tt-cell.o { color: var(--gold); }
.tt-cell.playable { cursor: pointer; }
.tt-cell.playable:hover { background: #232c48; box-shadow: 0 0 0 2px var(--accent) inset; }
.tt-cell.playable:active { transform: scale(.96); }
.tt-cell.win { background: rgba(74,222,128,.18); box-shadow: 0 0 0 2px var(--good) inset; }
.tt-cell.placed { animation: ttpop .18s ease; }
@keyframes ttpop { from { transform: scale(.5); opacity: .3; } to { transform: scale(1); opacity: 1; } }
.tt-banner { margin: 14px auto 0; max-width: 340px; padding: 12px 14px; border-radius: 12px; font-weight: 700; }
.tt-banner.win { background: rgba(74,222,128,.16); color: var(--good); }
.tt-banner.lose { background: rgba(255,92,92,.14); color: #ff8a8a; }
.tt-banner.draw { background: rgba(251,191,36,.14); color: var(--warn); }
.tt-hint { margin-top: 12px; }
/* Sign mode: one square camera view (yourself + the live board overlay). */
.tt-sign { margin: 0 auto; aspect-ratio: 1; width: 100%; max-width: 360px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #000; }
.tt-sign iframe { width: 100%; height: 100%; border: 0; display: block; }
.tt-trophy { font-size: 72px; animation: ttbob 2s ease-in-out infinite; }
@keyframes ttbob { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-8px) rotate(4deg); } }

/* ---- Trivia duel board ----------------------------------------------- */
.tq-card { text-align: left; }
.tq-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 6px; gap: 12px; }
.tq-vs { font-weight: 700; font-size: 17px; }
.tq-progress { font-size: 12px; color: var(--muted); font-family: "JetBrains Mono", monospace; white-space: nowrap; }
.tq-scoreline { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; }
.tq-score { font-family: "JetBrains Mono", monospace; font-weight: 800; font-size: 22px; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.tq-score .tq-scoreside { font-family: -apple-system, "Inter", sans-serif; font-weight: 700; font-size: 13px; color: var(--muted); }
.tq-cat { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.tq-sudden { background: rgba(251,191,36,.16); color: var(--warn); border-radius: 10px; padding: 8px 12px; font-weight: 700; font-size: 14px; margin: 0 0 12px; text-align: center; }
.tq-question { font-size: clamp(18px, 4.5vw, 24px); font-weight: 700; line-height: 1.25; margin: 0 0 16px; }
.tq-options { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 480px) { .tq-options { grid-template-columns: 1fr 1fr; } }
.tq-opt {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; color: var(--ink); font-size: 16px; font-weight: 600; cursor: default;
  transition: transform .08s ease, background .15s ease, box-shadow .15s ease;
}
.tq-opt .tq-letter {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  background: var(--panel); border: 1px solid var(--line); font-family: "JetBrains Mono", monospace; font-weight: 800; font-size: 15px; color: var(--muted);
}
.tq-opt .tq-text { flex: 1; }
.tq-opt .tq-ic { margin-left: auto; font-weight: 800; font-size: 18px; }
.tq-opt.tappable { cursor: pointer; }
.tq-opt.tappable:hover { background: #232c48; box-shadow: 0 0 0 2px var(--accent) inset; }
.tq-opt.tappable:active { transform: scale(.98); }
.tq-opt.picked { box-shadow: 0 0 0 2px var(--accent) inset; }
.tq-opt.picked .tq-letter { color: var(--accent-2); border-color: var(--accent); }
.tq-opt.picked .tq-ic { color: var(--accent-2); }
.tq-opt.correct { background: rgba(74,222,128,.16); box-shadow: 0 0 0 2px var(--good) inset; }
.tq-opt.correct .tq-letter { color: var(--good); border-color: var(--good); }
.tq-opt.correct .tq-ic { color: var(--good); }
.tq-opt.wrong { background: rgba(255,92,92,.12); box-shadow: 0 0 0 2px #ff8a8a inset; }
.tq-opt.wrong .tq-ic { color: #ff8a8a; }
.tq-opt.opp { outline: 2px dashed var(--gold); outline-offset: 2px; }
.tq-opt[disabled] { cursor: default; }
.tq-wait { margin: 14px 0 0; background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px; padding: 12px 14px; color: var(--muted); font-size: 14px; }

/* ---- Party Pong scorekeeper (played in person) ----------------------- */
/* Lobby table settings (cups + pace) */
.pong-opts { margin: 4px 0 8px; }
.pong-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 10px; }
.pong-opt__label { font-size: 13px; color: var(--muted); }
.pong-seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; flex-wrap: wrap; }
.pong-seg button { border: 0; background: none; color: var(--muted); cursor: pointer; font: 600 13px/1 inherit; padding: 8px 14px; border-radius: 999px; transition: background .15s ease, color .15s ease; }
.pong-seg button.is-on { background: var(--accent); color: #fff; }
.pong-seg button:not(.is-on):hover { color: var(--ink); }

/* Match card — the scorekeeper for one table */
.pong-card { text-align: center; }
.pong-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; gap: 12px; }
.pong-vs { font-weight: 700; font-size: 17px; }
.pong-headright { display: inline-flex; align-items: center; gap: 8px; }
.pong-table { font-size: 12px; font-weight: 800; color: var(--gold); border: 1px solid var(--gold); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.pong-clock { font-family: "JetBrains Mono", monospace; font-weight: 800; font-size: 20px; color: var(--accent-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pong-shot { border-radius: 10px; padding: 8px 12px; font-weight: 700; font-size: 14px; margin: 0 0 12px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.pong-shot.is-warn { background: rgba(251,191,36,.16); border-color: var(--warn); color: var(--warn); }
.pong-shot.is-over { background: rgba(255,92,92,.16); border-color: #ff8a8a; color: #ff8a8a; }

.pong-tables { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 620px) { .pong-tables { grid-template-columns: 1fr 1fr; } }
.pong-side { background: var(--panel-2); border: 1px solid var(--line); border-radius: 16px; padding: 14px 12px 12px; }
.pong-side--target { box-shadow: 0 0 0 1px rgba(255,210,92,.3) inset; }
.pong-side__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 0 12px; }
.pong-side__name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pong-side__left { font-family: "JetBrains Mono", monospace; font-weight: 800; color: var(--accent-2); font-variant-numeric: tabular-nums; font-size: 14px; white-space: nowrap; }
.pong-side__role { font-size: 12px; color: var(--muted); margin-top: 12px; }

/* The rack — a tidy triangle of cups (tap one the moment it goes down) */
.pong-rack { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pong-row { display: flex; justify-content: center; gap: 8px; }
.pong-cup {
  position: relative; flex: 0 0 auto; padding: 0; cursor: pointer;
  width: clamp(32px, 10.5vw, 50px); height: clamp(32px, 10.5vw, 50px); border-radius: 50%;
  border: 2px solid var(--accent-2); background: radial-gradient(circle at 50% 36%, #21314f 0%, #16203b 72%);
  box-shadow: inset 0 0 0 3px rgba(124,196,255,.18);
  transition: transform .08s ease, opacity .15s ease, box-shadow .15s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.pong-cup:hover { box-shadow: inset 0 0 0 3px rgba(124,196,255,.18), 0 0 0 2px var(--accent); }
.pong-cup:active { transform: scale(.9); }
.pong-cup.is-down { border-color: var(--line); border-style: dashed; background: transparent; opacity: .5; box-shadow: none; }
.pong-cup.is-down:hover { box-shadow: 0 0 0 2px var(--line); }
.pong-cup__x { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--good); font-weight: 800; font-size: clamp(15px, 4.6vw, 22px); }
.pong-cup.is-locked { cursor: default; }
.pong-cup.is-locked:hover { box-shadow: inset 0 0 0 3px rgba(124,196,255,.18); }
/* The target rack reads warmer — you're aiming at it. */
.pong-side--target .pong-cup:not(.is-down) { border-color: var(--gold); box-shadow: inset 0 0 0 3px rgba(255,210,92,.18); }
.pong-side--target .pong-cup:not(.is-down):hover { box-shadow: inset 0 0 0 3px rgba(255,210,92,.18), 0 0 0 2px var(--gold); }

.pong-actions { margin: 16px 0 0; }
.pong-bumpbtn { width: auto; padding: 10px 18px; font-size: 14px; }
.pong-confirm { margin: 16px 0 0; background: rgba(74,222,128,.1); border: 1px solid var(--good); border-radius: 14px; padding: 14px; }
.pong-confirm__msg { font-weight: 800; font-size: 17px; margin: 0 0 12px; color: var(--good); }

/* Bracket / pools */
.tour-round { margin: 0 0 16px; }
.tour-round h4 { margin: 0 0 8px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tour-match { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 0 0 8px; }
.tour-match.live { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.tour-match.mine { border-left: 3px solid var(--gold); }
.tour-seat { display: flex; align-items: center; gap: 8px; }
.tour-seat.won { font-weight: 800; }
.tour-seat.lost { color: var(--muted); opacity: .6; }
.tour-seat .chk { color: var(--good); }
.tour-mlabel { grid-column: 1 / -1; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.tour-mstate { align-self: center; font-size: 11px; color: var(--accent-2); }
.tour-pools { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

/* "Now playing" strip — glanceable matchups + round progress at the top of the
   tournament screen, so who-plays-who and the schedule read without scrolling. */
.tour-now { padding: 14px 16px; margin-bottom: 14px; }
.tour-now__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 10px; }
.tour-now__round { font-weight: 800; font-size: 15px; }
.tour-now__prog { font-size: 12px; color: var(--muted); font-family: "JetBrains Mono", monospace; white-space: nowrap; }
.tour-now__matches { display: flex; flex-wrap: wrap; gap: 8px; }
.tour-now__idle { font-size: 13px; color: var(--muted); }
.tour-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.tour-chip.mine { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.tour-chip__p { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tour-chip__vs { font-family: "JetBrains Mono", monospace; font-weight: 800; font-size: 12px; color: var(--accent-2); }
.tour-chip.mine .tour-chip__vs { color: var(--gold); }
.tour-chip__tbl { font-family: "JetBrains Mono", monospace; font-weight: 800; font-size: 11px; color: var(--gold); border: 1px solid rgba(255,210,92,.5); border-radius: 6px; padding: 1px 5px; }

/* Floating "beat" toast — a new match starting / a match result. Non-blocking
   (pointer-events:none) so it never eats a tap; auto-dismisses, fast pace kept. */
.gr-toast {
  position: fixed; left: 50%; top: 14px; transform: translate(-50%, -10px);
  z-index: 60; max-width: min(92vw, 460px); pointer-events: none; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 11px 18px; font-weight: 700; font-size: 15px; color: var(--ink);
  opacity: 0; transition: opacity .25s ease, transform .25s ease;
}
.gr-toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.gr-toast--go { border-color: var(--accent); }
.gr-toast--win { border-color: var(--good); color: var(--good); }
.gr-toast--lose { border-color: #ff8a8a; }

@media (prefers-reduced-motion: reduce) { .tt-trophy, .tt-cell.placed { animation: none; } .gr-toast { transition: opacity .2s ease; } }

/* ====================================================================
   Rock Paper Scissors — lobby options, duel arena, battle board.
   Bold/neon to match the dark room theme; all motion is gated by the
   prefers-reduced-motion block at the very bottom of this file.
   ==================================================================== */

/* --- lobby options (bracket/battle + best-of) --- */
.rps-opts { margin: 4px 0 14px; display: flex; flex-direction: column; gap: 12px; }
.rps-opt { display: flex; flex-direction: column; gap: 6px; }
.rps-opt__label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.rps-seg { display: inline-flex; flex-wrap: wrap; gap: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.rps-seg button { border: 0; background: none; color: var(--muted); cursor: pointer; font: 600 13px/1 inherit; padding: 9px 16px; border-radius: 999px; transition: background .15s ease, color .15s ease; }
.rps-seg button.is-on { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(79,140,255,.4); }
.rps-seg button:not(.is-on):hover { color: var(--ink); }

/* --- the card --- */
.rps-card { text-align: center; }
.rps-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rps-vs { font-weight: 700; font-size: 1.05rem; }
.rps-round { font-size: 12px; color: var(--muted); letter-spacing: .04em; white-space: nowrap; }
.rps-scoreline { display: flex; align-items: baseline; justify-content: center; gap: 12px; margin: 6px 0 10px; }
.rps-score { font: 800 1.9rem/1 "JetBrains Mono", ui-monospace, monospace; letter-spacing: .04em; color: var(--gold); }
.rps-score b { color: #fff; }
.rps-ties { font-size: 12px; }
.rps-modes { display: inline-flex; gap: 4px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px; margin: 0 auto 12px; }

/* --- arena: the clash + the countdown --- */
.rps-arena { position: relative; border-radius: 16px; padding: 20px 14px; margin-bottom: 14px; overflow: hidden;
  background: radial-gradient(120% 120% at 50% -10%, rgba(79,140,255,.18) 0%, rgba(20,26,46,.0) 55%), linear-gradient(180deg, #0e1428 0%, #0a0f1f 100%);
  border: 1px solid var(--line); min-height: 168px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.rps-arena[data-phase="throwing"]::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(115deg, rgba(124,196,255,.05) 0 12px, transparent 12px 28px); animation: rps-scan 1.1s linear infinite; }
@keyframes rps-scan { to { background-position: 56px 0; } }

.rps-clash { display: flex; align-items: center; justify-content: center; gap: 14px; position: relative; z-index: 1; }
.rps-hand { font-size: clamp(48px, 16vw, 84px); line-height: 1; filter: drop-shadow(0 6px 16px rgba(0,0,0,.55)); }
.rps-hand--me { transform-origin: bottom right; }
.rps-hand--opp { transform-origin: bottom left; scale: -1 1; } /* mirror the opponent's hand to face yours */
.rps-arena[data-phase="throwing"] .rps-hand--me { animation: rps-shake-r .5s ease-in-out infinite; }
.rps-arena[data-phase="throwing"] .rps-hand--opp { animation: rps-shake-l .5s ease-in-out infinite; }
.rps-arena[data-phase="revealed"] .rps-hand { animation: rps-slam .42s cubic-bezier(.2,1.4,.5,1); }
@keyframes rps-shake-r { 0%,100% { transform: rotate(-14deg) translateY(-6px); } 50% { transform: rotate(2deg) translateY(2px); } }
@keyframes rps-shake-l { 0%,100% { transform: rotate(14deg) translateY(-6px); } 50% { transform: rotate(-2deg) translateY(2px); } }
@keyframes rps-slam { 0% { transform: scale(.4) translateY(-22px); opacity: .2; } 70% { transform: scale(1.18); } 100% { transform: scale(1); opacity: 1; } }
.rps-bolt { font: 800 1.05rem/1 "JetBrains Mono", monospace; color: var(--gold); letter-spacing: .08em; text-shadow: 0 0 14px rgba(255,210,92,.6); }

.rps-count { position: relative; z-index: 1; font: 800 clamp(40px, 14vw, 72px)/1 "JetBrains Mono", ui-monospace, monospace; color: #fff; text-shadow: 0 0 22px rgba(124,196,255,.7); animation: rps-pop .6s ease-out; }
.rps-count--shoot { color: var(--gold); text-shadow: 0 0 30px rgba(255,210,92,.9); animation: rps-shoot .35s ease-out; letter-spacing: .02em; }
@keyframes rps-pop { 0% { transform: scale(1.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes rps-shoot { 0% { transform: scale(.5) rotate(-6deg); } 60% { transform: scale(1.35) rotate(3deg); } 100% { transform: scale(1) rotate(0); } }

.rps-outcome { position: relative; z-index: 1; font-weight: 800; font-size: 1.15rem; padding: 6px 16px; border-radius: 999px; animation: rps-pop .4s ease-out; }
.rps-outcome.win { color: var(--good); background: rgba(74,222,128,.14); }
.rps-outcome.lose { color: #ff8a8a; background: rgba(255,92,92,.12); }
.rps-outcome.tie { color: var(--warn); background: rgba(251,191,36,.14); }

/* --- the camera sign pad --- */
.rps-sign { position: relative; width: 100%; max-width: 360px; margin: 0 auto 12px; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #000; }
.rps-sign iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* --- the throw picker (touch) --- */
.rps-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 420px; margin: 0 auto; }
.rps-picker.is-locked { opacity: .55; }
.rps-throw { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border-radius: 14px; cursor: pointer;
  background: var(--panel-2); border: 2px solid var(--line); color: var(--ink); transition: transform .12s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.rps-throw:not(:disabled):hover { transform: translateY(-3px); border-color: var(--accent); }
.rps-throw:not(:disabled):active { transform: translateY(0) scale(.96); }
.rps-throw:disabled { cursor: default; }
.rps-throw.is-picked { border-color: var(--gold); background: rgba(255,210,92,.16); box-shadow: 0 0 0 2px rgba(255,210,92,.35), 0 10px 26px rgba(255,210,92,.22); }
.rps-throw__ic { font-size: clamp(30px, 9vw, 42px); line-height: 1; }
.rps-throw__lb { font-weight: 700; font-size: 13px; }

/* --- battle: everyone's throws + scoring --- */
.rps-arena--battle { min-height: 130px; }
.rps-throws { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.rps-throwcard { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 74px; padding: 10px 8px; border-radius: 12px; background: rgba(20,26,46,.7); border: 1px solid var(--line); }
.rps-throwcard.mine { border-color: var(--accent); }
.rps-throwcard.scored { border-color: var(--good); background: rgba(74,222,128,.12); }
.rps-throwcard.locked .rps-throwcard__hand { color: var(--good); }
.rps-throwcard__hand { font-size: 34px; line-height: 1; }
.rps-throwcard__nm { font-size: 11px; color: var(--muted); max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rps-throwcard__pt { font: 800 13px/1 "JetBrains Mono", monospace; color: var(--good); min-height: 13px; }

@media (max-width: 480px) { .rps-throw__lb { font-size: 12px; } .rps-hand { gap: 8px; } }

/* Motion off → freeze every RPS animation (countdown numbers still update via JS). */
@media (prefers-reduced-motion: reduce) {
  .rps-arena::before, .rps-hand, .rps-count, .rps-count--shoot, .rps-outcome { animation: none !important; }
}
