/*
 * Hollywood Link — 1990s VGA adventure / LucasArts-adjacent UI
 * Warm leather & wood chrome, parchment panels, chunky pixel type, limited palette.
 * Color tokens tuned for WCAG 2.1 AA contrast (body text, links on dark, controls).
 * Palette variables live in themes.css (body.theme-*).
 */

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

/* 2.4.1 Skip link — visible on keyboard focus only */
.skip-link {
  position: absolute;
  left: 0.5rem;
  top: 0.5rem;
  z-index: 10000;
  padding: 0.65rem 1rem;
  background: var(--parchment);
  color: var(--ink);
  border: 3px solid var(--focus-ring);
  font-family: "VT323", ui-monospace, monospace;
  font-size: 1.15rem;
  text-decoration: none;
  box-shadow: 4px 4px 0 var(--shadow-pixel);
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  overflow: hidden;
  white-space: nowrap;
}

.skip-link:focus {
  clip-path: none;
  width: auto;
  height: auto;
  overflow: visible;
  white-space: normal;
}

.skip-link:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "VT323", ui-monospace, monospace;
  font-size: 1.4rem;
  line-height: 1.5;
  color: var(--body-text, var(--parchment-mid));
  background: var(--bg-deep);
  background-image:
    linear-gradient(180deg, rgba(196, 160, 53, 0.04) 0%, transparent 42%),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 3px,
      rgba(0, 0, 0, 0.06) 3px,
      rgba(0, 0, 0, 0.06) 4px
    ),
    radial-gradient(ellipse 100% 70% at 50% 0%, rgba(90, 60, 35, 0.35), transparent 55%),
    linear-gradient(165deg, var(--bg) 0%, var(--bg-deep) 45%, #0a0705 100%);
}

@media (prefers-reduced-motion: reduce) {
  body {
    background-image:
      radial-gradient(ellipse 100% 70% at 50% 0%, rgba(90, 60, 35, 0.25), transparent 55%),
      linear-gradient(165deg, var(--bg) 0%, var(--bg-deep) 100%);
  }

  .avatar-tile,
  button,
  .button,
  header.site nav button {
    transition: none !important;
  }

  .avatar-tile:hover,
  button:hover,
  .button:hover,
  header.site nav button:hover,
  button:active,
  .button:active,
  header.site nav button:active {
    transform: none;
  }
}

/* Subtle vignette — warm cellar, not CRT scanlines */
body::after {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.5) 100%);
  opacity: 0.4;
}

/* 1.4.1 — links distinguishable by underline on default (not color alone) */
a {
  color: var(--accent-link);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--link-hover);
  text-decoration-thickness: 2px;
}

a:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 1px;
}

/* Top bar: wood + brass rail (verb-bar adjacent) */
header.site {
  position: relative;
  z-index: 2;
  padding: 0.65rem 1rem 0.75rem;
  border-bottom: 4px solid var(--border-brass);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, transparent 40%),
    repeating-linear-gradient(
      90deg,
      var(--wood-mid) 0 2px,
      var(--wood-dark) 2px 4px
    ),
    linear-gradient(180deg, var(--wood-light) 0%, var(--wood-dark) 100%);
  box-shadow:
    0 5px 0 var(--shadow-pixel),
    inset 0 1px 0 rgba(232, 208, 120, 0.12);
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  justify-content: space-between;
}

.site-header-end {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
}

.language-switcher {
  position: relative;
  font-family: "Press Start 2P", monospace;
  font-size: 0.55rem;
  line-height: 1.6;
  letter-spacing: 0.02em;
}

.language-switcher > summary {
  list-style: none;
  cursor: pointer;
  min-height: 2.75rem;
  min-width: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.45rem;
  border: 2px solid var(--border-wood);
  background: linear-gradient(180deg, var(--parchment-mid) 0%, var(--parchment-shadow) 45%, #9a8568 100%);
  color: var(--ink);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.35),
    inset -1px -1px 0 rgba(0, 0, 0, 0.25),
    3px 3px 0 var(--shadow-pixel);
}

.language-switcher > summary::-webkit-details-marker {
  display: none;
}

.language-switcher > summary:hover {
  border-color: var(--border-brass);
}

.language-switcher-icon {
  font-size: 1.1rem;
  line-height: 1;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.35));
}

.language-switcher-list {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  min-width: 10rem;
  border: 2px solid var(--border-wood);
  background: linear-gradient(180deg, var(--parchment) 0%, var(--parchment-mid) 100%);
  box-shadow:
    3px 3px 0 var(--shadow-pixel),
    0 6px 18px rgba(0, 0, 0, 0.35);
  z-index: 50;
}

.language-switcher-list a {
  display: block;
  padding: 0.45rem 0.65rem;
  color: var(--ink);
  text-decoration: none;
  font-family: "VT323", system-ui, sans-serif;
  font-size: 1.15rem;
  letter-spacing: 0.03em;
}

.language-switcher-list a:hover,
.language-switcher-list a:focus-visible {
  background: rgba(0, 0, 0, 0.08);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.language-switcher-current {
  font-weight: bold;
}

.splash-lang {
  position: fixed;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 20;
}

header.site::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--brass-dim) 0%,
    var(--brass-bright) 22%,
    var(--brass) 50%,
    var(--brass-bright) 78%,
    var(--brass-dim) 100%
  );
  opacity: 0.9;
}

header.site nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
  align-items: center;
  font-family: "Press Start 2P", monospace;
  font-size: 0.55rem;
  line-height: 1.6;
  letter-spacing: 0.02em;
}

header.site nav form {
  display: inline;
  margin: 0;
}

/* Verb-style nav chips — min ~44px target height where possible (2.5.8) */
header.site nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.5rem 0.65rem;
  border: 2px solid var(--border-wood);
  background: linear-gradient(180deg, var(--parchment-mid) 0%, var(--parchment-shadow) 45%, #9a8568 100%);
  color: var(--ink);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.35),
    inset -1px -1px 0 rgba(0, 0, 0, 0.25),
    3px 3px 0 var(--shadow-pixel);
  text-decoration: none;
}

header.site nav a:hover {
  border-color: var(--border-brass);
  color: var(--ink);
  background: linear-gradient(180deg, var(--parchment) 0%, var(--parchment-mid) 50%, var(--parchment-shadow) 100%);
  text-decoration: underline;
  text-underline-offset: 3px;
}

header.site nav a:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  z-index: 1;
}

/* Active page: brass border + inset shadow in hollywood theme. */
header.site nav a.active {
  border-color: var(--border-brass);
  background: linear-gradient(180deg, var(--parchment-shadow) 0%, var(--parchment-mid) 45%, #9a8568 100%);
  box-shadow:
    inset 2px 2px 0 rgba(0, 0, 0, 0.2),
    inset -1px -1px 0 rgba(255, 255, 255, 0.2),
    1px 1px 0 var(--shadow-pixel);
}

header.site nav button {
  font-family: "Press Start 2P", monospace;
  font-size: 0.55rem;
  line-height: 1.6;
  letter-spacing: 0.02em;
  min-height: 2.75rem;
  padding: 0.5rem 0.65rem;
  margin: 0;
  border: 2px solid var(--border-wood);
  background: linear-gradient(180deg, #7a6550 0%, #4a3a2e 50%, #2e241c 100%);
  color: #fdf6ea;
  text-shadow: 1px 1px 0 var(--shadow-pixel);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.12),
    inset -1px -1px 0 rgba(0, 0, 0, 0.35),
    3px 3px 0 var(--shadow-pixel);
}

header.site nav button:hover {
  color: var(--parchment);
  background: linear-gradient(180deg, #8b7358 0%, #5a4838 55%, #3a2e24 100%);
  transform: translate(1px, 1px);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.15),
    inset -1px -1px 0 rgba(0, 0, 0, 0.35),
    2px 2px 0 var(--shadow-pixel);
}

header.site nav button:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--shadow-pixel);
}

header.site nav button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

/* --- Mobile hamburger toggle --- */
.nav-toggle {
  display: none; /* hidden on desktop */
}

