/*
 * 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).
 */

:root {
  color-scheme: dark;
  /* Leather & wood (DOS-adjacent browns) */
  --bg-deep: #0f0b08;
  --bg: #16100c;
  --bg-panel: #1f1610;
  --bg-inset: #120d0a;
  --wood-dark: #2a1c12;
  --wood-mid: #3d2818;
  --wood-light: #5c3d24;
  --leather: #1a120c;
  /* Parchment & ink (dialogue / card surfaces) */
  --parchment: #f2e8d5;
  --parchment-mid: #e4d6be;
  --parchment-shadow: #c4b49a;
  --ink: #1a0f0a;
  --ink-dim: #3d2818;
  /* Brass & accents */
  --brass: #b8922a;
  --brass-dim: #7a6218;
  --brass-bright: #f0d878;
  --copper: #8b5c38;
  /* Links on dark background — ≥4.5:1 vs --bg-deep */
  --link: #9fd4ff;
  --link-hover: #cce9ff;
  /* Status — ≥4.5:1 on parchment */
  --success: #1e5c28;
  --success-fg: #e8f5e9;
  --danger: #8b2504;
  --danger-fg: #fff5f3;
  /* Chrome */
  --border-wood: #2a1810;
  --border-brass: #6b5420;
  --shadow-pixel: #080605;
  /* Focus ring — ≥3:1 vs adjacent backgrounds (2.4.7, 1.4.11) */
  --focus-ring: #0b62c9;
  --focus-ring-inner: #ffffff;
  --accent-action: var(--brass);
  --accent-link: var(--link);
}

*,
*::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(--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;
}

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;
}

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);
}

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-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;
}

.home-your-stats-verify {
  margin: 0 0 1rem;
}

.home-your-stats-block {
  margin: 0 0 1rem;
}

.home-your-stats-block-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.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 0.4rem 0;
  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 {
  margin-top: 0.25rem;
  padding-top: 0.85rem;
  border-top: 2px dashed rgba(42, 28, 18, 0.2);
  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;
}

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

.home-choice-grid--mode {
  max-width: 52rem;
}

.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-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;
  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-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;
}

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);
}
