:root {
  color-scheme: dark;
  --blue: #087ce8;
  --panel: #092d5d;
  --panel-dark: #041932;
  --green: #9ddd27;
  --yellow: #ffc122;
  --white: #fffdf4;
  --ink: #102235;
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  background: #03111d;
}

* {
  box-sizing: border-box;
}

html,
body,
.app {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 30%, #0d3450 0, #051827 42%, #02080d 100%);
  color: var(--white);
  user-select: none;
}

button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.title-screen,
.game-screen {
  width: 100%;
  height: 100vh;
  height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.title-screen {
  background:
    linear-gradient(90deg, rgb(0 0 0 / 78%), transparent 34% 66%, rgb(0 0 0 / 78%)),
    #02080c;
}

.title-card {
  position: relative;
  width: min(100vw, calc(100svh * 0.563));
  height: min(100svh, calc(100vw / 0.563));
  max-width: 100vw;
  max-height: 100svh;
  overflow: hidden;
  background: #087ce8;
  box-shadow: 0 0 70px rgb(0 0 0 / 65%);
}

.title-card__art {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.play-hotspot {
  position: absolute;
  z-index: 2;
  top: 74.2%;
  left: 20%;
  width: 60%;
  height: 12.8%;
  border: 0;
  border-radius: 18%;
  outline: 0;
  background: transparent;
  cursor: pointer;
}

.play-hotspot:not(:disabled):hover,
.play-hotspot:not(:disabled):focus-visible {
  box-shadow:
    inset 0 0 0 5px rgb(255 255 255 / 76%),
    0 0 38px rgb(255 220 61 / 78%);
}

.play-hotspot:not(:disabled):active {
  transform: scale(0.97);
}

.play-hotspot:disabled {
  cursor: wait;
}

.loading-label {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 7.5%;
  margin: 0;
  border: 2px solid rgb(255 255 255 / 48%);
  border-radius: 999px;
  background: rgb(4 22 43 / 82%);
  padding: 0.52rem 0.8rem;
  color: white;
  font-size: clamp(0.62rem, 2.4vw, 0.76rem);
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transform: translateX(-50%);
  white-space: nowrap;
}

.game-screen {
  background:
    radial-gradient(circle at 50% 55%, #15334a 0, #061420 45%, #010609 100%);
}

.game-shell {
  position: relative;
  width: min(100vw, 620px);
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: #1688e4;
  box-shadow: 0 0 80px rgb(0 0 0 / 72%);
  touch-action: none;
}

.game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  outline: 0;
  touch-action: none;
}

.hud {
  position: absolute;
  z-index: 4;
  inset: max(0.75rem, env(safe-area-inset-top)) 0.75rem auto;
  height: 7.6rem;
  pointer-events: none;
}

.hud-button {
  position: absolute;
  pointer-events: auto;
  border: 3px solid rgb(255 255 255 / 40%);
  border-radius: 1rem;
  background: linear-gradient(#123e78, #061f45);
  color: white;
  box-shadow: 0 4px 0 #03152e, 0 6px 13px rgb(0 0 0 / 30%);
  cursor: pointer;
}

.hud-button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #03152e;
}

.hud-button:focus-visible,
.game-button:focus-visible,
.text-button:focus-visible {
  outline: 4px solid white;
  outline-offset: 3px;
}

.hud-button--pause {
  top: 0;
  left: 0;
  width: 3.35rem;
  height: 3.35rem;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  font-weight: 1000;
}

.level-panel {
  position: absolute;
  top: 0;
  left: 50%;
  width: min(54%, 270px);
  transform: translateX(-50%);
}

.level-panel__label {
  min-height: 2.35rem;
  display: grid;
  place-items: center;
  border: 3px solid rgb(255 255 255 / 36%);
  border-radius: 0.9rem;
  background: linear-gradient(#123e78, #061f45);
  color: white;
  font-size: clamp(0.78rem, 3vw, 1.05rem);
  font-weight: 1000;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 1px #031326;
  box-shadow: 0 4px 0 #03152e;
}

.route-progress {
  height: 1.8rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.55rem;
  border: 3px solid rgb(255 255 255 / 34%);
  border-radius: 999px;
  background: #061c39;
  padding: 0.2rem 0.4rem;
  box-shadow: 0 3px 0 #020f21;
}

.route-progress__truck {
  font-size: 1rem;
  filter: saturate(1.25);
}

.route-progress__track {
  position: relative;
  height: 0.72rem;
  flex: 1;
  overflow: hidden;
  border-radius: 999px;
  background: #031226;
}

.route-progress__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #74d72e, #cfe52e, #ffcb24);
  box-shadow: inset 0 2px 2px rgb(255 255 255 / 38%);
  transition: width 180ms ease;
}

.route-progress__finish {
  width: 1rem;
  height: 1rem;
  background:
    linear-gradient(45deg, #fff 25%, transparent 25% 75%, #fff 75%),
    linear-gradient(45deg, #fff 25%, #111 25% 75%, #fff 75%);
  background-position: 0 0, 4px 4px;
  background-size: 8px 8px;
}

.score-panel {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 5.2rem;
  border: 3px solid rgb(255 255 255 / 35%);
  border-radius: 1rem;
  background: linear-gradient(#10386e, #061d3e);
  padding: 0.38rem 0.72rem 0.48rem;
  color: var(--green);
  text-align: center;
  box-shadow: 0 4px 0 #03152e;
}

.score-panel span {
  display: block;
  font-size: 0.6rem;
  font-weight: 1000;
  letter-spacing: 0.07em;
}

.score-panel strong {
  display: block;
  color: white;
  font-size: 1.45rem;
  line-height: 1;
  text-shadow: 0 2px 1px #031326;
}

.lives-panel {
  position: absolute;
  top: 4.25rem;
  right: 0;
  color: #ffcf26;
  text-align: right;
  text-shadow: 0 2px 2px rgb(0 0 0 / 80%);
}

.lives-panel span {
  display: block;
  font-size: 1.05rem;
  letter-spacing: 0.15em;
}

.lives-panel small {
  display: block;
  color: white;
  font-size: 0.48rem;
  font-weight: 1000;
  letter-spacing: 0.05em;
}

.control-hint {
  position: absolute;
  z-index: 3;
  bottom: max(0.7rem, env(safe-area-inset-bottom));
  left: 50%;
  margin: 0;
  border-radius: 999px;
  background: rgb(4 24 42 / 62%);
  padding: 0.38rem 0.75rem;
  color: rgb(255 255 255 / 78%);
  font-size: clamp(0.58rem, 2.4vw, 0.72rem);
  font-weight: 1000;
  letter-spacing: 0.12em;
  pointer-events: none;
  text-shadow: 0 2px 2px rgb(0 0 0 / 70%);
  transform: translateX(-50%);
  white-space: nowrap;
  transition: opacity 500ms ease;
}

.control-hint.is-hidden {
  opacity: 0;
}

.modal-panel {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgb(1 11 19 / 68%);
  padding: 1rem;
  backdrop-filter: blur(5px);
}

.modal-card {
  width: min(88%, 390px);
  border: 4px solid rgb(255 255 255 / 60%);
  border-radius: 1.6rem;
  background:
    linear-gradient(145deg, rgb(19 70 123 / 98%), rgb(3 27 57 / 98%));
  padding: 1.5rem;
  color: white;
  text-align: center;
  box-shadow: 0 9px 0 #02152c, 0 22px 45px rgb(0 0 0 / 45%);
}

.modal-card__eyebrow {
  margin: 0 0 0.25rem;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.14em;
}

.modal-card h2 {
  margin: 0 0 1.2rem;
  font-size: clamp(1.65rem, 7vw, 2.55rem);
  line-height: 0.98;
  text-shadow: 0 3px 0 #031326;
}

.modal-card blockquote {
  margin: 0.75rem 0 1rem;
  border-radius: 0.9rem;
  background: rgb(0 0 0 / 24%);
  padding: 0.9rem;
  color: #fff3d5;
  font-family: Georgia, serif;
  font-size: clamp(1rem, 4vw, 1.24rem);
  font-style: italic;
  line-height: 1.35;
}

.final-score {
  margin: 0 0 1rem;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.final-score strong {
  color: white;
  font-size: 1.25rem;
}

.game-button {
  min-width: 12rem;
  border: 4px solid #788d19;
  border-radius: 1rem;
  background: linear-gradient(#ffe038, #f0a90c);
  color: #342109;
  cursor: pointer;
  padding: 0.8rem 1.25rem;
  font-size: 1rem;
  font-weight: 1000;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 5px 0 #76510a;
}

.game-button:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #76510a;
}

.text-button {
  display: block;
  border: 0;
  background: transparent;
  color: rgb(255 255 255 / 76%);
  cursor: pointer;
  margin: 1rem auto 0;
  padding: 0.4rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

.noscript-message {
  position: fixed;
  z-index: 50;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  margin: 0 auto;
  border-radius: 999px;
  background: #071c34;
  padding: 0.75rem 1rem;
  text-align: center;
}

@media (pointer: coarse) {
  .control-hint {
    bottom: max(0.85rem, env(safe-area-inset-bottom));
  }
}

@media (max-width: 430px) {
  .hud {
    inset-inline: 0.5rem;
  }

  .hud-button--pause {
    width: 3rem;
    height: 3rem;
  }

  .level-panel {
    width: 51%;
  }

  .score-panel {
    min-width: 4.75rem;
    padding-inline: 0.5rem;
  }

  .score-panel strong {
    font-size: 1.25rem;
  }
}

@media (max-height: 640px) {
  .hud {
    transform: scale(0.88);
    transform-origin: top center;
  }

  .control-hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .route-progress__fill,
  .control-hint {
    transition: none;
  }
}
