:root {
  --bg: #0b0b12;
  --surface: #15151f;
  --surface-2: #1e1e2c;
  --line: #2a2a3b;
  --text: #f4f4f8;
  --muted: #9b9bb2;
  --accent: #ffd60a;
  --accent-ink: #1a1500;
  --hot: #ff4d6d;
  --good: #2bd576;
  --mid: #ffb020;
  --bad: #ff4d6d;
  --radius: 14px;
  --display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --body: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
a { color: inherit; }
kbd {
  font: 600 11px/1 var(--body);
  padding: 3px 6px;
  border-radius: 5px;
  border: 1px solid currentColor;
  opacity: .55;
}

/* ---------------------------------------------------------------- shared */

.screen { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar { padding: 16px 20px; max-width: 1100px; width: 100%; margin: 0 auto; }
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font: 800 20px/1 var(--display); letter-spacing: -.02em; text-decoration: none;
}
.logo-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--accent);
  position: relative; flex: none;
}
.logo-mark::after {
  content: ''; position: absolute; left: 11px; top: 8px;
  border-style: solid; border-width: 6px 0 6px 9px;
  border-color: transparent transparent transparent var(--accent-ink);
}

.eyebrow {
  margin: 0 0 8px; color: var(--accent);
  font: 700 12px/1.2 var(--body); letter-spacing: .14em; text-transform: uppercase;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 12px 18px; cursor: pointer;
  font-weight: 700; text-decoration: none;
  transition: transform .08s ease, background .15s ease, opacity .15s;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn small { font-weight: 500; opacity: .75; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: #ffe04a; }
.btn-secondary { background: var(--surface-2); border: 1px solid var(--line); }
.btn-secondary:hover:not(:disabled) { background: #26263a; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--muted); }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn-xl {
  flex-direction: column; gap: 2px; padding: 16px 22px; min-height: 68px;
  font: 800 19px/1.15 var(--display); letter-spacing: -.01em;
}
.btn-xl small { font: 500 13px/1.2 var(--body); }

.cta { display: grid; gap: 12px; margin: 28px 0 0; }

.ad-slot { width: 100%; margin: 28px auto 0; min-height: 0; }
.ad-mock {
  display: grid; place-items: center; height: 100px; border-radius: 10px;
  border: 1px dashed var(--line); color: var(--muted); font-size: 13px;
}

.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); font-weight: 600;
  padding: 10px 16px; border-radius: 999px; transition: .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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

.home-main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 12px 20px 32px; }
.hero { max-width: 560px; }
.hero h1 {
  margin: 0; font: 800 clamp(38px, 9vw, 68px)/0.98 var(--display); letter-spacing: -.035em;
}
.lede { color: var(--muted); font-size: 18px; margin: 16px 0 0; max-width: 46ch; }

.daily-done {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface);
}
.daily-done p { margin: 0; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 24px 0 0; }
.stats div { background: var(--surface); border-radius: 12px; padding: 12px; }
.stats dt { color: var(--muted); font-size: 12px; }
.stats dd { margin: 2px 0 0; font: 800 22px/1.1 var(--display); }

.howto {
  list-style: none; counter-reset: step; padding: 0; margin: 36px 0 0;
  display: grid; gap: 10px;
}
.howto li {
  counter-increment: step; position: relative; padding: 14px 14px 14px 52px;
  background: var(--surface); border-radius: 12px; color: var(--muted);
}
.howto li b { color: var(--text); }
.howto li::before {
  content: counter(step); position: absolute; left: 14px; top: 12px;
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--accent); font: 800 14px/1 var(--display);
}

.footer {
  display: flex; gap: 10px; justify-content: center; padding: 20px 20px calc(20px + var(--safe-b));
  color: var(--muted); font-size: 14px;
}
.footer a { text-decoration: none; }
.footer a:hover { color: var(--text); }

