/* Same palette as Snäckmageddon and the hub: ink, cream panels, warm lines, green accent. */
:root {
  --ink: #1f1710;
  --muted: #6a5a4a;
  --panel: rgba(255, 250, 240, 0.97);
  --line: #e0d4c2;
  --chip: #efe6d6;
  --accent: #3aaa5c;
  --accent-ink: #fff;
  --hud: rgba(20, 15, 10, 0.62);
  --ground: #2f5f27;
  --ground-low: #1f4a1b;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --pad-h: 150px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: linear-gradient(var(--ground), var(--ground-low) 70%); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button { font: inherit; }

/* ---------- stage ---------- */
#stage { position: fixed; inset: 0; padding: calc(52px + var(--safe-t)) 4px calc(var(--pad-h) + 8px + var(--safe-b)); touch-action: none; }
#maze { width: 100%; height: 100%; display: block; touch-action: none; }
.banner { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; pointer-events: none;
  font-weight: 900; font-size: clamp(22px, 6vw, 34px); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.5), 0 0 18px rgba(0,0,0,.5); letter-spacing: .02em; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; user-select: none; -webkit-user-select: none; }
#hud > * { pointer-events: auto; }
.hud-top { position: absolute; top: calc(8px + var(--safe-t)); left: 8px; right: 8px; display: flex; align-items: stretch; gap: 6px; }
.stat { display: grid; align-content: center; justify-items: start; gap: 0; padding: 4px 10px; border-radius: 10px; background: var(--hud); color: #fff; min-width: 56px; }
.stat .label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; opacity: .8; line-height: 1.2; }
.stat .value { font-weight: 800; font-size: 18px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat.lives { padding: 4px 8px; }
.stat.lives canvas { width: 72px; height: 24px; display: block; }
.hud-btns { display: flex; gap: 6px; margin-left: auto; }
.icon-btn { width: 40px; height: 36px; align-self: center; border: none; border-radius: 10px; background: var(--hud); color: #fff; font-size: 17px; cursor: pointer; flex: none; }
@media (max-width: 400px) { .stat.best { display: none; } .stat { min-width: 48px; padding: 4px 8px; } }

/* ---------- the cross ---------- */
.pad { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr; grid-template-areas: ". up ." "left down right"; gap: 6px; padding: 6px 10px calc(8px + var(--safe-b)); height: calc(var(--pad-h) + 8px + var(--safe-b)); z-index: 4; max-width: 340px; margin: 0 auto; }
.pad-btn { border: 0; border-radius: 16px; background: var(--panel); color: var(--ink); font-size: 26px; font-weight: 800; cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,.18), 0 8px 24px rgba(0,0,0,.18);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pad-btn.up { grid-area: up; } .pad-btn.down { grid-area: down; } .pad-btn.left { grid-area: left; } .pad-btn.right { grid-area: right; }
.pad-btn.pressed { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.18), 0 4px 12px rgba(0,0,0,.18); filter: brightness(1.12); }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(31, 74, 27, 0.6); backdrop-filter: blur(3px); z-index: 10; overflow: auto; }
.panel { position: relative; width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.panel.small { width: min(380px, 100%); text-align: center; }
.panel h1 { margin: 6px 0 4px; font-size: 32px; line-height: 1.05; }
.panel h2 { margin: 0 0 10px; font-size: 22px; }
.tagline { margin: 0 0 16px; color: var(--muted); }
.lang { position: absolute; top: 14px; right: 14px; display: flex; gap: 2px; background: var(--chip); border-radius: 999px; padding: 3px; }
.lang button { font-size: 12px; font-weight: 700; border: 0; background: transparent; padding: 4px 10px; border-radius: 999px; cursor: pointer; color: var(--muted); }
.lang button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.btn { border: 0; border-radius: 12px; padding: 11px 18px; font-weight: 800; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); flex: 1 1 100%; font-size: 17px; }
.btn.secondary { background: var(--chip); color: var(--ink); }
.btn:hover { filter: brightness(1.05); }
.hint { min-height: 1.2em; margin: 10px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
footer { margin-top: 12px; font-size: 12px; color: var(--muted); text-align: center; }
footer a { color: inherit; }
#help p { line-height: 1.45; }
.why { font-size: 14px; color: var(--muted); line-height: 1.45; margin: 4px 0; }
.score { font-size: 30px; font-weight: 800; margin: 6px 0 0; }
.best { margin: 0 0 14px; color: var(--muted); font-weight: 700; }
.best.new { color: var(--accent); }
