body {
  height: 100dvh;
  min-height: 100svh;
  padding: 68px 12px 24px;
  overflow: auto;
}

#game-container {
  width: min(100%, 800px, calc((100dvh - 190px) * 1.333333));
  min-width: 0;
  gap: 12px;
}

#canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
}

.hud { padding: 0 8px; gap: 8px; }
.hud-section { min-width: 0; }
.hud-label { font-size: 12px; letter-spacing: 0; }
.game-mode { font-size: 12px; }

.overlay {
  inset: 64px 8px 8px;
  width: auto;
  height: auto;
  padding: 12px;
  overflow-y: auto;
  align-items: safe center;
  border-radius: 16px;
}

.overlay .menu {
  width: min(100%, 450px);
  max-height: 100%;
  padding: clamp(16px, 4vw, 30px);
  overflow-y: auto;
}

.menu-btn { min-height: 44px; padding: 12px 16px; }
.menu h1 { font-size: clamp(32px, 8vw, 50px); }
.menu h2 { font-size: clamp(20px, 6vw, 28px); }

#touch-controls {
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 20;
  gap: 14px;
}

.touch-btn { width: 60px; height: 60px; touch-action: none; }

@media (max-height: 600px) {
  .menu .subtitle { margin-bottom: 16px; }
  .menu-btn { margin: 8px 0; }
  .hud-value { font-size: 22px; }
}