@media (max-width: 40rem) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    min-width: 2.75rem;
    padding: 0.35rem 0.45rem;
    border: 2px solid var(--border-wood);
    background: linear-gradient(180deg, var(--parchment-mid) 0%, var(--parchment-shadow) 45%, #9a8568 100%);
    color: var(--ink);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-shadow:
      inset 1px 1px 0 rgba(255, 255, 255, 0.35),
      inset -1px -1px 0 rgba(0, 0, 0, 0.25),
      3px 3px 0 var(--shadow-pixel);
  }

  .nav-toggle:hover {
    border-color: var(--border-brass);
  }

  .nav-toggle:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
  }

  /* Pressed + open state: deliberate "inset" look, never a browser-default dark flash. */
  .nav-toggle:active,
  .nav-toggle[aria-expanded="true"] {
    background: linear-gradient(180deg, var(--parchment-shadow) 0%, var(--parchment-mid) 100%);
    border-color: var(--border-brass);
    transform: translate(1px, 1px);
    box-shadow:
      inset 2px 2px 0 rgba(0, 0, 0, 0.2),
      inset -1px -1px 0 rgba(255, 255, 255, 0.25),
      1px 1px 0 var(--shadow-pixel);
  }

  .nav-toggle-bars {
    display: block;
    width: 1.1rem;
    height: 2px;
    background: var(--ink);
    position: relative;
    transition: background 0.2s;
  }

  .nav-toggle-bars::before,
  .nav-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--ink);
    transition: transform 0.2s;
  }

  .nav-toggle-bars::before { top: -6px; }
  .nav-toggle-bars::after  { top:  6px; }

  /* Animate to X when open */
  .nav-toggle[aria-expanded="true"] .nav-toggle-bars {
    background: transparent;
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bars::before {
    top: 0;
    transform: rotate(45deg);
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bars::after {
    top: 0;
    transform: rotate(-45deg);
  }

  /* Mobile drawer: absolutely positioned below the header so opening
     the menu never changes the header height or disrupts the brand alignment.
     Spans the full header width regardless of where nav#site-nav sits in the DOM. */
  header.site nav#site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 30;
    flex-direction: column;
    gap: 0.55rem;
    margin: 0;
    padding: 1rem 1rem 1.25rem;
    border-top: 4px solid var(--border-brass);
    background:
      linear-gradient(180deg, rgba(0, 0, 0, 0.08) 0%, transparent 30%),
      linear-gradient(180deg, var(--wood-light) 0%, var(--wood-dark) 100%);
    box-shadow:
      0 6px 0 var(--shadow-pixel),
      0 14px 28px rgba(0, 0, 0, 0.45);
  }

  header.site nav#site-nav.nav-open {
    display: flex;
    animation: nav-drawer-in 0.18s ease-out;
  }

  header.site nav#site-nav a,
  header.site nav#site-nav button {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  header.site nav#site-nav form {
    width: 100%;
    display: flex;
  }

  @keyframes nav-drawer-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

main {
  position: relative;
  z-index: 1;
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

#main-content:focus {
  outline: none;
}

#main-content:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 4px;
}

h1,
h2 {
  font-family: "Press Start 2P", monospace;
  font-weight: 400;
  letter-spacing: 0.03em;
  line-height: 1.45;
  text-transform: uppercase;
}

h1 {
  font-size: 0.72rem;
  margin: 0 0 0.75rem;
  color: var(--ink);
  text-shadow: 1px 1px 0 var(--parchment-shadow);
}

h2 {
  font-size: 0.58rem;
  margin: 0 0 0.65rem;
  color: var(--wood-light);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.2);
}

.card h1,
.card h2 {
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.25);
}

.card h2 {
  color: var(--ink-dim);
}

.brand {
  font-family: "Press Start 2P", monospace;
  font-weight: 400;
  font-size: 0.62rem;
  line-height: 1.5;
  letter-spacing: 0.06em;
  color: var(--brass-bright);
  text-decoration: none;
  text-shadow:
    2px 2px 0 var(--shadow-pixel),
    0 0 1px rgba(0, 0, 0, 0.8);
}

.brand:hover {
  color: var(--parchment);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.brand:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 4px;
}

/* Parchment “dialogue box” */
.card {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, transparent 42%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      rgba(74, 53, 40, 0.04) 3px,
      rgba(74, 53, 40, 0.04) 4px
    ),
    linear-gradient(180deg, var(--parchment) 0%, var(--parchment-mid) 100%);
  color: var(--ink);
  border: 4px solid var(--border-wood);
  border-radius: 0;
  padding: 1.35rem 1.4rem;
  margin-bottom: 1.1rem;
  box-shadow:
    0 0 0 2px var(--border-brass),
    6px 6px 0 var(--shadow-pixel),
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    inset 0 -3px 0 rgba(0, 0, 0, 0.06);
  position: relative;
}

.card::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(74, 53, 40, 0.2);
  pointer-events: none;
}

.card::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--brass-bright), var(--brass-dim));
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.4),
    1px 1px 0 var(--shadow-pixel);
  opacity: 0.85;
  pointer-events: none;
}

.card p,
.card label {
  color: var(--ink);
}

.flash-error {
  color: var(--danger-fg);
  font-family: "Press Start 2P", monospace;
  font-size: 0.55rem;
  line-height: 1.55;
  text-shadow: 2px 2px 0 var(--shadow-pixel);
}

.card .flash-error {
  color: var(--danger);
}

.flash-info {
  color: var(--success-fg);
  font-family: "Press Start 2P", monospace;
  font-size: 0.55rem;
  line-height: 1.55;
  text-shadow: 2px 2px 0 var(--shadow-pixel);
}

.card .flash-info {
  color: var(--success);
}

/* ---- Player name field (home.html step 1) ----
   Deliberate vertical stack: label → input → real-time feedback. All three
   children share the same max-width so the feedback box sits directly under
   the input with matching edges. Feedback carries a leading glyph via
   ::before so state is readable without relying on color alone. */
.player-name-field {
  display: block;
  max-width: 28rem;
  margin: 0.75rem 0 0.5rem;
}

.player-name-field-label {
  display: block;
  font-family: "Press Start 2P", monospace;
  font-size: 0.5rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.4);
  /* Clearance for the input focus ring (3px outline + 2px offset = 5px reach). */
  margin: 0 0 0.75rem;
}

/* Both input and feedback anchor to the field container's max-width via
   width:100% + box-sizing:border-box (inherited), so their outer edges
   always match regardless of per-theme padding differences. */
.player-name-field input[type="text"] {
  display: block;
  width: 100%;
  max-width: 100%;
  /* Space below for focus ring (5px reach) + visual gap to the feedback. */
  margin: 0 0 0.75rem;
}

.player-name-feedback {
  font-family: "Press Start 2P", monospace;
  font-size: 0.55rem;
  line-height: 1.55;
  /* Match the input's outer width exactly: same box model, same 100% of the
     field container, same border-box sizing. */
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0.5rem 0.65rem 0.45rem;
  border: 3px solid transparent;
  text-shadow: 1px 1px 0 var(--shadow-pixel);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 140ms ease-out, transform 140ms ease-out;
}
.player-name-feedback::before {
  content: "";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  font-family: "Press Start 2P", monospace;
  font-size: 0.55rem;
  border: 2px solid currentColor;
  background: rgba(255, 255, 255, 0.5);
  text-shadow: none;
}
.player-name-feedback[data-state="idle"] {
  display: none;
}
.player-name-feedback[data-state="error"] {
  color: var(--danger);
  border-color: var(--danger);
  background: var(--danger-fg);
  animation: player-name-feedback-in 140ms ease-out;
}
.player-name-feedback[data-state="error"]::before {
  content: "!";
}
.player-name-feedback[data-state="checking"] {
  color: var(--ink-dim);
  border-color: var(--wood-dark);
  background: rgba(255, 255, 255, 0.45);
  font-style: italic;
  animation: player-name-feedback-in 140ms ease-out;
}
.player-name-feedback[data-state="checking"]::before {
  content: "\2026"; /* … */
  font-style: normal;
}
.player-name-feedback[data-state="ok"] {
  color: var(--success);
  border-color: var(--success);
  background: var(--success-fg);
  animation: player-name-feedback-in 140ms ease-out;
}
.player-name-feedback[data-state="ok"]::before {
  content: "\2713"; /* ✓ */
  font-family: "VT323", monospace;
  font-size: 1rem;
  line-height: 1;
}

