/* =============================================================================
   ROMP — Design System v2  "Neon Arcade"
   A premium, playful arcade aesthetic. Dark-first synthwave energy with a
   crisp, high-contrast light mode. Every class name is preserved from v1 so
   the React markup renders unchanged — this file is a pure visual overhaul.
   ========================================================================== */

/* ---- Tokens --------------------------------------------------------------- */
:root {
  /* brand — Poki-calm azure */
  --primary: #009cff;          /* Poki azure */
  --primary-600: #0074e0;
  --primary-300: #6fc8ff;
  --secondary: #06b6d4;        /* cyan */
  --accent: #ff7690;           /* soft candy pink / CTA */
  --accent-2: #fb7185;
  --amber: #f59e0b;
  --lime: #22c55e;

  /* signature gradients — vivid azure with a cyan lift for dimension */
  --grad-brand: linear-gradient(135deg, #19a8ff 0%, #0a86f0 52%, #0067d6 100%);
  --grad-cool:  linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
  --grad-candy: linear-gradient(135deg, #ff7690 0%, #ffa86b 100%);
  --grad-sheen: linear-gradient(140deg, rgba(255,255,255,.95), rgba(255,255,255,0) 55%);

  /* surfaces — light, cool near-white canvas */
  --bg: #f5fcff;
  --bg-tint-a: rgba(0,156,255,.04);
  --bg-tint-b: rgba(21,200,209,.035);
  --surface: #ffffff;
  --surface-2: #eef4fb;
  --surface-3: #e6eef7;
  --text: #14112b;
  --text-soft: #3a3658;
  --muted: #6f6b8c;
  --border: #e3eaf3;
  --border-strong: #d2dded;

  /* depth — layered pillowy slate-blue with a tight contact shadow for realism */
  --shadow: 0 1px 2px rgba(20,40,80,.06), 0 4px 10px rgba(78,98,140,.12);
  --shadow-md: 0 2px 4px rgba(20,40,80,.06), 0 10px 24px rgba(78,98,140,.16);
  --shadow-lg: 0 4px 8px rgba(20,40,80,.08), 0 22px 48px rgba(78,98,140,.26);
  --glow: 0 6px 16px rgba(0,118,224,.28);
  --glow-accent: 0 6px 18px rgba(255,118,144,.34);
  --ring: 0 0 0 3px color-mix(in srgb, var(--primary) 26%, transparent);

  --r-sm: 11px; --r-md: 17px; --r-lg: 24px; --r-xl: 32px;
  --maxw: 1300px;
  --header-h: 66px;

  --font-display: "Bricolage Grotesque", "Space Grotesk", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, sans-serif;

  --ease: cubic-bezier(.22,.68,.32,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
}

[data-theme="dark"] {
  --primary: #3fb6ff;
  --primary-600: #1f9bff;
  --primary-300: #8fd3ff;
  --secondary: #22d3ee;
  --accent: #fb7185;
  --accent-2: #f9a8d4;

  --grad-brand: linear-gradient(135deg, #1f9bff 0%, #0a86f0 100%);

  --bg: #08060f;
  --bg-tint-a: rgba(0,156,255,.16);
  --bg-tint-b: rgba(21,200,209,.12);
  --surface: #120f20;
  --surface-2: #1a1630;
  --surface-3: #241e3f;
  --text: #f3f0ff;
  --text-soft: #c9c3e6;
  --muted: #938daf;
  --border: #272138;
  --border-strong: #352c4f;

  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45);
  --shadow-md: 0 14px 40px rgba(0,0,0,.5);
  --shadow-lg: 0 26px 70px rgba(0,0,0,.62);
  --glow: 0 8px 26px rgba(31,155,255,.45);
  --glow-accent: 0 8px 26px rgba(251,113,133,.42);
  --ring: 0 0 0 3px color-mix(in srgb, var(--primary) 40%, transparent);
}

/* ---- Base ----------------------------------------------------------------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .3s var(--ease), color .3s var(--ease);
  position: relative;
  overflow-x: hidden;
}
/* Ambient aurora — sits behind everything, gives the page depth */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(58% 48% at 10% -6%, var(--bg-tint-a), transparent 68%),
    radial-gradient(52% 42% at 96% 2%, var(--bg-tint-b), transparent 70%),
    radial-gradient(40% 38% at 78% 38%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 72%),
    radial-gradient(46% 42% at 50% 112%, color-mix(in srgb, var(--secondary) 13%, transparent), transparent 70%);
}
/* Fine grain — barely-there texture that kills the flat "AI-white" look */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-theme="dark"] body::after { opacity: .06; }

h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; line-height: 1.08; margin: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--primary); color: #fff; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }

