/* ==========================================================================
   Frimax Arcade — brand tokens & shared UI
   --------------------------------------------------------------------------
   Every colour, font and radius used across the arcade is declared here.
   Nothing below :root hardcodes a colour, so matching the official brand
   sheet is a single edit in this block.

   Palette source: the greens are read straight out of the official
   Frimax-Logo.svg supplied by the client — the fills declared in its own
   <style> block, not sampled from a screenshot. The amber and the pack
   colours are still taken by eye from the frimax.co.za line-up and are worth
   confirming against a brand sheet.
   ========================================================================== */

/* --- Fonts ---------------------------------------------------------------
   Self-hosted, Latin subset. `swap` means text is readable in a system face
   the instant the page paints and changes once the file lands, rather than
   being invisible while it downloads. See assets/fonts/README.md. */
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/poppins-800.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/poppins-700.woff2") format("woff2");
}

/* One variable file covers every weight of the body face. */
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("../fonts/nunito.woff2") format("woff2");
}

:root {
  /* --- Brand palette ---------------------------------------------------- */
  /* The leaf green carrying the wordmark — the most identifying Frimax
     colour, and the one used most in the logo artwork. */
  --frimax-green: #6cb545;
  --frimax-green-bright: #84c95c;
  /* The logo outline and the "NEW 70g" roundel. */
  --frimax-green-dark: #106b39;
  --frimax-green-deep: #0b5e34;
  /* The emerald in the logo's highlight strokes. Cooler and more saturated
     than the leaf green, so it carries glows and win states. */
  --frimax-emerald: #1dc267;
  /* The "70g" flash on the roundel. */
  --frimax-amber: #f5a623;
  --frimax-amber-dark: #d4870d;
  /* Tomato Sauce pack red, used sparingly as a secondary accent. */
  --frimax-tomato: #b51d42;
  --frimax-cream: #fffdf7;
  --frimax-ink: #0a2412;

  /* --- Surfaces --------------------------------------------------------- */
  /* Page darks, pulled towards the logo's hue — its green is a touch cooler
     and bluer than the yellow-green I had been working from. */
  --bg: #0c2a19;
  --bg-deep: #04150d;
  --surface: rgba(255, 253, 247, 0.06);
  --surface-raised: rgba(255, 253, 247, 0.11);
  --surface-solid: #103322;
  --border: rgba(132, 201, 92, 0.24);
  --border-strong: rgba(132, 201, 92, 0.55);

  /* --- Text ------------------------------------------------------------- */
  --text: var(--frimax-cream);
  --text-muted: rgba(255, 253, 247, 0.64);
  --text-faint: rgba(255, 253, 247, 0.4);
  --text-on-amber: var(--frimax-green-deep);

  /* --- Feedback --------------------------------------------------------- */
  --win: var(--frimax-emerald);
  --lose: #ff6b6b;

  /* --- Type ------------------------------------------------------------- */
  /* Only a fallback now: the wordmark everywhere is the real logo file. */
  --font-script: "Brush Script MT", cursive;
  --font-display: "Poppins", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;

  /* --- Shape ------------------------------------------------------------ */
  --radius-sm: 8px;
  --radius: 16px;
  --radius-lg: 26px;
  --radius-pill: 999px;

  /* --- Elevation -------------------------------------------------------- */
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
  --glow: 0 0 28px rgba(132, 201, 92, 0.4);

  /* --- Material --------------------------------------------------------- */
  /* What stops a dark UI reading as flat CSS is light behaviour: a lit top
     edge, a shaded bottom, and grain over the gradients. These four tokens
     are applied together on every raised surface in the arcade. */

  /* A one-pixel highlight along the top edge, as if lit from above. */
  --rim: inset 0 1px 0 rgba(255, 253, 247, 0.16);
  --rim-strong: inset 0 1px 0 rgba(255, 253, 247, 0.3);
  /* Shade pooling in the bottom of a panel, so it reads as a curved surface. */
  --inset-deep: inset 0 -30px 46px -30px rgba(0, 0, 0, 0.85);

  /* Fractal-noise grain, generated by the browser rather than shipped as an
     image. Broken-up gradients read as a material; clean ones read as CSS.
     The opacity is baked into the rect so this can be dropped into any
     background-image stack as-is — turbulence output is fully opaque, and at
     full strength it swamps the surface underneath as television static. */
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.055'/%3E%3C/svg%3E");

  /* Gloss falling across the top half of a button or chip. */
  --sheen: linear-gradient(
    180deg,
    rgba(255, 253, 247, 0.22) 0%,
    rgba(255, 253, 247, 0.06) 45%,
    rgba(255, 253, 247, 0) 52%
  );

  /* Ambient light thrown by a hovered card, in each of the two brand colours */
  --glow-green:
    0 0 0 1px rgba(132, 201, 92, 0.5), 0 22px 54px -16px rgba(108, 181, 69, 0.7);
  --glow-amber:
    0 0 0 1px rgba(245, 166, 35, 0.55),
    0 22px 54px -16px rgba(245, 166, 35, 0.6);

  /* --- Layout ----------------------------------------------------------- */
  --page-max: 1180px;
  --header-h: 68px;
}

