:root {
  color-scheme: dark;
  --bg: #0b1018;
  --ink: #fff7e6;
  --muted: #bdb6a8;
  --line: rgba(255, 247, 230, 0.16);
  --panel: rgba(18, 24, 32, 0.9);
  --road: #202937;
  --cyan: #5ee2ff;
  --gold: #ffd25a;
  --green: #71e38a;
  --pink: #ff6f91;
  --violet: #a78bfa;
  --orange: #fb923c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 16% 14%, rgba(94, 226, 255, 0.22), transparent 26%),
    radial-gradient(circle at 86% 24%, rgba(255, 111, 145, 0.18), transparent 24%),
    radial-gradient(circle at 46% 92%, rgba(113, 227, 138, 0.15), transparent 28%),
    linear-gradient(135deg, #081019, #172638 58%, #090b10);
  background-size: 44px 44px, 44px 44px, auto, auto, auto, auto;
}

button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.72rem 0.9rem;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(94, 226, 255, 0.13), rgba(255, 255, 255, 0.02)),
    #192331;
  font: inherit;
  font-weight: 950;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 12px 24px rgba(0, 0, 0, 0.22);
}

button:hover {
  border-color: var(--green);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.primary {
  color: #101319;
  border-color: rgba(255, 210, 90, 0.5);
  background: linear-gradient(135deg, var(--green), var(--gold), var(--orange));
  box-shadow: 0 0 28px rgba(255, 210, 90, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.courierApp {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  align-items: start;
  gap: 14px;
  width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 14px;
}

.cityWrap {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 10px;
  min-width: 0;
}

canvas {
  display: block;
  width: min(100%, calc(100dvh - 28px));
  height: auto;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101720;
  box-shadow:
    0 0 0 1px rgba(94, 226, 255, 0.12),
    0 0 42px rgba(94, 226, 255, 0.18),
    0 24px 70px rgba(0, 0, 0, 0.48);
  touch-action: none;
}

.courierControls {
  display: grid;
  align-content: start;
  gap: 12px;
  max-height: calc(100dvh - 28px);
  overflow: auto;
  padding-right: 2px;
}

.sideHeader,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.015)),
    var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

.sideHeader {
  padding: 14px;
  border-color: rgba(94, 226, 255, 0.24);
  background:
    linear-gradient(135deg, rgba(94, 226, 255, 0.17), rgba(255, 111, 145, 0.09)),
    var(--panel);
}

.panel {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.panel.compact {
  gap: 8px;
}

.panel button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.kicker {
  margin: 0 0 6px;
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 1000;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(94, 226, 255, 0.38);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.48rem;
  line-height: 1.05;
  text-wrap: balance;
}

h2 {
  font-size: 1rem;
}

p {
  color: var(--muted);
  line-height: 1.42;
}

.scoreStrip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.scoreStrip span {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.58rem 0.64rem;
  color: var(--muted);
  background:
    linear-gradient(145deg, rgba(94, 226, 255, 0.08), rgba(255, 255, 255, 0.015)),
    rgba(7, 11, 17, 0.72);
  font-weight: 850;
}

.scoreStrip strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 1.22rem;
  text-overflow: ellipsis;
  text-shadow: 0 0 16px rgba(255, 210, 90, 0.2);
  white-space: nowrap;
}

.shopPanel {
  background:
    linear-gradient(145deg, rgba(255, 210, 90, 0.12), rgba(94, 226, 255, 0.06)),
    var(--panel);
}

.howPanel {
  background:
    linear-gradient(145deg, rgba(94, 226, 255, 0.12), rgba(113, 227, 138, 0.06)),
    var(--panel);
}

.directionsList {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1.25rem;
  color: var(--muted);
  line-height: 1.35;
  font-size: 0.9rem;
  font-weight: 800;
}

.directionsList li::marker {
  color: var(--gold);
  font-weight: 1000;
}

.shopStatus {
  border: 1px solid rgba(113, 227, 138, 0.22);
  border-radius: 8px;
  padding: 0.58rem 0.68rem;
  color: var(--green);
  background: rgba(113, 227, 138, 0.08);
  font-size: 0.86rem;
  font-weight: 850;
}

.vehicleShop {
  display: grid;
  gap: 10px;
}

.vehicleCard {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.01)),
    rgba(7, 11, 17, 0.62);
}

.vehicleCard:hover {
  border-color: rgba(94, 226, 255, 0.42);
  transform: translateY(-1px);
}

.vehicleCard.equipped {
  border-color: var(--gold);
  background:
    linear-gradient(135deg, rgba(255, 210, 90, 0.13), rgba(94, 226, 255, 0.055)),
    rgba(7, 11, 17, 0.68);
  box-shadow: 0 0 0 1px rgba(255, 210, 90, 0.32), 0 0 28px rgba(255, 210, 90, 0.16);
}

.vehiclePreview {
  display: grid;
  place-items: center;
  width: 76px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 70% 24%, rgba(255, 210, 90, 0.16), transparent 24%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    #121923;
  background-size: 18px 18px;
}

.vehicleShape {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 8px 8px 5px 5px;
  background: var(--paint, var(--cyan));
  box-shadow: 0 0 18px color-mix(in srgb, var(--paint, var(--cyan)) 44%, transparent);
}

.vehicleShape::before,
.vehicleShape::after {
  content: "";
  position: absolute;
  bottom: -7px;
  width: 11px;
  height: 11px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: #111821;
}

.vehicleShape::before {
  left: 4px;
}

.vehicleShape::after {
  right: 4px;
}

.vehicleInfo {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.vehicleName {
  font-weight: 1000;
}

.vehicleMeta {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.vehicleCard button {
  min-height: 38px;
  padding: 0.5rem 0.65rem;
}

.touchPad {
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.touchPad button {
  justify-content: center;
}

#upBtn,
#downBtn {
  grid-column: 2;
}

#leftBtn {
  grid-column: 1;
}

#rightBtn {
  grid-column: 3;
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .courierApp {
    grid-template-columns: 1fr;
    min-height: 100dvh;
  }

  .courierControls {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  canvas {
    width: min(100%, 620px);
  }

  .touchPad {
    display: grid;
  }

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

@media (max-width: 560px) {
  .courierApp {
    padding: 10px;
  }

  canvas {
    width: min(100%, 430px);
  }

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