:root {
  --bg: #fff7ea; --bg2: #ffe9c7; --ink: #2b2118; --muted: #7a6650;
  --card: #fffdf8; --line: #ecd9b8; --accent: #d9772f; --accent-ink: #fff;
  --gold: #c98a1e; --stove: #3a332d; --tile: #f6e6cc;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1712; --bg2: #2a2119; --ink: #f6ead8; --muted: #b9a58c;
    --card: #241d16; --line: #3d3127; --accent: #f09a4f; --accent-ink: #1c1712;
    --gold: #f0c060; --stove: #0f0d0b; --tile: #2e251d;
  }
}
:root[data-theme="dark"] {
  --bg: #1c1712; --bg2: #2a2119; --ink: #f6ead8; --muted: #b9a58c;
  --card: #241d16; --line: #3d3127; --accent: #f09a4f; --accent-ink: #1c1712;
  --gold: #f0c060; --stove: #0f0d0b; --tile: #2e251d;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: linear-gradient(var(--bg), var(--bg2)); color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
main {
  max-width: 520px; margin: 0 auto; min-height: 100%;
  padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
}
header { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
h1 { font-size: 1.4rem; margin: 0; letter-spacing: -0.01em; }
.hud { display: flex; gap: 14px; color: var(--muted); font-size: 0.9rem; }
.hud b { color: var(--ink); font-variant-numeric: tabular-nums; }
.stage {
  position: relative; flex: 1; min-height: 380px; max-height: 640px;
  border-radius: 18px; overflow: hidden; background: var(--card);
  border: 1px solid var(--line); touch-action: none; user-select: none;
}
canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
.overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 24px;
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: blur(2px);
}
.overlay[hidden] { display: none; }
.overlay h2 { margin: 0; font-size: 1.8rem; }
.overlay p { margin: 0; color: var(--muted); }
.gold { color: var(--gold); font-weight: 600; }
button {
  font: inherit; font-weight: 600; border: 0; border-radius: 999px; cursor: pointer;
  padding: 12px 32px; background: var(--accent); color: var(--accent-ink); margin-top: 6px;
}
button:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
footer { text-align: center; padding-bottom: 4px; }
.mp { color: var(--muted); font-size: 0.95rem; text-decoration: none; }
.mp:hover { color: var(--ink); text-decoration: underline; }
