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

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

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

button {
  border: 0;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

.game {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: #05070b;
}

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.top-ui,
.bottom-ui,
.message {
  position: absolute;
  left: 12px;
  right: 12px;
  z-index: 2;
}

.top-ui {
  top: max(10px, env(safe-area-inset-top));
  display: grid;
  gap: 8px;
}

.brand,
.stats,
.garage,
.mode-row,
.control-row,
.message {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(5, 7, 11, 0.58);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.brand {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
}

.brand span {
  color: #8df7ff;
  font-size: 12px;
  font-weight: 1000;
  text-transform: uppercase;
}

.brand strong {
  font-size: 22px;
  line-height: 1;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
}

.stats div {
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.045);
}

.stats span {
  display: block;
  color: rgba(247, 248, 251, 0.62);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.stats strong {
  display: block;
  margin-top: 2px;
  font-size: 22px;
  line-height: 1;
}

.garage,
.mode-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  padding: 6px;
}

.car-chip,
.mode-button,
.steer,
#reset,
#boost {
  min-height: 42px;
  color: #f7f8fb;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
}

.car-chip.active,
.mode-button.active {
  color: #061013;
  background: #8df7ff;
}

.bottom-ui {
  bottom: max(12px, env(safe-area-inset-bottom));
  display: grid;
  gap: 8px;
}

.control-row {
  min-height: 112px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: center;
  padding: 10px;
}

.steer {
  min-height: 86px;
  color: #061013;
  background: rgba(141, 247, 255, 0.92);
  font-size: 22px;
  touch-action: none;
}

.pedals {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 8px;
}

#boost {
  min-height: 74px;
  color: #061013;
  background: #ffd84a;
  font-size: 22px;
}

#reset {
  min-height: 74px;
}

.message {
  top: 48%;
  width: min(360px, calc(100% - 24px));
  right: auto;
  padding: 12px;
  transition: opacity 240ms ease, transform 240ms ease;
}

.message.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.message strong,
.message span {
  display: block;
}

.message strong {
  font-size: 18px;
}

.message span {
  margin-top: 4px;
  color: rgba(247, 248, 251, 0.72);
  font-weight: 750;
}

@media (min-width: 720px) {
  .top-ui,
  .bottom-ui {
    left: 24px;
    right: auto;
    width: 430px;
  }

  .bottom-ui {
    right: 24px;
    left: auto;
  }
}