@media (min-width: 900px) {
  .home-main {
    display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    column-gap: 64px; align-items: start; padding-top: 48px;
  }
  .cta { grid-template-columns: 1fr 1fr; }
  .howto { margin-top: 64px; }
  .ad-slot[data-ad-slot="home"] { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------------- game */

.game { height: 100dvh; min-height: 0; overflow: hidden; }

.hud {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 12px; height: 52px;
}
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: 10px; background: var(--surface); cursor: pointer; color: var(--muted);
}
.icon-btn:hover { color: var(--text); }
.hud-left { display: flex; gap: 8px; }
.mute-btn .icon-off, .mute-btn[aria-pressed="true"] .icon-on { display: none; }
.mute-btn[aria-pressed="true"] .icon-off { display: block; }
/* The browser blocked sound: nudge the player to tap for it. */
.mute-btn.attention { color: var(--accent-ink); background: var(--accent); animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 50% { transform: scale(1.12); } }
.hud-round { color: var(--muted); font-size: 14px; }
.hud-round b { color: var(--text); }
.hud-score { font: 800 18px/1 var(--display); }
.hud-score b { color: var(--accent); }

.stage { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.video-frame {
  position: relative; aspect-ratio: 16 / 9; width: 100%;
  overflow: hidden; background: #000;
}
/* The iframe is taller than the visible 16:9 box. YouTube letterboxes the
   video in the middle, so its title bar (which would spoil the brand) sits in
   the cropped-off strip above the frame. */
.video-crop { position: absolute; left: 0; right: 0; top: -90px; bottom: -90px; pointer-events: none; }
.video-crop iframe, .video-crop #yt { width: 100%; height: 100%; border: 0; display: block; }

.masks { position: absolute; inset: 0; pointer-events: none; }
.mask {
  position: absolute; border-radius: 6px;
  /* Mostly opaque: backdrop blur doesn't reach into the YouTube iframe everywhere. */
  background: rgba(20, 20, 30, .92);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.curtain {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  background: radial-gradient(circle at 50% 40%, #1d1d2b, #0b0b12 70%);
  pointer-events: none;
  transition: opacity .25s ease;
}
.curtain[data-state="tap"] { pointer-events: auto; cursor: pointer; }
.curtain[data-state="hidden"] { opacity: 0; }
.curtain p { margin: 12px 0 0; color: var(--muted); font-weight: 600; }
.curtain[data-state="tap"] p {
  color: var(--accent-ink); background: var(--accent); padding: 12px 20px; border-radius: 999px;
  font: 800 18px/1 var(--display);
}
.curtain[data-state="tap"] .spinner, .curtain[data-state="ended"] .spinner { display: none; }
.curtain[data-state="ended"] p { color: var(--text); font: 800 clamp(28px, 6vw, 56px)/1 var(--display); letter-spacing: -.03em; }
.spinner {
  width: 34px; height: 34px; margin: 0 auto; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.meter { padding: 10px 14px 0; }
.meter-bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter-bar i {
  display: block; height: 100%; background: var(--good); transform-origin: left;
  transition: background .3s;
}
.meter[data-level="mid"] .meter-bar i { background: var(--mid); }
.meter[data-level="low"] .meter-bar i { background: var(--bad); }
.meter-row { display: flex; justify-content: space-between; margin-top: 6px; font-size: 13px; color: var(--muted); }
.meter-pts b { color: var(--text); font: 800 16px/1 var(--display); font-variant-numeric: tabular-nums; }
.meter-time { font-variant-numeric: tabular-nums; }
.meter.done { opacity: .35; }
.meter.done .meter-pts { visibility: hidden; }

.panel {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  padding: 10px 14px calc(14px + var(--safe-b));
  overflow-y: auto;
}
.prompt { margin: 4px 0 10px; color: var(--muted); font-weight: 600; }

.reveal { margin: 4px 0 12px; animation: pop .25s ease; }
.reveal p { margin: 0; }
.reveal-verdict { font-weight: 700; color: var(--bad); }
.reveal-verdict[data-ok="true"] { color: var(--good); }
.reveal-brand { font: 800 34px/1.05 var(--display); letter-spacing: -.03em; margin-top: 2px !important; }
.reveal-meta { color: var(--muted); font-size: 14px; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }

/* Answers live in the thumb zone on phones: pushed to the bottom. */
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.prompt, .reveal { margin-top: auto; }
.option {
  position: relative; min-height: 64px; padding: 12px 10px;
  border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface);
  font: 800 17px/1.15 var(--display); letter-spacing: -.01em; cursor: pointer;
  transition: transform .08s ease, border-color .15s, background .15s, opacity .2s;
}
.option kbd { display: none; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); }
.option:hover:not(:disabled) { border-color: var(--accent); }
.option:active:not(:disabled) { transform: scale(.97); }
.option:disabled { cursor: default; }
.option.is-correct { border-color: var(--good); background: color-mix(in srgb, var(--good) 22%, var(--surface)); }
.option.is-wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 22%, var(--surface)); }
.option:disabled:not(.is-correct):not(.is-wrong) { opacity: .6; }
body[data-screen="game"] .options:has(.is-correct) .option:not(.is-correct):not(.is-wrong) { opacity: .4; }

.panel-actions { display: flex; gap: 10px; margin-top: 10px; }
.panel-actions .btn { flex: 1; min-height: 52px; }
#btn-next { font: 800 18px/1 var(--display); }

.ad-slot-side { display: none; }

/* Landscape phones: video left, answers right. */
@media (orientation: landscape) and (max-height: 540px) {
  .hud { height: 44px; }
  .stage { flex-direction: row; gap: 12px; padding: 0 12px calc(8px + var(--safe-b)); }
  .video-col { flex: none; width: min(62vw, calc((100dvh - 44px - 48px) * 16 / 9)); }
  .video-frame { border-radius: 10px; }
  .meter { padding: 8px 0 0; }
  .panel { padding: 0; }
  .reveal-brand { font-size: 26px; }
  .option { min-height: 52px; font-size: 15px; }
}

/* Laptop / desktop: big video with a side panel and keyboard shortcuts. */
@media (min-width: 900px) and (min-height: 541px) {
  .hud { max-width: 1320px; width: 100%; margin: 0 auto; padding: 12px 24px; height: 64px; }
  .stage {
    display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start;
    max-width: 1320px; width: 100%; margin: 0 auto; padding: 0 24px 24px;
  }
  .video-col { width: 100%; max-width: calc((100dvh - 64px - 70px) * 16 / 9); justify-self: center; }
  .video-frame { border-radius: 16px; }
  .meter { padding: 12px 2px 0; }
  .panel {
    background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
    padding: 18px; max-height: calc(100dvh - 88px); overflow-y: auto;
  }
  .options { grid-template-columns: 1fr; }
  .prompt, .reveal { margin-top: 0; }
  .option { text-align: left; padding-left: 44px; min-height: 58px; background: var(--surface-2); }
  .option kbd { display: inline-block; }
  .ad-slot-side { display: block; margin-top: 18px; }
  .ad-slot-side .ad-mock { height: 250px; }
}

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

.results-main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 24px 20px 40px; text-align: center; }
.res-score { margin: 0; font: 800 clamp(56px, 16vw, 96px)/1 var(--display); letter-spacing: -.04em; }
.res-score b { color: var(--accent); }
.res-msg { color: var(--muted); font-size: 18px; margin: 10px 0 0; }
.res-squares { font-size: 28px; letter-spacing: 4px; margin: 14px 0 0; }
.results-main .cta { grid-template-columns: 1fr 1fr; }
#btn-home { margin-top: 14px; }

