:root {
  color-scheme: light dark;
  --bg: #0b0e14;
  --fg: #e6e1cf;
  --accent: #5de4c7;
  --muted: #8a9199;
}
html, body { overscroll-behavior: none; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Helvetica, Arial;
  display: flex; flex-direction: column;
}
.topbar { display:flex; align-items:center; gap:16px; padding:10px 16px; border-bottom:1px solid #111827; }
.topbar h1 { margin:0; font-size:18px; font-weight:600; }
.topbar .back { color: var(--accent); text-decoration: none; }
.stage-wrap { position:relative; margin:0 auto; padding:12px; width:min(100%, 560px); flex:1 1 auto; display:flex; align-items:center; justify-content:center; }
.stage-wrap.portrait { width:min(100%, 560px); }
canvas#game { display:block; width:100%; height:auto; border:1px solid #1f2937; background: linear-gradient(#7dd3fc, #0ea5e9 40%, #0c4a6e 85%); box-shadow:0 2px 16px rgba(0,0,0,0.3); touch-action: none; }
.hud { position:absolute; top:16px; left:16px; right:16px; display:flex; align-items:center; justify-content:space-between; font-weight:700; text-shadow:0 1px 0 rgba(0,0,0,0.6); }
.hud .right { color: var(--muted); }
.help { position:absolute; bottom:12px; width:100%; text-align:center; color:var(--muted); }
.icon-btn { background: transparent; border: 1px solid #1f2937; color: var(--fg); border-radius: 8px; padding: 4px 8px; cursor: pointer; }
.overlay { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; background: rgba(0,0,0,0.55); color:var(--fg); text-align:center; padding:24px; }
.overlay.hidden { display:none; }
.overlay .panel { background: rgba(15, 23, 42, 0.85); border:1px solid #1f2937; border-radius:12px; padding:24px 28px; max-width: 420px; }
.overlay .actions { margin-top:16px; display:flex; gap:12px; justify-content:center; }
.overlay button { background: var(--accent); color:#112; border:none; font-weight:700; padding:10px 16px; border-radius:8px; cursor:pointer; }
.overlay button.secondary { background:#334155; color:var(--fg); }
