/* ===== Arcade: the neon scoreboard (docs/design.md). One look for this layout. ===== */
:root {
  --bg: #160B2E; --bg-deep: #0C0619; --sheet: #241547; --sheet-line: #3B2A66; --ink: #F1ECFF; --ink-muted: #A99CC9;
  --accent: #E23BFF; --accent-dark: #B71ED6; --highlight: #FFD84D; --text-on-bg: #CFC4EA; --on-accent: #12071F;
  --display: "Chakra Petch", "Trebuchet MS", Arial, sans-serif;
  --body: "Chakra Petch", "Trebuchet MS", Arial, sans-serif;
  --r-sheet: 0; --r-chip: 0; --r-btn: 0; --glow: 0 0 18px var(--accent); --text-glow: 0 0 24px var(--accent);
  --display-weight: 700; --display-heavy: 700; --sheet-rule: none; --brand: var(--ink);
}
:root {
  /* derived tints and fixed game colours */
  --bg-line: color-mix(in srgb, var(--text-on-bg) 24%, transparent);
  --bg-muted: color-mix(in srgb, var(--text-on-bg) 72%, transparent);
  --ink-10: color-mix(in srgb, var(--ink) 10%, transparent);
  --ink-35: color-mix(in srgb, var(--ink) 35%, transparent);
  --accent-12: color-mix(in srgb, var(--accent) 14%, transparent);
  --sheet-raise: color-mix(in srgb, var(--ink) 6%, var(--sheet));
  --red: #e53935; --red-light: #ef9a9a; --red-pale: #ffcdd2;
  --blue: #005aea; --blue-light: #5585e6; --blue-pale: #bbdefb;
  --purple: #9501e5; --purple-light: #d68afa; --purple-pale: #e1bee7;
  --green: #2e9e5b; --guess: #2f8fd8;
  --pill: color-mix(in srgb, var(--bg-deep) 84%, transparent);
  --pill-text: #fff;
  --out: #d9382b;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--body); font-size: 16px; line-height: 1.45; color: var(--text-on-bg); background: var(--bg); min-height: 100vh;
}
a { color: var(--highlight); }
button, input { font-family: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: var(--display-weight); line-height: 1; letter-spacing: -.01em; }
h2 { font-size: 44px; }
h3 { font-size: 26px; margin-top: 22px; margin-bottom: 8px; }
h4 { font-size: 22px; }
p { margin: 0 0 12px; max-width: 62ch; }
.muted { color: var(--bg-muted); }
.sheet .muted, .sheet-muted { color: var(--ink-muted); }
.error { border-left: 4px solid var(--accent); padding: 8px 12px; margin: 12px 0; color: #fff; background: var(--accent-12); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--highlight); outline-offset: 2px; }
kbd { font-family: var(--display); font-size: 15px; background: var(--ink-10); border: 1px solid var(--sheet-line); border-radius: 3px; padding: 1px 7px; }
.sheet kbd { color: var(--ink); }

/* ===== Screens ===== */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }
.screen:not(#game-screen).active { display: grid; align-content: center; justify-items: center;
  padding: 28px 20px 48px; }
