/* ============================================================
   APEX RUSH — interface system
   ============================================================ */
:root {
  --ink: #070a0f;
  --ink-soft: #10151d;
  --paper: #f6f0e4;
  --paper-dim: #b9b4aa;
  --amber: #ffb21a;
  --amber-hot: #ff7a00;
  --red: #ff3b30;
  --cyan: #7ee8ff;
  --line: rgba(246, 240, 228, 0.16);
  --glass: rgba(9, 13, 20, 0.68);
  --font-display: "Arial Black", "Helvetica Neue", "PingFang SC", sans-serif;
  --font-condensed: "Arial Narrow", "Helvetica Neue", "PingFang SC", sans-serif;
  --font-ui: "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

kbd {
  display: inline-flex;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(246, 240, 228, 0.28);
  border-bottom-color: rgba(246, 240, 228, 0.1);
  border-radius: 4px;
  background: rgba(246, 240, 228, 0.08);
  color: var(--paper);
  font-family: var(--font-condensed);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.28);
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 20%, #1a293b 0%, #070a0f 68%);
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
}

.screen-fx,
.vignette,
.grain,
.speed-fx,
.collision-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.screen-fx {
  z-index: 2;
}

.vignette {
  background:
    radial-gradient(ellipse at 50% 48%, transparent 36%, rgba(0, 0, 0, 0.18) 70%, rgba(0, 0, 0, 0.62) 112%),
    linear-gradient(180deg, rgba(4, 7, 11, 0.32) 0%, transparent 16%, transparent 82%, rgba(4, 7, 11, 0.3) 100%);
}

.grain {
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 220 220' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.7'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.speed-fx {
  opacity: 0;
  transition: opacity 0.35s ease;
  background:
    radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.2) 76%),
    repeating-conic-gradient(from 0deg at 50% 52%, transparent 0deg 5deg, rgba(255, 255, 255, 0.05) 5.5deg 6deg, transparent 6.5deg 11deg);
  mask-image: radial-gradient(ellipse at center, transparent 18%, black 64%);
  -webkit-mask-image: radial-gradient(ellipse at center, transparent 18%, black 64%);
  mix-blend-mode: screen;
  transform: scale(1.15);
}
.speed-fx.is-fast { opacity: 0.6; }

.collision-flash {
  opacity: 0;
  background: radial-gradient(circle at center, transparent 38%, rgba(255, 92, 42, 0.5) 115%);
  transition: opacity 0.22s ease-out;
  z-index: 9;
}
.collision-flash.is-hit { opacity: 1; transition-duration: 0.03s; }

.is-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ============================================================
   HUD
   ============================================================ */
.hud {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.45s ease, visibility 0.45s;
}

.hud.is-hidden { opacity: 0; visibility: hidden; }

.hud-top-left,
.hud-top-right,
.hud-bottom-left,
.hud-bottom-right,
.hud-bottom-center,
.hud-center {
  position: absolute;
}

.hud-top-left {
  top: clamp(18px, 3vw, 38px);
  left: clamp(18px, 3vw, 42px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  position: relative;
  border: 1px solid rgba(246, 240, 228, 0.2);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 35%),
    var(--glass);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.lap-panel {
  width: 232px;
  padding: 16px 18px 14px;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%);
}

.lap-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 46px;
  height: 3px;
  background: var(--amber);
}

.lap-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.micro-label {
  font-family: var(--font-condensed);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: rgba(246, 240, 228, 0.56);
}

.lap-count {
  font-family: var(--font-display);
  font-size: 28px;
  font-style: italic;
  line-height: 0.8;
  letter-spacing: -0.06em;
  color: var(--paper);
}

.lap-count b { color: var(--amber); font-size: 36px; font-weight: 900; }
.lap-count i { font-style: normal; opacity: 0.35; padding: 0 4px; font-size: 20px; }
.lap-count span { font-size: 20px; opacity: 0.55; }

.time-block { display: grid; gap: 4px; }
.time-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-family: var(--font-condensed);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(246, 240, 228, 0.54);
}
.time-row strong {
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--paper);
}
.time-row.best-time strong { color: var(--amber); }

/* minimap */
.minimap-panel {
  width: 232px;
  padding: 9px 10px 10px;
  border: 1px solid rgba(246, 240, 228, 0.14);
  background: rgba(8, 11, 16, 0.48);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.minimap-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-condensed);
  font-size: 8px;
  letter-spacing: 0.17em;
  color: rgba(246, 240, 228, 0.42);
  margin: 0 4px 5px;
}
.minimap-head i { color: var(--red); font-style: normal; }
#minimap { width: 212px; height: 212px; display: block; }

