/* ==========================================================================
   DN1 Survival — Stylesheet (Phase 1)
   Pure CSS3, zero external dependencies
   ========================================================================== */

:root {
  --bg-deep: #0b1017;
  --glass-bg: rgba(15, 23, 34, 0.72);
  --glass-card-bg: rgba(13, 19, 28, 0.84);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-highlight: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-blue: #3b82f6;
  --accent-cyan: #38bdf8;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --accent-emerald: #10b981;
  --dn1-red: #dc2626;
  --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', 'Segoe UI Mono', SFMono-Regular, Menlo, Consolas, monospace;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-pill: 999px;
  --shadow-card: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.app-shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
}

#game-canvas {
  display: block;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* ==========================================================================
   Glassmorphic Surfaces
   ========================================================================== */

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 1px 0 var(--glass-highlight) inset;
}

.glass-card {
  background: var(--glass-card-bg);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-card);
}

/* ==========================================================================
   Top Floating Bar: HUD & Language Toggle
   ========================================================================== */

.top-bar {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: calc(14px + env(safe-area-inset-left, 0px));
  right: calc(14px + env(safe-area-inset-right, 0px));
  z-index: 30;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.hud-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 166px);
}

.hud {
  pointer-events: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  transition: transform 0.18s ease, opacity 0.25s ease;
}

.hud.score-pop {
  transform: scale(1.03);
}

.hud-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 50px;
}

.hud-stat--speed {
  min-width: 74px;
}

.hud-label {
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.hud-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(0.88rem, 2.1vw, 1.08rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
  white-space: nowrap;
}

.hud-value.is-throttling {
  color: #fbbf24;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.48);
}

.hud-value.is-boosted {
  color: #38bdf8;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.55);
}

.hud-value.is-braking {
  color: #34d399;
}

.hud-value.is-radar-danger {
  color: #f87171;
  text-shadow: 0 0 12px rgba(248, 113, 113, 0.65);
}

.hud-best {
  color: var(--accent-amber);
}

.hud-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.12);
}

.hud-phase {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.hud-phase[data-phase="sunset"] {
  background: rgba(249, 115, 22, 0.16);
  border-color: rgba(251, 146, 60, 0.35);
  color: #fdba74;
}

.hud-phase[data-phase="night"] {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(96, 165, 250, 0.35);
  color: #bfdbfe;
}

.hud-phase[data-phase="dawn"] {
  background: rgba(244, 114, 182, 0.15);
  border-color: rgba(244, 114, 182, 0.35);
  color: #fbcfe8;
}

.hud-phase-icon {
  font-size: 0.85rem;
  line-height: 1;
}

/* Active Power-Up Pills */
.powerup-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  pointer-events: none;
}

.powerup-bar:empty {
  display: none;
}

.pu-pill {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: rgba(13, 19, 28, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 0.73rem;
  font-weight: 800;
  color: #f8fafc;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32);
}

.pu-pill-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  opacity: 0.25;
  pointer-events: none;
  transition: width 0.08s linear;
}

.pu-pill--coffee {
  border-color: rgba(245, 158, 11, 0.55);
  color: #fde68a;
}

.pu-pill--coffee .pu-pill-fill {
  background: #f59e0b;
}

.pu-pill--vignette {
  border-color: rgba(56, 189, 248, 0.55);
  color: #bae6fd;
}

.pu-pill--vignette .pu-pill-fill {
  background: #38bdf8;
}

.pu-pill--lpg {
  border-color: rgba(59, 130, 246, 0.6);
  color: #93c5fd;
}

.pu-pill--lpg .pu-pill-fill {
  background: #3b82f6;
}

.pu-pill--cb {
  border-color: rgba(16, 185, 129, 0.62);
  color: #a7f3d0;
}

.pu-pill--cb .pu-pill-fill {
  background: #10b981;
}

.pu-pill--throttle {
  border-color: rgba(251, 191, 36, 0.52);
  color: #fde68a;
}

.pu-pill--throttle .pu-pill-fill {
  background: #f59e0b;
}

.pu-pill--combo {
  border-color: rgba(248, 113, 113, 0.52);
  color: #fecaca;
}

.pu-pill--combo .pu-pill-fill {
  background: #ef4444;
}

.pu-pill-timer {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.7rem;
  opacity: 0.92;
}

