/* ==========================================================================
   Road Classics: The Climb — global styles
   Brand tokens derived from roadclassics.cz + Enervit official
   ========================================================================== */

:root {
  /* Road Classics brand */
  --rc-primary: #00205b;
  --rc-primary-deep: #001230;
  --rc-cream: #f1cc7e;
  --rc-cream-soft: #f6dca6;
  --rc-bg-light: #f4f7fc;
  --rc-energy: #e53747;

  /* Enervit */
  --en-red: #e30613;
  --en-white: #ffffff;

  /* Functional */
  --ok: #198754;
  --warn: #ffc107;
  --crit: #dc3545;
  --ink: #212529;
  --muted: #6c757d;
  --line: rgba(0, 32, 91, 0.12);

  /* Type */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* Layout */
  --maxw: 1120px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-card: 0 6px 24px rgba(0, 32, 91, 0.08);
  --shadow-card-hover: 0 14px 40px rgba(0, 32, 91, 0.16);
}

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

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--rc-bg-light);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--rc-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 .5em;
  color: var(--rc-primary);
}

h1 { font-size: clamp(2rem, 6vw, 3.6rem); line-height: 1.05; }
h2 { font-size: clamp(1.4rem, 4vw, 2.2rem); }
h3 { font-size: 1.15rem; }

button { font-family: inherit; cursor: pointer; }

/* ---- shared layout ---- */
.shell { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ==========================================================================
   HOME (entry page) — wine-monochrome illustrated style
   ========================================================================== */
body.home {
  background: #00112e;
  color: var(--rc-cream);
  min-height: 100dvh;
}
body.home .shell { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.home-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 22px 20px 6px;
}
.home-topbar .brands {
  display: flex; align-items: center; gap: 14px;
}
.home-topbar .brands img { height: 26px; opacity: .9; }
.home-topbar .brands .x {
  color: var(--rc-cream-soft);
  font-size: .8rem;
  letter-spacing: .25em;
}

.home-hero {
  position: relative;
  padding: 60px 20px 80px;
  overflow: hidden;
  isolation: isolate;
}
.home-hero-art {
  position: absolute;
  inset: 0;
  background-image: url('/assets/scenes/landscapes/palava-overview-map.png');
  background-size: cover;
  background-position: center;
  opacity: 0.32;
  filter: saturate(1.05) brightness(0.85);
  z-index: -1;
}
.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(80% 100% at 50% 65%, transparent, rgba(8,2,8,0.85));
}
.home-hero-shell {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.home-hero .kicker {
  font-size: .8rem;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--rc-cream-soft);
}
.home-hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  color: var(--rc-cream);
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-shadow: 0 6px 30px rgba(0,0,0,.55);
}
.home-hero p {
  margin: 4px auto 16px;
  max-width: 540px;
  font-size: 1.05rem;
  line-height: 1.55;
  color: rgba(255,255,255,.85);
}
.home-hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.home-monuments {
  padding: 30px 20px 80px;
  position: relative;
}
.home-monuments .shell { padding: 0 0; }

.monument-grid-illustrated {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 0 20px;
}
@media (min-width: 720px) {
  .monument-grid-illustrated { grid-template-columns: 1fr 1fr 1fr; gap: 22px; padding: 0; }
}

.monument-card {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: #001026;
  border: 1px solid rgba(241, 204, 126,.18);
  isolation: isolate;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.monument-card.is-active:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 48px rgba(229, 55, 71, 0.28);
  border-color: rgba(241, 204, 126,.5);
}
.monument-card .mc-art {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 0;
  transition: transform .8s ease;
}
.monument-card.is-active:hover .mc-art { transform: scale(1.04); }
.monument-card .mc-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(8,2,8,0.15) 35%, rgba(8,2,8,0.92));
}
.monument-card .mc-body {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 2;
  padding: 22px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.monument-card .mc-date {
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--rc-cream-soft);
}
.monument-card h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  color: var(--rc-cream);
  margin: 0;
  line-height: 1;
  letter-spacing: -0.01em;
}
.monument-card .mc-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  font-size: .85rem;
  color: rgba(255,255,255,.7);
}
.monument-card .mc-stats strong {
  color: var(--rc-cream);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  margin-right: 2px;
}
.monument-card .btn {
  align-self: flex-start;
  margin-top: 4px;
}

.monument-card.is-soon {
  filter: saturate(0.85);
  opacity: 0.94;
}
.monument-card.is-soon .mc-art { filter: brightness(0.7); }
.monument-card .mc-soon {
  align-self: flex-start;
  display: inline-block;
  margin-top: 4px;
  padding: 6px 12px;
  border: 1px solid rgba(241, 204, 126,.45);
  border-radius: 999px;
  font-size: .72rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--rc-cream);
  background: rgba(8,2,8,0.4);
  backdrop-filter: blur(4px);
}

.home-footer {
  background: rgba(0,0,0,0.45);
  color: var(--rc-cream-soft);
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  font-size: .85rem;
  border-top: 1px solid rgba(241, 204, 126,.1);
}
.home-footer .shell {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
}
.home-footer a { color: var(--rc-cream); }