@keyframes player-name-feedback-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .player-name-feedback {
    animation: none !important;
    transition: none;
  }
}

.player-name-enter-hint {
  margin-top: 0.1rem;
}

/* =========================================================================
   LEADERBOARDS — Hollywood retro styling
   Index page: 4 marquee plaques in a grid, each with mode/scope tickets and
   a top-3 mini-podium. Detail page: chips, board switcher, full podium,
   remaining-positions table.
   ========================================================================= */

.leaderboard-index-card .leaderboard-index-intro {
  max-width: 38rem;
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 1rem;
}

.leaderboard-grid {
  list-style: none;
  padding: 0;
  margin: 0.85rem 0 0.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.1rem;
}

.leaderboard-tile-wrap {
  display: contents;
}

.leaderboard-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.05rem 1rem 0.95rem;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.16) 0%, transparent 45%),
    linear-gradient(180deg, var(--parchment) 0%, var(--parchment-mid) 100%);
  color: var(--ink);
  border: 3px solid var(--border-wood);
  text-decoration: none;
  box-shadow:
    0 0 0 2px var(--border-brass),
    4px 4px 0 var(--shadow-pixel),
    inset 0 0 0 1px rgba(255, 255, 255, 0.22),
    inset 0 -3px 0 rgba(0, 0, 0, 0.06);
  transition: transform 120ms ease-out, box-shadow 120ms ease-out;
}

.leaderboard-tile:hover,
.leaderboard-tile:focus-visible {
  transform: translate(-1px, -2px);
  box-shadow:
    0 0 0 2px var(--brass-bright),
    6px 7px 0 var(--shadow-pixel),
    inset 0 0 0 1px rgba(255, 255, 255, 0.3),
    inset 0 -3px 0 rgba(0, 0, 0, 0.06);
  outline: none;
}

.leaderboard-tile:active {
  transform: translate(0, 0);
  box-shadow:
    0 0 0 2px var(--border-brass),
    2px 2px 0 var(--shadow-pixel),
    inset 0 0 0 1px rgba(255, 255, 255, 0.22),
    inset 0 -3px 0 rgba(0, 0, 0, 0.06);
}

/* Brass top-bar like a vintage marquee header */
.leaderboard-tile-bar {
  display: block;
  height: 8px;
  margin: -1.05rem -1rem 0.4rem;
  background:
    repeating-linear-gradient(
      90deg,
      var(--brass-dim) 0 6px,
      var(--brass) 6px 12px,
      var(--brass-bright) 12px 14px,
      var(--brass) 14px 20px
    );
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.35);
}