/* the start console never re-centres when rows appear (feedback 3b) */
#start-screen.screen.active { align-content: start; padding-top: clamp(24px, 6vh, 72px); }
.screen:not(#game-screen).active > * { width: 100%; }
@media (max-width: 600px) { .screen:not(#game-screen).active { padding: 18px 16px 40px; } }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border-radius: var(--r-btn);
  border: 2px solid var(--bg-line); background: transparent; color: var(--text-on-bg); font-family: var(--display); font-weight: var(--display-weight);
  font-size: 22px; line-height: 1; text-decoration: none; letter-spacing: .01em;
}
.btn:hover { border-color: var(--text-on-bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: var(--glow); }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.big { width: 100%; padding: 18px 22px; font-size: 30px; }
.btn.small { padding: 7px 12px; font-size: 18px; }
.btn:disabled { opacity: .45; cursor: default; }
.sheet .btn, .modal .btn { color: var(--ink); border-color: var(--ink-35); }
.sheet .btn:hover, .modal .btn:hover { border-color: var(--ink); }
.sheet .btn.primary, .sheet .btn.primary:hover, .modal .btn.primary, .modal .btn.primary:hover { color: var(--on-accent); }
.sheet .btn.primary, .modal .btn.primary { border-color: var(--accent); }
.actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.actions .btn.big { flex: 1; }
.actions.row .btn { flex: 1; }
.link { background: none; border: none; color: var(--highlight); text-decoration: underline; padding: 0; font: inherit; }
.sheet .link { color: var(--ink); }

/* ===== Chips, toggles, sliders ===== */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 18px; border-radius: var(--r-chip); border: 2px solid var(--bg-line); background: transparent; color: var(--text-on-bg);
  font-family: var(--display); font-weight: var(--display-weight); font-size: 21px; line-height: 1;
}
.chip:hover { border-color: var(--text-on-bg); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: var(--glow); }
.chip:disabled { opacity: .35; cursor: default; border-color: var(--bg-line); }
.chips.cloud { height: auto; min-height: 0; overflow-y: auto; padding: 2px; align-content: start; }
.region-box { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 8px; height: 150px; }
.region-box .filter { margin-bottom: 0; }
.opt.ghost { visibility: hidden; }
.slider-row.ghost { opacity: .35; }
.chips.cloud .chip { font-size: 17px; padding: 6px 12px; }
.filter { width: 100%; margin-bottom: 8px; }
input[type=text] {
  width: 100%; padding: 12px 14px; border-radius: var(--r-btn); border: 2px solid var(--bg-line); background: var(--bg-deep); color: #fff;
  font-size: 17px;
}
input[type=text]::placeholder { color: color-mix(in srgb, var(--text-on-bg) 50%, transparent); }
.sheet input[type=text], .modal input[type=text] { background: var(--sheet-raise); color: var(--ink); border-color: var(--ink-35); }
.sheet input[type=text]::placeholder, .modal input[type=text]::placeholder { color: var(--ink-muted); }
.toggle {
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; border-radius: var(--r-chip); border: 2px solid var(--bg-line);
  background: transparent; color: var(--text-on-bg); font-family: var(--display); font-weight: var(--display-weight); font-size: 21px; line-height: 1;
}
.toggle .knob { width: 34px; height: 20px; border-radius: 999px; background: var(--bg-line); position: relative; transition: background .2s; flex: none; }
.toggle .knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle .state { font-family: var(--body); font-weight: 400; font-size: 14px; opacity: .7; }
.toggle[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-12); color: #fff; }
.toggle[aria-pressed="true"] .knob { background: var(--accent); }
.toggle[aria-pressed="true"] .knob::after { transform: translateX(14px); }
.toggle[aria-pressed="true"] .state { color: var(--accent); opacity: 1; }
.toggle[aria-pressed="false"] .knob::after { background: color-mix(in srgb, var(--text-on-bg) 55%, transparent); }
input[type=range] { width: 100%; accent-color: var(--accent); margin: 8px 0 0; }
.slider-row { display: flex; align-items: center; gap: 14px; }
.slider-row input[type=range] { flex: 1; margin: 0; }
.slider-row output { font-family: var(--display); font-weight: var(--display-weight); font-size: 30px; min-width: 88px; text-align: right; line-height: 1; color: #fff; }

/* ===== Start console ===== */
.console { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.25fr); gap: 48px; max-width: 1180px; margin: 0 auto; }
@media (max-width: 880px) { .console { grid-template-columns: 1fr; gap: 28px; } }
.brand h1 { font-size: clamp(64px, 9vw, 132px); font-weight: var(--display-heavy); line-height: .86; letter-spacing: -.02em; color: var(--brand); text-shadow: var(--text-glow); }
.brand h1 span { color: inherit; }
.brand .tag { margin: 18px 0 30px; font-size: 18px; max-width: 34ch; }
.tiles { display: grid; gap: 10px; }
.tile {
  display: grid; grid-template-columns: 1fr; text-align: left; padding: 14px 18px; border-radius: var(--r-btn); border: 2px solid var(--bg-line);
  background: transparent; color: var(--text-on-bg);
}
.tile:hover { border-color: var(--text-on-bg); }
.tile[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-12); color: #fff; box-shadow: var(--glow); }
.tile .t { font-family: var(--display); font-weight: var(--display-weight); font-size: 30px; line-height: 1; }
.tile .d { font-size: 14px; margin-top: 4px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.options { display: grid; gap: 22px; align-content: start; }
.opt { display: grid; grid-template-columns: 130px 1fr; gap: 16px; align-items: start; }
@media (max-width: 600px) { .opt { grid-template-columns: 1fr; gap: 6px; } }
.opt > .lbl { font-family: var(--display); font-weight: var(--display-weight); font-size: 24px; line-height: 1.1; padding-top: 8px; color: #fff; }
.opt .stack { display: grid; gap: 10px; }
.opt .inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cta { margin-top: 6px; }
.console .foot { grid-column: 1 / -1; font-size: 15px; }

/* ===== Sheets (results, lobbies, listings) ===== */
.sheet {
  background: var(--sheet); color: var(--ink); border-radius: var(--r-sheet); max-width: 960px; margin: 0 auto; overflow: hidden; position: relative;
  border-top: var(--sheet-rule); animation: sheet-in .45s cubic-bezier(.2,.8,.2,1) both;
}
.sheet.narrow { max-width: 520px; }
.sheet.wide { max-width: 1120px; }
.sheet .inner { padding: 22px 26px 26px; }
@media (max-width: 600px) { .sheet .inner { padding: 18px 16px 20px; } }
.sheet h2, .sheet h3 { color: var(--ink); }
.sheet .head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.sheet .kicker { font-size: 15px; color: var(--ink-muted); }
.sheet .lead { font-size: 18px; color: var(--ink-muted); margin: 0 0 14px; }
.sheet-map { width: 100%; height: 400px; background: #dfe6ea; }
.sheet-map.tall { height: clamp(420px, 66vh, 760px); }
.sheet-map.short { height: 260px; }
@media (max-width: 600px) { .sheet-map, .sheet-map.tall { height: 260px; } .sheet-map.short { height: 200px; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.pause-line { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--accent); width: 100%; transition: width linear; }
.band { margin: 0 0 12px; padding: 12px 16px; background: var(--out); color: #fff; border-radius: var(--r-btn); }
.band .band-title { font-family: var(--display); font-weight: var(--display-weight); font-size: 26px; line-height: 1.1; }
.band small { display: block; font-family: var(--body); font-weight: 400; font-size: 16px; margin-top: 4px; opacity: .95; }
.band-choice { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.band-choice .btn { flex: 1; color: #fff; border-color: rgba(255,255,255,.6); }
.band-choice .btn.primary { background: #fff; color: var(--out); border-color: #fff; box-shadow: none; }
.headline-sub { font-size: 17px; margin: -2px 0 12px; }
.next-line { margin-top: 14px; font-family: var(--display); font-weight: var(--display-weight); font-size: 20px; }
/* name box vs helper text (feedback 3g) */
.modal input[type=text] { outline-offset: 0; }
.modal-note { margin-top: 12px; }
.join-grid, .lobby-grid { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(200px, 260px); gap: 24px; align-items: start; }
@media (max-width: 640px) { .join-grid, .lobby-grid { grid-template-columns: 1fr; } }
.params { margin: 0; display: grid; gap: 0; border-left: 2px solid var(--sheet-line); padding-left: 14px; }
.params > div { padding: 5px 0; border-bottom: 1px solid var(--sheet-line); }
.params dt { font-size: 13px; color: var(--ink-muted); }
.params dd { margin: 0; font-family: var(--display); font-weight: var(--display-weight); font-size: 18px; }
.params dd.mode { color: var(--accent); }
.person { display: inline-flex; align-items: center; gap: 8px; }
.person .ok { color: var(--accent); font-weight: 700; }

.big-num { font-family: var(--display); font-weight: var(--display-heavy); font-size: clamp(72px, 12vw, 140px); line-height: .9; letter-spacing: -.03em; }
.big-num small { font-size: .3em; font-weight: var(--display-weight); letter-spacing: 0; margin-left: 6px; color: var(--ink-muted); }
.score-block { display: flex; align-items: flex-end; gap: 22px; flex-wrap: wrap; margin: 6px 0 12px; }
.score-block .sub { font-size: 17px; color: var(--ink-muted); padding-bottom: 12px; }
.score-block .sub b { color: var(--ink); font-weight: 600; }
.result-sheet .inner { padding-top: 16px; }
.result-sheet .big-num { font-size: clamp(60px, 9vw, 104px); }
.result-sheet .score-block { margin: 2px 0 8px; }
.result-sheet .actions { margin-top: 14px; }

.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.badge { display: inline-block; padding: 5px 12px; border: 1px solid var(--sheet-line); border-radius: var(--r-chip); font-size: 15px; color: var(--ink); background: var(--sheet-raise); line-height: 1.2; }
.badge.mode { border-color: var(--accent); color: var(--ink); font-family: var(--display); font-weight: var(--display-weight); font-size: 17px; }
.on-ocean .badge { color: var(--text-on-bg); border-color: var(--bg-line); background: transparent; }

/* ruler bar */
.ruler { position: relative; height: 22px; background: var(--ink-10); border-radius: 3px; overflow: hidden; }
.ruler .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.ruler.red .fill { background: var(--red); } .ruler.blue .fill { background: var(--blue); } .ruler.purple .fill { background: var(--purple); }
.ruler.sun .fill { background: var(--highlight); }
.ruler .ticks { position: absolute; inset: 0; background-image: linear-gradient(90deg, var(--ink-35) 1px, transparent 1px); background-size: 20% 100%; }
.ruler .ticks.fine { background-size: 10% 100%; }
.ruler.total { height: 30px; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 150px) 1fr auto; gap: 12px; align-items: center; margin: 8px 0; }
.bar-row .name { font-family: var(--display); font-weight: var(--display-weight); font-size: 21px; line-height: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .val { font-family: var(--display); font-weight: var(--display-weight); font-size: 24px; min-width: 64px; text-align: right; line-height: 1; }
.bar-row .val small { font-family: var(--body); font-weight: 400; font-size: 13px; color: var(--ink-muted); display: block; }
.bar-row.dim { opacity: .45; }
.table .bar-row { margin: 0; grid-template-columns: 1fr auto; }
.table .bar-row .name { display: none; }

/* HP bars: the value label sits inside the fill, or just outside it when the fill is too narrow (feedback 13) */
.hp-row { display: grid; grid-template-columns: minmax(90px, 180px) 1fr 52px; --p: 0%; gap: 12px; align-items: center; margin: 8px 0; }
.hp-row .name small { display: block; font-family: var(--body); font-weight: 400; font-size: 12px; color: var(--ink-muted); min-height: 14px; margin-top: 2px; }
.hp-row .name { font-family: var(--display); font-weight: var(--display-weight); font-size: 22px; line-height: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-bar { height: 40px; border-radius: var(--r-btn); background: var(--ink-10); position: relative; overflow: visible; }
.hp-bar .fill { height: 100%; transition: width .7s ease; border-radius: inherit; }
.hp-bar.red .fill { background: var(--red); } .hp-bar.blue .fill { background: var(--blue); } .hp-bar.purple .fill { background: var(--purple); }
.hp-bar .hp-val { position: absolute; top: 50%; left: calc(var(--p) - 10px); transform: translate(-100%, -50%); color: #fff; white-space: nowrap;
  font-family: var(--display); font-weight: var(--display-heavy); font-size: 24px; transition: left .7s ease, color .2s; }
.hp-row.narrow .hp-val { left: calc(var(--p) + 8px); transform: translate(0, -50%); color: var(--ink); }
.hp-row .mult { transform: scale(0); background: var(--highlight); color: #16233B; text-align: center; padding: 4px 4px; border-radius: var(--r-btn);
  font-family: var(--display); font-weight: var(--display-heavy); font-size: 20px; padding: 4px 10px; border-radius: var(--r-btn); transition: transform .25s ease; }
.hp-row .mult.show { transform: scale(1); }
.hp-row.dead { opacity: .45; }
.hp-row .elim { font-size: 14px; color: var(--out); }
.sheet .hp-row .elim { color: var(--ink-muted); }

/* tables on sheets */
.table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.table th, .table td { padding: 9px 8px; text-align: left; border-bottom: 1px solid var(--sheet-line); font-size: 16px; vertical-align: middle; }
.table th { font-weight: 500; color: var(--ink-muted); font-size: 14px; }
.table tr.me td { background: var(--accent-12); }
.table tr.elim td { color: var(--out); }
.table tr.dim td { opacity: .5; }
.table td.num { font-family: var(--display); font-weight: var(--display-weight); font-size: 22px; }
.table.compact th, .table.compact td { padding: 4px 8px; font-size: 15px; }
.table.compact td.num { font-size: 20px; }
.t-red { color: var(--red); } .t-blue { color: var(--blue); } .t-purple { color: var(--purple); }
.teamdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.teamdot.red { background: var(--red); } .teamdot.blue { background: var(--blue); } .teamdot.purple { background: var(--purple); }
.winner-line { font-family: var(--display); font-weight: var(--display-heavy); font-size: 40px; line-height: 1; margin: 12px 0 8px; }
.winner-line.draw { color: var(--ink-muted); }
.result-sheet .winner-line { font-size: 32px; margin: 6px 0 6px; }

/* team totals (match over, primary block) */
.team-totals { display: grid; gap: 8px; margin: 10px 0 14px; }
.team-row { display: grid; grid-template-columns: 8px 1fr auto; gap: 14px; align-items: center; padding: 10px 14px; border-radius: var(--r-btn); background: var(--ink-10); }
.team-row .bar { width: 8px; height: 100%; min-height: 36px; border-radius: 2px; }
.team-row .bar.red { background: var(--red); } .team-row .bar.blue { background: var(--blue); } .team-row .bar.purple { background: var(--purple); }
.team-row .tn { font-family: var(--display); font-weight: var(--display-weight); font-size: 28px; line-height: 1; }
.team-row .tn small { display: block; font-family: var(--body); font-weight: 400; font-size: 13px; color: var(--ink-muted); margin-top: 3px; }
.team-row .tv { font-family: var(--display); font-weight: var(--display-heavy); font-size: 40px; line-height: 1; }
.team-row.winner { background: var(--highlight); color: #16233B; box-shadow: var(--glow); }
.team-row.winner .tn small { color: #16233B; opacity: .75; }
.team-row.dead { opacity: .5; }

/* rankings */
.standings { list-style: none; padding: 0; margin: 6px 0 0; counter-reset: rank; }
.standings li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--sheet-line); font-size: 18px; }
.standings li::before { counter-increment: rank; content: counter(rank); font-family: var(--display); font-weight: var(--display-heavy); font-size: 30px; width: 44px; line-height: 1; color: var(--ink-muted); }
.standings li.first { font-size: 24px; }
.standings li.first::before { color: var(--highlight); }
.standings.plain li::before { content: none; }
.standings li .note { margin-left: auto; font-size: 14px; color: var(--ink-muted); }
.standings li.elim { color: var(--out); }
.player-list { list-style: none; padding: 0; margin: 8px 0; }
.player-list li { padding: 8px 0; border-bottom: 1px solid var(--sheet-line); display: flex; align-items: center; gap: 10px; font-size: 17px; }
.player-list li .host-mark { font-size: 13px; color: var(--ink-muted); margin-left: auto; }
.player-list li.left, .player-list li.kicked { text-decoration: line-through; opacity: .55; }
.wait-line { font-size: 15px; color: var(--ink-muted); margin: 10px 0 0; }
details.round { border-top: 1px solid var(--sheet-line); padding: 8px 0; }
details.round summary { cursor: pointer; font-family: var(--display); font-weight: var(--display-weight); font-size: 22px; list-style: none; display: flex; align-items: center; gap: 10px; }
details.round summary::before { content: "+"; width: 22px; color: var(--ink-muted); }
details.round[open] summary::before { content: "–"; }
details.round.void summary { color: var(--ink-muted); }
details.round .sheet-map { margin: 10px 0; border-radius: var(--r-btn); }

/* lobby teams */
.teams { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 14px 0; }
@media (max-width: 640px) { .teams { grid-template-columns: 1fr; } }
.team-col { border-top: 6px solid; padding: 10px 12px 12px; background: var(--ink-10); border-radius: 0 0 var(--r-btn) var(--r-btn); min-height: 130px; }
.team-col.red { border-color: var(--red); } .team-col.blue { border-color: var(--blue); } .team-col.purple { border-color: var(--purple); }
.team-col h4 { margin-bottom: 8px; }
.team-col ul { list-style: none; padding: 0; margin: 0 0 10px; }
.team-col li { padding: 4px 0; font-size: 16px; }
.team-col li.disc { color: var(--ink-muted); }
.share { display: flex; gap: 8px; margin: 12px 0 4px; }
.share input { flex: 1; }
.lobby-status { font-family: var(--display); font-weight: var(--display-weight); font-size: 22px; margin: 12px 0 0; }

/* listing */
.mrow { border-top: 2px solid var(--sheet-line); padding: 18px 0 22px; }
.mrow:first-child { border-top: none; padding-top: 6px; }
.mrow .mhead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.mrow .host { font-family: var(--display); font-weight: var(--display-heavy); font-size: 34px; line-height: 1; }
.mrow .tag { display: inline-block; padding: 4px 10px; border-radius: var(--r-chip); background: var(--accent); color: var(--on-accent); font-family: var(--display); font-weight: var(--display-weight); font-size: 16px; line-height: 1.2; }
.mrow .tag.quiet { background: transparent; border: 1px solid var(--sheet-line); color: var(--ink-muted); font-family: var(--body); font-weight: 400; font-size: 14px; }
.mrow .teams { margin: 10px 0 0; }
.mrow .team-col { cursor: pointer; min-height: 80px; }
.mrow .team-col:hover { background: var(--accent-12); }
.mrow.full .team-col, .mrow.full .brlist { cursor: default; opacity: .6; }
.mrow .brlist { cursor: pointer; padding: 10px 12px; background: var(--ink-10); border-radius: var(--r-btn); margin-top: 10px; }
.mrow .brlist:hover { background: var(--accent-12); }
.mrow .brlist b { font-family: var(--display); font-size: 22px; }
.mrow .brlist .player-list { margin: 6px 0 0; }
.mrow .brlist .player-list li { border: none; padding: 3px 0; }
.join-note { font-size: 14px; color: var(--ink-muted); }

/* ===== Game screen (PRD §11 placements) ===== */
#game-screen { position: fixed; inset: 0; overflow: hidden; background: #000; }
#game-screen.active { display: block; }
#street-view { position: absolute; inset: 0; cursor: crosshair; transition: filter .5s ease; }
#street-view * { cursor: crosshair; }
#game-screen.dim #street-view, #game-screen.dim #guess-map-wrap, #game-screen.dim #compass, #game-screen.dim #br-topright,
#game-screen.dim #br-circles { filter: brightness(.15) saturate(.6); pointer-events: none; }
#game-screen.dim #guess-map-wrap { opacity: .5; }
#game-screen.frozen #street-view, #game-screen.frozen #guess-map-wrap { pointer-events: none; }
#game-screen.warn::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 5;
  animation: vignette .7s ease-in-out infinite alternate;
}
@keyframes vignette {
  from { box-shadow: inset 0 0 60px 10px rgba(229,57,53,.25); }
  to   { box-shadow: inset 0 0 140px 40px rgba(229,57,53,.9); }
}
#timer-pill {
  position: absolute; top: 30px; left: 8px; z-index: 10; pointer-events: none;
  background: var(--pill); border-radius: 32px; padding: 6px 22px 8px; min-width: 180px; text-align: center;
}
#timer-text { font-family: var(--display); font-weight: var(--display-heavy); font-size: 44px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--pill-text); text-shadow: var(--text-glow); }
#round-caption { font-family: var(--display); font-weight: var(--display-weight); font-size: 14px; color: var(--text-on-bg); }
#game-screen.warn #timer-pill { animation: glow .7s ease-in-out infinite alternate; }
@keyframes glow {
  from { box-shadow: 0 0 6px 2px rgba(229,57,53,.25); background: var(--pill); }
  to   { box-shadow: 0 0 26px 10px rgba(229,57,53,.9); background: #7a1f1b; }
}

#compass { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 10; pointer-events: none; width: 320px; }
#game-screen.br-countries #compass { top: 44px; }
#compass-window { width: 320px; height: 28px; border-radius: 14px; background: var(--pill); overflow: hidden; position: relative; }
#compass-strip { position: absolute; left: 50%; top: 0; height: 28px; display: flex; white-space: nowrap; will-change: transform; }
#compass-strip span { width: 40px; flex: 0 0 40px; text-align: center; line-height: 28px; font-family: var(--display); font-size: 15px; font-weight: var(--display-weight); color: var(--text-on-bg); }
#compass-strip span.n { color: var(--accent); }
#compass-needle { text-align: center; color: var(--accent); font-size: 12px; line-height: 10px; margin-top: 1px; }

#br-circles { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 10; pointer-events: none; display: flex; gap: 6px; }
#br-circles .slot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; background: color-mix(in srgb, var(--bg-deep) 50%, transparent); }
#br-circles .slot.taken { border-color: transparent; animation: pop .35s ease; }
@keyframes pop { 0% { transform: scale(.4); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
.avatar { display: inline-flex; width: 28px; height: 28px; border-radius: 50%; align-items: center; justify-content: center; color: #fff;
  font-family: var(--display); font-weight: var(--display-heavy); font-size: 16px; text-shadow: 0 1px 2px rgba(0,0,0,.5); vertical-align: middle; flex: none; }
.avatar.sm { width: 22px; height: 22px; font-size: 13px; }

#api-counter { position: absolute; top: 8px; right: 8px; z-index: 10; pointer-events: none; font-family: ui-monospace, Menlo, monospace;
  font-size: 11px; color: var(--text-on-bg); background: var(--pill); padding: 2px 6px; border-radius: 4px; }
#game-screen.br #api-counter { display: none; }

#br-topright { position: absolute; top: 8px; right: 8px; z-index: 10; pointer-events: none; width: 270px; max-width: 45vw; }
#br-leaderboard, #br-shared { background: var(--pill); border-radius: 8px; padding: 8px 10px; font-size: 14px; color: var(--pill-text); }
.lb-row { display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.lb-row.me { background: rgba(255,255,255,.12); border-radius: 4px; margin: 0 -4px; padding: 3px 4px; }
.lb-row .rank { width: 22px; font-family: var(--display); font-weight: var(--display-weight); color: var(--text-on-bg); }
.lb-row .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.lb-row .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .dist { font-family: var(--display); font-weight: var(--display-weight); font-size: 16px; }
.lb-row .dist.none { font-family: var(--body); font-weight: 400; font-size: 12px; opacity: .7; }
.lb-row.out .nm { text-decoration: line-through; opacity: .6; }
.pins { display: inline-flex; gap: 2px; }
.pins .pin { width: 9px; height: 12px; display: inline-block; }
.pins .pin.used { opacity: .25; filter: grayscale(1); }
#br-quiet { text-align: center; font-family: var(--display); font-weight: var(--display-weight); font-size: 18px; padding: 2px 0 6px; color: var(--highlight); }
#br-flags { display: flex; flex-wrap: wrap; gap: 4px; min-height: 22px; margin-bottom: 6px; }
#br-flags .flag { background: rgba(255,255,255,.1); border-radius: 4px; padding: 1px 5px; font-size: 16px; }
#br-flags .flag .cnt { font-size: 11px; color: var(--text-on-bg); margin-left: 2px; }
#br-flags .flag.blink { animation: blinkred .3s ease 2; }
@keyframes blinkred { 50% { background: var(--out); } }

#continent-overlay { position: absolute; inset: 0; z-index: 30; background: color-mix(in srgb, var(--bg-deep) 70%, transparent); display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none; }
#continent-map { width: min(80vw, 700px); height: min(60vh, 450px); border-radius: var(--r-sheet); overflow: hidden; }
#continent-name { font-family: var(--display); font-size: 56px; font-weight: var(--display-heavy); margin-top: 12px; color: #fff; }

/* guess map: 4:3, widths in vw (feedback 14) */
#guess-map-wrap {
  position: absolute; bottom: 24px; right: 24px; z-index: 20; --mw: 22;
  width: calc(var(--mw) * 1vw); height: min(calc(var(--mw) * 0.75vw), 88vh); opacity: .7;
  border: 2px solid color-mix(in srgb, var(--sheet) 50%, transparent); border-radius: var(--r-sheet); overflow: hidden; background: var(--bg-deep);
  display: flex; flex-direction: column; transition: width .3s ease, height .3s ease, opacity .3s ease;
}
#guess-map-wrap.expanded { opacity: 1; }
#guess-map-box { flex: 1; position: relative; min-height: 0; }
#guess-map { position: absolute; inset: 0; }
#map-size-btns { position: absolute; top: 8px; left: 8px; z-index: 2; display: flex; gap: 4px; }
#map-size-btns button { width: 42px; height: 42px; border-radius: 4px; border: none; background: var(--pill); color: #fff; font-size: 20px; }
#submit-row { display: flex; }
#submit-guess, #finish-guess { flex: 1; height: 54px; border: none; font-family: var(--display); font-weight: var(--display-weight); font-size: 24px; color: var(--on-accent); background: var(--accent); }
#submit-guess:disabled { background: color-mix(in srgb, var(--bg-deep) 70%, var(--text-on-bg)); color: var(--bg-deep); cursor: default; }
#finish-guess { flex: 0 0 34%; background: var(--bg-deep); color: var(--text-on-bg); }
#finish-guess:disabled { opacity: .5; }
#lifelines { display: flex; gap: 4px; padding: 4px; background: var(--bg-deep); }
#lifelines .lifeline { flex: 1; text-align: center; font-family: var(--display); font-weight: 700; font-size: 17px; padding: 6px 4px; border: 2px solid var(--bg-line); background: transparent; color: #fff; cursor: pointer; }
#lifelines .lifeline.used { opacity: .35; text-decoration: line-through; }
#lifelines .lifeline:disabled { opacity: .45; cursor: default; }
#country-search-wrap { position: relative; padding: 4px; background: var(--bg-deep); }
#country-search { padding: 8px 10px; font-size: 15px; border-width: 1px; }
#country-suggest { position: absolute; left: 4px; right: 4px; top: 100%; z-index: 5; list-style: none; margin: 0; padding: 0;
  background: var(--bg-deep); border: 1px solid var(--bg-line); border-radius: 0 0 4px 4px; max-height: 180px; overflow-y: auto; color: #fff; }
#country-suggest li { padding: 6px 10px; cursor: pointer; }
#country-suggest li:hover, #country-suggest li.hl { background: rgba(255,255,255,.12); }
#br-readout { padding: 6px 8px; background: var(--bg-deep); font-family: var(--display); font-weight: var(--display-weight); font-size: 18px; text-align: center; color: var(--highlight); }

#shortcuts-hint { position: absolute; bottom: 24px; left: 8px; z-index: 10; pointer-events: none; font-family: ui-monospace, Menlo, monospace;
  font-size: 12px; color: var(--text-on-bg); background: var(--pill); padding: 4px 8px; border-radius: 4px; white-space: pre; }
#mp-status { position: absolute; top: 44px; left: 50%; transform: translateX(-50%); z-index: 10; pointer-events: none; font-size: 13px;
  background: var(--pill); padding: 3px 12px; border-radius: 999px; color: var(--text-on-bg); }
#loading-overlay { position: absolute; inset: 0; z-index: 40; background: color-mix(in srgb, var(--bg-deep) 94%, transparent); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; font-family: var(--display); font-size: 28px; color: #fff; }
.spinner { width: 46px; height: 46px; border: 4px solid rgba(255,255,255,.2); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#touch-divider, #touch-buttons { display: none; }

/* pre-round countdown (inside the game screen, above everything) */
#round-countdown { position: absolute; inset: 0; z-index: 45; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
#round-countdown .num { font-family: var(--display); font-weight: var(--display-heavy); font-size: min(62vh, 62vw); line-height: 1; color: var(--accent); letter-spacing: -.04em; animation: cdpulse 1s ease-out infinite; text-shadow: var(--text-glow); }
#round-countdown .num.go { color: #fff; }
#round-countdown .lbl { font-family: var(--display); font-weight: var(--display-weight); font-size: 30px; color: #fff; margin-top: 6px; }

/* ===== Banners (PRD 11.7) ===== */
#banners { position: fixed; left: 0; right: 0; top: 0; z-index: 60; pointer-events: none; }
.banner { position: absolute; left: 50%; transform: translateX(-50%); padding: 8px 20px; border-radius: var(--r-chip); color: #fff;
  font-family: var(--display); font-weight: var(--display-weight); font-size: 22px; white-space: nowrap; animation: slidein .3s ease; }
@keyframes slidein { from { opacity: 0; transform: translate(-50%, -20px); } to { opacity: 1; transform: translate(-50%, 0); } }
.banner.green { background: rgba(0,200,83,.85); }
.banner.red { background: rgba(233,69,96,.85); }
.banner.orange { background: rgba(255,152,0,.9); }
.banner.amber { background: rgba(230,120,0,.93); }
.banner.okgreen { background: rgba(0,190,70,.95); }
.banner.mult-green { background: rgba(0,200,83,.85); }
.banner.mult-orange { background: rgba(255,152,0,.9); }
.banner.mult-red { background: rgba(233,69,96,.9); }
.banner.pulse { animation: slidein .3s ease, bpulse .5s ease-in-out infinite alternate; }
@keyframes bpulse { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.08); } }
#toasts { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { background: var(--sheet); color: var(--ink); padding: 8px 16px; border-radius: var(--r-btn); animation: slidein .3s; font-weight: 500; border-top: var(--sheet-rule); }

/* ===== Modals ===== */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: color-mix(in srgb, var(--bg-deep) 70%, transparent); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--sheet); color: var(--ink); border-radius: var(--r-sheet); border-top: var(--sheet-rule); padding: 22px 24px; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; }
.modal.wide { max-width: 880px; }
.modal h3, .modal .modal-title { margin-top: 0; font-size: 34px; color: var(--ink); }
.modal .modal-actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.modal .modal-actions .btn { flex: 1; }
.modal-lead, .modal-note { color: var(--ink-muted); }
.modal-map, .debug-map { width: 100%; height: 260px; background: #dfe6ea; margin: 10px 0; }
.choice { display: flex; gap: 10px; }
.choice-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 10px; border: 2px solid var(--ink-35); background: transparent; color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 22px; cursor: pointer; }
.choice-btn .flag { font-size: 40px; }
.choice-btn:hover { border-color: var(--accent); }
.modal pre { background: var(--ink-10); padding: 10px; border-radius: var(--r-btn); overflow-x: auto; font-size: 13px; }
.keys td { padding: 5px 8px; }

/* ===== Lobby countdown overlay (BR) ===== */
#countdown-overlay { position: fixed; inset: 0; z-index: 90; background: color-mix(in srgb, var(--bg-deep) 92%, transparent); display: flex; flex-direction: column; align-items: center; justify-content: center; }
#countdown-number { font-family: var(--display); font-size: min(62vh, 62vw); font-weight: var(--display-heavy); line-height: 1; color: #fff; animation: cdpulse 1s ease-out infinite; letter-spacing: -.04em; text-shadow: var(--text-glow); }
#countdown-number.u1 { color: color-mix(in srgb, var(--accent) 45%, #fff); } #countdown-number.u2 { color: color-mix(in srgb, var(--accent) 75%, #fff); } #countdown-number.u3 { color: var(--accent); }
@keyframes cdpulse { 0% { transform: scale(1.12); } 100% { transform: scale(1); } }
#countdown-label { font-family: var(--display); font-weight: var(--display-weight); font-size: 30px; color: var(--text-on-bg); margin-top: 16px; }

/* ===== Trophy (BR winner) ===== */
#br-trophy { position: relative; height: 190px; margin: 4px 0 6px; perspective: 800px; overflow: hidden; }
.trophy-scene { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; transform-style: preserve-3d; }
.trophy { font-size: 120px; transform-style: preserve-3d; animation: trophyin 3.5s cubic-bezier(.2,.8,.2,1) both; filter: drop-shadow(0 10px 30px color-mix(in srgb, var(--highlight) 55%, transparent)); }
@keyframes trophyin {
  0% { transform: rotateY(-540deg) scale(.2) translateZ(-300px); opacity: 0; }
  60% { transform: rotateY(20deg) scale(1.1); opacity: 1; }
  100% { transform: rotateY(0) scale(1); opacity: 1; }
}
.sweep { position: absolute; top: 0; bottom: 0; width: 60px; left: -80px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent);
  transform: skewX(-20deg); animation: sweep 1.2s ease-in-out 1.8s 2; }
@keyframes sweep { from { left: -80px; } to { left: 110%; } }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -10px; width: 8px; height: 14px; opacity: .95; animation: fall 3.2s linear forwards; }
@keyframes fall { 0% { transform: translateY(0) rotate(0); } 100% { transform: translateY(240px) rotate(720deg); opacity: 0; } }

/* touch split layout: see /static/touch.css */

@media (prefers-reduced-motion: reduce) {
  .sheet { animation: none; }
  #round-countdown .num, #countdown-number, .banner.pulse, #game-screen.warn::after, #game-screen.warn #timer-pill { animation: none; }
  .trophy { animation: none; }
}
#game-screen.br-distance #submit-guess { font-size: 18px; white-space: nowrap; }

/* narrow (non-touch) windows */
@media (max-width: 700px) {
  #guess-map-wrap { width: calc(100vw - 16px) !important; height: 42vh !important; right: 8px; bottom: 8px; opacity: 1; }
  #compass, #compass-window { width: 200px; }
  #compass { top: 92px; }
  #game-screen.br-countries #compass { top: 122px; }
  #br-circles { top: 92px; }
  #timer-pill { top: 8px; }
  #br-topright { top: 96px; width: 200px; }
  #shortcuts-hint { display: none; }
}

/* feedback round 5: you chips, compact BR lobby, lobby countdown bar, rounds grid */
.you { display: inline-block; background: var(--accent); color: var(--bg-deep, #111); font-family: var(--display); font-weight: 700; font-size: 11px; padding: 1px 6px; margin-left: 6px; vertical-align: middle; border-radius: var(--r-chip, 999px); }
.people-grid { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.pchip { display: inline-flex; align-items: center; background: var(--ink-10); padding: 5px 10px 5px 6px; border-radius: var(--r-btn); }
.pchip.me { outline: 2px solid var(--accent); }
.lobby-foot { margin-top: 18px; display: grid; gap: 10px; }
.countdown-row { display: flex; gap: 10px; align-items: stretch; }
.countdown-row .btn { align-self: center; flex: 0 0 auto; }
.countdown-bar .cd-label, .countdown-bar .cd-unit { white-space: nowrap; }
.countdown-bar { flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--ink-10); border-left: 8px solid var(--accent); font-family: var(--display); font-weight: var(--display-weight, 700); font-size: 18px; padding: 6px 14px; }
.countdown-bar .cd-num { font-size: 56px; line-height: 1; min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; animation: cdpulse 1s ease-out infinite; color: var(--accent); }
.countdown-bar.soon .cd-num { color: var(--highlight); }
.attempts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.rr.out .attempts, .attempts { text-decoration: none; }
.attempt { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; padding: 2px 8px; border-radius: var(--r-chip, 6px); background: var(--ink-10); font-size: 13px; font-family: var(--body); color: var(--ink-muted); }
.attempt.ok { color: var(--highlight); } .attempt.no { color: var(--accent); } .attempt.life { color: var(--ink); }
.rounds-grid.wide { grid-template-columns: 1fr; }
.rounds-grid.wide .rr { align-items: flex-start; }
.rounds-grid.wide .rr .nm { white-space: normal; }
@keyframes cbar { from { opacity: .7; } to { opacity: 1; } }
.team-row.mine { outline: 2px solid var(--accent); }
.rounds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 6px 0 12px; }
.rcard { background: var(--ink-10); padding: 8px 10px 10px; display: grid; gap: 6px; align-content: start; border-radius: var(--r-btn); }
.rcard.void { opacity: .7; }
.rcard .rtitle { font-family: var(--display); font-weight: var(--display-weight, 700); font-size: 17px; }
.sheet-map.mini { height: 150px; margin: 0; }
.rrows { display: grid; gap: 3px; }
.rr { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.rr .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr .nm small { display: block; color: var(--ink-muted); font-size: 11px; white-space: normal; }
.rr .v { font-family: var(--display); font-weight: var(--display-weight, 700); font-size: 15px; }
.rr.out .nm { text-decoration: line-through; color: var(--ink-muted); }
@media (prefers-reduced-motion: reduce) { .countdown-bar { animation: none; } }