/* ==========================================================================
   Top bar (legacy — used inside game.html and leaderboard.html)
   ========================================================================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: var(--rc-primary);
  color: var(--rc-cream);
}
.topbar .brands { display: flex; align-items: center; gap: 18px; }
.topbar .brands img { height: 28px; }
.topbar .brands .x {
  color: var(--rc-cream-soft);
  font-size: .85rem;
  letter-spacing: .25em;
  text-transform: uppercase;
}
.topbar nav a {
  color: var(--rc-cream);
  margin-left: 18px;
  font-weight: 500;
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative;
  background: linear-gradient(180deg, var(--rc-primary) 0%, var(--rc-primary-deep) 100%);
  color: var(--rc-cream);
  padding: 64px 20px 80px;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 80% at 80% 20%, rgba(241, 204, 126, 0.18), transparent 70%);
  pointer-events: none;
}
.hero .shell { position: relative; z-index: 1; text-align: center; }
.hero h1 { color: var(--rc-cream); }
.hero .tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1rem, 2.4vw, 1.4rem);
  color: var(--rc-cream-soft);
  margin-bottom: 32px;
}
.hero .cta-row {
  display: flex; gap: 12px; flex-wrap: wrap; justify-content: center;
  margin-top: 24px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1rem;
  border: 2px solid transparent;
  transition: transform .15s, box-shadow .15s, background .15s, color .15s;
  text-decoration: none;
  min-height: 48px;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--rc-energy);
  color: #fff;
  box-shadow: 0 6px 18px rgba(229, 55, 71, 0.35);
}
.btn-primary:hover { background: #c92e3c; }

.btn-ghost {
  background: transparent;
  color: var(--rc-cream);
  border-color: var(--rc-cream);
}
.btn-ghost:hover { background: var(--rc-cream); color: var(--rc-primary); }

.btn-secondary {
  background: var(--rc-primary);
  color: var(--rc-cream);
}
.btn-secondary:hover { background: var(--rc-primary-deep); }

/* ==========================================================================
   Monument grid
   ========================================================================== */
.monuments {
  padding: 64px 20px 80px;
}
.monuments h2 {
  text-align: center;
  margin-bottom: 8px;
}
.monuments .lead {
  text-align: center;
  color: var(--muted);
  margin: 0 auto 40px;
  max-width: 640px;
}

.monument-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 720px) {
  .monument-grid { grid-template-columns: repeat(3, 1fr); }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card.is-active:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}
.card .cover {
  height: 160px;
  background: linear-gradient(135deg, var(--rc-primary), var(--rc-energy));
  position: relative;
}
.card .cover.palava { background: linear-gradient(135deg, #0a2f6b, #c8423c); }
.card .cover.vysocina { background: linear-gradient(135deg, #2d4a2b, #7fa05a); filter: grayscale(.4); }
.card .cover.jested { background: linear-gradient(135deg, #1f3a5f, #6b8aab); filter: grayscale(.4); }

.card .badge {
  position: absolute; top: 14px; left: 14px;
  background: rgba(0, 0, 0, 0.32);
  color: #fff;
  font-size: .75rem; letter-spacing: .12em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
  backdrop-filter: blur(6px);
}
.card .body {
  padding: 22px 22px 24px;
  display: flex; flex-direction: column; gap: 10px;
  flex: 1;
}
.card h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin: 0;
  color: var(--rc-primary);
}
.card .meta {
  display: flex; gap: 16px; color: var(--muted); font-size: .9rem;
}
.card .meta strong { color: var(--ink); }
.card .desc { color: var(--muted); font-size: .92rem; flex: 1; }
.card .card-cta { margin-top: 8px; }

.card.is-soon { opacity: .72; }
.card.is-soon .card-cta { pointer-events: none; }

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
  background: var(--rc-primary-deep);
  color: var(--rc-cream-soft);
  padding: 28px 20px;
  font-size: .9rem;
}
.footer .shell {
  display: flex; flex-wrap: wrap; gap: 16px;
  justify-content: space-between; align-items: center;
}
.footer a { color: var(--rc-cream); }

/* ==========================================================================
   Game screen
   ========================================================================== */
body.game {
  background: #0c0a08;
  color: #fff;
  overflow: hidden;
  height: 100dvh;
}

.game-stage {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

#game-canvas {
  width: 100%;
  height: 100%;
  max-width: 1400px;
  display: block;
  margin: 0 auto;
  background: linear-gradient(180deg, #00112e 0%, #001026 55%, #002a6b 100%);
  touch-action: manipulation;
}

/* MapLibre race map — full-screen behind the HUD during race scene */
#race-map {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: none;
  background: #00112e;
}
body.race-active #race-map { display: block; }
body.race-active #game-canvas { display: none; }
body.race-active .game-stage { background: transparent; }

/* MapLibre attribution: keep it tiny + corner */
.maplibregl-ctrl-attrib {
  font-size: 9px !important;
  background: rgba(8,2,8,0.55) !important;
  color: rgba(255,255,255,0.5) !important;
}
.maplibregl-ctrl-attrib a { color: rgba(255,255,255,0.6) !important; }

/* Bike markers on the map */
.map-bike-marker {
  width: 56px;
  height: 68px;                  /* taller — top-down rider is a vertical shape */
  display: block;
  overflow: hidden;
  pointer-events: none;
  will-change: transform;
  /* Transparent top-down cyclist (white bg chroma-keyed out) */
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.6));
}
.map-bike-marker img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(1.5);
  transform-origin: 50% 50%;
}
.map-bike-marker.map-player {
  width: 74px;
  height: 88px;
  filter: drop-shadow(0 4px 10px rgba(229,55,71,0.7));
}
.map-bike-marker.map-player::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(229,55,71,0.4), transparent 70%);
  z-index: -1;
  animation: player-pulse 2s ease-in-out infinite;
}
@keyframes player-pulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50%      { transform: scale(1.15); opacity: 1; }
}
.map-bike-marker.map-passed { animation: faded-pass 0.5s ease forwards; }
@keyframes faded-pass {
  0%   { transform: scale(1); }
  100% { transform: scale(0.85); opacity: 0.65; }
}