.leaderboard-tile-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.leaderboard-chip {
  display: inline-flex;
  align-items: center;
  font-family: "Press Start 2P", monospace;
  font-size: 0.42rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.32rem 0.5rem 0.28rem;
  border: 2px solid var(--wood-dark);
  background: var(--parchment-shadow);
  color: var(--ink);
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.4);
  box-shadow: 1px 1px 0 var(--shadow-pixel);
}
.leaderboard-chip--mode-easy {
  background: linear-gradient(180deg, #cfe9c3 0%, #9ec98b 100%);
  border-color: #2c5520;
  color: #1a3a14;
}
.leaderboard-chip--mode-hard {
  background: linear-gradient(180deg, #e9b69a 0%, #c4724a 100%);
  border-color: #5e2208;
  color: #3a1606;
}
.leaderboard-chip--scope-global {
  background: linear-gradient(180deg, #f0d878 0%, #b8922a 100%);
  border-color: #5a4612;
  color: #2a200a;
}
.leaderboard-chip--scope-friends {
  background: linear-gradient(180deg, #c9b8e0 0%, #8b6fb0 100%);
  border-color: #2e1a4a;
  color: #1a0f2a;
}

.leaderboard-tile-title {
  font-family: "Press Start 2P", monospace;
  font-size: 0.62rem;
  line-height: 1.55;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin: 0.1rem 0 0.45rem;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.35);
}

.leaderboard-preview {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
}

.leaderboard-preview-row {
  display: grid;
  grid-template-columns: 1.7rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.4rem 0.55rem;
  background: rgba(255, 255, 255, 0.45);
  border-left: 4px solid var(--copper);
  box-shadow: inset 0 -1px 0 rgba(74, 53, 40, 0.18);
}
.leaderboard-preview-row--rank-1 {
  border-left-color: var(--brass-bright);
  background:
    linear-gradient(90deg, rgba(240, 216, 120, 0.45) 0%, rgba(255, 255, 255, 0.55) 60%);
}
.leaderboard-preview-row--rank-2 {
  border-left-color: var(--parchment-shadow);
  background:
    linear-gradient(90deg, rgba(196, 180, 154, 0.45) 0%, rgba(255, 255, 255, 0.55) 60%);
}
.leaderboard-preview-row--rank-3 {
  border-left-color: var(--copper);
  background:
    linear-gradient(90deg, rgba(139, 92, 56, 0.32) 0%, rgba(255, 255, 255, 0.55) 60%);
}

.leaderboard-preview-rank {
  font-family: "Press Start 2P", monospace;
  font-size: 0.6rem;
  color: var(--ink-dim);
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.4);
}

.leaderboard-preview-name {
  font-family: "VT323", monospace;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-preview-points {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  font-family: "VT323", monospace;
  color: var(--ink);
}
.leaderboard-preview-points-num {
  font-size: 1.35rem;
  line-height: 1;
  color: var(--brass-dim);
  font-variant-numeric: tabular-nums;
}
.leaderboard-preview-points-suffix {
  font-size: 0.7rem;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: "Press Start 2P", monospace;
}

.leaderboard-tile-empty {
  font-family: "VT323", monospace;
  font-size: 1.1rem;
  color: var(--ink-dim);
  margin: 0.2rem 0;
  padding: 0.7rem 0.55rem;
  border: 2px dashed rgba(74, 53, 40, 0.35);
  background: rgba(255, 255, 255, 0.25);
}

.leaderboard-tile-cta {
  font-family: "Press Start 2P", monospace;
  font-size: 0.5rem;
  color: var(--brass-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 0.35rem;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.45);
}
.leaderboard-tile:hover .leaderboard-tile-cta,
.leaderboard-tile:focus-visible .leaderboard-tile-cta {
  color: #5a3a08;
}

.leaderboard-friends-empty {
  font-family: "VT323", monospace;
  font-size: 1.15rem;
  line-height: 1.4;
  color: var(--ink-dim);
  margin: 1.1rem 0 0.25rem;
  padding: 0.95rem 1.1rem;
  border: 2px dashed rgba(74, 53, 40, 0.32);
  background: rgba(255, 255, 255, 0.3);
  max-width: 42rem;
}

/* --- Detail page --- */

.leaderboard-detail-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.65rem 0.85rem;
  margin-bottom: 0.6rem;
}
.leaderboard-detail-header h1 {
  margin: 0;
}

.leaderboard-detail-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
}

.leaderboard-board-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.3rem 0 1.1rem;
  padding: 0.55rem 0.6rem;
  background: rgba(74, 53, 40, 0.07);
  border: 2px solid var(--border-wood);
}
.leaderboard-board-switcher a {
  font-family: "Press Start 2P", monospace;
  font-size: 0.5rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.55rem 0.7rem 0.5rem;
  color: var(--ink);
  background: linear-gradient(180deg, var(--parchment) 0%, var(--parchment-mid) 100%);
  border: 2px solid var(--wood-dark);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    2px 2px 0 var(--shadow-pixel);
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 80ms ease-out;
}
.leaderboard-board-switcher a:hover {
  transform: translate(-1px, -1px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    3px 3px 0 var(--shadow-pixel);
}
.leaderboard-board-switcher a.is-active {
  background: linear-gradient(180deg, var(--brass) 0%, var(--brass-dim) 100%);
  color: var(--parchment);
  border-color: #3d2e08;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.4),
    inset 0 2px 0 rgba(0, 0, 0, 0.18),
    1px 1px 0 var(--shadow-pixel);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
  transform: translate(0, 1px);
}

.leaderboard-empty-state {
  text-align: center;
  padding: 2rem 1rem;
  font-family: "VT323", monospace;
  font-size: 1.3rem;
  color: var(--ink-dim);
  border: 3px dashed rgba(74, 53, 40, 0.4);
  background: rgba(255, 255, 255, 0.3);
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}
.leaderboard-empty-state-icon {
  font-size: 2rem;
  color: var(--brass-dim);
  text-shadow: 2px 2px 0 var(--shadow-pixel);
}

.leaderboard-podium {
  list-style: none;
  padding: 0;
  margin: 0.9rem 0 1.1rem;
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  gap: 0.65rem;
  align-items: end;
}
@media (max-width: 32rem) {
  .leaderboard-podium {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}
.leaderboard-podium[data-count="1"] {
  grid-template-columns: minmax(0, 22rem);
  justify-content: center;
}
.leaderboard-podium[data-count="2"] {
  grid-template-columns: 1fr 1fr;
}

.leaderboard-podium-place {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.4rem;
  padding: 1.1rem 0.85rem 0.95rem;
  background: linear-gradient(180deg, var(--parchment) 0%, var(--parchment-mid) 100%);
  border: 3px solid var(--wood-dark);
  box-shadow:
    0 0 0 2px var(--border-brass),
    3px 3px 0 var(--shadow-pixel),
    inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}
.leaderboard-podium-place::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px dashed rgba(74, 53, 40, 0.22);
  pointer-events: none;
}
.leaderboard-podium-place--rank-1 {
  order: 2;
  padding-top: 1.45rem;
  padding-bottom: 1.25rem;
  background:
    linear-gradient(180deg, #fff5d2 0%, #f0d878 60%, #d4b65a 100%);
  border-color: #5a4612;
  box-shadow:
    0 0 0 3px var(--brass-bright),
    4px 4px 0 var(--shadow-pixel),
    inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}
.leaderboard-podium-place--rank-2 {
  order: 1;
  background:
    linear-gradient(180deg, #fbf6ed 0%, #d4c8b0 100%);
  border-color: #6b5640;
}
.leaderboard-podium-place--rank-3 {
  order: 3;
  background:
    linear-gradient(180deg, #efddc4 0%, #b88660 100%);
  border-color: #5c3a1f;
}
@media (max-width: 32rem) {
  .leaderboard-podium-place--rank-1,
  .leaderboard-podium-place--rank-2,
  .leaderboard-podium-place--rank-3 {
    order: initial;
  }
}

.leaderboard-podium-rank {
  font-family: "Press Start 2P", monospace;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--brass-dim);
  text-shadow:
    2px 2px 0 var(--shadow-pixel),
    0 0 0 1px rgba(0, 0, 0, 0.3);
}
.leaderboard-podium-place--rank-1 .leaderboard-podium-rank {
  font-size: 1.85rem;
  color: #5a4108;
  text-shadow: 2px 2px 0 #b8922a, 3px 3px 0 var(--shadow-pixel);
}

.leaderboard-podium-name {
  font-family: "VT323", monospace;
  font-size: 1.5rem;
  line-height: 1.1;
  color: var(--ink);
  word-break: break-word;
}
.leaderboard-podium-place--rank-1 .leaderboard-podium-name {
  font-size: 1.85rem;
}

.leaderboard-podium-points {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  margin-top: 0.2rem;
}
.leaderboard-podium-points-num {
  font-family: "VT323", monospace;
  font-size: 1.65rem;
  line-height: 1;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}
.leaderboard-podium-place--rank-1 .leaderboard-podium-points-num {
  font-size: 2.1rem;
  color: #5a4108;
}
.leaderboard-podium-points-suffix {
  font-family: "Press Start 2P", monospace;
  font-size: 0.5rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.leaderboard-rest-table {
  margin-top: 0.6rem;
}

label {
  display: block;
  margin: 0.55rem 0;
  color: var(--ink-dim);
}

input[type="text"],
input[type="password"],
input[type="email"] {
  width: 100%;
  max-width: 28rem;
  padding: 0.5rem 0.65rem;
  border-radius: 0;
  border: 3px solid var(--wood-dark);
  background: rgba(255, 255, 255, 0.65);
  color: var(--ink);
  font-family: "VT323", monospace;
  font-size: 1.3rem;
  box-shadow:
    inset 3px 3px 0 rgba(0, 0, 0, 0.12),
    inset 0 0 0 1px var(--parchment-shadow);
}

input[type="file"] {
  font-family: "VT323", monospace;
  font-size: 1.05rem;
  color: var(--ink-dim);
  max-width: 100%;
}

code {
  font-family: "VT323", monospace;
  font-size: 1.1em;
  color: var(--wood-light);
  background: rgba(0, 0, 0, 0.06);
  padding: 0.08em 0.35em;
  border: 2px solid var(--parchment-shadow);
}

input[type="text"]:focus-visible,
input[type="password"]:focus-visible,
input[type="email"]:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-color: var(--border-brass);
  box-shadow:
    inset 3px 3px 0 rgba(0, 0, 0, 0.12),
    0 0 0 1px var(--focus-ring-inner);
}

/* Classic beveled “push” buttons */
button,
.button {
  display: inline-block;
  font-family: "Press Start 2P", monospace;
  font-size: 0.55rem;
  line-height: 1.5;
  letter-spacing: 0.02em;
  padding: 0.55rem 0.85rem 0.5rem;
  border-radius: 0;
  border: 2px solid #1a1008;
  background: linear-gradient(180deg, var(--brass-bright) 0%, var(--brass) 35%, var(--brass-dim) 100%);
  color: var(--ink);
  font-weight: 400;
  cursor: pointer;
  text-decoration: none;
  margin: 0.35rem 0.35rem 0.35rem 0;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.35);
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, 0.45),
    inset -2px -2px 0 rgba(0, 0, 0, 0.2),
    4px 4px 0 var(--shadow-pixel);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}

button:hover,
.button:hover {
  transform: translate(1px, 1px);
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, 0.45),
    inset -2px -2px 0 rgba(0, 0, 0, 0.2),
    3px 3px 0 var(--shadow-pixel);
  text-decoration: none;
  color: var(--ink);
}

button:active,
.button:active {
  transform: translate(3px, 3px);
  box-shadow:
    inset 2px 2px 0 rgba(0, 0, 0, 0.15),
    1px 1px 0 var(--shadow-pixel);
}

button:focus-visible,
.button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, 0.45),
    inset -2px -2px 0 rgba(0, 0, 0, 0.2),
    4px 4px 0 var(--shadow-pixel),
    0 0 0 1px var(--focus-ring-inner);
}

button.secondary,
.button.secondary {
  background: linear-gradient(180deg, #8b7355 0%, #5c4a38 45%, #3d3025 100%);
  color: #faf4eb;
  text-shadow: 2px 2px 0 var(--shadow-pixel);
}

button.secondary:hover,
.button.secondary:hover {
  color: var(--parchment);
  background: linear-gradient(180deg, #9a8060 0%, #6b5640 50%, #4a3a2e 100%);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.15rem;
  color: var(--ink);
  border: 3px solid var(--wood-dark);
  background: rgba(255, 255, 255, 0.35);
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.45rem;
  border-bottom: 2px solid var(--parchment-shadow);
}

th {
  font-family: "Press Start 2P", monospace;
  font-size: 0.5rem;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: linear-gradient(180deg, var(--parchment-shadow) 0%, #a08b70 100%);
  text-transform: uppercase;
}

tr:nth-child(even) td {
  background: rgba(74, 53, 40, 0.06);
}

/* Timer: brass frame, ticking border (no synthwave glow) */
.timer {
  font-family: "VT323", monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1.55rem;
  color: var(--ink);
  margin-bottom: 1rem;
  padding: 0.55rem 0.85rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(212, 196, 168, 0.9) 100%);
  border: 3px solid var(--brass-dim);
  display: inline-block;
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.5),
    3px 3px 0 var(--shadow-pixel);
  animation: timer-tick 1.4s steps(2, end) infinite;
}

@media (prefers-reduced-motion: reduce) {
  .timer {
    animation: none;
  }
}

@keyframes timer-tick {
  0%,
  100% {
    border-color: var(--brass-dim);
  }
  50% {
    border-color: var(--brass-bright);
  }
}

.clue {
  font-size: 1.45rem;
  font-style: italic;
  margin: 0.55rem 0;
  padding: 0.5rem 0.65rem 0.5rem 0.85rem;
  border-left: 5px solid var(--brass-dim);
  border-bottom: 1px solid rgba(74, 53, 40, 0.15);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.25);
}