/* custom scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.main { flex: 1; padding-top: 26px; padding-bottom: 64px; }

/* shared chip-button base reused by primary/ghost */
.btn-primary, .btn-ghost, .fs-btn { font-family: var(--font-body); }

/* ---- Header --------------------------------------------------------------- */
.header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: saturate(1.6) blur(18px);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-bottom: 1px solid var(--border);
}
.header-row { height: var(--header-h); display: flex; align-items: center; gap: 18px; }
.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 12px; overflow: hidden;
  background: var(--grad-brand);
  display: grid; place-items: center;
  box-shadow: var(--glow), inset 0 1px 0 rgba(255,255,255,.5), inset 0 -4px 9px rgba(0,42,92,.32);
  position: relative; transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
/* glossy top-left sheen */
.logo-mark::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(155deg, rgba(255,255,255,.55), rgba(255,255,255,0) 48%); }
.logo-mark > * { position: relative; z-index: 1; }
.logo:hover .logo-mark { transform: rotate(-8deg) scale(1.08); box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.5); }
.logo-word { font-family: var(--font-display); font-weight: 700; font-size: 23px; letter-spacing: -.04em; }
.logo-word b {
  background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent;
}

.search { flex: 1; max-width: 480px; position: relative; display: flex; align-items: center; }
.search input {
  width: 100%; height: 44px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); padding: 0 18px 0 44px;
  font-family: inherit; font-size: 15px; outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--primary); background: var(--surface); box-shadow: var(--ring); }
.search > .ico {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; color: var(--muted); pointer-events: none; transition: color .18s;
}
.search:focus-within > .ico { color: var(--primary); }

/* Visually hidden, still announced. The header's language <label> ships one of
   these; with the rule missing the word "Language" rendered as loose text in the
   header on every page. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

/* Language switcher — a native <select> so it stays keyboard- and mobile-native,
   dressed to match .search / .icon-btn. Chevron is ours because appearance:none
   removes the platform one. */
.lang-switch { position: relative; display: flex; align-items: center; flex-shrink: 0; }
.lang-switch > .ico,
.lang-switch > .caret {
  position: absolute; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; color: var(--muted);
  pointer-events: none; transition: color .18s;
}
.lang-switch > .ico { left: 14px; }
/* The shared chevron glyph points right; a dropdown affordance has to point down. */
.lang-switch > .caret { right: 12px; transform: translateY(-50%) rotate(90deg); }
.lang-switch select {
  height: 44px; max-width: 168px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  padding: 0 32px 0 40px;
  font-family: inherit; font-size: 14.5px; font-weight: 600;
  appearance: none; -webkit-appearance: none; outline: none; cursor: pointer;
  text-overflow: ellipsis;
  transition: border-color .18s, background .18s, box-shadow .18s;
}
.lang-switch select:hover { background: var(--surface); border-color: var(--primary); }
.lang-switch select:focus-visible { border-color: var(--primary); box-shadow: var(--ring); }
.lang-switch:hover > .ico,
.lang-switch:focus-within > .ico { color: var(--primary); }
/* The dropdown list itself is drawn by the OS — force readable colours in dark mode. */
.lang-switch select option { background: var(--surface); color: var(--text); }

.header-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); display: grid; place-items: center;
  transition: background .18s, transform .12s, border-color .18s, color .18s;
}
.icon-btn:hover { background: var(--surface); border-color: var(--primary); color: var(--primary); }
.icon-btn:active { transform: scale(.92); }

.btn-primary {
  position: relative; height: 44px; padding: 0 22px; border-radius: 999px; border: none;
  font-weight: 700; font-size: 14.5px; color: #fff; white-space: nowrap;
  background: var(--grad-brand); background-size: 180% 180%;
  box-shadow: var(--glow); overflow: hidden;
  transition: transform .12s var(--ease), box-shadow .2s, filter .2s;
}
.btn-primary::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: var(--grad-sheen); opacity: 0; transition: opacity .25s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-primary:hover::after { opacity: .25; }
.btn-primary:active { transform: translateY(0); }