/* Station markers (small Enervit tents on map) */
.map-station-marker {
  width: 38px;
  height: 38px;
  pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.5));
}
.map-station-marker img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.map-station-marker.map-station-collected { opacity: 0.4; filter: grayscale(0.7); }

/* Loading state for the map */
.map-loading {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8,2,8,0.78);
  color: var(--rc-cream);
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: .05em;
  text-align: center;
  padding: 20px;
  backdrop-filter: blur(6px);
}

.hud-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(0,0,0,0.55), transparent);
  pointer-events: none;
  z-index: 5;
}
.hud-top .timer {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: .04em;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,.5);
}
.hud-top .monument-name {
  font-size: .85rem;
  color: var(--rc-cream-soft);
  letter-spacing: .2em;
  text-transform: uppercase;
  text-align: right;
}

.profile-mini {
  position: relative;
  width: 100%;
  height: 56px;
  background: rgba(255,255,255,.06);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
}
.profile-mini svg { width: 100%; height: 100%; display: block; }
.profile-mini .pos-marker {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--rc-energy);
  box-shadow: 0 0 12px var(--rc-energy);
  left: 0;
  transition: left .1s linear;
}

.hud-bottom {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  background: linear-gradient(0deg, rgba(0,0,0,0.55), transparent);
  z-index: 5;
  pointer-events: none;
}
@media (max-width: 720px) {
  .hud-bottom {
    grid-template-columns: minmax(0, 220px) minmax(0, 220px);
    justify-content: center;
    gap: 8px;
  }
  .hud-bottom .gauge { padding: 8px 12px; }
  .hud-bottom .gauge .value { font-size: 1.2rem; }
  .hud-bottom .gauge .label { font-size: .62rem; }
  .hud-bottom .cadence-zones { display: none; }
}

.gauge {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 10px 12px;
}
.gauge .label {
  font-size: .7rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(255,255,255,.6);
  margin-bottom: 6px;
}
.gauge .value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
}
.bar {
  height: 8px;
  background: rgba(255,255,255,.1);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--ok);
  width: 100%;
  transition: width .15s, background .2s;
}
.bar.warn > span { background: var(--warn); }
.bar.crit > span { background: var(--crit); }

.cadence-zones {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
  gap: 2px;
  margin-top: 6px;
  height: 8px;
}
.cadence-zones span {
  background: rgba(255,255,255,.1);
  border-radius: 2px;
}
.cadence-zones span.lit { background: currentColor; }
.cadence-zones[data-zone="low"]    { color: var(--muted); }
.cadence-zones[data-zone="below"]  { color: var(--warn); }
.cadence-zones[data-zone="ideal"]  { color: var(--ok); }
.cadence-zones[data-zone="above"]  { color: var(--warn); }
.cadence-zones[data-zone="anaer"]  { color: var(--crit); }

.tap-zone {
  position: fixed;
  inset: 0;
  z-index: 4;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;          /* no double-tap zoom delay */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;          /* no long-press iOS context menu */
}

.kbd-hint {
  position: fixed;
  bottom: calc(120px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  background: rgba(0,0,0,.45);
  border-radius: 999px;
  font-size: .85rem;
  letter-spacing: .04em;
  z-index: 6;
  backdrop-filter: blur(6px);
  pointer-events: none;
  transition: opacity .4s;
}
.kbd-hint.fade { opacity: 0; }
.kbd-hint kbd {
  font-family: var(--font-body);
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  padding: 2px 8px;
  border-radius: 6px;
  margin: 0 4px;
}
@media (max-width: 720px) {
  .kbd-hint .desktop, .start-overlay .desktop { display: none; }
}
@media (min-width: 721px) {
  .kbd-hint .mobile, .start-overlay .mobile { display: none; }
}

/* Segment banner — appears top-center when entering a new segment */
.segment-banner {
  position: fixed;
  top: calc(80px + env(safe-area-inset-top));
  left: 50%;
  transform: translate(-50%, -16px);
  padding: 10px 22px;
  background: rgba(0, 32, 91, 0.85);
  color: var(--rc-cream);
  border: 1px solid rgba(241, 204, 126, 0.4);
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .02em;
  white-space: nowrap;
  opacity: 0;
  z-index: 6;
  pointer-events: none;
  transition: transform .4s ease, opacity .4s ease;
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
.segment-banner.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.segment-banner .gradient {
  display: inline-block;
  margin-left: 10px;
  padding: 1px 8px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: .8rem;
  background: rgba(241, 204, 126, 0.18);
}
.segment-banner.up   .gradient { color: var(--rc-energy); }
.segment-banner.down .gradient { color: var(--ok); }

/* ==========================================================================
   SCENE OVERLAYS — multi-stage Pálava day flow
   ========================================================================== */
.scene-overlay {
  position: fixed;
  inset: 0;
  z-index: 14;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  text-align: center;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(2,9,26,0.78) 0%, rgba(0, 32, 91,0.94) 100%);
  color: #fff;
  overflow-y: auto;
  opacity: 0;
  transition: opacity .35s ease;
}
.scene-overlay.show { display: flex; opacity: 1; }
.scene-overlay .bg-art {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.35;
  filter: saturate(1.05) brightness(0.85);
  z-index: -1;
}
.scene-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(60% 70% at 50% 50%, transparent, rgba(2,9,26,0.65));
}

