/* MonkeyCalc design rules (see brand/README.md):
   - Two grounds, both dark: the page, and panels (all text lives in one). The player and featured game sit on near-black.
   - One accent, banana yellow, used only for Play.
   - Four type sizes; one spacing scale (4px steps); corners 16 panels and player, 12 cards and icons, 10 buttons, round pills.
   - A game appears two ways only: a card in grids, a row (48px icon, title, category) in lists. */
@font-face { font-family: "Plus Jakarta Sans"; src: url(/fonts/plus-jakarta-sans.woff2) format("woff2"); font-weight: 200 800; font-display: swap; }
/* One dark palette for every visitor (no light mode): nothing splits the page into light and dark halves. */
:root {
  --bg: #161311; --surface: #221e1c; --text: #fafaf9; --muted: #a8a29e; --line: #34302d; --line-strong: #57534e;
  --stage: var(--bg); --stage-surface: var(--surface); --stage-text: var(--text); --stage-muted: var(--muted); --stage-line: var(--line-strong);
  --action: #fafaf9; --action-ink: #1c1917;
  --accent: #ffcf33; --accent-ink: #1c1917;
  --focus: #ffcf33;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --t-xs: .8125rem; --t-sm: .875rem; --t-md: 1rem; --t-panel: 1.0625rem; --t-section: 1.3125rem; --t-title: clamp(1.75rem, 1.2rem + 2vw, 2.125rem);
  --r-btn: 10px; --r-card: 12px; --r-panel: 16px; --r-pill: 999px; --tap: 44px;
  color-scheme: dark;
}

/* base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; overflow-x: clip; background: var(--bg); color: var(--text); font: var(--t-md)/1.5 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
a:hover { text-decoration-color: currentColor; }
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--action); color: var(--action-ink); padding: var(--s2) var(--s4); z-index: 200; }
.skip:focus { left: 0; }
p { margin: 0 0 var(--s3); }

/* type: page title, section title, panel title, body */
h1 { font-size: var(--t-title); line-height: 1.15; font-weight: 800; letter-spacing: -.02em; margin: var(--s2) 0 var(--s1); }
h2 { font-size: var(--t-section); line-height: 1.3; font-weight: 800; margin: var(--s7) 0 var(--s3); }
.panel h2 { font-size: var(--t-panel); font-weight: 700; margin: 0 0 var(--s2); }
.meta, .lead { margin: 0; color: var(--muted); font-size: var(--t-sm); }
.lead { font-size: var(--t-md); max-width: 60ch; }

/* buttons: Play (accent pill), action (ink), ghost (outline on the stage) */
.btn, .search button { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 18px; font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: var(--r-btn); background: var(--action); color: var(--action-ink); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--stage-text); border: 1px solid var(--stage-line); }
.btn-ghost:hover { border-color: var(--stage-muted); }
.play { display: inline-flex; align-items: center; gap: .4em; max-width: 100%; min-height: 56px; padding: 0 30px; font: inherit; font-size: 1.2rem; font-weight: 800; cursor: pointer; border: 0; border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); white-space: nowrap; }
.play:hover { filter: brightness(1.05); }
.play-name { overflow: hidden; text-overflow: ellipsis; }

/* header and category bar: identical on every page */
.top { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: center; padding: 10px var(--s5); background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
@media (max-width: 600px) { .top { position: static; padding: 10px var(--s4); } }
.logo { display: inline-flex; align-items: center; gap: 10px; font-size: 1.25rem; letter-spacing: -.02em; text-decoration: none; white-space: nowrap; }
.logo b { font-weight: 800; }
.wordmark span { font-weight: 500; color: var(--muted); }
.search { display: flex; align-items: stretch; flex: 1 1 15rem; max-width: 32rem; margin-left: auto; }
.search input { flex: 1; min-width: 0; font: inherit; min-height: var(--tap); padding: 0 14px; border: 1px solid var(--line-strong); border-right: 0; border-radius: var(--r-btn) 0 0 var(--r-btn); background: var(--bg); color: var(--text); }
/* one unit: same height and border on both halves; iOS/WebKit default control styling removed; 16px text stops iPhone zooming in */
.search input, .search button { -webkit-appearance: none; appearance: none; margin: 0; height: var(--tap); font-size: 1rem; }
.search button { flex: none; border: 1px solid var(--action); border-radius: 0 var(--r-btn) var(--r-btn) 0; }
.cats { background: var(--surface); border-bottom: 1px solid var(--line); }
.cats ul, .chips, .crumbs ol, .pages ul { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--s2); }
.cats ul { overflow-x: auto; padding: 10px var(--s5); scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - var(--s7)), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - var(--s7)), transparent); }
.cats ul::-webkit-scrollbar { display: none; }
.cats li:last-child { padding-right: var(--s7); }
.cats a, .chips a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; white-space: nowrap; text-decoration: none; font-size: var(--t-sm); border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface); }
.cats a:hover, .chips a:hover { border-color: var(--line-strong); }
.cats a[aria-current] { background: var(--action); color: var(--action-ink); border-color: var(--action); }

