/* A GAME ABOUT NOTHING - minimal, mobile-first layout. */

:root {
  --bg: #111214;
  --surface: #18191d;
  --surface-2: #202228;
  --line: #282b33;
  --text: #f3efe6;
  --muted: #8e8b82;
  --accent: #f2c744;
  --accent-ink: #171300;
  --good: #4cc38a;
  --bad: #e5604f;
  --radius: 12px;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Archivo Black", "Arial Black", Impact, sans-serif;
  --font-quote: "Lora", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.4;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---- Minimal single-row header --------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(17, 18, 20, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 8px 14px;
  padding-top: calc(8px + env(safe-area-inset-top));
}
.topbar-inner {
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-display);
  line-height: 1;
}
.brand:hover { text-decoration: none; }
.brand-a {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.16em;
  margin-bottom: 2px;
}
.brand-b {
  font-size: 19px;
  color: var(--accent);
  letter-spacing: 0.03em;
}
.modes {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}
.pill {
  height: 30px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 12.5px;
  padding: 0 11px;
  white-space: nowrap;
  transition: background 120ms ease, color 120ms ease;
}
.pill:hover { color: var(--text); }
.pill[aria-current="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

/* ---- Main column ----------------------------------------------------------------------- */

main {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 12px 14px 24px;
  flex: 1 0 auto;
}
.view { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.notice {
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: center;
}
.notice.warn { color: var(--accent); border-color: rgba(242, 199, 68, 0.4); }
/* Keep intro notice hidden so mobile plays immediately above the fold without banner clutter */
.notice.intro { display: none !important; }

/* ---- Play header & score strip --------------------------------------------------------- */

.play-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
}
.turn-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.stake { color: var(--muted); font-size: 12.5px; }
.stake b { color: var(--accent); font-weight: 700; }

.score-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}
.score-cell {
  height: 28px;
  border-radius: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.score-cell.current {
  border-color: var(--accent);
  color: var(--text);
}
.score-cell.solved {
  background: rgba(76, 195, 138, 0.12);
  border-color: rgba(76, 195, 138, 0.5);
  color: var(--good);
}
.score-cell.missed {
  background: rgba(229, 96, 79, 0.1);
  border-color: rgba(229, 96, 79, 0.45);
  color: var(--bad);
}

/* ---- Clue stage ------------------------------------------------------------------------ */

.clue-stage {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 2px;
}
.clue-stage.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.clue-slot {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  border: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}
.clue-slot .clue-num {
  position: absolute;
  left: 7px;
  top: 5px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  opacity: 0.65;
}
.clue-slot .clue-glyph {
  width: 66%;
  height: 66%;
  object-fit: contain;
  display: block;
  opacity: 0;
  transform: scale(0.75);
  transition: opacity 220ms ease, transform 260ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.clue-slot.revealed {
  background: var(--surface-2);
  border: 1px solid rgba(242, 199, 68, 0.38);
}
.clue-slot.revealed .clue-glyph { opacity: 1; transform: none; }
.clue-slot.revealed .clue-num { color: var(--accent); opacity: 0.9; }
.clue-slot .clue-dot { display: none; }
.clue-caption {
  text-align: center;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  margin-top: -2px;
}

.hint {
  font-size: 12.5px;
  color: var(--text);
  background: rgba(242, 199, 68, 0.09);
  border: 1px solid rgba(242, 199, 68, 0.35);
  border-radius: 8px;
  padding: 7px 10px;
  text-align: center;
  letter-spacing: 0.04em;
}
.hint b { color: var(--accent); font-weight: 700; }

/* ---- Guess form ------------------------------------------------------------------------ */

.guess { position: relative; display: flex; flex-direction: column; gap: 6px; }
.guess input[type="text"] {
  width: 100%;
  height: 46px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* >=16px prevents mobile Safari auto-zoom */
  padding: 0 12px;
  outline: none;
}
.guess input[type="text"]:focus {
  border-color: var(--accent);
}
.guess input::placeholder { color: var(--muted); }
.suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: 50px;
  z-index: 15;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  max-height: 210px;
  overflow-y: auto;
}
.suggest li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 6px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 14.5px;
}
.suggest li:hover, .suggest li[aria-selected="true"] {
  background: var(--accent);
  color: var(--accent-ink);
}
.suggest li .tag {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.04em;
  flex: 0 0 auto;
}
.suggest li[aria-selected="true"] .tag, .suggest li:hover .tag { color: var(--accent-ink); }
.suggest li.empty { color: var(--muted); cursor: default; }
.suggest li.empty:hover { background: transparent; color: var(--muted); }

.guess-actions { display: grid; grid-template-columns: 2fr 1fr; gap: 6px; }
.btn {
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  padding: 0 14px;
}
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; filter: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); }
.btn.small { height: 32px; font-size: 12.5px; padding: 0 10px; }
.btn.block { width: 100%; }