.play-answer-feedback .play-answer-feedback-track {
  margin: 0 0 0.75rem;
  font-weight: bold;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: "Press Start 2P", monospace;
  font-size: 0.48rem;
}

.play-session-stats {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  line-height: 1.35;
}

.play-countdown-page .play-session-stats {
  text-align: center;
}

.play-feedback-banner {
  margin: 0 0 1rem;
  padding: 1rem 1.1rem;
  border: 3px solid var(--wood-dark);
  box-shadow: 3px 3px 0 var(--shadow-pixel);
}

.play-feedback-banner--correct {
  background: rgba(120, 180, 90, 0.35);
  border-color: rgba(42, 90, 28, 0.85);
}

.play-feedback-banner--wrong {
  background: rgba(200, 120, 90, 0.3);
  border-color: rgba(120, 50, 30, 0.75);
}

.play-feedback-banner--timeout {
  background: rgba(200, 190, 120, 0.35);
  border-color: var(--border-brass);
}

.play-feedback-heading {
  margin: 0 0 0.35rem;
  font-family: "Press Start 2P", monospace;
  font-size: 0.62rem;
  line-height: 1.5;
  color: var(--ink);
}

.play-feedback-sub {
  margin: 0;
  font-size: 1.15rem;
  color: var(--ink-dim);
}

.play-feedback-section-title {
  margin: 0 0 0.4rem;
  font-family: "Press Start 2P", monospace;
  font-size: 0.48rem;
  color: var(--ink);
}

.play-feedback-answer-block {
  margin: 1.25rem 0 1rem;
}

.play-feedback-correct-answer {
  margin: 0;
  font-size: 1.65rem;
  font-weight: bold;
  color: var(--ink);
}

.play-feedback-fun-fact {
  margin: 1.15rem 0 1.25rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.35);
  border: 2px dashed rgba(42, 28, 18, 0.25);
  font-size: 1.2rem;
  line-height: 1.45;
  color: var(--ink);
}

.play-feedback-fun-fact p {
  margin: 0;
}

.play-feedback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.25rem;
}

.play-feedback-action-form {
  margin: 0;
}

.muted {
  color: var(--ink-dim);
  font-size: 1.08rem;
}

.home-hero {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  margin-bottom: 1.35rem;
  flex-wrap: wrap;
}

.home-avatar {
  display: block;
  flex-shrink: 0;
  object-fit: cover;
  object-position: center center;
  aspect-ratio: 1 / 1;
  background: rgba(255, 255, 255, 0.55);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border-radius: 0;
  border: 4px solid var(--wood-dark);
  box-shadow:
    0 0 0 2px var(--border-brass),
    4px 4px 0 var(--shadow-pixel);
}

/* HTML width/height vary; lock square boxes so non-128×128 sources still look right */
.home-avatar-pick-done .home-avatar {
  width: 96px;
  height: 96px;
}

.home-hero .home-avatar {
  width: 128px;
  height: 128px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.35rem 0;
}

@media (max-width: 520px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.stats-grid section {
  background: rgba(255, 255, 255, 0.35);
  border: 3px solid var(--wood-dark);
  border-radius: 0;
  padding: 1rem;
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.35),
    4px 4px 0 var(--shadow-pixel);
}

.stats-grid section h2 {
  margin-top: 0;
}

.avatar-grid-form {
  margin-top: 0.65rem;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.85rem;
  margin: 1.1rem 0;
}

.avatar-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 0.5rem;
  border: 3px solid var(--wood-dark);
  border-radius: 0;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.4);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.4),
    3px 3px 0 var(--shadow-pixel);
  transition: transform 0.06s ease, border-color 0.06s ease;
}

.avatar-tile:hover {
  border-color: var(--border-brass);
  transform: translate(-1px, -1px);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.4),
    4px 4px 0 var(--shadow-pixel);
}

.avatar-tile:has(input:focus-visible) {
  outline: 3px solid var(--brass-bright);
  outline-offset: 2px;
}

.avatar-tile:has(input:checked) {
  border-color: var(--brass-dim);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.35),
    3px 3px 0 var(--shadow-pixel),
    0 0 0 2px var(--brass);
  background: linear-gradient(180deg, rgba(232, 208, 120, 0.35) 0%, rgba(255, 255, 255, 0.45) 100%);
}

/* Invisible full-tile hit target; selection shown via .avatar-tile:has(input:checked) */
.avatar-tile input[type="radio"] {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  appearance: none;
  -webkit-appearance: none;
}

.avatar-tile input[type="radio"]:focus-visible {
  outline: none;
}

.avatar-tile .avatar-name {
  pointer-events: none;
  position: relative;
  z-index: 0;
}

.avatar-tile img {
  display: block;
  width: 128px;
  height: 128px;
  object-fit: cover;
  object-position: center center;
  aspect-ratio: 1 / 1;
  background: rgba(255, 255, 255, 0.55);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
  position: relative;
  z-index: 0;
}

.avatar-name {
  font-family: "Press Start 2P", monospace;
  font-size: 0.45rem;
  line-height: 1.5;
  letter-spacing: 0.03em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

/* Radio / checkbox rows in play forms (not avatar picker tiles) */
.card label:has(input[type="radio"]):not(.avatar-tile) {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  margin: 0.4rem 0;
  border: 2px solid var(--wood-dark);
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  color: var(--ink);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.4);
}

.card label:has(input[type="radio"]:checked):not(.avatar-tile) {
  border-color: var(--border-brass);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.4),
    0 0 0 1px var(--brass-dim);
  background: rgba(232, 208, 120, 0.2);
}

.card label:has(input[type="radio"]):not(.avatar-tile):hover {
  border-color: var(--copper);
}