/* Top-right Pause, Audio Mute & RO / EN Toggle */
.top-controls {
  pointer-events: auto;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pause-btn,
.mute-btn {
  appearance: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.pause-btn:hover,
.mute-btn:hover {
  border-color: rgba(56, 189, 248, 0.45);
  color: #ffffff;
  transform: translateY(-1px);
}

.pause-btn:active,
.mute-btn:active {
  transform: scale(0.95);
}

.pause-icon,
.mute-icon {
  width: 17px;
  height: 17px;
  display: block;
}

.pause-icon--play,
.mute-icon--off {
  display: none;
}

.pause-btn.is-paused {
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(14, 116, 144, 0.42);
}

.pause-btn.is-paused .pause-icon--pause {
  display: none;
}

.pause-btn.is-paused .pause-icon--play {
  display: block;
}

.mute-btn.is-muted {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.36);
  background: rgba(127, 29, 29, 0.42);
}

.mute-btn.is-muted .mute-icon--on {
  display: none;
}

.mute-btn.is-muted .mute-icon--off {
  display: block;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 4px;
  border-radius: var(--radius-pill);
  gap: 3px;
  flex-shrink: 0;
}

.lang-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

.lang-btn:hover {
  color: var(--text-primary);
}

.lang-btn[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(14, 165, 233, 0.85));
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.35);
}

.pause-btn:focus-visible,
.mute-btn:focus-visible,
.lang-btn:focus-visible,
.car-card:focus-visible,
.paint-swatch:focus-visible,
.legend-toggle-btn:focus-visible,
.legend-close-x:focus-visible,
.ro-plate--interactive:focus-within,
.primary-btn:focus-visible,
.secondary-btn:focus-visible,
.share-btn:focus-visible,
.install-btn:focus-visible,
.quick-toggle-btn:focus-visible,
.horn-btn:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* ==========================================================================
   Bottom HUD Action Bar: Horn Button (Desktop & Mobile) & Touch Pedals
   ========================================================================== */

.touch-hints {
  position: fixed;
  left: calc(16px + env(safe-area-inset-left, 0px));
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  z-index: 15;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.touch-hints.visible {
  opacity: 0.96;
  visibility: visible;
}

.touch-center-cluster {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}

.touch-pill {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(15, 23, 34, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(248, 250, 252, 0.78);
  font-size: 0.72rem;
  opacity: 0.62;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.touch-pill--dir {
  display: none;
}

.horn-btn {
  position: relative;
  pointer-events: auto;
  appearance: none;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 1px solid rgba(56, 189, 248, 0.36);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: rgba(15, 23, 34, 0.64);
  color: #e0f2fe;
  font-family: var(--font-sans);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.36), 0 0 14px rgba(56, 189, 248, 0.16), 0 1px 0 rgba(255, 255, 255, 0.12) inset;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: transform 0.12s ease, opacity 0.18s ease, background-color 0.14s ease, border-color 0.14s ease, box-shadow 0.16s ease;
}

.horn-btn:hover:not(.is-cooldown) {
  border-color: rgba(125, 211, 252, 0.72);
  background: rgba(14, 116, 144, 0.56);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4), 0 0 18px rgba(56, 189, 248, 0.32);
}

.horn-btn:active:not(.is-cooldown),
.horn-btn.honking {
  transform: scale(0.92);
  border-color: rgba(253, 224, 71, 0.92);
  background: rgba(217, 119, 6, 0.84);
  color: #ffffff;
  box-shadow: 0 0 24px rgba(250, 204, 21, 0.55);
}

.horn-btn.is-cooldown {
  opacity: 0.64;
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  cursor: default;
}

.horn-ring-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
}

.horn-ring-track {
  fill: none;
  stroke: rgba(148, 163, 184, 0.18);
  stroke-width: 2.6;
}

.horn-ring-fill {
  fill: none;
  stroke: rgba(56, 189, 248, 0.92);
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
  transition: stroke 0.2s ease;
}

.horn-btn.is-cooldown .horn-ring-fill {
  stroke: rgba(251, 191, 36, 0.88);
}

.horn-btn.honking .horn-ring-fill {
  stroke: #fef08a;
}

.horn-icon {
  position: relative;
  z-index: 1;
  font-size: 1.05rem;
  line-height: 1;
}

.horn-label {
  position: relative;
  z-index: 1;
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
}

.pedal-btn {
  display: none;
  pointer-events: auto;
  appearance: none;
  min-width: 94px;
  min-height: 50px;
  padding: 12px 18px;
  border-radius: 18px;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(12px) saturate(135%);
  -webkit-backdrop-filter: blur(12px) saturate(135%);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34), 0 1px 0 rgba(255, 255, 255, 0.1) inset;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: transform 0.1s ease, background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.touch-hints:not(.visible) .pedal-btn,
.touch-hints:not(.visible) .horn-btn {
  pointer-events: none;
}

.pedal-btn--brake {
  border: 1px solid rgba(248, 113, 113, 0.42);
  background: rgba(15, 23, 34, 0.58);
  color: rgba(254, 202, 202, 0.94);
}

.pedal-btn--brake.active,
.pedal-btn--brake:active {
  transform: scale(0.95);
  background: rgba(220, 38, 38, 0.8);
  border-color: rgba(254, 202, 202, 0.85);
  color: #ffffff;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.45);
}

.pedal-btn--gas {
  border: 1px solid rgba(251, 191, 36, 0.42);
  background: rgba(15, 23, 34, 0.58);
  color: rgba(254, 240, 138, 0.94);
}