/* position */
.hud-top-right {
  top: clamp(18px, 3vw, 38px);
  right: clamp(18px, 3vw, 42px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.position-panel {
  min-width: 156px;
  padding: 12px 16px 10px;
  text-align: right;
  border-right: 3px solid var(--amber);
  background: linear-gradient(270deg, rgba(9, 13, 20, 0.76), rgba(9, 13, 20, 0.24));
  clip-path: polygon(14px 0, 100% 0, 100% 100%, 0 100%, 0 14px);
}
.position-line {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  line-height: 0.85;
  margin-top: 2px;
}
.position-prefix {
  font-family: var(--font-display);
  font-size: 18px;
  font-style: italic;
  color: var(--amber);
  margin-right: 2px;
}
.position-line b {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.08em;
  color: var(--paper);
  text-shadow: 0 5px 24px rgba(0, 0, 0, 0.4);
}
.position-line em {
  font-family: var(--font-condensed);
  font-style: normal;
  font-size: 14px;
  color: rgba(246, 240, 228, 0.45);
  margin-left: 7px;
}

.standings {
  width: 204px;
  display: grid;
  gap: 3px;
  padding: 4px;
  transition: opacity 0.3s;
}
.standing-row {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 7px;
  height: 24px;
  padding: 0 8px 0 6px;
  font-family: var(--font-condensed);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: rgba(246, 240, 228, 0.62);
  background: linear-gradient(90deg, rgba(8, 11, 16, 0.6), rgba(8, 11, 16, 0.15));
  border-left: 2px solid transparent;
  transition: all 0.25s ease;
}
.standing-row.is-player {
  color: var(--paper);
  background: linear-gradient(90deg, rgba(255, 178, 26, 0.2), rgba(8, 11, 16, 0.1));
  border-left-color: var(--amber);
}
.standing-row .standing-pos { color: rgba(246, 240, 228, 0.36); font-weight: 700; }
.standing-row.is-player .standing-pos { color: var(--amber); }
.standing-row .standing-name { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.standing-chip { width: 3px; height: 10px; border-radius: 1px; box-shadow: 0 0 8px currentColor; }
.standing-row .standing-gap { font-size: 9px; opacity: 0.55; font-variant-numeric: tabular-nums; }

/* center messages */
.hud-center {
  top: 16%;
  left: 50%;
  transform: translateX(-50%);
  width: min(620px, 88vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.notification {
  opacity: 0;
  transform: translateY(12px);
  text-align: center;
  transition: opacity 0.28s ease, transform 0.28s ease;
  text-shadow: 0 4px 28px rgba(0, 0, 0, 0.6);
}
.notification.is-show { opacity: 1; transform: translateY(0); }
.notif-kicker {
  display: block;
  font-family: var(--font-condensed);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--amber);
  margin-bottom: 4px;
}
.notif-main {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(26px, 4.4vw, 54px);
  font-style: italic;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  text-transform: uppercase;
}
.notif-sub {
  display: block;
  margin-top: 7px;
  font-family: var(--font-condensed);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: rgba(246, 240, 228, 0.66);
}

.countdown {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-family: var(--font-display);
  font-size: clamp(130px, 22vw, 260px);
  font-style: italic;
  font-weight: 900;
  color: var(--paper);
  text-shadow: 0 0 0 transparent, 0 20px 80px rgba(0, 0, 0, 0.45);
  letter-spacing: -0.09em;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.15s, transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.3);
  z-index: 8;
}
.countdown.is-show { opacity: 1; transform: scale(1); }
.countdown.is-go { color: var(--amber); font-size: clamp(110px, 18vw, 220px); }
.countdown::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 178, 26, 0.09), transparent 32%);
  pointer-events: none;
}

