/* ==========================================================================
   Infinite Maze — shell styles (Phase 1)
   Tokens mirror DESIGN.md §2.2 and §8. Canvas colors are duplicated in
   src/config.js in Phase 2 and must be kept in sync with these values.
   ========================================================================== */

:root {
  /* Surfaces */
  --color-bg: #070b14; /* page + canvas clear */
  --color-surface: #0b1220; /* corridor floor, HUD bar */
  --color-surface-raised: #131e33; /* restart button, dpad keys */
  --color-surface-active: #1c2b47; /* pressed key / hover */

  /* Maze */
  --color-wall: #e2e8f0;
  --color-wall-depth: #334155;
  --color-corridor: #0f172a;

  /* Actors */
  --color-entry: #22c55e;
  --color-exit: #fbbf24;
  --color-exit-locked: #ef4444;
  --color-key: #fbbf24;
  --color-player: #60a5fa;
  --color-player-ring: #0b1020;

  /* Text */
  --color-text: #e2e8f0;
  --color-text-muted: #94a3b8; /* 7.1:1 on surface — safe for labels */
  --color-text-disabled: #64748b; /* 3.8:1 — large/non-essential only */

  /* Interaction */
  --color-focus: #60a5fa;
  --color-border: #1d2a44;
  --color-cyan: #38bdf8;
  --color-gold: #fbbf24;
  --color-overlay: #000000;
  --color-danger: #f87171;
  --color-warning: #fbbf24;
  --color-critical: #ef4444;

  /* Typography */
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", "Courier New", monospace;

  /* Layout */
  --hud-h: 56px;
  --hud-pad-x: 16px;
  --dpad-size: 56px;
  --dpad-gap: 8px;
  --dpad-radius: 14px;

  /* Motion (DESIGN.md §5.1) */
  --dur-step: 70ms;
  --dur-pulse: 2000ms;
  --dur-complete: 400ms;
  --dur-fade: 180ms;
  --dur-press: 90ms;
  --dur-hover: 150ms;
  --ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --------------------------------------------------------------------------
   Reset + viewport lock
   -------------------------------------------------------------------------- */

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--color-text);
  font-family: var(--font-ui);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Full-viewport game shell. Content and footer scroll below it. */
.app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--color-bg);
}

button {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

/* --------------------------------------------------------------------------
   HUD — fixed height, three-column grid so the timer stays optically centered
   -------------------------------------------------------------------------- */

.hud {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  height: calc(var(--hud-h) + env(safe-area-inset-top, 0px) + 1px);
  padding-top: env(safe-area-inset-top, 0px);
  padding-right: max(var(--hud-pad-x), env(safe-area-inset-right, 0px));
  padding-bottom: 0;
  padding-left: max(var(--hud-pad-x), env(safe-area-inset-left, 0px));
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  z-index: 2;
}

.hud__group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.hud__group--level {
  justify-self: start;
}

.hud__group--time {
  justify-self: center;
  align-items: center;
  text-align: center;
}

.hud__label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.hud__value,
.hud__time {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.02em;
  /* Stable digit widths — the timer must never shimmer. */
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-variant-ligatures: none;
  color: var(--color-text);
  white-space: nowrap;
}

/* Level value + key status indicator */

.hud__value-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hud__key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-key);
  transition: opacity var(--dur-hover) linear;
}

.hud__key[hidden] {
  display: none;
}

.hud__key svg {
  width: 14px;
  height: 14px;
  display: block;
}

/* Collected: still visible, but visibly spent. */
.hud__key.is-collected {
  opacity: 0.45;
}

/* Countdown pressure states */

.hud__time.is-warning {
  color: var(--color-warning);
}

.hud__time.is-critical {
  color: var(--color-critical);
}

/* HUD action cluster: mute + restart */

.hud__actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud__mute {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-surface-raised);
  color: var(--color-text);
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color var(--dur-hover) linear,
    transform var(--dur-press) var(--ease-out-quad);
}

.hud__mute svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* Speaker waves swap for a slash while muted. */
.hud__mute .hud__mute-slash {
  display: none;
}

.hud__mute.is-muted .hud__mute-waves {
  display: none;
}

.hud__mute.is-muted .hud__mute-slash {
  display: inline;
}

