:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #0b0d12;
  color: #f5f7ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background: radial-gradient(circle at top, #1a2233, #0b0d12 60%);
}

.page {
  width: min(1100px, 94vw);
  padding: 24px 0 40px;
}

.header {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 40px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.header h1 {
  margin: 0 0 6px;
  font-size: 2.2rem;
}

.subtitle {
  margin: 0;
  color: #aab0c2;
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px 16px;
}

.hud-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
}

.hud-item .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #93a1c7;
}

.game-layout {
  display: flex;
  justify-content: center;
}

.game-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(560px, 100%);
}

.canvas-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 18px;
  padding: 12px;
  background: rgba(6, 8, 15, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  touch-action: none;
}

canvas {
  display: block;
  margin: 0 auto;
  border-radius: 12px;
  background: #0d1220;
  width: 100%;
  height: auto;
}

.canvas-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: #f7f8ff;
  pointer-events: none;
  padding: 16px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

button,
select {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.2s ease;
}

button:hover,
select:hover {
  background: rgba(255, 255, 255, 0.16);
}

button:active {
  transform: scale(0.98);
}

button.primary {
  background: #4b7cff;
  color: #fff;
}

.speed-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.speed-control label {
  color: #aab0c2;
}

.pad-panel {
  background: rgba(6, 8, 15, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  touch-action: none;
}

.dpad {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  width: 100%;
}

.pad-row {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.pad {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 1.2rem;
  touch-action: none;
}

.pad-hint {
  margin: 0;
  text-align: center;
  color: #8c94b1;
  font-size: 0.9rem;
}

@media (max-width: 860px) {
  .hud {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

@media (max-width: 520px) {
  .hud {
    grid-template-columns: repeat(2, minmax(90px, 1fr));
  }

  .pad {
    width: 56px;
    height: 56px;
  }
}