/* nitro */
.hud-bottom-left {
  bottom: clamp(88px, 11vh, 120px);
  left: clamp(18px, 3vw, 42px);
}
.nitro-panel {
  width: 232px;
  padding: 9px 12px 10px;
  border-left: 2px solid var(--cyan);
  background: linear-gradient(90deg, rgba(9, 13, 20, 0.66), transparent);
}
.nitro-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-condensed);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--cyan);
}
.nitro-head b {
  font-family: "SFMono-Regular", "Menlo", monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--paper);
}
.nitro-track {
  height: 5px;
  margin: 7px 0 6px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  transform: skewX(-22deg);
}
.nitro-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #37b9ff, #a8f4ff);
  box-shadow: 0 0 14px rgba(126, 232, 255, 0.8);
  transition: width 0.1s linear, background 0.2s;
}
.nitro-fill.is-low { background: linear-gradient(90deg, #ff6a1f, #ffb21a); }
.nitro-fill.is-boosting { background: linear-gradient(90deg, #ffffff, #7ee8ff); animation: nitroPulse 0.18s infinite alternate; }
.nitro-hint {
  font-family: var(--font-condensed);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: rgba(246, 240, 228, 0.35);
}
@keyframes nitroPulse { to { opacity: 0.65; } }

/* speedometer */
.hud-bottom-right {
  right: clamp(10px, 2vw, 28px);
  bottom: clamp(8px, 1.5vw, 24px);
  width: clamp(210px, 21vw, 300px);
  aspect-ratio: 1;
  filter: drop-shadow(0 15px 40px rgba(0, 0, 0, 0.4));
}
#speedometer { width: 100%; height: 100%; display: block; }

.hud-bottom-center {
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  white-space: nowrap;
  font-family: var(--font-condensed);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: rgba(246, 240, 228, 0.32);
  align-items: center;
}
.hud-bottom-center span { display: flex; gap: 4px; align-items: center; }
.hud-bottom-center kbd {
  min-width: 18px;
  height: 17px;
  padding: 0 4px;
  font-size: 8px;
  color: rgba(246, 240, 228, 0.55);
  background: rgba(255, 255, 255, 0.04);
}

.pause-button {
  position: absolute;
  top: clamp(20px, 3vw, 38px);
  left: 50%;
  transform: translateX(-50%);
  pointer-events: auto;
}
.icon-button {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid rgba(246, 240, 228, 0.18);
  background: rgba(8, 11, 16, 0.32);
  backdrop-filter: blur(8px);
  transition: background 0.2s, border-color 0.2s;
}
.icon-button:hover { background: rgba(246, 240, 228, 0.1); border-color: rgba(246, 240, 228, 0.4); }
.icon-button span { display: block; width: 4px; height: 14px; background: var(--paper); }

.speed-lines { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.3s; }

/* ============================================================
   START SCREEN
   ============================================================ */
.screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  transition: opacity 0.7s ease, visibility 0.7s;
}

.start-screen {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(20px, 3.4vw, 46px) clamp(22px, 4.8vw, 72px) clamp(18px, 2.6vw, 34px);
  background:
    linear-gradient(90deg, rgba(5, 8, 12, 0.92) 0%, rgba(5, 8, 12, 0.68) 35%, rgba(5, 8, 12, 0.02) 66%, rgba(5, 8, 12, 0.44) 100%),
    linear-gradient(0deg, rgba(5, 8, 12, 0.9) 0%, transparent 28%, transparent 82%, rgba(5, 8, 12, 0.46) 100%);
  overflow: hidden;
}
.start-screen.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.start-screen::before {
  content: "";
  position: absolute;
  left: -8%;
  top: 41%;
  width: 56%;
  height: 1px;
  background: linear-gradient(90deg, var(--amber), transparent);
  opacity: 0.5;
}
.start-screen::after {
  content: "01";
  position: absolute;
  right: 4%;
  top: 16%;
  font-family: var(--font-display);
  font-size: 19vw;
  font-weight: 900;
  font-style: italic;
  line-height: 0.7;
  color: rgba(246, 240, 228, 0.035);
  pointer-events: none;
}

.start-shade {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 68% 48%, transparent 0%, rgba(4, 7, 10, 0.18) 52%, rgba(4, 7, 10, 0.7) 100%);
  pointer-events: none;
}

.start-grid {
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 7.4vw 7.4vw;
  mask-image: linear-gradient(90deg, black, transparent 55%, black);
  -webkit-mask-image: linear-gradient(90deg, black, transparent 55%, black);
  pointer-events: none;
}

.start-top,
.start-bottom,
.hero-copy,
.control-strip {
  position: relative;
  z-index: 2;
}

.start-top { display: flex; align-items: center; justify-content: space-between; }
.brand-mark { display: flex; align-items: center; gap: 11px; }
.brand-glyph {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  font-style: italic;
  color: var(--ink);
  background: var(--amber);
  clip-path: polygon(0 0, 100% 0, 100% 78%, 76% 100%, 0 100%);
}
.brand-copy {
  display: flex;
  flex-direction: column;
  font-family: var(--font-condensed);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1.3;
}
.brand-copy small { font-size: 7px; letter-spacing: 0.24em; color: rgba(246, 240, 228, 0.38); }
.start-meta { display: flex; gap: 20px; font-family: var(--font-condensed); font-size: 9px; letter-spacing: 0.16em; color: rgba(246, 240, 228, 0.5); }
.start-meta span { display: flex; align-items: center; gap: 6px; }
.dot { width: 5px; height: 5px; display: inline-block; border-radius: 50%; background: var(--paper); }
.dot.live { background: var(--red); box-shadow: 0 0 10px var(--red); animation: dotPulse 1.8s infinite; }
@keyframes dotPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.hero-copy {
  width: min(640px, 55vw);
  margin-top: auto;
  margin-bottom: auto;
  padding: 4vh 0 0;
  animation: heroIn 0.9s 0.1s both cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes heroIn { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
.kicker-line {
  display: flex;
  align-items: center;
  white-space: nowrap;
  gap: 11px;
  font-family: var(--font-condensed);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: var(--amber);
  margin-bottom: 16px;
}
.kicker-line span { width: 34px; height: 1px; background: var(--amber); }
.kicker-line #menuKicker { width: auto; height: auto; background: none; white-space: nowrap; }
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(72px, 10.8vw, 168px);
  font-weight: 900;
  font-style: italic;
  line-height: 0.72;
  letter-spacing: -0.085em;
  text-transform: uppercase;
  margin-left: -0.06em;
  filter: drop-shadow(0 14px 36px rgba(0, 0, 0, 0.38));
}
.hero-title span { display: block; }
.hero-title .outline {
  color: transparent;
  -webkit-text-stroke: 2px rgba(246, 240, 228, 0.92);
  text-shadow: none;
  padding-left: 0.12em;
  letter-spacing: -0.04em;
}
.hero-subline { display: flex; align-items: flex-start; gap: clamp(18px, 3vw, 42px); margin-top: clamp(20px, 3.2vh, 36px); }
.cn-title {
  font-family: var(--font-ui);
  font-size: clamp(20px, 2.2vw, 30px);
  font-weight: 800;
  letter-spacing: 0.22em;
  writing-mode: vertical-rl;
  color: var(--amber);
  line-height: 1;
  padding-top: 2px;
  text-shadow: 0 0 28px rgba(255, 178, 26, 0.2);
}
.hero-desc { font-size: clamp(11px, 1vw, 14px); line-height: 1.9; color: rgba(246, 240, 228, 0.6); letter-spacing: 0.04em; }

.start-actions { display: flex; align-items: center; gap: clamp(20px, 3vw, 36px); margin-top: clamp(24px, 4vh, 42px); }
.primary-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: clamp(24px, 3.8vw, 48px);
  min-width: 250px;
  padding: 16px 18px 16px 22px;
  background: var(--amber);
  color: var(--ink);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%);
  overflow: hidden;
  transition: transform 0.16s ease, background 0.2s;
  box-shadow: 0 0 0 1px rgba(255, 178, 26, 0.2), 0 10px 40px rgba(255, 140, 0, 0.2);
}
.primary-btn:hover { background: #ffc24d; transform: translateY(-2px); }
.primary-btn:active { transform: translateY(1px); }
.primary-btn .btn-text {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  font-style: italic;
  line-height: 0.95;
  letter-spacing: -0.02em;
}
.primary-btn .btn-text small {
  font-family: var(--font-condensed);
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.19em;
  margin-top: 7px;
  opacity: 0.62;
}
.primary-btn .btn-arrow { position: relative; z-index: 1; margin-left: auto; font-size: 26px; font-weight: 700; transition: transform 0.2s; }
.primary-btn:hover .btn-arrow { transform: translateX(5px); }
.btn-shine {
  position: absolute;
  top: -50%;
  left: -30%;
  width: 26%;
  height: 200%;
  background: rgba(255, 255, 255, 0.28);
  transform: rotate(25deg);
  transition: left 0.5s ease;
}
.primary-btn:hover .btn-shine { left: 120%; }
.primary-btn.small { min-width: 210px; padding: 13px 16px 13px 18px; }
.primary-btn.small .btn-text { font-size: 17px; }
.primary-btn.small .btn-arrow { font-size: 21px; }

.start-record {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 120px;
  font-family: var(--font-condensed);
  font-size: 9px;
  letter-spacing: 0.15em;
  color: rgba(246, 240, 228, 0.42);
}
.start-record strong { font-family: "SFMono-Regular", "Menlo", monospace; font-size: 13px; font-weight: 500; color: var(--paper); letter-spacing: -0.02em; }

.control-strip {
  display: flex;
  gap: clamp(16px, 3.4vw, 54px);
  padding-top: 20px;
  border-top: 1px solid rgba(246, 240, 228, 0.12);
  margin-bottom: 3vh;
  flex-wrap: wrap;
}
.control-item { display: flex; align-items: center; gap: 11px; }
.key-cluster { display: flex; gap: 2px; }
.key-cluster kbd { min-width: 21px; height: 21px; padding: 0 4px; font-size: 8px; }
.wide-key { min-width: 48px; height: 21px; padding: 0 7px; font-size: 8px; }
.control-item > span {
  display: flex;
  flex-direction: column;
  font-family: var(--font-condensed);
  font-size: 8px;
  letter-spacing: 0.06em;
  color: rgba(246, 240, 228, 0.35);
  line-height: 1.5;
}
.control-item b { font-size: 9px; color: rgba(246, 240, 228, 0.72); font-weight: 600; letter-spacing: 0.08em; }

.start-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-condensed);
  font-size: 8px;
  letter-spacing: 0.13em;
  color: rgba(246, 240, 228, 0.25);
  border-top: 1px solid rgba(246, 240, 228, 0.08);
  padding-top: 12px;
}
.start-hint { color: rgba(246, 240, 228, 0.55); }
.start-hint b { color: var(--amber); }
.start-hint { animation: hintBlink 2.4s infinite; }
@keyframes hintBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ============================================================
   MODALS
   ============================================================ */
