:root {
  color-scheme: dark;
  --bg-deep: #08121a;
  --bg-panel: rgba(6, 18, 24, 0.68);
  --bg-panel-strong: rgba(8, 22, 30, 0.88);
  --line-soft: rgba(183, 229, 217, 0.14);
  --line-bright: rgba(177, 255, 237, 0.3);
  --text-main: #edf7ef;
  --text-dim: rgba(237, 247, 239, 0.74);
  --accent-mint: #7cf0ca;
  --accent-gold: #efcf7d;
  --accent-sky: #94c8ff;
  --shadow-deep: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(124, 240, 202, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(148, 200, 255, 0.12), transparent 34%),
    linear-gradient(180deg, #091722 0%, #04090d 100%);
  color: var(--text-main);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.03), transparent 20%, transparent 80%, rgba(255, 255, 255, 0.02)),
    radial-gradient(circle at 50% 110%, rgba(239, 207, 125, 0.08), transparent 35%);
}

button {
  font: inherit;
}

#app,
#scene-shell {
  width: 100vw;
  height: 100vh;
}

#scene-shell {
  position: relative;
  overflow: hidden;
}

canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

#hud {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.hud-cluster {
  position: absolute;
  display: flex;
  gap: 14px;
}

.top-left {
  top: 22px;
  left: 22px;
  flex-direction: column;
  max-width: min(460px, calc(100vw - 44px));
}

.top-right {
  top: 22px;
  right: 22px;
}

.bottom-left {
  left: 22px;
  bottom: 22px;
  align-items: flex-end;
}

.hud-button-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
}

.bottom-center {
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
}

.hud-chip,
.hud-panel,
.overlay-card,
.garage-drawer,
.settings-drawer {
  border: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(13, 27, 35, 0.88), rgba(6, 16, 22, 0.72));
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-deep);
}

.hud-chip,
.hud-panel {
  border-radius: 18px;
}

.hud-chip {
  padding: 14px 16px;
}

.brand-chip strong,
.objective-chip strong {
  display: block;
  font-size: 0.98rem;
  line-height: 1.4;
}

.brand-chip strong {
  font-family: "Arial Narrow", "Trebuchet MS", sans-serif;
  letter-spacing: 0.08em;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--accent-gold);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.stats-panel {
  min-width: 284px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
}

.stat span {
  display: block;
  color: var(--text-dim);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 6px;
  font-family: "Arial Narrow", "Trebuchet MS", sans-serif;
  font-size: 1rem;
  color: var(--text-main);
}

.hud-button,
.primary-button {
  pointer-events: auto;
  appearance: none;
  border: 1px solid var(--line-bright);
  border-radius: 999px;
  color: var(--text-main);
  background:
    linear-gradient(135deg, rgba(124, 240, 202, 0.2), rgba(148, 200, 255, 0.14)),
    rgba(5, 16, 22, 0.84);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.hud-button:hover,
.primary-button:hover,
.hud-button:focus-visible,
.primary-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(177, 255, 237, 0.55);
  background:
    linear-gradient(135deg, rgba(124, 240, 202, 0.28), rgba(148, 200, 255, 0.22)),
    rgba(9, 23, 31, 0.94);
}

.hud-button {
  min-height: 46px;
  padding: 0 16px;
}

.primary-button {
  padding: 13px 20px;
  font-weight: 700;
}

.vehicle-card {
  max-width: 330px;
  padding: 10px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.vehicle-card img {
  width: 110px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.04);
}

.vehicle-copy strong {
  display: block;
  margin-bottom: 6px;
}

.vehicle-copy p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.45;
}

.prompt-chip {
  min-width: min(72vw, 580px);
  text-align: center;
  color: var(--text-main);
}

#crosshair {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 32px;
  height: 32px;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 160ms ease;
}

#crosshair span,
#crosshair span::before,
#crosshair span::after {
  position: absolute;
  content: "";
  background: rgba(255, 255, 255, 0.82);
  border-radius: 999px;
}

#crosshair span {
  inset: 15px 12px 15px 12px;
}

#crosshair span::before {
  inset: -3px 6px;
}