.pedal-btn--gas.active,
.pedal-btn--gas:active {
  transform: scale(0.95);
  background: rgba(217, 119, 6, 0.82);
  border-color: rgba(253, 224, 71, 0.88);
  color: #ffffff;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.45);
}

@media (hover: none) and (pointer: coarse) {
  .touch-hints {
    justify-content: space-between;
  }

  .pedal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .touch-pill--dir {
    display: grid;
  }
}

body.has-touch .touch-hints {
  justify-content: space-between;
}

body.has-touch .pedal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.has-touch .touch-pill--dir {
  display: grid;
}

/* ==========================================================================
   Overlays & Modals
   ========================================================================== */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(76px + env(safe-area-inset-top, 0px))
    calc(16px + env(safe-area-inset-right, 0px))
    calc(24px + env(safe-area-inset-bottom, 0px))
    calc(16px + env(safe-area-inset-left, 0px));
  background: radial-gradient(circle at 50% 40%, rgba(11, 16, 23, 0.42), rgba(6, 9, 14, 0.74));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.overlay[hidden] {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 530px;
  max-height: 100%;
  overflow-y: auto;
  border-radius: var(--radius-lg);
  padding: clamp(16px, 3vw, 24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 11px;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.overlay.active .modal-card {
  transform: translateY(0) scale(1);
}

#start-overlay {
  max-height: 100dvh;
  padding-top: calc(54px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
}

.modal-card--start {
  max-width: 604px;
  gap: 9px;
}

/* Start Card Header: Route Shield + Career KM + Personal Best Badges */
.start-card-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.start-header-badges {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.route-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 11px 4px 5px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  max-width: 100%;
}

.route-shield {
  background: var(--dn1-red);
  color: #ffffff;
  font-weight: 900;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  padding: 2.5px 7px;
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.45);
}

.route-text {
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  white-space: nowrap;
}

.start-career-badge,
.start-best-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.start-career-badge.is-unlocked {
  background: rgba(16, 185, 129, 0.13);
  border-color: rgba(52, 211, 153, 0.42);
  color: #a7f3d0;
}

.start-best-badge.has-record {
  background: rgba(245, 158, 11, 0.13);
  border-color: rgba(245, 158, 11, 0.42);
  color: #fde68a;
}

.start-career-icon,
.start-best-icon {
  font-size: 0.78rem;
  line-height: 1;
}

.start-career-label,
.start-best-label {
  font-size: 0.61rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.88;
}

.start-career-value,
.start-best-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--text-primary);
}

.start-career-badge.is-unlocked .start-career-value {
  color: #34d399;
}

.start-best-badge.has-record .start-best-value {
  color: var(--accent-amber);
}