/* ==========================================================================
   Reset & base
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(
      ellipse 80% 60% at 50% -10%,
      rgba(108, 181, 69, 0.42),
      transparent 70%
    ),
    radial-gradient(
      ellipse 60% 50% at 90% 100%,
      rgba(245, 166, 35, 0.14),
      transparent 70%
    ),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/**
 * Two fixed layers sit between the background gradients and the content.
 *
 * ::before is the material — foil stripes for the brand reference, plus film
 * grain so the large flat areas of green have something happening in them.
 * ::after is a vignette, which is what stops a big dark page looking like a
 * flat fill and pulls the eye to the middle.
 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    repeating-linear-gradient(
      -45deg,
      rgba(255, 253, 247, 0.045) 0 1px,
      transparent 1px 13px
    ),
    var(--noise);
  background-size:
    auto,
    160px 160px;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    ellipse 96% 86% at 50% 40%,
    transparent 62%,
    rgba(3, 12, 6, 0.42) 100%
  );
}

body > * {
  position: relative;
  z-index: 1;
}

img,
svg,
canvas {
  max-width: 100%;
  display: block;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.01em;
  margin: 0;
  text-transform: uppercase;
}

p {
  margin: 0 0 1em;
  line-height: 1.6;
}

a {
  color: var(--frimax-green-bright);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 3px solid var(--frimax-amber);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Layout helpers
   ========================================================================== */

.wrap {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 20px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.spacer {
  flex: 1;
}

.center {
  text-align: center;
}

/* ==========================================================================
   Site header — the green masthead, as on frimax.co.za
   ========================================================================== */

/**
 * A lit green bar rather than a flat fill: brighter across the top, grain and
 * a wide chevron weave over it, a gold hairline where it meets the page, and
 * a shadow cast down so the page reads as passing underneath.
 */
.site-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--frimax-green);
  background-image:
    linear-gradient(
      180deg,
      var(--frimax-green-bright) 0%,
      var(--frimax-green) 42%,
      #4e9526 100%
    );
  border-bottom: 3px solid var(--frimax-green-dark);
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 247, 0.35),
    inset 0 -1px 0 rgba(245, 166, 35, 0.5),
    0 10px 30px -8px rgba(0, 0, 0, 0.6);
}

/* The weave and grain, kept off the header's own children */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(
      115deg,
      rgba(13, 61, 27, 0.14) 0 2px,
      transparent 2px 16px
    ),
    var(--noise);
  background-size:
    auto,
    160px 160px;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
}

/* --------------------------------------------------------------- wordmark */

.logo {
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
  color: var(--frimax-cream);
  text-decoration: none;
}

.logo:hover {
  text-decoration: none;
}

/**
 * The Frimax wordmark: heavy script, cream fill, dark green outline and a
 * dropped shadow. This is a CSS stand-in for the real logo file — swap the
 * element for an <img> or inline SVG when the artwork is available.
 */
.logo-word {
  font-family: var(--font-script);
  font-size: 1.85rem;
  line-height: 1;
  color: #ffffff;
  /* Three layers, as on the real mark: white fill, a dark green outline, and
     a lighter green shadow dropped down and to the right. */
  -webkit-text-stroke: 2.5px var(--frimax-green-dark);
  paint-order: stroke fill;
  text-shadow:
    2px 3px 0 var(--frimax-green-bright),
    3px 4px 0 rgba(13, 61, 27, 0.4);
  letter-spacing: 0.01em;
  font-style: italic;
}

