:root {
  --void: #05070c;
  --panel: #0d1320;
  --line: #1c2740;
  --ink: #e7ecf5;
  --dim: #7c89a6;
  --accent: #ffe27a;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  background: radial-gradient(120% 100% at 50% 0%, #0c1322 0%, var(--void) 70%);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
}
body { display: flex; flex-direction: column; align-items: center; min-height: 100vh; padding: 24px 16px 48px; }

.topbar { width: 100%; max-width: 720px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.topbar a { color: var(--dim); text-decoration: none; font-size: 14px; }
.topbar a:hover { color: var(--ink); }
.brand { font-weight: 800; letter-spacing: .02em; color: var(--ink); font-size: 16px; }
.brand b { color: var(--accent); }

#hud {
  width: 100%; max-width: 720px; display: flex; gap: 18px; align-items: center;
  font-variant-numeric: tabular-nums; margin-bottom: 12px; font-size: 15px; flex-wrap: wrap;
}
.hud-group { display: flex; align-items: center; gap: 6px; }
.heart { font-size: 18px; }
.heart.full { color: #d8453c; }
.heart.half { color: #d8453c; opacity: .55; }
.heart.empty { color: #38415a; }
.coin { color: var(--accent); }
.key { color: #f5c542; }
.hud-level { margin-left: auto; color: var(--dim); font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }

.stage-wrap { position: relative; }
#stage {
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font-family: "DejaVu Sans Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 18px;
  user-select: none;
  box-shadow: 0 18px 60px rgba(0,0,0,.6), inset 0 0 80px rgba(80,120,200,.04);
}
#stage span { will-change: contents; }

#banner {
  position: absolute; inset: 10px; border-radius: 8px;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(5,7,12,.82); backdrop-filter: blur(2px); text-align: center;
}
#banner.show { display: flex; }
#banner h2 { margin: 0 0 6px; font-size: 26px; color: var(--accent); }
#banner p { margin: 0; color: var(--dim); }

.controls { margin-top: 16px; color: var(--dim); font-size: 13px; text-align: center; line-height: 1.7; }
.controls kbd {
  display: inline-block; min-width: 22px; padding: 2px 7px; margin: 0 1px;
  background: var(--panel); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; color: var(--ink); font-family: inherit; font-size: 12px;
}
.dpad { display: none; }
@media (hover: none) and (pointer: coarse) {
  .dpad { display: grid; grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(3, 52px);
    gap: 6px; margin: 18px auto 0; justify-content: center; }
  .dpad button { background: var(--panel); border: 1px solid var(--line); color: var(--ink);
    border-radius: 10px; font-size: 20px; }
  .dpad .up { grid-area: 1 / 2; } .dpad .left { grid-area: 2 / 1; }
  .dpad .right { grid-area: 2 / 3; } .dpad .down { grid-area: 3 / 2; }
}