#crosshair span::after {
  inset: 6px -3px;
}

body[data-mode="walk"] #crosshair {
  opacity: 1;
}

.overlay-screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(4, 10, 16, 0.22), rgba(4, 10, 16, 0.7)),
    radial-gradient(circle at 50% 10%, rgba(148, 200, 255, 0.12), transparent 40%);
  z-index: 12;
}

.overlay-card {
  width: min(680px, 100%);
  border-radius: 28px;
  padding: 28px;
}

.overlay-card h1,
.overlay-card h2 {
  margin: 0 0 14px;
  font-family: "Arial Narrow", "Trebuchet MS", sans-serif;
  line-height: 1.15;
}

.overlay-card p {
  margin: 0;
  color: var(--text-dim);
  line-height: 1.6;
}

.hero-card {
  display: grid;
  gap: 18px;
}

.hero-grid,
.controls-grid {
  display: grid;
  gap: 12px;
}

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

.hero-grid > div,
.controls-grid > div {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.03);
}

.hero-grid strong,
.controls-grid strong {
  display: block;
  margin-bottom: 6px;
}

.controls-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.controls-grid span {
  color: var(--text-dim);
  font-size: 0.92rem;
}

.garage-drawer {
  position: absolute;
  top: 18px;
  right: 18px;
  width: min(540px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  padding: 20px;
  border-radius: 24px;
  overflow: auto;
  z-index: 10;
}

.settings-drawer {
  position: absolute;
  top: 18px;
  right: 18px;
  width: min(460px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  padding: 20px;
  border-radius: 24px;
  overflow: auto;
  z-index: 11;
}

.garage-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.garage-header h2 {
  margin: 0;
  font-family: "Arial Narrow", "Trebuchet MS", sans-serif;
  font-size: 1.16rem;
}

.garage-intro {
  margin: 14px 0 18px;
  color: var(--text-dim);
  line-height: 1.55;
}

.garage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.garage-grid figure {
  margin: 0;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.03);
}

.garage-grid img {
  width: 100%;
  height: 154px;
  border-radius: 12px;
  object-fit: cover;
  display: block;
}

.garage-grid figcaption {
  margin-top: 10px;
  color: var(--text-dim);
  font-size: 0.88rem;
}

.settings-section + .settings-section {
  margin-top: 18px;
}

.settings-section-head {
  margin-bottom: 10px;
}

.settings-section-head strong {
  display: block;
  font-size: 1rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.settings-control {
  display: grid;
  gap: 10px;
  padding: 14px 14px 12px;
  border-radius: 18px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.03);
}

.settings-control span {
  color: var(--text-dim);
  font-size: 0.82rem;
}

.settings-control strong {
  font-family: "Arial Narrow", "Trebuchet MS", sans-serif;
  font-size: 1rem;
}

.settings-control input[type="range"] {
  width: 100%;
  accent-color: var(--accent-mint);
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.settings-footnote {
  margin: 14px 0 0;
  color: var(--text-dim);
  line-height: 1.5;
  font-size: 0.88rem;
}

.toast {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translate(-50%, -18px);
  min-width: 220px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--line-bright);
  background: rgba(5, 17, 23, 0.88);
  color: var(--text-main);
  text-align: center;
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
}

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

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .top-left,
  .top-right,
  .bottom-left,
  .bottom-center {
    left: 14px;
    right: 14px;
    transform: none;
  }

  .top-right {
    top: auto;
    bottom: 14px;
    justify-content: flex-end;
  }

  .bottom-left {
    bottom: 116px;
    flex-direction: column;
    align-items: flex-start;
  }

  .bottom-center {
    bottom: 14px;
  }

  .vehicle-card {
    max-width: min(100%, 340px);
  }

  .hero-grid,
  .controls-grid,
  .garage-grid,
  .stats-panel,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .garage-drawer {
    top: auto;
    right: 14px;
    left: 14px;
    bottom: 14px;
    width: auto;
  }

  .settings-drawer {
    top: auto;
    right: 14px;
    left: 14px;
    bottom: 14px;
    width: auto;
  }
}