/**
 * The real logo file, swapped in for .logo-word by assets.js.
 *
 * The lockup baseline-aligns so the CSS wordmark sits on the same line as
 * "Arcade". An image has no text baseline, so it aligns on its bottom edge
 * and drops the sub-label — centring the row is what the image version wants.
 */
.logo-img {
  height: 42px;
  width: auto;
  display: block;
  /* The mark carries its own drop shadow; this lifts it off the green. */
  filter: drop-shadow(0 2px 3px rgba(6, 42, 24, 0.35));
}

.logo:has(.logo-img) {
  align-items: center;
}

/* Fallback for browsers without :has() — the sub-label reads fine either way,
   this just keeps it from hanging low. */
@supports not selector(:has(*)) {
  .logo-img {
    align-self: center;
  }
}

.logo-sub {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--frimax-green-deep);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

/**
 * A moulded plastic key rather than a coloured rectangle: a lit top edge, a
 * gloss over the top half, a solid green edge underneath that compresses when
 * pressed, and a highlight that sweeps across on hover.
 */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 26px;
  border: 0;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition:
    transform 0.12s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
  /* The amber-on-dark-green treatment from the pack's "70g" roundel. */
  background-color: var(--frimax-amber);
  background-image: linear-gradient(
    180deg,
    #ffc04d 0%,
    var(--frimax-amber) 46%,
    var(--frimax-amber-dark) 100%
  );
  color: var(--text-on-amber);
  box-shadow:
    var(--rim-strong),
    inset 0 -2px 0 rgba(122, 72, 0, 0.35),
    0 5px 0 var(--frimax-green-deep),
    var(--shadow);
  text-decoration: none;
}

/* Gloss across the top half */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--sheen);
  pointer-events: none;
}

/* The sweep — parked off the left edge, crossing on hover */
.btn::after {
  content: "";
  position: absolute;
  top: -60%;
  bottom: -60%;
  width: 45%;
  left: -70%;
  transform: skewX(-22deg);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 253, 247, 0.4),
    transparent
  );
  pointer-events: none;
  transition: left 0.55s ease;
}

.btn:hover::after {
  left: 130%;
}

.btn:hover {
  filter: brightness(1.06);
  text-decoration: none;
}

.btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow:
    inset 0 2px 5px rgba(122, 72, 0, 0.45),
    0 1px 0 var(--frimax-green-deep),
    var(--shadow);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.btn:disabled::after {
  display: none;
}

.btn-secondary {
  background-color: transparent;
  background-image: linear-gradient(
    180deg,
    rgba(255, 253, 247, 0.14),
    rgba(255, 253, 247, 0.04)
  );
  color: var(--text);
  border: 2px solid var(--border-strong);
  box-shadow:
    var(--rim),
    0 6px 18px -8px rgba(0, 0, 0, 0.7);
}

.btn-secondary:hover {
  border-color: var(--frimax-green-bright);
  box-shadow:
    var(--rim),
    0 0 22px -4px rgba(132, 201, 92, 0.5);
}

.btn-secondary:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45);
}

/* On the green masthead a translucent button disappears — give it contrast. */
.site-header .btn-secondary {
  background: rgba(13, 61, 27, 0.35);
  border-color: var(--frimax-green-deep);
  color: var(--frimax-cream);
}

.btn-lg {
  padding: 18px 44px;
  font-size: 1.12rem;
}

.btn-sm {
  padding: 9px 18px;
  font-size: 0.76rem;
}

/* Buttons never wrap, so on a narrow header the word is dropped and the icon
   carries the button. The accessible name is on the button's aria-label. */
@media (max-width: 460px) {
  .btn-label {
    display: none;
  }
}

/* ==========================================================================
   Panels & cards
   ========================================================================== */