/* page */
main { max-width: 1200px; margin: 0 auto; padding: var(--s5) var(--s5) var(--s7); }
@media (max-width: 600px) { main { padding: var(--s4) var(--s4) var(--s7); } }
.page-head { margin: 0 0 var(--s5); }
.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); margin: var(--s7) 0 var(--s3); }
.row-head h2 { margin: 0; }
.row-head a { font-size: var(--t-sm); font-weight: 600; white-space: nowrap; }
.crumbs ol { flex-wrap: wrap; font-size: var(--t-sm); color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: var(--s2); }

/* stage band: full-width dark ground wherever the page is about playing */
.band { margin: calc(-1 * var(--s5)) calc(50% - 50vw) 0; padding: var(--s5) max(var(--s5), calc(50vw - 600px + var(--s5))) var(--s6); background: var(--stage); color: var(--stage-text); }
@media (max-width: 600px) { .band { margin-top: calc(-1 * var(--s4)); padding: var(--s4) var(--s4) var(--s5); } }
.band .crumbs ol, .band .meta { color: var(--stage-muted); }
.band-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s5); }
.band-head h1 { margin-top: var(--s2); }
.band-actions { display: flex; gap: var(--s2); }
.band-body { display: grid; gap: var(--s5); }
@media (min-width: 1024px) { .band-body { grid-template-columns: minmax(0, 1fr) 320px; } }
.band-intro { display: flex; flex-direction: column; justify-content: center; }
.band-intro .feature { margin-top: var(--s5); }
.band-intro h1 { margin: 0 0 var(--s1); }

/* the player */
.stage { border-radius: var(--r-panel); overflow: hidden; background: #0c0a09; }
.player { position: relative; aspect-ratio: 16 / 10; max-height: 78svh; width: 100%; display: grid; place-items: center; overflow: hidden; }
@media (max-width: 700px) { .player { aspect-ratio: 4 / 5; } }
.player-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(22px) brightness(.5); transform: scale(1.15); }
.player-start { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--s4); max-width: 90%; }
.player-start > img { border-radius: 24px; box-shadow: 0 0 0 4px rgb(255 255 255 / .12); }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.stage:fullscreen, .stage.pseudo-full { position: fixed; inset: 0; z-index: 300; border-radius: 0; display: flex; }
.stage:fullscreen .player, .stage.pseudo-full .player { flex: 1; aspect-ratio: auto; max-height: none; }
.pseudo-on #fs { position: fixed; top: var(--s2); right: var(--s2); z-index: 301; background: var(--stage); }