/* ---- Category nav --------------------------------------------------------- */
.catnav {
  position: sticky; top: var(--header-h); z-index: 40;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.catnav-row { display: flex; gap: 7px; overflow-x: auto; padding: 11px 0; scrollbar-width: none; }
.catnav-row::-webkit-scrollbar { display: none; }
.cat-pill {
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
  padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  color: var(--muted); background: transparent; border: 1px solid transparent; white-space: nowrap;
  transition: background .18s, color .18s, border-color .18s, transform .12s;
}
.cat-pill:hover { background: var(--surface-2); color: var(--text); transform: translateY(-1px); }
.cat-pill.active {
  color: #fff; background: var(--grad-brand); background-size: 160% 160%;
  box-shadow: var(--glow); border-color: transparent;
}
.cat-pill.active .ico { opacity: 1; }
.cat-pill .ico { opacity: .85; }

/* ---- Auto-hide top nav on scroll-down, reveal on scroll-up ---------------- */
.header, .catnav { transition: transform .34s var(--ease); will-change: transform; }
html[data-nav="down"] .header  { transform: translateY(-100%); pointer-events: none; }
html[data-nav="down"] .catnav  { transform: translateY(calc(-100% - var(--header-h) - 4px)); pointer-events: none; }

/* ---- Section headers ------------------------------------------------------ */
.section-head { display: flex; align-items: center; gap: 13px; margin: 38px 0 18px; }
.section-head h2 { font-size: 24px; letter-spacing: -.025em; }
.section-head .dot {
  width: 11px; height: 22px; border-radius: 5px;
  background: var(--grad-brand); box-shadow: var(--glow);
}
.section-head .more {
  margin-left: auto; font-size: 14px; font-weight: 700; color: var(--muted);
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 999px;
  transition: color .18s, background .18s, gap .18s;
}
.section-head .more:hover { color: var(--primary); background: var(--surface-2); gap: 9px; }

/* ---- Game grid + cards ---------------------------------------------------- */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(186px, 1fr)); }
.grid.dense { grid-template-columns: repeat(auto-fill, minmax(154px, 1fr)); gap: 14px; }

