/* Theme custom properties, carried character-for-character from the design
   handoff's <helmet> block.

   THESE MUST BE GLOBAL. games/engine.js:colors() does
   getComputedStyle(document.body) and reads these names directly, so any
   scoping mechanism (CSS modules, shadow DOM, a scoped @layer) would silently
   break the palette of every canvas game. */

/* Self-hosted (latin subset, straight from Google's CDN) rather than linked to
   fonts.googleapis.com — that was a third-party origin on the critical path,
   costing a DNS lookup, a TLS handshake and a render-blocking stylesheet.

   No `unicode-range`: the browser then uses each font for any glyph it has and
   falls back per-glyph for the rest. That matters because the card suits
   (♠♥♦♣) and the d-pad arrows (◀▲▶▼) are outside the latin subset — they fall
   back to the system monospace font, which is exactly what happened with
   Google Fonts too, since these are the same subset files. */
@font-face {
  font-family: "Press Start 2P";
  src: url("/fonts/press-start-2p-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "VT323";
  src: url("/fonts/vt323-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

body {
  --bg: #0a0a13;
  --panel: #12121f;
  --panel2: #1a1a2c;
  --ink: #e6efe9;
  --dim: #7f87a3;
  --line: #2b2b47;
  --acc: #39ff88;
  --acc2: #ff3d81;
  --warn: #ffd23d;
  --bad: #ff5566;
  --good: #39ff88;

  /* Per-game hue lightness. The prototype computed these inline; they differ
     between the icon (38/62) and the game name (36/62). Preserved exactly. */
  --icon-l: 62%;
  --name-l: 62%;
  --glow: 0 0 8px;

  margin: 0;
  background: var(--bg);
}

body.light {
  --bg: #ecebe2;
  --panel: #f6f5ec;
  --panel2: #ffffff;
  --ink: #191926;
  --dim: #63637a;
  --line: #cfcdbc;
  --acc: #0b8f4d;
  --acc2: #c81e5e;
  --warn: #9a7200;
  --bad: #c0392b;
  --good: #0b8f4d;

  --icon-l: 38%;
  --name-l: 36%;
  --glow: none;
}

/* Accent.

   The prototype did document.body.style.setProperty('--acc', accent), which is
   an INLINE style and therefore outranks the `body.light` rule — so picking any
   accent silently replaced light mode's deliberately darker #0b8f4d with the
   dark-theme value and destroyed light-mode contrast. Expressed as a data
   attribute with per-theme pairs, both themes keep a readable accent. */
body[data-accent="blue"] {
  --acc: #41c7ff;
  --good: #41c7ff;
}
body.light[data-accent="blue"] {
  --acc: #0a6d9e;
  --good: #0a6d9e;
}
body[data-accent="pink"] {
  --acc: #ff3d81;
  --good: #ff3d81;
}
body.light[data-accent="pink"] {
  --acc: #c81e5e;
  --good: #c81e5e;
}
body[data-accent="amber"] {
  --acc: #ffd23d;
  --good: #ffd23d;
}
body.light[data-accent="amber"] {
  --acc: #9a7200;
  --good: #9a7200;
}

a {
  color: var(--acc);
}
a:hover {
  color: var(--acc2);
}
button {
  cursor: pointer;
}

@keyframes mg-blink {
  0%,
  60% {
    opacity: 1;
  }
  61%,
  100% {
    opacity: 0;
  }
}

/* The scanline overlay and the blinking INSERT COIN are decorative motion.
   The prototype had no reduced-motion handling. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .scanlines {
    display: none;
  }
}
