/* ═══════════════════════════════════════════════════════════════
   PlayVolt — styles
   Tokens first, then layout, components, and one section per page.
   Signature element: "keycap" buttons that press down like arcade
   buttons. Each game brings its own --accent colour from its art.
   ═══════════════════════════════════════════════════════════════ */

/* ── Fonts (self-hosted, SIL Open Font Licence) ─────────────── */
@font-face { font-family: 'Bungee'; src: url('/assets/fonts/bungee.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Bricolage Grotesque'; src: url('/assets/fonts/bricolage-grotesque.woff') format('woff'); font-weight: 200 800; font-stretch: 75% 100%; font-display: swap; }

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  --font-display: 'Bungee', 'Arial Black', Impact, system-ui, sans-serif;
  --font-body: 'Bricolage Grotesque', ui-rounded, 'Segoe UI', system-ui, sans-serif;

  --volt: #FFE53B;        /* brand yellow */
  --volt-deep: #C9A400;
  --zap: #FF3E9A;         /* hot pink */
  --zap-deep: #B8136A;
  --arc: #2EE6F6;         /* cyan */
  --arc-deep: #0F9AA7;
  --good: #5BE38F;
  --bad: #FF5A6E;

  --r-sm: 10px; --r-md: 16px; --r-lg: 24px; --r-xl: 32px;
  --gutter: clamp(16px, 4vw, 40px);
  --max: 1320px;
  --ease-pop: cubic-bezier(.34, 1.56, .64, 1);
}
:root, [data-theme="dark"] {
  /* Midnight blue */
  --bg: #0A1124;
  --bg-2: #0E1730;
  --panel: #131D3B;
  --panel-2: #1B2850;
  --line: #2A3B70;
  --ink: #EEF3FF;
  --ink-2: #B3BFE0;
  --ink-3: #8391BA;
  --on-volt: #10162E;
  --dot: rgba(179, 191, 224, .07);
  --shadow: 0 18px 40px rgba(2, 5, 16, .6);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #F4F0FF;
  --bg-2: #EAE3FF;
  --panel: #FFFFFF;
  --panel-2: #F1ECFF;
  --line: #D6CCF5;
  --ink: #1C1240;
  --ink-2: #4B3F78;
  --ink-3: #625490; /* 5:1+ on every light background (WCAG AA) */
  --zap: #E0247A; --zap-deep: #9E0F55;
  --arc: #0AA7B8; --arc-deep: #067480;
  --volt-deep: #B89300;
  --dot: rgba(60, 40, 140, .08);
  --shadow: 0 16px 36px rgba(40, 20, 110, .14);
  color-scheme: light;
}

/* ── Base ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font: 400 1rem/1.55 var(--font-body);
  color: var(--ink); background-color: var(--bg);
  /* LED-marquee dot grid */
  background-image: radial-gradient(var(--dot) 1.2px, transparent 1.3px);
  background-size: 18px 18px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
main { flex: 1; outline: none; }
main:focus, main:focus-visible { outline: none; }
img, video { max-width: 100%; display: block; }
/* Inline icons without an explicit size default to the text size (component rules below override this) */
svg:where(:not([width])) { width: 1.2em; height: 1.2em; flex: none; vertical-align: -0.2em; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.1; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--arc); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--zap); color: #fff; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--volt); color: var(--on-volt); padding: 10px 16px; border-radius: 10px; font-weight: 700; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.ssr { max-width: 70ch; margin: 40px auto; padding: 0 var(--gutter); color: var(--ink-2); }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.display { font-family: var(--font-display); font-weight: 400; letter-spacing: .01em; }

/* ── Keycap buttons (signature) ─────────────────────────────── */
.btn {
  --cap: var(--volt); --cap-deep: var(--volt-deep); --cap-ink: var(--on-volt);
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  padding: .78em 1.25em; min-height: 46px;
  font-weight: 750; font-size: 1rem; line-height: 1; text-decoration: none; white-space: nowrap;
  color: var(--cap-ink); background: var(--cap);
  border: 0; border-radius: 14px; cursor: pointer;
  box-shadow: 0 5px 0 var(--cap-deep);
  transform: translateY(0);
  transition: transform .09s ease, box-shadow .09s ease, filter .15s;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--cap-deep); filter: brightness(1.05); }
