:root {
  color-scheme: light;
  --asphalt: #26312e;
  --asphalt-light: #34413d;
  --ink: #17201d;
  --paper: #f3efdf;
  --line: #d5d0bf;
  --yellow: #f1ca51;
  --coral: #dc6247;
  --mint: #a7cbb0;
  --sky: #82b5bd;
  --muted: #a7b0a9;
  font-family: "Avenir Next", Avenir, "Trebuchet MS", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--paper);
  background-color: #202a27;
  background-image: radial-gradient(#46524b 0.65px, transparent 0.65px);
  background-size: 15px 15px;
}

button {
  color: inherit;
  font: inherit;
}

.game-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  padding: 0 clamp(14px, 4vw, 56px);
}

.topbar,
.statusbar {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgb(243 239 223 / 20%);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: inherit;
  text-decoration: none;
}

.wordmark-mark,
.start-mark {
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--yellow);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.wordmark-mark {
  width: 27px;
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: 15px;
}

.wordmark-divider {
  padding: 0 4px;
  color: var(--coral);
}

.score-display {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.score-label {
  color: var(--muted);
  font-size: 9px;
}

#score {
  min-width: 2ch;
  color: var(--yellow);
  font-size: 23px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.game-stage {
  display: grid;
  flex: 1;
  min-height: 0;
  place-items: center;
  padding: clamp(12px, 3vh, 28px) 0;
}

.playfield {
  position: relative;
  width: min(100%, 780px);
  height: min(100%, 780px);
  min-height: 400px;
  overflow: hidden;
  border: 5px solid #d9d5c6;
  background: var(--asphalt);
  box-shadow: 0 16px 50px rgb(0 0 0 / 30%);
  isolation: isolate;
  touch-action: none;
  user-select: none;
}

.road,
.travel-lanes,
.parking-strip,
.parking-bays {
  position: absolute;
  inset: 0;
}

.road {
  overflow: hidden;
  background-color: var(--asphalt);
  background-image: radial-gradient(rgb(255 255 255 / 3%) 0.7px, transparent 0.7px);
  background-size: 9px 9px;
}

.travel-lanes {
  right: 28%;
  border-right: 2px solid var(--yellow);
  background-image: linear-gradient(90deg, transparent 49.7%, rgb(255 255 255 / 5%) 50%, transparent 50.3%);
}

.lane-divider,
.lane-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background-image: linear-gradient(to bottom, var(--paper) 0 28px, transparent 28px 48px);
  background-repeat: repeat-y;
  background-size: 2px 48px;
  opacity: 0.6;
}

.lane-divider {
  left: 50%;
}

.parking-strip {
  left: auto;
  width: 28%;
  border-left: 1px solid rgb(241 202 81 / 50%);
  background: #34413d;
}

.parking-bays {
  display: block;
  overflow: hidden;
}

.bay {
  position: absolute;
  right: 7px;
  left: 7px;
  border-top: 2px solid var(--yellow);
  border-bottom: 2px solid var(--yellow);
}

.bay::before,
.bay::after {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--yellow);
  content: "";
}

.bay::before {
  left: 0;
}

.bay::after {
  right: 0;
}

.bay-target {
  position: absolute;
  top: 50%;
  left: 0;
  width: 84%;
  height: 96%;
  border: 2px solid rgb(241 202 81 / 70%);
  transform: translateY(-50%);
  animation: target-contract 850ms ease-out both;
}

@keyframes target-contract {
  from {
    transform: translateY(-50%) scale(1.28);
  }

  to {
    transform: translateY(-50%) scale(1);
  }
}

.parking-feedback {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  padding: 6px 8px;
  border: 1px solid currentColor;
  color: var(--yellow);
  background: var(--asphalt);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  white-space: nowrap;
  animation: feedback-rise 1.1s ease-out forwards;
}

.parking-feedback[data-result="perfect"] {
  color: var(--mint);
}

.parking-feedback[data-result="crooked"] {
  border-color: #9aa29c;
  color: #b8beb8;
}

@keyframes feedback-rise {
  from {
    opacity: 0;
    transform: translate(-50%, 20%);
  }

  18% {
    opacity: 1;
  }

  to {
    opacity: 0;
    transform: translate(-50%, -80%);
  }
}