.intro-shell, .prerace-shell {
  position: relative;
  z-index: 1;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.scene-overlay .kicker {
  font-size: .75rem;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--rc-cream-soft);
  margin-bottom: 4px;
}
.scene-overlay .title-display {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 8vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--rc-cream);
  margin: 0;
}
.scene-overlay .lead {
  font-size: 1rem;
  line-height: 1.5;
  color: rgba(255,255,255,.86);
  max-width: 460px;
  margin: 0;
}
.scene-overlay .step-pill {
  font-size: .7rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  background: rgba(241, 204, 126,.18);
  color: var(--rc-cream);
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid rgba(241, 204, 126,.35);
}
.scene-overlay .prerace-foot {
  font-size: .82rem;
  color: var(--rc-cream-soft);
  opacity: .8;
}
.scene-overlay .back {
  margin-top: 6px;
  font-size: .85rem;
  color: var(--rc-cream-soft);
}

/* Intro stat cards */
.intro-stats {
  display: flex;
  gap: 18px;
  margin: 8px 0 6px;
}
.intro-stats > div {
  text-align: center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(241, 204, 126,.2);
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 80px;
}
.intro-stats strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--rc-cream);
  line-height: 1;
}
.intro-stats span {
  font-size: .68rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(255,255,255,.6);
}
.btn.big { padding: 16px 30px; font-size: 1.05rem; }

/* Choice buttons (breakfast etc.) */
.choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 460px;
  margin-top: 6px;
}
.choice {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(241, 204, 126,.3);
  border-radius: 14px;
  color: #fff;
  padding: 14px 18px;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: transform .12s, background .15s;
}
.choice:hover, .choice:focus-visible {
  transform: translateY(-2px);
  background: rgba(241, 204, 126,.18);
  outline: none;
}
.choice .choice-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--rc-cream);
  margin-bottom: 2px;
}
.choice .choice-sub {
  font-size: .85rem;
  color: rgba(255,255,255,.7);
}

/* Breakfast — illustrated food cards */
.food-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: 100%;
  max-width: 480px;
  margin-top: 6px;
}
@media (min-width: 540px) {
  .food-cards { grid-template-columns: 1fr 1fr 1fr; }
}
.food-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(241, 204, 126,.32);
  border-radius: 16px;
  padding: 14px 12px;
  font-family: inherit;
  cursor: pointer;
  transition: transform .15s, background .15s, border-color .15s;
  color: #fff;
  text-align: center;
}
.food-card:hover, .food-card:focus-visible {
  transform: translateY(-4px);
  background: rgba(241, 204, 126,.18);
  border-color: var(--rc-cream);
  outline: none;
}
.food-card-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.35));
}
.food-card-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--rc-cream);
}
.food-card-sub {
  font-size: .78rem;
  color: rgba(255,255,255,.72);
  line-height: 1.4;
}