.hud__mute:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .hud__mute:hover {
    background: var(--color-surface-active);
  }
}

/* Restart control: 44 × 44 minimum touch target */

.hud__restart {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-surface-raised);
  color: var(--color-text);
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color var(--dur-hover) linear,
    transform var(--dur-press) var(--ease-out-quad);
}

.hud__restart svg {
  width: 20px;
  height: 20px;
  display: block;
}

@media (hover: hover) and (pointer: fine) {
  .hud__restart:hover {
    background: var(--color-surface-active);
  }
}

.hud__restart:active {
  background: var(--color-surface-active);
  transform: scale(0.94);
}

.hud__restart:focus-visible,
.dpad__btn:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* Set during the completion transition (Phase 5). */
.hud__restart[disabled],
.hud__restart.is-disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Stage — flex-grow playfield between HUD and D-pad
   -------------------------------------------------------------------------- */

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  overflow: hidden;
}

.maze-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--color-bg);
  /* No scroll, pinch, double-tap zoom or pull-to-refresh on the playfield. */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* --------------------------------------------------------------------------
   D-pad — hidden on fine pointers; shown for coarse pointer or observed touch
   -------------------------------------------------------------------------- */

.dpad {
  display: none;
  flex: 0 0 auto;
  align-self: flex-end;
  grid-template-columns: repeat(3, var(--dpad-size));
  grid-template-rows: repeat(3, var(--dpad-size));
  gap: var(--dpad-gap);
  margin: 8px max(16px, env(safe-area-inset-right, 0px))
    calc(16px + env(safe-area-inset-bottom, 0px)) 16px;
  padding: 0;
  touch-action: none;
  z-index: 3;
}

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

/* Hybrid devices: revealed by src/main.js on the first touch. */
body.is-touch .dpad {
  display: grid;
}

.dpad__btn {
  appearance: none;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--dpad-radius);
  background: var(--color-surface-raised);
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  transition: background-color var(--dur-press) linear,
    transform var(--dur-press) var(--ease-out-quad);
}

.dpad__btn--up {
  grid-area: 1 / 2;
}

.dpad__btn--left {
  grid-area: 2 / 1;
}

.dpad__btn--right {
  grid-area: 2 / 3;
}

.dpad__btn--down {
  grid-area: 3 / 2;
}

.dpad__btn:active,
.dpad__btn.is-pressed {
  background: var(--color-surface-active);
  transform: scale(0.96);
}

/* --------------------------------------------------------------------------
   Responsive: mobile HUD metrics and inline label/value on wide screens
   -------------------------------------------------------------------------- */

@media (max-width: 719px) {
  :root {
    --hud-h: 52px;
    --hud-pad-x: 12px;
  }

  .hud__group {
    gap: 2px;
  }

  .hud__label {
    font-size: 10px;
  }

  .hud__value,
  .hud__time {
    font-size: 17px;
  }
}

@media (min-width: 720px) {
  .hud__group {
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
  }

  .hud__label {
    font-size: 12px;
  }

  .hud__group--time .hud__label {
    font-size: 11px;
    letter-spacing: 0.1em;
  }

  .hud__value,
  .hud__time {
    font-size: 18px;
  }
}

@media (max-width: 359px) {
  .hud__value,
  .hud__time {
    font-size: 16px;
  }
}

/* --------------------------------------------------------------------------
   Landscape: overlay the pad on the playfield's bottom-right corner
   -------------------------------------------------------------------------- */

@media (orientation: landscape) and (max-height: 600px) {
  .dpad {
    position: fixed;
    right: max(16px, env(safe-area-inset-right, 0px));
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    margin: 0;
    --dpad-size: 48px;
    opacity: 0.92;
  }
}

@media (orientation: landscape) and (max-height: 400px) {
  .dpad {
    --dpad-size: 44px;
    --dpad-gap: 6px;
  }
}

/* --------------------------------------------------------------------------
   Mode selector pill bar
   -------------------------------------------------------------------------- */

.mode-bar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  z-index: 2;
}

.mode-bar__label {
  margin-right: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.mode-pill {
  appearance: none;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.06);
  color: var(--color-cyan);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color var(--dur-hover) linear,
    border-color var(--dur-hover) linear, color var(--dur-hover) linear;
}

