/*
 * `n64.css` — THE MENU CHROME THE THREE 3D GAMES SHARE.
 * ==================================================================
 * The overlay, the panels, the big letterspaced title, the buttons
 * and the character-select grid. Alamo 64, Alamo Kart and Goldendart
 * had a near-identical copy of all of it in their own <style> block:
 * the same rules, differing only in which green or blue they were.
 *
 * So the RULES live here and the COLOURS are custom properties each
 * game sets. Overriding a token is a line; overriding a rule means
 * you have found something this file should have had a token for.
 *
 * The shell (SS.createShell) still owns the frame around all of this
 * — corner buttons, the pause modal, the touch pad — and injects its
 * own CSS from engine.js. This is only the game's own menu inside it.
 *
 * Loaded with a ?v= like every script, so `npm run bump` keeps it in
 * step. A stale cached stylesheet is the same failure as a stale
 * cached engine, and just as hard to recognise from the outside.
 */

:root {
  --n64-bg: #0b1018;              /* behind everything */
  --n64-veil: rgba(9, 14, 24, 0.9);   /* the overlay over the game */
  --n64-title: #ffd76a;
  --n64-title-shadow: 3px 3px 0 #d8582c, 5px 5px 0 #1a2434;
  --n64-title-size: 2.4rem;
  --n64-title-track: 5px;         /* letter-spacing on the title */
  --n64-text: #cfe0f0;
  --n64-muted: #7f9ab4;
  --n64-accent: #5a8ac0;          /* button fill */
  --n64-accent-hi: #7ba9dc;       /* button hover */
  --n64-ink: #08111c;             /* text ON a button */
  --n64-border: #ffd76a;          /* button border */
  --n64-ghost-border: #33506e;
  --n64-cell: #16202e;            /* a character-select cell */
  --n64-cell-border: #3c5c36;
  --n64-gap: 14px;
  --n64-pad: 18px;
  --n64-prose: 560px;             /* how wide a paragraph gets */
  --n64-prose-size: 0.9rem;
  --n64-btn-size: 1.05rem;
  --n64-btn-pad: 11px 24px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--n64-bg);
  font-family: 'Courier New', monospace;
  color: #fff;
  overflow: hidden;
}

/* ---- the overlay and its panels ---------------------------------- */
/* One overlay per game holds every screen; each screen is a .panel and
   exactly one of them is visible. The shared menu navigation
   (SS.createMenuNav) drives all of them without knowing which is up —
   it only ever looks at the buttons currently on screen. */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--n64-gap);
  background: var(--n64-veil);
  text-align: center;
  padding: var(--n64-pad);
  z-index: 5;
  overflow-y: auto;
}
.overlay.hidden { display: none; }

.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--n64-gap);
  text-align: center;
}
.panel.hidden { display: none; }

h2 {
  font-size: var(--n64-title-size);
  color: var(--n64-title);
  text-shadow: var(--n64-title-shadow);
  letter-spacing: var(--n64-title-track);
}
p { font-size: var(--n64-prose-size); line-height: 1.6; max-width: var(--n64-prose); color: var(--n64-text); }
.muted { color: var(--n64-muted); font-size: 0.8rem; }

/* ---- buttons ------------------------------------------------------ */
button {
  padding: var(--n64-btn-pad);
  background: var(--n64-accent);
  color: var(--n64-ink);
  border: 3px solid var(--n64-border);
  font-family: inherit;
  font-size: var(--n64-btn-size);
  font-weight: bold;
  letter-spacing: 2px;
  cursor: pointer;
  border-radius: 4px;
}
button:hover { background: var(--n64-accent-hi); }

/* Where the gamepad cursor is. SS.createMenuNav puts this class on the
   button it has focused, and it has to be obvious from the sofa — a
   browser's own focus ring is a hairline at three metres. */
button.gp-focus {
  border-color: #ffe27a;
  box-shadow: 0 0 0 3px rgba(255, 226, 122, 0.6), 0 0 14px var(--n64-accent);
  outline: none;
}

button.ghost {
  background: transparent;
  color: var(--n64-muted);
  border: 2px solid var(--n64-ghost-border);
  font-size: 0.8rem;
  padding: 7px 16px;
}
button.ghost:hover { color: var(--n64-text); border-color: var(--n64-accent); background: transparent; }

/* ---- the seat row: 1 / 2 / 3 / 4 PLAYERS -------------------------- */
.playerrow { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.playerrow button { min-width: 118px; font-size: 0.9rem; padding: 10px 12px; }
.playerrow button small {
  display: block; font-size: 0.62rem; font-weight: normal;
  letter-spacing: 0; opacity: 0.75; margin-top: 3px;
}

/* ---- the character select ----------------------------------------- */
/* Four across, two down — the same shape the pad cursor wraps around in
   N64.Match.createSelect(), which takes `cols: 4`. Change one and the
   other is wrong: the cursor would wrap somewhere the eye does not. */
.chargrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 520px;
}
.charcell {
  background: var(--n64-cell);
  border: 2px solid var(--n64-cell-border);
  border-radius: 5px;
  padding: 7px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  min-width: 110px;
}
/* The portrait is rendered by the game's own renderer and read back into
   this canvas, so it upscales with the SAME nearest-neighbour rule the
   game does — a smoothed portrait beside a pixelated game looks broken. */
.charcell .swatch {
  width: 60px; height: 60px; border-radius: 4px;
  border: 2px solid rgba(0, 0, 0, 0.5);
  image-rendering: pixelated;
}
.charcell .cname { font-size: 0.7rem; letter-spacing: 1px; color: var(--n64-text); }
.charcell .tag { font-size: 0.68rem; height: 0.9rem; color: var(--n64-title); letter-spacing: 1px; }

/* ---- the results table --------------------------------------------- */
table.results { border-collapse: collapse; font-size: 0.85rem; }
table.results td { padding: 3px 12px; text-align: left; color: var(--n64-text); }
table.results tr.me td { color: var(--n64-title); font-weight: bold; }