.modal-screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(5, 8, 12, 0.56);
  backdrop-filter: blur(11px) saturate(0.8);
  -webkit-backdrop-filter: blur(11px) saturate(0.8);
  transition: opacity 0.35s ease, visibility 0.35s;
}
.modal-card {
  position: relative;
  width: min(430px, 94vw);
  padding: clamp(26px, 4vw, 42px);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 30%),
    linear-gradient(160deg, rgba(20, 27, 38, 0.96), rgba(8, 12, 18, 0.97));
  border: 1px solid rgba(246, 240, 228, 0.18);
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.6);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 30px), calc(100% - 30px) 100%, 0 100%);
  animation: cardIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 68px;
  height: 3px;
  background: var(--amber);
}
.modal-kicker {
  display: block;
  font-family: var(--font-condensed);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: var(--amber);
  margin-bottom: 12px;
}
.modal-card h2 {
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 52px);
  font-style: italic;
  line-height: 0.95;
  letter-spacing: -0.055em;
}
.modal-card > p { color: rgba(246, 240, 228, 0.55); font-size: 12px; line-height: 1.8; margin-top: 12px; }
.modal-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; margin-top: 25px; }
.modal-actions.horizontal { flex-direction: row; flex-wrap: wrap; align-items: center; }
.ghost-btn {
  padding: 9px 2px;
  font-family: var(--font-condensed);
  font-size: 10px;
  letter-spacing: 0.11em;
  color: rgba(246, 240, 228, 0.52);
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.ghost-btn:hover { color: var(--paper); border-bottom-color: rgba(246, 240, 228, 0.3); }
.pause-tips { display: flex; gap: 10px; align-items: center; margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; font-family: var(--font-condensed); font-size: 8px; letter-spacing: 0.07em; color: rgba(246, 240, 228, 0.32); }
.pause-tips kbd { min-width: 18px; height: 17px; font-size: 8px; padding: 0 4px; }

/* finish */
.finish-screen { background: rgba(5, 8, 12, 0.42); }
.finish-rays {
  position: absolute;
  inset: -70%;
  background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(255, 178, 26, 0.13) 0deg 4deg, transparent 4deg 12deg);
  animation: raysSpin 42s linear infinite;
  mask-image: radial-gradient(circle at center, black 0%, transparent 68%);
  -webkit-mask-image: radial-gradient(circle at center, black 0%, transparent 68%);
  pointer-events: none;
}
@keyframes raysSpin { to { transform: rotate(360deg); } }
.finish-card { width: min(530px, 94vw); }
.finish-place {
  display: flex;
  align-items: baseline;
  line-height: 0.82;
  margin: 4px 0 14px;
}
.finish-place span { font-family: var(--font-display); font-style: italic; font-size: 26px; color: var(--amber); margin-right: 3px; }
.finish-place b {
  font-family: var(--font-display);
  font-size: clamp(84px, 12vw, 132px);
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.1em;
  color: var(--paper);
  text-shadow: 0 10px 45px rgba(0, 0, 0, 0.4);
}
.finish-place em { font-family: var(--font-condensed); font-style: normal; font-size: 17px; color: rgba(246, 240, 228, 0.35); margin-left: 8px; }
.finish-card h2 { font-size: clamp(30px, 4.4vw, 44px); color: var(--amber); margin-top: 4px; }
.finish-subtitle { margin-top: 6px !important; }
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: rgba(246, 240, 228, 0.12);
  margin-top: 20px;
  border: 1px solid rgba(246, 240, 228, 0.12);
}
.result-grid > div { background: rgba(8, 12, 18, 0.9); padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; }
.result-grid span { font-family: var(--font-condensed); font-size: 8px; letter-spacing: 0.13em; color: rgba(246, 240, 228, 0.38); }
.result-grid strong { font-family: "SFMono-Regular", "Menlo", monospace; font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.result-grid small { font-size: 9px; opacity: 0.4; }
.final-standings { display: grid; gap: 2px; margin-top: 16px; }
.final-row {
  display: grid;
  grid-template-columns: 25px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 5px 7px;
  font-family: var(--font-condensed);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: rgba(246, 240, 228, 0.52);
  background: rgba(255, 255, 255, 0.025);
}
.final-row.is-player { color: var(--paper); background: rgba(255, 178, 26, 0.1); }
.final-row b { color: var(--amber); font-weight: 700; }
.final-row .name { display: flex; align-items: center; gap: 7px; }
.final-row time { font-family: "SFMono-Regular", "Menlo", monospace; font-size: 9px; opacity: 0.6; }

/* ============================================================
   TOUCH
   ============================================================ */
.touch-controls {
  position: absolute;
  inset: auto 0 0;
  z-index: 6;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 18px calc(18px + env(safe-area-inset-bottom)) 18px;
  pointer-events: none;
  transition: opacity 0.25s;
}
.touch-controls .touch-steer,
.touch-controls .touch-pedals { display: flex; align-items: flex-end; gap: 9px; pointer-events: auto; }
.touch-btn {
  width: 63px;
  height: 63px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(246, 240, 228, 0.28);
  background: rgba(8, 12, 18, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(246, 240, 228, 0.8);
  font-family: var(--font-condensed);
  font-size: 11px;
  letter-spacing: 0.04em;
  border-radius: 50%;
  touch-action: none;
  transition: transform 0.1s, background 0.1s;
}
.touch-btn.is-pressed { background: rgba(255, 178, 26, 0.76); color: var(--ink); transform: scale(0.93); border-color: var(--amber); }
.steer-btn { width: 66px; height: 66px; font-size: 17px; }
.throttle-btn { width: 82px; height: 82px; margin-left: 2px; background: rgba(255, 178, 26, 0.2); border-color: rgba(255, 178, 26, 0.55); color: var(--amber); font-size: 13px; }
.brake-btn { width: 58px; height: 58px; }
.drift-btn { width: 58px; height: 58px; font-size: 10px; }
.nitro-btn { width: 50px; height: 50px; color: var(--cyan); border-color: rgba(126, 232, 255, 0.45); font-size: 9px; }
.touch-btn:active { background: rgba(255, 178, 26, 0.65); color: var(--ink); }

.rotate-notice {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: #070a0f;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 30px;
}
.rotate-icon { font-size: 54px; color: var(--amber); animation: rotateHint 2s ease-in-out infinite; }
.rotate-notice strong { font-size: 20px; }
.rotate-notice span { font-size: 12px; color: rgba(246, 240, 228, 0.5); }
@keyframes rotateHint { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(90deg); } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (pointer: coarse) {
  .touch-controls:not(.is-hidden) { display: flex; }
  .hud-bottom-center { display: none; }
  .hud-bottom-left { bottom: 104px; }
  .minimap-panel { opacity: 0.7; }
  .hud-bottom-right { width: 152px; right: 8px; bottom: 96px; opacity: 0.92; }
}
@media (max-width: 1100px) {
  .hud-bottom-center { display: none; }
  .hud-bottom-right { width: clamp(200px, 25vw, 270px); }
  .standings { display: none; }
  .hero-copy { width: min(600px, 66vw); }
}
@media (max-width: 900px) {
  .control-strip { gap: 15px; }
  .control-item:nth-child(3) { display: none; }
  .start-meta span:nth-child(2),
  .start-meta span:nth-child(3) { display: none; }
  .hero-desc br { display: none; }
  .lap-panel, .minimap-panel, .nitro-panel { width: 190px; }
  #minimap { width: 170px; height: 170px; }
  .hud-top-left { gap: 8px; }
  .minimap-panel { padding: 7px 8px 8px; }
  .minimap-head { font-size: 7px; }
  .start-bottom span:nth-child(1) { display: none; }
  .start-bottom { justify-content: space-between; }
  .hero-copy { width: 72vw; }
  .cn-title { display: none; }
  .hero-subline { margin-top: 18px; }
  .position-line b { font-size: 52px; }
  .position-panel { min-width: 130px; }
}
@media (max-width: 680px) {
  .start-screen { padding: 16px 18px 14px; background: linear-gradient(0deg, rgba(5,8,12,0.94), rgba(5,8,12,0.45) 60%, rgba(5,8,12,0.8)); }
  .start-meta { display: none; }
  .hero-copy { width: 100%; padding-top: 6vh; margin-bottom: auto; }
  .hero-title { font-size: clamp(62px, 21vw, 110px); }
  .hero-desc { display: none; }
  .cn-title { display: block; writing-mode: horizontal-tb; font-size: 15px; letter-spacing: 0.25em; }
  .hero-subline { margin-top: 17px; }
  .start-actions { flex-direction: column; align-items: flex-start; gap: 16px; margin-top: 25px; }
  .primary-btn { min-width: 220px; }
  .start-record { flex-direction: row; gap: 8px; align-items: baseline; }
  .control-strip { display: none; }
  .start-bottom { font-size: 7px; }
  .start-bottom span:nth-child(3) { display: none; }
  .hud-top-left { top: 14px; left: 14px; }
  .hud-top-right { top: 14px; right: 14px; }
  .lap-panel { width: 146px; padding: 10px 11px 9px; }
  .lap-count { font-size: 21px; }
  .lap-count b { font-size: 27px; }
  .time-row { font-size: 9px; }
  .time-row strong { font-size: 10px; }
  .minimap-panel { display: none; }
  .nitro-panel { width: 150px; }
  .hud-bottom-left { bottom: 103px; left: 14px; }
  .nitro-hint { display: none; }
  .hud-bottom-right { width: 160px; right: 6px; bottom: 6px; }
  .pause-button { top: 14px; }
  .position-panel { min-width: 104px; padding: 8px 11px 8px; }
  .position-line b { font-size: 42px; }
  .position-prefix { font-size: 13px; }
  .position-line em { font-size: 10px; }
  .hud-center { top: 20%; }
  .notif-main { font-size: 26px; }
  .modal-card { padding: 24px 21px; }
  .result-grid { margin-top: 15px; }
  .pause-tips { flex-wrap: wrap; }
}
@media (max-height: 520px) and (pointer: coarse) {
  .minimap-panel { display: none; }
  .hud-bottom-left { bottom: 96px; }
  .hud-bottom-right { width: 136px; bottom: 88px; }
  .lap-panel { width: 164px; }
  .nitro-panel { width: 142px; }
}
@media (max-height: 620px) and (orientation: landscape) {
  .hero-title { font-size: 70px; }
  .hero-copy { padding-top: 2vh; }
  .kicker-line { margin-bottom: 9px; }
  .hero-subline { margin-top: 11px; }
  .start-actions { margin-top: 14px; }
  .control-strip { display: none; }
  .start-bottom { padding-top: 7px; }
  .start-screen { padding-top: 14px; padding-bottom: 10px; }
  .hud-bottom-left { bottom: 74px; }
  .hud-bottom-right { width: 180px; }
}
@media (orientation: portrait) and (max-width: 500px) and (pointer: coarse) {
  .rotate-notice { display: flex; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Compact results for short landscape screens */
@media (max-height: 560px) {
  .modal-screen { align-items: flex-start; overflow-y: auto; padding: 10px; }
  .finish-card { width: min(620px, 96vw); padding: 18px 24px 16px; }
  .finish-card .modal-kicker { margin-bottom: 4px; }
  .finish-place { margin: 0 0 8px; }
  .finish-place b { font-size: 62px; }
  .finish-place span { font-size: 17px; }
  .finish-place em { font-size: 12px; }
  .finish-card h2 { font-size: 24px; margin-top: 0; }
  .finish-subtitle { display: none; }
  .result-grid { grid-template-columns: repeat(4, 1fr); margin-top: 10px; }
  .result-grid > div { padding: 6px 9px; gap: 3px; }
  .result-grid strong { font-size: 12px; }
  .final-standings { display: none; }
  .finish-card .modal-actions { margin-top: 12px; }
  .finish-card .primary-btn.small { min-width: 180px; padding: 10px 14px; }
  .pause-card { padding: 22px 24px; }
  .pause-card h2 { font-size: 32px; }
  .pause-card .modal-actions { margin-top: 14px; }
  .pause-tips { margin-top: 12px; padding-top: 10px; }
}

/* ============================================================
   RACE SETUP / GARAGE
   ============================================================ */
.setup-screen {
  z-index: 12;
  display: flex;
  flex-direction: column;
  padding: clamp(18px, 2.8vw, 36px) clamp(20px, 4vw, 58px) clamp(14px, 2vw, 24px);
  background:
    linear-gradient(90deg, rgba(5, 8, 12, 0.97) 0%, rgba(5, 8, 12, 0.88) 32%, rgba(5, 8, 12, 0.35) 61%, rgba(5, 8, 12, 0.08) 100%),
    linear-gradient(0deg, rgba(5, 8, 12, 0.86) 0%, transparent 24%, transparent 80%, rgba(5, 8, 12, 0.5) 100%);
  overflow: hidden;
}
.setup-screen.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.setup-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 74% 50%, transparent 2%, rgba(5, 8, 12, 0.18) 68%, rgba(5, 8, 12, 0.42) 100%);
}
.setup-screen::before {
  content: "";
  position: absolute;
  left: clamp(20px, 4vw, 58px);
  top: 50%;
  width: 38%;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 178, 26, 0.55), transparent);
  opacity: 0.5;
  pointer-events: none;
}
.setup-top,
.setup-content,
.setup-footer {
  position: relative;
  z-index: 2;
}
.setup-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: clamp(12px, 1.7vw, 20px);
  border-bottom: 1px solid rgba(246, 240, 228, 0.12);
}
.setup-heading { display: flex; align-items: baseline; gap: 14px; margin-left: auto; margin-right: 20px; }
.setup-kicker {
  font-family: var(--font-condensed);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: var(--amber);
}
.setup-heading h2 {
  font-family: var(--font-display);
  font-size: clamp(24px, 2.6vw, 38px);
  font-style: italic;
  letter-spacing: -0.045em;
  line-height: 1;
}
.setup-close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(246, 240, 228, 0.22);
  color: rgba(246, 240, 228, 0.7);
  font-size: 21px;
  font-weight: 300;
  line-height: 1;
  transition: all 0.2s;
}
.setup-close:hover { background: rgba(246, 240, 228, 0.1); color: var(--paper); }

