:root {
  --bg-deep: #0a0a0b;
  --bg-panel: #14141a;
  --bg-elevated: #1c1c25;
  --line: rgba(201, 169, 110, 0.18);
  --text: #ece9e0;
  --muted: #8a8478;
  --amber: #f0b429;
  --amber-dim: #c68a12;
  --cyan: #5ec8d8;
  --ok: #3ecf8e;
  --bad: #ff6b6b;
  --road: #2a3344;
  --font: "Noto Sans SC", "IBM Plex Sans", system-ui, sans-serif;
  --radius: 14px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-deep);
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

kbd {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-family: "IBM Plex Sans", monospace;
  font-size: 0.72rem;
  color: var(--muted);
}

.app {
  min-height: 100vh;
}

.screen {
  display: none;
  min-height: 100vh;
}

.screen.is-active {
  display: block;
}

/* —— Home —— */
#screen-home {
  position: relative;
  overflow: hidden;
}

.home-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 38% at 18% 8%, rgba(201, 169, 110, 0.10), transparent 60%),
    radial-gradient(ellipse 55% 30% at 88% 92%, rgba(111, 158, 145, 0.06), transparent 65%),
    linear-gradient(180deg, #0c0c10 0%, #0a0a0b 50%, #06060a 100%);
}

.home-content {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 3rem;
}

.brand {
  margin: 0 0 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--amber);
}

.home-content h1,
.result-card h1 {
  margin: 0 0 0.85rem;
  font-size: clamp(1.9rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.lead {
  margin: 0 0 2rem;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.mode-grid-4 {
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 0;
}

.mode-card {
  text-align: left;
  padding: 1.15rem 1.2rem 1.25rem;
  border-radius: var(--radius);
  background: rgba(20, 20, 26, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.mode-card:hover {
  transform: translateY(-3px);
  border-color: rgba(240, 180, 41, 0.45);
  background: #1c1c25;
}

.mode-card-accent {
  background: linear-gradient(160deg, rgba(201, 169, 110, 0.12), rgba(28, 28, 37, 0.96) 55%);
  border-color: rgba(240, 180, 41, 0.4);
}

.mode-kicker {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--cyan);
}

.mode-name {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.mode-desc {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.cheat-sheet {
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px dashed rgba(255, 214, 140, 0.28);
  background: rgba(20, 20, 26, 0.72);
}

.cheat-sheet h2 {
  margin: 0 0 0.7rem;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  color: var(--amber);
}

.cheat-sheet ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.4rem;
}

.cheat-sheet li {
  color: var(--muted);
  font-size: 0.92rem;
}

.cheat-sheet em {
  font-style: normal;
  color: var(--text);
  font-weight: 600;
}

/* —— Play —— */
#screen-play {
  display: none;
  flex-direction: column;
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(201, 169, 110, 0.08), transparent 50%),
    var(--bg-deep);
}

#screen-play.is-active {
  display: flex;
}

.play-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
}

.play-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  justify-content: center;
  font-size: 0.88rem;
  color: var(--muted);
}

.play-meta span:first-child {
  color: var(--amber);
  font-weight: 600;
}

.ghost-btn {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--muted);
  transition: color 0.15s, border-color 0.15s;
}

.ghost-btn:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.35);
}

.play-actions {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.ghost-btn-pause {
  border-color: rgba(240, 180, 41, 0.45);
  color: var(--amber);
}

.ghost-btn-pause.is-paused-btn {
  border-color: rgba(62, 207, 142, 0.55);
  color: var(--ok);
  background: rgba(62, 207, 142, 0.12);
}

#screen-play.is-paused .timer-fill {
  opacity: 0.55;
}

#screen-play.is-paused .prompt-panel {
  outline: 1px dashed rgba(240, 180, 41, 0.35);
  outline-offset: -1px;
}

.timer-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(1);
  background: linear-gradient(90deg, var(--cyan), var(--amber));
  transition: background 0.2s;
}

.timer-fill.urgent {
  background: linear-gradient(90deg, var(--amber), var(--bad));
}

.stage {
  display: block;
  padding: 1rem 1.25rem 0.5rem;
}