/* homepage feature: the most played game, on the stage */
.feature { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4) var(--s5); padding: var(--s5); border-radius: var(--r-panel); overflow: hidden; background: #0c0a09; color: var(--stage-text); text-decoration: none; }
.feature > img:not(.player-bg) { position: relative; border-radius: 20px; box-shadow: 0 0 0 4px rgb(255 255 255 / .12); }
.feature-text { position: relative; display: flex; flex-direction: column; flex: 1 1 10rem; min-width: 0; }
.feature-text small { color: #d6d3d1; font-size: var(--t-xs); }
.feature-text b { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.feature-text span { color: #d6d3d1; font-size: var(--t-sm); }
.feature .play { position: relative; }

/* panels: the only place text sits */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 28px 32px; }
@media (max-width: 600px) { .panel { padding: 20px; } }
.panel > h2 ~ h2 { margin-top: var(--s5); }
.panel-stage { background: var(--stage-surface); border: 0; color: var(--stage-text); padding: 20px 20px var(--s3); }
.panel-stage small, .panel-stage .rows small { color: var(--stage-muted); }
.text { line-height: 1.7; }
.text p, .text li { max-width: 68ch; }
.text p:last-child { margin-bottom: 0; }
.text section + section { border-top: 1px solid var(--line); margin-top: var(--s5); padding-top: var(--s5); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: step; }
.steps li { position: relative; padding-left: 36px; counter-increment: step; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: .2em; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--action); color: var(--action-ink); font-size: 12px; font-weight: 700; line-height: 1; }
details { border-top: 1px solid var(--line); padding: var(--s3) 0; }
details:last-child { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 600; min-height: 28px; }
details p { margin: var(--s2) 0 0; color: var(--muted); }
.facts { display: grid; grid-template-columns: auto 1fr; margin: 0; font-size: var(--t-sm); }
.facts dt, .facts dd { padding: 10px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-weight: 600; }
.facts dt:last-of-type, .facts dd:last-of-type { border-bottom: 0; }
.chips { flex-wrap: wrap; }

/* game page below the stage: description and game info */
.split { display: grid; gap: var(--s5); margin-top: var(--s6); align-items: start; }
@media (min-width: 1024px) { .split { grid-template-columns: minmax(0, 1fr) 320px; } }

/* a game as a row */
.rows { list-style: none; margin: 0; padding: 0; }
.rows a { display: flex; align-items: center; gap: var(--s3); padding: var(--s2); margin: 0 calc(-1 * var(--s2)); border-radius: var(--r-btn); text-decoration: none; }
.rows a:hover { background: var(--bg); }
.panel-stage .rows a:hover { background: rgb(255 255 255 / .06); }
.rows img { width: 48px; height: 48px; flex: none; border-radius: var(--r-card); object-fit: cover; background: var(--line); }
.rows span { min-width: 0; }
.rows b { display: block; font-size: .9375rem; font-weight: 700; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows small { display: block; font-size: var(--t-xs); color: var(--muted); }

/* a game as a card: fixed 3/4/6/8 columns so 24- and 48-game lists fill whole rows */
.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); grid-template-columns: repeat(3, 1fr); }
@media (min-width: 520px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 760px) { .grid { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(8, 1fr); gap: var(--s3); } }
@media (max-width: 1023px) { .shelf li:nth-child(n+13) { display: none; } } /* shelves hold 16: two rows at 8 columns, 12 below */
.card { display: block; height: 100%; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.card img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--line); }
/* margin, not padding: the line clamp clips at the padding edge, so padding would show part of a third line */
.card span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; height: 2.6em; margin: var(--s2) 10px 10px; font-size: var(--t-xs); font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.card:hover { border-color: var(--line-strong); }

/* listings, pagination, text pages */
.pages ul { flex-wrap: wrap; justify-content: center; margin: var(--s6) 0 var(--s4); }
.pages a, .pages span { display: inline-flex; align-items: center; justify-content: center; min-width: var(--tap); min-height: var(--tap); padding: 0 var(--s3); border: 1px solid var(--line); border-radius: var(--r-btn); text-decoration: none; background: var(--surface); }
.pages span[aria-current] { background: var(--action); color: var(--action-ink); border-color: var(--action); }
.az { columns: 14rem; list-style: none; margin: 0; }
.az li { padding: var(--s1) 0; }
.about { margin-top: var(--s7); }
.prose { max-width: 760px; margin: 0 auto; }
.prose h1 { margin-top: 0; }
.prose h2 { font-size: var(--t-panel); margin: var(--s5) 0 var(--s2); }

/* footer */
.foot { text-align: center; color: var(--muted); font-size: var(--t-sm); padding: var(--s6) var(--s4); border-top: 1px solid var(--line); }
.foot p, .foot nav { margin: var(--s2) 0; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* controls as key caps, at the top of "How to play" */
.controls { list-style: none; margin: 0 0 var(--s3); padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2); }
.controls li { display: inline-flex; align-items: center; gap: 10px; padding: 6px var(--s3); border-radius: var(--r-btn); background: var(--bg); font-size: var(--t-sm); line-height: 1.3; }
.keys { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--s1); }
kbd { display: inline-block; min-width: 28px; padding: 2px 7px; font: inherit; font-weight: 700; text-align: center; border: 1px solid var(--line-strong); border-bottom-width: 3px; border-radius: 6px; background: var(--surface); }
.or { margin: 0 var(--s1); font-size: var(--t-xs); color: var(--muted); }