.card {
  position: relative; border-radius: var(--r-md); overflow: hidden; background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-md); display: block; isolation: isolate;
  transition: transform .42s var(--ease-out), box-shadow .3s var(--ease), border-color .26s;
}
/* gentle scale + lift, now carried on a soft azure glow + tinted edge */
.card:hover {
  transform: scale(1.045) translateY(-5px);
  box-shadow: var(--shadow-lg), 0 20px 42px -14px color-mix(in srgb, var(--primary) 50%, transparent);
  border-color: color-mix(in srgb, var(--primary) 42%, var(--border));
}
/* staggered reveal — one orchestrated cascade as a grid mounts */
@keyframes card-rise { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.grid > * { animation: card-rise .5s var(--ease-out) both; }
.grid > *:nth-child(1){ animation-delay:.00s } .grid > *:nth-child(2){ animation-delay:.04s }
.grid > *:nth-child(3){ animation-delay:.08s } .grid > *:nth-child(4){ animation-delay:.12s }
.grid > *:nth-child(5){ animation-delay:.16s } .grid > *:nth-child(6){ animation-delay:.20s }
.grid > *:nth-child(7){ animation-delay:.24s } .grid > *:nth-child(8){ animation-delay:.28s }
.grid > *:nth-child(9){ animation-delay:.30s } .grid > *:nth-child(n+10){ animation-delay:.34s }

.card-thumb { position: relative; aspect-ratio: 1/1; overflow: hidden; background: var(--surface-3); }
.card-clip { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; background: #000; }
.card-thumb .badge-hot, .card-thumb .badge-play, .card-thumb .play-overlay { z-index: 2; }
.card-thumb .art { position: absolute; inset: 0; transition: transform .5s var(--ease); }
.card:hover .art { transform: scale(1.04); }

.card-thumb .play-overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(to top, rgba(0,43,80,.45), rgba(0,43,80,.12));
  opacity: 0; transition: opacity .22s;
}
.card:hover .play-overlay { opacity: 1; }
.play-overlay .pbtn {
  width: 56px; height: 56px; border-radius: 999px; background: #fff;
  display: grid; place-items: center; color: var(--primary-600);
  box-shadow: 0 8px 26px rgba(0,0,0,.3); transform: scale(.7) translateY(8px); transition: transform .26s var(--ease-out);
}
.card:hover .pbtn { transform: scale(1) translateY(0); }

.badge-hot {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  font-size: 10.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--amber));
  box-shadow: 0 4px 14px rgba(255,118,144,.4);
}
.badge-play {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px; color: var(--text);
  background: color-mix(in srgb, var(--surface) 78%, transparent); backdrop-filter: blur(6px);
  border: 1px solid var(--border); display: inline-flex; align-items: center; gap: 4px;
}
.card-body { padding: 12px 13px 13px; }
.card-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; line-height: 1.2; letter-spacing: -.02em; transition: color .18s; }
.card:hover .card-title { color: var(--primary-600); }
.card-meta { margin-top: 5px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.card-meta .like { display: inline-flex; align-items: center; gap: 3px; color: var(--accent); font-weight: 700; margin-left: auto; }

/* thumbnail generated art */
.art-title { position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 13px; }
.art-title span {
  font-family: var(--font-display); font-weight: 800; color: #fff; font-size: 18px; line-height: 1.05;
  text-shadow: 0 2px 14px rgba(0,0,0,.4); letter-spacing: -.02em;
}
.art-deco { position: absolute; inset: 0; opacity: .9; }
.art-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- Category header (clean, Poki-style) ---------------------------------- */
.cat-head { display: flex; align-items: center; gap: 15px; margin: 6px 0 22px; }
.cat-head-icon {
  width: 52px; height: 52px; border-radius: var(--r-md); flex-shrink: 0;
  display: grid; place-items: center; color: var(--primary);
  background: var(--surface-2); border: 1px solid var(--border);
}
.cat-head h1 { font-size: clamp(24px, 4vw, 32px); letter-spacing: -.02em; }
.cat-head p { margin: 5px 0 0; color: var(--muted); font-size: 14.5px; }
@media (max-width: 480px) {
  .cat-head { gap: 12px; margin-bottom: 16px; }
  .cat-head-icon { width: 44px; height: 44px; }
}
.cat-intro { color: var(--muted); font-size: 15px; line-height: 1.75; max-width: 75ch; margin: 22px 0 6px; }
.home-intro { max-width: 80ch; margin: 40px auto 6px; padding-top: 24px; border-top: 1px solid var(--border); color: var(--muted); }
.home-intro h1 { font-size: 18px; color: var(--text); margin: 0 0 10px; }
.home-intro p { font-size: 14.5px; line-height: 1.75; margin: 0 0 12px; }

/* ---- Ad slots ------------------------------------------------------------- */
.ad {
  position: relative; display: grid; place-items: center; border-radius: var(--r-md);
  border: 1.5px dashed var(--border-strong); background: var(--surface-2); color: var(--muted); overflow: hidden;
}
.ad::before {
  content: "Advertisement"; position: absolute; top: 8px; left: 12px;
  font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; font-weight: 800; opacity: .6;
}
.ad-label { font-size: 12px; font-weight: 600; opacity: .7; }
.ad-leaderboard { height: 96px; margin: 22px 0 6px; }
.ad-rect { height: 250px; }
.ad-inline { height: 116px; margin: 28px 0; }
@media (max-width: 600px) { .ad-leaderboard { height: 68px; } }

/* ---- Game page ------------------------------------------------------------ */
.game-layout { display: grid; grid-template-columns: 1fr 308px; gap: 28px; align-items: start; }
@media (max-width: 980px) { .game-layout { grid-template-columns: 1fr; } }
.stage {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  background: #050309; aspect-ratio: 16/10;
  border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  /* Poki-style: open at a size that fits the screen — cap the height to ~64vh and
     derive the width from it (min with the column width) so the player never
     dominates the laptop screen. Use Fullscreen to go bigger. */
  width: min(100%, calc(64vh * 16 / 10));
  margin-inline: auto;
}
/* neon frame glow */
.stage::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none; z-index: 3;
  background: var(--grad-brand); opacity: .55;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.stage iframe { width: 100%; height: 100%; border: 0; display: block; position: relative; z-index: 1; }
.stage-cover { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; }
.stage-cover .bigplay { display: flex; flex-direction: column; align-items: center; gap: 16px; color: #fff; }
.stage-cover .bigplay .ring {
  width: 92px; height: 92px; border-radius: 999px; background: var(--grad-brand);
  display: grid; place-items: center; box-shadow: 0 12px 40px rgba(0,156,255,.5);
  transition: transform .2s var(--ease); position: relative;
}
.stage-cover .bigplay .ring::before {
  content: ""; position: absolute; inset: -10px; border-radius: 999px;
  border: 2px solid rgba(255,255,255,.4); animation: ripple 2.2s ease infinite;
}
@keyframes ripple { 0% { transform: scale(.9); opacity: .7; } 100% { transform: scale(1.35); opacity: 0; } }
.stage-cover .bigplay:hover .ring { transform: scale(1.08); }
.stage-cover .bigplay span { font-weight: 700; font-size: 15.5px; letter-spacing: .01em; text-shadow: 0 2px 12px rgba(0,0,0,.5); }

.stage-bar { display: flex; align-items: center; gap: 12px; padding: 16px 4px 0; flex-wrap: wrap;
  /* keep the title/controls bar the same width as the (capped) player, centered */
  width: min(100%, calc(64vh * 16 / 10)); margin-inline: auto; }
.stage-bar .title-blk { margin-right: auto; }
.stage-bar h1 { font-size: 27px; letter-spacing: -.03em; }
.stage-bar .crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.stage-bar .crumb a:hover { color: var(--primary); }
.vote {
  display: flex; align-items: center; gap: 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 5px; box-shadow: var(--shadow);
}
.vote button {
  border: none; background: transparent; color: var(--muted); display: inline-flex; align-items: center;
  gap: 6px; padding: 8px 13px; border-radius: 999px; font-weight: 700; font-size: 13.5px;
  transition: background .18s, color .18s;
}
.vote button:hover { background: var(--surface-2); color: var(--text); }
.vote button.up.on { color: var(--lime); background: color-mix(in srgb, var(--lime) 16%, transparent); }
.vote button.down.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.vote .divider { width: 1px; height: 20px; background: var(--border); }
.share-row { display: flex; gap: 8px; }
.fs-btn { display: inline-flex; align-items: center; gap: 8px; }

.content { margin-top: 36px; max-width: 75ch; }
.content h2 { font-size: 22px; margin: 32px 0 12px; display: flex; align-items: center; gap: 11px; letter-spacing: -.02em; }
.content h2 .bar { width: 5px; height: 22px; border-radius: 3px; background: var(--grad-brand); box-shadow: var(--glow); }
.content p { color: var(--text-soft); line-height: 1.8; font-size: 15.5px; margin: 0 0 13px; }
.content ul { margin: 0 0 13px; padding-left: 4px; list-style: none; }
.content ul li { position: relative; padding-left: 28px; margin-bottom: 10px; line-height: 1.65; font-size: 15.5px; color: var(--text-soft); }
.content ul li::before {
  content: ""; position: absolute; left: 4px; top: 8px; width: 9px; height: 9px;
  border-radius: 3px; background: var(--grad-brand); box-shadow: var(--glow);
}
.kv {
  display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 18px 20px; margin: 4px 0 8px; box-shadow: var(--shadow);
}
.kv .row { display: flex; gap: 14px; font-size: 14.5px; }
.kv .row .k { color: var(--muted); width: 100px; flex-shrink: 0; font-weight: 700; }

.sidebar { display: flex; flex-direction: column; gap: 22px; }
.side-block {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 18px; box-shadow: var(--shadow);
}
.side-block h3 { font-size: 15.5px; margin-bottom: 14px; display: flex; align-items: center; gap: 9px; letter-spacing: -.01em; }
.side-list { display: grid; gap: 8px; }
.side-game { display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: var(--r-sm); transition: background .18s, transform .15s; }
.side-game:hover { background: var(--surface-2); transform: translateX(3px); }
.side-game .sg-thumb { width: 58px; height: 58px; border-radius: 12px; overflow: hidden; flex-shrink: 0; position: relative; box-shadow: var(--shadow); }
.side-game .sg-name { font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: -.01em; }
.side-game:hover .sg-name { color: var(--primary); }
.side-game .sg-cat { font-size: 11.5px; color: var(--muted); text-transform: capitalize; margin-top: 2px; }

/* ---- Footer --------------------------------------------------------------- */
.footer { position: relative; border-top: 1px solid var(--border); background: var(--surface); margin-top: auto; }
.footer::before { content: ""; position: absolute; top: -1px; left: 0; right: 0; height: 2px; background: var(--grad-brand); opacity: .8; }
.footer-grid { display: grid; grid-template-columns: 1.7fr repeat(3, 1fr); gap: 36px; padding: 50px 0 30px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; } }
.footer h4 { font-family: var(--font-body); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 16px; }
.footer-links { display: grid; gap: 10px; }
.footer-links a { font-size: 14.5px; color: var(--text-soft); width: fit-content; transition: color .18s, transform .15s; }
.footer-links a:hover { color: var(--primary); transform: translateX(3px); }
.footer-blurb { color: var(--muted); font-size: 14px; line-height: 1.65; max-width: 300px; margin: 14px 0 0; }
.footer-bottom { border-top: 1px solid var(--border); padding: 20px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }

/* ---- Cookie banner -------------------------------------------------------- */
.cookie {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 80; max-width: 740px; margin: 0 auto;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(16px);
  border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  padding: 18px 22px; display: flex; align-items: center; gap: 18px;
  animation: cookie-in .45s var(--ease-out);
}
@keyframes cookie-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.cookie .ck-ico { width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0; display: grid; place-items: center;
  background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary); }
