:root {
  --bg: #0a0c11;
  --bg2: #0f1219;
  --panel: #12161f;
  --panel2: #171c27;
  --line: #242a38;
  --line2: #2f3647;
  --text: #e9ecf3;
  --muted: #8c94a8;
  --dim: #5d6579;
  --accent: #ffb547;
  --accent-ink: #1b1204;
  --cyan: #5ad1ff;
  --good: #4ade80;
  --bad: #ff6b6b;
  --r: 12px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
b, strong { font-weight: 600; }

/* ---------- header ---------- */
.top {
  height: 56px; display: flex; align-items: center; gap: 20px;
  padding: 0 16px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #10131b, #0c0f15);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-width: 0; }
.logo {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 38% 38%, #fff 0 12%, transparent 13%),
              radial-gradient(circle, #0b0d12 0 42%, var(--accent) 43% 100%);
  box-shadow: 0 0 18px rgba(255, 181, 71, .35);
}
.brand-name { font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.brand-sub { color: var(--muted); font-size: 12px; white-space: nowrap; }
.xp { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.lvl { font-family: var(--display); font-weight: 600; color: var(--accent); font-size: 13px; white-space: nowrap; }
.xpbar { width: 160px; height: 8px; border-radius: 99px; background: var(--panel2); overflow: hidden; border: 1px solid var(--line); }
.xpbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #ffd98a); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.xptext { font-family: var(--mono); font-size: 12px; color: var(--muted); min-width: 64px; }
.top-actions { display: flex; gap: 8px; }

.chip {
  border: 1px solid var(--line2); background: var(--panel2); color: var(--text);
  padding: 6px 12px; border-radius: 99px; font-size: 13px; font-weight: 500;
  transition: background .15s, border-color .15s;
}
.chip:hover { background: #1e2432; border-color: #3d4659; }
.chip.icon { width: 34px; padding: 6px 0; text-align: center; }
.chip.small { padding: 3px 9px; font-size: 11px; }
.chip.on { background: rgba(255, 181, 71, .16); border-color: var(--accent); color: var(--accent); }
.chip.muted { opacity: .5; }

/* ---------- layout ---------- */
.layout {
  height: calc(100% - 56px);
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr) 380px;
}

/* chapters sidebar */
.chapters { border-right: 1px solid var(--line); overflow-y: auto; padding: 12px 10px 24px; background: var(--bg2); }
.chapters h4 { margin: 4px 8px 10px; font: 600 11px/1 var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.chap {
  display: grid; grid-template-columns: 30px 1fr; gap: 2px 10px; align-items: center;
  width: 100%; text-align: left; border: 1px solid transparent; background: none;
  padding: 9px 8px; border-radius: 10px; margin-bottom: 2px;
}
.chap:hover { background: var(--panel); }
.chap.active { background: var(--panel2); border-color: var(--line2); }
.chap .num {
  grid-row: span 2; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  font: 600 13px var(--mono); background: var(--panel2); border: 1px solid var(--line2); color: var(--muted);
}
.chap.active .num { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chap.done .num { background: rgba(74, 222, 128, .14); color: var(--good); border-color: rgba(74, 222, 128, .4); }
.chap .t { font-weight: 600; font-size: 13.5px; line-height: 1.25; }
.chap .p { display: flex; align-items: center; gap: 6px; }
.chap .p i { flex: 1; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; position: relative; }
.chap .p i b { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 3px; }
.chap.done .p i b { background: var(--good); }
.chap .p small { font: 11px var(--mono); color: var(--dim); }

/* stage */
.stage-wrap {
  position: relative; overflow: hidden;
  background:
    radial-gradient(1200px 700px at 50% 20%, #1a2030 0%, #0d1017 60%, #090b10 100%);
}
.stage { position: absolute; inset: 0; }
.stage canvas { display: block; outline: none; touch-action: none; }
.labels { position: absolute; inset: 0; pointer-events: none; }
.stage-title { position: absolute; top: 14px; left: 16px; pointer-events: none; display: flex; flex-direction: column; }
.stage-title span { font: 600 11px var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.stage-title strong { font: 700 22px/1.2 var(--display); letter-spacing: -.01em; text-shadow: 0 2px 12px rgba(0,0,0,.6); }
.stage-hint {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  font-size: 12px; color: var(--muted); background: rgba(10, 12, 17, .7); border: 1px solid var(--line);
  padding: 5px 12px; border-radius: 99px; pointer-events: none; transition: opacity .6s; white-space: nowrap;
}
.stage-hint.gone { opacity: 0; }
.reset-view { position: absolute; top: 14px; right: 14px; background: rgba(18, 22, 31, .85); backdrop-filter: blur(6px); }
.nogl { position: absolute; inset: 40% 20% auto; text-align: center; color: var(--bad); }

/* 3D labels */
.lbl {
  font: 600 12px/1.2 'Inter', sans-serif; color: #fff; white-space: nowrap;
  background: rgba(10, 12, 17, .78); border: 1px solid rgba(255,255,255,.14);
  padding: 4px 8px; border-radius: 7px; transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0,0,0,.35); transition: opacity .25s;
}
.lbl small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; }
.lbl.accent { border-color: rgba(255,181,71,.6); color: var(--accent); }
.lbl.cyan { border-color: rgba(90,209,255,.55); color: var(--cyan); }
.lbl.good { border-color: rgba(74,222,128,.55); color: var(--good); }
.lbl.bad { border-color: rgba(255,107,107,.6); color: var(--bad); }
.lbl.plain { background: none; border: 0; box-shadow: none; text-shadow: 0 1px 6px #000; }
.lbl.big { font-size: 14px; padding: 6px 10px; }
.lbl.hide { opacity: 0; }

/* ---------- LCD (camera screen) ---------- */
.lcd {
  position: absolute; left: 14px; bottom: 14px; width: min(400px, calc(100% - 28px));
  background: linear-gradient(180deg, #1b1f28, #13161d); border: 1px solid #2c3242;
  border-radius: 16px; padding: 8px; box-shadow: 0 18px 50px rgba(0,0,0,.55);
  z-index: 3;
}
.lcd-top { display: flex; align-items: center; gap: 8px; font: 600 12px var(--display); padding: 0 4px 7px; }
.lcd-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.lcd-sub { color: var(--dim); font: 400 11px 'Inter'; }
.lcd-min { margin-left: auto; width: 24px; height: 20px; border-radius: 6px; border: 1px solid var(--line2); background: var(--panel2); line-height: 1; padding: 0; }
.lcd.min .lcd-body { display: none; }
.lcd.min { width: auto; }
.lcd-screen { position: relative; border-radius: 9px; overflow: hidden; background: #000; aspect-ratio: 3 / 2; cursor: crosshair; }
.lcd-screen canvas { width: 100%; height: 100%; display: block; }
.lcd-info {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 10px 6px;
  font: 600 11.5px var(--mono); color: #fff; letter-spacing: .02em;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.65));
  display: flex; gap: 12px; flex-wrap: wrap; pointer-events: none;
}
.lcd-info .warn { color: var(--bad); }
.lcd-mode {
  position: absolute; top: 7px; left: 8px; font: 600 11px var(--mono); color: #fff; pointer-events: none;
  background: rgba(0,0,0,.5); padding: 2px 6px; border-radius: 5px;
}
.reticle {
  position: absolute; width: 46px; height: 46px; margin: -23px 0 0 -23px; border: 2px solid var(--good);
  border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity .3s;
}
.reticle span { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 3px; font: 600 10.5px var(--mono); color: var(--good); white-space: nowrap; text-shadow: 0 1px 3px #000; }
.reticle.show { opacity: 1; animation: rpulse .45s ease-out; }
@keyframes rpulse { from { transform: scale(1.5); } to { transform: scale(1); } }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: flash .35s ease-out; }
@keyframes flash { 0% { opacity: .95; } 100% { opacity: 0; } }

.lcd-bar { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.meter { position: relative; flex: 1; height: 40px; border-radius: 8px; background: #0b0d12; border: 1px solid var(--line); overflow: hidden; }
.meter-ticks { position: absolute; inset: 0; display: flex; justify-content: space-between; align-items: flex-end; padding: 0 8px 4px; }
.meter-ticks i { width: 1px; height: 6px; background: #4a5266; }
.meter-ticks i.maj { height: 11px; background: #8c94a8; position: relative; }
.meter-ticks i.maj::after { content: attr(data-l); position: absolute; bottom: 13px; left: 50%; transform: translateX(-50%); font: 9.5px var(--mono); color: var(--muted); }
#meterNeedle {
  position: absolute; top: 4px; bottom: 4px; width: 3px; margin-left: -1.5px; left: 50%;
  background: var(--good); border-radius: 2px; box-shadow: 0 0 10px var(--good); transition: left .2s, background .2s;
}
#meterNeedle.off { background: var(--bad); box-shadow: 0 0 10px var(--bad); }
#histo { width: 96px; height: 40px; border-radius: 8px; background: #0b0d12; border: 1px solid var(--line); }
.shoot {
  width: 46px; height: 46px; border-radius: 50%; border: 3px solid #e9ecf3; background: none; padding: 3px; flex: none;
}
.shoot span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--bad); transition: transform .1s; }
.shoot:hover span { background: #ff8585; }
.shoot:active span { transform: scale(.85); }
.roll { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; }
.roll:empty { display: none; }
.roll img { height: 44px; aspect-ratio: 3/2; border-radius: 5px; border: 1px solid var(--line2); cursor: zoom-in; flex: none; }
.roll img:hover { border-color: var(--accent); }

/* ---------- side panel ---------- */
.panel { border-left: 1px solid var(--line); overflow-y: auto; background: var(--bg2); padding: 20px 20px 40px; scroll-behavior: smooth; }
.panel .kicker { font: 600 11px var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.panel h1 { font: 700 26px/1.15 var(--display); letter-spacing: -.02em; margin: 6px 0 4px; }
.panel .sub { color: var(--muted); margin: 0 0 14px; }
.panel section { margin-top: 20px; }
.panel h3 {
  font: 600 11px var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--dim);
  margin: 0 0 10px; display: flex; align-items: center; gap: 8px;
}
.panel h3 .count { color: var(--accent); letter-spacing: 0; font-family: var(--mono); }
.panel h3::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.learn p { margin: 0 0 10px; color: #cfd4df; }
.learn .tip { border-left: 3px solid var(--cyan); background: rgba(90, 209, 255, .06); padding: 8px 12px; border-radius: 0 8px 8px 0; font-size: 13px; }
.learn .tip b { color: var(--cyan); }
dfn, .t-link {
  font-style: normal; color: var(--accent); border-bottom: 1px dashed rgba(255,181,71,.5); cursor: help;
}
dfn:hover, .t-link:hover { border-bottom-style: solid; }

/* controls */
.controls { display: flex; flex-direction: column; gap: 14px; }
.ctl-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; gap: 8px; }
.ctl-head label { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.ctl-head output { font: 600 13px var(--mono); color: var(--accent); white-space: nowrap; }
.q {
  width: 17px; height: 17px; border-radius: 50%; border: 1px solid var(--line2); background: var(--panel2);
  font: 600 10px var(--mono); color: var(--muted); padding: 0; line-height: 15px;
}
.q:hover { color: var(--accent); border-color: var(--accent); }
.ctl .hint { font-size: 12px; color: var(--dim); margin-top: 3px; }
.ctl .ends { display: flex; justify-content: space-between; font: 10.5px var(--mono); color: var(--dim); margin-top: 1px; }
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: none; margin: 0; cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--accent) var(--p, 50%), var(--line) var(--p, 50%)); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 6px; background: var(--line); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; margin-top: -6px;
  background: #fff; border: 3px solid var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }
input[type=range]:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 6px; }
input[type=range]:disabled { opacity: .45; cursor: not-allowed; }

.ctl-toggle { display: flex; align-items: center; justify-content: space-between; }
.ctl-toggle .ctl-head { margin: 0; }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: background .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1px solid var(--line2); background: var(--panel2); border-radius: 8px; padding: 5px 10px; font-size: 12.5px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btnrow { display: flex; flex-wrap: wrap; gap: 6px; }
.btnrow button { border: 1px solid var(--line2); background: var(--panel2); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; }
.btnrow button:hover { border-color: var(--accent); color: var(--accent); }

/* readout */
.readout { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; font-size: 13px; min-height: 40px; }
.readout .row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.readout .row span:first-child { color: var(--muted); }
.readout .row b { font: 600 13px var(--mono); text-align: right; }
.readout .eq { font: 600 13px var(--mono); color: var(--cyan); background: rgba(90,209,255,.07); border-radius: 8px; padding: 8px 10px; margin: 4px 0 8px; text-align: center; }
.readout .status { margin-top: 6px; padding: 7px 10px; border-radius: 8px; font-weight: 600; font-size: 13px; }
.readout .status.good { background: rgba(74,222,128,.1); color: var(--good); }
.readout .status.bad { background: rgba(255,107,107,.1); color: var(--bad); }
.readout .status.mid { background: rgba(255,181,71,.1); color: var(--accent); }
.bar { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; margin: 3px 0 8px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 8px; transition: width .2s; }
.bar.cyan i { background: var(--cyan); }
.bar.good i { background: var(--good); }
.bar.bad i { background: var(--bad); }
.readout .part-card h4 { margin: 0 0 4px; font: 700 16px var(--display); color: var(--accent); }
.readout .part-card p { margin: 0; color: #cfd4df; }

/* missions */
.missions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.missions li {
  display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: start;
  padding: 9px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-size: 13px;
}
.missions li .box { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--line2); display: grid; place-items: center; font-size: 12px; margin-top: 1px; }
.missions li .xp-tag { font: 600 11px var(--mono); color: var(--accent); white-space: nowrap; margin-top: 2px; }
.missions li .kind { display: inline-block; font: 600 10px var(--mono); color: var(--cyan); border: 1px solid rgba(90,209,255,.35); border-radius: 5px; padding: 0 5px; margin-left: 4px; vertical-align: 1px; }
.missions li.done { border-color: rgba(74,222,128,.35); background: rgba(74,222,128,.05); }
.missions li.done .box { background: var(--good); border-color: var(--good); color: #062; }
.missions li.done .txt { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(140,148,168,.5); }
.missions li.pop { animation: pop .6s; }
@keyframes pop { 30% { transform: scale(1.03); background: rgba(74,222,128,.18); } }

/* terms */
.terms { display: grid; gap: 8px; }
.term { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; cursor: pointer; text-align: left; width: 100%; }
.term:hover { border-color: var(--line2); background: var(--panel2); }
.term b { color: var(--accent); font-size: 13.5px; }
.term p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }

.quizbox { display: flex; align-items: center; gap: 12px; }
.btn {
  border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 600;
  background: var(--accent); color: var(--accent-ink);
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line2); }
.quizbox small { color: var(--muted); }
.chapnav { display: flex; justify-content: space-between; margin-top: 26px; gap: 10px; }
.chapnav .btn { flex: 1; }

/* ---------- toasts ---------- */
.toasts { position: fixed; top: 66px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; pointer-events: none; }
.toast {
  background: #161b26; border: 1px solid var(--line2); border-left: 4px solid var(--accent);
  padding: 10px 14px; border-radius: 10px; max-width: 340px; font-size: 13px;
  box-shadow: 0 12px 30px rgba(0,0,0,.5); animation: tin .35s cubic-bezier(.2,.9,.3,1.2);
}
.toast.good { border-left-color: var(--good); }
.toast.good b { color: var(--good); }
.toast em { font-style: normal; font: 600 12px var(--mono); color: var(--accent); margin-left: 4px; }
.toast.out { animation: tout .3s forwards; }
@keyframes tin { from { transform: translateX(30px); opacity: 0; } }
@keyframes tout { to { transform: translateX(30px); opacity: 0; } }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(5, 6, 10, .72); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card {
  width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; padding: 24px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6); position: relative;
}
.modal-card.wide { width: min(860px, 100%); }
.modal-card h2 { font: 700 24px/1.2 var(--display); margin: 0 0 8px; letter-spacing: -.01em; }
.modal-card .x { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel2); }
.welcome .hero {
  height: 140px; border-radius: 12px; margin: -4px 0 16px;
  background:
    radial-gradient(circle at 50% 55%, #0b0d12 0 18%, transparent 19%),
    repeating-conic-gradient(from 10deg at 50% 55%, #2a2f3b 0 20deg, #1a1e27 20deg 40deg),
    #151922;
  position: relative; overflow: hidden;
}
.welcome .hero::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 55%, rgba(255,181,71,.35), transparent 45%); }
.welcome ol { padding-left: 20px; color: #cfd4df; }
.welcome li { margin-bottom: 6px; }
.quiz .qn { font: 600 11px var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.quiz .qq { font: 600 18px/1.35 var(--display); margin: 8px 0 14px; }
.quiz .opts { display: grid; gap: 8px; }
.quiz .opts button { text-align: left; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel2); }
.quiz .opts button:hover:not(:disabled) { border-color: var(--accent); }
.quiz .opts button.right { border-color: var(--good); background: rgba(74,222,128,.12); }
.quiz .opts button.wrong { border-color: var(--bad); background: rgba(255,107,107,.1); }
.quiz .why { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(90,209,255,.07); color: #cfd4df; font-size: 13px; }
.quiz .foot { display: flex; justify-content: flex-end; margin-top: 16px; }
.gloss-search { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg2); color: var(--text); font: inherit; margin: 6px 0 14px; }
.gloss-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.gloss-item { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.gloss-item b { color: var(--accent); }
.gloss-item p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.term-card .long { color: #cfd4df; }
.term-card .from { margin-top: 14px; }
.shot-view img { width: 100%; border-radius: 10px; display: block; }
.shot-view .exif { display: flex; flex-wrap: wrap; gap: 8px 16px; font: 600 13px var(--mono); margin-top: 12px; color: var(--accent); }

.confetti { position: fixed; top: -10px; width: 8px; height: 14px; z-index: 70; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translate3d(var(--dx), 105vh, 0) rotate(var(--r)); } }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 64px minmax(0, 1fr) 350px; }
  .chapters { padding: 10px 6px; }
  .chapters h4, .chap .t, .chap .p { display: none; }
  .chap { grid-template-columns: 1fr; justify-items: center; padding: 6px 0; }
  .brand-sub { display: none; }
}
@media (max-width: 820px) {
  body { overflow: auto; }
  .top { gap: 10px; padding: 0 12px; }
  .xpbar { width: 70px; }
  .brand-name, .brand-sub { display: none; }
  .lvl { display: none; }
  .layout { display: flex; flex-direction: column; height: auto; }
  .chapters { display: flex; gap: 6px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; }
  .chap { width: auto; flex: none; }
  .stage-wrap { height: 58vh; min-height: 360px; }
  .layout > .lcd { position: relative; left: auto; bottom: auto; width: auto; margin: 12px 16px 0; }
  .panel { border-left: 0; padding: 16px; overflow: visible; }
  .stage-title strong { font-size: 18px; }
  .toasts { top: auto; bottom: 16px; left: 16px; right: 16px; }
  .toast { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Glassbox reel mode: just the 3D stage, sized by the studio ---------- */
body.gb-reel { overflow: hidden; }
.gb-reel .top, .gb-reel .chapters, .gb-reel .panel, .gb-reel #lcd, .gb-reel .stage-title, .gb-reel .stage-hint,
.gb-reel .reset-view, .gb-reel .modal, .gb-reel .toasts, .gb-reel .labels { display: none !important; }
.gb-reel .layout { display: block; height: auto; }
.gb-reel .stage-wrap { position: fixed; left: 0; top: 0; }
.gb-reel .stage { position: relative; inset: auto; }

/* Way back to the Glassbox home page */
.home { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px 0 8px; margin-right: 2px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); text-decoration: none; font: 500 13px var(--sans, system-ui); transition: color .15s, border-color .15s, background .15s; }
.home:hover { color: var(--text); border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.05); }
@media (max-width: 560px) { .home span { display: none; } .home { padding: 0 8px; } }
.gb-reel .home { display: none !important; }
