:root {
  --bg: #071424;
  --panel: #102338;
  --line: #24405c;
  --ink: #e9f3ff;
  --muted: #9fb6cd;
  --accent: #54d6c4;
  --hot: #ff6b6b;
  --violet: #b39cff;
  --pn-vh: 1vh;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#app { min-height: calc(var(--pn-vh) * 100); display: flex; flex-direction: column; gap: 10px; padding: 12px clamp(10px, 3vw, 28px) 16px; max-width: 1040px; margin: 0 auto; }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.title { font-size: 20px; font-weight: 800; letter-spacing: .2px; }
.title small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.spacer { flex: 1; }
.hud { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 13px; }
.hud .opt { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.hud b { font-variant-numeric: tabular-nums; }
#stage { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
#board { display: block; width: 100%; height: auto; touch-action: none; }
#overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(4, 12, 22, .68); }
#overlay.hidden, #modal.hidden { display: none; }
.card { background: var(--panel); border: 1px solid var(--accent); border-radius: 14px; padding: 18px 24px; text-align: center; min-width: 238px; box-shadow: 0 12px 40px rgba(0,0,0,.45); }
.card-label { font-size: 20px; font-weight: 800; color: var(--accent); margin-bottom: 10px; }
.card-body { display: flex; justify-content: center; gap: 20px; margin-bottom: 14px; }
.card-body div { display: grid; gap: 2px; font-size: 12px; color: var(--muted); }
.card-body b { color: var(--ink); font-size: 18px; font-variant-numeric: tabular-nums; }
#controlbar { display: grid; gap: 8px; }
.steer { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.steer .key { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); font-size: 11px; }
.trackline { position: relative; height: 8px; border-radius: 8px; background: #1b334c; overflow: visible; }
.progress { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--accent), var(--violet)); border-radius: 8px; }
.gmark { position: absolute; top: -9px; left: 0; color: var(--violet); font-size: 16px; transform: translateX(-50%); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 9px; background: #152c44; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--accent); color: #05202a; border-color: var(--accent); }
.btn.icon { min-width: 44px; padding: 0; font-size: 20px; }
.btn.wide { min-width: 116px; }
.hint { color: var(--muted); font-size: 12px; }
#modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(2,8,16,.8); padding: 18px; z-index: 10; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; max-width: 560px; }
.modal-card h2 { margin-top: 0; color: var(--accent); }
.modal-card ol { padding-left: 20px; }
.modal-card li { margin-bottom: 8px; }
.muted { color: var(--muted); font-size: 12px; }
#toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: #173050; border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: 1; }
@media (max-width: 560px) {
  .title { font-size: 17px; }
  .hud { gap: 7px; }
  .actions .btn { flex: 1 1 auto; padding: 0 8px; font-size: 13px; }
  .hint { font-size: 11px; }
}
