:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  background: #07090d;
  color: #f6f7fb;
}

* {
  box-sizing: border-box;
}

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

body {
  background: #07090d;
}

button {
  font: inherit;
}

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

.screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(4, 7, 14, 0.18), rgba(4, 7, 14, 0.78)),
    radial-gradient(circle at 50% 16%, rgba(240, 54, 82, 0.22), transparent 34%);
  z-index: 5;
}

.hidden {
  display: none !important;
}

.screen-op {
  align-items: end;
  justify-items: start;
  padding: min(8vw, 80px);
}

.op-copy {
  max-width: 720px;
  padding-bottom: 8vh;
}

.eyebrow {
  margin: 0 0 10px;
  color: #82f7ff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(56px, 11vw, 142px);
  line-height: 0.88;
  letter-spacing: 0;
  text-shadow: 0 8px 42px rgba(247, 31, 81, 0.42);
}

h2 {
  margin-bottom: 22px;
  font-size: clamp(26px, 5vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

.op-copy p:not(.eyebrow),
.panel > p:not(.eyebrow) {
  color: rgba(246, 247, 251, 0.82);
  font-size: 18px;
}

.panel {
  width: min(1120px, 100%);
  padding: 28px;
  background: rgba(7, 9, 13, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px);
}

.select-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

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

.choice {
  min-height: 246px;
  padding: 16px;
  text-align: left;
  color: #f6f7fb;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.035));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.choice:hover,
.choice:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(130, 247, 255, 0.86);
  outline: none;
  background: linear-gradient(160deg, rgba(130, 247, 255, 0.18), rgba(255, 255, 255, 0.06));
}

.portrait,
.car-preview {
  height: 132px;
  margin-bottom: 12px;
  border-radius: 6px;
  overflow: hidden;
  background:
    linear-gradient(135deg, var(--accent), transparent 64%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(0, 0, 0, 0.24));
}

.portrait {
  position: relative;
}

.portrait img,
.car-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.car-preview img {
  object-fit: contain;
  padding: 0;
}

.portrait:has(img)::before,
.car-preview:has(img)::before {
  content: none;
}

.portrait::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 88px;
  height: 116px;
  border-radius: 44px 44px 12px 12px;
  transform: translateX(-50%);
  background:
    radial-gradient(circle at 50% 18%, #ffe1ca 0 22px, transparent 23px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.3), transparent 24%, transparent 76%, rgba(0, 0, 0, 0.32)),
    var(--accent);
}

.car-preview {
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.18);
}

.car-preview::before {
  content: "";
  width: 72%;
  height: 52px;
  border-radius: 12px 20px 8px 8px;
  background:
    linear-gradient(90deg, transparent 6%, #111 6% 15%, transparent 15% 84%, #111 84% 93%, transparent 93%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0) 34%),
    var(--accent);
  box-shadow: 0 20px 0 -8px rgba(0, 0, 0, 0.5);
}

.choice h3 {
  margin: 0 0 8px;
  font-size: 22px;
}

.choice p {
  margin-bottom: 0;
  color: rgba(246, 247, 251, 0.72);
  line-height: 1.45;
}

.primary {
  min-width: 198px;
  min-height: 46px;
  padding: 0 20px;
  color: #081017;
  font-weight: 900;
  background: #82f7ff;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(130, 247, 255, 0.24);
}

.hud {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  color: #fff;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  text-shadow:
    3px 3px 0 rgba(20, 35, 70, 0.7),
    -1px -1px 0 rgba(255, 255, 255, 0.45);
}

.mini-map {
  position: absolute;
  top: 18px;
  left: 22px;
  width: 210px;
  height: 150px;
}

.mini-map svg {
  width: 180px;
  height: 120px;
  filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, 0.28));
}

.mini-map path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.82);
  stroke-width: 8;
  stroke-linejoin: round;
}

.mini-map circle {
  fill: #ffef31;
  stroke: #ff3c00;
  stroke-width: 4;
}