.game-title {
  font-size: clamp(1.65rem, 5.4vw, 2.35rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.05;
  background: linear-gradient(180deg, #ffffff 15%, #cbd5e1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.game-subtitle {
  font-size: 0.86rem;
  line-height: 1.35;
  color: var(--text-secondary);
  max-width: 42ch;
}

/* Briefing Sections & Cards */
.briefing-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.briefing-heading {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-left: 2px;
}

/* 4-Car Garage Selector (4x1 Desktop, 2x2 Mobile) */
.car-selector {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.car-card {
  appearance: none;
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  padding: 9px 6px 10px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-family: var(--font-sans);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.2s ease;
}

.car-card:hover {
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(255, 255, 255, 0.24);
  transform: translateY(-2px);
}

.car-card:active {
  transform: scale(0.98);
}

.car-card--locked {
  opacity: 0.78;
  border-style: dashed;
  border-color: rgba(251, 191, 36, 0.34);
  background: rgba(15, 23, 42, 0.45);
  cursor: not-allowed;
}

.car-card--locked:hover {
  background: rgba(15, 23, 42, 0.56);
  border-color: rgba(251, 191, 36, 0.55);
  transform: none;
}

.car-card--locked:active {
  transform: none;
}

.car-card--locked .car-preview-canvas {
  filter: grayscale(0.72) contrast(0.92);
  opacity: 0.78;
}

@keyframes car-lock-shake {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  78% { transform: translateX(-3px); }
}

.car-card--shake {
  animation: car-lock-shake 0.32s ease;
}

.car-card.selected,
.car-card[aria-checked="true"] {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.15) 0%, rgba(37, 99, 235, 0.1) 100%);
  border-color: rgba(56, 189, 248, 0.78);
  box-shadow: 0 8px 22px rgba(14, 165, 233, 0.22), 0 0 0 1px rgba(56, 189, 248, 0.28) inset;
}

.car-card.selected::after,
.car-card[aria-checked="true"]::after {
  content: '✓';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  font-weight: 900;
  color: #082f49;
  background: #38bdf8;
  box-shadow: 0 2px 6px rgba(56, 189, 248, 0.45);
}

.car-preview-wrap {
  width: 48px;
  height: 70px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 52%, rgba(148, 163, 184, 0.14), rgba(15, 23, 42, 0.35) 75%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 2px;
}

.car-preview-canvas {
  width: 48px;
  height: 70px;
  display: block;
}

.car-card-name {
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.16;
  color: var(--text-primary);
  min-height: 2.32em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.car-card-badge,
.car-lock-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.car-lock-pill {
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(251, 191, 36, 0.42);
  color: #fde68a;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.car-card-badge--sedan {
  background: rgba(148, 163, 184, 0.16);
  border: 1px solid rgba(186, 210, 235, 0.3);
  color: #cbd5e1;
}

.car-card-badge--wagon {
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.38);
  color: #7dd3fc;
}

.car-card-badge--coupe {
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(248, 113, 113, 0.42);
  color: #fca5a5;
}

.car-card-badge--classic {
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(251, 191, 36, 0.44);
  color: #fde68a;
}

.car-card-perk {
  font-size: 0.63rem;
  line-height: 1.24;
  color: var(--text-secondary);
}

.hazard-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.hazard-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  text-align: left;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hazard-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hazard-icon svg {
  width: 26px;
  height: 26px;
}

.hazard-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hazard-copy strong {
  font-size: 0.79rem;
  font-weight: 700;
  color: var(--text-primary);
}

.hazard-copy span {
  font-size: 0.7rem;
  line-height: 1.28;
  color: var(--text-secondary);
}

.powerup-preview-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.pu-chip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 9px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

.pu-chip--coffee {
  border-color: rgba(245, 158, 11, 0.28);
  background: rgba(245, 158, 11, 0.06);
}

.pu-chip--vignette {
  border-color: rgba(56, 189, 248, 0.28);
  background: rgba(56, 189, 248, 0.06);
}

.pu-chip--lpg {
  border-color: rgba(59, 130, 246, 0.32);
  background: rgba(59, 130, 246, 0.07);
}

.pu-chip--cb {
  border-color: rgba(16, 185, 129, 0.32);
  background: rgba(16, 185, 129, 0.08);
}

.pu-chip-icon {
  font-size: 1rem;
  line-height: 1;
}

.pu-chip-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pu-chip-text strong {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--text-primary);
}

.pu-chip-text span {
  font-size: 0.68rem;
  line-height: 1.25;
  color: var(--text-secondary);
}

/* Near Miss Tip */
.bonus-callout {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.28);
  color: #fcd34d;
  font-size: 0.79rem;
  font-weight: 600;
}

/* Controls Section: Touch Action Rows & Desktop Keyboard Shortcuts */
.controls-groups {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.controls-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.controls-group--desktop {
  order: 1;
}

.controls-group--touch {
  order: 2;
}

.controls-subheading {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-align: left;
}

.controls-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  cursor: pointer;
  list-style: none;
}

.controls-summary::-webkit-details-marker {
  display: none;
}

.controls-summary-chevron {
  font-size: 0.8rem;
  line-height: 1;
  transition: transform 0.16s ease;
}

.controls-group--desktop:not([open]) .controls-summary-chevron {
  transform: rotate(-90deg);
}

.controls-group--desktop[open] .controls-bar {
  margin-top: 4px;
}

.touch-controls-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.touch-control-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.07);
  border: 1px solid rgba(56, 189, 248, 0.22);
  font-size: clamp(0.71rem, 2.5vw, 0.78rem);
  line-height: 1.26;
  text-align: left;
}

.touch-ctrl-gesture {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #e0f2fe;
}

.touch-ctrl-gesture strong {
  font-weight: 800;
  color: #bae6fd;
}

.touch-ctrl-icon {
  flex-shrink: 0;
  font-size: 0.92rem;
  line-height: 1;
}

.touch-ctrl-arrow {
  flex-shrink: 0;
  color: var(--accent-cyan);
  font-weight: 800;
}

.touch-ctrl-action {
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
}

.controls-bar {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px 12px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.control-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.kbd-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom-width: 2px;
  border-radius: 5px;
}

@media (pointer: coarse), (max-width: 640px) {
  .controls-group--touch {
    order: 1;
  }

  .controls-group--desktop {
    order: 2;
  }

  .controls-bar {
    font-size: 0.69rem;
    gap: 5px 10px;
  }

  kbd {
    min-width: 19px;
    height: 19px;
    font-size: 0.64rem;
  }
}

body.has-touch .controls-group--touch {
  order: 1;
}

body.has-touch .controls-group--desktop {
  order: 2;
}

/* Collapsible Legend Trigger & Info Modal */
.legend-toggle-btn {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.13);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.legend-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.085);
  border-color: rgba(56, 189, 248, 0.42);
  transform: translateY(-1px);
}

.legend-toggle-btn:active {
  transform: scale(0.99);
}

.legend-toggle-q {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1;
}