.prompt-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.4rem 1.5rem;
  border-radius: var(--radius);
  background: rgba(20, 20, 26, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.prompt-label {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  color: var(--cyan);
}

.prompt-text {
  margin: 0 0 0.75rem;
  font-size: clamp(1.35rem, 2.6vw, 1.85rem);
  font-weight: 700;
  line-height: 1.35;
}

.prompt-hint {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  min-height: 2.8em;
}

.feedback {
  margin-top: auto;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.feedback.is-ok {
  color: var(--ok);
  border-color: rgba(62, 207, 142, 0.35);
  background: rgba(62, 207, 142, 0.1);
}

.feedback.is-bad {
  color: #ffb4b4;
  border-color: rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.1);
}

.feedback.is-idle {
  color: var(--muted);
}

.dash {
  margin: 0.5rem 1.25rem 1.25rem;
  padding: 1rem 1.15rem 1.15rem;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #182338, #101929);
  border: 1px solid var(--line);
}

.cluster-panel {
  margin-bottom: 1rem;
}

.meter {
  padding: 0.75rem 0.85rem 0.7rem;
  border-radius: 18px;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(255, 255, 255, 0.04), transparent 55%),
    linear-gradient(180deg, #1a222f 0%, #0d121a 100%);
  border: 1px solid rgba(255, 214, 140, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 14px 32px rgba(0, 0, 0, 0.35);
}

.meter-top {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.4rem;
  margin-bottom: 0.35rem;
}

.meter-body {
  display: grid;
  grid-template-columns: 1fr minmax(140px, 0.85fr) 1fr;
  gap: 0.55rem;
  align-items: center;
}

.gauge {
  aspect-ratio: 1;
  max-width: 220px;
  width: 100%;
  margin: 0 auto;
}

.gauge-face {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 45%, #2a3344 0%, #151b26 55%, #0a0e14 100%);
  border: 3px solid #3a4558;
  box-shadow:
    inset 0 0 0 2px #0a0e14,
    inset 0 0 28px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.05);
}

.gauge-ticks,
.gauge-ticks-speed {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background:
    repeating-conic-gradient(
      from -120deg,
      rgba(255, 255, 255, 0.55) 0deg 1.2deg,
      transparent 1.2deg 30deg
    );
  -webkit-mask: radial-gradient(circle, transparent 72%, #000 73%);
  mask: radial-gradient(circle, transparent 72%, #000 73%);
  opacity: 0.55;
}

.gauge-ticks-speed {
  background:
    repeating-conic-gradient(
      from -120deg,
      rgba(255, 255, 255, 0.55) 0deg 1.2deg,
      transparent 1.2deg 34.28deg
    );
}

.gauge-nums {
  position: absolute;
  inset: 0;
}

.gauge-nums span {
  position: absolute;
  --a: calc(-120deg + var(--i) * 30deg);
  left: calc(50% + sin(var(--a)) * 38%);
  top: calc(50% - cos(var(--a)) * 38%);
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: clamp(0.55rem, 1.8vw, 0.72rem);
  font-weight: 600;
  color: rgba(230, 235, 245, 0.78);
}

.gauge-nums-speed span {
  --a: calc(-120deg + var(--i) * 40deg);
  font-size: clamp(0.5rem, 1.5vw, 0.62rem);
}

.gauge-needle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 38%;
  margin-left: -1.5px;
  transform-origin: bottom center;
  transform: translateY(-100%) rotate(-110deg);
  background: linear-gradient(180deg, #ff4d4d, #b01010);
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(255, 60, 60, 0.45);
}

.gauge-needle-speed {
  transform: translateY(-100%) rotate(-118deg);
}

.gauge-hub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: #c9ced8;
  box-shadow: inset 0 0 0 3px #2a303a;
}

.gauge-unit {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18%;
  text-align: center;
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  color: rgba(154, 168, 189, 0.75);
}

.gauge-ind {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  min-width: 0;
  z-index: 2;
}

.gauge-ind svg {
  width: 28px;
  height: 28px;
}

.ind-deco {
  color: rgba(255, 255, 255, 0.12);
}

.ind-deco svg {
  width: 18px;
  height: 18px;
}

.meter-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 4rem;
}

.ind {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: rgba(255, 255, 255, 0.12);
  transition: color 0.15s, filter 0.15s, opacity 0.15s;
}

.ind svg,
.icon-svg {
  width: 34px;
  height: 34px;
  display: block;
  color: inherit;
}

.meter-top .ind svg {
  width: 30px;
  height: 30px;
}

.ind.on {
  filter: drop-shadow(0 0 6px currentColor);
}

.ind-pos.on {
  color: #3ecf8e;
}

.ind-low.on {
  color: #3ecf8e;
}

.ind-high.on {
  color: #4db3ff;
}

.ind-signal.on {
  color: #3ecf8e;
}

.ind-hazard.on {
  color: #ff5a4a;
}

.ind.blink {
  animation: indBlink 0.55s steps(1) infinite;
}

.ind-high.flashing {
  animation: highFlash 0.28s steps(1) infinite;
}

@keyframes indBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.15; }
}

