/* ==========================================================================
   Gametron — "the basement" design system.
   A 90s rec room at night: wood paneling, shag carpet, CRT glow, cartridges,
   arcade cabinets. Tokens and reusable components are documented in
   docs/DESIGN.md. Page-specific rules live at the bottom, grouped by page.
   ========================================================================== */

:root {
  /* Room */
  --night: #0c0710;
  --wall-1: #3d2314;
  --wall-2: #2f1a0e;
  --groove: #170b05;
  --plank: #6e4427;
  --plank-hi: #96613a;
  --plank-lo: #3a2213;
  --carpet: #263f37;
  --carpet-fleck: #8a5a2b;

  /* Text */
  --cream: #f5e9cf;
  --cream-dim: #c9b693;
  --ink: #1a0f08;

  /* Light */
  --crt-glow: #7fd3ff;
  --crt-deep: #06121f;
  --phosphor: #9dffb6;
  --amber: #ffb02e;
  --lamp: #ffcf7a;

  /* 16-bit accents */
  --pink: #ff4fa3;
  --cyan: #3ff0ff;
  --yellow: #ffe14d;
  --green: #4cff7a;
  --red: #ff3d3d;
  --purple: #9d5cff;
  --blue: #3d7bff;

  /* Plastics */
  --plastic: #cfc8b6;
  --plastic-shade: #a39c89;
  --charcoal: #2e2d33;
  --charcoal-hi: #4a4950;

  /* Type */
  --font-pixel: "Press Start 2P", ui-monospace, monospace;
  --font-term: "VT323", ui-monospace, "SF Mono", Menlo, monospace;

  /* Shape */
  --r-sm: 4px;
  --r: 8px;
  --gutter: 16px;
  --focus: 0 0 0 3px var(--yellow), 0 0 0 6px var(--ink);
  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  font: 22px/1.25 var(--font-term);
  background-color: var(--wall-2);
  /* Wood paneling: grooves every 64px, grain from two soft gradients. */
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(127, 211, 255, 0.10), transparent 60%),
    repeating-linear-gradient(90deg, transparent 0 62px, var(--groove) 62px 64px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 9px, transparent 9px 23px, rgba(0, 0, 0, 0.05) 23px 31px, transparent 31px 64px),
    linear-gradient(180deg, var(--wall-1), var(--wall-2) 60%, #24140a);
  overflow-x: hidden;
}
a { color: var(--yellow); text-underline-offset: 3px; }
a:hover { color: var(--cyan); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
img, svg { max-width: 100%; }
main { max-width: 1240px; margin: 0 auto; padding: 24px var(--gutter) 96px; }
main.wide { max-width: none; padding: 0; }
h1, h2, h3 { font-family: var(--font-pixel); font-weight: 400; line-height: 1.35; margin: 0 0 12px; }
h1 { font-size: clamp(18px, 3.2vw, 28px); text-shadow: 3px 3px 0 var(--ink); }
h2 { font-size: clamp(13px, 1.8vw, 16px); margin-top: 40px; color: var(--lamp); text-shadow: 2px 2px 0 var(--ink); }
h3 { font-size: 11px; letter-spacing: 0.04em; }
p { margin: 0 0 12px; }
code, pre { font-family: var(--font-term); }
code { background: rgba(0, 0, 0, 0.45); padding: 0 6px; border-radius: var(--r-sm); color: var(--phosphor); }

/* Utilities */
.pixel { font-family: var(--font-pixel); font-weight: 400; letter-spacing: 0.02em; }
.term { font-family: var(--font-term); }
.muted { color: var(--cream-dim); }
.small { font-size: 18px; }
.tiny { font-size: 10px; }
.glow { text-shadow: 0 0 6px currentColor, 0 0 18px currentColor; }
.blink { animation: blink 1s steps(1) infinite; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@keyframes blink { 50% { opacity: 0; } }

/* Scanlines + vignette overlay for any positioned container. */
.scanlines { position: relative; }
.scanlines::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3; border-radius: inherit;
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

/* --------------------------------------------------------------------------
   Buttons — chunky arcade buttons with a pressable bottom edge.
   .btn (yellow) · .btn--red · .btn--cyan · .btn--green · .btn--ghost · .btn--sm · .btn--block
   -------------------------------------------------------------------------- */
.btn {
  --btn: var(--yellow); --btn-edge: #b38f00; --btn-ink: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 11px/1.2 var(--font-pixel); letter-spacing: 0.02em; text-transform: uppercase; text-decoration: none;
  color: var(--btn-ink); background: var(--btn);
  border: 3px solid var(--ink); border-radius: var(--r);
  padding: 10px 14px; margin-bottom: 5px; cursor: pointer;
  box-shadow: 0 5px 0 var(--btn-edge), 0 5px 0 3px var(--ink), 0 10px 18px rgba(0, 0, 0, 0.45);
  transform: translateY(0); transition: transform 0.06s, box-shadow 0.06s, filter 0.1s;
}
.btn:hover { filter: brightness(1.08); color: var(--btn-ink); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--btn-edge), 0 1px 0 3px var(--ink), 0 3px 6px rgba(0, 0, 0, 0.45); }
.btn:disabled, .btn[aria-disabled="true"] { filter: grayscale(0.8) brightness(0.7); cursor: not-allowed; }
.btn--red { --btn: var(--red); --btn-edge: #9e1818; --btn-ink: #fff; }
.btn--cyan { --btn: var(--cyan); --btn-edge: #109aa6; }
.btn--green { --btn: var(--green); --btn-edge: #1d9b3f; }
.btn--ghost { --btn: rgba(0, 0, 0, 0.45); --btn-edge: rgba(0, 0, 0, 0.7); --btn-ink: var(--cream); border-color: var(--cream-dim); }
.btn--sm { font-size: 9px; padding: 7px 10px; }
.btn--block { width: 100%; }

/* --------------------------------------------------------------------------
   Panels
   .panel (dark glass in a wood frame) · .panel--chalk · .panel--cork · .panel--term · .panel--paper
   -------------------------------------------------------------------------- */
.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(20, 11, 6, 0.92), rgba(12, 6, 3, 0.94));
  border: 6px solid var(--plank);
  border-image: linear-gradient(135deg, var(--plank-hi), var(--plank) 40%, var(--plank-lo)) 1;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.5), 0 14px 30px rgba(0, 0, 0, 0.5);
  padding: 16px 18px;
}
.panel > h3:first-child { color: var(--lamp); }
.panel--paper > h3:first-child, .panel--cork > h3:first-child { color: #a3311b; }
.panel--chalk {
  background:
    radial-gradient(ellipse at 20% 30%, rgba(255, 255, 255, 0.06), transparent 40%),
    radial-gradient(ellipse at 80% 70%, rgba(255, 255, 255, 0.05), transparent 45%),
    linear-gradient(160deg, #1f3a2c, #15291f);
  color: #eef3e8;
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.6);
}
.panel--cork {
  background-color: #b07a45;
  background-image:
    radial-gradient(rgba(70, 35, 10, 0.55) 1px, transparent 1.5px),
    radial-gradient(rgba(255, 220, 160, 0.35) 1px, transparent 1.5px),
    linear-gradient(135deg, #b9844e, #9c6a3a);
  background-size: 9px 9px, 13px 13px, auto;
  background-position: 0 0, 4px 6px, 0 0;
  color: var(--ink);
}
.panel--term { background: #050805; color: var(--phosphor); font-family: var(--font-term); }
.panel--term a { color: var(--yellow); }
.panel--paper { background: #f4ecd6; color: var(--ink); border-image: none; border: 0; border-radius: 2px; }
.panel--paper a { color: #a3311b; }

/* --------------------------------------------------------------------------
   CRT television — put an iframe, canvas or content inside .crt-screen.
   <div class="crt"><div class="crt-screen">…</div><div class="crt-panel">…</div></div>
   .crt--wood for the walnut-veneer console TV variant.
   -------------------------------------------------------------------------- */
.crt {
  position: relative;
  padding: clamp(10px, 2.4vw, 26px) clamp(10px, 2.4vw, 26px) 0;
  background: linear-gradient(160deg, #4b4a52, #2a2930 55%, #1d1c22);
  border-radius: 28px 28px 22px 22px;
  border: 3px solid #111;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.14),
    inset 0 -6px 12px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(127, 211, 255, 0.22),
    0 24px 40px rgba(0, 0, 0, 0.6);
}
.crt--wood {
  background:
    repeating-linear-gradient(92deg, rgba(0, 0, 0, 0.12) 0 3px, transparent 3px 11px),
    linear-gradient(160deg, #7a4a28, #4e2c15 60%, #3b200e);
}
.crt-screen {
  position: relative; overflow: hidden;
  aspect-ratio: 16 / 10;
  background: radial-gradient(ellipse at 50% 40%, #0f2a40, var(--crt-deep) 70%);
  border-radius: 22px / 18px;
  border: 4px solid #0a0a0c;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.9), 0 0 0 2px #3a3940, 0 0 26px rgba(127, 211, 255, 0.35);
}
.crt-screen::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 4; border-radius: inherit;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.07), transparent 30%),
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.5) 100%);
  animation: crt-roll 9s linear infinite;
}
.crt-screen:fullscreen { border-radius: 0; border: 0; }
.crt-screen:fullscreen::after { display: none; }
@keyframes crt-roll { from { background-position: 0 0, 0 0, 0 0; } to { background-position: 0 0, 0 60px, 0 0; } }
.crt-panel {
  display: flex; align-items: center; gap: 12px; padding: 10px 6px 12px;
  font: 9px var(--font-pixel); color: #b8b6c0; letter-spacing: 0.12em;
}
.crt-brand { margin-right: auto; text-shadow: 0 1px 0 #000; }
.crt-knob { width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #77767e, #232228 70%); border: 2px solid #0e0e10; box-shadow: 0 2px 0 #000; }
.crt-knob--sm { width: 14px; height: 14px; }
.crt-led { width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px var(--red), 0 0 2px #fff inset; }
.crt-led--on { background: var(--green); box-shadow: 0 0 8px var(--green), 0 0 2px #fff inset; }
.crt-speaker { width: 46px; height: 14px; background: repeating-linear-gradient(90deg, #111 0 2px, transparent 2px 5px); opacity: 0.8; }

/* --------------------------------------------------------------------------
   Cartridges — game cards. Label art is an inline pixel SVG (views.ts labelArt()).
   .shelf holds rows of cartridges on wooden planks.
   -------------------------------------------------------------------------- */
.shelf {
  --cart-w: 190px; --row: 272px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--cart-w), 1fr));
  grid-auto-rows: var(--row); column-gap: 22px;
  padding: 18px 20px 0;
  background:
    repeating-linear-gradient(180deg, transparent 0 calc(var(--row) - 22px), var(--plank-hi) calc(var(--row) - 22px) calc(var(--row) - 19px), var(--plank) calc(var(--row) - 19px) calc(var(--row) - 6px), var(--plank-lo) calc(var(--row) - 6px) var(--row)),
    linear-gradient(180deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.3));
  background-position: 0 18px, 0 0;
  border-left: 10px solid var(--plank-lo); border-right: 10px solid var(--plank-lo);
  box-shadow: inset 0 18px 30px rgba(0, 0, 0, 0.55);
}
.cartridge {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: 22px; text-decoration: none; color: var(--cream); min-width: 0;
}
.cart-shell {
  position: relative; width: 100%; max-width: 180px;
  aspect-ratio: 1 / 1;
  background: linear-gradient(180deg, var(--charcoal-hi), var(--charcoal) 30%, #222126);
  clip-path: polygon(0 7%, 7% 0, 93% 0, 100% 7%, 100% 100%, 0 100%);
  padding: 22px 12px 0;
  border-radius: 0 0 6px 6px;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.5);
  transition: transform 0.18s cubic-bezier(.2, .8, .3, 1.3), filter 0.18s;
}
.cart-shell::before { /* grip ridges */
  content: ""; position: absolute; left: 16%; right: 16%; top: 7px; height: 9px;
  background: repeating-linear-gradient(90deg, #1b1a1f 0 4px, #5a5961 4px 6px);
  border-radius: 2px;
}
.cart-label {
  position: relative; height: calc(100% - 12px);
  background: #f2e8cf; border-radius: 4px 4px 0 0; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.25);
}
.cart-art { display: block; width: 100%; height: auto; aspect-ratio: 16 / 11; image-rendering: pixelated; shape-rendering: crispEdges; }
.cart-title {
  font: 8px/1.45 var(--font-pixel); color: var(--ink); padding: 6px 7px 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cart-brand { position: absolute; left: 5px; top: 5px; font: 6px var(--font-pixel); color: #fff; background: var(--red); padding: 2px 4px; border-radius: 2px; letter-spacing: 0.08em; }
.cart-sticker {
  position: absolute; right: 4px; top: 5px;
  font: 6px var(--font-pixel); text-transform: uppercase; color: var(--ink);
  background: var(--yellow); padding: 3px 5px; transform: rotate(6deg);
  border: 2px solid #fff; border-radius: 3px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}
.cart-meta { margin-top: 10px; font-size: 18px; line-height: 1.1; text-align: center; color: var(--cream-dim); max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; }
.cart-meta b { color: var(--cream); font-weight: 400; }
.cartridge:hover .cart-shell, .cartridge:focus-visible .cart-shell { transform: translateY(-14px) rotate(-1.5deg); filter: brightness(1.12); }
.cartridge:active .cart-shell { transform: translateY(6px); }
.cartridge:focus-visible { box-shadow: none; }
.cartridge:focus-visible .cart-shell { outline: 3px solid var(--yellow); outline-offset: 3px; }

/* Genre "spines" on a shelf. */
.spines { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 8px; padding: 10px 12px 0; background: rgba(0, 0, 0, 0.3); border-bottom: 10px solid var(--plank); box-shadow: inset 0 10px 20px rgba(0, 0, 0, 0.5); }
.spine {
  font: 9px var(--font-pixel); text-transform: uppercase; text-decoration: none;
  color: var(--cream); padding: 12px 10px 10px; min-width: 44px; text-align: center;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.35), transparent 20%, transparent 80%, rgba(0, 0, 0, 0.35)), var(--spine, #534c7a);
  border-radius: 3px 3px 0 0; border: 2px solid rgba(0, 0, 0, 0.5); border-bottom: 0;
  transition: transform 0.12s;
}
.spine:hover, .spine.on { transform: translateY(-6px); color: var(--ink); background: var(--yellow); }
.spine.on { box-shadow: 0 0 14px rgba(255, 225, 77, 0.6); }

/* --------------------------------------------------------------------------
   Arcade cabinet — a lit marquee over a black screen and a control deck.
   -------------------------------------------------------------------------- */
.arcade {
  position: relative; display: flex; flex-direction: column;
  background: linear-gradient(90deg, #2a0f3d, #43175f 12%, #3a1453 88%, #210a31);
  border: 4px solid var(--ink); border-radius: 14px 14px 6px 6px;
  padding: 0 18px 18px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.55), inset 0 0 0 4px rgba(255, 79, 163, 0.25);
}
.arcade::before, .arcade::after { /* side art stripes */
  content: ""; position: absolute; top: 70px; bottom: 30px; width: 6px;
  background: repeating-linear-gradient(180deg, var(--pink) 0 14px, var(--yellow) 14px 28px, var(--cyan) 28px 42px);
  opacity: 0.85;
}
.arcade::before { left: 5px; } .arcade::after { right: 5px; }
.marquee {
  margin: 0 -18px 16px; padding: 16px 12px;
  text-align: center; font: clamp(12px, 1.6vw, 16px)/1.2 var(--font-pixel); color: #fff;
  background: radial-gradient(ellipse at center, #ff7cc0, var(--pink) 45%, #a01764);
  border-bottom: 4px solid var(--ink); border-radius: 10px 10px 0 0;
  text-shadow: 0 0 8px #fff, 3px 3px 0 #6b0b40;
  box-shadow: 0 0 30px rgba(255, 79, 163, 0.55);
}
.marquee--cyan { background: radial-gradient(ellipse at center, #9df9ff, var(--cyan) 45%, #0b8c96); color: var(--ink); text-shadow: 0 0 6px #fff; box-shadow: 0 0 30px rgba(63, 240, 255, 0.5); }
.arcade-screen { background: #030303; border: 4px solid #0d0d0d; border-radius: 10px; padding: 14px 14px 10px; box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.9), 0 0 0 3px #19191c; }
.arcade-deck { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; padding: 18px 10px 10px; background: linear-gradient(180deg, #1c1c22, #0e0e12); border-radius: 6px; border: 3px solid var(--ink); }
.stick { width: 12px; height: 26px; background: #222; position: relative; border-radius: 4px; }
.stick::before { content: ""; position: absolute; left: 50%; top: -14px; width: 24px; height: 24px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff8a8a, var(--red) 60%, #8a1010); }
.knob { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--ink); background: radial-gradient(circle at 35% 30%, #fff8, transparent 40%), var(--k, var(--yellow)); }
.insert-coin { margin-top: 10px; text-align: center; font: 9px var(--font-pixel); color: var(--yellow); }

/* High score table (arcade style). */
.hiscore { width: 100%; border-collapse: collapse; font: clamp(9px, 1.1vw, 11px)/1.9 var(--font-pixel); text-transform: uppercase; table-layout: fixed; }
.hiscore th { color: var(--red); font-weight: 400; text-align: left; padding-bottom: 6px; }
.hiscore td { padding: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hiscore .rk { color: var(--cyan); width: 4.8em; }
.hiscore .pts { text-align: right; color: var(--yellow); width: 6.5em; }
.hiscore tbody tr:first-child .name { color: var(--yellow); }
.hiscore a { color: inherit; text-decoration: none; }
.hiscore a:hover { color: var(--pink); }
.hiscore .name { color: #fff; }
.hiscore .sub { color: #8d8d9a; }

/* Arcade token + header readouts */
.token {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; flex: none;
  font: 7px var(--font-pixel); color: #6b4a00;
  background: radial-gradient(circle at 35% 30%, #fff6b0, #ffcf3a 45%, #c48a00 80%);
  border: 2px solid #7a5300; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.25), 0 2px 0 #4d3400;
}
.token--sm { width: 16px; height: 16px; font-size: 0; border-width: 1px; vertical-align: -2px; }
.lcd { font-family: var(--font-term); font-size: 26px; line-height: 1; color: var(--phosphor); background: #071108; border: 2px solid #000; border-radius: 4px; padding: 2px 8px; text-shadow: 0 0 6px rgba(157, 255, 182, 0.8); box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.9); }
.vcr { font-family: var(--font-term); font-size: 26px; line-height: 1; color: #6dffb0; text-shadow: 0 0 8px #3dff8f; letter-spacing: 0.06em; }

/* Stickers (die-cut vinyl). */
.sticker {
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  background: #fff; color: var(--ink); border: 0; border-radius: 14px; padding: 8px 4px 6px;
  box-shadow: 0 0 0 3px #fff, 0 4px 0 3px rgba(0, 0, 0, 0.25), 0 8px 14px rgba(0, 0, 0, 0.45);
  transform: rotate(var(--tilt, -3deg)); cursor: pointer; font: inherit; transition: transform 0.12s;
}
.sticker:hover:not(:disabled) { transform: rotate(0deg) scale(1.08); }
.sticker:disabled { cursor: default; filter: saturate(0.6); opacity: 0.85; }

/* Index card pinned to a corkboard. */
.note { position: relative; background: #fdfaf0; color: var(--ink); padding: 18px 16px 12px; box-shadow: 0 6px 12px rgba(0, 0, 0, 0.35); transform: rotate(var(--tilt, -1deg)); background-image: repeating-linear-gradient(180deg, transparent 0 25px, rgba(61, 123, 255, 0.25) 25px 26px); background-position: 0 30px; }
.note::before { content: ""; position: absolute; top: -7px; left: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff9a9a, var(--red) 60%, #7a0d0d); box-shadow: 0 3px 4px rgba(0, 0, 0, 0.4); }

/* Caution tape banner (test mode etc.) */
.tape {
  font: 10px/1.9 var(--font-pixel); color: var(--ink); text-transform: uppercase; text-align: center;
  padding: 10px 14px; margin: 0 0 18px;
  background: repeating-linear-gradient(-45deg, var(--yellow) 0 18px, var(--ink) 18px 36px);
  border: 3px solid var(--ink);
}
.tape span { background: var(--yellow); padding: 4px 8px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }

/* Forms */
.field, .new-thread input, .new-thread textarea, .switch input {
  font: 22px/1.2 var(--font-term); color: var(--cream);
  background: rgba(0, 0, 0, 0.55); border: 2px solid var(--plank-hi); border-radius: var(--r-sm);
  padding: 8px 10px; width: 100%;
}
.new-thread { display: flex; flex-direction: column; gap: 10px; max-width: 680px; margin-top: 18px; }
.new-thread textarea { min-height: 100px; resize: vertical; }
.new-thread .btn { align-self: flex-start; }

/* --------------------------------------------------------------------------
   Site chrome: the header is the shelf above the TV — logo, nav, the VCR
   clock and your arcade tokens.
   -------------------------------------------------------------------------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px var(--gutter) 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 40%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0 2px, transparent 2px 13px),
    linear-gradient(180deg, var(--plank), var(--plank-lo));
  border-bottom: 4px solid var(--groove);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 40px; height: 40px; }
.logo {
  font: 16px var(--font-pixel); letter-spacing: 0.04em; line-height: 1.1;
  background: linear-gradient(180deg, #fff 0 30%, var(--yellow) 30% 55%, var(--amber) 55% 75%, var(--pink) 75%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(2px 2px 0 var(--ink)) drop-shadow(0 0 1px var(--ink));
}
.top nav { display: flex; gap: 8px; }
.top nav a {
  font: 9px var(--font-pixel); text-transform: uppercase; text-decoration: none; color: var(--cream);
  padding: 9px 10px 7px; background: rgba(0, 0, 0, 0.35); border: 2px solid rgba(0, 0, 0, 0.55); border-radius: 4px;
}
.top nav a:hover, .top nav a[aria-current="page"] { background: var(--yellow); color: var(--ink); }
.me { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.tokens { display: inline-flex; align-items: center; gap: 6px; }
.vcr-box { display: flex; align-items: center; gap: 6px; background: #0b0b0d; border: 2px solid #000; border-radius: 4px; padding: 3px 8px; box-shadow: inset 0 1px 0 #333; }
.vcr-box .vcr-label { font: 6px var(--font-pixel); color: #777; letter-spacing: 0.1em; }
.player-tag { font: 9px var(--font-pixel); color: var(--cream); text-decoration: none; }
.player-tag::before { content: "1P "; color: var(--red); }
.switch input { width: 120px; font-size: 18px; padding: 3px 8px; }

.site-foot { text-align: center; padding: 30px var(--gutter) 60px; color: var(--cream-dim); font-size: 18px; }
.site-foot img { width: 110px; display: block; margin: 0 auto 8px; }

/* --------------------------------------------------------------------------
   Home: the basement scene
   -------------------------------------------------------------------------- */
.basement {
  position: relative; overflow: hidden;
  margin: -24px calc(-1 * var(--gutter)) 0; padding: 36px var(--gutter) 0;
  background:
    radial-gradient(ellipse 45% 55% at 50% 45%, rgba(127, 211, 255, 0.28), transparent 70%),
    radial-gradient(ellipse 30% 40% at 6% 60%, rgba(255, 176, 46, 0.25), transparent 70%),
    radial-gradient(ellipse 30% 40% at 96% 40%, rgba(255, 79, 163, 0.18), transparent 70%);
}
.basement-stars { position: absolute; inset: 0 0 auto 0; height: 130px; background: url("/static/art/stars.svg") repeat-x top center / 640px 130px; pointer-events: none; }
.deco { position: absolute; pointer-events: none; user-select: none; z-index: 1; }
.deco--poster-a { left: 2%; top: 56px; width: 150px; transform: rotate(-4deg); }
.deco--poster-b { right: 3%; top: 40px; width: 140px; transform: rotate(3deg); }
.deco--lamp { left: 5%; bottom: 70px; width: 64px; }
.deco--arcade { right: 2%; bottom: 46px; width: 170px; }
.deco--beanbag { left: 13%; bottom: 6px; width: 170px; z-index: 3; }
.deco--pad { right: 21%; bottom: 10px; width: 110px; transform: rotate(-12deg); z-index: 3; }
.tv-stand { position: relative; z-index: 2; max-width: 640px; margin: 0 auto; }
.tv-stand .crt { z-index: 2; }
.stand {
  position: relative; height: 104px; margin: 0 -30px;
  background:
    linear-gradient(180deg, var(--plank-hi) 0 6px, var(--plank) 6px 18px, var(--plank-lo) 18px 22px, transparent 22px),
    linear-gradient(90deg, var(--plank-lo) 0 14px, transparent 14px calc(100% - 14px), var(--plank-lo) calc(100% - 14px));
}
.stand-gear { position: absolute; left: 50%; top: 30px; transform: translateX(-50%); display: flex; align-items: flex-end; gap: 16px; }
.stand-gear img { width: 210px; display: block; }
.stand-gear .vcr-box { margin-bottom: 14px; }
.floor {
  position: relative; height: 74px; margin: 0 calc(-1 * var(--gutter));
  background-color: var(--carpet);
  background-image: url("/static/art/carpet.svg");
  background-size: 200px;
  box-shadow: inset 0 16px 22px rgba(0, 0, 0, 0.6);
}
.boot { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 6% 8%; color: var(--crt-glow); }
.boot-copy { font: 9px var(--font-pixel); color: #6fa8c7; letter-spacing: 0.06em; }
.boot h1 { font-size: clamp(13px, 2.4vw, 22px); color: #fff; text-shadow: 0 0 10px var(--crt-glow), 3px 3px 0 #001a2e; margin: 0; }
.boot p { font-size: clamp(18px, 2vw, 24px); color: #bfe8ff; margin: 0; max-width: 34ch; }
.boot .actions { margin-top: 6px; }
.cursor::after { content: "\2588"; margin-left: 4px; animation: blink 1s steps(1) infinite; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; margin-top: 40px; }
.section-head h2 { margin: 0 0 14px; }
.section-head .muted { font-size: 19px; margin-bottom: 14px; }
.empty { padding: 26px; text-align: center; }
.cabinets { display: grid; grid-template-columns: 1.15fr 1fr; gap: 28px; margin-top: 44px; align-items: start; }
.chalk-list { list-style: none; margin: 0; padding: 0; font-size: 24px; }
.chalk-list li { display: flex; gap: 10px; align-items: baseline; padding: 4px 0; border-bottom: 1px dashed rgba(255, 255, 255, 0.2); }
.chalk-list .rank { font-family: var(--font-pixel); font-size: 11px; color: var(--yellow); width: 2.4em; flex: none; }
.chalk-list a { color: #fff; text-decoration: none; }
.chalk-list a:hover { color: var(--yellow); }
.chalk-list .pts { margin-left: auto; color: #b9f5c9; white-space: nowrap; }
.chalk-title { font: 13px var(--font-pixel); text-align: center; margin-bottom: 12px; color: #fff; }
.chalk-tray { height: 10px; margin: 14px -18px -16px; background: linear-gradient(180deg, var(--plank-hi), var(--plank-lo)); position: relative; }
.chalk-tray::after { content: ""; position: absolute; left: 20%; top: -5px; width: 34px; height: 7px; background: #f4f4ef; border-radius: 3px; box-shadow: 50px 1px 0 -1px #f7d9e8; }
.chalk-doodle { position: absolute; right: 14px; bottom: 22px; width: 70px; opacity: 0.5; }

/* --------------------------------------------------------------------------
   Game page
   -------------------------------------------------------------------------- */
.game-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.game-title { display: inline-block; background: #f2e8cf; color: var(--ink); padding: 12px 16px 10px; border: 4px solid var(--charcoal); border-radius: 4px; box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5); text-shadow: none; margin-bottom: 10px; }
.game-byline { font-size: 21px; }
.genre-tag { font: 8px var(--font-pixel); text-transform: uppercase; color: var(--ink); background: var(--yellow); padding: 4px 6px; border: 2px solid var(--ink); border-radius: 3px; vertical-align: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.actions form { margin: 0; }
.play-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 26px; align-items: start; }
.tv-column { min-width: 0; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; z-index: 1; background: #000; }
.loading { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; text-align: center; padding: 20px; font: 11px/2 var(--font-pixel); color: var(--crt-glow); pointer-events: none; }
.console-under { position: relative; display: flex; justify-content: center; padding-top: 30px; }
.console-under .stand { position: absolute; left: -12px; right: -12px; top: 0; height: 22px; margin: 0; }
.console-unit { position: relative; width: min(330px, 72%); isolation: isolate; }
.console-unit img { display: block; width: 100%; }
.console-cart { position: absolute; left: 50%; top: -12%; transform: translateX(-50%); width: 34%; height: 34%; background: linear-gradient(180deg, var(--charcoal-hi), var(--charcoal)); clip-path: polygon(0 14%, 8% 0, 92% 0, 100% 14%, 100% 100%, 0 100%); padding: 8% 7% 0; z-index: -1; }
.console-cart span { display: block; background: #f2e8cf; color: var(--ink); font: 6px/1.5 var(--font-pixel); padding: 3px 4px; height: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.side .arcade { padding-bottom: 14px; }
.side .marquee { font-size: 11px; padding: 12px; margin-bottom: 12px; }
.stickers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding-top: 6px; }
.stickers form { margin: 0; display: flex; justify-content: center; }
.stickers .sticker { width: 100%; }
.sticker .emoji { font-size: 26px; line-height: 1; }
.sticker .count { font: 9px var(--font-pixel); }
.sticker small { font-size: 15px; color: #6c5a3a; display: inline-flex; align-items: center; gap: 3px; }
.readout { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 21px; }
.readout dt { color: #4f9d68; text-transform: uppercase; font-size: 18px; }
.readout dd { margin: 0; text-align: right; }
.desc-card { margin-top: 30px; max-width: 760px; font-size: 22px; }
.desc-card h3 { color: #a3311b; }
.forum { margin-top: 36px; }
.cork { padding: 26px 22px 22px; }
.cork-notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 24px 20px; list-style: none; margin: 0; padding: 0; }
.cork-notes a { color: var(--ink); font-size: 23px; text-decoration: none; display: block; line-height: 1.1; }
.cork-notes a:hover { color: #a3311b; text-decoration: underline; }
.cork-notes .meta { font-size: 17px; color: #6c5a3a; margin-top: 6px; }
.cork .new-thread { position: relative; background: #fdfaf0; padding: 22px 16px 16px; box-shadow: 0 6px 12px rgba(0, 0, 0, 0.35); max-width: 560px; transform: rotate(0.6deg); margin-top: 28px; }
.cork .new-thread::before { content: ""; position: absolute; top: -7px; left: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #9ab8ff, var(--blue) 60%, #10307a); box-shadow: 0 3px 4px rgba(0, 0, 0, 0.4); }
.cork .new-thread input, .cork .new-thread textarea { color: var(--ink); background: transparent; border: 0; border-bottom: 2px solid #c9bda0; border-radius: 0; }
.cork .new-thread input::placeholder, .cork .new-thread textarea::placeholder { color: #8a7c5f; }
.cork-empty { color: var(--ink); font-size: 22px; background: #fdfaf0; display: inline-block; padding: 10px 14px; transform: rotate(-1deg); }

/* --------------------------------------------------------------------------
   Thread page: BBS terminal
   -------------------------------------------------------------------------- */
.bbs { padding: 22px 22px 18px; font-size: 22px; max-width: 900px; }
.bbs-head { color: var(--amber); border-bottom: 2px dashed #285c35; padding-bottom: 10px; margin-bottom: 14px; }
.bbs-head h1 { font-size: clamp(14px, 2vw, 18px); color: var(--phosphor); text-shadow: 0 0 8px rgba(157, 255, 182, 0.6); }
.bbs-msg { border-bottom: 1px dashed #1f4a2a; padding: 10px 0 14px; }
.bbs-msg header { color: var(--amber); font-size: 19px; }
.bbs-msg .builder-flag { color: var(--ink); background: var(--yellow); padding: 0 6px; margin-left: 6px; }
.bbs-msg .post-body { white-space: pre-wrap; margin-top: 4px; color: var(--phosphor); text-shadow: 0 0 4px rgba(157, 255, 182, 0.35); overflow-wrap: anywhere; }
.bbs form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.bbs textarea { font: 22px/1.2 var(--font-term); color: var(--phosphor); background: #020402; border: 2px solid #285c35; padding: 10px; min-height: 110px; resize: vertical; width: 100%; }
.prompt-line { color: var(--amber); }

/* --------------------------------------------------------------------------
   Profile: trading card on a bedroom wall
   -------------------------------------------------------------------------- */
.profile-wall { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 34px; align-items: start; }
.card {
  position: relative; background: linear-gradient(160deg, #ffe680, #ffb02e 50%, #ff6f3c);
  border: 6px solid #fff; border-radius: 16px; padding: 14px; color: var(--ink);
  box-shadow: 0 0 0 3px var(--ink), 0 16px 30px rgba(0, 0, 0, 0.55); transform: rotate(-2deg);
}
.card-name { font: 11px/1.4 var(--font-pixel); margin: 0 0 8px; display: flex; justify-content: space-between; gap: 8px; text-shadow: none; overflow-wrap: anywhere; }
.card-name .hp { color: #a3311b; white-space: nowrap; }
.card-art { background: radial-gradient(circle at 50% 40%, #1d3f63, var(--crt-deep)); border: 4px solid #7a5300; border-radius: 6px; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; }
.card-art svg { width: 70%; height: auto; image-rendering: pixelated; shape-rendering: crispEdges; }
.card-type { font: 8px/1.6 var(--font-pixel); background: rgba(255, 255, 255, 0.7); margin: 8px 0; padding: 5px 8px; border-radius: 4px; overflow-wrap: anywhere; }
.card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; text-align: center; }
.card-stats div { background: rgba(255, 255, 255, 0.65); border-radius: 6px; padding: 6px 2px; }
.card-stats b { display: block; font: 10px var(--font-pixel); }
.card-stats span { font-size: 16px; }
.card-bio { font-size: 19px; margin-top: 8px; background: rgba(255, 255, 255, 0.55); border-radius: 6px; padding: 6px 8px; min-height: 2.4em; overflow-wrap: anywhere; }
.card form { margin-top: 12px; }
.wall-col h2:first-child { margin-top: 0; }
.memory-list { list-style: none; margin: 0; padding: 0; }
.memory-list li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px dashed rgba(157, 255, 182, 0.25); }
.memory-list .slot { font: 8px var(--font-pixel); color: var(--amber); }

/* --------------------------------------------------------------------------
   Build page: the instruction manual
   -------------------------------------------------------------------------- */
.manual { max-width: 860px; margin: 0 auto; padding: 30px clamp(18px, 4vw, 44px); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 8px 8px 0 #d9ccaa, 16px 16px 0 #b9ab88; }
.manual h1 { text-shadow: none; color: #c4261b; }
.manual h2 { color: var(--ink); text-shadow: none; }
.manual-cover { display: flex; gap: 22px; align-items: center; justify-content: space-between; border-bottom: 4px double var(--ink); padding-bottom: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.manual-cover > div { flex: 1 1 320px; }
.manual-cover img { width: 150px; }
.studio-callout { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--ink); color: var(--cream); padding: 14px 16px; margin: 14px 0 22px; border-radius: 6px; }
.studio-callout p { margin: 0; }
.steps { padding-left: 0; list-style: none; counter-reset: s; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 18px 54px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 38px; height: 38px; display: grid; place-items: center; font: 14px var(--font-pixel); color: #fff; background: #c4261b; border: 3px solid var(--ink); border-radius: 50%; }
.manual pre { background: #0a0f0a; color: var(--phosphor); padding: 10px 14px; border-radius: 4px; margin: 8px 0; white-space: pre-wrap; word-break: break-word; font-size: 21px; border: 3px solid #333; }
.manual code { background: #e7dcbd; color: var(--ink); }
.tpl-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.tpl-list li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; border-bottom: 1px dotted #b9ab88; padding-bottom: 8px; }

/* --------------------------------------------------------------------------
   Error / 404: NO SIGNAL
   -------------------------------------------------------------------------- */
.nosignal { max-width: 720px; margin: 20px auto 0; }
.static {
  position: absolute; inset: -50%; z-index: 0;
  background: url("/static/art/static.svg") 0 0 / 260px 260px;
  animation: static-shift 0.4s steps(4) infinite; opacity: 0.6;
}
@keyframes static-shift { 0% { transform: translate(0, 0); } 25% { transform: translate(-40px, 30px); } 50% { transform: translate(30px, -50px); } 75% { transform: translate(-20px, -20px); } }
.nosignal-msg { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 20px; }
.nosignal-msg .label { font: clamp(16px, 3vw, 28px) var(--font-pixel); color: #fff; background: rgba(0, 0, 0, 0.8); padding: 12px 18px; text-shadow: 3px 3px 0 var(--blue); }
.nosignal-msg p { background: rgba(0, 0, 0, 0.8); padding: 6px 12px; margin: 0; max-width: 40ch; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .deco--poster-a, .deco--poster-b { width: 110px; }
  .deco--arcade { width: 130px; }
}
@media (max-width: 900px) {
  .play-layout, .cabinets, .profile-wall { grid-template-columns: 1fr; }
  .profile-wall .card { max-width: 320px; width: 100%; margin: 0 auto; }
  .deco--poster-a, .deco--poster-b, .deco--arcade, .deco--pad { display: none; }
  .deco--lamp { width: 50px; bottom: 76px; left: 2px; }
  .deco--beanbag { width: 120px; left: auto; right: 2%; }
}
@media (max-width: 640px) {
  body { font-size: 21px; }
  .top { gap: 10px; }
  .top nav { order: 3; width: 100%; }
  .top nav a { flex: 1; text-align: center; padding: 9px 4px 7px; }
  .switch, .vcr-box { display: none; }
  .logo { font-size: 13px; }
  .brand img { width: 32px; height: 32px; }
  .basement { padding-top: 26px; }
  .tv-stand { margin: 0 10px; }
  .stand { margin: 0 -14px; height: 76px; }
  .stand-gear { top: 26px; }
  .stand-gear img { width: 150px; }
  .stand-gear .vcr-box { display: none; }
  .deco--lamp { display: none; }
  .boot { padding: 4% 6%; gap: 6px; }
  .boot-copy { display: none; }
  .boot p { font-size: 17px; }
  .boot .btn { font-size: 7px; padding: 7px 8px; }
  .boot .actions { gap: 8px; }
  .shelf { --cart-w: 130px; --row: 238px; column-gap: 12px; padding: 14px 8px 0; border-width: 6px; }
  .cart-shell { padding: 18px 9px 0; }
  .cart-title { font-size: 7px; }
  .cart-meta { font-size: 16px; }
  .stickers { gap: 8px; }
  .crt { border-radius: 18px 18px 14px 14px; }
  .crt-panel .crt-speaker, .crt-panel .crt-knob--sm { display: none; }
  .crt-panel { gap: 8px; font-size: 7px; }
  .steps li { padding-left: 46px; }
  .steps li::before { width: 32px; height: 32px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
