:root {
  --red: #ff3b3b; --orange: #ff8a1f; --yellow: #ffcc1a; --green: #3ddc84;
  --grad: linear-gradient(110deg, var(--red) 0%, var(--orange) 55%, var(--yellow) 100%);
  --text: #f2f4f8; --muted: #b8bfcc; --panel: rgb(14 16 22 / 0.78); --line: rgb(255 255 255 / 0.14);
  --font-display: "Space Grotesk", system-ui, sans-serif; --font-body: "Inter", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d0f13; color: var(--text); font-family: var(--font-body); -webkit-tap-highlight-color: transparent; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.smoke-veil { position: fixed; inset: 0; pointer-events: none; z-index: 2; background: radial-gradient(ellipse at 50% 40%, rgb(20 20 22 / 0), rgb(20 20 22 / 0.9)); opacity: 0; transition: opacity 0.6s; }
.labels { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
.wlabel { position: absolute; transform: translate(-50%, -100%); padding: 3px 8px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-size: 0.72rem; white-space: nowrap; pointer-events: auto; cursor: pointer; }
.wlabel b { font-family: var(--font-display); }
.wlabel.warn { border-color: rgb(255 59 59 / 0.8); color: #ffd0d0; }
.wlabel.ok { border-color: rgb(61 220 132 / 0.7); }

/* ---- HUD ---- */
.hud { position: fixed; top: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 14px 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
.back { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px 6px 6px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); text-decoration: none; color: var(--text); }
.back svg, .icon-btn svg, .stations svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.back svg { width: 18px; height: 18px; }
.back img { height: 26px; width: auto; display: block; }
.status { margin: 0 auto; display: flex; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 6px 14px; }
.lbl { font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); display: block; }
.clock b { font-family: var(--font-display); font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.firebar { min-width: 110px; }
.bar { position: relative; height: 8px; border-radius: 4px; background: rgb(255 255 255 / 0.12); overflow: hidden; margin-top: 4px; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--grad); transition: width 0.25s; }
.bar.smoke i { background: linear-gradient(90deg, #8a8f99, #3c3f46); }
.bar .limit { position: absolute; top: -2px; bottom: -2px; left: 60%; width: 2px; background: #fff; opacity: 0.8; }
.tools { display: flex; gap: 6px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn[aria-pressed="true"] .wave { display: none; }

.objectives { position: fixed; left: 14px; top: 76px; z-index: 4; width: 230px; padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); font-size: 0.85rem; }
.obj-title { margin: 0 0 6px; font-family: var(--font-display); font-weight: 600; }
.objectives ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; color: var(--muted); }
.objectives li.done { color: var(--green); text-decoration: line-through; text-decoration-color: rgb(61 220 132 / 0.5); }
.objectives li.bad { color: #ff8080; }
.instruction { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); z-index: 4; margin: 0; max-width: min(560px, calc(100vw - 32px)); padding: 9px 16px; border-radius: 12px; background: var(--panel); border: 1px solid rgb(255 138 31 / 0.5); text-align: center; font-size: 0.92rem; }
.instruction:empty { display: none; }

.stations { position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 5; display: flex; gap: 6px; padding: 6px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); max-width: calc(100vw - 16px); overflow-x: auto; }
.stations button { display: grid; justify-items: center; gap: 3px; min-width: 76px; padding: 8px 8px 6px; border-radius: 12px; border: 1px solid transparent; background: transparent; cursor: pointer; font-size: 0.72rem; color: var(--muted); }
.stations button svg { width: 22px; height: 22px; }
.stations button:hover, .stations button.is-here { color: var(--text); background: rgb(255 255 255 / 0.06); border-color: var(--line); }
.stations button.leave { color: #9ff0c1; }

.pass { position: fixed; right: 14px; top: 76px; z-index: 5; width: 220px; padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); display: grid; gap: 8px; font-size: 0.85rem; }
.pass__ext { display: flex; align-items: center; gap: 10px; }
.pass__type { font-family: var(--font-display); font-weight: 700; padding: 3px 8px; border-radius: 8px; background: #b91c1c; }
.pass__gauge { flex: 1; height: 8px; border-radius: 4px; background: rgb(255 255 255 / 0.12); overflow: hidden; }
.pass__gauge i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #7dd3fc, #e0f2fe); }
.pass__steps { margin: 0; padding-left: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; color: var(--muted); }
.pass__steps li { padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); font-size: 0.78rem; }
.pass__steps li b { color: var(--yellow); }
.pass__steps li.done { color: var(--green); border-color: rgb(61 220 132 / 0.5); }
.pass__steps li.now { color: var(--text); border-color: rgb(255 138 31 / 0.8); }
.reticle { position: fixed; z-index: 4; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 2px rgb(0 0 0 / 0.4); pointer-events: none; }
.reticle::before, .reticle::after { content: ""; position: absolute; background: #fff; left: 50%; top: 50%; }
.reticle::before { width: 2px; height: 14px; margin: -7px 0 0 -1px; } .reticle::after { width: 14px; height: 2px; margin: -1px 0 0 -7px; }
.reticle.on-base { border-color: var(--green); }
.reticle.spraying { transform: scale(1.12); }

.choice { position: fixed; z-index: 8; transform: translate(-50%, 8px); padding: 10px; border-radius: 14px; background: rgb(14 16 22 / 0.94); border: 1px solid var(--line); display: grid; gap: 6px; min-width: 200px; font-size: 0.85rem; }
.choice p { margin: 0 0 2px; color: var(--muted); }

/* ---- cards ---- */
.card { position: fixed; z-index: 10; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(500px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  padding: 26px 26px 22px; border-radius: 22px; background: rgb(14 16 22 / 0.92); border: 1px solid var(--line); text-align: center; box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.8); }
.card--debrief { width: min(600px, calc(100vw - 32px)); text-align: left; }
.eyebrow { margin: 0 0 6px; font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--orange); font-weight: 600; }
.card h1, .card h2 { margin: 0; font-family: var(--font-display); letter-spacing: -0.02em; }
.card h1 { font-size: 2.8rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.card h2 { font-size: 1.8rem; }
.stars { color: var(--yellow); letter-spacing: 2px; font-size: 1.3rem; }
.sub { margin: 6px 0 14px; color: var(--muted); }
.how { text-align: left; margin: 0 0 18px; padding: 0 0 0 18px; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
.how b { color: var(--text); }
.db-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.db-list li { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgb(255 255 255 / 0.03); font-size: 0.88rem; }
.db-list li strong { display: block; font-family: var(--font-display); margin-bottom: 2px; }
.db-list li.good { border-left: 3px solid var(--green); }
.db-list li.bad { border-left: 3px solid var(--red); }
.db-list li.meh { border-left: 3px solid var(--yellow); }
.db-list li span { color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border-radius: 999px; border: 0; cursor: pointer; background: var(--grad); color: #1d0700; font-weight: 700; font-size: 1rem; }
.btn--sm { padding: 8px 14px; font-size: 0.86rem; }
.btn--ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn:disabled { opacity: 0.45; cursor: default; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.best { margin: 12px 0 0; font-size: 0.85rem; color: var(--muted); }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; }

@media (max-width: 760px) {
  .back img { display: none; }
  .firebar { min-width: 70px; }
  .status { gap: 8px; padding: 6px 10px; }
  .objectives { width: auto; right: 14px; top: 66px; font-size: 0.78rem; padding: 8px 10px; }
  .objectives ol { grid-template-columns: 1fr 1fr; gap: 2px 12px; }
  .instruction { top: auto; bottom: 96px; font-size: 0.85rem; }
  .pass { top: auto; bottom: 150px; right: 10px; width: 190px; }
  .stations button { min-width: 62px; font-size: 0.66rem; }
  #btnRestart { display: none; }
}

.credit { margin: 10px 0 0; font-size: 0.72rem; color: rgb(184 191 204 / 0.7); }