@keyframes highFlash {
  0%, 49% { color: #4db3ff; opacity: 1; }
  50%, 100% { color: #3ecf8e; opacity: 0.9; }
}

.cluster-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.status-hint {
  font-size: 0.72rem;
  color: var(--muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  transition: background 0.15s, box-shadow 0.15s;
}

.status-dot.is-on {
  background: var(--ok);
  box-shadow: 0 0 10px rgba(62, 207, 142, 0.7);
}

.status-dot.is-warn {
  background: #4db3ff;
  box-shadow: 0 0 10px rgba(77, 179, 255, 0.7);
}

.status-dot.is-alert {
  background: #ff6b5a;
  box-shadow: 0 0 10px rgba(255, 107, 90, 0.7);
}

.light-state {
  margin: 0;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.control-label {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  color: var(--amber-dim);
}

.btn-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
}

.light-btn {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.7rem;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 600;
  font-size: 0.92rem;
  text-align: left;
  transition: transform 0.12s, border-color 0.12s, background 0.12s, box-shadow 0.12s;
}

.light-btn:hover {
  border-color: rgba(240, 180, 41, 0.4);
}

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

.light-btn.is-active {
  border-color: var(--amber);
  background: rgba(240, 180, 41, 0.16);
  box-shadow: inset 0 0 0 1px rgba(240, 180, 41, 0.25);
}

.light-btn.is-active .btn-icon {
  color: var(--amber);
  background: rgba(240, 180, 41, 0.18);
  box-shadow: 0 0 16px rgba(240, 180, 41, 0.25);
}

.btn-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 48px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  color: rgba(243, 239, 230, 0.88);
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}

.btn-icon .icon-svg,
.icon-svg {
  width: 36px;
  height: 36px;
  display: block;
}

.btn-copy {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.btn-name {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}

.btn-sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.2;
}

.light-btn kbd {
  align-self: start;
  margin-left: 0;
}

.light-btn-flash.is-active {
  border-color: #9fdfff;
  background: rgba(120, 200, 255, 0.16);
}

.light-btn-flash.is-active .btn-icon {
  color: #9fdfff;
  background: rgba(120, 200, 255, 0.16);
  box-shadow: 0 0 16px rgba(120, 200, 255, 0.28);
}

.light-btn-signal.is-active {
  border-color: var(--ok);
  background: rgba(62, 207, 142, 0.14);
}

.light-btn-signal.is-active .btn-icon {
  color: var(--ok);
  background: rgba(62, 207, 142, 0.16);
  box-shadow: 0 0 16px rgba(62, 207, 142, 0.25);
}

.light-btn[data-light="high"] .btn-icon {
  color: #4db3ff;
}

.light-btn[data-light="low"] .btn-icon {
  color: #3ecf8e;
}

.light-btn[data-light="position"] .btn-icon {
  color: #3ecf8e;
}

.light-btn-signal .icon-signal {
  color: #3ecf8e;
}

.light-btn-signal .icon-hazard,
.light-btn[data-light="hazard"] .btn-icon {
  color: #ff5a4a;
}

.light-btn[data-light="flash"] .btn-icon {
  color: #4db3ff;
}

.light-btn-flash .icon-flash {
  animation: flashIconPulse 0.55s steps(1) infinite;
}

@keyframes flashIconPulse {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.35; }
}

.light-btn[data-light="hazard"].is-active {
  border-color: #ff6b5a;
  background: rgba(255, 107, 90, 0.14);
}

.light-btn[data-light="hazard"].is-active .btn-icon {
  color: #ff6b5a;
  background: rgba(255, 107, 90, 0.16);
  box-shadow: 0 0 16px rgba(255, 107, 90, 0.28);
}

.light-btn-off {
  color: var(--muted);
}

.light-btn-off.is-active .btn-icon {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

/* —— Result —— */
#screen-result {
  display: none;
  place-items: center;
  padding: 2rem 1.25rem;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(240, 180, 41, 0.16), transparent 55%),
    var(--bg-deep);
}