.btn:active, .btn[aria-pressed="true"]:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--cap-deep); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 1.15em; height: 1.15em; flex: none; }
.btn--zap { --cap: var(--zap); --cap-deep: var(--zap-deep); --cap-ink: #fff; }
.btn--arc { --cap: var(--arc); --cap-deep: var(--arc-deep); --cap-ink: #04262A; }
.btn--ghost { --cap: var(--panel-2); --cap-deep: var(--line); --cap-ink: var(--ink); }
.btn--ghost[aria-pressed="true"] { --cap: color-mix(in srgb, var(--zap) 22%, var(--panel-2)); --cap-deep: var(--zap-deep); }
.btn--danger { --cap: var(--bad); --cap-deep: #A3243A; --cap-ink: #fff; }
.btn--sm { min-height: 36px; padding: .55em .9em; font-size: .9rem; border-radius: 11px; box-shadow: 0 4px 0 var(--cap-deep); }
.btn--sm:hover { box-shadow: 0 5px 0 var(--cap-deep); }
.btn--sm:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--cap-deep); }
.btn--xl { min-height: 64px; padding: .9em 1.8em; font-size: 1.25rem; border-radius: 18px; box-shadow: 0 7px 0 var(--cap-deep), 0 14px 32px color-mix(in srgb, var(--cap) 35%, transparent); }
.btn--xl:hover { box-shadow: 0 9px 0 var(--cap-deep), 0 18px 40px color-mix(in srgb, var(--cap) 45%, transparent); }
.btn--xl:active { transform: translateY(6px); box-shadow: 0 1px 0 var(--cap-deep); }
.iconbtn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 13px;
  background: var(--panel-2); color: var(--ink); border: 0; cursor: pointer; box-shadow: 0 4px 0 var(--line);
  transition: transform .09s, box-shadow .09s;
}
.iconbtn:hover { transform: translateY(-1px); box-shadow: 0 5px 0 var(--line); }
.iconbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.iconbtn svg { width: 22px; height: 22px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--arc); font-weight: 650; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* Keyboard key, used in controls tables */
kbd {
  display: inline-block; min-width: 1.9em; padding: .12em .5em; margin: .1em .1em;
  font: 700 .82rem/1.5 var(--font-body); text-align: center;
  background: var(--panel-2); color: var(--ink); border-radius: 7px; box-shadow: 0 3px 0 var(--line);
}