.cookie p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.cookie p b { color: var(--text); }
.cookie .ck-actions { display: flex; gap: 9px; flex-shrink: 0; margin-left: auto; }
.btn-ghost { height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-weight: 700; font-size: 13.5px; transition: background .18s, border-color .18s; }
.btn-ghost:hover { background: var(--surface-3); border-color: var(--border-strong); }
@media (max-width: 600px) { .cookie { flex-direction: column; align-items: flex-start; } .cookie .ck-actions { margin-left: 0; width: 100%; } .cookie .ck-actions button { flex: 1; } }

/* ---- Misc ----------------------------------------------------------------- */
.empty { text-align: center; padding: 80px 20px; color: var(--muted); }
.empty .big { display: inline-grid; place-items: center; width: 96px; height: 96px; border-radius: 28px;
  background: var(--surface-2); color: var(--primary); margin-bottom: 18px; box-shadow: var(--shadow); }
.empty h2 { font-size: 24px; color: var(--text); margin-bottom: 8px; letter-spacing: -.02em; }
.pagewrap { animation: fade .35s var(--ease-out); }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.results-count { color: var(--muted); font-size: 14.5px; margin: 2px 0 0; }
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 90;
  background: var(--text); color: var(--bg); font-weight: 700; font-size: 13.5px; padding: 12px 22px;
  border-radius: 999px; box-shadow: var(--shadow-lg); animation: cookie-in .25s;
}