#screen-result.is-active {
  display: grid;
}

.result-card {
  width: min(520px, 100%);
  padding: 2rem 1.6rem;
  border-radius: calc(var(--radius) + 4px);
  background: rgba(20, 20, 26, 0.95);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: center;
}

.result-score {
  margin: 0 0 1.25rem;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--amber);
}

.result-detail {
  text-align: left;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 1.5rem;
}

.result-detail ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

.result-detail li {
  margin-bottom: 0.35rem;
}

.result-detail strong {
  color: var(--text);
}

.result-actions {
  display: grid;
  gap: 0.75rem;
  justify-items: center;
}

.result-actions .mode-card {
  width: 100%;
  text-align: center;
}

/* —— 起步 / 靠边 —— */
#screen-maneuver {
  display: none;
  flex-direction: column;
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(240, 180, 41, 0.08), transparent 50%),
    var(--bg-deep);
}

#screen-maneuver.is-active {
  display: flex;
}

#screen-maneuver-result {
  display: none;
  place-items: center;
  padding: 2rem 1.25rem;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(240, 180, 41, 0.16), transparent 55%),
    var(--bg-deep);
}

#screen-maneuver-result.is-active {
  display: grid;
}

.maneuver-layout {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  gap: 1rem;
  padding: 1rem 1.25rem 1.25rem;
  flex: 1;
  min-height: 0;
}

.maneuver-side {
  padding: 1rem;
  border-radius: var(--radius);
  background: rgba(20, 20, 26, 0.92);
  border: 1px solid var(--line);
}