/* ── Chips ──────────────────────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; min-height: 36px;
  border-radius: 999px; border: 2px solid var(--line); background: var(--panel);
  font-weight: 650; font-size: .92rem; color: var(--ink-2); text-decoration: none; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s, transform .15s var(--ease-pop);
}
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip[aria-pressed="true"], .chip.is-on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip--sm { min-height: 26px; padding: 2px 9px; font-size: .78rem; border-width: 1.5px; cursor: default; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 650; background: var(--panel-2); color: var(--ink-2); }

/* ── Top bar ────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--line);
}
.topbar__in { display: flex; align-items: center; gap: 18px; height: 72px; }
.logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-family: var(--font-display); font-size: 1.45rem; color: var(--ink); flex: none; }
.logo svg { width: 34px; height: 34px; filter: drop-shadow(0 0 10px color-mix(in srgb, var(--volt) 60%, transparent)); transition: transform .3s var(--ease-pop); }
.logo:hover svg { transform: rotate(-12deg) scale(1.08); }
.logo b { color: var(--volt); font-weight: 400; }
[data-theme="light"] .logo b { color: var(--zap); }
.nav { display: flex; gap: 4px; }
.nav a { padding: 10px 14px; border-radius: 12px; font-weight: 700; text-decoration: none; color: var(--ink-2); }
.nav a:hover { color: var(--ink); background: var(--panel-2); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--panel-2); box-shadow: inset 0 -3px 0 var(--zap); }
.search { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
.search input {
  width: 100%; height: 46px; padding: 0 16px 0 44px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--panel); color: var(--ink);
}
.search input:focus { outline: none; border-color: var(--arc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--arc) 25%, transparent); }
.search svg { position: absolute; left: 14px; top: 50%; translate: 0 -50%; width: 20px; height: 20px; color: var(--ink-3); pointer-events: none; }
.search__results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 50;
  background: var(--panel); border: 2px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow);
  padding: 6px; display: none; max-height: 70vh; overflow: auto;
}
.search__results.open { display: block; }
.sresult { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; text-decoration: none; }
.sresult:hover, .sresult.is-active { background: var(--panel-2); }
.sresult img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; }
.sresult small { display: block; color: var(--ink-3); }
.topbar__actions { display: flex; align-items: center; gap: 10px; }
.menu-toggle { display: none; }
.avatar { --a1: #FF3E9A; --a2: #FFE53B; width: 40px; height: 40px; border-radius: 13px; flex: none; display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(135deg, var(--a1), var(--a2)); color: #1A1033; font-family: var(--font-display); font-size: 1.05rem; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--lg { width: 104px; height: 104px; border-radius: 30px; font-size: 2.6rem; box-shadow: 0 6px 0 var(--line); }
.avatar--sm { width: 30px; height: 30px; border-radius: 9px; font-size: .8rem; }
.userbtn { display: inline-flex; align-items: center; gap: 8px; padding: 3px; border-radius: 15px; text-decoration: none; border: 2px solid transparent; }
.userbtn:hover { border-color: var(--line); }

@media (max-width: 920px) {
  .topbar__in { gap: 10px; height: 64px; }
  .menu-toggle { display: inline-grid; }
  .nav, .topbar .search { display: none; }
  .topbar.menu-open .nav, .topbar.menu-open .search { display: flex; }
  .topbar.menu-open .topbar__in { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 14px; }
  .topbar.menu-open .search { order: 5; flex-basis: 100%; max-width: none; margin: 0; }
  .topbar.menu-open .nav { order: 6; flex-basis: 100%; flex-direction: column; }
  .topbar__actions { margin-left: auto; }
  .logo { font-size: 1.2rem; }
}

/* ── Footer ─────────────────────────────────────────────────── */
.footer { margin-top: 80px; border-top: 2px solid var(--line); background: var(--bg-2); }
.footer__in { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 32px; padding-top: 40px; padding-bottom: 40px; }
.footer h4, .footer .foot-h { font-size: .95rem; margin-bottom: 10px; color: var(--ink); font-family: inherit; letter-spacing: normal; text-transform: none; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer a { color: var(--ink-2); text-decoration: none; }
.footer a:hover { color: var(--ink); text-decoration: underline; }
.footer__base { padding-bottom: 28px; color: var(--ink-3); font-size: .88rem; }
@media (max-width: 720px) { .footer__in { grid-template-columns: 1fr 1fr; } .footer__in > :first-child { grid-column: 1 / -1; } }

/* ── Sections & headings ────────────────────────────────────── */
.section { margin-top: 56px; }
.section__head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section__title { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
.section__title small { display: block; font-family: var(--font-body); font-size: .95rem; font-weight: 500; color: var(--ink-3); margin-top: 6px; letter-spacing: 0; }
.page-title { font-family: var(--font-display); font-weight: 400; font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.02; }
.page-head { padding-top: 40px; margin-bottom: 26px; }
.page-head p { margin-top: 10px; color: var(--ink-2); max-width: 60ch; }

/* ── Game card ──────────────────────────────────────────────── */
.card {
  --accent: var(--volt);
  position: relative; display: flex; flex-direction: column;
  background: var(--panel); border: 3px solid var(--line); border-radius: var(--r-lg);
  text-decoration: none; overflow: hidden; isolation: isolate;
  transition: transform .25s var(--ease-pop), border-color .2s, box-shadow .25s;
}
.card:hover, .card:focus-visible {
  transform: translateY(-6px) rotate(-.6deg);
  border-color: var(--accent);
  box-shadow: 0 14px 0 -4px color-mix(in srgb, var(--accent) 55%, var(--bg)), 0 22px 44px color-mix(in srgb, var(--accent) 28%, transparent);
  outline: none;
}
.card__media { position: relative; aspect-ratio: 16 / 9; background: var(--panel-2); overflow: hidden; }
.card__media img, .card__media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card__media img { transition: transform .4s ease, opacity .3s; }
.card:hover .card__media img { transform: scale(1.05); }
.card__media video { opacity: 0; transition: opacity .25s; }
.card__media video.is-playing { opacity: 1; }
.card__badges { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 6px; z-index: 2; pointer-events: none; }
.badge { padding: 4px 9px; border-radius: 9px; font: 800 .74rem/1.2 var(--font-body); background: rgba(8, 13, 30, .82); color: #fff; backdrop-filter: blur(4px); }
.badge--new { background: var(--zap); }
.badge--soon { background: var(--arc); color: #04262A; }
.badge--price { margin-left: auto; background: var(--volt); color: var(--on-volt); }
.card__body { display: grid; grid-template-columns: 52px 1fr; gap: 4px 12px; padding: 14px 14px 16px; align-items: center; }
.card__icon { grid-row: span 2; width: 52px; height: 52px; border-radius: 14px; object-fit: cover; border: 2px solid var(--line); background: var(--panel-2); }
.card__title { font-weight: 800; font-size: 1.08rem; line-height: 1.2; color: var(--ink); }
.card__meta { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--ink-3); min-width: 0; }
.card__meta .genre { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stars-mini { color: var(--volt); font-weight: 750; white-space: nowrap; }
[data-theme="light"] .stars-mini { color: #B57B00; }
.card__fav { position: absolute; z-index: 3; top: 8px; right: 8px; }

/* Grid & shelf */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.shelf { position: relative; }
.shelf__track {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 22%); gap: 20px;
  overflow-x: auto; scroll-snap-type: x mandatory; padding: 10px 4px 26px; margin: -10px -4px 0;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.shelf__track > * { scroll-snap-align: start; }
.shelf__nav { display: flex; gap: 8px; }
@media (max-width: 1100px) { .shelf__track { grid-auto-columns: minmax(250px, 31%); } }
@media (max-width: 720px) { .shelf__track { grid-auto-columns: 78%; gap: 14px; } .shelf__nav { display: none; } }

/* ── Home: hero "cabinet" ───────────────────────────────────── */
.hero { padding-top: 34px; }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 52px); align-items: center; }
.cabinet {
  --accent: var(--volt);
  display: block; text-decoration: none; color: inherit;
  position: relative; border-radius: var(--r-xl); padding: 14px;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 3px solid var(--line);
  box-shadow: 0 10px 0 var(--line), 0 30px 80px color-mix(in srgb, var(--accent) 30%, transparent);
}
.cabinet__screen {
  position: relative; aspect-ratio: 16 / 9; border-radius: 20px; overflow: hidden; background: #000;
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--accent) 70%, transparent), 0 0 40px color-mix(in srgb, var(--accent) 35%, transparent);
  animation: power-on .9s cubic-bezier(.2, .8, .2, 1) both .1s;
}
.cabinet__screen video, .cabinet__screen img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cabinet__screen::after { /* scanlines */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .14) 0 2px, transparent 2px 4px);
  mix-blend-mode: multiply;
}
.cabinet__lights { display: flex; justify-content: space-between; align-items: center; padding: 12px 6px 2px; }
.cabinet__lights span { display: flex; gap: 8px; }
.cabinet__lights i { width: 12px; height: 12px; border-radius: 50%; background: var(--zap); box-shadow: 0 0 12px var(--zap); }
.cabinet__lights i:nth-child(2) { background: var(--volt); box-shadow: 0 0 12px var(--volt); }
.cabinet__lights i:nth-child(3) { background: var(--arc); box-shadow: 0 0 12px var(--arc); }
.cabinet__lights small { font-weight: 700; color: var(--ink-3); font-size: .82rem; }
@keyframes power-on {
  0% { transform: scale(1, .004); filter: brightness(4); opacity: .2; }
  45% { transform: scale(1, .004); filter: brightness(4); opacity: 1; }
  70% { transform: scale(1, 1); filter: brightness(1.8); }
  100% { transform: scale(1, 1); filter: brightness(1); }
}
.hero__info { display: grid; gap: 18px; justify-items: start; }
.hero__kicker { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; color: var(--ink-2); }
.hero__kicker img { width: 46px; height: 46px; border-radius: 13px; border: 2px solid var(--line); }
.hero__title { font-family: var(--font-display); font-weight: 400; font-size: clamp(2.3rem, 5.4vw, 4.4rem); line-height: .95; color: var(--ink); text-shadow: 0 4px 0 color-mix(in srgb, var(--accent, var(--zap)) 55%, transparent); }
.hero__tag { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--ink-2); max-width: 34ch; margin: 0; }
.hero__ctas { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; }
.hero__facts { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 900px) { .hero__grid { grid-template-columns: 1fr; } .cabinet { padding: 9px; } }