.panel {
  position: relative;
  background-color: rgba(9, 33, 17, 0.72);
  background-image:
    linear-gradient(
      180deg,
      rgba(255, 253, 247, 0.09),
      rgba(255, 253, 247, 0.02) 30%,
      transparent 60%
    ),
    var(--noise);
  background-size:
    auto,
    160px 160px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  /* No backdrop-filter here. A blurred backdrop has to be recomputed whenever
     anything behind it changes, and on a game page there is a canvas
     animating right above this panel. The background below is already opaque
     enough that the blur bought nothing. */
  box-shadow:
    var(--rim),
    var(--inset-deep),
    var(--shadow);
}

/* A short gold rule across the top of every panel, the way a scoreboard or a
   betting slip is capped. Cheap, and it reads as deliberate trim. */
.panel::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 24px;
  right: 24px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--frimax-amber) 22%,
    var(--frimax-amber) 78%,
    transparent
  );
  opacity: 0.65;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: var(--radius-pill);
  background-color: var(--frimax-green-dark);
  background-image: linear-gradient(
    180deg,
    rgba(255, 253, 247, 0.18),
    transparent 60%
  );
  border: 1px solid var(--frimax-green);
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--frimax-amber);
  box-shadow:
    var(--rim),
    0 3px 10px -4px rgba(0, 0, 0, 0.8);
}

/* ==========================================================================
   Icons — see assets/js/icons.js
   ========================================================================== */

/**
 * The set is stroke-drawn, so appearance lives here rather than on the SVG's
 * own attributes: a CSS `fill` would beat a presentation attribute and turn
 * every outline into a solid blob. Solid parts opt in with .icon-dot.
 */
.icon {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  display: inline-block;
  vertical-align: -0.13em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.icon-dot {
  fill: currentColor;
  stroke: none;
}

/* Wrappers exist only to be replaced by the SVG, so they must not add a box */
[data-icon] {
  display: inline-flex;
  line-height: 0;
}

.badge .icon,
.btn .icon {
  width: 1.15em;
  height: 1.15em;
}

/* ==========================================================================
   Icon buttons — the hub header and the cabinet bar
   ========================================================================== */

/* Square icon buttons: 40px, which with the bar's gap gives each a hit area
   past the 44px a thumb needs. */
.icon-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(255, 253, 247, 0.16);
  background: rgba(255, 253, 247, 0.07);
  background-image: var(--sheen);
  color: var(--frimax-cream);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.08s ease,
    background-color 0.15s ease;
}

.icon-btn .icon {
  width: 20px;
  height: 20px;
}

.icon-btn:hover {
  background-color: rgba(255, 253, 247, 0.14);
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn[aria-pressed="true"] {
  color: var(--text-faint);
}

.icon-btn[hidden] {
  display: none;
}

a.icon-btn {
  text-decoration: none;
}

/* ==========================================================================
   HUD — shared score strip used by the arcade games
   ========================================================================== */

.hud {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
}

/* Each stat reads as a machined counter: recessed face, lit top edge, and the
   figure itself glowing slightly the way a lit display does. */
.hud-item {
  min-width: 92px;
  padding: 9px 16px;
  border-radius: var(--radius);
  background-color: rgba(4, 16, 8, 0.6);
  background-image: linear-gradient(
    180deg,
    rgba(255, 253, 247, 0.1),
    transparent 55%
  );
  border: 1px solid var(--border);
  text-align: center;
  box-shadow:
    var(--rim),
    inset 0 6px 14px -8px rgba(0, 0, 0, 0.9);
}

.hud-label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 3px;
}

.hud-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--frimax-amber);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px rgba(245, 166, 35, 0.55);
}

/* ==========================================================================
   Game shell — canvas stage with overlay
   ========================================================================== */

.game-page {
  padding: 28px 0 60px;
}

/* Brushed-gold lettering. The gradient is clipped to the glyphs, with a flat
   cream fill underneath for anything that cannot clip a background to text. */