/* Bike check (garage) gauge */
.gauge-wrap {
  width: 100%;
  max-width: 420px;
  margin-top: 8px;
}
.gauge-bar {
  position: relative;
  height: 22px;
  background: rgba(255,255,255,.08);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(241, 204, 126,.2);
}
.gauge-target {
  position: absolute;
  left: 80%; right: 8%;
  top: 0; bottom: 0;
  background: rgba(25,135,84,.35);
}
.gauge-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  background: linear-gradient(90deg, var(--rc-cream-soft), var(--rc-energy));
  transition: width .06s linear;
}
.gauge-overload {
  position: absolute;
  left: 92%; top: 0; bottom: 0;
  width: 0;
  background: var(--crit);
}
.gauge-readout {
  text-align: center;
  margin-top: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--rc-cream);
}
.gauge-readout small { font-size: .7rem; color: rgba(255,255,255,.6); margin-left: 4px; }
.btn-pump {
  width: 100%;
  max-width: 320px;
  padding: 18px;
  margin: 6px 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 999px;
  border: 2px solid var(--rc-cream);
  background: rgba(241,204,126,.16);
  color: #fff;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.btn-pump:active { background: var(--rc-cream); color: var(--rc-primary); transform: scale(0.98); }

/* Jersey packing scene */
.packing-stage {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 6px;
}
.jersey {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  background: linear-gradient(180deg, rgba(0,42,107,0.55), rgba(0,32,91,0.35));
  border: 2px solid rgba(241,204,126,.35);
  border-radius: 12px;
  padding: 16px 12px;
}
.pocket {
  background: rgba(0,0,0,.25);
  border: 1px dashed rgba(241, 204, 126,.35);
  border-radius: 8px;
  padding: 10px 6px;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
.pocket .lbl {
  font-size: .65rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255,255,255,.55);
  margin-bottom: 4px;
}
.tray {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(241, 204, 126,.2);
  border-radius: 12px;
  padding: 10px;
  min-height: 60px;
  justify-content: center;
}
.pack-chip {
  font-family: inherit;
  border: 1px solid rgba(241, 204, 126,.3);
  border-radius: 10px;
  padding: 4px 6px 4px 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--rc-cream);
  background: rgba(255,255,255,.08);
  transition: transform .12s, background .15s, box-shadow .15s, border-color .15s;
}
.pack-chip:hover { background: rgba(241, 204, 126,.16); }
.pack-chip:active { transform: scale(0.95); }
.pack-chip.selected {
  border-color: var(--rc-cream);
  box-shadow: 0 0 0 2px var(--rc-cream), 0 0 18px rgba(241, 204, 126,.5);
  transform: translateY(-2px);
}
.pocket.targetable {
  background: rgba(241, 204, 126,.18);
  border-style: solid;
  border-color: var(--rc-cream);
}
.pocket.reject {
  animation: pocket-reject 0.3s ease-out;
}
@keyframes pocket-reject {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.pack-img {
  width: 28px;
  height: 28px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 6px;
  background-color: rgba(255,255,255,.92);
  flex-shrink: 0;
}
.pack-name {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
}
/* Per-product subtle background tint behind the icon */
.pack-chip.pack-gel       .pack-img { background-color: rgba(255,140,0,.20); }
.pack-chip.pack-caffeine  .pack-img { background-color: rgba(74,32,16,.32); }
.pack-chip.pack-jelly     .pack-img { background-color: rgba(255,180,80,.22); }
.pack-chip.pack-chews     .pack-img { background-color: rgba(244,114,148,.22); }
.pack-chip.pack-bar       .pack-img { background-color: rgba(42,139,58,.20); }
.pack-chip.pack-drink     .pack-img { background-color: rgba(31,120,209,.20); }
.pack-chip.pack-banana    .pack-img { background-color: rgba(255,213,68,.22); }

/* Bidon scene — illustration is decorative, gauge below is the actual UI */
.bidon-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-top: 6px;
}
.bidon-graphic {
  position: relative;
  width: 130px;
  height: 200px;
  transition: filter .25s, transform .25s;
}
.bidon-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.4));
}
.bidon-graphic.on-target {
  filter: drop-shadow(0 0 22px rgba(25,135,84,.85)) drop-shadow(0 4px 8px rgba(0,0,0,.3));
  transform: translateY(-2px);
}
.bidon-graphic.overflow {
  animation: bidon-shake 0.4s ease-in-out infinite;
  filter: drop-shadow(0 0 18px rgba(220,53,69,.85));
}
@keyframes bidon-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-3px); }
  75%      { transform: translateX( 3px); }
}
/* Pouring stream — appears above bidon while holding */
.bidon-pour {
  position: absolute;
  left: 50%;
  top: -28px;
  transform: translateX(-50%);
  width: 4px;
  height: 32px;
  background: linear-gradient(180deg, transparent, rgba(80,160,255,0.9));
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
  border-radius: 0 0 4px 4px;
}
.bidon-readout {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.2rem;
  color: var(--rc-cream);
  min-width: 90px;
}
.bidon-readout small { font-size: .5em; color: rgba(255,255,255,.6); margin-left: 4px; }

/* Horizontal gauge bar shows level + target band + overflow zone */
.bidon-gauge {
  position: relative;
  width: 100%;
  max-width: 360px;
  height: 22px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(241, 204, 126,.25);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}
.bidon-gauge-target {
  position: absolute;
  left: 55%; width: 15%;
  top: 0; bottom: 0;
  background: rgba(25,135,84,0.32);
  border-left: 1px dashed rgba(25,135,84,.7);
  border-right: 1px dashed rgba(25,135,84,.7);
}
.bidon-gauge-overflow {
  position: absolute;
  left: 92%; right: 0;
  top: 0; bottom: 0;
  background: rgba(220,53,69,0.4);
}
.bidon-gauge-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  background: linear-gradient(90deg, rgba(80,160,255,0.85), rgba(50,110,200,0.95));
  transition: width .06s linear;
}
.bidon-gauge-marks {
  position: relative;
  width: 100%;
  height: 14px;
  margin-top: 2px;
  font-size: .65rem;
  color: rgba(255,255,255,.55);
}
.bidon-gauge-marks span {
  position: absolute;
  transform: translateX(-50%);
}

/* Drive transition summary */
.scene-drive .bg-art { opacity: 0.55; }
.prep-summary {
  font-size: .92rem;
  line-height: 1.6;
  color: var(--rc-cream-soft);
  background: rgba(0,0,0,.35);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 6px 0;
}