.card label:has(input[type="radio"]:focus-visible):not(.avatar-tile) {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

/* Play MCQ: entire row is the control; hide native radio dot (same idea as .home-big-choice) */
.card label.play-mcq-option:has(input[type="radio"]) {
  position: relative;
  gap: 0;
  padding: 0.55rem 0.85rem;
}

.card label.play-mcq-option input[type="radio"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  appearance: none;
  -webkit-appearance: none;
}

.card label.play-mcq-option input[type="radio"]:focus,
.card label.play-mcq-option input[type="radio"]:focus-visible {
  outline: none;
}

.card label.play-mcq-option:has(input:focus-visible) {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.card label.play-mcq-option span {
  pointer-events: none;
  position: relative;
  z-index: 0;
  flex: 1;
}

/* Group related controls (1.3.1) */
fieldset.quiz-fieldset {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}

fieldset.quiz-fieldset legend {
  font-family: "Press Start 2P", monospace;
  font-size: 0.5rem;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  padding: 0;
  margin: 0 0 0.65rem;
}

input[type="radio"]:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

input[type="file"]:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Screen-reader-only fallback control (keyboard / assistive tech) */
kbd {
  font-family: "VT323", ui-monospace, monospace;
  font-size: 0.95em;
  padding: 0.08em 0.35em;
  border: 2px solid var(--wood-dark);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.35);
  color: var(--ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Setup: full-width choice rows (one tap = submit via JS); skip avatar tiles */
form[data-submit-on="radio-change"] label:has(input[type="radio"]):not(.avatar-tile):not(.home-big-choice) {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  margin: 0.5rem 0;
  border: 3px solid var(--wood-dark);
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  color: var(--ink);
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, 0.35),
    3px 3px 0 var(--shadow-pixel);
}

form[data-submit-on="radio-change"] label:has(input[type="radio"]):not(.avatar-tile):not(.home-big-choice):hover {
  border-color: var(--copper);
}

form[data-submit-on="radio-change"] label:has(input[type="radio"]:checked):not(.avatar-tile):not(.home-big-choice) {
  border-color: var(--border-brass);
  background: rgba(232, 208, 120, 0.25);
}

/* Home: progressive one-page onboarding (visible title lives in header .brand) */
.home-zone {
  border-top: 3px solid var(--wood-dark);
  padding: 1.25rem 0 1.5rem;
  margin: 0;
}

/* Same horizontal bleed for every step so border-top dividers share one width (active used to add
   extra negative margin only on the current step, which staggered the dark separator lines). */
.card.home-onboarding > .home-zone {
  margin-left: -0.75rem;
  margin-right: -0.75rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

/* Guest name already saved: one line, less vertical padding */
.home-zone--compact-name {
  padding-top: 0.6rem;
  padding-bottom: 0.75rem;
}

/* Keep label + handle on one typographic line (baseline), not separate flex-centered items */
.home-zone-title-line {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  min-width: 0;
}

.home-zone-title-label {
  flex-shrink: 0;
}

/* Guest handle: same Press Start 2P line as .home-zone-title / .home-zone-title-label */
.home-player-handle-in-title {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  min-width: 0;
}

.home-your-stats {
  margin-bottom: 1.25rem;
  /* Leave room on the right for the avatar corner-piece (72px + 1rem gutter). */
  padding-right: calc(72px + 1.75rem);
}

/* Suppress the generic brass corner-dot when the avatar occupies that slot. */
.home-your-stats::after {
  display: none;
}

.home-your-stats-avatar {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 72px;
  height: 72px;
  object-fit: cover;
  object-position: center center;
  image-rendering: pixelated;
  border: 3px solid var(--wood-dark);
  background: var(--parchment);
  box-shadow:
    0 0 0 2px var(--border-brass),
    3px 3px 0 var(--shadow-pixel),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

/* On narrow viewports, drop the float-out and stack the avatar above the heading. */
@media (max-width: 28rem) {
  .home-your-stats {
    padding-right: 1.4rem;
  }
  .home-your-stats-avatar {
    position: static;
    display: block;
    margin: 0 0 0.75rem;
  }
}

.home-your-stats-verify {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
}

.home-your-stats-line {
  margin: 0 0 0.35rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.4em;
  line-height: 1.35;
  font-size: 0.95rem;
}

.home-your-stats-line:last-of-type {
  margin-bottom: 0.5rem;
}

.home-your-stats-mode {
  font-family: "Press Start 2P", monospace;
  font-size: 0.48rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  flex: 0 0 auto;
}

.home-your-stats-table-wrap {
  margin-top: 0.75rem;
  overflow-x: auto;
}

.home-your-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.home-your-stats-table th,
.home-your-stats-table td {
  text-align: left;
  padding: 0.4rem 0.65rem;
  border-bottom: 1px solid rgba(42, 28, 18, 0.12);
}

.home-your-stats-table thead th {
  font-weight: bold;
  color: var(--ink-dim);
  border-bottom-width: 2px;
}

.home-setup-resume-play {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 2px dashed rgba(42, 28, 18, 0.2);
}

.home-setup-resume-play-lead {
  margin: 0 0 0.75rem;
}

.home-email-invite {
  max-width: 36rem;
}

.home-email-invite-lead {
  margin: 0 0 0.65rem;
  font-size: 1.15rem;
  line-height: 1.4;
  color: var(--ink);
}

.home-email-invite-why {
  margin: 0 0 0.35rem;
  font-weight: bold;
  color: var(--ink);
}

.home-email-benefits {
  margin: 0 0 0.85rem;
  padding-left: 1.35rem;
  color: var(--ink-dim);
  font-size: 1.08rem;
  line-height: 1.45;
}

.home-email-benefits li {
  margin: 0.2rem 0;
}

.home-email-invite-resume {
  margin: 0 0 0.65rem;
}

.home-email-invite-form {
  margin: 0;
}

.home-email-invite-hint {
  margin: 0.35rem 0 0.65rem;
  font-size: 1.02rem;
}

.home-email-invite-form button[type="submit"] {
  margin-top: 0.15rem;
}

.home-zone-title {
  margin: 0 0 0.65rem;
  font-family: "Press Start 2P", monospace;
  font-size: 0.55rem;
  line-height: 1.6;
  letter-spacing: 0.04em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.home-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.35rem;
  background: var(--wood-dark);
  color: var(--parchment-mid);
  border: 2px solid var(--border-brass);
  font-size: 0.65rem;
  box-shadow: 2px 2px 0 var(--shadow-pixel);
}

.home-zone--locked {
  opacity: 0.48;
  pointer-events: none;
}

.home-zone--locked .home-zone-hint {
  margin-bottom: 0;
}

.home-zone--active {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 0;
  box-shadow: inset 0 0 0 1px rgba(184, 146, 42, 0.35);
}

/* Dim completed *content* only. Whole-section opacity made the step badge (1, 2, …) nearly vanish vs active steps. */
.home-zone--done:not(.home-zone--active) > :not(h2.home-zone-title) {
  opacity: 0.92;
}

/* Beat .card h2 { color: ink-dim } so “YOUR PLAYER NAME” matches other onboarding headers. */
.card.home-onboarding > .home-zone > h2.home-zone-title {
  color: var(--ink);
}

.home-zone-done {
  margin: 0.5rem 0 0;
  color: var(--ink);
  font-size: 1.2rem;
}

.home-avatar-pick-done {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.home-avatar-pick-done p {
  margin: 0;
}

.home-avatar-switch-form {
  margin: 0;
  display: flex;
  align-items: center;
}

.home-choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.75rem;
  /* Cap the pair of tiles so they don't balloon across the full card width on
     wide viewports — keeps game-type and difficulty pickers visually consistent. */
  max-width: 52rem;
}

@media (max-width: 640px) {
  .home-choice-grid {
    grid-template-columns: 1fr;
  }
}

.home-big-choice {
  position: relative;
  display: flex;
  align-items: stretch;
  min-height: 7.5rem;
  padding: 1rem 1.1rem;
  margin: 0 !important;
  border: 3px solid var(--wood-dark);
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  color: var(--ink);
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, 0.4),
    4px 4px 0 var(--shadow-pixel);
  transition: transform 0.06s ease, border-color 0.06s ease;
}

.home-big-choice:hover {
  border-color: var(--copper);
  transform: translate(-1px, -1px);
}

.home-big-choice:has(input:focus-visible) {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.home-big-choice:has(input:checked) {
  border-color: var(--border-brass);
  background: rgba(232, 208, 120, 0.28);
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, 0.35),
    4px 4px 0 var(--shadow-pixel),
    0 0 0 2px var(--brass-dim);
}

/* Full-card hit target; no visible radio dot */
.home-big-choice input[type="radio"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  appearance: none;
  -webkit-appearance: none;
}

.home-big-choice-body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  pointer-events: none;
  position: relative;
  z-index: 0;
  flex: 1;
}

.home-big-choice-title {
  font-family: "Press Start 2P", monospace;
  font-size: 0.52rem;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.home-big-choice-desc {
  font-size: 1.15rem;
  line-height: 1.35;
  color: var(--ink-dim);
}

.home-big-choice-remaining {
  display: block;
  margin-top: 0.5rem;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--ink-dim);
  font-family: "VT323", ui-monospace, monospace;
}

.home-big-choice-remaining-score {
  display: block;
}

.home-big-choice-remaining-extra {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.95rem;
  line-height: 1.3;
}

.home-big-choice--exhausted {
  opacity: 0.52;
  cursor: not-allowed;
}

.home-big-choice--exhausted .home-big-choice-title,
.home-big-choice--exhausted .home-big-choice-desc {
  color: var(--ink-dim);
}

.home-link-both-exhausted {
  margin: 0.5rem 0 0.75rem;
  max-width: 40rem;
}

.home-continue-footer {
  margin: 1.75rem 1rem 2rem;
  text-align: center;
  max-width: 44rem;
  margin-left: auto;
  margin-right: auto;
}

/* .muted uses --ink-dim (for parchment panels). On --bg-deep that fails WCAG AA; use light ink here. */
.home-continue-footer.muted {
  color: var(--parchment-mid);
}

.home-continue-footer .muted {
  color: var(--parchment-shadow);
}

@media (prefers-reduced-motion: reduce) {
  .home-big-choice {
    transition: none;
  }

  .home-big-choice:hover {
    transform: none;
  }
}

/* Opening countdown — once per play run (not between questions) */
.play-countdown-page main {
  min-height: 60vh;
  position: relative;
}

.play-countdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  background: rgba(8, 6, 5, 0.92);
  border: none;
  box-shadow: inset 0 0 0 4px var(--border-brass);
}

.play-countdown-pretitle {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  color: var(--brass-bright);
  text-transform: uppercase;
}

.play-countdown-number {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(4rem, 22vw, 12rem);
  line-height: 1;
  color: var(--parchment);
  text-shadow:
    4px 4px 0 var(--shadow-pixel),
    0 0 40px rgba(240, 216, 120, 0.35);
}

.play-countdown-sub {
  margin: 0;
  max-width: 28rem;
  text-align: center;
  font-size: 1.15rem;
  color: var(--parchment-mid);
}

.play-countdown-form {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* First-visit splash (pixel art hero). Blink stays slow for WCAG (no &gt;3 flashes/sec). */
.splash-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #0a0806;
  overflow-x: hidden;
}

.splash-skip-to-game {
  z-index: 6000;
}

.splash-stage {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0806;
  padding: 0.75rem min(1.25rem, 4vw) 1rem;
  border-bottom: 4px solid var(--wood-dark);
  box-shadow: 0 6px 0 var(--shadow-pixel);
}

/* Full artwork visible: scale down with aspect ratio (no crop). */
.splash-art {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: min(72vh, 88dvh);
  object-fit: contain;
  object-position: center center;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.splash-reviews {
  flex: 1 1 auto;
  max-width: 40rem;
  margin: 0 auto;
  width: 100%;
  padding: 1.35rem 1.25rem 1rem;
  box-sizing: border-box;
}

.splash-reviews-heading {
  font-family: "Press Start 2P", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass-bright);
  text-align: center;
  margin: 0 0 1rem;
  opacity: 0.75;
}

.splash-review {
  margin: 0 0 1.1rem;
  padding: 0 0 1rem;
  border-bottom: 1px solid rgba(196, 180, 154, 0.15);
  color: var(--parchment-mid);
}

.splash-reviews .splash-review:last-child {
  border-bottom: none;
  margin-bottom: 0.35rem;
  padding-bottom: 0;
}

.splash-review p {
  margin: 0 0 0.45rem;
  font-family: "VT323", ui-monospace, monospace;
  font-size: 1.42rem;
  line-height: 1.35;
  font-style: italic;
  color: #e8dcc8;
}

.splash-review footer {
  font-family: "VT323", ui-monospace, monospace;
  font-size: 1.1rem;
  color: var(--ink-dim);
}

.splash-review-outlet {
  font-family: "Press Start 2P", monospace;
  font-size: 0.42rem;
  line-height: 1.6;
  letter-spacing: 0.06em;
  font-style: normal;
  color: var(--brass-bright);
}

.splash-footer {
  flex: 0 0 auto;
  padding: 1.75rem 1rem 2.25rem;
  background: linear-gradient(180deg, rgba(15, 11, 8, 0.97) 0%, #0a0806 100%);
  border-top: 3px solid var(--border-brass);
  text-align: center;
  margin-top: auto;
}

.splash-tagline {
  margin: 0 0 0.65rem;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(0.38rem, 2.2vw, 0.62rem);
  line-height: 1.9;
  letter-spacing: 0.06em;
  color: #f5e6c8;
  text-shadow:
    3px 3px 0 #0a0604,
    0 0 24px rgba(0, 0, 0, 0.9);
  max-width: 38rem;
  margin-left: auto;
  margin-right: auto;
}

/* Irregular “glitchy” hold times; ~6s loop, well under three flashes per second */
@keyframes splash-flaky-blink {
  0%,
  100% {
    opacity: 1;
    transform: translateX(0);
  }
  4% {
    opacity: 0.35;
    transform: translateX(-1px);
  }
  7% {
    opacity: 1;
    transform: translateX(0);
  }
  31% {
    opacity: 0.22;
    transform: translateX(1px);
  }
  34% {
    opacity: 0.95;
    transform: translateX(0);
  }
  48% {
    opacity: 0.5;
    transform: translateX(-2px);
  }
  51% {
    opacity: 1;
    transform: translateX(0);
  }
  63% {
    opacity: 0.12;
    transform: translateX(0);
  }
  66% {
    opacity: 0.88;
    transform: translateX(1px);
  }
  79% {
    opacity: 0.42;
    transform: translateX(0);
  }
  82% {
    opacity: 1;
    transform: translateX(0);
  }
  93% {
    opacity: 0.55;
    transform: translateX(-1px);
  }
  96% {
    opacity: 1;
    transform: translateX(0);
  }
}

.splash-tagline--flaky {
  animation: splash-flaky-blink 6.2s steps(1, end) infinite;
}

.splash-a11y {
  margin: 0;
  font-family: "VT323", ui-monospace, monospace;
  font-size: 1.35rem;
}

.splash-continue-link {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.splash-continue-link:hover {
  color: var(--link-hover);
}

.splash-continue-link:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.splash-noscript-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 7000;
  padding: 1rem;
}

@media (prefers-reduced-motion: reduce) {
  .splash-tagline--flaky {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* Site-wide creator credit */
.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding: 1.25rem 1.25rem 1.75rem;
  border-top: 2px solid var(--wood-dark);
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.35) 100%);
}

.site-footer-inner {
  margin: 0 auto;
  max-width: 44rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  text-align: center;
  font-family: "VT323", ui-monospace, monospace;
  font-size: 1.12rem;
  line-height: 1.45;
  color: rgba(232, 216, 190, 0.82);
}

.site-footer-credits {
  margin: 0;
}

.site-footer-inner a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.site-footer-inner a:hover {
  color: var(--link-hover);
}

.site-footer-inner a:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.site-footer-inner strong {
  color: var(--brass-bright);
  font-weight: normal;
  letter-spacing: 0.04em;
}

/* Low-profile theme control (footer only) */
.theme-switcher-form {
  margin: 0;
}

.theme-switcher-label {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
  margin: 0;
  font-size: 0.95rem;
  color: rgba(232, 216, 190, 0.55);
}

.theme-switcher-label-text {
  font-family: "VT323", ui-monospace, monospace;
}

.theme-switcher-select {
  max-width: 12rem;
  padding: 0.2rem 0.45rem;
  font-family: "VT323", ui-monospace, monospace;
  font-size: 0.95rem;
  line-height: 1.3;
  color: var(--ink);
  background: var(--parchment);
  border: 2px solid var(--wood-dark);
  border-radius: 0;
  cursor: pointer;
}

.theme-switcher-select:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

body:not(.splash-body) {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body:not(.splash-body) main {
  flex: 1 0 auto;
}

.splash-body .site-footer {
  margin-top: 0;
  border-top-color: rgba(90, 60, 35, 0.45);
}

/* --- Global error page (Spring Boot /error) --- */
.error-page-card {
  text-align: center;
  padding: 1.6rem 1.5rem 1.75rem;
}

.error-page-eyebrow {
  margin: 0 0 0.5rem;
  font-family: "Press Start 2P", monospace;
  font-size: 0.45rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--copper);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.15);
}

