:root {
  --night: #0a0f17; --panel: #111a26ee; --line: #24324a; --text: #eef4f8; --muted: #8fa3b8;
  --ember: #ff6a2b; --live: #c9ff3d; --bad: #ff7a7a;
  --r0: #c9d4de; --r1: #8be0a9; --r2: #7ab8ff; --r3: #c79bff; --r4: #ffc65a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--text); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; overflow: hidden; }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#labels { position: fixed; inset: 0; pointer-events: none; }
.lbl { position: absolute; left: 0; top: 0; font-size: 11px; padding: 1px 6px; border-radius: 8px; background: #0a0f17aa; color: var(--muted); white-space: nowrap; }
.lbl.up { color: var(--live); }
.lbl.you { color: var(--ember); font-weight: 600; }
button { font: inherit; color: var(--text); background: #1b2738; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--ember); border-color: var(--ember); color: #1a0d05; font-weight: 600; }
.top { position: fixed; top: 0; left: 0; right: 0; display: flex; gap: 8px; align-items: center; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); background: linear-gradient(#0a0f17ee, #0a0f1700); }
.top .brand { font-weight: 700; letter-spacing: 0.04em; }
.top .stat { color: var(--muted); font-size: 12px; }
.top .stat b { color: var(--text); }
.top .grow { flex: 1; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); margin-right: 4px; }
.dot.on { background: var(--live); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 6px; padding: 8px 12px; padding-bottom: max(8px, env(safe-area-inset-bottom)); background: #0a0f17ee; border-top: 1px solid var(--line); }
.tabs button { flex: 1; }
.tabs button.on { border-color: var(--ember); color: var(--ember); }
.panel { position: fixed; left: 0; right: 0; bottom: 56px; max-height: 55vh; overflow: auto; background: var(--panel); border-top: 1px solid var(--line); padding: 12px; backdrop-filter: blur(6px); }
.card { position: fixed; left: 12px; right: 12px; top: 56px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
@media (min-width: 900px) {
  .panel { top: 56px; bottom: 12px; left: 12px; right: auto; width: 360px; max-height: none; border: 1px solid var(--line); border-radius: 12px; }
  .card { left: auto; right: 12px; width: 320px; }
  .tabs { left: 12px; right: auto; bottom: auto; top: 50px; width: 360px; background: none; border: 0; padding: 0; }
  .panel { top: 92px; }
}
h3 { margin: 0 0 8px; font-size: 15px; }
.row { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #1a2536; }
.row:last-child { border-bottom: 0; }
.muted { color: var(--muted); font-size: 12px; }
.bad { color: var(--bad); }
.hp { height: 4px; background: #1b2738; border-radius: 2px; overflow: hidden; margin-top: 3px; }
.hp i { display: block; height: 100%; background: var(--r1); }
.hp i.low { background: var(--bad); }
.r0 { color: var(--r0); } .r1 { color: var(--r1); } .r2 { color: var(--r2); } .r3 { color: var(--r3); } .r4 { color: var(--r4); }
.info { width: 18px; height: 18px; padding: 0; border-radius: 50%; font-size: 11px; line-height: 16px; margin-left: 4px; vertical-align: middle; }
.bubble { margin: 6px 0; padding: 8px 10px; border-radius: 8px; background: #0a0f17; border: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.notice { position: fixed; left: 50%; transform: translateX(-50%); bottom: 110px; max-width: calc(100% - 32px); background: #2a1410; border: 1px solid var(--ember); border-radius: 10px; padding: 8px 12px; }
.start { position: fixed; inset: 0; display: grid; place-items: center; background: #0a0f17cc; padding: 16px; }
.start .box { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: grid; gap: 12px; }
.start h1 { margin: 0; font-size: 26px; letter-spacing: 0.04em; }
.hint { position: fixed; top: 56px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--ember); border-radius: 10px; padding: 8px 12px; display: flex; gap: 10px; align-items: center; }
.log div { padding: 4px 0; border-bottom: 1px solid #1a2536; }
body.busy .panel button, body.busy .card button, body.busy .start button { opacity: 0.6; cursor: progress; }
input { font: inherit; color: var(--text); background: #0a0f17; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
.stack { display: grid; gap: 12px; }
[hidden] { display: none !important; }