/* Filter strip on home */
.filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; margin-top: 54px; padding: 16px; border-radius: var(--r-lg); background: var(--panel); border: 3px solid var(--line); }
.filterbar .search { display: block; margin: 0; flex: 1 1 260px; max-width: none; }
.filterbar .chips { flex: 2 1 420px; }

/* Newsletter band */
.signup-band {
  margin-top: 64px; padding: clamp(24px, 5vw, 44px); border-radius: var(--r-xl);
  background: var(--zap); color: #fff; display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: center;
  box-shadow: 0 10px 0 var(--zap-deep);
  position: relative; overflow: hidden;
}
.signup-band::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .16) 1.5px, transparent 1.6px); background-size: 16px 16px; pointer-events: none; }
.signup-band h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.5rem, 3vw, 2.2rem); position: relative; }
.signup-band p { margin: 8px 0 0; opacity: .92; position: relative; }
.signup-band form { display: flex; gap: 10px; position: relative; flex-wrap: wrap; }
.signup-band input { flex: 1 1 200px; height: 52px; padding: 0 16px; border-radius: 14px; border: 0; background: #fff; color: #1A1033; }
.signup-band .btn { --cap: var(--volt); --cap-deep: #2A1050; --cap-ink: #1A1033; height: 52px; }
@media (max-width: 760px) { .signup-band { grid-template-columns: 1fr; } }

/* ── Forms ──────────────────────────────────────────────────── */
.field { display: grid; gap: 6px; }
.field > span, .field > label { font-weight: 700; font-size: .92rem; }
.field small { color: var(--ink-3); font-size: .84rem; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 13px;
  border: 2px solid var(--line); background: var(--bg-2); color: var(--ink);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--arc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--arc) 22%, transparent); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--zap); flex: none; }