.res-list { list-style: none; padding: 0; margin: 28px 0 0; text-align: left; display: grid; gap: 6px; }
.res-list li {
  display: grid; grid-template-columns: 24px 1fr auto auto auto; gap: 10px; align-items: center;
  padding: 10px 12px; background: var(--surface); border-radius: 10px; font-size: 15px;
}
.res-list .b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-list .t { color: var(--muted); font-size: 13px; }
.res-list .p { font: 800 15px/1 var(--display); min-width: 44px; text-align: right; }
.res-list a { color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- mock ad break */

.ad-break {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px;
  background: rgba(5, 5, 10, .92); backdrop-filter: blur(6px);
}
.ad-break-card { width: min(640px, 100%); text-align: center; }
.ad-break-video {
  aspect-ratio: 16 / 9; display: grid; place-content: center; gap: 8px; border-radius: 14px;
  background: repeating-linear-gradient(45deg, #1a1a26 0 14px, #20202e 14px 28px);
  font: 800 24px/1.1 var(--display);
}
.ad-break-video small { font: 500 13px/1.3 var(--body); color: var(--muted); }
.ad-break p:last-child { color: var(--muted); }

/* ---------------------------------------------------------------- static pages */

.doc { max-width: 680px; margin: 0 auto; padding: 8px 20px 48px; color: #d7d7e2; }
.doc h1 { font: 800 40px/1.05 var(--display); letter-spacing: -.03em; color: var(--text); }
.doc h2 { font: 800 22px/1.2 var(--display); color: var(--text); margin-top: 32px; }