.sim-stats {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.sim-stats li {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.sim-stats li.is-warn {
  color: #ff6b5a;
  border-color: rgba(255, 107, 90, 0.4);
  background: rgba(255, 107, 90, 0.12);
}

.sim-stats li.is-ok {
  color: var(--ok);
  border-color: rgba(62, 207, 142, 0.35);
  background: rgba(62, 207, 142, 0.1);
}

.maneuver-tip {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
}

.maneuver-main {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.sim-prompt .prompt-text {
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
}

.sim-stage {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0a0a0b;
  box-shadow: var(--shadow);
  min-height: 240px;
}

.sim-stage-3d {
  position: relative;
  min-height: min(56vh, 560px);
}

.cockpit-vignette {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 78% 70% at 50% 48%, transparent 42%, rgba(8, 12, 18, 0.45) 100%),
    linear-gradient(180deg, rgba(10, 14, 22, 0.22) 0%, transparent 18%, transparent 78%, rgba(10, 14, 22, 0.3) 100%);
  z-index: 1;
}

/* 参考手游：视口叠加触控 HUD */
.cockpit-hud {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.cockpit-hud > * {
  pointer-events: auto;
}

.hud-signals {
  position: absolute;
  left: 5%;
  bottom: 14%;
  display: flex;
  gap: 0.65rem;
  align-items: center;
}

.hud-circle {
  width: clamp(64px, 8.5vw, 88px);
  height: clamp(64px, 8.5vw, 88px);
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
  box-shadow:
    0 4px 18px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: background 0.12s, border-color 0.12s, transform 0.12s, box-shadow 0.12s;
}

/* 转向灯圆钮：比通用圆钮更小 */
.hud-signal {
  width: clamp(42px, 5.2vw, 52px);
  height: clamp(42px, 5.2vw, 52px);
  border-width: 2px;
}

.hud-circle svg {
  width: 42%;
  height: 42%;
}

.hud-signal svg {
  width: 48%;
  height: 48%;
}

.hud-circle:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: #fff;
  transform: scale(1.04);
}

.hud-circle.is-active {
  background: rgba(62, 207, 142, 0.42);
  border-color: #7dffc0;
  box-shadow:
    0 0 0 4px rgba(62, 207, 142, 0.28),
    0 4px 18px rgba(0, 0, 0, 0.35);
}

.hud-circle.is-warn {
  background: rgba(255, 107, 90, 0.42);
  border-color: #ff8a7a;
}

.hud-right-area {
  position: absolute;
  right: 2.5%;
  bottom: 5%;
  display: flex;
  align-items: flex-end;
  gap: 0.85rem;
}

/* 观察 → 手刹 → 档位，竖排对齐、互不重叠 */
.hud-right-tools {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.hud-right-tools .hud-hb {
  position: static;
  width: clamp(44px, 5.5vw, 54px);
  height: clamp(44px, 5.5vw, 54px);
  flex-shrink: 0;
}

/* 靠边停车：右后视镜（判断离路边 30–50cm） */
.hud-right-mirror {
  position: absolute;
  right: 3%;
  top: 10%;
  width: clamp(148px, 22vw, 210px);
  padding: 5px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(160deg, #3a4048, #1a1e24);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  cursor: pointer;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transform: perspective(280px) rotateY(-14deg);
}

.hud-right-mirror[hidden] {
  display: none !important;
}

.hud-right-mirror canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  background: #2a3038;
}

.hud-right-mirror-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0.15rem 0.1rem;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.72rem;
  font-weight: 700;
}

.hud-right-mirror-gap {
  font-variant-numeric: tabular-nums;
  color: #c8d0d8;
}

.hud-right-mirror-gap.is-ok {
  color: #3ecf8e;
}

.hud-right-mirror-gap.is-warn {
  color: #f0b429;
}

.hud-right-mirror-gap.is-bad {
  color: #ff8a7a;
}

.hud-right-mirror:hover {
  outline: 2px solid rgba(125, 255, 192, 0.7);
  outline-offset: 2px;
}

.hud-right-mirror.is-active {
  outline: 2px solid #3ecf8e;
  outline-offset: 2px;
}

/* 竖排自动挡：P R N D */
.hud-shifter {
  position: relative;
  width: 64px;
  height: 152px;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: linear-gradient(180deg, rgba(18, 22, 30, 0.82), rgba(10, 12, 18, 0.88));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  padding: 8px 6px 8px 26px;
  flex-shrink: 0;
}

.hud-shifter-slot {
  position: absolute;
  left: 12px;
  top: 12px;
  bottom: 12px;
  width: 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.hud-shifter-knob {
  position: absolute;
  left: 5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(160deg, #3a414c, #1a1e24);
  border: 2px solid rgba(255, 255, 255, 0.55);
  display: grid;
  place-items: center;
  color: #c8d0d8;
  font-size: 0.65rem;
  transition: top 0.18s ease;
  z-index: 3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  top: 10px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.hud-shifter-knob:focus-visible {
  outline: 2px solid #3ecf8e;
  outline-offset: 2px;
}

.hud-shifter-knob.is-dragging {
  cursor: grabbing;
  transition: none;
  border-color: #7dffc0;
  color: #7dffc0;
}

.hud-shifter-knob[data-gear="R"] { top: 42px; }
.hud-shifter-knob[data-gear="N"] { top: 74px; }
.hud-shifter-knob[data-gear="D"] {
  top: 106px;
  border-color: #3ecf8e;
  color: #3ecf8e;
}

.hud-shifter-gears {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: 2px 0;
}

.hud-shift-opt {
  appearance: none;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.hud-shift-opt.is-active {
  color: #3ecf8e;
  text-shadow: 0 0 8px rgba(62, 207, 142, 0.5);
}

.hud-shift-opt:hover {
  color: rgba(255, 255, 255, 0.85);
}

.hud-pedals {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
  padding-bottom: 0.15rem;
}

.hud-pedal {
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.45);
  background: rgba(12, 16, 24, 0.35);
  color: #fff;
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.hud-pedal-face {
  display: block;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.35) 1.5px, transparent 2px);
  background-size: 10px 10px;
  background-position: center;
}

.hud-pedal-face-gas {
  background-color: rgba(80, 200, 220, 0.55);
}

.hud-pedal-face-brake {
  background-color: rgba(180, 190, 200, 0.5);
}

.hud-pedal-tag {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  text-align: center;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

/* 左油门（高窄） / 右脚刹（矮宽） */
.hud-pedal-gas {
  width: clamp(48px, 6vw, 60px);
  height: clamp(96px, 13vw, 128px);
}

.hud-pedal-brake {
  width: clamp(84px, 10vw, 110px);
  height: clamp(48px, 6.5vw, 60px);
}

.hud-pedal.is-active {
  border-color: #f0b429;
  box-shadow: 0 0 0 3px rgba(240, 180, 41, 0.35);
}

.hud-pedal-gas.is-active .hud-pedal-face-gas {
  background-color: rgba(80, 220, 200, 0.85);
}

.hud-pedal-brake.is-active .hud-pedal-face-brake {
  background-color: rgba(240, 180, 41, 0.75);
}

.hud-hb .hud-hb-ico {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.hud-pill {
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
}

.hud-cancel {
  position: absolute;
  left: calc(5% + clamp(42px, 5.2vw, 52px) * 2 + 1.1rem);
  bottom: 16%;
  width: auto;
  height: auto;
}

#maneuver-canvas {
  display: block;
  width: 100%;
  height: min(56vh, 560px);
  touch-action: none;
  background: #6a849c;
}

.sim-controls {
  padding: 0.85rem;
  border-radius: var(--radius);
  background: rgba(20, 20, 26, 0.92);
  border: 1px solid var(--line);
  display: grid;
  gap: 0.55rem;
}

.sim-controls-cabin {
  gap: 0.65rem;
}

.cabin-hint-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gold, #f0b429);
  letter-spacing: 0.02em;
}

.cabin-hint-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.4rem;
}

.cabin-hint-list li {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
}

.cabin-hint-list em {
  font-style: normal;
  color: var(--text);
  font-weight: 600;
}

.cabin-hint-list kbd {
  font-size: 0.72rem;
}

.cabin-fallback {
  margin-top: 0.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.55rem;
}

.cabin-fallback summary {
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--muted);
  user-select: none;
  margin-bottom: 0.45rem;
}

.cabin-fallback[open] summary {
  margin-bottom: 0.55rem;
  color: var(--text);
}

.cabin-fallback .sim-row {
  margin-bottom: 0.45rem;
}

.sim-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
}

.sim-row:last-child {
  grid-template-columns: repeat(4, 1fr);
}

.sim-row-5 {
  grid-template-columns: repeat(5, 1fr);
}

.sim-btn {
  padding: 0.75rem 0.55rem;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 600;
  font-size: 0.88rem;
  transition: border-color 0.12s, background 0.12s, transform 0.12s;
}

.sim-btn:hover {
  border-color: rgba(240, 180, 41, 0.4);
}

.sim-btn:active,
.sim-btn.is-active {
  border-color: var(--amber);
  background: rgba(240, 180, 41, 0.16);
}

.sim-btn.is-next {
  border-color: var(--ok);
  box-shadow: 0 0 0 1px var(--ok);
}

.sim-btn[data-sim="observe"].is-active {
  border-color: var(--ok);
  background: rgba(62, 207, 142, 0.14);
}

.meta-hint {
  color: var(--muted);
  font-size: 0.82rem;
}

.result-detail .muted {
  color: var(--muted);
}

@media (max-width: 860px) {
  .mode-grid,
  .mode-grid-4 {
    grid-template-columns: 1fr;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .maneuver-layout {
    grid-template-columns: 1fr;
  }

  .sim-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .meter-body {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }

  .meter-center {
    grid-column: 1 / -1;
    order: -1;
  }

  .gauge {
    max-width: 160px;
  }

  .gauge-ind svg {
    width: 22px;
    height: 22px;
  }

  .home-content {
    padding-top: 3rem;
  }

  .btn-icon {
    width: 48px;
    height: 42px;
  }

  .icon-svg {
    width: 34px;
    height: 34px;
  }

  .light-btn {
    grid-template-columns: 48px 1fr auto;
    gap: 0.45rem;
    padding: 0.55rem 0.55rem;
  }

  .route-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .route-info {
    max-height: 24vh;
  }

  .route-pane-map {
    max-height: 28vh;
  }

  #screen-route .route-side .sim-controls {
    grid-template-columns: 1fr 1fr;
  }
}

/* —— 一号线跟考 —— */
#screen-route {
  display: none;
  flex-direction: column;
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(240, 180, 41, 0.08), transparent 50%),
    var(--bg-deep);
}

