/* Layout: a night-game scoreboard. Rope across the top in tug of war, one column of play, a live board beside it (below it on phones). */
:root {
  color-scheme: dark;
  --night: #0a1120;
  --panel: #111b2d;
  --panel-2: #172440;
  --line: #24324d;
  --chalk: #eef2f8;
  --dim: #8d9ab2;
  --led: #ffb627;
  --led-glow: rgba(255, 182, 39, .35);
  --good: #3ddc84;
  --bad: #ff5a5f;
  --team-r: #ff6b5e;
  --team-b: #4cc9f0;
  --rope-1: #c9a46a;
  --rope-2: #8a6a3a;
  --fire: #ff7a1a;
  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --body: "Barlow Semi Condensed", "Arial Narrow", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 50% -200px, #1a2a4a 0%, transparent 70%),
    var(--night);
  color: var(--chalk);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.45;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px 40px;
}
.wrap { max-width: 980px; margin: 0 auto; display: grid; gap: 20px; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--led); outline-offset: 2px; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { font-family: var(--display); font-weight: 900; font-size: clamp(34px, 7vw, 54px); line-height: .9; letter-spacing: .01em; text-transform: uppercase; margin: 0; }
.brand span { color: var(--led); text-shadow: 0 0 18px var(--led-glow); }
.net { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.dot.on { background: var(--good); box-shadow: 0 0 8px var(--good); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; min-width: 0; }
.label { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin: 0 0 8px; }
h2 { font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1; text-transform: uppercase; margin: 0 0 6px; text-wrap: balance; }
p { margin: 0; }
.muted { color: var(--dim); }

/* home */
.home { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
.stack { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.input {
  background: var(--night); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; width: 100%; font-size: 18px;
}
.input:focus { border-color: var(--led); outline: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; font-weight: 600; font-size: 15px; color: var(--dim);
}
.chip[aria-pressed="true"] { border-color: var(--led); color: var(--night); background: var(--led); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  border: 0; border-radius: 10px; padding: 13px 20px; font-weight: 700; font-size: 17px;
  letter-spacing: .04em; text-transform: uppercase; background: var(--panel-2); border: 1px solid var(--line);
}
.btn.primary { background: var(--led); color: var(--night); border-color: var(--led); }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.join { display: flex; gap: 8px; }
.join .input { text-transform: uppercase; letter-spacing: .2em; font-family: var(--display); font-weight: 800; font-size: 22px; width: 8.5ch; text-align: center; }
.list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.match-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--night); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.match-row b { font-family: var(--display); font-size: 22px; letter-spacing: .12em; color: var(--led); }
.empty { color: var(--dim); font-size: 15px; padding: 12px; border: 1px dashed var(--line); border-radius: 10px; }
.note { font-size: 14px; color: var(--dim); }

/* lobby */
.code {
  font-family: var(--display); font-weight: 900; font-size: clamp(64px, 16vw, 112px); line-height: .9;
  letter-spacing: .14em; color: var(--led); text-shadow: 0 0 28px var(--led-glow);
}
.players { display: flex; flex-wrap: wrap; gap: 8px; }
.pchip { display: inline-flex; align-items: center; gap: 8px; background: var(--night); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px 6px 6px; font-weight: 600; }
.av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 15px; color: var(--night); flex: none; }
.you { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--led); }

/* game */
.game { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.hud { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.led { font-family: var(--display); font-weight: 800; color: var(--led); text-shadow: 0 0 14px var(--led-glow); font-variant-numeric: tabular-nums; line-height: 1; }
.hud .led { font-size: 40px; }
.clock { height: 6px; background: var(--night); border-radius: 3px; overflow: hidden; margin-bottom: 18px; }
.clock i { display: block; height: 100%; background: var(--led); transform-origin: left; }
.qcat { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--led); }
.question { font-size: clamp(22px, 4vw, 28px); font-weight: 600; line-height: 1.25; margin: 6px 0 18px; text-wrap: balance; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ans {
  text-align: left; background: var(--night); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; font-size: 18px; font-weight: 600; display: flex; gap: 12px; align-items: center; min-height: 64px;
}
.ans:hover:not(:disabled) { border-color: var(--led); }
.ans kbd { font-family: var(--display); font-weight: 800; color: var(--dim); font-size: 16px; }
.ans.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 16%, var(--night)); }
.ans.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 16%, var(--night)); }
.ans:disabled { cursor: default; }
.flash { margin-top: 14px; font-weight: 700; min-height: 1.5em; }
.flash.good { color: var(--good); } .flash.bad { color: var(--bad); }