.mode-pill:hover {
  border-color: var(--color-cyan);
  background: rgba(56, 189, 248, 0.14);
}

.mode-pill.is-active {
  border-color: var(--color-gold);
  background: rgba(251, 191, 36, 0.14);
  color: var(--color-gold);
}

.mode-pill:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Arcade landing sections
   -------------------------------------------------------------------------- */

.arcade {
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  padding: 48px 20px 8px;
}

.arcade__section {
  max-width: 1120px;
  margin: 0 auto 56px;
}

.arcade__kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-gold);
}

.arcade__title {
  margin: 0 0 8px;
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.arcade__heading {
  margin: 44px 0 12px;
  font-size: clamp(17px, 2.2vw, 21px);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-gold);
}

.arcade__title + .arcade__heading {
  margin-top: 10px;
}

.arcade__lede {
  margin: 0;
  max-width: 74ch;
  font-size: 16px;
  line-height: 1.75;
  color: var(--color-text-muted);
}

.cards {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.cards--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cards--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cards--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
  display: block;
  padding: 22px;
  border: 1px solid rgba(56, 189, 248, 0.55);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.06), #0a1322 70%);
  color: inherit;
  text-decoration: none;
  transition: border-color var(--dur-hover) linear,
    box-shadow var(--dur-hover) linear, transform var(--dur-hover) var(--ease-out-quad);
}

.card__title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-text);
}

.card__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--color-text-muted);
}

.card__list {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--color-text-muted);
}

.card__list li + li {
  margin-top: 6px;
}

.card__more {
  display: inline-block;
  margin-top: 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-gold);
}

.card--link:hover,
.card--link:focus-visible {
  border-color: var(--color-cyan);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.3), 0 12px 30px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
  outline: none;
}

kbd {
  padding: 1px 6px;
  border: 1px solid var(--color-border);
  border-radius: 5px;
  background: #0b1220;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text);
}

.arcade__cta {
  max-width: 1120px;
  margin: 0 auto 60px;
  text-align: center;
}

.cta-button {
  display: inline-block;
  padding: 16px 46px;
  border-radius: 999px;
  background: var(--color-gold);
  color: #1a1205;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: 0 12px 30px rgba(251, 191, 36, 0.22);
  transition: transform var(--dur-press) var(--ease-out-quad),
    box-shadow var(--dur-hover) linear;
}

.cta-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(251, 191, 36, 0.3);
}

.cta-button:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 3px;
}

.arcade__cta-note {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--color-text-disabled);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  background: #05080f;
  border-top: 1px solid var(--color-border);
  padding: 42px 20px 36px;
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 28px;
  max-width: 1120px;
  margin: 0 auto;
}

.brand {
  display: inline-block;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--color-text);
  text-decoration: none;
}

.brand span {
  color: var(--color-gold);
}

.site-footer__brand-col p {
  margin: 10px 0 0;
  max-width: 34ch;
  font-size: 14px;
  line-height: 1.65;
  color: var(--color-text-muted);
}

.site-footer__copy {
  color: var(--color-text-disabled) !important;
  font-size: 12px !important;
}

.site-footer .site-footer__col {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 8px;
}

.site-footer__title {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-gold);
}

.site-footer__col a {
  font-size: 14px;
  color: var(--color-text-muted);
  text-decoration: none;
}

.site-footer__col a:hover,
.site-footer__col a:focus-visible {
  color: var(--color-text);
  text-decoration: underline;
}

@media (max-width: 900px) {
  .cards--three,
  .cards--four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-footer__grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .cards--two,
  .cards--three,
  .cards--four {
    grid-template-columns: 1fr;
  }

  .site-footer__grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* --------------------------------------------------------------------------
   Below-the-fold content: how to play, rules, tips, footer
   -------------------------------------------------------------------------- */

.info {
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  padding: 56px 20px 48px;
}

.info__inner {
  max-width: 760px;
  margin: 0 auto;
}

.info__title {
  margin: 0 0 14px;
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.info__lede {
  margin: 0 0 8px;
  font-size: 17px;
  line-height: 1.7;
  color: var(--color-text-muted);
}

.info h2 {
  margin: 38px 0 12px;
  font-size: 20px;
  line-height: 1.3;
}

.info p {
  margin: 0 0 16px;
  font-size: 16px;
  line-height: 1.72;
  color: var(--color-text-muted);
}

.info strong {
  color: var(--color-text);
  font-weight: 600;
}

.info__list {
  margin: 0 0 8px;
  padding-left: 22px;
}

.info__list li {
  margin-bottom: 10px;
  font-size: 16px;
  line-height: 1.72;
  color: var(--color-text-muted);
}

.info a {
  color: var(--color-player);
}

.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 26px 20px 40px;
}

.site-footer__inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  font-size: 14px;
  color: var(--color-text-muted);
}