#screen-route.is-active {
  display: flex;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

#screen-route-result {
  display: none;
  place-items: center;
  padding: 2rem 1.25rem;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(240, 180, 41, 0.16), transparent 55%),
    var(--bg-deep);
}

#screen-route-result.is-active {
  display: grid;
}

.route-window-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
}

.route-window-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f0b429, #ff6b5a);
  transition: width 0.1s linear;
}

.route-layout {
  display: grid;
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr) minmax(220px, 280px);
  gap: 0.65rem;
  padding: 0.55rem 0.75rem 0.65rem;
  flex: 1;
  min-height: 0;
}

.route-side {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

#screen-route .route-side .sim-controls {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: minmax(0, 1fr);
  gap: 0.4rem;
  height: auto;
  overflow: auto;
  align-content: stretch;
}

#screen-route .route-side .sim-btn {
  width: 100%;
  min-height: 0;
}

.route-main {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  min-height: 0;
}

.route-info {
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

#screen-route .route-info .sim-prompt {
  height: 100%;
  min-height: 0;
  overflow: auto;
  justify-content: flex-start;
  padding: 0.9rem 0.95rem;
}

#screen-route .route-info .prompt-text {
  font-size: 1.05rem;
}

#screen-route .route-info .prompt-hint {
  min-height: 0;
}