.setup-content {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: space-between;
  gap: 26px;
  padding-top: clamp(14px, 2vw, 24px);
}
.setup-panel {
  width: min(650px, 55vw);
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2vh, 22px);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 178, 26, 0.45) transparent;
}
.setup-panel::-webkit-scrollbar { width: 4px; }
.setup-panel::-webkit-scrollbar-thumb { background: rgba(255, 178, 26, 0.45); }
.setup-group { display: flex; flex-direction: column; gap: 10px; }
.setup-group-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 2px;
}
.setup-step {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
  font-style: italic;
  color: var(--amber);
  letter-spacing: -0.02em;
  align-self: flex-start;
  padding-top: 2px;
}
.setup-group-head h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-style: italic;
  letter-spacing: -0.02em;
  line-height: 1;
}
.setup-group-head p {
  margin-top: 4px;
  font-family: var(--font-condensed);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: rgba(246, 240, 228, 0.42);
}
.setup-count {
  margin-left: auto;
  font-family: var(--font-condensed);
  font-size: 8px;
  letter-spacing: 0.17em;
  color: rgba(246, 240, 228, 0.3);
  white-space: nowrap;
}

.car-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.car-card {
  --car: #ff3b30;
  position: relative;
  min-height: 150px;
  padding: 10px 11px 9px;
  display: flex;
  flex-direction: column;
  text-align: left;
  border: 1px solid rgba(246, 240, 228, 0.17);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.07), rgba(8, 11, 16, 0.82));
  background:
    radial-gradient(ellipse at 50% 25%, color-mix(in srgb, var(--car) 18%, transparent), transparent 65%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.07), rgba(8, 11, 16, 0.82));
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 11px), calc(100% - 11px) 100%, 0 100%);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
}
.car-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 34px;
  height: 3px;
  background: var(--car);
  box-shadow: 0 0 12px var(--car);
  transition: width 0.25s;
}
.car-card:hover { transform: translateY(-2px); border-color: rgba(246, 240, 228, 0.36); }
.car-card.is-selected {
  border-color: var(--amber);
  background:
    radial-gradient(ellipse at 50% 25%, color-mix(in srgb, var(--car) 28%, transparent), transparent 65%),
    linear-gradient(145deg, rgba(255, 178, 26, 0.12), rgba(8, 11, 16, 0.9));
  box-shadow: inset 0 0 0 1px rgba(255, 178, 26, 0.25), 0 8px 26px rgba(0, 0, 0, 0.22);
}
.car-card.is-selected::before { width: 100%; background: var(--amber); }
.car-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-condensed);
  font-size: 8px;
  letter-spacing: 0.13em;
  color: rgba(246, 240, 228, 0.3);
}
.car-card-head em {
  font-style: normal;
  font-weight: 700;
  color: var(--car);
}
.car-card-visual {
  margin: 7px -3px 3px;
  height: 44px;
  color: var(--car);
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.45));
}
.car-card-visual svg { display: block; width: 100%; height: 100%; overflow: visible; }
.car-card-name {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(12px, 1.1vw, 15px);
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--paper);
  white-space: nowrap;
}
.car-card-cn {
  display: block;
  margin-top: 4px;
  font-family: var(--font-condensed);
  font-size: 8px;
  letter-spacing: 0.06em;
  color: rgba(246, 240, 228, 0.4);
}
.car-card-bars {
  display: flex;
  gap: 2px;
  margin-top: auto;
  padding-top: 8px;
}
.car-card-bars i {
  display: block;
  height: 3px;
  flex: 1;
  background: rgba(246, 240, 228, 0.12);
  transform: skewX(-24deg);
  overflow: hidden;
}
.car-card-bars i b { display: block; height: 100%; background: var(--car); opacity: 0.75; }