.game-title {
  font-size: clamp(2rem, 6vw, 3.2rem);
  text-align: center;
  margin-bottom: 6px;
  color: var(--frimax-cream);
  background: linear-gradient(
    180deg,
    #fffdf7 0%,
    #ffe6a8 38%,
    var(--frimax-amber) 62%,
    #b9740a 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 0 rgba(13, 61, 27, 0.9))
    drop-shadow(0 8px 20px rgba(0, 0, 0, 0.65));
}

.game-tagline {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 22px;
}

/* The cabinet: a gold-lipped bezel around the screen, with the screen itself
   sunk behind it. */
.stage {
  position: relative;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid var(--border-strong);
  background: var(--bg-deep);
  box-shadow:
    var(--rim),
    0 0 0 1px rgba(245, 166, 35, 0.28),
    0 0 60px -18px rgba(132, 201, 92, 0.55),
    var(--shadow-lg);
  touch-action: none;
  /* Dragging tiles must never start a text selection over the board. */
  user-select: none;
  -webkit-user-select: none;
}

/* Screen glass: a soft corner vignette and a diagonal reflection. Sits above
   the canvas but below the HUD and overlay, and never takes a click. */
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  /* Above the canvas, below every piece of cabinet trim: the Spin & Win
     pointer sits at 3, the HUDs at 4 and the overlays at 5. */
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(
      128deg,
      rgba(255, 253, 247, 0.07) 0%,
      transparent 32%,
      transparent 100%
    ),
    radial-gradient(
      ellipse 92% 88% at 50% 50%,
      transparent 55%,
      rgba(0, 0, 0, 0.5) 100%
    );
}

.stage canvas {
  width: 100%;
  height: auto;
  display: block;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(
      ellipse 70% 60% at 50% 42%,
      rgba(26, 107, 49, 0.5),
      transparent 70%
    ),
    rgba(5, 19, 8, 0.93);
  backdrop-filter: blur(7px);
  z-index: 5;
  transition: opacity 0.25s ease;
}

.overlay[hidden] {
  display: none;
}

.overlay-inner {
  max-width: 460px;
  animation: overlay-rise 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.4) both;
}

@keyframes overlay-rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
}

.overlay h2 {
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  margin-bottom: 12px;
  color: var(--frimax-amber);
  text-shadow:
    0 2px 0 rgba(13, 61, 27, 0.9),
    0 0 32px rgba(245, 166, 35, 0.45);
}

/* ==========================================================================
   Results panel — name, leaderboard, share. See assets/js/results.js
   ========================================================================== */

.results {
  margin-top: 20px;
  text-align: left;
}

/* --------------------------------------------------------- name capture --- */

.name-form[hidden] {
  display: none;
}

.name-form {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(4, 16, 8, 0.5);
  box-shadow: var(--rim);
}

.name-form label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--frimax-amber);
  margin-bottom: 8px;
}

.name-row {
  display: flex;
  gap: 8px;
}

.name-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
}

.name-input::placeholder {
  color: var(--text-faint);
}

.name-skip {
  display: block;
  margin: 9px auto 0;
  padding: 4px 8px;
  border: 0;
  background: none;
  color: var(--text-faint);
  font-family: var(--font-body);
  font-size: 0.78rem;
  text-decoration: underline;
  cursor: pointer;
}

.name-skip:hover {
  color: var(--text-muted);
}

/* ------------------------------------------------------------- the board --- */

.board-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 3px;
}

.board-row {
  display: grid;
  grid-template-columns: 2.1em 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 253, 247, 0.045);
  font-size: 0.9rem;
}

/* The player's own row, so they can find themselves without reading */
.board-row.is-you {
  background: rgba(245, 166, 35, 0.16);
  box-shadow: inset 0 0 0 1px rgba(245, 166, 35, 0.45);
}

.board-row.is-first .board-rank {
  color: var(--frimax-amber);
}

