:root {
  --pn-vh: 1vh;
  --bg: #0d1b2a;
  --panel: #112437;
  --ink: #e8f1f5;
  --muted: #8fa7b5;
  --accent: #2ec4b6;
  --gold: #ffd166;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  overscroll-behavior: none;
}
#app {
  min-height: calc(var(--pn-vh) * 100);
  display: flex;
  flex-direction: column;
  max-width: 980px;
  margin: 0 auto;
  padding: 8px 12px 12px;
}
.topbar, #statusbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.topbar { padding: 4px 2px 8px; }
.title { font-size: 18px; font-weight: 800; letter-spacing: .2px; }
.title small { color: var(--muted); font-weight: 500; font-size: 11px; margin-left: 4px; }
.spacer { flex: 1; }
.hud { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.hud .opt { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.hud b { color: var(--gold); font-variant-numeric: tabular-nums; }
#stage { position: relative; width: 100%; }
canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 900 / 540;
  background: var(--bg);
  border-radius: 10px;
  touch-action: none;
  user-select: none;
}
#overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 15, 24, .55);
  border-radius: 10px;
}
.card, .modal-card {
  background: var(--panel);
  border: 1px solid #24455c;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .35);
}
.card { min-width: 240px; text-align: center; }
.card-label { font-size: 20px; font-weight: 800; color: var(--accent); }
.card-body { display: flex; justify-content: center; gap: 18px; margin: 12px 0; }
.card-body div { display: flex; flex-direction: column; }
.card-body span { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.card-body b { color: var(--ink); font-size: 16px; font-variant-numeric: tabular-nums; }
#statusbar { padding-top: 10px; }
#status { flex: 1 1 100%; min-height: 18px; color: var(--muted); font-size: 13px; }
#status[data-tone="warn"] { color: var(--gold); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; }
.btn {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid #2c5369;
  border-radius: 8px;
  background: #163047;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:hover { background: #1e405b; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #06231f; border-color: var(--accent); }
.btn.icon { min-width: 40px; padding: 8px; font-size: 18px; }
#btn-hold {
  flex: 1 1 140px;
  min-height: 48px;
  background: var(--gold);
  color: #2a1c00;
  border-color: var(--gold);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1px;
  touch-action: none;
}
#btn-hold.held { background: #f79d5c; border-color: #f79d5c; }
#modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 15, 24, .7);
  padding: 20px;
  z-index: 10;
}
.modal-card { max-width: 560px; line-height: 1.55; }
.modal-card h2 { margin-top: 0; color: var(--accent); }
.modal-card ol { padding-left: 20px; }
.modal-card .muted { color: var(--muted); font-size: 13px; }
#toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); color: var(--gold); font-size: 13px; pointer-events: none; }
.hidden { display: none !important; }
@media (max-width: 600px) {
  .title { font-size: 16px; }
  .hud { gap: 6px; font-size: 12px; }
  .btn { min-height: 38px; padding: 7px 10px; }
}