.record-box {
  position: absolute;
  top: 118px;
  left: 0;
  color: #fff;
  font-size: 25px;
  line-height: 0.9;
}

.record-box span {
  display: block;
  color: #ff0b0b;
  font-size: 32px;
  line-height: 0.88;
}

.record-box strong {
  display: block;
  font-size: 30px;
}

.arcade-top {
  position: absolute;
  top: 14px;
  left: 50%;
  display: flex;
  align-items: flex-start;
  gap: clamp(24px, 5vw, 58px);
  transform: translateX(-50%);
  white-space: nowrap;
}

.arcade-stat,
.lap-box {
  text-align: center;
}

.arcade-stat span,
.lap-box span {
  display: block;
  color: #ff0b0b;
  font-size: clamp(28px, 4vw, 50px);
  line-height: 0.8;
}

.arcade-stat strong {
  display: block;
  min-width: 130px;
  font-size: clamp(58px, 8vw, 112px);
  line-height: 0.8;
  color: #f8f8f8;
  letter-spacing: 0;
}

.lap-box {
  padding-top: 28px;
}

.lap-box strong {
  display: block;
  color: #fff;
  font-size: clamp(26px, 3.6vw, 48px);
  line-height: 0.9;
}

.rank-list {
  display: none;
}

.rank-list li {
  height: 30px;
  padding-left: 8px;
  background: rgba(70, 76, 88, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.rank-list li:last-child {
  color: #ff0b0b;
}

.tachometer {
  position: absolute;
  right: 34px;
  bottom: 22px;
  width: 310px;
  height: 250px;
}

.tach-arc {
  position: absolute;
  inset: 8px 8px 0 8px;
  border: 14px dashed rgba(255, 255, 255, 0.84);
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  transform: rotate(-25deg);
}

.tach-needle {
  position: absolute;
  left: 153px;
  bottom: 74px;
  width: 6px;
  height: 148px;
  background: #f6f7fb;
  border-radius: 999px;
  transform-origin: 50% 100%;
  transform: rotate(-70deg);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.7);
}

.tachometer strong {
  position: absolute;
  right: 58px;
  bottom: 6px;
  color: #f3ed21;
  font-size: 62px;
  line-height: 1;
}

.tachometer span {
  position: absolute;
  right: 0;
  bottom: 18px;
  font-size: 30px;
}

.lap-times {
  position: absolute;
  top: 178px;
  left: 50%;
  min-width: 360px;
  transform: translateX(-50%);
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 38px;
  line-height: 1.02;
  text-align: left;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.45);
}

.lap-times div {
  white-space: nowrap;
}

.lap-times .best-lap {
  color: #ff2424;
  text-shadow:
    0 0 14px rgba(255, 36, 36, 0.5),
    0 3px 0 rgba(0, 0, 0, 0.45);
}

.meter {
  position: absolute;
  left: 50%;
  bottom: 14px;
  width: min(360px, 40vw);
  height: 8px;
  transform: translateX(-50%);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #82f7ff, #ff365c);
}

.voice {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 4;
  width: min(720px, calc(100% - 32px));
  padding: 14px 18px;
  transform: translateX(-50%);
  background: rgba(7, 9, 13, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  backdrop-filter: blur(14px);
}

.voice span {
  display: inline-block;
  margin-bottom: 4px;
  color: #82f7ff;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.voice p {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.result-panel {
  max-width: 560px;
}

@media (max-width: 820px) {
  .screen,
  .screen-op {
    padding: 16px;
  }

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

  .choice {
    min-height: 206px;
  }

  .portrait,
  .car-preview {
    height: 96px;
  }
}

@media (max-width: 520px) {
  .select-grid,
  .car-grid {
    grid-template-columns: 1fr;
  }

  .mini-map,
  .record-box,
  .rank-list {
    display: none;
  }

  .arcade-top {
    left: 12px;
    right: 12px;
    justify-content: space-between;
    gap: 10px;
    transform: none;
  }

  .tachometer {
    right: 14px;
    bottom: 18px;
    transform: scale(0.72);
    transform-origin: right bottom;
  }
}