.board-rank {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.board-name {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-score {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--frimax-amber);
  font-variant-numeric: tabular-nums;
}

.board-note,
.board-empty {
  margin: 9px 0 0;
  font-size: 0.74rem;
  color: var(--text-faint);
  text-align: center;
}

.results-actions {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

/* ==========================================================================
   Touch d-pad — shown on coarse pointers only
   ========================================================================== */

.dpad {
  display: none;
  grid-template-columns: repeat(3, 62px);
  grid-template-rows: repeat(3, 62px);
  gap: 8px;
  justify-content: center;
  margin: 20px auto 0;
}

.dpad button {
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--frimax-amber);
  border-radius: var(--radius);
  font-size: 1.5rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.dpad button:active {
  background: var(--frimax-green);
  color: var(--frimax-cream);
}

.dpad .up {
  grid-area: 1 / 2;
}
.dpad .left {
  grid-area: 2 / 1;
}
.dpad .right {
  grid-area: 2 / 3;
}
.dpad .down {
  grid-area: 3 / 2;
}

@media (pointer: coarse) {
  .dpad {
    display: grid;
  }
}

/* ==========================================================================
   Forms
   ========================================================================== */

.field {
  text-align: left;
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 5px;
}

.field input {
  width: 100%;
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
}

.field input::placeholder {
  color: var(--text-faint);
}

.field-error {
  color: var(--lose);
  font-size: 0.8rem;
  margin-top: 5px;
  min-height: 1em;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  position: relative;
  border-top: 1px solid var(--border);
  padding: 38px 0 48px;
  margin-top: 70px;
  color: var(--text-faint);
  font-size: 0.85rem;
  text-align: center;
  background: linear-gradient(180deg, transparent, rgba(3, 12, 6, 0.6));
}

/* Gold trim on the seam, matching the rule across the top of every panel */
.site-footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, 70%);
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--frimax-amber),
    transparent
  );
  opacity: 0.7;
}

.site-footer p {
  margin: 0 0 6px;
}

/* The wordmark repeated small, so the page closes on the brand */
.footer-mark {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 16px;
  opacity: 0.85;
}

.footer-mark {
  align-items: center;
}

.footer-mark .logo-word {
  font-size: 1.5rem;
}

/* assets.js swaps every .logo-word, the footer's included — the sizes are set
   per placement rather than on .logo-img, which carries the masthead size. */
.footer-mark .logo-img {
  height: 30px;
}

.footer-mark .logo-sub {
  color: var(--frimax-green-bright);
  font-size: 0.72rem;
}

/* ==========================================================================
   Utility
   ========================================================================== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ==========================================================================
   Player layer — XP strip, toasts, profile. See assets/js/player.js
   ========================================================================== */

/* ------------------------------------------------------------- XP strip --- */

.xp-strip {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(4, 16, 8, 0.55);
  border: 1px solid var(--border);
  box-shadow: var(--rim);
}

.xp-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.xp-level {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--frimax-cream);
}

.xp-gain {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  color: var(--frimax-amber);
  text-shadow: 0 0 14px rgba(245, 166, 35, 0.5);
}

.xp-bar {
  height: 9px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.45);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7);
}

.xp-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--frimax-green), var(--frimax-amber));
  box-shadow: 0 0 12px rgba(245, 166, 35, 0.55);
  /* Slow enough to read as a gain rather than a jump */
  transition: width 0.9s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.xp-foot {
  margin-top: 7px;
  font-size: 0.72rem;
  color: var(--text-faint);
}

/* --------------------------------------------------------------- toasts --- */

.toast-tray {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 9px;
  pointer-events: none;
  width: min(380px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius);
  background-color: rgba(7, 28, 14, 0.96);
  background-image: linear-gradient(
    180deg,
    rgba(255, 253, 247, 0.1),
    transparent 60%
  );
  border: 1px solid var(--border-strong);
  box-shadow:
    var(--rim),
    0 14px 34px -10px rgba(0, 0, 0, 0.9);
  /* Parked below the tray and slid up, so it reads as arriving */
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transition:
    opacity 0.3s ease,
    transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

.toast.is-in {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 10px;
  color: var(--frimax-amber);
  background: rgba(245, 166, 35, 0.14);
  border: 1px solid rgba(245, 166, 35, 0.4);
}

.toast-icon .icon {
  width: 20px;
  height: 20px;
}

.toast-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.toast-body b {
  font-family: var(--font-display);
  font-size: 0.92rem;
  color: var(--frimax-cream);
}

.toast-body span {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* A level-up is the loudest thing that happens, so it gets the gold */
.toast--level {
  border-color: var(--frimax-amber);
  box-shadow:
    var(--rim),
    0 0 0 1px rgba(245, 166, 35, 0.3),
    0 18px 40px -10px rgba(245, 166, 35, 0.4);
}

.toast--level .toast-icon {
  color: var(--frimax-green-deep);
  background: linear-gradient(180deg, #ffd257, var(--frimax-amber-dark));
  border-color: var(--frimax-amber);
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: opacity 0.2s ease;
    transform: none;
  }
  .toast.is-in {
    transform: none;
  }
}
