/* Layout: masthead with category tabs; hero = intro + featured game; card grid; game page = stage + sidebar ad.
   Look: school-bus yellow on cool notebook paper (light) / chalkboard slate (dark). Bungee only for logo + headings. */
:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --ink: #1b2333;
  --muted: #586378;
  --line: #d4dbe6;
  --accent: #ffc21a;
  --accent-ink: #1b2333;
  --link: #2a55e0;
  --rule: rgba(42, 85, 224, .07);
  --shadow: 0 1px 2px rgba(27, 35, 51, .08), 0 6px 18px rgba(27, 35, 51, .06);
  --display: "Bungee", "Arial Black", Impact, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151d24; --surface: #1d2730; --ink: #e8edf2; --muted: #9aa8b5; --line: #2c3a46;
    --accent: #ffc21a; --accent-ink: #1b2333; --link: #93b2ff; --rule: rgba(255, 255, 255, .025);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151d24; --surface: #1d2730; --ink: #e8edf2; --muted: #9aa8b5; --line: #2c3a46;
  --accent: #ffc21a; --accent-ink: #1b2333; --link: #93b2ff; --rule: rgba(255, 255, 255, .025);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .25); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 var(--body);
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule) 31px 32px);
}
img { max-width: 100%; display: block; }
a { color: var(--link); }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.wrap { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 16px; }
.mono { font-family: var(--mono); }
.big { font-size: 1.15rem; }
.small { font-size: .85rem; color: var(--muted); }

/* masthead */
.masthead { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line); }
.mast-row { display: flex; align-items: center; gap: 20px; padding-block: 10px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 1.3rem; color: var(--ink); text-decoration: none; letter-spacing: .01em; }
.bell { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .15); position: relative; }
.bell::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--accent-ink); }
.cats { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1; }
.cats a { padding: 6px 10px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 700; font-size: .92rem; white-space: nowrap; }
.cats a:hover { background: var(--bg); color: var(--ink); }

main { padding-block: 24px 48px; display: grid; gap: 28px; }