.form { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.error { color: var(--bad); font-weight: 650; font-size: .92rem; }
.panel { background: var(--panel); border: 3px solid var(--line); border-radius: var(--r-lg); padding: clamp(18px, 3vw, 28px); }
.panel h2, .panel h3 { margin-bottom: 14px; }
.panel h2 { font-size: 1.3rem; }
.auth { max-width: 460px; margin: 48px auto 0; }
.auth .page-title { font-size: 2.2rem; margin-bottom: 8px; }

/* ── Game page ──────────────────────────────────────────────── */
.gp { --accent: var(--volt); padding-top: 26px; }
.gp__top { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
@media (max-width: 1080px) { .gp__top { grid-template-columns: 1fr; } }
.player {
  position: relative; border-radius: var(--r-lg); overflow: hidden; background: #000;
  border: 3px solid color-mix(in srgb, var(--accent) 65%, var(--line));
  box-shadow: 0 10px 0 color-mix(in srgb, var(--accent) 35%, var(--bg)), 0 24px 60px color-mix(in srgb, var(--accent) 22%, transparent);
}
.player__stage { position: relative; aspect-ratio: 16 / 9; background: #000; }
.player__stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.player__poster { position: absolute; inset: 0; display: grid; place-items: center; cursor: pointer; }
.player__poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.player__poster::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(4, 8, 22, .25), rgba(4, 8, 22, .78)); z-index: 1; }
.player__go { position: relative; z-index: 2; display: grid; justify-items: center; gap: 14px; text-align: center; padding: 16px; }
.playdisc {
  width: clamp(84px, 11vw, 124px); aspect-ratio: 1; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--volt); color: var(--on-volt); display: grid; place-items: center;
  box-shadow: 0 8px 0 var(--volt-deep), 0 0 0 10px rgba(255, 229, 59, .18), 0 0 60px rgba(255, 229, 59, .5);
  transition: transform .1s, box-shadow .1s;
  animation: disc-pulse 2.4s ease-in-out infinite;
}
.playdisc svg { width: 44%; height: 44%; margin-left: 8%; }
.playdisc:hover { transform: translateY(-2px) scale(1.03); }
.playdisc:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--volt-deep), 0 0 0 10px rgba(255, 229, 59, .18); }
@keyframes disc-pulse { 50% { box-shadow: 0 8px 0 var(--volt-deep), 0 0 0 18px rgba(255, 229, 59, .08), 0 0 80px rgba(255, 229, 59, .6); } }
.player__go strong { font-family: var(--font-display); font-weight: 400; color: #fff; font-size: clamp(1.1rem, 2.4vw, 1.6rem); text-shadow: 0 3px 0 rgba(0, 0, 0, .5); }
.player__go small { color: rgba(255, 255, 255, .85); font-weight: 600; max-width: 46ch; }
.player__notice { position: relative; z-index: 2; max-width: 420px; margin: 16px; padding: 22px; border-radius: var(--r-md); background: var(--panel); color: var(--ink); text-align: center; display: grid; gap: 12px; justify-items: center; }
.player__notice svg { width: 44px; height: 44px; color: var(--volt); }
.player__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; background: var(--panel); border-top: 3px solid var(--line); }
.player__status { font-size: .88rem; color: var(--ink-2); display: flex; align-items: center; gap: 8px; margin-right: auto; min-width: 0; }
.player__status i { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); flex: none; }
.player__status.ok i { background: var(--good); box-shadow: 0 0 10px var(--good); }
.player.is-fullscreen, .player:fullscreen { border-radius: 0; border: 0; display: flex; flex-direction: column; background: #000; }
.player:fullscreen .player__stage, .player.is-fullscreen .player__stage { flex: 1; aspect-ratio: auto; }
.player.is-fullscreen { position: fixed; inset: 0; z-index: 90; }
.player__loading { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 700; pointer-events: none; }

.gp__side { display: grid; gap: 18px; }
.gp__id { display: grid; grid-template-columns: 76px 1fr; gap: 14px; align-items: center; }
.gp__id img { width: 76px; height: 76px; border-radius: 20px; border: 3px solid var(--line); object-fit: cover; }
.gp__title { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.7rem, 3vw, 2.3rem); line-height: 1; }
.gp__tag { color: var(--ink-2); margin-top: 6px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fact { background: var(--panel); border: 2px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; }
.fact b { display: block; font-size: 1.15rem; }
.fact span { font-size: .82rem; color: var(--ink-3); font-weight: 600; }
.gp__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.gp__actions .btn { flex: 1 1 auto; }
.gp__body { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; margin-top: 40px; align-items: start; }
@media (max-width: 1080px) { .gp__body { grid-template-columns: 1fr; } }
.prose { max-width: 70ch; font-size: 1.05rem; }
.prose p { color: var(--ink-2); }
.controls-table { width: 100%; border-collapse: collapse; }
.controls-table td { padding: 9px 0; border-bottom: 2px dashed var(--line); vertical-align: top; }
.controls-table td:first-child { font-weight: 700; padding-right: 14px; width: 40%; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.gallery button { padding: 0; border: 3px solid var(--line); border-radius: var(--r-md); overflow: hidden; cursor: zoom-in; background: var(--panel-2); aspect-ratio: 16 / 9; transition: border-color .15s, transform .2s var(--ease-pop); }
.gallery button:hover { border-color: var(--accent); transform: scale(1.02); }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.trailer { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-md); overflow: hidden; border: 3px solid var(--line); background: #000; }
.trailer iframe, .trailer video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.changelog { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.changelog li { padding-left: 18px; border-left: 4px solid var(--accent); }
.changelog b { font-size: 1.02rem; }
.changelog time { color: var(--ink-3); font-size: .85rem; margin-left: 8px; }
.changelog p { margin: 4px 0 0; color: var(--ink-2); }

/* Ratings */
.stars { display: inline-flex; gap: 2px; color: var(--volt); }
[data-theme="light"] .stars { color: #E2A400; }
.stars svg { width: 20px; height: 20px; }
.stars .off { color: var(--line); }
.rate-input { display: inline-flex; gap: 4px; flex-direction: row-reverse; justify-content: flex-end; }
.rate-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rate-input label { cursor: pointer; color: var(--line); transition: transform .15s var(--ease-pop), color .1s; }
.rate-input label svg { width: 34px; height: 34px; }
.rate-input label:hover, .rate-input label:hover ~ label, .rate-input input:checked ~ label { color: var(--volt); }
.rate-input label:hover { transform: scale(1.18) rotate(-8deg); }
.rate-input input:focus-visible + label { outline: 3px solid var(--arc); border-radius: 8px; }
.rating-sum { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; }
.rating-big { font-family: var(--font-display); font-size: 3.2rem; line-height: 1; }
.bars { display: grid; gap: 4px; }
.bars div { display: grid; grid-template-columns: 14px 1fr 30px; gap: 8px; align-items: center; font-size: .82rem; color: var(--ink-3); }
.bars span { height: 9px; border-radius: 9px; background: var(--panel-2); overflow: hidden; }
.bars span i { display: block; height: 100%; background: var(--volt); border-radius: 9px; }
.posts { display: grid; gap: 14px; margin-top: 18px; }
.post { display: grid; grid-template-columns: 40px 1fr; gap: 12px; padding: 14px; border-radius: var(--r-md); background: var(--panel); border: 2px solid var(--line); }
.post__head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.post__head a { font-weight: 800; text-decoration: none; }
.post__head time { font-size: .82rem; color: var(--ink-3); }
.post p { margin: 6px 0 0; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.post .linkbtn { font-size: .84rem; color: var(--ink-3); margin-left: auto; }
.empty { padding: 26px; text-align: center; border: 3px dashed var(--line); border-radius: var(--r-lg); color: var(--ink-2); }
.empty strong { display: block; font-size: 1.1rem; color: var(--ink); margin-bottom: 4px; }

/* Tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 3px solid var(--line); margin-bottom: 22px; }
.tabs button, .tabs a { padding: 11px 16px; border: 0; background: none; font-weight: 750; color: var(--ink-3); cursor: pointer; border-radius: 12px 12px 0 0; text-decoration: none; margin-bottom: -3px; border-bottom: 3px solid transparent; }
.tabs button:hover, .tabs a:hover { color: var(--ink); }
.tabs [aria-selected="true"], .tabs [aria-current="page"] { color: var(--ink); border-bottom-color: var(--zap); background: var(--panel); }

/* ── Leaderboards ───────────────────────────────────────────── */
.lb { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.lb th { text-align: left; font-size: .82rem; color: var(--ink-3); font-weight: 700; padding: 0 14px; }
.lb td { padding: 10px 14px; background: var(--panel); border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); }
.lb td:first-child { border-left: 2px solid var(--line); border-radius: 14px 0 0 14px; width: 64px; }
.lb td:last-child { border-right: 2px solid var(--line); border-radius: 0 14px 14px 0; }
.lb .rank { font-family: var(--font-display); font-size: 1.2rem; }
.lb tr.top1 td { background: color-mix(in srgb, var(--volt) 16%, var(--panel)); border-color: color-mix(in srgb, var(--volt) 50%, var(--line)); }
.lb tr.top2 td { background: color-mix(in srgb, var(--arc) 12%, var(--panel)); }
.lb tr.top3 td { background: color-mix(in srgb, var(--zap) 12%, var(--panel)); }
.lb tr.me td { border-color: var(--arc); }
.lb tr.me td:first-child { box-shadow: inset 4px 0 0 var(--arc); }
.lb .who { display: flex; align-items: center; gap: 10px; font-weight: 750; }
.lb .who a { text-decoration: none; }
.lb .score { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.board-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 22px; }
.board-picker a { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 14px; border: 2px solid var(--line); background: var(--panel); text-decoration: none; font-weight: 700; font-size: .92rem; line-height: 1.2; }
.board-picker a:hover { border-color: var(--ink-3); }
.board-picker a[aria-current="true"] { border-color: var(--zap); box-shadow: 0 4px 0 var(--zap-deep); }
.board-picker img { width: 38px; height: 38px; border-radius: 10px; }

/* ── Profile ────────────────────────────────────────────────── */
.profile-head { display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center; padding-top: 40px; }
.profile-head h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.8rem, 4vw, 2.8rem); }
.statline { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.statline span { padding: 6px 12px; border-radius: 11px; background: var(--panel); border: 2px solid var(--line); font-size: .9rem; color: var(--ink-2); }
.statline b { color: var(--ink); }
@media (max-width: 720px) { .profile-head { grid-template-columns: auto 1fr; } .profile-head > :last-child { grid-column: 1 / -1; } }
.achievements { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.ach { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: center; padding: 12px; border-radius: var(--r-md); background: var(--panel); border: 2px solid var(--line); }
.ach > svg { width: 48px; height: 48px; }
.ach b { display: block; line-height: 1.2; }
.ach small { color: var(--ink-3); line-height: 1.3; display: block; }
.ach.locked { opacity: .55; filter: grayscale(1); }
.ach.earned { border-color: color-mix(in srgb, var(--volt) 60%, var(--line)); }
.avatar-picker { display: flex; flex-wrap: wrap; gap: 10px; }
.avatar-picker button { padding: 3px; border-radius: 16px; border: 3px solid transparent; background: none; cursor: pointer; }
.avatar-picker button[aria-pressed="true"] { border-color: var(--zap); }

/* ── Dashboard ──────────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.tile { padding: 16px; border-radius: var(--r-md); background: var(--panel); border: 3px solid var(--line); }
.tile b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 1.9rem; line-height: 1.1; }
.tile span { color: var(--ink-3); font-weight: 650; font-size: .88rem; }
.chart { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; align-items: end; height: 160px; padding: 10px 0 0; }
.chart div { display: grid; grid-template-rows: 1fr auto; gap: 6px; height: 100%; text-align: center; font-size: .72rem; color: var(--ink-3); }
.chart i { align-self: end; display: block; min-height: 3px; border-radius: 6px 6px 3px 3px; background: var(--arc); position: relative; }
.chart i[data-n]:hover::after { content: attr(data-n); position: absolute; bottom: 100%; left: 50%; translate: -50% -4px; background: var(--ink); color: var(--bg); padding: 2px 6px; border-radius: 6px; font-weight: 700; font-style: normal; }
.table-wrap { overflow-x: auto; max-width: 100%; border-radius: var(--r-md); border: 3px solid var(--line); }
/* keyboard focus ring for scrollable tables */
.table-wrap:focus-visible { outline: 3px solid var(--arc); outline-offset: 2px; }
/* Grid/flex items default to min-width:auto, which let wide tables stretch the page on phones */
.panel, .section, #dash, .dash-grid > * { min-width: 0; }
.table { width: 100%; border-collapse: collapse; background: var(--panel); font-size: .92rem; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 2px solid var(--line); white-space: nowrap; }
.table th { font-size: .8rem; color: var(--ink-3); background: var(--panel-2); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }
.table .gamecell { display: flex; align-items: center; gap: 10px; font-weight: 750; }
.table .gamecell img { width: 34px; height: 34px; border-radius: 9px; }
.status { display: inline-block; padding: 2px 9px; border-radius: 999px; font-weight: 750; font-size: .78rem; }
.status--published { background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--good); }
.status--unpublished { background: var(--panel-2); color: var(--ink-3); }
.status--coming_soon { background: color-mix(in srgb, var(--arc) 22%, transparent); color: var(--arc); }
.uploader { display: grid; gap: 8px; padding: 14px; border: 3px dashed var(--line); border-radius: var(--r-md); background: var(--bg-2); }
.uploader.is-drag { border-color: var(--arc); background: color-mix(in srgb, var(--arc) 8%, var(--bg-2)); }
.uploader input[type=file] { font-size: .9rem; max-width: 100%; }
.uploader .field small { color: var(--ink-2); } /* readable on the tinted box in both themes (WCAG AA) */
.progress { height: 10px; border-radius: 10px; background: var(--panel-2); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--arc); transition: width .2s; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs figure { margin: 0; position: relative; width: 120px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; border: 2px solid var(--line); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.thumbs button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 8px; border: 0; background: rgba(0, 0, 0, .7); color: #fff; cursor: pointer; }
.controls-editor { display: grid; gap: 8px; }
.controls-editor div { display: grid; grid-template-columns: 1fr 1.4fr 40px; gap: 8px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: 1fr; } }
details.adv summary { cursor: pointer; font-weight: 750; }

/* ── Modal & lightbox ───────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 16px; background: rgba(3, 6, 18, .72); backdrop-filter: blur(6px); animation: fade .15s ease; }
.modal__box { width: min(560px, 100%); max-height: 90vh; overflow: auto; background: var(--panel); border: 3px solid var(--line); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow); animation: pop .25s var(--ease-pop); }
.modal__box h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.5rem; margin-bottom: 12px; }
.modal__close { float: right; margin: -6px -6px 0 0; }
.lightbox { position: fixed; inset: 0; z-index: 96; background: rgba(2, 4, 12, .94); display: grid; grid-template-columns: 60px 1fr 60px; align-items: center; padding: 16px; }
.lightbox img { max-height: 86vh; margin: 0 auto; border-radius: 14px; }
.lightbox .iconbtn { justify-self: center; }
.lightbox__close { position: absolute; top: 14px; right: 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }

/* Share preview card */
.sharecard { border-radius: 16px; overflow: hidden; border: 2px solid var(--line); background: var(--bg-2); margin: 10px 0 16px; }
.sharecard img { aspect-ratio: 1200 / 630; width: 100%; object-fit: cover; }
.sharecard div { padding: 12px 14px; }
.sharecard small { color: var(--ink-3); font-size: .8rem; }
.sharecard b { display: block; margin: 2px 0; }
.sharecard p { margin: 0; color: var(--ink-2); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.copyrow { display: flex; gap: 8px; }
.copyrow input { flex: 1; min-width: 0; }
.share-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* Toasts */
.toasts { position: fixed; z-index: 99; left: 50%; bottom: 20px; translate: -50% 0; display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; padding: 13px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-weight: 700; box-shadow: 0 6px 0 rgba(0, 0, 0, .25), var(--shadow); animation: toast-in .35s var(--ease-pop); display: flex; gap: 10px; align-items: center; }
.toast--good { background: var(--good); color: #052B14; }
.toast--bad { background: var(--bad); color: #fff; }
.toast--volt { background: var(--volt); color: var(--on-volt); }
@keyframes toast-in { from { transform: translateY(24px) scale(.9); opacity: 0; } }

/* Info pages */
.legal { max-width: 74ch; }
.legal h2 { font-size: 1.35rem; margin: 32px 0 10px; }
.legal p, .legal li { color: var(--ink-2); }
.legal .note { padding: 14px 16px; border-radius: var(--r-md); background: color-mix(in srgb, var(--volt) 14%, var(--panel)); border: 2px solid color-mix(in srgb, var(--volt) 45%, var(--line)); color: var(--ink); }
.about-hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: center; padding-top: 44px; }
.about-hero .icons { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.about-hero .icons img { border-radius: 16px; border: 3px solid var(--line); aspect-ratio: 1; object-fit: cover; }
.about-hero .icons img:nth-child(odd) { transform: rotate(-4deg); }
.about-hero .icons img:nth-child(even) { transform: rotate(3deg) translateY(10px); }
@media (max-width: 820px) { .about-hero { grid-template-columns: 1fr; } }

.spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--volt); animation: spin .8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.notfound { text-align: center; padding: 80px 0; display: grid; gap: 16px; justify-items: center; }
.notfound h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(3rem, 10vw, 6rem); color: var(--zap); }

/* ── Motion preferences ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .card:hover { transform: none; }
}

/* Let the player grow to fit the "best on desktop" notice on small screens */
.player__stage:has(.player__notice) { aspect-ratio: auto; min-height: 56.25vw; }
.player__stage:has(.player__notice) .player__poster { position: relative; min-height: inherit; padding: 8px 0; }
@media (max-width: 520px) { .player__notice { padding: 16px; gap: 8px; font-size: .92rem; } .player__notice svg { width: 34px; height: 34px; } }

/* Light mode: status labels use deep text on a soft tint (WCAG AA contrast) */
[data-theme="light"] .status--published { background: #DBF9E6; color: #0F6B36; }
[data-theme="light"] .status--coming_soon { background: #D9F4FB; color: #0B5E7A; }