/* Landmark chapter card — fired when crossing into a new race zone */
.landmark-card {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s ease;
  background: linear-gradient(180deg, rgba(8,2,8,0.55), rgba(40,5,22,0.78));
  backdrop-filter: blur(4px);
}
.landmark-card.show { opacity: 1; }
.landmark-card .lm-art {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.82;
  transform: scale(1.06);
  transition: transform 1.6s ease, opacity 0.4s ease;
}
.landmark-card.show .lm-art { transform: scale(1.0); }
.landmark-card::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(60% 70% at 50% 60%, transparent, rgba(8,2,8,0.7));
}
.landmark-card .lm-text {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 560px;
  padding: 0 24px;
  transform: translateY(8px);
  opacity: 0;
  transition: transform .5s ease .15s, opacity .5s ease .15s;
}
.landmark-card.show .lm-text { transform: translateY(0); opacity: 1; }
.landmark-card .lm-kicker {
  font-size: .8rem;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--rc-cream-soft);
  margin-bottom: 10px;
}
.landmark-card .lm-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 7vw, 3.4rem);
  color: var(--rc-cream);
  margin: 0 0 6px;
  line-height: 1.05;
  text-shadow: 0 8px 36px rgba(0,0,0,.6);
}
.landmark-card .lm-sub {
  margin: 0;
  font-size: 1rem;
  color: rgba(255,255,255,.86);
}
.landmark-card .lm-actions {
  position: absolute;
  bottom: calc(28px + env(safe-area-inset-bottom));
  left: 20px;
  right: 20px;
  z-index: 2;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  opacity: 0;
  transition: opacity .25s ease;
}
.landmark-card.show .lm-actions { opacity: 1; transition-delay: 0.5s; }
.landmark-card .lm-btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 22px;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  pointer-events: auto;
  transition: transform .15s ease, background .15s ease;
  box-shadow: 0 8px 22px rgba(0,0,0,.45);
  min-width: 140px;
}
.landmark-card .lm-capture {
  background: rgba(241, 204, 126, 0.95);
  color: var(--rc-primary);
}
.landmark-card .lm-continue {
  background: var(--rc-energy);
  color: #fff;
}
.landmark-card .lm-btn:hover { transform: translateY(-2px); }
.landmark-card .lm-btn:active { transform: scale(0.97); }

/* Route map preview */
.scene-map .map-stage {
  width: 100%;
  max-width: 620px;
  background: rgba(8,2,8,0.55);
  border: 1px solid rgba(241, 204, 126,.3);
  border-radius: 14px;
  padding: 14px;
  margin-top: 8px;
}
.scene-map svg { width: 100%; height: auto; display: block; }
.map-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  font-family: var(--font-body);
}
.map-pin .pin-dot {
  display: none;
}
.map-pin .pin-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--rc-cream);
  background: rgba(8,2,8,0.85);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: .04em;
}

/* Mid-race café stop scene */
.scene-cafe .food-cards { grid-template-columns: 1fr 1fr; }
@media (min-width: 540px) {
  .scene-cafe .food-cards { grid-template-columns: 1fr 1fr 1fr 1fr; }
}
.food-card.food-skip {
  background: rgba(0,0,0,0.35);
  border-style: dashed;
}
.food-card-skip {
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 2.6rem;
  color: var(--rc-cream-soft);
  background: none !important;
}

/* Race countdown */
.race-countdown {
  position: fixed;
  inset: 0;
  z-index: 16;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(2,9,26,0.5);
  backdrop-filter: blur(2px);
}
.race-countdown .num {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(6rem, 30vw, 14rem);
  color: var(--rc-cream);
  text-shadow: 0 8px 40px rgba(229,55,71,.6);
}
.race-countdown .num.flash {
  animation: cd-flash 0.6s ease-out;
}
@keyframes cd-flash {
  0%   { transform: scale(0.4); opacity: 0; }
  50%  { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1.0); opacity: 1; }
}

/* Afterparty multi-panel evening flow */
.scene-afterparty {
  background: linear-gradient(180deg, rgba(8,2,8,0.92), rgba(40,5,22,0.96));
}
.ap-stage {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: stretch;
}
.ap-art {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  border-radius: 14px;
  border: 1px solid rgba(241, 204, 126,.2);
  box-shadow: 0 18px 48px rgba(0,0,0,.5);
  transition: opacity .35s ease, transform .35s ease;
}
.ap-vignette {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  padding: 0 4px;
}
.ap-step {
  font-size: .72rem;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--rc-cream-soft);
}
.ap-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.4rem, 4vw, 2rem);
  color: var(--rc-cream);
  margin: 0;
}
.ap-body {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(255,255,255,.86);
}
.ap-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* Tap-to-start overlay (legacy fallback when scenes off) */
.start-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(2,9,26,.6) 0%, rgba(2,9,26,.85) 100%);
  backdrop-filter: blur(6px);
  color: #fff;
  transition: opacity .35s ease;
}
.start-overlay.hide {
  opacity: 0;
  pointer-events: none;
}
.start-overlay h2 {
  font-family: var(--font-display);
  color: var(--rc-cream);
  margin: 0;
  font-size: clamp(1.6rem, 6vw, 2.4rem);
}
.start-overlay p {
  margin: 0;
  max-width: 360px;
  color: rgba(255,255,255,.82);
  font-size: .95rem;
  line-height: 1.45;
}
.start-overlay kbd {
  font-family: var(--font-body);
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.25);
  padding: 2px 8px;
  border-radius: 6px;
  margin: 0 2px;
  font-size: .85em;
  color: var(--rc-cream);
}
.start-overlay .pulse {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--rc-energy);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-top: 8px;
  box-shadow: 0 0 0 0 rgba(229,55,71,.7);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(229,55,71,.7); transform: scale(1); }
  70%  { box-shadow: 0 0 0 26px rgba(229,55,71,0); transform: scale(1.04); }
  100% { box-shadow: 0 0 0 0 rgba(229,55,71,0);   transform: scale(1); }
}