/* ---- FAQ + Game info ------------------------------------------------------ */
.faq { display: flex; flex-direction: column; gap: 11px; margin-top: 8px; }
.faq-item { border: 1px solid var(--border); border-radius: var(--r-md); padding: 0 18px; background: var(--surface); transition: border-color .2s, box-shadow .2s; }
.faq-item:hover { border-color: var(--border-strong); }
.faq-item[open] { border-color: var(--primary); box-shadow: var(--shadow); }
.faq-item summary { cursor: pointer; font-weight: 700; font-size: 15px; padding: 16px 32px 16px 0; list-style: none; position: relative; color: var(--text); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: 2px; top: 50%; transform: translateY(-50%); font-size: 22px; line-height: 1; color: var(--primary); font-weight: 700; transition: transform .2s; }
.faq-item[open] summary::after { content: "\2212"; }
.faq-item > p { margin: 0; padding: 0 0 17px; color: var(--muted); line-height: 1.7; font-size: 14.5px; }
.game-info { display: flex; flex-direction: column; }
.gi-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.gi-row:last-child { border-bottom: none; }
.gi-k { color: var(--muted); white-space: nowrap; }
.gi-v { font-weight: 700; text-align: right; color: var(--text); }

/* ---- Fullscreen stage ------------------------------------------------------
   Native :fullscreen where supported; .fs-on is the CSS-overlay fallback for
   browsers without the Fullscreen API (iPhone Safari). */
.stage:fullscreen { aspect-ratio: auto; border-radius: 0; border: none; background: #050309;
  width: 100%; height: 100%; max-width: none; margin: 0; }
.stage:fullscreen::after { display: none; }
.stage.fs-on {
  position: fixed; inset: 0; z-index: 300;
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; margin: 0;
  aspect-ratio: auto; border-radius: 0; border: none;
}
.stage.fs-on::after { display: none; }
body.fs-lock { overflow: hidden; }
.stage-exit {
  position: absolute; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right));
  z-index: 6; width: 42px; height: 42px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.28); background: rgba(8,6,15,.55); color: #fff;
  display: grid; place-items: center;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: background .18s, transform .12s;
}
.stage-exit:hover { background: rgba(8,6,15,.85); }
.stage-exit:active { transform: scale(.92); }

/* ---- Responsive: tablet ---------------------------------------------------- */
@media (max-width: 860px) {
  .main { padding-top: 18px; padding-bottom: 48px; }
  .section-head { margin: 28px 0 14px; }
  .section-head h2 { font-size: 20px; }
  .content h2 { font-size: 20px; margin: 28px 0 10px; }
}