.site-footer__brand {
  margin: 0;
  font-size: 14px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

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

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

/* --------------------------------------------------------------------------
   Utilities and accessibility
   -------------------------------------------------------------------------- */

.sr-only {
  position: absolute !important;
  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;
}

.noscript {
  position: absolute;
  inset: auto 0 0 0;
  margin: 0;
  padding: 16px;
  text-align: center;
  font-size: 14px;
  color: var(--color-text-muted);
  background: var(--color-surface);
}

/* Canvas motion is handled in the renderer (Phase 3); this covers DOM chrome. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================

/* ==========================================================================
   Arcade upgrade — landing hero, runners, tools, arena HUD and setup overlay
   ========================================================================== */

/* Landing page */

.landing__main {
  padding: 0 20px 8px;
  background: var(--color-bg);
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: clamp(24px, 4vw, 56px);
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(40px, 7vw, 76px) 0 clamp(32px, 5vw, 56px);
}

.hero__kicker {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-gold);
}

.hero__title {
  margin: 0 0 16px;
  font-size: clamp(46px, 8vw, 86px);
  line-height: 0.94;
  letter-spacing: -0.035em;
  text-transform: uppercase;
  color: var(--color-text);
  text-shadow: 0 0 24px rgba(56, 189, 248, 0.35), 0 0 60px rgba(56, 189, 248, 0.16);
}

.hero__tagline {
  margin: 0;
  max-width: 44ch;
  font-size: clamp(16px, 2.2vw, 19px);
  line-height: 1.65;
  color: var(--color-text-muted);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 28px 0 14px;
}

.cta-button--hero {
  padding: 19px 58px;
  font-size: 15px;
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.5), 0 0 34px rgba(251, 191, 36, 0.45),
    0 16px 40px rgba(251, 191, 36, 0.2);
}

.ghost-button {
  display: inline-block;
  padding: 17px 30px;
  border: 1px solid rgba(56, 189, 248, 0.55);
  border-radius: 999px;
  color: var(--color-cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  background: rgba(56, 189, 248, 0.04);
  transition: background-color var(--dur-hover) linear, border-color var(--dur-hover) linear;
}

.ghost-button:hover,
.ghost-button:focus-visible {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--color-cyan);
  outline: none;
}

.hero__note {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-disabled);
}

.hero__facts {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(16px, 3vw, 34px);
  margin: 30px 0 0;
  padding: 0;
  list-style: none;
}

.hero__facts li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.hero__facts strong {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--color-gold);
  text-shadow: 0 0 18px rgba(251, 191, 36, 0.35);
}

.hero__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 1.4vw, 16px);
  min-height: clamp(300px, 34vw, 400px);
  padding: 28px 20px 52px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 26px;
  background: radial-gradient(circle at 50% 30%, rgba(56, 189, 248, 0.18), transparent 62%),
    linear-gradient(180deg, #0a1526, #060b14 80%);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(56, 189, 248, 0.08) inset;
  overflow: hidden;
}

.hero__glow {
  position: absolute;
  inset: -30%;
  background: radial-gradient(closest-side, rgba(251, 191, 36, 0.22), transparent 70%);
  filter: blur(12px);
  pointer-events: none;
}

.hero__runner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hero__runner canvas {
  display: block;
  width: clamp(112px, 15vw, 176px);
  height: auto;
  aspect-ratio: 1;
  filter: drop-shadow(0 10px 24px rgba(56, 189, 248, 0.35));
}

.hero__runner--maya {
  transform: translateY(16px);
}

.hero__runner span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-cyan);
}

.hero__stage-note {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-disabled);
}

