:root {
  --bg: #070b16;
  --bg2: #0c1324;
  --panel: rgba(16, 22, 40, 0.78);
  --panel-solid: #111a30;
  --line: rgba(160, 190, 255, 0.12);
  --line2: rgba(160, 190, 255, 0.22);
  --text: #e9eefb;
  --muted: #93a1c2;
  --dim: #66739a;
  --mint: #5ef0d0;
  --cyan: #46c8ff;
  --violet: #8b7bff;
  --gold: #ffc83d;
  --rose: #ff6b8a;
  --ok: #4fe39a;
  --bad: #ff6b6b;
  --radius: 18px;
  --stage-top: 0px;
  --stage-bottom: 0px;
  --stage-right: 0px;
  --sheet-h: 46vh;
  --font: "Inter", "SF Pro Text", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "SF Pro Display", "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); overflow: hidden; }
body { font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select { font: inherit; color: inherit; }
a { color: var(--mint); }
sub, sup { font-size: 0.72em; line-height: 0; }

#bg { position: fixed; inset: 0; background:
  radial-gradient(1100px 700px at 15% -10%, rgba(70, 120, 255, 0.20), transparent 60%),
  radial-gradient(900px 700px at 110% 30%, rgba(139, 123, 255, 0.16), transparent 60%),
  radial-gradient(800px 600px at 40% 120%, rgba(94, 240, 208, 0.10), transparent 60%),
  linear-gradient(180deg, #070b16 0%, #0a1022 100%); }
#bg::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(170, 200, 255, 0.07) 1px, transparent 1px); background-size: 26px 26px; mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%); }

#stage { position: fixed; top: var(--stage-top); bottom: var(--stage-bottom); left: 0; right: var(--stage-right); transition: top .5s cubic-bezier(.2,.8,.2,1), bottom .5s cubic-bezier(.2,.8,.2,1), right .5s; z-index: 1; touch-action: none; }
.stage-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
body.mode-home #stage { pointer-events: none; opacity: 0.9; }
#app { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
#app > * { pointer-events: auto; }

/* 3D labels */
.label-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.label3d { position: absolute; left: 0; top: 0; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .35s; will-change: transform; }
.label3d.in { opacity: 1; }
.label3d.out { opacity: 0; }
.label3d > * { pointer-events: none; }
.label3d { --c: var(--mint); }
.label3d.tag, .label3d.tag-gold, .label3d.tag-rose, .label3d.tag-violet, .label3d.tag-cyan, .label3d.tag-white { margin: 0; }
.label3d .t, .label3d.chip { transform: translate(-50%, -50%); }
.label3d.chip, .label3d.tag, .label3d.tag-gold, .label3d.tag-rose, .label3d.tag-violet, .label3d.tag-cyan, .label3d.tag-white {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; letter-spacing: .01em;
  background: rgba(8, 12, 24, 0.78); border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); color: var(--c);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); translate: -50% -160%;
}
.label3d.tag-gold { --c: var(--gold); } .label3d.tag-rose { --c: var(--rose); } .label3d.tag-violet { --c: #b3a8ff; } .label3d.tag-cyan { --c: var(--cyan); } .label3d.tag-white { --c: #e8eefc; }
.label3d.center { translate: -50% -50%; }
.label3d.big { font-size: 15px; padding: 5px 12px; }
.label3d.num { translate: -50% -50%; width: 22px; height: 22px; padding: 0; display: grid; place-items: center; border-radius: 50%; font-size: 12px; font-weight: 700; background: var(--gold); color: #1a1200; border: 0; }
.label3d.num.mint { background: var(--mint); color: #04221c; }
.label3d.num.rose { background: var(--rose); color: #2a0610; }
.label3d.delta { translate: -50% -50%; font-weight: 800; font-size: 16px; text-shadow: 0 0 8px rgba(0,0,0,.9); }
.label3d.delta.neg { color: #ff6b6b; } .label3d.delta.pos { color: #6fa8ff; }
.label3d.skel { translate: -50% -50%; font-weight: 700; font-size: 17px; padding: 0 3px; background: rgba(7, 11, 22, 0.92); border-radius: 6px; color: #e9eefb; }
.label3d.skel.el-O { color: #ff6d74; } .label3d.skel.el-N { color: #7aa4ff; } .label3d.skel.el-Cl, .label3d.skel.el-F { color: #5ee88c; } .label3d.skel.el-Br { color: #e2725f; } .label3d.skel.el-I { color: #c08bff; } .label3d.skel.el-S { color: #f5cf3b; }
.label3d.el { translate: -50% -50%; font-weight: 700; font-size: 12px; color: #fff; text-shadow: 0 1px 3px #000, 0 0 2px #000; }
.label3d.caption { translate: -50% 0; font-size: 12px; color: #c3cde6; font-weight: 650; letter-spacing: .01em; background: rgba(8,12,24,.62); padding: 3px 9px; border-radius: 8px; }
.label3d.title3d { translate: -50% 0; font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--text); text-shadow: 0 2px 10px rgba(0,0,0,.6); }
.label3d.bigtext { translate: -50% -50%; font-family: var(--display); font-weight: 800; font-size: 28px; color: var(--text); text-shadow: 0 2px 16px rgba(0,0,0,.7); }
.label3d.eq { translate: -50% -50%; font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--text); background: rgba(8,12,24,.7); padding: 6px 14px; border-radius: 12px; border: 1px solid var(--line2); }

/* ---------- generic UI ---------- */
.glass { background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 999px; font-weight: 650; background: rgba(255,255,255,0.06); border: 1px solid var(--line2); transition: transform .15s, background .2s; white-space: nowrap; }
.btn:active { transform: scale(0.96); }
.btn.primary { background: linear-gradient(135deg, #5ef0d0, #46c8ff); color: #032227; border: 0; box-shadow: 0 8px 24px rgba(70, 200, 255, 0.25); }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.ghost { background: transparent; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,0.06); border: 1px solid var(--line); transition: transform .15s, background .2s; flex: none; }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.on { background: rgba(94, 240, 208, 0.16); border-color: rgba(94, 240, 208, 0.5); color: var(--mint); }
.icon-btn svg, .btn svg { width: 20px; height: 20px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: rgba(255,255,255,0.06); border: 1px solid var(--line); }
.honors { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; padding: 2px 7px; border-radius: 6px; background: rgba(255, 200, 61, 0.14); color: var(--gold); border: 1px solid rgba(255,200,61,0.35); vertical-align: middle; }
.muted { color: var(--muted); }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; scrollbar-width: none; }
.scroll::-webkit-scrollbar { display: none; }
#toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translate(-50%, 20px); z-index: 50; padding: 10px 16px; border-radius: 999px; background: rgba(14, 20, 38, 0.95); border: 1px solid var(--line2); font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: all .3s; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- top bar ---------- */
.topbar { position: absolute; left: 0; right: 0; top: 0; padding: calc(10px + var(--safe-t)) 12px 10px; display: flex; align-items: center; gap: 10px; z-index: 5; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.topbar .ttl { flex: 1; min-width: 0; pointer-events: none; }
.topbar .ttl .k { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.topbar .ttl .n { font-family: var(--display); font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- home ---------- */
.home { position: absolute; inset: 0; }
.home .scroller { position: absolute; inset: 0; padding: calc(18px + var(--safe-t)) 18px calc(40px + var(--safe-b)); }
.hero { min-height: 88vh; display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 18px; max-width: 980px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .02em; position: absolute; top: calc(16px + var(--safe-t)); left: 18px; right: 18px; max-width: 980px; margin: 0 auto; }
.brand .logo { width: 30px; height: 30px; }
.brand .sp { flex: 1; }
.hero h1 { font-family: var(--display); font-size: clamp(38px, 9vw, 68px); line-height: 1.0; margin: 0 0 12px; letter-spacing: -0.02em; font-weight: 800; }
.hero h1 .grad { background: linear-gradient(100deg, #5ef0d0 0%, #46c8ff 45%, #a493ff 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: #b8c4e0; font-size: 16.5px; max-width: 560px; margin: 0 0 18px; }
.hero .row { display: flex; gap: 10px; flex-wrap: wrap; }
.stats { display: flex; gap: 18px; margin-top: 16px; color: var(--muted); font-size: 13px; }
.stats b { color: var(--text); font-size: 18px; display: block; font-family: var(--display); }
.section-h { max-width: 980px; margin: 26px auto 12px; display: flex; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; }
.section-h h2 { font-family: var(--display); margin: 0; font-size: 21px; letter-spacing: -0.01em; }
.section-h span { color: var(--muted); font-size: 13px; }
.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; max-width: 980px; margin: 0 auto; }
.ucard { position: relative; border-radius: var(--radius); padding: 16px 16px 14px; overflow: hidden; text-align: left; min-height: 132px; display: flex; flex-direction: column; background: linear-gradient(160deg, rgba(255,255,255,0.06), rgba(255,255,255,0.015)); border: 1px solid var(--line); transition: transform .2s, border-color .2s; }
.ucard:active { transform: scale(0.98); }
.ucard::before { content: ""; position: absolute; inset: 0; background: radial-gradient(400px 160px at 100% 0%, color-mix(in srgb, var(--uc) 26%, transparent), transparent 70%); pointer-events: none; }
.ucard .num { font-family: var(--display); font-weight: 800; font-size: 13px; color: var(--uc); letter-spacing: .1em; }
.ucard h3 { margin: 4px 0 4px; font-family: var(--display); font-size: 19px; letter-spacing: -0.01em; position: relative; }
.ucard p { margin: 0; color: var(--muted); font-size: 13.5px; position: relative; flex: 1; }
.ucard .meta { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--muted); position: relative; }
.bar { flex: 1; height: 5px; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--uc, var(--mint)); border-radius: 4px; transition: width .6s; }
.ucard .glyph { position: absolute; right: 12px; top: 12px; width: 54px; height: 54px; opacity: .9; }
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-width: 980px; margin: 0 auto; }
.tcard { border-radius: 16px; padding: 14px; text-align: left; background: rgba(255,255,255,0.04); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; min-height: 104px; }
.tcard svg { width: 26px; height: 26px; color: var(--tc, var(--mint)); }
.tcard b { font-family: var(--display); font-size: 15.5px; }
.tcard span { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.footer { max-width: 980px; margin: 30px auto 0; color: var(--dim); font-size: 12px; text-align: center; }

/* ---------- unit page ---------- */
.unitpage { position: absolute; inset: 0; }
.unitpage .scroller { position: absolute; inset: 0; padding: calc(70px + var(--safe-t)) 16px calc(40px + var(--safe-b)); }
.unit-hero { max-width: 760px; margin: 0 auto 16px; }
.unit-hero .k { color: var(--uc); font-weight: 800; letter-spacing: .12em; font-size: 12px; }
.unit-hero h1 { font-family: var(--display); font-size: clamp(30px, 7vw, 44px); margin: 6px 0 8px; line-height: 1.05; letter-spacing: -0.02em; }
.unit-hero p { color: #b8c4e0; margin: 0 0 12px; }
.unit-media { max-width: 760px; margin: 0 auto 14px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #000; aspect-ratio: 16/9; }
.unit-media video, .unit-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lessons { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.lcard { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 16px; background: rgba(255,255,255,0.045); border: 1px solid var(--line); text-align: left; width: 100%; transition: transform .15s; }
.lcard:active { transform: scale(0.985); }
.lcard .idx { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-family: var(--display); background: color-mix(in srgb, var(--uc) 16%, transparent); color: var(--uc); flex: none; }
.lcard.done .idx { background: var(--uc); color: #071018; }
.lcard .body { flex: 1; min-width: 0; }
.lcard b { display: block; font-family: var(--display); font-size: 16px; }
.lcard span { color: var(--muted); font-size: 13px; display: block; }
.lcard .go { color: var(--muted); }
.objectives { max-width: 760px; margin: 18px auto 0; padding: 14px 16px; border-radius: 16px; border: 1px dashed var(--line2); color: var(--muted); font-size: 13.5px; }
.objectives b { color: var(--text); }
.objectives ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- lesson player ---------- */
body.mode-lesson { --stage-top: 0px; --stage-bottom: var(--sheet-h); }
.lesson .sheet { position: absolute; left: 0; right: 0; bottom: 0; height: var(--sheet-h); border-radius: 22px 22px 0 0; display: flex; flex-direction: column; transition: height .45s cubic-bezier(.2,.8,.2,1); border-bottom: 0; z-index: 4; }
.lesson .sheet .handle { width: 100%; padding: 8px 0 2px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.lesson .sheet .handle i { width: 42px; height: 5px; border-radius: 4px; background: rgba(255,255,255,0.2); }
.lesson .dots { display: flex; gap: 4px; padding: 6px 18px 0; }
.lesson .dots i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,0.1); position: relative; overflow: hidden; }
.lesson .dots i.done { background: color-mix(in srgb, var(--uc) 70%, transparent); }
.lesson .dots i.cur::after { content: ""; position: absolute; inset: 0; background: var(--uc); transform-origin: left; animation: fillbar var(--dur, 6s) linear forwards; }
.lesson .dots i.cur.paused::after { animation-play-state: paused; }
.lesson .dots i.cur.static::after { animation: none; }
@keyframes fillbar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.lesson .content { flex: 1; padding: 10px 20px 8px; }
.lesson .content .stepk { font-size: 11.5px; font-weight: 800; letter-spacing: .12em; color: var(--uc); text-transform: uppercase; }
.lesson .content h2 { font-family: var(--display); margin: 3px 0 6px; font-size: 21px; line-height: 1.2; letter-spacing: -0.01em; }
.lesson .content .say { color: #cdd6ec; font-size: 15.5px; line-height: 1.55; }
.lesson .content .say b { color: #fff; }
.lesson .content .say .hl { color: var(--mint); font-weight: 650; }
.lesson .content .say .gold { color: var(--gold); font-weight: 650; }
.lesson .content .say .rose { color: var(--rose); font-weight: 650; }
.lesson .content .say .vio { color: #b3a8ff; font-weight: 650; }
.lesson .content .say .cy { color: var(--cyan); font-weight: 650; }
.trybox { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(94, 240, 208, 0.07); border: 1px solid rgba(94, 240, 208, 0.25); font-size: 13.5px; color: #bff6ea; display: flex; gap: 8px; align-items: flex-start; }
.trybox svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.keybox { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 200, 61, 0.07); border: 1px solid rgba(255, 200, 61, 0.25); font-size: 13.5px; color: #ffe7a6; }
.lesson .controls { display: flex; align-items: center; gap: 10px; padding: 8px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); }
.lesson .controls .sp { flex: 1; }
.lesson .controls .play { width: 52px; height: 52px; background: linear-gradient(135deg, #5ef0d0, #46c8ff); color: #032227; border: 0; box-shadow: 0 6px 20px rgba(70, 200, 255, 0.3); }
.lesson .controls .play svg { width: 24px; height: 24px; }
.lesson .controls .count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 44px; text-align: center; }
.stage-tools { position: absolute; right: 10px; top: calc(64px + var(--safe-t)); display: flex; flex-direction: column; gap: 8px; z-index: 4; }
.stage-tools .icon-btn { width: 38px; height: 38px; background: rgba(10, 15, 30, 0.6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.stage-tools .icon-btn svg { width: 18px; height: 18px; }
.hint-pill svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.hint-pill { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--sheet-h) + 12px); z-index: 4; font-size: 12.5px; color: var(--muted); padding: 6px 12px; border-radius: 999px; background: rgba(10, 15, 30, 0.6); border: 1px solid var(--line); pointer-events: none; transition: opacity .4s, bottom .45s; white-space: nowrap; }

/* tool panels inside sheet */
.toolpanel { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-row label { font-size: 12.5px; color: var(--muted); min-width: 70px; }
.slider-row output { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 52px; text-align: right; color: var(--mint); }
input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; height: 30px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 4px; background: linear-gradient(90deg, rgba(94,240,208,.5), rgba(139,123,255,.5)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: #fff; margin-top: -9px; box-shadow: 0 2px 10px rgba(0,0,0,.4); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 4px; background: linear-gradient(90deg, rgba(94,240,208,.5), rgba(139,123,255,.5)); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 0; }
.twin { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.panelcard { border-radius: 14px; background: rgba(0,0,0,0.25); border: 1px solid var(--line); padding: 8px; }
.panelcard .cap { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin: 0 0 4px 4px; }
.panelcard svg { display: block; width: 100%; height: auto; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(255,255,255,0.06); border: 1px solid var(--line); gap: 2px; flex-wrap: wrap; }
.seg button { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 650; color: var(--muted); }
.seg button.on { background: rgba(255,255,255,0.12); color: var(--text); }

/* quiz */
.quiz { display: flex; flex-direction: column; gap: 10px; }
.quiz .q { font-family: var(--display); font-size: 18px; font-weight: 650; line-height: 1.35; }
.quiz .opts { display: flex; flex-direction: column; gap: 8px; }
.quiz .opt { text-align: left; padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,0.05); border: 1px solid var(--line); font-size: 15px; transition: background .2s, border-color .2s, transform .15s; }
.quiz .opt:active { transform: scale(0.985); }
.quiz .opt.right { background: rgba(79, 227, 154, 0.14); border-color: rgba(79, 227, 154, 0.6); }
.quiz .opt.wrong { background: rgba(255, 107, 107, 0.12); border-color: rgba(255, 107, 107, 0.55); }
.quiz .why { font-size: 14px; color: #cdd6ec; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,0.04); }
.score { text-align: center; padding: 10px 0; }
.score .big { font-family: var(--display); font-size: 48px; font-weight: 800; background: linear-gradient(100deg, #5ef0d0, #46c8ff); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- explorer & builder (side/bottom panel) ---------- */
body.mode-panel { --stage-top: 0px; --stage-bottom: var(--sheet-h); }
.panel-sheet { position: absolute; left: 0; right: 0; bottom: 0; height: var(--sheet-h); border-radius: 22px 22px 0 0; display: flex; flex-direction: column; z-index: 4; transition: height .45s cubic-bezier(.2,.8,.2,1); }
.panel-sheet .inner { flex: 1; padding: 6px 16px calc(14px + var(--safe-b)); }
.searchbar { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 14px; background: rgba(255,255,255,0.06); border: 1px solid var(--line); }
.searchbar input { flex: 1; background: transparent; border: 0; outline: none; font-size: 15px; }
.searchbar svg { width: 18px; height: 18px; color: var(--muted); }
.catrow { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 4px; scrollbar-width: none; }
.catrow::-webkit-scrollbar { display: none; }
.catrow .chip { flex: none; }
.catrow .chip.on { background: rgba(94, 240, 208, 0.16); color: var(--mint); border-color: rgba(94,240,208,.45); }
.mlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 8px; }
.mitem { text-align: left; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,0.04); border: 1px solid var(--line); }
.mitem.on { border-color: rgba(94,240,208,.6); background: rgba(94,240,208,.08); }
.mitem b { display: block; font-size: 13.5px; line-height: 1.25; }
.mitem span { font-size: 12px; color: var(--muted); }
.infocard h2 { font-family: var(--display); margin: 2px 0 2px; font-size: 22px; line-height: 1.15; }
.infocard .formula { font-family: var(--display); font-size: 16px; color: var(--mint); font-weight: 650; }
.infocard .kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13.5px; margin-top: 8px; }
.infocard .kv span:nth-child(odd) { color: var(--muted); }
.infocard .note { margin-top: 10px; color: #cdd6ec; font-size: 14px; }
.groups { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.groups .chip { border-color: color-mix(in srgb, var(--gc) 55%, transparent); color: var(--gc); }
.toolrow { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.atominfo { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,0.05); border: 1px solid var(--line); font-size: 13.5px; }
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; margin-top: 10px; }
.pal { padding: 10px 4px; border-radius: 14px; background: rgba(255,255,255,0.05); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 700; }
.pal .dot { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset -3px -4px 6px rgba(0,0,0,.35), inset 2px 2px 4px rgba(255,255,255,.35); }
.pal small { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.pal:disabled { opacity: .35; }
.namebox { padding: 12px 14px; border-radius: 16px; background: linear-gradient(135deg, rgba(94,240,208,0.10), rgba(139,123,255,0.10)); border: 1px solid rgba(94,240,208,0.3); }
.namebox .nm { font-family: var(--display); font-size: 21px; font-weight: 750; line-height: 1.2; word-break: break-word; }
.namebox .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.challenge { margin-top: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 200, 61, 0.08); border: 1px solid rgba(255, 200, 61, 0.3); font-size: 14px; display: flex; gap: 10px; align-items: center; }
.challenge b { color: var(--gold); }

/* labs index */
.labgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; max-width: 980px; margin: 0 auto; }

/* desktop layout: panels on the right */
@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .hero { min-height: 70vh; }
  :root { --sheet-w: 420px; }
  body.mode-lesson, body.mode-panel { --stage-bottom: 0px; --stage-right: var(--sheet-w); }
  .lesson .sheet, .panel-sheet { left: auto; top: 0; width: var(--sheet-w); height: 100% !important; border-radius: 0; border-right: 0; border-top: 0; }
  .lesson .sheet .handle { display: none; }
  .lesson .content { padding-top: calc(70px + var(--safe-t)); }
  .panel-sheet .inner { padding-top: calc(70px + var(--safe-t)); }
  .hint-pill { bottom: 18px; left: calc(50% - var(--sheet-w) / 2); }
  .stage-tools { right: calc(var(--sheet-w) + 12px); }
  .topbar { right: var(--sheet-w); }
  .lesson .content h2 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.fade-enter { animation: fadein .45s cubic-bezier(.2,.8,.2,1); }
@keyframes fadein { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.loader { position: fixed; inset: 0; display: grid; place-items: center; z-index: 60; background: var(--bg); transition: opacity .6s; }
.loader.hide { opacity: 0; pointer-events: none; }
.loader .ring { width: 54px; height: 54px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.08); border-top-color: var(--mint); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.err { position: fixed; inset: 0; display: grid; place-items: center; padding: 30px; text-align: center; color: var(--muted); z-index: 70; background: var(--bg); }
.challenge svg { width: 22px; height: 22px; flex: none; color: var(--gold); }
.namebox .groups { margin-top: 6px; }
@media (max-width: 600px) { .hint-pill { white-space: normal; text-align: center; width: max-content; max-width: 86vw; } }