.track-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.track-card {
  position: relative;
  min-height: 126px;
  padding: 7px 7px 9px;
  text-align: left;
  border: 1px solid rgba(246, 240, 228, 0.15);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(8, 11, 16, 0.82));
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
  overflow: hidden;
}
.track-card:hover { transform: translateY(-2px); border-color: rgba(246, 240, 228, 0.35); }
.track-card.is-selected {
  border-color: var(--amber);
  background: linear-gradient(145deg, rgba(255, 178, 26, 0.14), rgba(8, 11, 16, 0.9));
  box-shadow: inset 0 0 0 1px rgba(255, 178, 26, 0.22);
}
.track-card.is-selected::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--amber);
}
.track-thumb {
  display: block;
  width: 100%;
  height: 72px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(246, 240, 228, 0.07);
}
.track-thumb canvas { display: block; width: 100%; height: 100%; }
.track-card-info { display: block; padding: 7px 3px 0; }
.track-card-info strong {
  display: block;
  font-family: var(--font-display);
  font-size: 13px;
  font-style: italic;
  letter-spacing: -0.02em;
  color: var(--paper);
}
.track-card-info small {
  display: block;
  margin-top: 3px;
  font-family: var(--font-condensed);
  font-size: 7px;
  letter-spacing: 0.08em;
  color: rgba(246, 240, 228, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.setup-actions {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: auto;
  padding-top: 2px;
}
.setup-actions .primary-btn { flex: 0 0 auto; min-width: 218px; }
.setup-choice {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-condensed);
  font-size: 8px;
  letter-spacing: 0.12em;
  color: rgba(246, 240, 228, 0.32);
}
.setup-choice strong {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-condensed);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: rgba(246, 240, 228, 0.82);
}
.setup-choice em { font-style: normal; color: rgba(246, 240, 228, 0.25); }
#choiceDot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px currentColor;
}