.car {
  position: absolute;
  z-index: 2;
  top: 65%;
  left: 25%;
  width: 46px;
  height: 86px;
  border: 2px solid #f2a48c;
  border-radius: 13px 13px 10px 10px;
  background: var(--coral);
  box-shadow: 0 6px 10px rgb(0 0 0 / 25%);
  transform: translate(-50%, -50%);
}

.car[data-type="sports"] {
  border-radius: 15px 15px 8px 8px;
  background: #df6044;
}

.car[data-type="truck"] {
  border-radius: 5px;
  background: #6aab83;
}

.car[data-type="van"] {
  border-radius: 8px;
  background: #dfb842;
}

.car[data-type="suv"] {
  border-radius: 11px;
  background: #75b3ba;
}

.car[data-type="micro"] {
  border-radius: 12px 12px 8px 8px;
  background: #dc8850;
}

.car[data-type="sedan"] {
  border-radius: 11px 11px 9px 9px;
  background: #cf7b94;
}

.car-window {
  position: absolute;
  top: 15px;
  left: 7px;
  width: 28px;
  height: 24px;
  border: 1px solid #d1e2d7;
  border-radius: 7px 7px 3px 3px;
  background: #71969a;
}

.car-light {
  position: absolute;
  bottom: 5px;
  width: 8px;
  height: 4px;
  border-radius: 2px;
  background: #f8df94;
}

.car-light--left {
  left: 5px;
}

.car-light--right {
  right: 5px;
}

.car-wheel {
  position: absolute;
  top: 26px;
  width: 5px;
  height: 18px;
  border-radius: 4px;
  background: #151c1a;
}

.car-wheel--left {
  left: -4px;
}

.car-wheel--right {
  right: -4px;
}

.smoke-puff {
  position: absolute;
  z-index: 1;
  width: 13px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgb(215 220 207 / 54%);
  pointer-events: none;
  animation: exhaust-drift 680ms ease-out forwards;
}

@keyframes exhaust-drift {
  from {
    opacity: 0.65;
    transform: scale(0.55);
  }

  to {
    opacity: 0;
    transform: translate(-8px, 12px) scale(1.8);
  }
}

.start-screen,
.result-screen {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgb(19 29 26 / 88%);
  text-align: center;
}

.start-screen[hidden],
.result-screen[hidden] {
  display: none;
}

.start-mark {
  width: 46px;
  aspect-ratio: 1;
  margin-bottom: 20px;
  border-radius: 50%;
  font-size: 25px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--yellow);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1,
h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

h1 {
  font-size: clamp(44px, 9vw, 76px);
  line-height: 1;
}

h2 {
  font-size: clamp(28px, 6vw, 42px);
}

.start-button {
  display: inline-flex;
  min-width: 160px;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-top: 27px;
  padding: 0 17px;
  border: 1px solid var(--yellow);
  border-radius: 2px;
  color: var(--ink);
  background: var(--yellow);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  transition: background-color 140ms ease, transform 140ms ease;
}

.start-button:hover {
  background: #f7d96f;
  transform: translateY(-2px);
}

.start-button:focus-visible {
  outline: 3px solid var(--paper);
  outline-offset: 3px;
}

.final-score {
  margin-top: 10px;
  color: var(--yellow);
  font-size: 56px;
  font-variant-numeric: tabular-nums;
}

.statusbar {
  min-height: 48px;
  justify-content: flex-start;
  gap: 9px;
  border-top: 1px solid rgb(243 239 223 / 20%);
  border-bottom: 0;
  color: var(--muted);
  font-size: 8px;
}

.status-dot {
  width: 7px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--yellow);
}

.status-rule {
  width: 1px;
  height: 14px;
  margin: 0 5px;
  background: rgb(243 239 223 / 24%);
}

.status-caption strong {
  color: var(--paper);
}

@media (max-width: 520px) {
  .game-shell {
    padding: 0 10px;
  }

  .topbar {
    min-height: 52px;
  }

  .game-stage {
    padding: 10px 0;
  }

  .playfield {
    min-height: 360px;
    border-width: 3px;
  }

  .parking-strip {
    width: 34%;
  }

  .travel-lanes {
    right: 34%;
  }

  .parking-bays {
    padding: 0;
  }

  .bay {
    right: 5px;
    left: 5px;
  }

  .car {
    width: 38px;
    height: 72px;
  }

  .car-window {
    top: 12px;
    left: 6px;
    width: 22px;
    height: 21px;
  }

  .statusbar {
    min-height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