.misses { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.misses li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
}
.misses li .miss-title { text-decoration: line-through; color: var(--muted); }
.misses li .miss-fb { color: var(--text); font-weight: 600; font-size: 12px; flex: 0 0 auto; }
.misses li.skip .miss-title { text-decoration: none; font-style: italic; }

/* ---- Browse by season (chips + scrollable episode list) -------------------------------- */

.browse { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.season-bar {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 1px 0;
}
.season-bar::-webkit-scrollbar { display: none; }
.chip {
  flex: 1 0 auto;
  min-width: 34px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 0 8px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip.open { background: var(--surface-2); color: var(--text); border-color: var(--muted); }
.chip.hinted { border-color: var(--accent); color: var(--accent); }
.chip.hinted.open { background: rgba(242, 199, 68, 0.14); }
.browse-list {
  list-style: none;
  margin: 0;
  padding: 4px;
  max-height: 42vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.browse-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 6px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 14px;
}
.browse-list li .num {
  flex: 0 0 44px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.browse-list li:hover { background: var(--surface-2); }
.browse-list li:active { background: var(--accent); color: var(--accent-ink); }
.browse-list li.used { cursor: default; }
.browse-list li.used .title { text-decoration: line-through; color: var(--muted); }
.browse-list li.used:hover { background: transparent; }
.browse-list li.dim { opacity: 0.35; }

/* ---- Turn result (reveal card) --------------------------------------------------------- */

.turn-result { display: flex; flex-direction: column; gap: 6px; text-align: center; padding: 16px 14px 14px; }
.tr-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.tr-head.good { color: var(--good); }
.tr-head.bad { color: var(--bad); }
.tr-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}
.tr-title { font-family: var(--font-display); font-size: 22px; line-height: 1.15; letter-spacing: 0.01em; }
.tr-quote {
  margin: 6px 0 0;
  padding: 0 6px;
  font-family: var(--font-quote);
  font-style: italic;
  font-size: 17px;
  line-height: 1.35;
  color: var(--text);
}
.tr-quote .q-who {
  display: block;
  margin-top: 4px;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.tr-quote .q-who::before { content: "\2014  "; }
.tr-beats {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
  margin: 2px 0 8px;
}
.tr-beats .dot { color: var(--accent); margin: 0 7px; }

/* ---- Endless HUD ----------------------------------------------------------------------- */

.endless-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  padding: 8px 12px;
}
.endless-hud b { color: var(--text); font-size: 14px; }
.endless-hud .hud-stats { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---- Recap ----------------------------------------------------------------------------- */

.recap-head { text-align: center; display: flex; flex-direction: column; gap: 3px; padding: 14px 12px; }
.recap-kicker { color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; }
.recap-total { font-family: var(--font-display); font-size: 44px; line-height: 1.05; color: var(--accent); }
.recap-total small { font-size: 18px; color: var(--muted); font-family: var(--font-body); font-weight: 600; }
.recap-verdict { font-size: 15px; font-weight: 700; }
.recap-social { color: var(--muted); font-size: 13px; }
.recap-social b { color: var(--text); }

.recap-rows { display: flex; flex-direction: column; gap: 6px; }
.recap-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.recap-emoji { display: flex; gap: 3px; }
.recap-emoji img { width: 22px; height: 22px; display: block; }
.recap-emoji .dim { opacity: 0.22; }
.recap-ep .t { font-weight: 700; font-size: 14px; }
.recap-ep .m { color: var(--muted); font-size: 12px; }
.recap-pts { font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }
.recap-pts.good { color: var(--good); }
.recap-pts.bad { color: var(--bad); }

.recap-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.recap-actions .span2 { grid-column: 1 / -1; }
.streak-line { text-align: center; color: var(--muted); font-size: 13px; }
.streak-line b { color: var(--accent); }

/* ---- Help ------------------------------------------------------------------------------ */

.help h1 { font-family: var(--font-display); font-size: 20px; margin: 0 0 6px; }
.help h2 { font-size: 14px; margin: 12px 0 4px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text); }
.help p, .help li { color: var(--muted); font-size: 14px; }
.help ol, .help ul { padding-left: 18px; margin: 4px 0; }
.help .ladder { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 14px; }
.help .ladder b { color: var(--accent); text-align: right; }
.help .fine { font-size: 11.5px; margin-top: 14px; }

/* ---- Footer / toast -------------------------------------------------------------------- */

footer {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 0 14px 20px;
  color: var(--muted);
  font-size: 11.5px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
}
footer a { color: var(--muted); }
.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 50;
  background: var(--text);
  color: var(--bg);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  font-size: 13px;
  max-width: calc(100vw - 28px);
}

@media (prefers-reduced-motion: reduce) {
  .clue-slot .clue-glyph { transition: none; }
}
