:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #081520;
}

button {
  min-height: 2.6rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 0.55rem 0.68rem;
  color: #f8fbff;
  background: rgba(12, 22, 32, 0.72);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

button:hover {
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

button.active {
  border-color: #ffd5a1;
  background: rgba(178, 64, 34, 0.88);
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hud {
  position: fixed;
  z-index: 3;
  color: #f8fbff;
  background: rgba(7, 15, 23, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(16px);
}

.topbar {
  top: 1rem;
  left: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.82rem 1rem;
  border-radius: 8px;
  pointer-events: none;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.15rem, 2.5vw, 1.85rem);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0.7rem;
  color: #ffd7b4;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

p,
.status,
.hint {
  color: #eaf4ff;
  font-size: 0.92rem;
}

.status {
  min-width: 8.5rem;
  text-align: right;
  font-weight: 800;
}

.panel {
  left: 1rem;
  bottom: 1rem;
  width: min(22rem, calc(100vw - 2rem));
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border-radius: 8px;
}

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

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

.control-grid.one {
  grid-template-columns: 1fr;
}

.hint {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 3;
  padding: 0.68rem 0.78rem;
  border-radius: 8px;
  background: rgba(7, 15, 23, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
}

.fps-overlay {
  position: fixed;
  top: 6.8rem;
  right: 1rem;
  z-index: 3;
  min-width: 5.7rem;
  padding: 0.48rem 0.62rem;
  border-radius: 6px;
  color: #f8fbff;
  background: rgba(7, 15, 23, 0.64);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.82rem;
  font-weight: 900;
  text-align: center;
  backdrop-filter: blur(16px);
}

.driver-cockpit {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: none;
  pointer-events: none;
}

.driver-cockpit.active {
  display: block;
}

.windshield {
  position: absolute;
  left: 8vw;
  right: 8vw;
  bottom: 19vh;
  height: 27vh;
  border-left: 0.9rem solid rgba(9, 13, 16, 0.72);
  border-right: 0.9rem solid rgba(9, 13, 16, 0.72);
  border-bottom: 1.2rem solid rgba(9, 13, 16, 0.86);
  transform: perspective(520px) rotateX(50deg);
  transform-origin: bottom;
}

.dash {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -5vh;
  height: 28vh;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.09), transparent 28%),
    linear-gradient(180deg, #22272c, #080a0d 72%);
  border-top: 0.55rem solid #363b40;
  box-shadow: 0 -1.5rem 4rem rgba(0, 0, 0, 0.55);
}

.wheel {
  position: absolute;
  left: 50%;
  bottom: 4vh;
  width: min(25vw, 13rem);
  aspect-ratio: 1;
  border: 1.3rem solid #15191d;
  border-radius: 50%;
  transform: translateX(-50%) rotateX(18deg);
  box-shadow:
    inset 0 0 0 0.42rem #343a40,
    0 1.1rem 2.8rem rgba(0, 0, 0, 0.55);
}

.wheel span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.55rem;
  height: 45%;
  border-radius: 999px;
  background: #272d33;
  transform-origin: top;
}

.wheel span:nth-child(1) {
  transform: rotate(0deg);
}

.wheel span:nth-child(2) {
  transform: rotate(120deg);
}

.wheel span:nth-child(3) {
  transform: rotate(240deg);
}

.gauge {
  position: absolute;
  left: 23%;
  bottom: 6vh;
  width: min(15vw, 6.5rem);
  aspect-ratio: 1;
  border: 0.5rem solid #0d1014;
  border-radius: 50%;
  background:
    radial-gradient(circle, #28313a 0 24%, #11161b 25% 100%),
    conic-gradient(from 220deg, #f5d06f, #c34a2d, #29313a 58%);
  box-shadow: inset 0 0 0 0.25rem #46515c;
}

.gauge.right {
  left: auto;
  right: 23%;
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
  }

  .status,
  .hint {
    display: none;
  }

  .fps-overlay {
    top: auto;
    right: 1rem;
    bottom: 12.8rem;
  }

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

  .panel {
    gap: 0.8rem;
  }
}