.board { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.brow { display: grid; grid-template-columns: 22px 26px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--night); border: 1px solid var(--line); }
.brow.me { border-color: var(--led); }
.brow .rank { font-family: var(--display); font-weight: 800; color: var(--dim); text-align: center; }
.brow .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.brow .sub { display: block; font-size: 12px; color: var(--dim); font-weight: 500; }
.brow .pts { font-family: var(--display); font-weight: 800; font-size: 22px; font-variant-numeric: tabular-nums; }
.prog { height: 3px; background: var(--line); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--dim); }

.count { text-align: center; padding-block: 40px; }
.count .led { font-size: 140px; }

/* results */
.podium { display: grid; gap: 4px; text-align: center; padding-block: 8px 14px; }
.verdict { font-family: var(--display); font-weight: 900; font-size: clamp(40px, 9vw, 72px); text-transform: uppercase; line-height: .95; }
.review { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.review li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; font-size: 15px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.review .mk { font-weight: 800; }
.review .mk.g { color: var(--good); } .review .mk.b { color: var(--bad); }

/* tug of war */
.game .full { grid-column: 1 / -1; }
.tug-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.side { display: grid; gap: 2px; min-width: 0; flex: 1; }
.side b { font-family: var(--display); font-weight: 900; font-size: 30px; text-transform: uppercase; line-height: 1; }
.side.r b { color: var(--team-r); }
.side.b { text-align: right; }
.side.b b { color: var(--team-b); }
.side span { font-size: 13px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mclock { font-size: 46px; text-align: center; }
.mclock small { display: block; font-family: var(--body); font-size: 11px; letter-spacing: .12em; color: var(--dim); text-shadow: none; font-weight: 700; margin-top: 4px; }
.track { position: relative; height: 58px; border-radius: 12px; background: var(--night); border: 1px solid var(--line); overflow: hidden; }
.zone { position: absolute; top: 0; bottom: 0; width: 6%; }
.zone.r { left: 0; background: color-mix(in srgb, var(--team-r) 40%, transparent); }
.zone.b { right: 0; background: color-mix(in srgb, var(--team-b) 40%, transparent); }
.mid { position: absolute; left: 50%; top: 6px; bottom: 6px; width: 2px; margin-left: -1px; background: var(--line); }
.rope { position: absolute; left: 0; right: 0; top: 50%; height: 8px; margin-top: -4px; background: repeating-linear-gradient(115deg, var(--rope-1) 0 6px, var(--rope-2) 6px 10px); }
.knot { position: absolute; top: 50%; left: 50%; width: 22px; height: 38px; margin: -19px 0 0 -11px; border-radius: 6px; background: var(--chalk); box-shadow: 0 0 0 3px var(--night), 0 0 18px var(--led-glow); transition: left .35s cubic-bezier(.3, 1.4, .5, 1); }
.tug-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 14px; color: var(--dim); font-variant-numeric: tabular-nums; }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.team { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.team h3 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 22px; text-transform: uppercase; }
.team.r h3 { color: var(--team-r); }
.team.b h3 { color: var(--team-b); }
.team .players { flex-direction: column; align-items: flex-start; }
.tdot { width: 10px; height: 10px; border-radius: 50%; justify-self: center; }
.tdot.r { background: var(--team-r); } .tdot.b { background: var(--team-b); }
.pull-pos { color: var(--good); } .pull-neg { color: var(--bad); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; text-align: center; }
.stats div { background: var(--night); border: 1px solid var(--line); border-radius: 10px; padding: 10px 6px; }
.stats b { display: block; font-family: var(--display); font-weight: 800; font-size: 28px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.how { font-size: 15px; color: var(--dim); display: grid; gap: 4px; margin: 0; padding-left: 18px; }

/* streaks, power-ups, progression, daily */
.top-right { display: flex; align-items: center; gap: 14px; }
.icon-btn { background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.fire { display: inline-flex; align-items: center; gap: 6px; font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: .04em; text-transform: uppercase; color: var(--night); background: var(--fire); padding: 3px 12px; border-radius: 999px; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.shake { animation: shake .4s; }
@keyframes shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.hud-mid { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.streak { font-size: 13px; color: var(--dim); font-weight: 600; }
.powers { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.power { border: 1px dashed var(--led); background: transparent; color: var(--led); border-radius: 10px; padding: 8px 14px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: 14px; text-align: left; }
.power small { display: block; font-size: 12px; color: var(--dim); text-transform: none; letter-spacing: 0; font-weight: 500; }
.power:disabled { opacity: .4; cursor: not-allowed; }
.frozen .answers { filter: saturate(.2) brightness(.7); }
.freeze-tag { color: var(--team-b); }
.ans.gone { visibility: hidden; }
.diff { font-size: 11px; font-weight: 700; letter-spacing: .1em; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--dim); margin-left: 8px; }
.diff.h { color: var(--fire); border-color: var(--fire); }
.rank-name { font-family: var(--display); font-weight: 900; font-size: 42px; text-transform: uppercase; line-height: 1; color: var(--led); text-shadow: 0 0 18px var(--led-glow); }
.xpbar { height: 8px; background: var(--night); border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.xpbar i { display: block; height: 100%; background: var(--led); }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.mini-stats div { background: var(--night); border: 1px solid var(--line); border-radius: 10px; padding: 8px 4px; min-width: 0; }
.mini-stats b { display: block; font-family: var(--display); font-weight: 800; font-size: 22px; font-variant-numeric: tabular-nums; }
.mini-stats span { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.share { background: var(--night); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 16px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; margin: 0; font-family: var(--body); user-select: all; }
.lb { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.lb li { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 8px; background: var(--night); border: 1px solid var(--line); font-size: 15px; }
.lb li.me { border-color: var(--led); }
.lb .r { font-family: var(--display); font-weight: 800; color: var(--dim); text-align: center; }
.lb .v { font-family: var(--display); font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.lb .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lb .nm small { color: var(--dim); font-weight: 500; margin-left: 6px; }
.xp-gain { text-align: center; font-weight: 700; color: var(--good); }
.promo { text-align: center; font-family: var(--display); font-weight: 900; font-size: 30px; text-transform: uppercase; color: var(--led); text-shadow: 0 0 18px var(--led-glow); }
.chip:disabled { opacity: .4; cursor: not-allowed; }
.cta { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.badge { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--fire); color: var(--fire); border-radius: 999px; padding: 3px 10px; }
.cpu-rec { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--dim); }
.cpu-rec span { border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.cpu-rec b { color: var(--chalk); }
@media (max-width: 760px) { .mini-stats { grid-template-columns: repeat(2, 1fr); } }

@media (max-width: 760px) {
  .home, .game { grid-template-columns: 1fr; }
  .teams { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .mclock { font-size: 36px; }
  .answers { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* page basics */
html { -webkit-text-size-adjust: 100%; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); background: #0a1120; }
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--led); }

/* ad slot and footer */
.ad { max-width: 980px; margin: 0 auto; min-height: 100px; display: grid; place-items: center; }
.ad .adsbygoogle { display: block; width: 100%; }
.foot { max-width: 980px; margin: 8px auto 0; font-size: 13px; color: var(--dim); display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; text-align: center; }
.foot a { color: var(--dim); }

/* name 'em all */
.guess { display: flex; gap: 8px; }
.guess .input { flex: 1; min-width: 0; font-size: 18px; }
.named { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; padding: 0; list-style: none; }
.named li { border: 1px solid var(--good); color: var(--chalk); background: color-mix(in srgb, var(--good) 12%, var(--night)); border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: 15px; }
.named li.miss { border-color: var(--line); background: transparent; color: var(--dim); }
.named li.none { border: 1px dashed var(--line); background: transparent; color: var(--dim); font-weight: 500; }

/* Optional accounts share the existing scoreboard palette and typography. */
.account-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.account-controls .btn { padding: 7px 12px; font-size: 14px; }
.account-menu { position: relative; max-width: 240px; }
.account-menu summary { cursor: pointer; color: var(--led); overflow-wrap: anywhere; }
.account-menu[open] { padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.auth-dialog { color: var(--chalk); width: min(460px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow: auto; box-shadow: 0 24px 80px #03071199; }
.auth-dialog::backdrop { background: #050b16cc; }
.auth-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.auth-form { display: grid; gap: 14px; margin-top: 20px; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: 12px 0 18px; }
.auth-status { font-size: 16px; overflow-wrap: anywhere; }
.auth-status[data-error="true"] { color: var(--bad); }
.auth-status[data-error="false"] { color: var(--good); }
.auth-dialog [hidden] { display: none !important; }
.auth-dialog a { color: var(--led); }