/* hero */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; align-items: center; }
.eyebrow { margin: 0 0 6px; font-family: var(--mono); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
h1, h2 { text-wrap: balance; }
.hero h1 { font-family: var(--display); font-weight: 400; font-size: clamp(1.9rem, 4.2vw, 3rem); line-height: 1.05; margin: 0 0 12px; }
.lede { margin: 0 0 18px; color: var(--muted); max-width: 46ch; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: 700 .9rem var(--body); padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.chip:hover { border-color: var(--ink); }
.chip.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.feature { position: relative; display: block; border-radius: 14px; overflow: hidden; text-decoration: none; color: #fff; box-shadow: var(--shadow); }
.feature .thumb { aspect-ratio: 16 / 10; border-radius: 0; }
.feature::after { content: ""; position: absolute; inset: 40% 0 0; background: linear-gradient(to top, rgba(10, 14, 22, .85), transparent); }
.feature-tag, .feature-title, .feature-meta { position: absolute; left: 18px; z-index: 1; }
.feature-tag { top: 16px; background: var(--accent); color: var(--accent-ink); font: 700 .75rem var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 5px 9px; border-radius: 6px; }
.feature-title { bottom: 40px; right: 18px; font-family: var(--display); font-size: clamp(1.2rem, 2.6vw, 1.7rem); line-height: 1.1; }
.feature-meta { bottom: 14px; font-size: .9rem; opacity: .9; }
.feature .clock { color: #fff; border-color: rgba(255, 255, 255, .5); }

/* section heads */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sec-head h2 { font-family: var(--display); font-weight: 400; font-size: 1.35rem; margin: 0; }
.count { margin: 0; color: var(--muted); font-family: var(--mono); font-size: .85rem; font-variant-numeric: tabular-nums; }

/* grid + cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; text-decoration: none; color: var(--ink); transition: transform .15s ease, box-shadow .15s ease; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-body { display: grid; gap: 6px; padding: 10px 12px 12px; }
.card-title { font-weight: 700; line-height: 1.25; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: .8rem; color: var(--muted); }
.clock { font: 700 .72rem var(--mono); letter-spacing: .02em; padding: 2px 7px; border: 1.5px solid var(--line); border-radius: 999px; color: var(--ink); white-space: nowrap; }
.card[hidden] { display: none; }

.thumb { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: hsl(var(--h) 65% 55%); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.nothumb { background: linear-gradient(135deg, hsl(var(--h) 70% 58%), hsl(calc(var(--h) + 40) 70% 42%)); }
.thumb.nothumb::before { content: attr(data-initials); position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: clamp(1.6rem, 5vw, 2.6rem); color: rgba(255, 255, 255, .92); text-shadow: 0 2px 0 rgba(0, 0, 0, .18); }

/* ads */
.ad { display: grid; gap: 4px; justify-items: center; }
.ad-label { font: .68rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ad-ph { display: grid; place-items: center; width: 100%; min-height: 90px; border: 1.5px dashed var(--line); border-radius: 8px; color: var(--muted); font: .8rem var(--mono); background: var(--surface); }
.ad-side .ad-ph { min-height: 600px; }
.ad-in_grid.span-row { grid-column: 1 / -1; }
.sticky { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 72px); }

/* game page */
.crumbs { display: flex; gap: 8px; font-size: .9rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.game-main { display: grid; gap: 22px; min-width: 0; }
.game-h1 { font-family: var(--display); font-weight: 400; font-size: clamp(1.6rem, 3.4vw, 2.3rem); line-height: 1.1; margin: 0; }
.game-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: -12px 0 0; color: var(--muted); font-size: .92rem; }

.stage { position: relative; width: 100%; aspect-ratio: var(--ratio); max-height: 78vh; margin-inline: auto; background: #0c1117; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.stage.is-portrait { max-width: min(100%, 440px); }
.stage .thumb { position: absolute; inset: 0; aspect-ratio: auto; filter: saturate(.9) brightness(.7); }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 10px; font: 400 1.25rem var(--display); padding: 14px 26px 14px 20px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink); cursor: pointer; box-shadow: 0 6px 0 rgba(0, 0, 0, .25); }
.play:active { transform: translate(-50%, calc(-50% + 3px)); box-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.play-ico { width: 0; height: 0; border-left: 14px solid currentColor; border-block: 9px solid transparent; }
.fs { position: absolute; right: 10px; bottom: 10px; font: 700 .8rem var(--body); padding: 6px 10px; border-radius: 6px; border: 0; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; }

.block h2, .prose h2 { font-size: 1.15rem; margin: 0 0 8px; }
.block p, .block ol { margin: 0; max-width: 68ch; }
.block ol { padding-left: 1.2em; display: grid; gap: 4px; }
.tags { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { font-size: .8rem; padding: 3px 9px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.ctls { display: grid; gap: 8px; }
.ctl { display: grid; grid-template-columns: minmax(0, 190px) minmax(0, 1fr); gap: 12px; align-items: center; }
.keys { display: flex; flex-wrap: wrap; gap: 4px; }
kbd { font: 700 .78rem var(--mono); padding: 3px 8px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); border-bottom-width: 3px; color: var(--ink); }
.faq details { border-top: 1px solid var(--line); padding-block: 10px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { margin-top: 6px; color: var(--muted); }

.prose { max-width: 68ch; display: grid; gap: 12px; }
.prose p { margin: 0; }
.empty { color: var(--muted); }

/* footer */
.foot { border-top: 1px solid var(--line); background: var(--surface); }
.foot-row { display: grid; gap: 10px; padding-block: 24px; font-size: .9rem; color: var(--muted); }
.foot-row p { margin: 0; max-width: 72ch; }
.foot-row nav { display: flex; gap: 16px; }

@media (max-width: 900px) {
  .game-layout { grid-template-columns: minmax(0, 1fr); }
  .game-side { display: none; }
}
@media (max-width: 720px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .feature { order: -1; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .ctl { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
