/* WHEN — colour back in, filled buttons, fully rounded. */

:root {
  --bg: #0A0A0B;
  --surface: #151517;
  --surface-2: #1E1E21;
  --surface-3: #2A2A2E;
  --line: rgba(255,255,255,0.08);
  --line-2: rgba(255,255,255,0.16);
  --text: #FFFFFF;
  --muted: #8E8E96;
  --muted-2: #62626A;
  --yellow: #FFD60A;
  --blue: #0A84FF;
  --green: #30D158;
  --orange: #FF9F0A;
  --purple: #BF5AF2;
  --pink: #FF375F;
  --red: #FF453A;
  --pill: 999px;
  --r-card: 28px;
  --safe: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", system-ui, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--bg); color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

.app { max-width: 500px; margin: 0 auto; padding: 16px 18px calc(40px + var(--safe)); }

.screen { display: none; animation: in .2s ease-out; }
.screen.active { display: block; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.ico { flex: 0 0 auto; display: block; }

/* ── type ───────────────────────────────────────────────── */
h1, h2, h3 { margin: 0; letter-spacing: -0.025em; line-height: 1.08; }
.title { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; }
.h-sub { color: var(--muted); font-size: 14.5px; font-weight: 450; }
.center { text-align: center; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2); }

/* ── masthead ───────────────────────────────────────────── */
.masthead { padding: 34px 0 26px; }
.wordmark { font-size: 52px; font-weight: 800; letter-spacing: -0.045em; line-height: 1; }
.wordmark em { font-style: normal; color: var(--yellow); }
.masthead .sub { color: var(--muted); font-size: 15px; margin-top: 10px; }

/* ── buttons: filled, pill ──────────────────────────────── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 17px 20px; border: 0; border-radius: var(--pill);
  font: inherit; font-size: 16.5px; font-weight: 650; letter-spacing: -0.01em;
  color: #0A0A0B; background: var(--surface-3);
  cursor: pointer; transition: transform .1s ease, filter .15s ease;
}
.btn:active { transform: scale(.975); filter: brightness(1.1); }
.btn.solid  { background: var(--yellow); color: #17130A; }
.btn.blue   { background: var(--blue);   color: #fff; }
.btn.grey   { background: var(--surface-3); color: var(--text); }
.btn.ghost  { background: transparent; color: var(--muted); font-weight: 500; }
.btn.sm { padding: 11px 18px; font-size: 14.5px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.btn-col { display: grid; gap: 10px; }

/* ── mode cards ─────────────────────────────────────────── */
.mode {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 16px 18px; border: 0; border-radius: var(--r-card);
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
  transition: transform .1s ease;
}
.mode:active { transform: scale(.99); }
.mode .badge { width: 46px; height: 46px; flex: 0 0 46px; border-radius: var(--pill); display: grid; place-items: center; }
.mode.champ .badge { background: var(--yellow); color: #17130A; }
.mode.quick .badge { background: var(--blue); color: #fff; }
.mode .t { display: block; font-size: 18px; font-weight: 650; letter-spacing: -0.02em; }
.mode .d { display: block; font-size: 13px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.mode .chev { color: var(--muted-2); margin-left: auto; }

/* ── panels / rows ──────────────────────────────────────── */
.panel { background: var(--surface); border-radius: var(--r-card); padding: 6px 20px; margin-top: 14px; }
.panel > h3 { padding: 16px 0 8px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2); font-weight: 700; }
.panel.pad { padding: 16px 18px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; }
.row + .row { border-top: 1px solid var(--line); }
.row .lbl { font-size: 15px; font-weight: 550; flex: 1 1 auto; min-width: 0; }
.row .lbl small { display: block; color: var(--muted-2); font-size: 12.5px; margin-top: 2px; font-weight: 450; }

.seg { display: flex; background: var(--bg); border-radius: var(--pill); padding: 3px; gap: 2px; flex: 0 0 auto; }
.seg button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 8px 12px; border-radius: var(--pill); cursor: pointer; min-width: 40px;
}
.seg button.on { background: var(--text); color: #0A0A0B; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 2px 0 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; color: var(--muted);
  border: 0; background: var(--surface-2);
  border-radius: var(--pill); padding: 9px 15px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.chip.on { color: #0A0A0B; }

/* ── avatars ────────────────────────────────────────────── */
.av {
  border-radius: var(--pill); display: grid; place-items: center; flex: 0 0 auto;
  font-weight: 750; color: #17130A; letter-spacing: -0.02em; border: 0; cursor: pointer; font-family: var(--font);
}
.av.lg { width: 44px; height: 44px; font-size: 15px; }
.av.md { width: 34px; height: 34px; font-size: 12.5px; }
.av.sm { width: 26px; height: 26px; font-size: 10px; }

/* ── players setup ──────────────────────────────────────── */
.player-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
input[type=text], input[type=number] {
  flex: 1; min-width: 0; padding: 14px 18px; border-radius: var(--pill); border: 0;
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; font-weight: 500;
}
input::placeholder { color: var(--muted-2); font-weight: 450; }
input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--line-2); }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.icon-btn {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: var(--pill); border: 0;
  background: var(--surface); color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
.icon-btn:active { background: var(--surface-2); }

/* ── game ───────────────────────────────────────────────── */
.topbar { display: flex; align-items: center; gap: 8px; margin: 2px 0 16px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 650; color: var(--muted);
  background: var(--surface); padding: 8px 13px; border-radius: var(--pill);
}
.pill.cat { color: #17130A; }
.pill.count { font-variant-numeric: tabular-nums; }

.timer { position: relative; width: 62px; height: 62px; flex: 0 0 62px; margin-left: auto; }
.timer svg.ring { transform: rotate(-90deg); display: block; }
.timer .track { stroke: var(--surface-2); }
.timer .bar { stroke: var(--blue); stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke .3s ease; }
.timer .num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 23px; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.timer.warn .bar { stroke: var(--yellow); }
.timer.warn .num { color: var(--yellow); }
.timer.danger .bar { stroke: var(--red); }
.timer.danger .num { color: var(--red); animation: pulse .9s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.14); } }

.tbar { height: 5px; border-radius: var(--pill); background: var(--surface-2); overflow: hidden; margin: 0 0 22px; }
.tbar-fill { height: 100%; width: 100%; border-radius: var(--pill); background: var(--blue); transform-origin: left center; transition: transform 1s linear, background .3s ease; }
.tbar-fill.warn { background: var(--yellow); }
.tbar-fill.danger { background: var(--red); }

.question { font-size: 28px; font-weight: 700; line-height: 1.16; letter-spacing: -0.03em; margin: 6px 0 8px; }
.qhint { color: var(--muted-2); font-size: 12.5px; font-weight: 550; display: flex; align-items: center; gap: 6px; }

.guess-list { margin-top: 22px; display: grid; gap: 9px; }
.guess {
  display: flex; align-items: center; gap: 12px; padding: 7px 8px 7px 9px;
  background: var(--surface); border-radius: var(--pill);
}
.guess .nm { font-weight: 600; font-size: 15px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guess input { flex: 0 0 104px; text-align: center; padding: 11px 8px; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--bg); }
.guess.done input { color: var(--green); }

.hint-card { background: var(--surface); border-radius: var(--r-card); padding: 24px; text-align: center; }
.hint-card .t { font-size: 16px; font-weight: 650; }
.hint-card .d { color: var(--muted); font-size: 13.5px; margin-top: 5px; }

/* ── reveal ─────────────────────────────────────────────── */
.photo {
  width: 100%; aspect-ratio: 3/2; border-radius: var(--r-card); overflow: hidden;
  background: var(--surface); display: grid; place-items: center; margin-bottom: 20px;
}
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.answer-q { font-size: 15px; color: var(--muted); font-weight: 500; }
.answer-year { font-size: 68px; font-weight: 800; letter-spacing: -0.05em; line-height: 1.02; margin: 4px 0 0; font-variant-numeric: tabular-nums; color: var(--yellow); }
.answer-year .bc { font-size: 26px; font-weight: 650; color: var(--muted); letter-spacing: -0.02em; }
.fact { color: var(--muted); font-size: 15px; line-height: 1.5; margin-top: 12px; }

/* timeline */
.timeline { margin: 32px 0 0; }
.tl-line { height: 3px; border-radius: var(--pill); background: var(--surface-2); position: relative; margin: 36px 4px 0; }
.tl-actual { position: absolute; top: -11px; height: 25px; width: 3px; border-radius: var(--pill); background: var(--yellow); transform: translateX(-50%); }
.tl-actual::after {
  content: attr(data-y); position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
  font-size: 11px; font-weight: 750; color: #17130A; background: var(--yellow); padding: 3px 9px; border-radius: var(--pill); white-space: nowrap;
}
.tl-dot { position: absolute; top: 50%; transform: translate(-50%,-50%); }
.tl-dot .av { border: 2px solid var(--bg); }
.tl-dot span { position: absolute; top: 30px; left: 50%; transform: translateX(-50%); font-size: 10.5px; font-weight: 600; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.tl-ends { display: flex; justify-content: space-between; color: var(--muted-2); font-size: 11px; font-weight: 600; margin-top: 46px; font-variant-numeric: tabular-nums; }

.results { display: grid; gap: 8px; margin-top: 22px; }
.res { display: flex; align-items: center; gap: 12px; padding: 11px 16px 11px 11px; border-radius: var(--pill); background: var(--surface); }
.res .nm { font-weight: 600; font-size: 15px; flex: 1; min-width: 0; }
.res .nm small { display: block; font-size: 11.5px; color: var(--muted-2); font-weight: 500; margin-top: 1px; }
.res .gs { font-size: 14px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.res .gs small { display: block; font-size: 11px; color: var(--muted-2); font-weight: 500; }
.res .pt { font-weight: 750; font-size: 17px; min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.res.exact { background: rgba(255,214,10,.13); }
.res.exact .pt { color: var(--yellow); }

/* ── leaderboard ────────────────────────────────────────── */
.lb { display: grid; gap: 9px; }
.lb-row { display: flex; align-items: center; gap: 13px; padding: 12px 18px 12px 12px; border-radius: var(--pill); background: var(--surface); }
.lb-row .pos { font-size: 13px; font-weight: 700; width: 16px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.lb-row .nm { flex: 1; font-weight: 650; font-size: 16px; letter-spacing: -0.01em; }
.lb-row .nm small { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); margin-top: 1px; }
.lb-row .sc { font-weight: 750; font-size: 20px; font-variant-numeric: tabular-nums; }
.lb-row.p1 { background: rgba(255,214,10,.13); }
.lb-row.p1 .sc, .lb-row.p1 .pos { color: var(--yellow); }

/* ── recap ──────────────────────────────────────────────── */
.recap-q { padding: 13px 0; }
.recap-q + .recap-q { border-top: 1px solid var(--line); }
.recap-q .q { font-weight: 550; font-size: 14.5px; line-height: 1.4; }
.recap-q .q b { color: var(--yellow); font-weight: 700; }
.recap-q .g { color: var(--muted-2); font-size: 12.5px; margin-top: 5px; }
.recap-q .g b { color: var(--muted); font-weight: 650; }

/* ── misc ───────────────────────────────────────────────── */
.footer-note { color: var(--muted-2); font-size: 12px; text-align: center; margin-top: 26px; }
.spacer { height: 10px; }
.hidden { display: none !important; }

.burst { position: fixed; inset: 0; pointer-events: none; z-index: 99; overflow: hidden; }
.burst i { position: absolute; width: 7px; height: 7px; border-radius: var(--pill); animation: fly 1.5s cubic-bezier(.2,.6,.4,1) forwards; }
@keyframes fly { from { transform: translateY(0) scale(1); opacity: 1; } to { transform: translateY(-72vh) rotate(300deg) scale(.6); opacity: 0; } }