.error-page-code {
  margin: 0 0 0.65rem;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(1.35rem, 5vw, 1.85rem);
  line-height: 1.2;
  color: var(--brass-bright);
  text-shadow:
    2px 2px 0 var(--shadow-pixel),
    0 0 24px rgba(240, 216, 120, 0.22);
}

.error-page-card .error-page-title {
  margin: 0 0 0.85rem;
  font-size: 0.62rem;
  line-height: 1.5;
  color: var(--ink);
  text-shadow: 1px 1px 0 var(--parchment-shadow);
}

.error-page-lead {
  margin: 0 auto 0.75rem;
  max-width: 28rem;
  text-align: center;
  font-size: 1.25rem;
  line-height: 1.45;
  color: var(--ink-dim);
}

.error-page-message {
  margin: 0 auto 0.85rem;
  max-width: 32rem;
  text-align: left;
  padding: 0.65rem 0.85rem;
  background: var(--parchment-mid);
  border: 2px dashed rgba(74, 53, 40, 0.28);
  font-size: 1.15rem;
  line-height: 1.4;
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.error-page-path {
  margin: 0 auto 1.1rem;
  max-width: 32rem;
  text-align: left;
  font-size: 1.05rem;
  line-height: 1.4;
  color: var(--ink-dim);
}

.error-page-path-code {
  display: inline-block;
  margin-top: 0.2rem;
  padding: 0.15rem 0.45rem;
  background: var(--bg-inset);
  color: var(--parchment-mid);
  border: 2px solid var(--wood-mid);
  font-family: "VT323", ui-monospace, monospace;
  font-size: 1.1rem;
  word-break: break-all;
}

.error-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
  margin-top: 0.25rem;
}

