:root {
  color-scheme: dark;
  --bg: #101413;
  --panel: #171d1a;
  --panel-2: #202922;
  --text: #edf2ed;
  --muted: #9aa89d;
  --green: #67d883;
  --red: #ff5a5f;
  --amber: #ffd166;
  --road: #2f3533;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--green);
  color: #061008;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 12px 16px;
}

button:hover {
  filter: brightness(1.08);
}

.game-shell {
  display: grid;
  gap: 12px;
  margin: 0 auto;
  max-width: 1120px;
  min-height: 100vh;
  padding: 18px;
}

.topbar,
.dispatch {
  align-items: center;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  padding: 14px 16px;
}

.eyebrow,
.label {
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1;
}

h2 {
  font-size: 30px;
  line-height: 1.1;
  margin-bottom: 10px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.stats span {
  background: var(--panel-2);
  border-radius: 6px;
  color: var(--muted);
  padding: 8px 10px;
}

.stats b {
  color: var(--text);
}

.arena-wrap {
  min-height: 0;
  position: relative;
  touch-action: none;
}

canvas {
  aspect-ratio: 16 / 9;
  background: var(--road);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  display: block;
  max-height: calc(100vh - 220px);
  width: 100%;
}

.hint {
  bottom: 12px;
  color: rgba(255, 255, 255, 0.74);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 8px;
  left: 12px;
  position: absolute;
}

.hint span {
  background: rgba(0, 0, 0, 0.42);
  border-radius: 5px;
  padding: 6px 8px;
}

.touch-controls {
  bottom: 12px;
  display: none;
  gap: 6px;
  grid-template-columns: repeat(3, 52px);
  grid-template-rows: repeat(3, 52px);
  position: absolute;
  right: 12px;
  touch-action: none;
}

.touch-btn {
  align-items: center;
  background: rgba(237, 242, 237, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  color: #101413;
  display: flex;
  font-size: 24px;
  justify-content: center;
  padding: 0;
  user-select: none;
}

.touch-btn.pressed {
  background: var(--green);
  transform: translateY(1px);
}

.touch-btn.up {
  grid-column: 2;
  grid-row: 1;
}

.touch-btn.left {
  grid-column: 1;
  grid-row: 2;
}

.touch-btn.siren {
  background: var(--red);
  color: #fff;
  grid-column: 2;
  grid-row: 2;
}

.touch-btn.right {
  grid-column: 3;
  grid-row: 2;
}

.touch-btn.down {
  grid-column: 2;
  grid-row: 3;
}

.dispatch {
  align-items: flex-start;
  color: var(--muted);
  display: block;
  min-height: 72px;
}

#dispatch-text {
  color: var(--text);
  line-height: 1.45;
}

.overlay {
  align-items: center;
  background: rgba(0, 0, 0, 0.72);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
}

.overlay.visible {
  display: flex;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  max-width: 560px;
  padding: 24px;
  width: min(560px, 100%);
}

.panel p {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 18px;
}

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

.answers button {
  background: var(--panel-2);
  color: var(--text);
  text-align: left;
}

.answers button:hover {
  background: #2f3a32;
}

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

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  canvas {
    max-height: none;
  }

  .hint {
    display: none;
  }

  .touch-controls {
    display: grid;
  }

  h1 {
    font-size: 24px;
  }
}
