/* Ticker layout (hard edges, monospace numerals) in the Game Log palette. */
:root {
  --bg: #0f1524;
  --panel: #1a2236;
  --line: #45526e;
  --line-soft: #2a3550;
  --text: #eef2f8;
  --muted: #a3aec4;
  --accent: #3ddbb4;
  --accent-ink: #0f1524;
  --wrong: #ff9a8a;
  --sans: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

html { background: var(--bg); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; color: inherit; border-radius: 0; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
p, h1, h2, ol { margin: 0; }

.app {
  width: 100%;
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 28px 20px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.loading { margin: auto; color: var(--muted); font-family: var(--mono); font-size: 13px; line-height: 1.6; text-align: center; }
.loading code { color: var(--text); }

/* ---------- header ---------- */

.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.top__meta { display: flex; flex-direction: column; gap: 2px; font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--muted); }
.clock { display: flex; align-items: baseline; gap: 4px; font-family: var(--mono); }
.clock__n { font-size: 44px; font-weight: 800; line-height: 0.9; font-variant-numeric: tabular-nums; }
.clock__u { font-size: 12px; font-weight: 500; color: var(--muted); }

.rule { margin-top: 14px; height: 4px; background: var(--line-soft); }
.rule__fill { height: 4px; background: var(--accent); }

.prompt { margin-top: 22px; font-weight: 700; font-size: 32px; line-height: 1.05; letter-spacing: -0.02em; }
.prompt--home { font-size: 64px; line-height: 0.92; letter-spacing: -0.04em; margin-top: 30px; }
.lede { margin-top: 14px; font-size: 18px; line-height: 1.35; color: var(--muted); }

.tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; font-family: var(--mono); font-size: 12px; font-weight: 700; }
.tag { border: 1px solid var(--muted); padding: 2px 8px; white-space: nowrap; }
.tag--solid { background: var(--text); color: var(--bg); border-color: var(--text); }
.tag--hit { border-color: var(--accent); color: var(--accent); }

/* ---------- question panels ---------- */

.panel { margin-top: 22px; background: var(--panel); border: 1px solid var(--line); }

.panel--fantasy {
  height: 268px;
  padding: 16px 16px 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}
.bar { display: flex; flex-direction: column; gap: 8px; }
.bar__value { font-family: var(--mono); font-weight: 800; font-size: 26px; text-align: center; font-variant-numeric: tabular-nums; }
.bar__fill { background: var(--muted); }
.bar__label { font-family: var(--mono); font-size: 12px; font-weight: 500; text-align: center; color: var(--muted); line-height: 1.4; }
.bar__label b { color: var(--accent); font-weight: 700; }
.bar--top .bar__value { color: var(--accent); }
.bar--top .bar__fill { background: var(--accent); }

.panel--line { padding: 0; }
.cells { display: grid; gap: 1px; background: var(--line); }
.cells--big { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cells--small { grid-template-columns: repeat(var(--n), minmax(0, 1fr)); border-top: 1px solid var(--line); }
.cell { background: var(--panel); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 4px 12px; min-width: 0; }
.cell__value { font-family: var(--mono); font-weight: 800; font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; }
.cell__label { font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.cell--big { padding: 22px 4px 18px; gap: 10px; }
.cell--big .cell__value { font-size: 46px; letter-spacing: -0.03em; height: 46px; display: flex; align-items: center; }
.cell--big .cell__label { font-size: 12px; }
.cell--big:first-child .cell__value { color: var(--accent); }
/* Season totals run long ("248/371"): step the big numerals down so they never clip. */
.cell--big[data-len='6'] .cell__value { font-size: 38px; }
.cell--big[data-len='7'] .cell__value { font-size: 33px; }
.cell--big[data-len='8'] .cell__value, .cell--big[data-len='9'] .cell__value { font-size: 28px; }

/* who was it against: the player is given, above his line */
.subject { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.subject__name { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; }
.subject__meta { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }

/* weekly or season leader: one number carries the question */
.panel--leader { padding: 0; }
.leader { display: flex; flex-direction: column; align-items: flex-start; padding: 22px 16px 18px; }
.leader__value { font-family: var(--mono); font-weight: 800; font-size: 84px; line-height: 0.9; letter-spacing: -0.04em; color: var(--accent); font-variant-numeric: tabular-nums; }
.leader__stat { margin-top: 14px; font-family: var(--mono); font-size: 14px; font-weight: 800; letter-spacing: 0.04em; }
.leader__caption { margin-top: 4px; font-size: 15px; color: var(--muted); }
.panel--leader .cells--big { border-top: 1px solid var(--line); }

/* season week by week: one bar per week, gaps where he sat */
.panel--weeks {
  height: 268px; padding: 16px 12px 10px;
  display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 4px; align-items: end;
}
.wbar { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wbar__value { font-family: var(--mono); font-weight: 700; font-size: 10px; text-align: center; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.wbar__fill { background: var(--muted); }
.wbar__label { font-family: var(--mono); font-size: 11px; font-weight: 500; text-align: center; color: var(--muted); }
.wbar--top .wbar__value { color: var(--accent); }
.wbar--top .wbar__fill { background: var(--accent); }
.wbar--minor { opacity: 0.35; }
.wbar--out .wbar__value { color: var(--muted); }
.panel--dense { gap: 2px; padding-inline: 8px; }
.panel--dense .wbar__value { font-size: 9px; }
.panel--dense .wbar__label { font-size: 9px; }
.panel--reveal { margin-top: 12px; border-color: var(--accent); }
.axis { margin-top: 8px; font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--muted); }

/* who had more */
.panel--duel { padding: 0; }
.duel__head { display: flex; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 13px; font-weight: 800; letter-spacing: 0.04em; }
.duel__head span:last-child { color: var(--muted); font-weight: 500; white-space: nowrap; }
.duel__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 16px; }
.duel__row + .duel__row { border-top: 1px solid var(--line-soft); }
.duel__who { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.duel__name { font-size: 20px; font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
.duel__meta { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--muted); }
.duel__value { font-family: var(--mono); font-weight: 800; font-size: 34px; line-height: 1; color: var(--muted); font-variant-numeric: tabular-nums; }
.duel__row--won .duel__value, .duel__row--won .duel__name { color: var(--accent); }

.panel--three { padding: 4px 12px; }
.log { width: 100%; border-collapse: collapse; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.log th { font-size: 11px; font-weight: 500; color: var(--muted); text-align: right; padding: 10px 0 8px 6px; white-space: nowrap; }
.log td { font-size: 17px; font-weight: 700; text-align: right; padding: 16px 0 16px 6px; border-top: 1px solid var(--line-soft); white-space: nowrap; }
.log .t-left { text-align: left; padding-left: 0; }
.log td.t-left { font-size: 13px; font-weight: 500; }
.log .t-dim { color: var(--muted); }
.log .t-hit { color: var(--accent); font-weight: 700; }
/* QB and RB rows carry seven stat columns: tighten so nothing clips at 390px. */
.panel--three[data-cols='7'] { padding: 4px 10px; }
.panel--three[data-cols='7'] .log th { font-size: 9.5px; padding-left: 4px; }
.panel--three[data-cols='7'] .log td { font-size: 13px; padding-left: 4px; }
.panel--three[data-cols='7'] .log td.t-left { font-size: 11.5px; }

/* ---------- hints ---------- */

.hints { margin-top: 10px; display: flex; gap: 8px; }
.hint {
  flex: 1; min-height: 44px; padding: 0 6px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: transparent; border: 1px solid var(--line); color: var(--text);
  font-family: var(--mono); font-size: 12px; font-weight: 700;
}
.hint:disabled { color: #6f7b94; border-color: var(--line-soft); }
.hint--used { border-color: var(--accent); color: var(--accent); }
.worth { margin-top: 10px; font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--muted); }
.worth b { color: var(--text); font-weight: 700; }

/* ---------- answering ---------- */

.answer { margin-top: 22px; }

.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice {
  min-height: 68px; padding: 8px 14px; text-align: left;
  background: var(--panel); border: 1px solid var(--line);
  font-size: 16px; font-weight: 700; line-height: 1.2;
}
.choice:hover { border-color: var(--accent); }

.typed { display: flex; flex-direction: column; gap: 8px; scroll-margin-top: 12px; }
.label { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; }
.label--gap { margin-top: 14px; }
.input {
  height: 54px; padding: 0 14px; width: 100%;
  background: var(--panel); border: 1px solid var(--line);
  font-size: 17px; font-weight: 600;
}
.input::placeholder { color: #8090ab; font-weight: 500; }
.input:focus { outline: none; border-color: var(--accent); }
.input--set { border-color: var(--accent); color: var(--accent); }

.suggest { display: flex; flex-direction: column; }
.suggest__row {
  min-height: 46px; padding: 0 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-top: 0;
  font-size: 15px; font-weight: 700; text-align: left;
}
.suggest__row:first-child { border-top: 1px solid var(--line); }
.suggest__row.is-active { background: #26314c; border-color: var(--accent); border-top: 1px solid var(--accent); }
.suggest__meta { font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--muted); white-space: nowrap; }

.primary, .secondary {
  min-height: 54px; width: 100%; padding: 0 16px;
  font-family: var(--mono); font-size: 14px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
}
.primary { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); }
.primary:disabled { background: transparent; color: #6f7b94; border-color: var(--line-soft); }
.secondary { background: transparent; color: var(--text); border: 1px solid var(--text); }
.quiet {
  margin-top: auto; align-self: center; min-height: 44px; padding: 20px 8px 0;
  background: none; border: 0; color: var(--muted);
  font-family: var(--mono); font-size: 12px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- result of one question ---------- */

.result { display: flex; flex-direction: column; gap: 14px; }
.result__verdict { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 22px; font-weight: 800; letter-spacing: 0.02em; }
.result--right .result__verdict { color: var(--accent); }
.result--wrong .result__verdict { color: var(--wrong); }
.result__who { display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--line); padding: 12px 14px; }
.result--right .result__who { border-color: var(--accent); }
.result__photo { width: 76px; height: 56px; object-fit: cover; object-position: top; background: var(--line-soft); flex: none; }
.result__name { font-size: 22px; font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; }
.result__meta { margin-top: 4px; font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--muted); }
.result__note { font-size: 14px; color: var(--muted); line-height: 1.4; }

/* ---------- home ---------- */

.block { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 10px; }
.block__note { font-size: 15px; line-height: 1.4; color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 44px; padding: 0 14px;
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  font-family: var(--mono); font-size: 12px; font-weight: 700; text-transform: uppercase;
}
.chip--on { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip--wide { flex: 1; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding: 8px 14px; min-height: 56px; }
.chip small { font-size: 11px; font-weight: 500; text-transform: none; }
.foot { margin-top: 28px; font-family: var(--mono); font-size: 11px; line-height: 1.6; color: var(--muted); }
.foot--credit { margin-top: 10px; }
.foot a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- round results ---------- */

.marks { margin-top: 18px; display: flex; gap: 4px; }
.mark { flex: 1; height: 14px; border: 1px solid var(--line); }
.mark--on { background: var(--accent); border-color: var(--accent); }
.recap { margin-top: 18px; padding: 0; list-style: none; border: 1px solid var(--line); background: var(--panel); }
.recap__row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line-soft); }
.recap__row:first-child { border-top: 0; }
.recap__n { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--muted); }
.recap__name { flex: 1; min-width: 0; font-size: 16px; font-weight: 700; line-height: 1.2; }
.recap__name small { display: block; margin-top: 2px; font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--muted); }
.recap__pts { font-family: var(--mono); font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.is-right .recap__pts { color: var(--accent); }
.is-wrong .recap__pts, .is-wrong .recap__name { color: var(--wrong); }
.is-wrong .recap__name small { color: var(--muted); }
.stack { margin-top: 22px; display: flex; flex-direction: column; gap: 8px; }
.stack .quiet { margin-top: 0; padding-top: 0; }

@media (prefers-reduced-motion: no-preference) {
  .bar__fill, .wbar__fill { animation: rise 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both; transform-origin: bottom; }
  @keyframes rise { from { transform: scaleY(0); } }
}
.choice--on { border-color: var(--accent); color: var(--accent); }
.choice--on b { font-family: var(--mono); }
.choices--rank { margin-top: 8px; }

.feedback { margin-top: 28px; display: flex; flex-direction: column; gap: 8px; }
.feedback__message { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; font-size: 16px; font-weight: 500; line-height: 1.4; }
.feedback__reply { font-size: 15px; font-weight: 500; }
.feedback__trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.feedback__error { font-size: 14px; color: var(--wrong, #ff8a7a); }
.feedback__done { font-size: 15px; color: var(--accent); }
.feedback .secondary:disabled { color: #6f7b94; border-color: var(--line-soft); }
