:root {
  color-scheme: dark;
  --bg: #111319;
  --panel: #1b1f27;
  --road: #2f343b;
  --line: #d9d3be;
  --accent: #36d7a2;
  --danger: #ff5f57;
  --text: #f4f2ea;
  --muted: #a8b0bc;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 15%, rgba(54, 215, 162, 0.14), transparent 24rem),
    linear-gradient(135deg, #0f1117 0%, #171a20 50%, #20242a 100%);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.shell {
  width: min(1120px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(320px, 540px) minmax(260px, 360px);
  gap: 28px;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
}

.game-panel {
  width: 100%;
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.hud > div {
  min-height: 64px;
  padding: 10px 14px;
  background: rgba(27, 31, 39, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

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

.hud strong {
  display: block;
  margin-top: 3px;
  font-size: 24px;
  line-height: 1;
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  max-height: calc(100vh - 140px);
  background: var(--road);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
}

.touch-controls {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.touch-controls button,
.start-button {
  min-height: 48px;
  border-radius: 8px;
  background: #2b3038;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 800;
}

.touch-controls button:first-child,
.touch-controls button:last-child {
  font-size: 30px;
  line-height: 1;
}

.start-button {
  width: 100%;
  margin-top: 22px;
  color: #09120f;
  background: var(--accent);
}

.side-panel {
  padding: 26px;
  background: rgba(27, 31, 39, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.side-panel h1 {
  margin: 0 0 12px;
  font-size: 44px;
  line-height: 0.95;
}

.side-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.key-grid {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 10px 12px;
  align-items: center;
  margin-top: 24px;
}

.key-grid span {
  min-height: 34px;
  display: grid;
  place-items: center;
  background: #252a32;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  font-weight: 800;
}

@media (max-width: 860px) {
  .shell {
    width: min(560px, calc(100vw - 24px));
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: start;
  }

  .side-panel {
    order: -1;
    padding: 18px;
  }

  .side-panel h1 {
    font-size: 34px;
  }

  .key-grid {
    display: none;
  }

  canvas {
    max-height: none;
  }
}
