:root {
  color-scheme: dark;
  --bg: #10131b;
  --panel: #191f2b;
  --text: #f4f7fb;
  --muted: #aab4c5;
  --accent: #ffd339;
  --wall: #2468ff;
  --danger: #ff4d76;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 10%, rgba(36, 104, 255, 0.16), transparent 28rem),
    linear-gradient(145deg, #10131b, #161923);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.game-shell {
  width: min(100vw, 680px);
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 18px;
}

.hud {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(25, 31, 43, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.hud strong {
  display: block;
  margin-top: 2px;
  color: var(--accent);
  font-size: 22px;
  line-height: 1;
}

button {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: #263246;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover,
button:focus-visible {
  background: #34425c;
  outline: 2px solid rgba(255, 211, 57, 0.7);
  outline-offset: 2px;
}

#restart {
  padding: 0 14px;
}

#game {
  width: 100%;
  aspect-ratio: 28 / 31;
  display: block;
  background: #070910;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

.touch-controls {
  display: none;
  grid-template-columns: repeat(3, 52px);
  grid-template-areas:
    ". up ."
    "left down right";
  justify-content: center;
  gap: 8px;
}

.touch-controls [data-dir="up"] {
  grid-area: up;
}

.touch-controls [data-dir="left"] {
  grid-area: left;
}

.touch-controls [data-dir="down"] {
  grid-area: down;
}

.touch-controls [data-dir="right"] {
  grid-area: right;
}

.message {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 680px), (pointer: coarse) {
  .game-shell {
    align-content: start;
    padding: 10px;
  }

  .touch-controls {
    display: grid;
  }
}