.legend-toggle-text {
  flex: 1;
  text-align: left;
  color: var(--text-primary);
}

.legend-toggle-arrow {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-secondary);
  line-height: 1;
}

.legend-overlay {
  z-index: 40;
  max-height: 100dvh;
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  background: rgba(4, 7, 12, 0.78);
}

.modal-card--legend {
  max-width: 520px;
  gap: 12px;
}

.legend-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.legend-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.legend-title {
  font-size: clamp(1.05rem, 3.8vw, 1.25rem);
  font-weight: 900;
  color: var(--text-primary);
  text-align: left;
}

.legend-close-x {
  appearance: none;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.12s ease;
}

.legend-close-x:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

.legend-close-x:active {
  transform: scale(0.94);
}

.legend-done-btn {
  padding: 12px 20px;
  font-size: 0.94rem;
}

/* Primary Action Button */
.primary-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 22px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.4), 0 1px 0 rgba(255, 255, 255, 0.25) inset;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.primary-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(37, 99, 235, 0.5), 0 1px 0 rgba(255, 255, 255, 0.3) inset;
}

.primary-btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn-arrow {
  font-size: 1.15rem;
  line-height: 1;
}

/* ==========================================================================
   Pause Modal Specifics
   ========================================================================== */

.modal-card--pause {
  max-width: 410px;
}

.pause-badge {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.42);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
}

.pause-title {
  font-size: clamp(1.55rem, 4.5vw, 2rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.pause-subtitle {
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--text-secondary);
  max-width: 34ch;
}

.pause-stats {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pause-actions-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.secondary-btn {
  appearance: none;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.secondary-btn:active {
  transform: translateY(1px) scale(0.98);
}

.secondary-btn .btn-arrow {
  font-size: 0.96rem;
  opacity: 0.88;
}

.pause-quick-toggles {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 2px;
}

.quick-toggle-btn {
  appearance: none;
  flex: 1;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.quick-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(56, 189, 248, 0.42);
}

.quick-toggle-btn:active {
  transform: scale(0.98);
}

.quick-mute-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.quick-mute-icon--off {
  display: none;
}

.quick-toggle-btn.is-muted {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.36);
  background: rgba(127, 29, 29, 0.36);
}

.quick-toggle-btn.is-muted .quick-mute-icon--on {
  display: none;
}

.quick-toggle-btn.is-muted .quick-mute-icon--off {
  display: block;
}

.quick-toggle-label {
  color: var(--text-secondary);
}

.quick-toggle-state {
  font-weight: 800;
  color: #7dd3fc;
}

.quick-toggle-btn.is-muted .quick-toggle-state {
  color: #fca5a5;
}

.pause-lang-toggle {
  flex-shrink: 0;
}

/* ==========================================================================
   Game Over Modal Specifics
   ========================================================================== */

.modal-card--gameover {
  position: relative;
  max-width: 452px;
}

.gameover-stamp {
  position: absolute;
  top: 10px;
  right: 12px;
  transform: rotate(-3.5deg);
  padding: 2px 6px;
  max-width: calc(100% - 24px);
  white-space: nowrap;
  border: 1.5px solid rgba(248, 113, 113, 0.86);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.56);
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.34);
  font-weight: 900;
  font-size: 0.5rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.15;
  color: #fecaca;
  opacity: 0.9;
  pointer-events: none;
  z-index: 2;
}

.gameover-stamp--red {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.88);
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.34);
  background: rgba(127, 29, 29, 0.28);
}

.gameover-stamp--amber {
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.88);
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.34);
  background: rgba(146, 64, 14, 0.26);
}

.gameover-stamp--emerald {
  color: #a7f3d0;
  border-color: rgba(52, 211, 153, 0.88);
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.34);
  background: rgba(6, 78, 59, 0.28);
}

.gameover-stamp[hidden] {
  display: none;
}

/* ==========================================================================
   Phase 4: Interactive Romanian License Plate Selector, Milestones & Ranks
   ========================================================================== */

.customize-section {
  gap: 0;
}

.customize-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.paint-picker-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.paint-swatches {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.paint-swatch {
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.32);
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.28), 0 2px 6px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  padding: 0;
  transition: transform 0.14s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.paint-swatch:hover {
  transform: scale(1.1);
  border-color: rgba(255, 255, 255, 0.68);
}

.paint-swatch[aria-pressed="true"] {
  transform: scale(1.08);
  border-color: #ffffff;
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.35),
    0 0 0 2px #0f172a,
    0 0 0 3.8px var(--accent-cyan);
}