/* ---- Responsive: large phones --------------------------------------------- */
@media (max-width: 760px) {
  .container { padding: 0 14px; }
  .header-row { gap: 10px; }
  .logo-word { font-size: 20px; }
  .search input { height: 42px; font-size: 14px; padding: 0 14px 0 40px; }
  .search > .ico { left: 13px; }
  /* "Surprise me" becomes icon-only so the search bar keeps room */
  .header .btn-primary { width: 44px; padding: 0; display: grid; place-items: center; }
  .header .btn-primary .bp-text { display: none; }
  /* Same treatment for the language switcher: collapse to the globe alone. At full
     width the language name plus chevron ate more of a 390px header than the search
     did. The select still covers the control, so tapping it opens the native list. */
  /* 44px, not the search bar's 42px — collapsed it reads as one of the round
     icon buttons beside it, so it should line up with those. */
  .lang-switch select {
    width: 44px; height: 44px; padding: 0; color: transparent;
    text-indent: -9999px;
  }
  .lang-switch > .ico { left: 50%; transform: translate(-50%, -50%); }
  .lang-switch > .caret { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 13px; }
  .grid.dense { grid-template-columns: repeat(auto-fill, minmax(134px, 1fr)); gap: 11px; }
}

/* ---- Responsive: phones ---------------------------------------------------- */
@media (max-width: 700px) {
  /* taller inline stage so touch games aren't a letterboxed sliver */
  .stage { aspect-ratio: auto; height: clamp(300px, 58vh, 540px); }
  .stage-bar { padding-top: 12px; gap: 9px; }
  .stage-bar .title-blk { flex-basis: 100%; margin-right: 0; }
  .stage-bar h1 { font-size: 21px; }
  .fs-btn { margin-left: auto; height: 40px; padding: 0 16px; font-size: 13.5px; }
  .vote button { padding: 7px 11px; font-size: 13px; }
  .content { margin-top: 26px; }
  .content p, .content ul li { font-size: 15px; }
  .kv { padding: 14px 16px; }
  .kv .row .k { width: 76px; }
}

@media (max-width: 480px) {
  .grid, .grid.dense { grid-template-columns: 1fr 1fr; }
  .catnav-row { padding: 9px 0; }
  .cat-pill { padding: 8px 13px; font-size: 13.5px; }
  .stage-bar h1 { font-size: 19px; }
}

/* =============================================================================
   HOME — Poki-style lead mosaic
   The grid is the page: a 2×2 featured tile inside the first square-tile grid.
   Hierarchy comes from tile SIZE only. Reuses GameCard + the base .grid.
   ========================================================================== */
.home-featured { grid-auto-flow: dense; }
.home-featured .feat-span { grid-column: span 2; grid-row: span 2; }
.home-featured .feat-span > .card { height: 100%; display: flex; flex-direction: column; }
.home-featured .feat-span .card-thumb { aspect-ratio: auto; flex: 1; }
.home-featured .feat-span .card-title { font-size: 17px; }

@media (max-width: 640px) {
  /* phones: keep the 2-wide emphasis but drop the tall row-span so it stays clean */
  .home-featured .feat-span { grid-row: auto; }
  .home-featured .feat-span > .card { display: block; height: auto; }
  .home-featured .feat-span .card-thumb { aspect-ratio: 1 / 1; flex: none; }
}

/* ---- SEO/AEO additions: quick answer, features, tags, embed, sort, lists --- */
.quick-answer { margin: 16px 0 8px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); padding: 14px 16px; }
.qa-head { display: inline-flex; align-items: center; gap: 7px; font-weight: 800; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--primary-600); margin-bottom: 10px; }
.qa-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 22px; margin: 0; }
.qa-grid > div { display: flex; flex-direction: column; }
.qa-grid dt { font-weight: 700; font-size: 13.5px; color: var(--text); }
.qa-grid dd { margin: 0; font-size: 13.5px; color: var(--muted); }

.content ul.features { list-style: none; padding-left: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 18px; }
.content ul.features li { position: relative; padding-left: 24px; color: var(--text-soft); font-size: 14.5px; }
.content ul.features li::before {
  content: "\2713"; position: absolute; left: 0; top: 0; color: var(--lime); font-weight: 800;
  width: auto; height: auto; border-radius: 0; background: none; box-shadow: none;
}

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.tag-chip { display: inline-block; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--primary-600); font-size: 13px; font-weight: 600; text-decoration: none; transition: border-color .2s, background .2s; }
.tag-chip:hover { border-color: var(--primary); background: var(--surface-2); }

.next-game { margin: 20px 0 4px; padding: 13px 16px; border-radius: var(--r-md); background: var(--bg-tint-a); border: 1px dashed var(--border-strong); font-size: 14.5px; color: var(--text-soft); }
.next-game a { color: var(--primary-600); font-weight: 700; text-decoration: none; }