/* Mode and runner cards */

.card__tag {
  display: inline-block;
  margin-bottom: 10px;
  padding: 3px 9px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.08);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-cyan);
}

.card--mode-chase {
  border-color: rgba(244, 63, 94, 0.5);
}

.card--mode-chase .card__tag {
  border-color: rgba(244, 63, 94, 0.45);
  background: rgba(244, 63, 94, 0.08);
  color: #fb7185;
}

.card--mode-shadow {
  border-color: rgba(192, 38, 211, 0.5);
}

.card--mode-shadow .card__tag {
  border-color: rgba(192, 38, 211, 0.45);
  background: rgba(192, 38, 211, 0.1);
  color: #e879f9;
}

.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.card__meta li {
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.09);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.card--runner {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.runner-card__art {
  display: block;
  width: 132px;
  height: 132px;
  filter: drop-shadow(0 8px 20px rgba(56, 189, 248, 0.28));
}

.cards--tools {
  margin-top: 16px;
}

.tool-icon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  border: 1px solid currentColor;
  border-radius: 12px;
  font-size: 20px;
  line-height: 1;
}

.tool-icon--speed {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.18);
}

.tool-icon--freeze {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.18);
}

.tool-icon--compass {
  color: #34d399;
  background: rgba(52, 211, 153, 0.1);
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.18);
}

.arcade__heading--center {
  margin-top: 0;
  text-align: center;
}

/* Arena HUD additions: hearts, mode chip, tools */

.hud__group--level {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.hud__hearts {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 16px;
  line-height: 1;
}

.heart {
  color: #f43f5e;
  text-shadow: 0 0 8px rgba(244, 63, 94, 0.55);
  transition: color var(--dur-hover) linear, text-shadow var(--dur-hover) linear;
}

.heart.is-lost {
  color: #334155;
  text-shadow: none;
}

.hud__mode {
  flex: 0 1 auto;
  max-width: 118px;
  padding: 7px 10px;
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.08);
  color: var(--color-cyan);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1.1;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  touch-action: manipulation;
}

.hud__mode:hover,
.hud__mode:focus-visible {
  border-color: var(--color-cyan);
  background: rgba(56, 189, 248, 0.16);
  outline: none;
}

.hud__mode.is-chase {
  border-color: rgba(244, 63, 94, 0.55);
  background: rgba(244, 63, 94, 0.1);
  color: #fb7185;
}

.hud__mode.is-shadow {
  border-color: rgba(192, 38, 211, 0.55);
  background: rgba(192, 38, 211, 0.12);
  color: #e879f9;
}

.effect-bar {
  z-index: 2;
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.effect-bar[hidden] {
  display: none;
}

.effect-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
}

.effect-chip[hidden] {
  display: none;
}

.effect-chip b {
  font-family: var(--font-mono);
  font-weight: 600;
  opacity: 0.9;
}

.effect-chip--speed {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
}

.effect-chip--freeze {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
}

.effect-chip--compass {
  color: #34d399;
  background: rgba(52, 211, 153, 0.1);
}

/* Setup overlay */

.setup {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 14px;
  overflow: auto;
  background: radial-gradient(circle at 50% 18%, rgba(56, 189, 248, 0.16), rgba(7, 11, 20, 0.9) 62%);
  backdrop-filter: blur(4px);
}

.setup[hidden] {
  display: none;
}

.setup__panel {
  width: min(660px, 100%);
  max-height: 100%;
  padding: clamp(18px, 3vw, 30px);
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 20px;
  background: linear-gradient(180deg, #0d1a2f, #070d18 78%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(56, 189, 248, 0.1) inset;
  overflow: auto;
}

.setup__kicker {
  margin: 0 0 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-gold);
}

.setup__title {
  margin: 0 0 6px;
  font-size: clamp(22px, 4vw, 30px);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.setup__note {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-text-muted);
}

.setup__section {
  margin-bottom: 16px;
}

.setup__label {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-cyan);
}

.choices {
  display: grid;
  gap: 10px;
}

.choices--runners {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choices--modes {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.runner-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 10px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--color-text);
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color var(--dur-hover) linear, background-color var(--dur-hover) linear,
    box-shadow var(--dur-hover) linear;
}