.paint-swatch--white {
  background: linear-gradient(145deg, #ffffff 0%, #cbd5e1 100%);
}

.paint-swatch--silver {
  background: linear-gradient(145deg, #e2e8f0 0%, #64748b 100%);
}

.paint-swatch--blue {
  background: linear-gradient(145deg, #60a5fa 0%, #1d4ed8 100%);
}

.paint-swatch--red {
  background: linear-gradient(145deg, #f87171 0%, #b91c1c 100%);
}

.paint-swatch--black {
  background: linear-gradient(145deg, #475569 0%, #090d16 100%);
}

.plate-inline-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.plate-inline-row .briefing-heading {
  cursor: pointer;
  line-height: 1.2;
}

.ro-plate {
  display: inline-flex;
  align-items: stretch;
  border-radius: 7px;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff 0%, #e2e8f0 100%);
  border: 1.5px solid #0f172a;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.45) inset;
  height: 34px;
  flex-shrink: 0;
}

.ro-plate--interactive {
  position: relative;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.ro-plate--interactive:hover {
  transform: translateY(-1px);
  border-color: rgba(56, 189, 248, 0.85);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
}

.ro-plate-eu {
  width: 21px;
  background: #003399;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 2px 1px;
  border-right: 1px solid rgba(15, 23, 42, 0.28);
}

.ro-plate-stars {
  width: 10px;
  height: 10px;
  display: block;
}

.ro-plate-country {
  font-family: var(--font-sans);
  font-size: 0.48rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.03em;
  color: #ffffff;
}

.ro-plate-county-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  gap: 3px;
  padding: 0 7px 0 8px;
  background: rgba(15, 23, 42, 0.065);
  border-right: 1px solid rgba(15, 23, 42, 0.16);
}

.ro-plate-county-value {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #0f172a;
}

.ro-plate-caret {
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  color: #1d4ed8;
}

.ro-plate-suffix {
  display: inline-flex;
  align-items: center;
  padding: 0 10px 0 8px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  color: #0f172a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.ro-plate-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  font-size: 16px;
  color-scheme: dark;
  background-color: #0f172a;
  color: #f8fafc;
}

.ro-plate-num {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #0f172a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.ro-plate--compact {
  height: 27px;
  border-radius: 5px;
}

.ro-plate--compact .ro-plate-eu {
  width: 17px;
}

.ro-plate--compact .ro-plate-country {
  font-size: 0.5rem;
}

.ro-plate--compact .ro-plate-num {
  padding: 0 8px;
  font-size: 0.77rem;
}

.install-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.install-btn:hover {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.45);
  color: #e0f2fe;
  transform: translateY(-1px);
}

.install-btn:active {
  transform: scale(0.97);
}

.install-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Non-intrusive Route Progression Milestone Toast */
.route-milestone-toast {
  position: fixed;
  top: var(--hud-safe-top, calc(76px + env(safe-area-inset-top, 0px)));
  left: 50%;
  transform: translate(-50%, -10px) scale(0.96);
  z-index: 22;
  pointer-events: none;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 8px;
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 6px 13px 6px 8px;
  border-radius: var(--radius-md);
  line-height: 1.28;
  text-align: center;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  opacity: 0;
  transition: opacity 0.24s ease, transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.route-milestone-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.route-milestone-toast[hidden] {
  display: none;
}

.route-milestone-shield {
  flex-shrink: 0;
  background: var(--dn1-red);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

.route-milestone-name {
  min-width: 0;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  font-size: clamp(0.76rem, 2.9vw, 0.86rem);
  font-weight: 800;
  line-height: 1.25;
  color: #ffffff;
  letter-spacing: 0.01em;
}

.route-milestone-km {
  flex-shrink: 0;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: clamp(0.66rem, 2.3vw, 0.74rem);
  font-weight: 700;
  color: #93c5fd;
  padding-left: 6px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
}

/* Game Over Driver Rank & Action Buttons */
.gameover-meta-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rank-badge {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  padding: 8px 11px;
  border-radius: var(--radius-md);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.32);
}

.rank-badge--novice {
  background: rgba(250, 204, 21, 0.1);
  border-color: rgba(250, 204, 21, 0.36);
}

.rank-badge--commuter {
  background: rgba(56, 189, 248, 0.11);
  border-color: rgba(56, 189, 248, 0.36);
}

.rank-badge--survivor {
  background: rgba(16, 185, 129, 0.11);
  border-color: rgba(16, 185, 129, 0.38);
}

.rank-badge--king {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(251, 191, 36, 0.5);
}

.rank-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.rank-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.rank-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.rank-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
}

.gameover-actions-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.gameover-actions-row .primary-btn {
  padding: 13px 14px;
  font-size: 0.94rem;
}

.share-btn {
  appearance: none;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  font-family: var(--font-sans);
  font-size: 0.94rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #fef3c7;
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.34), rgba(245, 158, 11, 0.24));
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.18), 0 1px 0 rgba(255, 255, 255, 0.16) inset;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.share-btn:hover {
  border-color: rgba(253, 224, 71, 0.72);
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.5), rgba(245, 158, 11, 0.35));
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(245, 158, 11, 0.28);
}

.share-btn:active {
  transform: translateY(1px) scale(0.98);
}