.setup-aside {
  width: min(306px, 24vw);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  gap: 18px;
  padding: 12px 0 5px;
  pointer-events: none;
}
.setup-preview-card {
  padding: 16px 18px 15px;
  border: 1px solid rgba(246, 240, 228, 0.16);
  border-left: 2px solid var(--amber);
  background: linear-gradient(160deg, rgba(9, 13, 20, 0.56), rgba(9, 13, 20, 0.24));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
}
.setup-preview-card h3 {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: clamp(25px, 2.6vw, 34px);
  font-style: italic;
  letter-spacing: -0.055em;
  line-height: 0.95;
}
.setup-preview-card p {
  margin-top: 8px;
  font-size: 10px;
  line-height: 1.7;
  color: rgba(246, 240, 228, 0.52);
}
.preview-stats { display: flex; flex-direction: column; gap: 5px; margin-top: 14px; }
.preview-stat { display: grid; grid-template-columns: 30px 1fr 20px; align-items: center; gap: 7px; }
.preview-stat span { font-family: var(--font-condensed); font-size: 8px; letter-spacing: 0.05em; color: rgba(246, 240, 228, 0.4); }
.preview-stat i { height: 3px; background: rgba(246, 240, 228, 0.12); transform: skewX(-24deg); overflow: hidden; }
.preview-stat i b { display: block; height: 100%; background: linear-gradient(90deg, var(--stat-color, var(--amber)), #ffd875); }
.preview-stat em { font-family: "SFMono-Regular", Menlo, monospace; font-style: normal; font-size: 8px; color: rgba(246, 240, 228, 0.55); text-align: right; }
.setup-track-badge { padding: 4px 2px 0; text-align: right; }
.setup-track-badge > span { font-family: var(--font-condensed); font-size: 8px; letter-spacing: 0.2em; color: rgba(246, 240, 228, 0.35); }
.setup-track-badge strong { display: block; margin-top: 4px; font-family: var(--font-display); font-size: 22px; font-style: italic; letter-spacing: -0.04em; }
.setup-track-badge em { display: block; margin-top: 3px; font-family: var(--font-condensed); font-style: normal; font-size: 8px; letter-spacing: 0.1em; color: rgba(246, 240, 228, 0.42); }
.track-tags { display: flex; gap: 4px; justify-content: flex-end; margin-top: 7px; flex-wrap: wrap; }
.track-tags span {
  padding: 3px 6px;
  border: 1px solid rgba(246, 240, 228, 0.14);
  font-family: var(--font-condensed);
  font-size: 7px;
  letter-spacing: 0.06em;
  color: rgba(246, 240, 228, 0.45);
}

.setup-footer {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-top: 10px;
  margin-top: 8px;
  border-top: 1px solid rgba(246, 240, 228, 0.09);
  font-family: var(--font-condensed);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: rgba(246, 240, 228, 0.28);
}
.setup-footer span:last-child { margin-left: auto; }
.setup-footer kbd { min-width: 18px; height: 17px; font-size: 8px; }

@media (max-width: 1180px) {
  .setup-panel { width: min(600px, 62vw); }
  .setup-aside { width: 250px; }
  .car-card { min-height: 138px; }
  .setup-heading h2 { font-size: 26px; }
}
@media (max-width: 960px) {
  .setup-aside { display: none; }
  .setup-panel { width: 100%; max-width: 760px; }
  .setup-heading { margin-right: 0; }
  .car-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .track-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-height: 620px) {
  .setup-screen { padding: 8px 14px 6px; overflow-y: auto; }
  .setup-aside { display: none; }
  .setup-content { flex: 0 0 auto; min-height: 0; padding-top: 6px; padding-bottom: 4px; }
  .setup-panel { max-height: none; overflow: visible; width: 100%; max-width: 820px; gap: 6px; }
  .setup-top { padding-bottom: 4px; }
  .setup-top .brand-glyph { width: 30px; height: 30px; font-size: 17px; }
  .setup-top .brand-copy { font-size: 8px; }
  .setup-heading h2 { font-size: 20px; }
  .setup-kicker { font-size: 6.5px; }
  .setup-group { gap: 4px; }
  .setup-group-head { gap: 9px; }
  .setup-group-head p { display: none; }
  .setup-group-head h3 { font-size: 13px; }
  .setup-step { font-size: 11px; }
  .setup-count { font-size: 6.5px; }
  .car-list { gap: 6px; }
  .car-card { min-height: 86px; padding: 5px 7px 5px; }
  .car-card::before { width: 26px; }
  .car-card-head { font-size: 7px; }
  .car-card-visual { height: 26px; margin: 2px -2px 1px; }
  .car-card-name { font-size: 10px; }
  .car-card-cn { display: none; }
  .car-card-bars { display: none; }
  .track-list { gap: 6px; }
  .track-card { min-height: 76px; padding: 4px 4px 4px; }
  .track-thumb { height: 34px; }
  .track-card-info { padding-top: 3px; }
  .track-card-info strong { font-size: 10px; }
  .track-card-info small { font-size: 6px; }
  .setup-actions { gap: 12px; position: static; padding: 4px 0 0; background: none; }
  .setup-actions .primary-btn { min-width: 176px; padding: 7px 12px; }
  .setup-actions .primary-btn .btn-text { font-size: 15px; }
  .setup-actions .primary-btn .btn-text small { margin-top: 4px; font-size: 7px; }
  .setup-actions .primary-btn .btn-arrow { font-size: 19px; }
  .setup-choice { font-size: 6.5px; }
  .setup-choice strong { font-size: 8.5px; }
  .setup-footer { display: none; }
}
@media (max-height: 460px) {
  .setup-choice { display: none; }
}
@media (max-width: 680px) {
  .setup-heading { display: none; }
  .setup-top { justify-content: space-between; }
  .car-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .track-list { grid-template-columns: 1fr; }
  .track-thumb { height: 56px; }
  .track-card { min-height: 82px; display: flex; gap: 8px; align-items: center; }
  .track-thumb { width: 108px; flex: 0 0 108px; height: 58px; }
  .track-card-info { padding: 0; }
  .setup-actions { flex-direction: column; align-items: flex-start; }
}
