/* A GAME ABOUT NOTHING - styles. Mobile first; desktop widens the frame. */

:root {
  --bg: #121316;
  --surface: #1c1e23;
  --surface-2: #26292f;
  --line: #33373f;
  --text: #f3efe6;
  --muted: #a7a399;
  --accent: #f2c744;
  --accent-ink: #1a1500;
  --good: #4cc38a;
  --bad: #e5604f;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Archivo Black", "Arial Black", Impact, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
  min-height: 100dvh;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
a { color: var(--accent); }
.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;
}

/* ---- Header ---------------------------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(18, 19, 22, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px 8px;
  padding-top: calc(10px + env(safe-area-inset-top));
}
.topbar-inner { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.brand {
  display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--text);
  font-family: var(--font-display); letter-spacing: 0.02em; line-height: 1;
}
.brand-a { font-size: 13px; color: var(--muted); letter-spacing: 0.18em; }
.brand-b { font-size: 24px; color: var(--accent); }
.modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.pill {
  height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); cursor: pointer; font-weight: 600; font-size: 14px; padding: 0 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pill:hover { background: var(--surface-2); }
.pill[aria-current="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---- Layout ---------------------------------------------------------------------------- */

main { max-width: 760px; margin: 0 auto; padding: 14px 14px 40px; }
.view { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.notice {
  border-radius: 10px; padding: 10px 12px; font-size: 14px; color: var(--muted);
  background: var(--surface-2); border: 1px dashed var(--line);
}
.notice.warn { color: var(--accent); border-color: rgba(242, 199, 68, 0.5); }
.notice.intro { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.notice.intro .btn.small { flex: 0 0 auto; }

/* ---- Play head ------------------------------------------------------------------------- */

.play-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.turn-label { font-family: var(--font-display); font-size: 18px; letter-spacing: 0.02em; }
.stake { color: var(--muted); font-size: 14px; }
.stake b { color: var(--accent); font-weight: 700; }

.score-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.score-cell {
  height: 40px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.score-cell.current { border-color: var(--accent); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.score-cell.solved { background: rgba(76, 195, 138, 0.14); border-color: rgba(76, 195, 138, 0.6); color: var(--good); }
.score-cell.missed { background: rgba(229, 96, 79, 0.12); border-color: rgba(229, 96, 79, 0.55); color: var(--bad); }

/* ---- The frame ------------------------------------------------------------------------- */

.frame {
  position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius);
  background: #000; border: 1px solid var(--line); box-shadow: var(--shadow);
}
.frame img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
  transform-origin: center center;
  transition: transform 720ms cubic-bezier(0.2, 0.7, 0.2, 1), opacity 240ms ease;
  will-change: transform;
}
.frame img.loading { opacity: 0; }
.frame-badge {
  position: absolute; left: 10px; top: 10px; padding: 4px 9px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase;
}
.frame-badge.full { background: rgba(242, 199, 68, 0.9); color: var(--accent-ink); }

.hint {
  font-size: 15px; color: var(--text); background: rgba(242, 199, 68, 0.12);
  border: 1px solid rgba(242, 199, 68, 0.45); border-radius: 10px; padding: 10px 12px;
}
.hint b { color: var(--accent); }

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

.guess { position: relative; display: flex; flex-direction: column; gap: 8px; }
.guess input[type="text"] {
  width: 100%; height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: inherit; font-size: 17px; padding: 0 14px; outline: none;
}
.guess input[type="text"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(242, 199, 68, 0.2); }
.guess input::placeholder { color: var(--muted); }
.suggest {
  position: absolute; left: 0; right: 0; top: 60px; z-index: 10; margin: 0; padding: 6px; list-style: none;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  max-height: 300px; overflow-y: auto;
}
.suggest li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  min-height: 56px; padding: 8px 12px; border-radius: 9px; cursor: pointer; font-size: 16px;
}
.suggest li:hover, .suggest li[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.suggest li .tag { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0.05em; 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: 8px; }
.btn {
  height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font-weight: 700; font-size: 16px; cursor: pointer; padding: 0 16px;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.small { height: 40px; font-size: 14px; padding: 0 12px; }
.btn.block { width: 100%; }

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

/* ---- Turn result ----------------------------------------------------------------------- */

.turn-result { display: flex; flex-direction: column; gap: 6px; text-align: center; }
.tr-head { font-family: var(--font-display); font-size: 22px; letter-spacing: 0.02em; }
.tr-head.good { color: var(--good); }
.tr-head.bad { color: var(--bad); }
.tr-title { font-size: 20px; font-weight: 700; }
.tr-meta { color: var(--muted); font-size: 14px; margin-bottom: 6px; }

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

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

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

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

.recap-rows { display: flex; flex-direction: column; gap: 8px; }
.recap-row {
  display: grid; grid-template-columns: 84px 1fr auto; gap: 12px; align-items: center;
  padding: 8px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
}
.recap-thumb { width: 84px; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: #000; }
.recap-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recap-ep .t { font-weight: 700; font-size: 16px; }
.recap-ep .m { color: var(--muted); font-size: 13px; }
.recap-pts { font-weight: 800; font-size: 18px; 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: 8px; }
.recap-actions .span2 { grid-column: 1 / -1; }
.streak-line { text-align: center; color: var(--muted); font-size: 14px; }
.streak-line b { color: var(--accent); }

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

.help h1 { font-family: var(--font-display); font-size: 24px; margin: 0 0 6px; }
.help h2 { font-size: 16px; margin: 14px 0 4px; }
.help p, .help li { color: var(--muted); font-size: 15px; }
.help ol, .help ul { padding-left: 20px; margin: 4px 0; }
.help .ladder { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; font-size: 15px; }
.help .ladder b { color: var(--accent); text-align: right; }

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

footer { max-width: 760px; margin: 0 auto; padding: 0 14px 30px; color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
footer a { color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 600;
  box-shadow: var(--shadow); font-size: 14px; max-width: calc(100vw - 32px);
}

/* ---- Desktop --------------------------------------------------------------------------- */

@media (min-width: 640px) {
  .topbar-inner { flex-direction: row; align-items: center; justify-content: space-between; }
  .modes { display: flex; }
  .pill { padding: 0 16px; }
  .brand-b { font-size: 28px; }
  .frame { max-height: 62vh; aspect-ratio: auto; height: min(62vh, 540px); }
  .recap-actions { grid-template-columns: 1fr 1fr 1fr; }
  .recap-actions .span2 { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .frame img { transition: none; }
}