/* ==========================================================================
   Pickup floating feedback — "+25 ENERVIT GEL"
   ========================================================================== */
.pickup-toast {
  position: fixed;
  left: 50%;
  bottom: calc(180px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--en-red);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .04em;
  z-index: 7;
  pointer-events: none;
  box-shadow: 0 10px 30px rgba(227, 6, 19, 0.45);
  opacity: 0;
  animation: toast-up 1.6s ease forwards;
  white-space: nowrap;
}
.pickup-toast small {
  display: block;
  font-weight: 500;
  font-size: .7rem;
  opacity: .85;
  letter-spacing: .12em;
  text-transform: uppercase;
}
@keyframes toast-up {
  0%   { opacity: 0; transform: translate(-50%, 14px); }
  15%  { opacity: 1; transform: translate(-50%, 0); }
  80%  { opacity: 1; transform: translate(-50%, -36px); }
  100% { opacity: 0; transform: translate(-50%, -64px); }
}
.pickup-toast.overtake-toast {
  background: var(--ok);
  box-shadow: 0 10px 30px rgba(25, 135, 84, 0.45);
  bottom: calc(220px + env(safe-area-inset-bottom));
}

/* ==========================================================================
   Tactics modal — full-screen pause with 3 choices + countdown
   ========================================================================== */
.tactic-modal {
  position: fixed;
  inset: 0;
  z-index: 11;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  text-align: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  gap: 18px;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(2,9,26,0.78) 0%, rgba(0, 32, 91, 0.88) 100%);
  backdrop-filter: blur(8px);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.tactic-modal.show { opacity: 1; pointer-events: auto; }

.tactic-modal .ctx {
  font-size: .8rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--rc-cream-soft);
}
.tactic-modal h3 {
  font-family: var(--font-display);
  color: var(--rc-cream);
  font-size: clamp(1.4rem, 5vw, 2rem);
  margin: 0;
  max-width: 520px;
}
.tactic-modal .sub {
  margin: 0 0 6px;
  color: rgba(255,255,255,.7);
  max-width: 420px;
}
.tactic-options {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tactic-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(241, 204, 126,.35);
  color: #fff;
  border-radius: 14px;
  padding: 14px 18px;
  text-align: left;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  transition: transform .12s, background .15s, border-color .15s;
  min-height: 60px;
}
.tactic-btn:hover, .tactic-btn:focus-visible {
  background: rgba(241, 204, 126,.18);
  transform: translateY(-1px);
  outline: none;
}
.tactic-btn .hint {
  font-size: .8rem;
  font-weight: 400;
  color: var(--rc-cream-soft);
}
.tactic-btn[data-id="attack"] { border-color: rgba(229,55,71,.6); }
.tactic-btn[data-id="attack"]:hover { background: rgba(229,55,71,.18); }
.tactic-btn[data-id="refuel"] { border-color: rgba(227,6,19,.6); }
.tactic-btn[data-id="refuel"]:hover { background: rgba(227,6,19,.18); }

.tactic-countdown {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--rc-cream);
  letter-spacing: .04em;
}
.tactic-countdown .ring {
  display: inline-block;
  width: 32px;
  height: 32px;
  margin-left: 10px;
  border-radius: 50%;
  vertical-align: middle;
  background: conic-gradient(var(--rc-energy) 0deg, rgba(241, 204, 126,.18) 0);
  position: relative;
  transition: background 0.06s linear;
}
.tactic-countdown .ring::after {
  content: "";
  position: absolute;
  inset: 5px;
  background: rgba(20, 14, 22, 0.95);
  border-radius: 50%;
}

/* ==========================================================================
   Tactic incoming hint (small ribbon above HUD)
   ========================================================================== */
.tactic-incoming {
  position: fixed;
  top: calc(126px + env(safe-area-inset-top));
  left: 50%;
  transform: translate(-50%, -10px);
  background: rgba(229,55,71,.92);
  color: #fff;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .04em;
  z-index: 6;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  box-shadow: 0 6px 18px rgba(229,55,71,.4);
}
.tactic-incoming.show { opacity: 1; transform: translate(-50%, 0); }
.tactic-incoming.good { background: rgba(25, 135, 84, 0.95); box-shadow: 0 6px 18px rgba(25,135,84,.4); }
.tactic-incoming.bad  { background: rgba(220, 53, 69, 0.95); }
.tactic-incoming.ok   { background: rgba(241, 204, 126, 0.95); color: var(--rc-primary); }
.tactic-incoming strong { margin-left: 8px; font-weight: 800; }