.error-page-dev {
  margin-top: 1.35rem;
  text-align: left;
  border-top: 2px dashed rgba(74, 53, 40, 0.22);
  padding-top: 1rem;
}

.error-page-dev summary {
  cursor: pointer;
  font-family: "Press Start 2P", monospace;
  font-size: 0.42rem;
  color: var(--ink-dim);
  letter-spacing: 0.06em;
}

.error-page-dev summary:hover {
  color: var(--ink);
}

.error-page-dev summary:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.error-page-trace {
  margin: 0.75rem 0 0;
  padding: 0.75rem 0.85rem;
  max-height: 16rem;
  overflow: auto;
  background: var(--bg-inset);
  color: var(--parchment-mid);
  border: 3px solid var(--wood-dark);
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: left;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* --- Admin dashboard (/admin/) --- */
.admin-tool-list {
  list-style: none;
  margin: 1.1rem 0 0;
  padding: 0;
}

.admin-tool-list li {
  margin: 0 0 1.35rem;
  padding-bottom: 1.1rem;
  border-bottom: 2px dashed rgba(74, 53, 40, 0.2);
}

.admin-tool-list li:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.admin-tool-list a {
  font-family: "Press Start 2P", monospace;
  font-size: 0.52rem;
  line-height: 1.6;
  letter-spacing: 0.04em;
}

/* ── Duel ────────────────────────────────────────────────────── */

.duel-lobby-selectors {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.duel-lobby-selectors fieldset {
  border: 2px solid var(--chrome-border, #555);
  padding: 0.75rem 1rem;
  min-width: 0;
}

.duel-lobby-selectors label {
  display: block;
  padding: 0.3rem 0;
  cursor: pointer;
}

.duel-player-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

.duel-lobby-player {
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--chrome-border, #555);
  font-family: "VT323", monospace;
  font-size: 1.1rem;
}

.duel-chat-messages {
  height: 10rem;
  overflow-y: auto;
  border: 2px solid var(--chrome-border, #555);
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  background: var(--parchment-deep, rgba(0,0,0,0.15));
  font-family: "VT323", monospace;
  font-size: 1rem;
}

.duel-chat-msg {
  margin-bottom: 0.2rem;
  word-break: break-word;
}

.duel-chat-form {
  display: flex;
  gap: 0.5rem;
}

.duel-chat-form input[type="text"] {
  flex: 1;
}

.duel-match-found {
  text-align: center;
  animation: duel-pulse 1s ease-in-out infinite alternate;
}

@keyframes duel-pulse {
  from { opacity: 0.7; }
  to   { opacity: 1; }
}

/* Scoreboard */
.duel-scoreboard {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1rem;
  font-family: "Press Start 2P", monospace;
}

.duel-player {
  text-align: center;
}

.duel-player-name {
  display: block;
  font-size: 0.55rem;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
}

.duel-player-score {
  display: block;
  font-size: 1.8rem;
  color: var(--gold, #f5c542);
}

.duel-vs {
  font-size: 1rem;
  opacity: 0.6;
}

/* Game area */
.duel-progress {
  font-family: "VT323", monospace;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  opacity: 0.8;
}

.duel-status {
  padding: 0.75rem;
  margin-top: 0.75rem;
  font-family: "VT323", monospace;
  font-size: 1.15rem;
  text-align: center;
  border: 2px solid var(--chrome-border, #555);
  min-height: 1.5em;
}

.duel-status.duel-status-neutral {
  border-color: var(--chrome-border, #555);
  opacity: 0.8;
}

.duel-status.duel-status-you-answered {
  border-color: var(--chrome-border, #555);
}

.duel-status.duel-status-resolved {
  border-color: var(--border-brass, #a88538);
}

.duel-status.duel-opponent-correct {
  border-color: var(--danger, #c0392b);
  color: var(--danger, #c0392b);
}

.duel-status.duel-opponent-wrong {
  border-color: var(--gold, #f5c542);
  color: var(--gold, #f5c542);
}

.duel-status.duel-opponent-disconnected {
  border-color: var(--chrome-border, #555);
  opacity: 0.7;
}

/* Highlight the option the opponent just picked wrong, so you don't click it. */
.play-mcq-option.duel-option-opponent-wrong {
  background: rgba(220, 70, 70, 0.18);
  border-color: rgba(180, 40, 40, 0.55) !important;
  text-decoration: line-through;
  opacity: 0.85;
}

/* Highlight the correct option once a question is resolved. */
.play-mcq-option.duel-option-correct {
  background: rgba(60, 180, 90, 0.22);
  border-color: rgba(40, 150, 70, 0.65) !important;
  font-weight: bold;
}

/* Anticipation-building overlay shown for ~5s before the first question. */
.duel-start-countdown {
  text-align: center;
  padding: 2.5rem 1rem;
  font-family: "Press Start 2P", monospace;
}

.duel-start-countdown-label {
  font-size: 1.25rem;
  margin: 0 0 1.25rem;
  letter-spacing: 0.05em;
}

.duel-start-countdown-number {
  font-size: 6rem;
  line-height: 1;
  margin: 0;
  color: var(--gold, #f5c542);
  text-shadow: 0 0 12px rgba(245, 197, 66, 0.5);
}

.duel-next-countdown {
  font-family: "VT323", monospace;
  font-size: 1.15rem;
  text-align: center;
  margin-top: 0.5rem;
  opacity: 0.9;
}

.duel-question-feedback {
  text-align: center;
  padding: 0.75rem;
  margin-top: 0.75rem;
  font-family: "VT323", monospace;
  font-size: 1.15rem;
}

/* Results */
.duel-results { text-align: center; }

.duel-results-banner {
  font-family: "Press Start 2P", monospace;
  font-size: 0.9rem;
  padding: 0.75rem 1.5rem;
  display: inline-block;
  margin-bottom: 1rem;
}

.duel-win   { color: var(--gold, #f5c542); }
.duel-loss  { color: var(--danger, #c0392b); }
.duel-draw  { opacity: 0.7; }

.duel-results-scoreboard {
  margin: 1.5rem 0;
}

.duel-results-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

/* Static content pages (About, Privacy) — long-form prose inside a card. */
.static-page {
  max-width: 52rem;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

.static-article {
  padding: 2rem 2.25rem;
}

.static-article h1 {
  font-family: "Press Start 2P", monospace;
  font-size: 1.25rem;
  line-height: 1.3;
  margin: 0 0 1.25rem;
  color: var(--brass-bright);
}

.static-article h2 {
  font-family: "Press Start 2P", monospace;
  font-size: 0.85rem;
  line-height: 1.3;
  margin: 1.75rem 0 0.75rem;
  color: var(--brass-bright);
}

.static-article p,
.static-article ul {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  line-height: 1.55;
}

.static-article ul {
  padding-left: 1.35rem;
}

.static-article li {
  margin-bottom: 0.5rem;
}

.static-article a {
  color: var(--brass-bright);
  text-decoration: underline;
}

.static-back {
  margin-top: 2rem;
}

/* Footer nav links for About / Privacy / GitHub. */
.site-footer-nav {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.6rem;
  font-family: "VT323", ui-monospace, monospace;
  font-size: 1.1rem;
}

.site-footer-nav a {
  color: var(--brass-bright);
  text-decoration: none;
}

.site-footer-nav a:hover,
.site-footer-nav a:focus-visible {
  text-decoration: underline;
}

/* Visually hidden but accessible to assistive tech — used for SEO/a11y H1 on splash. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Splash primary CTA — visible above the fold, points to /splash/continue. */
.splash-cta {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.85rem 1.6rem;
  background: var(--brass-bright, #c4a035);
  color: var(--ink, #1a0f08);
  font-family: "Press Start 2P", monospace;
  font-size: 0.85rem;
  text-decoration: none;
  border: 3px solid var(--ink, #1a0f08);
  box-shadow: 4px 4px 0 var(--shadow-pixel, #000);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out, background 80ms;
}

.splash-cta:hover,
.splash-cta:focus-visible {
  background: #e0bc4e;
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--shadow-pixel, #000);
  outline: none;
}