.runner-choice__art {
  display: block;
  width: 88px;
  height: 88px;
}

.runner-choice__name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.runner-choice__tag {
  font-size: 11px;
  line-height: 1.4;
  color: var(--color-text-muted);
}

.runner-choice:hover {
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.06);
}

.runner-choice.is-selected {
  border-color: var(--color-gold);
  background: rgba(251, 191, 36, 0.08);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.3) inset;
}

.mode-choice {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color var(--dur-hover) linear, background-color var(--dur-hover) linear;
}

.mode-choice b {
  font-size: 12px;
  letter-spacing: 0.04em;
}

.mode-choice span {
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--color-text-muted);
}

.mode-choice:hover {
  border-color: rgba(56, 189, 248, 0.55);
}

.mode-choice.is-selected {
  border-color: var(--color-cyan);
  background: rgba(56, 189, 248, 0.1);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.16);
}

.start-button {
  width: 100%;
  margin-top: 4px;
  padding: 15px;
  border: none;
  border-radius: 12px;
  background: var(--color-gold);
  color: #1a1205;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 12px 30px rgba(251, 191, 36, 0.25);
  transition: transform var(--dur-press) var(--ease-out-quad), filter var(--dur-hover) linear;
}

.start-button:hover {
  filter: brightness(1.06);
}

.start-button:active {
  transform: scale(0.99);
}

.start-button:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 3px;
}

.setup__hint {
  margin: 10px 0 0;
  font-size: 11px;
  text-align: center;
  color: var(--color-text-disabled);
}

/* Arena footer */

.arena-footer {
  z-index: 3;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px max(12px, env(safe-area-inset-right, 12px)) 6px
    max(12px, env(safe-area-inset-left, 12px));
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 11px;
}

.arena-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.arena-footer a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.arena-footer a:hover,
.arena-footer a:focus-visible {
  color: var(--color-text);
}

.brand--small {
  font-size: 12px;
}

/* Responsive adjustments for the new sections */

@media (max-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 40px;
  }

  .hero__stage {
    min-height: 300px;
  }
}

@media (max-width: 640px) {
  .choices--modes {
    grid-template-columns: minmax(0, 1fr);
  }

  .card--runner {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    text-align: center;
  }

  .card--runner .card__tag {
    margin-top: 4px;
  }

  .hero__facts {
    gap: 16px;
  }

  .hero__runner canvas {
    width: 116px;
  }

  .hero__title {
    letter-spacing: -0.03em;
  }

  .hud__hearts {
    font-size: 14px;
  }

  .hud__mode {
    max-width: 86px;
    padding: 6px 8px;
    font-size: 9px;
  }

  .setup {
    padding: 8px;
  }
}

/* --------------------------------------------------------------------------
   HUD home link and +10s timer highlight
   -------------------------------------------------------------------------- */

.hud__home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-surface-raised);
  color: var(--color-text);
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color var(--dur-hover) linear,
    transform var(--dur-press) var(--ease-out-quad);
}

.hud__home svg {
  width: 20px;
  height: 20px;
  display: block;
}

.hud__home:hover,
.hud__home:focus-visible {
  background: var(--color-surface-active);
  outline: none;
}

.hud__home:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
}

.hud__home:active {
  transform: scale(0.94);
}

/* Time Boost: a brief emerald pulse on the countdown. */
.hud__time.is-boosted {
  color: #34d399;
  text-shadow: 0 0 14px rgba(52, 211, 153, 0.65);
}

@media (max-width: 430px) {
  .hud {
    --hud-pad-x: 10px;
    gap: 8px;
  }

  .hud__group--level {
    gap: 6px;
  }

  .hud__actions {
    gap: 5px;
  }

  .hud__home,
  .hud__mute,
  .hud__restart {
    width: 38px;
    height: 38px;
  }

  .hud__home svg,
  .hud__mute svg,
  .hud__restart svg {
    width: 18px;
    height: 18px;
  }

  .hud__mode {
    max-width: 66px;
    padding: 6px 7px;
    font-size: 9px;
  }

  .hud__hearts {
    gap: 1px;
    font-size: 13px;
  }
}

.effect-chip--smash {
  color: #fb7185;
  background: rgba(251, 113, 133, 0.1);
}