#screen-route .route-info .feedback {
  margin-top: 0.35rem;
}

#screen-route .sim-controls {
  flex-shrink: 0;
  gap: 0.35rem;
}

#screen-route .sim-btn {
  padding: 0.48rem 0.4rem;
  font-size: 0.82rem;
}

.route-pane {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #0a0a0b;
  display: grid;
  place-items: center;
}

.route-pane-map {
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 1280 / 780;
  max-height: 42%;
  min-height: 120px;
  background: #b9dff0;
}

.route-pane-map.is-hidden {
  display: none;
}

.route-pane-video {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
}

.route-progress-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  z-index: 2;
}

.route-progress {
  height: 100%;
  width: 0%;
  background: #f0b429;
}

.route-map {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #b9dff0;
}

.route-marker {
  position: absolute;
  left: 0;
  top: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff2a2a;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(160, 0, 0, 0.55);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 3;
  display: none;
}

.route-marker.is-on {
  display: block;
}

.route-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #111;
  cursor: pointer;
  object-fit: contain;
}

.route-video-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(8, 8, 10, 0.82);
  pointer-events: none;
}

.route-video-loading.is-on {
  display: flex;
}

.route-video-loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.4rem 1.8rem;
  border-radius: 12px;
  background: rgba(28, 28, 37, 0.96);
  border: 1px solid rgba(240, 180, 41, 0.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.route-video-spinner {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.14);
  border-top-color: #f0b429;
  animation: route-spin 0.7s linear infinite;
}

.route-video-loading-text {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #f5f1e6;
}

@keyframes route-spin {
  to {
    transform: rotate(360deg);
  }
}

.route-speed {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.route-speed select {
  appearance: none;
  background: rgba(20, 20, 26, 0.95);
  color: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  font: inherit;
  cursor: pointer;
}

.route-speed select:hover,
.route-speed select:focus {
  border-color: rgba(240, 180, 41, 0.55);
  outline: none;
}

#btn-route-cue-pause.is-on {
  border-color: rgba(240, 180, 41, 0.7);
  color: #f0b429;
}

#btn-route-cue-pause:not(.is-on) {
  color: var(--muted);
}