.embed-toggle { margin: 6px 0; display: inline-flex; align-items: center; gap: 7px; }
.embed-box { margin: 10px 0 4px; display: flex; flex-direction: column; gap: 10px; }
.embed-box textarea { width: 100%; resize: vertical; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 11px 12px; background: var(--surface-2); color: var(--text); }
.embed-box .btn-primary { align-self: flex-start; }

.sort-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.sort-label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sort-btn { cursor: pointer; padding: 7px 15px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-soft); font-weight: 600; font-size: 13.5px; transition: all .2s; }
.sort-btn:hover { border-color: var(--border-strong); }
.sort-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: var(--glow); }

.content ol.best-of { padding-left: 22px; color: var(--text-soft); line-height: 1.8; }
.content ol.best-of li { margin-bottom: 6px; font-size: 14.5px; }
.content ol.best-of a { color: var(--primary-600); font-weight: 700; text-decoration: none; }

.collection-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 16px; }
.collection-item { display: flex; gap: 16px; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.collection-item .ci-thumb { flex: 0 0 96px; width: 96px; height: 96px; border-radius: var(--r-sm); overflow: hidden; display: block; }
.collection-item .ci-thumb .art { width: 100%; height: 100%; }
.ci-body { flex: 1; min-width: 0; }
.ci-body h3 { font-size: 17px; margin: 2px 0 6px; }
.ci-body .ci-cat { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: capitalize; }
.ci-body p { margin: 0 0 9px; color: var(--text-soft); font-size: 14.5px; line-height: 1.65; }
.ci-play { color: var(--primary-600); font-weight: 700; text-decoration: none; font-size: 14px; }
.meta-note { color: var(--muted); font-size: 14px; margin: 4px 0 14px; }
@media (max-width: 560px) { .collection-item { flex-direction: column; } .collection-item .ci-thumb { width: 100%; height: 140px; flex: none; } }

.browse-row { display: flex; flex-wrap: wrap; gap: 9px; margin: 26px 0 8px; }
.browse-pill { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-soft); font-weight: 600; font-size: 14px; text-decoration: none; transition: all .2s; }
.browse-pill:hover { border-color: var(--primary); color: var(--primary-600); background: var(--surface-2); }

.blog-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.blog-card { display: flex; flex-direction: column; gap: 6px; padding: 16px 17px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); text-decoration: none; transition: transform .15s, border-color .15s, box-shadow .15s; }
.blog-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.blog-card .bc-tag { font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--accent-2); }
.blog-card b { color: var(--text); font-size: 15.5px; line-height: 1.3; }
.blog-card .bc-desc { color: var(--muted); font-size: 13.5px; line-height: 1.55; }

/* ---- Reduced motion ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---- RTL (Arabic, Urdu, Persian, Hebrew, Pashto, Sindhi, Yiddish, Divehi) --
   dir="rtl" is set on <html> by tools/gen-seo-pages.js (static pages) and
   components.jsx's setLocale() (the SPA), driven by tools/locales.js's `dir`
   field — this stylesheet only needs to react to it. */
[dir="rtl"] { direction: rtl; }
[dir="rtl"] .header-row,
[dir="rtl"] .catnav-row,
[dir="rtl"] .stage-bar,
[dir="rtl"] .sort-bar,
[dir="rtl"] .footer-grid,
[dir="rtl"] .qa-grid > div,
[dir="rtl"] .cookie { direction: rtl; }
[dir="rtl"] .stage-bar .title-blk { margin-right: 0; margin-left: auto; }
[dir="rtl"] .cookie .ck-actions { margin-left: 0; margin-right: auto; }
[dir="rtl"] .stage-exit { right: auto; left: max(10px, env(safe-area-inset-left)); }
/* directional glyphs (chevron/arrow icons) visually point the wrong way once
   the layout flows right-to-left — mirror them back */
[dir="rtl"] .ico[data-icon="chevron"], [dir="rtl"] .ico[data-icon="arrowright"] { transform: scaleX(-1); }
/* the display/body fonts have little to no Arabic/Hebrew glyph coverage and
   silently fall back to whatever generic font the OS picks — name a script-
   appropriate stack explicitly so RTL text renders with real hinting/metrics
   instead of a mismatched fallback. */
[dir="rtl"] {
  --font-display: "Noto Sans Arabic", "Noto Sans Hebrew", "Segoe UI", Tahoma, system-ui, sans-serif;
  --font-body: "Noto Sans Arabic", "Noto Sans Hebrew", "Segoe UI", Tahoma, system-ui, sans-serif;
}