/* ==========================================================================
   FINISH SCREEN — modal shown when player crosses the finish line
   ========================================================================== */
.finish-modal {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  text-align: center;
  gap: 16px;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(2,9,26,.85) 0%, rgba(0, 32, 91, 0.94) 100%);
  backdrop-filter: blur(10px);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
  overflow-y: auto;
}
.finish-modal.show { opacity: 1; pointer-events: auto; }

.finish-modal .ribbon {
  font-family: var(--font-display);
  font-size: clamp(2rem, 7vw, 3.4rem);
  color: var(--rc-cream);
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1;
}
.finish-modal .stamp {
  font-size: .8rem;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: rgba(241, 204, 126,.7);
}

.finish-score {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 10vw, 4rem);
  color: var(--rc-energy);
  text-shadow: 0 4px 20px rgba(229,55,71,.5);
  line-height: 1;
  margin: 4px 0;
}
.finish-score small {
  display: block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.28em;
  color: var(--rc-cream-soft);
  letter-spacing: .2em;
  text-transform: uppercase;
  margin-top: 6px;
}

.finish-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 460px;
}
.finish-stats .stat {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(241, 204, 126,.2);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
}
.finish-stats .stat .lab {
  font-size: .68rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: rgba(255,255,255,.6);
}
.finish-stats .stat .val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.45rem;
  color: #fff;
  margin-top: 2px;
}
.finish-stats .stat .sub {
  font-size: .75rem;
  color: var(--rc-cream-soft);
  margin-top: 2px;
}

.finish-style {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(241, 204, 126,.15);
  border: 1px solid rgba(241, 204, 126,.4);
  border-radius: 999px;
  padding: 8px 18px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--rc-cream);
  letter-spacing: .04em;
}
.finish-style .glyph {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--rc-energy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #fff;
}

.finish-pb {
  font-size: .85rem;
  color: var(--rc-cream-soft);
}
.finish-pb.new {
  color: var(--ok);
  font-weight: 600;
}

.finish-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 6px;
}
.finish-actions .btn {
  min-width: 140px;
}

/* Confetti — drawn as falling colored squares */
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 13;
  overflow: hidden;
}
.confetti span {
  position: absolute;
  width: 8px;
  height: 12px;
  top: -20px;
  opacity: 0.95;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0.4; }
}

/* ==========================================================================
   LIVE STATS — speed/distance shown beneath HUD timer + monument name
   ========================================================================== */
.hud-top .timer-block,
.hud-top .name-block {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.hud-top .timer-sub,
.hud-top .name-sub {
  font-size: 0.72rem;
  color: var(--rc-cream-soft);
  letter-spacing: 0.06em;
  margin-top: 2px;
  font-weight: 500;
}
.hud-top .name-block { text-align: right; align-items: flex-end; }
.hud-top .score-pop {
  display: inline-block;
  margin-left: 8px;
  background: rgba(255,255,255,.12);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .72rem;
  color: var(--rc-cream);
  font-weight: 700;
  letter-spacing: .04em;
  transition: transform .25s, background .25s;
}
.hud-top .score-pop.bump {
  transform: scale(1.18);
  background: var(--ok);
  color: #fff;
}
.hud-top .score-pop.minus {
  background: var(--crit);
  color: #fff;
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* ── Mobile fix: keep tactic/finish modal buttons reachable on short phones ── */
@media (max-height: 780px) {
  .finish-modal { gap: 9px; padding-top: 14px; }
  .finish-modal .finish-logos { display: none; }   /* branding lives elsewhere; save vertical space */
  .finish-modal .finish-stats { gap: 7px; }
  .tactic-modal { gap: 12px; padding-top: 16px; }
}
/* Pin the post-race actions to the bottom of the scroll area so they are
   always tappable regardless of content height. */
.finish-modal .finish-actions {
  position: sticky;
  bottom: 0;
  width: 100%;
  padding: 12px 0 4px;
  background: linear-gradient(to top, rgba(2,9,26,0.97) 55%, rgba(2,9,26,0));
}

/* Ensure modal buttons respond instantly to taps (no 300ms delay, no gesture
   capture) and always sit above the steering layer. */
.tactic-btn, .finish-actions .btn, #pump-btn {
  touch-action: manipulation;
  pointer-events: auto;
}

/* When the game is paused (a modal is open), no pointer input may reach the
   map or steering layer — guarantees decision/finish buttons get every tap. */
body.game-paused #race-map,
body.game-paused #tap-zone,
body.game-paused .maplibregl-canvas-container,
body.game-paused #race-map canvas { pointer-events: none !important; touch-action: none !important; }

/* "built by juraj.digital" credit — subtle, bottom-right */
.built-by {
  position: fixed;
  right: 10px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 90;
  font: 600 11px/1 var(--font-body);
  letter-spacing: .02em;
  color: rgba(241, 204, 126, .55);
  text-decoration: none;
  pointer-events: auto;
}
.built-by:hover { color: var(--rc-cream); text-decoration: none; }
body.game .built-by { color: rgba(241, 204, 126, .45); }