.share-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.share-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

/* Glassmorphic Toast Notification */
.share-toast {
  position: fixed;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 14px);
  z-index: 60;
  pointer-events: none;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border-color: rgba(52, 211, 153, 0.48);
  color: #ecfdf5;
  font-size: clamp(0.76rem, 2.8vw, 0.86rem);
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  width: max-content;
  max-width: calc(100vw - 24px);
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.share-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.share-toast[hidden] {
  display: none;
}

.crash-badge {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fecaca;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.45);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
}

.gameover-title {
  font-size: clamp(1.55rem, 4.5vw, 2rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.cause-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.28);
}

.cause-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fca5a5;
}

.cause-value {
  font-size: 0.98rem;
  font-weight: 700;
  color: #ffffff;
}

.new-record-badge {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #fef08a;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.45);
  padding: 5px 14px;
  border-radius: var(--radius-pill);
}

.stats-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-box {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 8px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.stat-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(0.86rem, 3.2vw, 1.05rem);
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
}

.stat-val--gold {
  color: var(--accent-amber);
}

.shortcut-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

/* Responsive Adjustments */
@media (max-width: 600px) {
  #start-overlay {
    padding-top: calc(50px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .car-selector {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
}

@media (max-width: 520px) {
  .hud-stack {
    max-width: calc(100vw - 196px);
  }

  .hud {
    gap: 6px 9px;
    padding: 7px 10px;
  }

  .hud-stat {
    min-width: 44px;
  }

  .hud-stat--speed {
    min-width: 62px;
  }

  .pedal-btn {
    min-width: 86px;
    min-height: 46px;
    padding: 10px 14px;
    font-size: 0.72rem;
  }

  .horn-btn {
    width: 54px;
    height: 54px;
  }

  .horn-icon {
    font-size: 0.96rem;
  }

  .horn-label {
    font-size: 0.48rem;
  }

  .hud-divider--phase {
    display: none;
  }

  .car-selector {
    gap: 6px;
  }

  .car-card {
    padding: 7px 5px;
    gap: 3px;
  }

  .car-preview-wrap,
  .car-preview-canvas {
    width: 40px;
    height: 58px;
  }

  .car-card-name {
    font-size: 0.71rem;
  }

  .car-card-perk {
    font-size: 0.61rem;
  }

  .customize-row {
    align-items: flex-end;
    gap: 6px 8px;
  }

  .paint-picker-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .plate-inline-row {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }

  .plate-inline-row .briefing-heading {
    padding-left: 0;
    text-align: right;
  }

  .hazard-grid,
  .powerup-preview-grid {
    grid-template-columns: 1fr;
  }

  .pu-chip {
    flex-direction: row;
    align-items: center;
    gap: 9px;
  }

  .stats-grid {
    gap: 8px;
  }

  .gameover-meta-row {
    flex-direction: column;
    align-items: stretch;
  }

  .ro-plate--compact {
    align-self: center;
  }

  .gameover-actions-row {
    grid-template-columns: 1fr;
  }

  .route-milestone-toast {
    gap: 6px;
    padding: 6px 12px 6px 8px;
  }

  .route-milestone-name {
    font-size: clamp(0.75rem, 3vw, 0.84rem);
  }

  .route-milestone-km {
    font-size: clamp(0.66rem, 2.4vw, 0.74rem);
  }
}

@media (max-width: 480px) {
  .overlay {
    padding-left: calc(12px + env(safe-area-inset-left, 0px));
    padding-right: calc(12px + env(safe-area-inset-right, 0px));
  }

  #start-overlay {
    padding-top: calc(48px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .modal-card--start {
    padding: 10px 11px;
    gap: 6px;
  }

  .start-card-header {
    gap: 4px 6px;
  }

  .start-header-badges {
    gap: 4px;
  }

  .route-badge {
    gap: 5px;
    padding: 2.5px 8px 2.5px 4px;
  }

  .route-shield {
    font-size: 0.62rem;
    padding: 1.5px 5px;
  }

  .route-text {
    font-size: 0.61rem;
    letter-spacing: 0.05em;
  }

  .start-career-badge,
  .start-best-badge {
    padding: 2.5px 7px;
    gap: 4px;
  }

  .start-career-label,
  .start-best-label {
    font-size: 0.54rem;
  }

  .start-career-value,
  .start-best-value {
    font-size: 0.7rem;
  }

  .game-title {
    font-size: clamp(1.36rem, 6.2vw, 1.72rem);
  }

  .game-subtitle {
    font-size: 0.75rem;
    line-height: 1.24;
    max-width: 34ch;
  }

  .briefing-section {
    gap: 4px;
  }

  .briefing-heading {
    font-size: 0.6rem;
  }

  .car-card {
    padding: 6px 4px 7px;
    gap: 2px;
  }

  .car-card.selected::after,
  .car-card[aria-checked="true"]::after {
    top: 4px;
    right: 4px;
    width: 15px;
    height: 15px;
    font-size: 0.56rem;
  }

  .car-preview-wrap,
  .car-preview-canvas {
    width: 32px;
    height: 46px;
    margin-bottom: 1px;
  }

  .car-card-name {
    font-size: 0.68rem;
    min-height: 2.2em;
  }

  .car-card-badge,
  .car-lock-pill {
    font-size: 0.55rem;
    padding: 1.5px 6px;
  }

  .car-card-perk {
    display: none;
  }

  .paint-swatches {
    gap: 5px;
  }

  .paint-swatch {
    width: 22px;
    height: 22px;
  }

  .ro-plate {
    height: 30px;
  }

  .ro-plate-county-wrap {
    min-width: 32px;
    padding: 0 5px 0 6px;
  }

  .ro-plate-county-value,
  .ro-plate-suffix {
    font-size: 0.8rem;
  }

  .legend-toggle-btn {
    padding: 6px 10px;
    font-size: 0.77rem;
  }

  .modal-card--start .primary-btn {
    padding: 11px 16px;
    font-size: 0.94rem;
  }

  .gameover-stamp {
    position: static;
    align-self: flex-end;
    transform: rotate(-4deg);
    max-width: 100%;
    padding: 3px 7px;
    font-size: 0.54rem;
    letter-spacing: 0.05em;
  }
}

@media (max-height: 700px) {
  .overlay {
    padding-top: calc(64px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  #start-overlay {
    padding-top: calc(48px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .legend-overlay {
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .modal-card {
    padding: 14px 16px;
    gap: 9px;
  }

  .gameover-stamp {
    top: 9px;
    right: 12px;
    transform: rotate(-3.5deg);
    padding: 2px 6px;
    font-size: 0.5rem;
  }

  .modal-card--start {
    padding-top: 10px;
    padding-bottom: 10px;
    gap: 6px;
  }

  .modal-card--start .primary-btn {
    padding: 10px 16px;
  }
}

@media (max-height: 520px) {
  .overlay {
    align-items: flex-start;
    padding-top: calc(60px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  #start-overlay {
    padding-top: calc(52px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .legend-overlay {
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .modal-card {
    margin: 0 auto;
    padding: 12px 14px;
    gap: 8px;
  }

  .gameover-stamp {
    top: 8px;
    right: 10px;
    transform: rotate(-3.5deg);
    padding: 2px 6px;
    font-size: 0.5rem;
  }

  .gameover-actions-row .primary-btn,
  .share-btn {
    padding: 10px 12px;
    font-size: 0.88rem;
  }
}

@media (max-width: 400px) {
  .top-bar {
    top: calc(10px + env(safe-area-inset-top, 0px));
    left: calc(10px + env(safe-area-inset-left, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    gap: 8px;
  }

  .hud-stack {
    max-width: calc(100vw - 172px);
    gap: 6px;
  }

  .hud {
    gap: 5px 8px;
    padding: 6px 8px;
  }

  .hud-stat {
    min-width: 40px;
  }

  .hud-stat--speed {
    min-width: 56px;
  }

  .top-controls {
    gap: 5px;
  }

  .pause-btn,
  .mute-btn {
    width: 34px;
    height: 34px;
  }

  .lang-toggle {
    min-height: 34px;
    padding: 3px;
  }

  .lang-btn {
    padding: 5px 8px;
    font-size: 0.72rem;
  }

  .touch-control-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 8px 10px;
  }

  .touch-ctrl-arrow {
    display: none;
  }

  .touch-ctrl-action {
    text-align: left;
    padding-left: 24px;
  }

  .touch-hints {
    left: calc(10px + env(safe-area-inset-left, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    gap: 6px;
  }

  .touch-center-cluster {
    gap: 4px;
  }

  .touch-pill {
    width: 24px;
    height: 24px;
    font-size: 0.62rem;
  }

  .pedal-btn {
    min-width: 72px;
    min-height: 44px;
    padding: 8px 10px;
    font-size: 0.68rem;
    border-radius: 15px;
  }

  .horn-btn {
    width: 50px;
    height: 50px;
  }

  .horn-icon {
    font-size: 0.9rem;
  }

  .horn-label {
    font-size: 0.44rem;
    letter-spacing: 0.04em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .overlay,
  .modal-card,
  .primary-btn,
  .secondary-btn,
  .share-btn,
  .install-btn,
  .quick-toggle-btn,
  .lang-btn,
  .pause-btn,
  .mute-btn,
  .car-card,
  .paint-swatch,
  .ro-plate--interactive,
  .legend-toggle-btn,
  .legend-close-x,
  .hud,
  .pu-pill-fill,
  .pedal-btn,
  .horn-btn,
  .horn-ring-fill,
  .touch-hints,
  .route-milestone-toast,
  .share-toast {
    transition: none;
  }

  .car-card--shake {
    animation: none;
  }
}
