/* ==========================================================
   PsixoLab 3D: calm teaching interface
   One accent colour, a dark 3D area and a lighter function area
   ========================================================== */

@font-face { font-family: "Nunito Variable"; font-style: normal; font-display: swap; font-weight: 200 1000;
  src: url(../fonts/nunito-cyrillic-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Nunito Variable"; font-style: normal; font-display: swap; font-weight: 200 1000;
  src: url(../fonts/nunito-cyrillic-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Nunito Variable"; font-style: normal; font-display: swap; font-weight: 200 1000;
  src: url(../fonts/nunito-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Nunito Variable"; font-style: normal; font-display: swap; font-weight: 200 1000;
  src: url(../fonts/nunito-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- Tokens ---------- */
:root {
  --font: "Nunito Variable", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --topbar-h: 52px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --good: #3ecf8e;
  --bad: #ef6b6b;
  --warn: #e8b04a;
}
:root, :root[data-theme="night"] {
  color-scheme: dark;
  --bg: #0d1119;
  --bg-2: #121826;
  --stage: #05070c;            /* 3D area */
  --panel: #182031;            /* function area */
  --panel-2: #1f2940;
  --line: #2b3650;
  --text: #e9eef7;
  --muted: #9aa8c0;
  --accent: #5b9dff;
  --accent-ink: #06142b;
  --accent-soft: rgba(91, 157, 255, .16);
  --track: #2d3a55;
  --btn: #2a3550;
  --btn-edge: #161d2f;
  --shadow: 0 18px 40px -20px rgba(0, 0, 0, .8);
  --label-bg: rgba(8, 11, 19, .82);
  --label-text: #e9eef7;
}
:root[data-theme="day"] {
  color-scheme: light;
  --bg: #e9edf4;
  --bg-2: #f3f5f9;
  --stage: #cfd8e6;
  --panel: #ffffff;
  --panel-2: #f1f4f9;
  --line: #d3dae6;
  --text: #17202f;
  --muted: #5a6880;
  --accent: #2f6fe0;
  --accent-ink: #ffffff;
  --accent-soft: rgba(47, 111, 224, .12);
  --track: #d5dceb;
  --btn: #e6ebf4;
  --btn-edge: #b9c4d8;
  --shadow: 0 18px 40px -22px rgba(30, 50, 90, .35);
  --label-bg: rgba(255, 255, 255, .92);
  --label-text: #17202f;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body { margin: 0; height: 100%; font-family: var(--font); font-weight: 600; color: var(--text); background: var(--bg); overflow-x: hidden; -webkit-tap-highlight-color: transparent; transition: background-color .3s, color .3s; }
body.locked { overflow: hidden; }
h1, h2, h3, h4, p { margin: 0; }
button, select, input { font: inherit; color: inherit; }
svg.i { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#app { height: 100%; display: flex; flex-direction: column; min-height: 0; }

/* ---------- Buttons: 3D with light gradients ---------- */
.btn3d {
  --g1: #eaf1ff; --g2: #bccbe8; --edge: #7d92b9; --ink: #15233d;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 42px; padding: .55rem 1rem; border: 0; border-radius: 13px; cursor: pointer;
  font-weight: 800; line-height: 1.1; color: var(--ink);
  background: linear-gradient(180deg, var(--g1), var(--g2));
  box-shadow: 0 4px 0 var(--edge), 0 9px 14px -8px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .85), inset 0 -2px 0 rgba(0, 0, 0, .06);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .45);
  transition: transform .09s, box-shadow .09s, filter .2s; user-select: none; -webkit-user-select: none; touch-action: manipulation; overflow: hidden;
}
.btn3d:hover { filter: brightness(1.05) saturate(1.05); transform: translateY(-1px); box-shadow: 0 5px 0 var(--edge), 0 12px 16px -8px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .85), inset 0 -2px 0 rgba(0, 0, 0, .06); }
.btn3d:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge), 0 3px 6px -3px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .6); }
.btn3d[disabled] { opacity: .5; cursor: not-allowed; transform: translateY(3px); box-shadow: 0 1px 0 var(--edge); filter: grayscale(.4); }
/* colour families: all soft and light */
.btn3d.pink, .btn3d.cyan, .btn3d.primary { --g1: #b8dcff; --g2: #7fb0ff; --edge: #4477d4; --ink: #0c1f42; }
.btn3d.lime { --g1: #c6f6de; --g2: #6fdaa9; --edge: #2f9d74; --ink: #073322; }
.btn3d.red { --g1: #ffd0d0; --g2: #ff9a9a; --edge: #c96262; --ink: #3a0d0d; }
.btn3d.amber { --g1: #ffeec6; --g2: #f8c66f; --edge: #c58f33; --ink: #3a2705; }
.btn3d.violet { --g1: #e3dbff; --g2: #b3a2ff; --edge: #7562d0; --ink: #1d1447; }
.btn3d.neutral { --g1: #eef3fd; --g2: #c5d2ec; --edge: #8497bd; }
/* pressed / selected toggle: sinks and turns blue */
.btn3d.neutral[aria-pressed="true"], .btn3d.amber[aria-pressed="true"], .btn3d.on { --g1: #b8dcff; --g2: #7fb0ff; --edge: #4477d4; --ink: #0c1f42; transform: translateY(3px); box-shadow: 0 1px 0 var(--edge), inset 0 2px 4px rgba(0, 40, 120, .25); }
.btn3d.small { min-height: 36px; padding: .4rem .8rem; font-size: .9rem; border-radius: 11px; box-shadow: 0 3px 0 var(--edge), 0 7px 12px -8px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .85); }
.btn3d.small:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.btn3d.icon { width: 40px; min-width: 40px; height: 40px; padding: 0; border-radius: 12px; }
.btn3d.big { min-height: 62px; padding: .9rem 2.1rem; font-size: 1.15rem; border-radius: 18px; box-shadow: 0 6px 0 var(--edge), 0 16px 22px -10px rgba(60, 120, 255, .7), inset 0 1px 0 rgba(255, 255, 255, .9), inset 0 -3px 0 rgba(0, 0, 0, .06); }
.btn3d.big:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--edge), 0 6px 10px -6px rgba(60, 120, 255, .6); }
.btn3d.block { width: 100%; }
.btn3d .ripple { position: absolute; border-radius: 50%; transform: scale(0); background: rgba(255, 255, 255, .55); animation: ripple .5s ease-out forwards; pointer-events: none; }
@keyframes ripple { to { transform: scale(3); opacity: 0; } }
/* answers in the quiz keep clear right / wrong colours */
.opt.right { --g1: #c6f6de; --g2: #6fdaa9; --edge: #2f9d74; --ink: #073322; }
.opt.wrong { --g1: #ffd0d0; --g2: #ff9a9a; --edge: #c96262; --ink: #3a0d0d; }
.opt .k { background: rgba(0, 0, 0, .1); }

/* ---------- Top bar ---------- */
.topbar { flex: none; height: var(--topbar-h); padding: 0 clamp(10px, 2vw, 22px); display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--bg-2); border-bottom: 1px solid var(--line); position: relative; z-index: 30; }
.tb-left, .tb-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 9px; background: none; border: 0; padding: 4px 6px; cursor: pointer; font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; border-radius: 10px; }
.brand img { width: 28px; height: 28px; }
.page-title { font-weight: 800; font-size: .98rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 10px; border-left: 1px solid var(--line); margin-left: 4px; }
.tb-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-weight: 700; cursor: pointer; }
.tb-btn:hover { border-color: var(--accent); }
.tb-btn.iconly { width: 38px; padding: 0; justify-content: center; }

/* popover menu */
.pop-wrap { position: relative; }
.popover { position: absolute; right: 0; top: calc(100% + 8px); width: min(320px, calc(100vw - 20px)); padding: 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); display: none; flex-direction: column; gap: 12px; z-index: 60; }
.popover.open { display: flex; }
.pop-sec { display: flex; flex-direction: column; gap: 8px; }
.pop-sec h5 { margin: 0; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg .btn3d { min-height: 36px; padding: .3rem .5rem; font-size: .88rem; }
.viewgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.viewgrid .btn3d { flex-direction: column; gap: 3px; min-height: 56px; font-size: .74rem; padding: .35rem .2rem; text-align: center; line-height: 1.15; }

/* ---------- Landing ---------- */
.landing { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center; gap: 20px; padding: clamp(14px, 4vw, 56px); max-width: 1240px; width: 100%; margin: 0 auto; }
.landing-text { display: flex; flex-direction: column; gap: 20px; align-items: flex-start; }
.landing h1 { font-size: clamp(1.9rem, 4.4vw, 3.1rem); line-height: 1.08; font-weight: 800; letter-spacing: -.02em; }
.landing p.sub { color: var(--muted); font-size: clamp(1rem, 1.9vw, 1.15rem); line-height: 1.55; max-width: 32em; }
.landing-stage { position: relative; height: min(64vh, 520px); border-radius: 20px; overflow: hidden; background: var(--stage); border: 1px solid var(--line); }
.landing-author { color: var(--muted); font-size: .85rem; }
.landing-author b { color: var(--text); }

/* ---------- Topics sidebar ---------- */
.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(2, 4, 10, .55); opacity: 0; pointer-events: none; transition: opacity .25s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.sidebar { position: fixed; z-index: 80; top: 0; bottom: 0; left: 0; width: min(420px, 92vw); display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line); box-shadow: var(--shadow); transform: translateX(-102%); visibility: hidden; transition: transform .3s var(--ease), visibility 0s linear .3s; }
.sidebar.open { transform: none; visibility: visible; transition: transform .3s var(--ease), visibility 0s; }
.sb-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 16px 8px; }
.sb-head h2 { font-size: 1.15rem; font-weight: 800; }
.searchbox { margin: 6px 16px 10px; position: relative; }
.searchbox input { width: 100%; height: 46px; padding: 0 14px 0 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); outline: none; font-weight: 600; }
.searchbox input:focus { border-color: var(--accent); }
.searchbox svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.sb-list { flex: 1; overflow-y: auto; padding: 4px 10px 20px; display: flex; flex-direction: column; gap: 6px; }
.sb-cat { margin: 12px 8px 2px; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.topic { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px; border-radius: 12px; border: 1px solid transparent; background: transparent; cursor: pointer; }
.topic:hover, .topic:focus-visible { background: var(--panel-2); border-color: var(--line); }
.topic .ti { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; flex: none; }
.topic .tt { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.topic .tt b { font-size: 1rem; font-weight: 800; }
.topic .tt small { color: var(--muted); font-size: .82rem; line-height: 1.3; font-weight: 600; }
.topic .badge { font-size: .7rem; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); font-weight: 700; flex: none; }
.topic mark { background: var(--accent-soft); color: var(--text); border-radius: 3px; padding: 0 1px; }
.sb-empty { padding: 24px 12px; color: var(--muted); text-align: center; }

/* ---------- Module: 3D area on top, functions below ---------- */
.module { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 10px clamp(8px, 1.6vw, 18px) 12px; }
.stage-wrap { position: relative; flex: 1 1 0; min-height: 220px; border-radius: 16px; overflow: hidden; background: var(--stage); border: 1px solid var(--line); }
.stage-host { position: absolute; inset: 0; touch-action: none; }
.stage-host canvas { display: block; width: 100%; height: 100%; outline: none; touch-action: none; cursor: grab; }
.stage-host canvas:active { cursor: grabbing; }
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.lbl { position: absolute; left: 0; top: 0; will-change: transform; white-space: nowrap; pointer-events: none; display: flex; align-items: center; gap: 6px; padding: 3px 9px 3px 6px; border-radius: 8px; font-weight: 700; font-size: .76rem; color: var(--label-text); background: var(--label-bg); border: 1px solid color-mix(in srgb, var(--lc, #fff) 60%, transparent); transition: opacity .2s; }
.lbl i { width: 16px; height: 16px; border-radius: 50%; background: var(--lc, #fff); display: grid; place-items: center; font-style: normal; font-size: .64rem; color: #0a0f1a; font-weight: 800; flex: none; }
.lbl span:empty { display: none; }
.lbl:has(span:empty) { padding: 3px; }
.lbl.dim { opacity: .6; }
.lbl.active { border-color: var(--lc, #fff); }
.lbl.hidden { display: none; }
.stage-hud { position: absolute; left: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; max-width: calc(100% - 70px); }
.hud-chip { display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 10px; background: var(--label-bg); border: 1px solid var(--line); font-weight: 700; width: fit-content; max-width: 100%; color: var(--label-text); }
.hud-chip .big { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.hud-chip small { color: var(--muted); font-weight: 700; font-size: .74rem; }
.wide-btn { position: absolute; right: 10px; top: 10px; z-index: 5; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--label-bg); color: var(--label-text); display: grid; place-items: center; cursor: pointer; opacity: .8; transition: opacity .2s, border-color .2s; }
.wide-btn:hover { opacity: 1; border-color: var(--accent); }
.loader { position: absolute; inset: 0; display: grid; place-items: center; z-index: 4; background: var(--stage); transition: opacity .4s; }
.loader.done { opacity: 0; pointer-events: none; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--track); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.nogl { padding: 24px; text-align: center; max-width: 420px; line-height: 1.5; }

/* wide (theatre / full screen) mode */
body.wide .topbar { display: none; }
body.wide .module { padding: 0; gap: 0; }
body.wide .stage-wrap { border-radius: 0; border: 0; }
body.wide .panel { display: none; }
body.wide .wide-btn { opacity: .35; }
body.wide .wide-btn:hover, body.wide .wide-btn.show { opacity: 1; }

/* function area */
.panel { flex: none; height: clamp(290px, 42%, 440px); display: flex; flex-direction: column; min-height: 0; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.panel-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.mode-select { appearance: none; -webkit-appearance: none; height: 38px; padding: 0 34px 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239aa8c0' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center; font-weight: 800; cursor: pointer; min-width: 150px; }
.mode-select:focus { outline: none; border-color: var(--accent); }
.panel-status { flex: 1; color: var(--muted); font-size: .86rem; font-weight: 700; text-align: right; line-height: 1.25; max-height: 2.5em; overflow: hidden; min-width: 0; }
.panel-status.good { color: var(--good); }
.panel-status.bad { color: var(--bad); }
.tab-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 12px; display: none; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.tab-body.active { display: flex; }
.tab-body.lab-sections { overflow: hidden; gap: 8px; padding: 8px 10px 10px; }
.subnav { display: flex; gap: 6px; flex: none; overflow-x: auto; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav .btn3d { min-height: 34px; padding: .3rem .85rem; font-size: .86rem; border-radius: 9px; flex: none; }
.panes { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 2px 2px 6px; overscroll-behavior: contain; }
.pane { display: none; gap: 10px; align-items: start; }
.pane.active { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.pane > .row-btns, .pane > .legend, .pane > .status { grid-column: 1 / -1; }
.lab-foot { flex: none; display: flex; flex-direction: column; gap: 6px; }
.lab-foot .status { font-size: .9rem; padding: 8px 12px; }
.tab-body::-webkit-scrollbar, .panes::-webkit-scrollbar, .sb-list::-webkit-scrollbar { width: 8px; }
.tab-body::-webkit-scrollbar-thumb, .panes::-webkit-scrollbar-thumb, .sb-list::-webkit-scrollbar-thumb { background: var(--track); border-radius: 8px; }

.group { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.group h4 { margin: 0; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; }
.desc { color: var(--muted); line-height: 1.5; font-size: .93rem; }
.desc b, .desc strong { color: var(--text); }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.row-btns .btn3d { flex: 1 1 auto; }
.mod-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mod-buttons .btn3d { flex-direction: column; gap: 3px; min-height: 52px; font-size: .86rem; padding: .4rem .3rem; }
.mod-buttons .btn3d .em { display: none; }

/* sliders */
.field { display: flex; flex-direction: column; gap: 6px; }
.field .lab { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-weight: 800; font-size: .92rem; }
.field .lab output { color: var(--accent); font-variant-numeric: tabular-nums; }
input[type="range"] { --p: 50%; -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; margin: 0; cursor: pointer; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--accent) var(--p), var(--track) var(--p)); }
input[type="range"]::-moz-range-track { height: 8px; border-radius: 999px; background: var(--track); }
input[type="range"]::-moz-range-progress { height: 8px; border-radius: 999px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -7px; border-radius: 50%; border: 0; background: #fff; box-shadow: 0 2px 0 rgba(0, 0, 0, .35), 0 0 0 3px var(--accent-soft); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; border: 0; background: #fff; box-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.ticks { display: flex; justify-content: space-between; font-size: .75rem; font-weight: 700; color: var(--muted); gap: 4px; }
.ticks span { flex: 1; text-align: center; } .ticks span:first-child { text-align: left; } .ticks span:last-child { text-align: right; }
.ticks span.on { color: var(--accent); }

/* meters */
.meter { height: 10px; border-radius: 999px; background: var(--track); overflow: hidden; position: relative; }
.meter > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 999px; background: var(--accent); transition: width .25s; }
.gauge { position: relative; height: 12px; border-radius: 999px; background: var(--track); margin-top: 22px; }
.gauge .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--bad); transition: background .3s; }
.gauge.ok .fill { background: var(--good); }
.gauge .th { position: absolute; top: -5px; bottom: -5px; width: 3px; margin-left: -1px; border-radius: 2px; background: var(--text); }
.gauge .th::after { content: attr(data-l); position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: .68rem; font-weight: 800; color: var(--muted); white-space: nowrap; }
.status { padding: 10px 12px; border-radius: 10px; font-weight: 700; line-height: 1.4; background: var(--panel-2); border: 1px solid var(--line); border-left-width: 4px; }
.status.good { border-left-color: var(--good); }
.status.bad { border-left-color: var(--bad); }
.status.info { border-left-color: var(--accent); }

.stage-chips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.schip { display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; padding: 8px 2px 7px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 700; font-size: .7rem; line-height: 1.15; min-width: 0; overflow-wrap: anywhere; }
.schip .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--track); font-weight: 800; font-size: .78rem; }
.schip.done .n { background: var(--good); color: #062a1a; }
.schip.active { border-color: var(--accent); background: var(--accent-soft); }
.schip.active .n { background: var(--accent); color: var(--accent-ink); }

canvas.chart { width: 100%; display: block; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); touch-action: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .78rem; font-weight: 700; color: var(--muted); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.stage-badge { display: inline-flex; align-items: center; padding: 5px 11px; border-radius: 8px; font-weight: 800; font-size: .86rem; color: #0a0f1a; background: var(--sc, var(--accent)); width: fit-content; }
.kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.kv > div { padding: 8px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.kv small { display: block; color: var(--muted); font-weight: 800; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.kv b { font-size: .98rem; font-weight: 800; }

/* attention: stimulus picker and brain region list */
.stimgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; }
.stim { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; text-align: left; }
.stim b { font-size: .88rem; font-weight: 800; }
.stim small { color: var(--muted); font-size: .72rem; font-weight: 700; }
.stim:hover { border-color: var(--accent); }
.stim.on { border-color: var(--accent); background: var(--accent-soft); }
.stim.on2 { border-color: var(--warn); }
.reglist { display: flex; flex-direction: column; gap: 6px; }
.reg { display: grid; grid-template-columns: 12px 1fr auto; gap: 4px 10px; align-items: center; }
.reg i { width: 12px; height: 12px; border-radius: 3px; background: var(--rc); }
.reg b { font-size: .86rem; font-weight: 800; }
.reg small { grid-column: 2 / 4; color: var(--muted); font-size: .76rem; line-height: 1.3; }
.reg .bar { width: 70px; height: 6px; border-radius: 99px; background: var(--track); overflow: hidden; }
.reg .bar em { display: block; height: 100%; width: 0; background: var(--rc); transition: width .25s; }

/* lesson */
.lesson-card { padding: 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--accent); display: flex; flex-direction: column; gap: 8px; }
.lesson-card .step-no { font-weight: 800; font-size: .74rem; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }
.lesson-card h3 { font-size: 1.15rem; font-weight: 800; line-height: 1.25; }
.lesson-card p { line-height: 1.6; }
.dots { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.dot { width: 11px; height: 11px; border-radius: 50%; border: 0; padding: 0; background: var(--track); cursor: pointer; }
.dot.done { background: var(--muted); } .dot.on { background: var(--accent); transform: scale(1.3); }
.lesson-nav { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }

/* quiz */
.qprog { height: 6px; border-radius: 99px; background: var(--track); overflow: hidden; }
.qprog i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .3s; }
.qmeta { display: flex; justify-content: space-between; font-weight: 800; color: var(--muted); font-size: .86rem; }
.qtext { font-size: 1.12rem; font-weight: 800; line-height: 1.35; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { text-align: left; justify-content: flex-start; font-weight: 700; }
.opt .k { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-weight: 800; flex: none; font-size: .82rem; }
.opt.locked { pointer-events: none; }
.opt.locked:not(.right):not(.wrong) { opacity: .5; }
.explain { line-height: 1.5; }
.result { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 6px 0; }
.result .num { font-size: 3rem; font-weight: 800; color: var(--accent); line-height: 1; }
.result .btns { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.intro-card { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }

/* focus notice */
.toast { position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 20px); opacity: 0; z-index: 90; max-width: min(520px, calc(100vw - 24px)); padding: 12px 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); line-height: 1.45; transition: opacity .3s, transform .3s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 899px) {
  .landing { grid-template-columns: 1fr; align-content: center; }
  .landing-stage { order: -1; height: 30vh; min-height: 200px; }
  .panel { height: clamp(260px, 50%, 470px); }
  .pane.active { grid-template-columns: 1fr; }
  .page-title { display: none; }
  .tb-btn span { display: none; }
  .tb-btn { width: 38px; padding: 0; justify-content: center; }
}
@media (max-width: 520px) {
  .brand span { display: none; }
  .schip { font-size: .62rem; }
  .btn3d.big { width: 100%; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .module { flex-direction: row; }
  .panel { height: auto; width: min(46%, 420px); }
  .pane.active { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* memory: working-memory slots */
.slots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.slot { height: 46px; border-radius: 10px; border: 1px dashed var(--line); display: grid; place-items: center; font-weight: 800; font-size: 1.02rem; background: var(--panel); transition: background .2s, border-color .2s; }
.slot.full { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.tb-btn { box-shadow: 0 2px 0 var(--line); }

/* =========================================================
   v3: keycap buttons, coloured options, lively 3D background
   ========================================================= */
:root, :root[data-theme="night"] { --key1: #27324d; --key2: #1a2237; --key-edge: #0a0f1a; --key-hi: rgba(255,255,255,.09); }
:root[data-theme="day"] { --key1: #ffffff; --key2: #e7ecf5; --key-edge: #b6c1d6; --key-hi: rgba(255,255,255,.9); }

/* neutral buttons become keyboard keys */
.btn3d.neutral, .subnav .btn3d, .modekey {
  --g1: var(--key1); --g2: var(--key2); --edge: var(--key-edge); --ink: var(--text);
  border: 1px solid var(--line); text-shadow: none;
  box-shadow: 0 4px 0 var(--key-edge), 0 8px 14px -8px rgba(0,0,0,.6), inset 0 1px 0 var(--key-hi);
}
.btn3d.neutral:hover, .subnav .btn3d:hover { border-color: color-mix(in srgb, var(--kc, var(--accent)) 60%, var(--line)); }
.btn3d.neutral[aria-pressed="true"], .subnav .btn3d[aria-pressed="true"] {
  --g1: color-mix(in srgb, var(--kc, var(--accent)) 30%, var(--key1)); --g2: color-mix(in srgb, var(--kc, var(--accent)) 18%, var(--key2)); --ink: var(--text);
  border-color: var(--kc, var(--accent)); transform: translateY(3px);
  box-shadow: 0 1px 0 var(--key-edge), 0 0 0 1px var(--kc, var(--accent)), 0 0 18px -4px var(--kc, var(--accent)), inset 0 1px 0 var(--key-hi);
}
.subnav { gap: 8px; padding: 2px 2px 6px; }
.subnav .btn3d { min-height: 38px; padding: .35rem 1rem; }

/* option keys with a coloured icon (sensation, memory, fear) */
.opt-key { flex-direction: row; gap: .55em; }
.opt-key .glyph { font-size: 1.25rem; line-height: 1; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--kc) 60%, transparent)); }
.opt-key::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 5px; height: 3px; border-radius: 3px; background: var(--kc); opacity: .55; }
.mod-buttons .btn3d .em { display: block; font-size: 1.35rem; line-height: 1; }
.mod-buttons .btn3d { --kc: var(--kc); }

/* attention stimuli as keys */
.stimgrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.stim { position: relative; flex-direction: row; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px;
  background: linear-gradient(180deg, var(--key1), var(--key2)); border: 1px solid var(--line);
  box-shadow: 0 4px 0 var(--key-edge), inset 0 1px 0 var(--key-hi); transition: transform .08s, box-shadow .08s, border-color .2s; }
.stim .glyph { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; font-size: 1.3rem;
  background: color-mix(in srgb, var(--kc) 22%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--kc) 55%, transparent); }
.stim .st { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stim:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--key-edge); }
.stim:hover { border-color: var(--kc); }
.stim.on, .stim.on2 { border-color: var(--kc); transform: translateY(3px); background: linear-gradient(180deg, color-mix(in srgb, var(--kc) 22%, var(--key1)), color-mix(in srgb, var(--kc) 10%, var(--key2)));
  box-shadow: 0 1px 0 var(--key-edge), 0 0 0 1px var(--kc), 0 0 18px -4px var(--kc); }

/* panel head: main play button + three mode keys */
.panel-head { gap: 10px; flex-wrap: wrap; padding: 10px; }
.modebar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; flex: 1 1 320px; }
.modekey { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 12px; cursor: pointer;
  font-weight: 800; color: var(--text); background: linear-gradient(180deg, var(--key1), var(--key2)); transition: transform .08s, box-shadow .08s, border-color .2s; }
.modekey[data-mode="lab"] { --kc: #5b9dff; } .modekey[data-mode="lesson"] { --kc: #3ecf8e; } .modekey[data-mode="quiz"] { --kc: #e8b04a; }
.modekey svg { color: var(--kc); width: 1.3em; height: 1.3em; }
.modekey:hover { border-color: var(--kc); }
.modekey:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--key-edge); }
.modekey[aria-pressed="true"] { transform: translateY(3px); border-color: var(--kc);
  background: linear-gradient(180deg, color-mix(in srgb, var(--kc) 28%, var(--key1)), color-mix(in srgb, var(--kc) 14%, var(--key2)));
  box-shadow: 0 1px 0 var(--key-edge), 0 0 0 1px var(--kc), 0 0 20px -4px var(--kc), inset 0 1px 0 var(--key-hi); }
.play-main { min-height: 46px; padding: 0 1.3rem; font-size: 1rem; box-shadow: 0 5px 0 #3565c4, 0 12px 24px -8px rgba(80, 150, 255, .75), inset 0 1px 0 rgba(255,255,255,.9); animation: glowPulse 2.6s ease-in-out infinite; }
@keyframes glowPulse { 50% { box-shadow: 0 5px 0 #3565c4, 0 12px 30px -4px rgba(80, 150, 255, .95), inset 0 1px 0 rgba(255,255,255,.9); } }
.panel-status-row { flex: none; padding: 6px 12px; border-bottom: 1px solid var(--line); min-height: 32px; display: flex; align-items: center; }
.panel-status-row .panel-status { text-align: left; font-size: .88rem; max-height: 2.6em; }

/* groups as framed cards */
.group { border: 1px solid var(--line); box-shadow: inset 0 1px 0 var(--key-hi); }

/* lively 3D stage background: coloured glows, soft grid and slow drift */
.stage-wrap { background:
    radial-gradient(60% 55% at 22% 18%, rgba(91, 157, 255, .20), transparent 70%),
    radial-gradient(55% 55% at 82% 78%, rgba(165, 139, 255, .18), transparent 70%),
    radial-gradient(45% 45% at 70% 12%, rgba(45, 212, 191, .10), transparent 70%),
    var(--stage); }
.stage-wrap::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(143, 184, 255, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(143, 184, 255, .07) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(circle at 50% 55%, #000 25%, transparent 75%); -webkit-mask-image: radial-gradient(circle at 50% 55%, #000 25%, transparent 75%); }
.stage-wrap::after { content: ""; position: absolute; inset: -20%; pointer-events: none;
  background: radial-gradient(30% 30% at 50% 50%, rgba(91, 157, 255, .10), transparent 70%); animation: stageDrift 18s ease-in-out infinite alternate; }
@keyframes stageDrift { from { transform: translate(-8%, -4%); } to { transform: translate(8%, 6%); } }
:root[data-theme="day"] .stage-wrap { background:
    radial-gradient(60% 55% at 22% 18%, rgba(91, 157, 255, .25), transparent 70%),
    radial-gradient(55% 55% at 82% 78%, rgba(165, 139, 255, .22), transparent 70%), var(--stage); }
.stage-host, .stage-hud, .wide-btn, .loader { z-index: 1; }
.landing-stage { background: radial-gradient(60% 55% at 30% 25%, rgba(91, 157, 255, .22), transparent 70%), radial-gradient(55% 55% at 80% 80%, rgba(165, 139, 255, .2), transparent 70%), var(--stage); }

@media (max-width: 899px) {
  .play-main { flex: 1 1 100%; }
  .modekey span { font-size: .9rem; }
}

/* =========================================================
   v4: key buttons in the style of the reference design
   raised: light top line, dark bottom edge, soft drop shadow
   pressed / selected: blue, sunk in with an inner shadow
   ========================================================= */
:root, :root[data-theme="night"] {
  --k1: #3a3d46; --k2: #282a31; --kedge: #09090c; --ktext: #ffffff;
  --b1: #4d97f0; --b2: #2f7ede; --bedge: #0f3a70;
}
:root[data-theme="day"] { --k1: #ffffff; --k2: #e8ecf3; --kedge: #aeb8ca; --ktext: #17202f; }
.key-raised {}
.btn3d, .btn3d.neutral, .subnav .btn3d, .modekey, .stim, .topic, .tb-btn, .schip, .opt-key {
  border: 0 !important; border-radius: 12px; color: var(--ktext); text-shadow: none;
  background: linear-gradient(180deg, var(--k1), var(--k2));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), inset 0 -2px 0 rgba(0,0,0,.07), 0 4px 0 var(--kedge), 0 9px 12px -4px rgba(0,0,0,.28);
  transition: transform .08s ease, box-shadow .08s ease, filter .15s;
}
:root[data-theme="night"] .btn3d.neutral, :root[data-theme="night"] .subnav .btn3d, :root[data-theme="night"] .modekey, :root[data-theme="night"] .stim,
:root[data-theme="night"] .topic, :root[data-theme="night"] .tb-btn, :root[data-theme="night"] .schip, :root[data-theme="night"] .opt-key {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), inset 0 -2px 0 rgba(0,0,0,.2), 0 4px 0 var(--kedge), 0 9px 12px -4px rgba(0,0,0,.45);
}
.btn3d:hover, .modekey:hover, .stim:hover, .topic:hover, .tb-btn:hover, .schip:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn3d:active, .modekey:active, .stim:active, .topic:active, .tb-btn:active, .schip:active {
  transform: translateY(3px); box-shadow: inset 0 2px 5px rgba(0,0,0,.28), 0 1px 0 var(--kedge), 0 3px 6px -2px rgba(0,0,0,.25);
}
/* blue main buttons */
.btn3d.primary, .btn3d.pink, .btn3d.cyan, .play-main {
  --ktext: #fff; color: #fff; background: linear-gradient(180deg, var(--b1), var(--b2));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), inset 0 -2px 0 rgba(0,0,0,.07), 0 4px 0 var(--bedge), 0 9px 12px -4px rgba(0,0,0,.35) !important;
  animation: none;
}
.btn3d.big { box-shadow: inset 0 1px 0 rgba(255,255,255,.55), inset 0 -2px 0 rgba(0,0,0,.07), 0 5px 0 var(--bedge), 0 12px 18px -6px rgba(47,126,222,.55) !important; }
/* selected / pressed toggles: blue and sunk in, like the active item in the reference */
.btn3d.neutral[aria-pressed="true"], .subnav .btn3d[aria-pressed="true"], .modekey[aria-pressed="true"],
.stim.on, .stim.on2, .schip.active, .opt-key[aria-pressed="true"] {
  color: #fff; background: linear-gradient(180deg, var(--b1), var(--b2)); transform: translateY(3px);
  box-shadow: inset 0 2px 5px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.15), 0 1px 0 var(--bedge), 0 3px 6px -2px rgba(0,0,0,.25) !important;
}
.stim.on small, .stim.on2 small { color: rgba(255,255,255,.8); }
.modekey[aria-pressed="true"] svg { color: #fff; }
.opt-key::after { display: none; }
.stim .glyph { background: color-mix(in srgb, var(--kc) 28%, rgba(0,0,0,.25)); box-shadow: none; }
.btn3d.lime { background: linear-gradient(180deg, #4fd99a, #27b877); box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 4px 0 #0e5a38, 0 9px 12px -4px rgba(0,0,0,.3) !important; color: #fff; }
.opt.right { background: linear-gradient(180deg, #4fd99a, #27b877) !important; color: #fff; }
.opt.wrong { background: linear-gradient(180deg, #f07878, #d84c4c) !important; color: #fff; }

/* sidebar topics: key rows with a number chip */
.sb-list { gap: 10px; padding: 6px 14px 20px; }
.topic { padding: 11px 12px; }
.topic .ti { background: rgba(0,0,0,.25); color: var(--ktext); border-radius: 8px; width: 30px; height: 30px; font-size: .9rem; }
:root[data-theme="day"] .topic .ti { background: rgba(40,60,100,.08); }
.topic .tt small { color: var(--muted); }
.topic:hover .ti { background: var(--b2); color: #fff; }
.topic .badge { background: rgba(0,0,0,.2); border: 0; color: var(--muted); }

/* small top bar keys */
.tb-btn { min-height: 36px; border-radius: 10px; }
.tb-btn.iconly { width: 36px; }
.schip { padding: 8px 2px; }
.schip .n { background: rgba(0,0,0,.25); }
.schip.active .n { background: rgba(255,255,255,.25); color: #fff; }
.popover { gap: 10px; }

/* logo */
.brand img { width: 32px; height: 32px; border-radius: 8px; filter: drop-shadow(0 0 8px rgba(47, 126, 222, .55)); }
.wordmark { font-weight: 900; letter-spacing: -.01em; }
.wordmark b { background: linear-gradient(180deg, #33c6ff, #2f7ede); -webkit-background-clip: text; background-clip: text; color: transparent; }
.landing-logo { width: 72px; height: 72px; border-radius: 18px; filter: drop-shadow(0 0 22px rgba(47, 126, 222, .6)); }
@media (max-width: 380px) { .brand .wordmark { display: none; } }

/* AR */
.ar-btn { right: 56px; width: auto; padding: 0 10px; font-size: .82rem; letter-spacing: .04em; }
.ar-overlay { position: fixed; inset: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 24px 16px 36px; font-family: var(--font); }
.ar-hint { pointer-events: none; padding: 10px 16px; border-radius: 12px; background: rgba(8, 11, 19, .75); color: #fff; font-weight: 700; text-align: center; max-width: 420px; }
.ar-exit { pointer-events: auto; }
/* logo in the sidebar */
.sb-brand { display: flex; align-items: center; gap: 12px; padding: 18px 16px 4px; font-size: 1.15rem; }
.sb-brand img { width: 40px; height: 40px; border-radius: 10px; filter: drop-shadow(0 0 10px rgba(47, 126, 222, .55)); }
.sb-head { padding-top: 8px; }
.sb-head h2 { font-size: 1rem; color: var(--muted); }

/* resize key between the 3D area and the panel (right side) */
.split { position: relative; flex: none; height: 0; margin-top: -10px; z-index: 8; }
.split-btn { position: absolute; right: 22px; top: -10px; width: 52px; height: 30px; border: 0; border-radius: 10px; cursor: ns-resize; touch-action: none;
  display: grid; place-items: center; color: var(--ktext); background: linear-gradient(180deg, var(--k1), var(--k2));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 3px 0 var(--kedge), 0 6px 10px -4px rgba(0,0,0,.5); transition: transform .08s, filter .15s; }
.split-btn:hover { filter: brightness(1.15); }
.split-btn.dragging, .split-btn:active { transform: translateY(2px); background: linear-gradient(180deg, var(--b1), var(--b2)); color: #fff; box-shadow: inset 0 2px 5px rgba(0,0,0,.28), 0 1px 0 var(--bedge); }
.panel { min-height: 96px; }
@media (orientation: landscape) and (max-height: 520px) { .split { display: none; } }

/* sidebar footer: language and day / night */
.sb-foot { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 16px 16px; border-top: 1px solid var(--line); background: var(--panel-2); }
.sb-foot .pop-sec h5 { margin: 0 0 2px; }
.sb-foot .seg .btn3d { min-height: 34px; font-size: .84rem; padding: .3rem .4rem; }
@media (max-width: 380px) { .sb-foot { grid-template-columns: 1fr; } }
/* landing brain: no drag cursor, soft entrance */
.landing-stage canvas { cursor: default !important; }
.landing-stage { box-shadow: 0 0 60px -20px rgba(47, 155, 255, .35), inset 0 0 80px -30px rgba(47, 155, 255, .25); }
/* process page appears with a soft zoom instead of a jump */
.module .stage-wrap { animation: stageIn .9s cubic-bezier(.2, .8, .2, 1) backwards; }
.module .panel { animation: panelIn .7s .15s cubic-bezier(.2, .8, .2, 1) backwards; }
@keyframes stageIn { from { opacity: 0; transform: scale(.965); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes panelIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.landing { transition: opacity .6s ease; }
body.leaving .landing-text { opacity: .35; transition: opacity .6s ease; }
@media (prefers-reduced-motion: reduce) { .module .stage-wrap, .module .panel { animation: none; } }

/* cinematic title inside the landing scene */
.landing-stage { position: relative; }
.hero-title { position: absolute; left: 22px; bottom: 20px; z-index: 2; pointer-events: none; color: #e8f4ff; text-shadow: 0 0 18px rgba(80, 180, 255, .55), 0 0 2px rgba(180, 225, 255, .6);
  animation: titleIn 2.4s cubic-bezier(.2, .8, .2, 1) .6s both; }
.hero-title .ht-en { font-weight: 500; font-size: clamp(.95rem, 1.6vw, 1.2rem); letter-spacing: .04em; }
.hero-title .ht-uz { font-weight: 400; font-size: clamp(.78rem, 1.25vw, .95rem); letter-spacing: .05em; color: #b9d8f5; margin-top: 3px; opacity: .85; }
@keyframes titleIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
:root[data-theme="day"] .hero-title { color: #0f2a55; text-shadow: 0 0 14px rgba(255, 255, 255, .8); }
:root[data-theme="day"] .hero-title .ht-uz { color: #29507f; }
@media (prefers-reduced-motion: reduce) { .hero-title { animation: none; } }
/* AR mark in the topics list */
.ar-chip { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 7px; font-size: .68rem; font-weight: 800; letter-spacing: .04em;
  color: #bfe6ff; background: linear-gradient(180deg, rgba(77, 151, 240, .35), rgba(47, 126, 222, .25)); box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 0 10px -3px rgba(77,151,240,.7); }
.ar-chip svg.i { width: 13px; height: 13px; }
:root[data-theme="day"] .ar-chip { color: #1a4f9c; }

/* ---------- v7: process view on the 3D area ---------- */
/* open digital lab: no hard box, soft depth, faint stars and a vignette */
.stage-wrap { border: 0; box-shadow: inset 0 0 140px rgba(0, 0, 0, .42), 0 18px 40px -24px rgba(0, 0, 0, .6); }
:root[data-theme="day"] .stage-wrap { box-shadow: inset 0 0 120px rgba(40, 60, 110, .12), 0 18px 40px -26px rgba(40, 60, 110, .35); }
.stage-wrap::before { opacity: .55;
  background-image:
    radial-gradient(1px 1px at 12% 22%, rgba(255,255,255,.55), transparent 60%), radial-gradient(1px 1px at 78% 14%, rgba(255,255,255,.45), transparent 60%),
    radial-gradient(1.3px 1.3px at 64% 72%, rgba(200,220,255,.5), transparent 60%), radial-gradient(1px 1px at 30% 84%, rgba(255,255,255,.35), transparent 60%),
    radial-gradient(1px 1px at 90% 58%, rgba(255,255,255,.4), transparent 60%), radial-gradient(1.2px 1.2px at 46% 8%, rgba(200,220,255,.45), transparent 60%),
    radial-gradient(1px 1px at 6% 64%, rgba(255,255,255,.35), transparent 60%), radial-gradient(1px 1px at 56% 40%, rgba(255,255,255,.2), transparent 60%),
    linear-gradient(rgba(143, 184, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(143, 184, 255, .05) 1px, transparent 1px);
  background-size: auto, auto, auto, auto, auto, auto, auto, auto, 44px 44px, 44px 44px; }
:root[data-theme="day"] .stage-wrap::before { opacity: .35; }
.stage-top, .timeline, .ex-bar, .struct-card { z-index: 3; }
.stage-top { position: absolute; left: 16px; top: 14px; max-width: min(56%, 560px); display: flex; flex-direction: column; align-items: flex-start; gap: 10px; pointer-events: none; }
.stage-top .vm-bar { pointer-events: auto; }

/* process title */
.proc-head { pointer-events: none; animation: procIn .8s .15s cubic-bezier(.2, .8, .2, 1) both; }
.proc-head h2 { margin: 0; font-size: clamp(1.02rem, 1.9vw, 1.45rem); font-weight: 800; letter-spacing: -.01em; line-height: 1.2; color: var(--text);
  text-shadow: 0 2px 14px rgba(0, 0, 0, .45); }
.proc-head p { margin: 4px 0 0; font-size: .84rem; color: var(--muted); font-weight: 600; }
:root[data-theme="day"] .proc-head h2 { text-shadow: 0 1px 8px rgba(255, 255, 255, .8); }
@keyframes procIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* view mode switch: small raised keys, blue when selected */
.vm-bar { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--label-bg); border: 1px solid var(--line); backdrop-filter: blur(8px); }
.vm-key { height: 32px; padding: 0 12px; border-radius: 9px; font-size: .8rem; font-weight: 800; cursor: pointer; color: var(--ktext, var(--text));
  background: linear-gradient(180deg, var(--k1, #3a3d46), var(--k2, #282a31)); border: 0; box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 2px 0 var(--kedge, #09090c);
  transition: transform .12s, box-shadow .12s, background .2s; white-space: nowrap; }
.vm-key:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 0 0 var(--kedge, #09090c); }
.vm-key[aria-pressed="true"] { color: #fff; background: linear-gradient(180deg, var(--b1, #4d97f0), var(--b2, #2f7ede)); box-shadow: inset 0 2px 4px rgba(0,0,0,.25), 0 1px 0 var(--bedge, #0f3a70); transform: translateY(1px); }
.vm-key.off { opacity: .45; }

/* step timeline */
.timeline { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(92%, 640px); display: none; flex-direction: column; align-items: center; gap: 8px;
  padding: 10px 16px 12px; border-radius: 16px; background: var(--label-bg); border: 1px solid var(--line); backdrop-filter: blur(10px); }
.stage-wrap[data-vm="steps"] .timeline { display: flex; animation: fadeUp .5s both; }
.stage-wrap[data-vm="steps"] .stage-hud { bottom: 108px; }
@keyframes fadeUp { from { opacity: 0; } to { opacity: 1; } }
.tl-label { display: flex; gap: 10px; align-items: baseline; font-size: .86rem; min-height: 1.3em; max-width: 100%; }
.tl-label b { color: var(--accent); letter-spacing: .08em; font-size: .74rem; flex: none; }
.tl-label span { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-track { position: relative; width: 100%; display: flex; justify-content: space-between; --prog: 0; }
.tl-track::before, .tl-track::after { content: ""; position: absolute; left: 14px; right: 14px; top: 50%; height: 3px; margin-top: -1.5px; border-radius: 3px; background: var(--track); }
.tl-track::after { right: auto; width: calc((100% - 28px) * var(--prog)); background: linear-gradient(90deg, var(--b2, #2f7ede), var(--b1, #4d97f0)); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.tl-node { position: relative; z-index: 1; width: 28px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.tl-node i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: .72rem; font-weight: 800;
  background: var(--panel); color: var(--muted); border: 2px solid var(--track); transition: transform .25s, background .25s, border-color .25s, box-shadow .25s; }
.tl-node.done i { border-color: var(--b1, #4d97f0); color: var(--text); }
.tl-node.on i { background: var(--b1, #4d97f0); border-color: var(--b1, #4d97f0); color: #fff; transform: scale(1.18); box-shadow: 0 0 0 5px rgba(77, 151, 240, .22), 0 0 18px rgba(77, 151, 240, .55); }
.tl-node:hover i { border-color: var(--accent); }

/* explorer controls and the structure card */
.ex-bar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: none; flex-direction: column; align-items: center; gap: 6px; }
.ex-bar .vm-bar { position: static; }
.ex-hint { margin: 0; padding: 4px 10px; border-radius: 8px; font-size: .76rem; font-weight: 700; color: var(--muted); background: var(--label-bg); white-space: nowrap; }
.stage-wrap[data-vm="explore"] .ex-bar { display: flex; animation: fadeUp .5s both; }
.stage-wrap[data-vm="explore"] .stage-hud { display: none; }
.struct-card { position: absolute; right: 14px; top: 60px; width: min(300px, calc(100% - 28px)); padding: 14px 16px 12px; border-radius: 14px; background: var(--label-bg); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  backdrop-filter: blur(12px); box-shadow: 0 16px 36px -18px rgba(0, 0, 0, .7), 0 0 26px -8px rgba(77, 151, 240, .45);
  opacity: 0; transform: translateY(8px) scale(.98); pointer-events: none; transition: opacity .3s, transform .35s cubic-bezier(.2, .8, .2, 1); }
.struct-card.show { opacity: 1; transform: none; pointer-events: auto; }
.struct-card h4 { margin: 0 26px 8px 0; font-size: 1rem; line-height: 1.25; }
.sc-row { margin-top: 6px; }
.sc-row small { display: block; font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sc-row p { margin: 2px 0 0; font-size: .86rem; line-height: 1.4; }
.sc-row.role p { color: var(--accent); font-weight: 700; }
.sc-x { position: absolute; right: 8px; top: 8px; width: 28px; height: 28px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.sc-x:hover { color: var(--text); background: var(--panel-2); }

/* cinematic exit when switching to another process */
.module .stage-wrap.leaving { animation: none; opacity: 0; transform: scale(.965); filter: blur(3px); transition: opacity .6s ease, transform .65s cubic-bezier(.4, 0, .2, 1), filter .6s; }
.module .stage-wrap.leaving ~ .panel { opacity: .4; transition: opacity .5s; }

/* AR how-to under the search bar */
.ar-help { margin: -2px 16px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); font-size: .84rem; }
.ar-help summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 9px 12px; font-weight: 700; color: var(--muted); }
.ar-help summary::-webkit-details-marker { display: none; }
.ar-help summary::after { content: "+"; margin-left: auto; font-weight: 800; }
.ar-help[open] summary::after { content: "\2212"; }
.ar-help[open] summary { color: var(--text); }
.ar-help p { margin: 0 12px 6px; color: var(--muted); line-height: 1.4; }
.ar-help ol { margin: 0 12px 10px; padding-left: 18px; display: grid; gap: 5px; line-height: 1.4; }

@media (max-width: 899px) {
  .stage-top { position: static; }
  .stage-top .proc-head { position: absolute; z-index: 3; left: 12px; top: 10px; max-width: calc(100% - 110px); }
  .proc-head p { display: none; }
  .stage-top .vm-bar { position: absolute; z-index: 3; left: 10px; bottom: 10px; }
  .stage-wrap .stage-hud { bottom: 58px; }
  .vm-key { height: 30px; padding: 0 9px; font-size: .74rem; }
  .timeline { bottom: 54px; width: calc(100% - 20px); padding: 8px 10px 10px; }
  .stage-wrap[data-vm="steps"] .stage-hud { display: none; }
  .ex-bar { bottom: 54px; }
  .ex-hint { display: none; }
  .struct-card { top: auto; bottom: 104px; right: 10px; left: 10px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .proc-head, .stage-wrap[data-vm] .timeline, .stage-wrap[data-vm] .ex-bar { animation: none; }
  .module .stage-wrap.leaving { transition: none; }
  .tl-track::after, .tl-node i, .struct-card { transition: none; }
}

/* ---------- v8: install button, fixed lesson buttons, phone fit ---------- */
.sb-brand .install-btn { margin-left: auto; height: 36px; padding: 0 12px; font-size: .82rem; gap: 6px; }
.install-help { display: none; margin: 4px 16px 6px; padding: 10px 12px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--bg-2); font-size: .84rem; line-height: 1.45; }
.install-help.open { display: grid; gap: 6px; }
.install-help p { margin: 0; color: var(--muted); }

/* lesson: Previous and Next always sit at the same place at the bottom of the panel */
#tab-lesson { padding-bottom: 0; }
.lesson-foot { position: sticky; bottom: 0; margin: auto -12px 0; padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 10px;
  background: var(--panel); border-top: 1px solid var(--line); z-index: 2; }
.lesson-nav .btn3d { min-height: 46px; }

/* timeline arrows on the 3D area */
.tl-row { display: flex; align-items: center; gap: 8px; width: 100%; }
.tl-row .tl-track { flex: 1; }
.tl-arrow { flex: none; width: 34px; height: 34px; border-radius: 10px; border: 0; cursor: pointer; display: grid; place-items: center; color: var(--ktext, var(--text));
  background: linear-gradient(180deg, var(--k1, #3a3d46), var(--k2, #282a31)); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 2px 0 var(--kedge, #09090c); }
.tl-arrow:active { transform: translateY(2px); box-shadow: none; }
.tl-arrow:disabled { opacity: .35; cursor: default; }
.tl-arrow svg.i { width: 18px; height: 18px; }
.vm-key .s { display: none; }

/* empty status line takes no room */
.panel-status-row:has(.panel-status:empty) { display: none; }

@media (max-width: 899px) {
  html, body { height: 100%; overscroll-behavior: none; }
  #app { height: 100dvh; }
  .module { padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); gap: 6px; }
  .stage-wrap { border-radius: 14px; min-height: 200px; }
  /* one compact row: play icon + three mode keys */
  .panel-head { display: grid !important; grid-template-columns: 52px 1fr; gap: 6px; padding: 8px !important; align-items: stretch; }
  .panel-head .play-main { flex: none; width: 52px; min-width: 0; height: 46px; padding: 0; justify-content: center; }
  .panel-head .play-main span { display: none; }
  .panel-head:has(.play-main[style*="none"]) { grid-template-columns: 1fr; }
  .panel-head .modebar { gap: 6px; }
  .panel-head .modekey { height: 46px; min-width: 0; padding: 0 6px; font-size: .86rem; gap: 6px; }
  .panel-head .modekey svg.i { width: 18px; height: 18px; }
  .vm-key .l { display: none; }
  .vm-key .s { display: inline; }
  .stage-top .vm-bar { right: auto; }
  .vm-key { padding: 0 12px; }
  .timeline { gap: 6px; }
  .tl-label { font-size: .8rem; }
  .tl-arrow { width: 32px; height: 32px; }
  .tl-node, .tl-node i { width: 24px; height: 24px; }
  .lesson-card { padding: 12px; }
  .lesson-card h3 { font-size: 1.05rem; }
  .lesson-card p { line-height: 1.5; }
  .sb-brand { padding: 14px 14px 4px; }
  .sb-brand .install-btn { height: 34px; padding: 0 10px; }
}
@media (max-width: 899px) {
  .split { margin-top: -6px; }
  .split-btn { top: -15px; height: 22px; width: 46px; right: 16px; border-radius: 8px; }
  .split-btn svg.i { width: 16px; height: 16px; }
}
@media (max-width: 380px) {
  .panel-head .modekey svg.i { display: none; }
  .sb-brand .wordmark { font-size: 1rem; }
}

@media (max-width: 899px) {
  .landing { padding-top: 10px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); gap: 14px; }
  .landing-stage { height: 44vh; height: 44dvh; }
  .landing-logo { display: none; }
}
@media (max-width: 899px) and (max-height: 700px) { .landing-stage { height: 36dvh; } }

/* ---------- v9: live "now" panel, auto play, info cards everywhere ---------- */
.stage-right { position: absolute; z-index: 3; right: 14px; top: 58px; width: min(290px, 42%); display: flex; flex-direction: column; align-items: stretch; gap: 8px; pointer-events: none; }
.stage-right .struct-card { position: static; width: auto; }
.stage-right .struct-card.show { pointer-events: auto; }
.now-panel { padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--panel) 55%, transparent); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-size: .8rem; line-height: 1.35;
  opacity: 0; transform: translateY(-4px); transition: opacity .35s, transform .35s; }
.now-panel.show { opacity: 1; transform: none; }
.np-head { display: block; color: var(--accent); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.np-sub { margin: 2px 0 0; font-weight: 700; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.now-panel small { display: block; margin-top: 8px; font-size: .66rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.now-panel ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 3px; }
.now-panel li { display: flex; align-items: center; gap: 7px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-panel li i { display: block; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--rc); box-shadow: 0 0 8px var(--rc); animation: npPulse 1.6s ease-in-out infinite; }
@keyframes npPulse { 50% { opacity: .45; } }

/* auto play control and progress on the timeline */
.tl-play { background: linear-gradient(180deg, var(--b1, #4d97f0), var(--b2, #2f7ede)) !important; color: #fff !important; box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 2px 0 var(--bedge, #0f3a70) !important; }
.tl-auto { width: 100%; height: 3px; border-radius: 3px; background: transparent; overflow: hidden; }
.timeline.auto .tl-auto { background: var(--track); }
.tl-auto i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; }
.timeline:not(.auto) .tl-auto i { width: 0 !important; }

@media (max-width: 899px) {
  .stage-right { position: static; width: auto; }
  .now-panel { position: absolute; z-index: 3; right: 8px; top: 62px; max-width: 54%; padding: 8px 10px; font-size: .74rem; }
  .now-panel small { margin-top: 5px; }
  /* on phones the card is a small sheet at the bottom of the screen, so the 3D model stays visible */
  .stage-right .struct-card { position: fixed; z-index: 60; top: auto; bottom: calc(10px + env(safe-area-inset-bottom)); right: 10px; left: 10px; width: auto;
    background: var(--panel); box-shadow: 0 -10px 30px -10px rgba(0, 0, 0, .6), 0 0 0 1px color-mix(in srgb, var(--accent) 45%, var(--line)); }
  .tl-row { gap: 5px; }
}
@media (prefers-reduced-motion: reduce) { .now-panel li i { animation: none; } .now-panel { transition: none; } }

@media (min-width: 900px) and (max-width: 1150px) {
  .stage-right { width: min(210px, 44%); top: 54px; right: 10px; }
  .now-panel { padding: 7px 9px; font-size: .72rem; }
  .now-panel small { margin-top: 4px; }
}

/* the 3D area and the panel can never be scrolled by focus or taps (their glow layers extend past the edges) */
.stage-wrap, .panel, .module { overflow: hidden; overflow: clip; }

/* ---------- v10: clarity first ---------- */
/* no background motion: the brain is the only thing that moves */
.stage-wrap::after { animation: none; display: none; }

/* callout labels: a clean chip outside the brain, a thin leader line and a pin exactly on the structure */
.lbl.callout { top: 0; left: 0; padding: 4px 10px; font-size: .8rem; background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--lc); box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .6); }
.lbl.callout i { display: none; }
.lbl.callout.active { color: var(--text); }
.lbl-line { position: absolute; left: 0; top: 0; height: 1.5px; margin-top: -.75px; background: var(--lc, #2de2d0); transform-origin: 0 50%; opacity: .9; pointer-events: none; will-change: transform; }
.lbl-pin { position: absolute; left: 0; top: 0; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--lc, #2de2d0); border: 2px solid #fff; pointer-events: none; will-change: transform;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--lc, #2de2d0) 28%, transparent); }
.lbl-line.hidden, .lbl-pin.hidden { display: none; }
:root[data-theme="day"] .lbl-pin { border-color: #17202f; }

/* hover preview on desktop: what is this? */
.hover-tip { position: absolute; left: 0; top: 0; z-index: 6; max-width: 240px; padding: 7px 10px; border-radius: 10px; pointer-events: none;
  background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line); box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .7);
  font-size: .78rem; line-height: 1.35; opacity: 0; transition: opacity .15s; }
.hover-tip.show { opacity: 1; }
.hover-tip b { display: block; font-size: .84rem; }
.hover-tip span { color: var(--muted); }

/* the live panel follows the same colour meaning: teal = main, blue = related */
.now-panel li i { animation: none; }
.now-panel li.main i { animation: npPulse 2.4s ease-in-out infinite; }
.now-panel li.main { color: var(--text); }
.now-panel li:not(.main) { color: var(--muted); font-weight: 600; }
.play-main { animation: none; }
@media (prefers-reduced-motion: reduce) { .now-panel li.main i { animation: none; } }

/* ---------- v11: change-topic button, main menu in the sidebar, sliding panel, step list on the 3D area ---------- */
.tb-change { gap: 7px; padding: 0 12px; }
.tb-change span { display: inline !important; white-space: nowrap; }
@media (max-width: 899px) {
  .topbar .tb-change { width: auto !important; padding: 0 10px; font-size: .84rem; }
}
@media (max-width: 360px) { .topbar .tb-change { font-size: .76rem; padding: 0 8px; } }

.sb-head-r { display: flex; align-items: center; gap: 8px; flex: none; }
.sb-home { height: 36px; padding: 0 12px; gap: 6px; font-size: .82rem; }

/* the panel rises and lowers smoothly */
.panel.sliding { transition: height .38s cubic-bezier(.2, .8, .2, 1); }

/* step list inside the live panel: finished steps are one short line, the current step has a short description */
.np-steps { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 5px; }
.np-steps li { display: flex; gap: 8px; align-items: flex-start; }
.np-steps li.on { animation: npIn .4s ease; }   /* only the newly reached step fades in */
.np-steps li i { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: .66rem; font-weight: 800; margin-top: 1px; }
.np-steps li.done i { background: transparent; border: 1.5px solid #5b9dff; color: #5b9dff; }
.np-steps li.on i { background: #2de2d0; color: #062a2a; box-shadow: 0 0 0 3px rgba(45, 226, 208, .22); }
.np-steps li b { display: block; font-size: .8rem; line-height: 1.3; }
.np-steps li.done b { color: var(--muted); font-weight: 700; }
.np-steps li.on b { color: var(--text); }
.np-steps li span { display: block; margin-top: 2px; font-size: .74rem; color: var(--muted); line-height: 1.35; }
@keyframes npIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .np-steps li { animation: none; } .panel.sliding { transition: none; } }
@media (max-width: 899px) { .np-steps li span { font-size: .7rem; } }

/* ---------- v12: 3D first. Wide screens: options on the right. Upright phones: options in a bottom sheet ---------- */
.panel-status-row, .sec-hidden { display: none !important; }
.modebar { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
.modekey.off { opacity: .45; }

/* stage buttons: full screen, reset view, AR, panel toggle, play */
.reset-btn { top: 56px; }
.panel-toggle { display: none; position: absolute; z-index: 5; right: 0; top: 50%; transform: translateY(-50%); width: 26px; height: 64px; border-radius: 10px 0 0 10px; border: 1px solid var(--line); border-right: 0;
  background: var(--label-bg); color: var(--label-text); place-items: center; cursor: pointer; opacity: .75; }
.panel-toggle:hover { opacity: 1; }
.panel-toggle svg.i { width: 16px; height: 16px; }
.stage-play { position: absolute; z-index: 4; left: 50%; bottom: calc(var(--sheet-h, 0px) + 16px); transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 20px 0 16px;
  border-radius: 999px; border: 0; cursor: pointer; color: #fff; font-weight: 800; font-size: .92rem; white-space: nowrap;
  background: linear-gradient(180deg, var(--b1, #4d97f0), var(--b2, #2f7ede)); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 3px 0 var(--bedge, #0f3a70), 0 12px 26px -10px rgba(47, 126, 222, .8); }
.stage-play:active { transform: translateX(-50%) translateY(2px); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 1px 0 var(--bedge, #0f3a70); }
.stage-play.on { background: linear-gradient(180deg, #3a3d46, #282a31); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 3px 0 #09090c; }
.stage-wrap[data-vm="explore"] .stage-hud, .stage-wrap[data-vm="steps"] .stage-hud { display: none; }

/* explore layer keys and the case chip row */
.ex-row { flex-wrap: wrap; }
.chip-row { display: none; gap: 6px; padding: 6px 8px 8px; overflow-x: auto; scrollbar-width: none; flex: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 12px; border: 0; cursor: pointer; font-weight: 700; font-size: .84rem; white-space: nowrap;
  color: var(--ktext, var(--text)); background: linear-gradient(180deg, var(--k1, #3a3d46), var(--k2, #282a31)); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 2px 0 var(--kedge, #09090c); }
.chip[aria-pressed="true"] { color: #fff; background: linear-gradient(180deg, var(--b1, #4d97f0), var(--b2, #2f7ede)); box-shadow: inset 0 2px 4px rgba(0,0,0,.25), 0 1px 0 var(--bedge, #0f3a70); }
.chip svg.i { width: 16px; height: 16px; }
.chip .glyph { font-size: 1.05rem; }
.chip small, .chip .sub { display: none; }

/* ----- wide screens and phones on their side: 3D on the left, options on the right ----- */
@media (min-width: 900px), (orientation: landscape) and (max-height: 520px) {
  .module { flex-direction: row; }
  .module .panel { height: auto !important; width: clamp(320px, 30vw, 430px); flex: none; }
  .module .split { display: none; }
  .module.collapsed .panel { display: none; }
  .panel-toggle { display: grid; }
  body.wide .panel-toggle { display: none; }
  .panel .modekey span { font-size: .84rem; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .module .panel { width: min(44%, 360px); }
  .proc-head p { display: none; }
}

/* ----- upright phones: the 3D fills the screen, options in a sheet that slides up from the bottom ----- */
@media (max-width: 899px) and (min-height: 521px) {
  .module { position: relative; display: block; padding: 6px; }
  .module .stage-wrap { position: absolute; inset: 6px; min-height: 0; }
  .module .panel { position: absolute; left: 6px; right: 6px; bottom: 6px; z-index: 10; height: 140px; border-radius: 18px 18px 14px 14px;
    box-shadow: 0 -14px 32px -12px rgba(0, 0, 0, .65); animation: none; }
  .module .split { position: absolute; left: 0; right: 0; bottom: calc(var(--sheet-h, 140px) + 6px); z-index: 11; height: 0; margin: 0; }
  .split-btn { top: -12px; right: 18px; }
  .panel.sheet-small .tab-body { display: none !important; }
  .panel.sheet-small[data-tab="lab"] .chip-row.has { display: flex; }
  .panel:not(.sheet-small) .chip-row { display: none; }
  /* everything on the 3D area stays above the sheet */
  .stage-wrap .stage-hud { bottom: calc(var(--sheet-h, 0px) + 12px); }
  .timeline { bottom: calc(var(--sheet-h, 0px) + 12px) !important; }
  .stage-right .struct-card { position: absolute !important; bottom: calc(var(--sheet-h, 0px) + 12px) !important; }
  .stage-wrap[data-vm="steps"] .stage-right .struct-card { bottom: calc(var(--sheet-h, 0px) + 120px) !important; }
  .stage-play { height: 42px; font-size: .86rem; }
  .reset-btn { top: 54px; }
  body.wide .module .stage-wrap { inset: 0; }
}

@media (max-width: 899px) { .panel-head { grid-template-columns: 1fr !important; } .panel-head .modekey { padding: 0 4px; font-size: .82rem; } }

/* top-right row on the 3D area: full screen, reset view, AR */
.stage-wrap .reset-btn { top: 10px !important; right: 56px; z-index: 5; }
.stage-wrap .ar-btn { right: 102px; z-index: 5; }

/* ---------- v13: the learning story ---------- */
/* cause → brain → outcome chain under the process title */
.story-strip { display: none; align-items: stretch; gap: 6px; margin-top: 10px; pointer-events: none; flex-wrap: wrap; }
.story-strip.show { display: flex; animation: fadeUp .4s both; }
.ss-node { padding: 6px 10px; border-radius: 10px; background: color-mix(in srgb, var(--panel) 70%, transparent); border: 1px solid var(--line); backdrop-filter: blur(6px); max-width: 190px; }
.ss-node small { display: block; font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ss-node b { display: block; font-size: .8rem; line-height: 1.25; color: var(--text); }
.ss-node span { display: block; font-size: .7rem; line-height: 1.3; color: var(--muted); margin-top: 1px; }
.ss-node.brain { border-color: rgba(45, 226, 208, .55); }
.ss-node.brain b { color: #2de2d0; }
.ss-node.out { border-color: rgba(91, 157, 255, .55); }
.ss-arrow { align-self: center; font-style: normal; font-weight: 800; color: var(--muted); }

/* the key takeaway after a full run */
.take-card { position: absolute; z-index: 6; left: 50%; bottom: calc(var(--sheet-h, 0px) + 74px); transform: translateX(-50%) translateY(8px); width: min(560px, calc(100% - 24px));
  padding: 12px 40px 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--panel) 94%, transparent); border: 1px solid rgba(45, 226, 208, .55);
  box-shadow: 0 16px 36px -16px rgba(0, 0, 0, .7), 0 0 24px -8px rgba(45, 226, 208, .45); opacity: 0; pointer-events: none; transition: opacity .35s, transform .35s; }
.take-card.show { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
.take-card small, .take-box small { display: block; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #2de2d0; }
.take-card p { margin: 4px 0 0; font-size: .9rem; line-height: 1.45; font-weight: 700; }
.take-box { padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(45, 226, 208, .5); background: rgba(45, 226, 208, .06); }
.take-box p { margin: 4px 0 0; line-height: 1.5; font-weight: 700; }

/* one comparison chart: the outcome in every situation */
.mchart { display: grid; gap: 6px; margin-top: 10px; }
.mchart h4 { margin: 0 0 2px; }
.mrow { display: grid; grid-template-columns: 22px minmax(0, 1.2fr) minmax(0, 1fr) 40px; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); }
.mrow .mg { text-align: center; }
.mrow .mn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.mrow .mb { height: 8px; border-radius: 8px; background: var(--track); overflow: hidden; }
.mrow .mb i { display: block; height: 100%; border-radius: 8px; background: #5b9dff; opacity: .55; transition: opacity .3s; }
.mrow output { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.mrow.on { color: var(--text); }
.mrow.on .mb i { background: #2de2d0; opacity: 1; }
.mnote { margin: 4px 0 0; font-size: .72rem; color: var(--muted); line-height: 1.4; }

/* body map */
.body-row { display: flex; gap: 14px; align-items: center; }
.body-fig { flex: none; width: 92px; }
.body-map { width: 100%; height: auto; display: block; }
.body-map .outline * { fill: color-mix(in srgb, var(--panel-2) 80%, transparent); stroke: var(--line); stroke-width: 1.4; }
.body-map .sys { fill: #3b4a66; stroke: none; opacity: .5; }
.body-map .sys.line, .body-map .sys.line path { fill: none; stroke: #3b4a66; stroke-width: 3; stroke-linecap: round; }
.body-map .sys.on { fill: #2de2d0; opacity: 1; filter: drop-shadow(0 0 4px rgba(45, 226, 208, .8)); }
.body-map .sys.line.on, .body-map .sys.line.on path { stroke: #2de2d0; opacity: 1; }
.body-row ul { margin: 0; padding-left: 16px; display: grid; gap: 6px; font-size: .84rem; line-height: 1.4; }

/* callouts: name plus what the structure does */
.lbl.callout { flex-direction: column; align-items: flex-start; gap: 0; max-width: 220px; white-space: normal; }
.lbl.callout small { display: block; font-size: .68rem; font-weight: 600; color: var(--muted); line-height: 1.3; }
.lbl.callout small:empty { display: none; }
.lbl:not(.callout) small { display: none; }

@media (max-width: 899px) {
  /* on phones the chain sits above the play button, three compact nodes in one row */
  .stage-top .story-strip { position: absolute; left: 8px; right: 8px; top: auto; bottom: calc(var(--sheet-h, 0px) + 68px); margin: 0; flex-wrap: nowrap; justify-content: center; }
  .stage-wrap[data-vm="steps"] .stage-top .story-strip { bottom: calc(var(--sheet-h, 0px) + 116px); }
  .ss-node { max-width: 33%; padding: 5px 7px; }
  .ss-node b { font-size: .72rem; }
  .ss-node span { display: none; }
  .lbl.callout { max-width: 160px; }
  .lbl.callout small { display: none; }
  .take-card { bottom: calc(var(--sheet-h, 0px) + 66px); }
  .body-fig { width: 72px; }
}
@media (prefers-reduced-motion: reduce) { .story-strip.show { animation: none; } .take-card { transition: none; } }

@media (min-width: 900px) { .story-strip { flex-wrap: nowrap; } .ss-node { min-width: 0; flex: 0 1 auto; } .ss-node b, .ss-node span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; } .stage-top { max-width: min(62%, 640px); } }

/* ---------- v14: what changed, what if, relationship map ---------- */
.change-card { display: none; flex: none; margin: 8px 10px 0; padding: 9px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.panel[data-tab="lab"] .change-card.show { display: block; }
@media (max-width: 899px) and (min-height: 521px) { .panel.sheet-small .change-card { display: none !important; } }
.wc-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 4px; }
.wc-t { font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #2de2d0; }
.wc-head span { font-size: .74rem; color: var(--muted); }
.change-card .mnote { margin: 2px 0 0; }
.wc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 18px auto; align-items: center; gap: 8px; padding: 3px 0; font-size: .8rem; border-top: 1px dashed color-mix(in srgb, var(--line) 70%, transparent); }
.wc-row:first-of-type { border-top: 0; }
.wc-n { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wc-row.main .wc-n { color: var(--text); }
.wc-b { color: var(--muted); }
.wc-v { font-weight: 800; }
.wc-a { font-style: normal; font-weight: 900; text-align: center; color: var(--muted); }
.wc-a.up { color: #2de2d0; }
.wc-a.down { color: #ff8a7a; }

.whatif .wi-scale { display: flex; justify-content: space-between; font-size: .74rem; color: var(--muted); font-weight: 700; margin: 2px 0 4px; }
.whatif input[type="range"] { width: 100%; accent-color: #2de2d0; }

.rel-map { display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
.rel-node { padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); font-size: .82rem; font-weight: 700; line-height: 1.35; }
.rel-node.first { border-color: rgba(91, 157, 255, .6); }
.rel-node.last { border-color: rgba(45, 226, 208, .6); color: var(--text); }
.rel-arrow { align-self: center; font-style: normal; font-weight: 900; color: var(--muted); line-height: 1; }

/* ---------- v15 ---------- */
.hud-chip.hud-title { display: none; }

/* the cause chain now lives at the top of the options panel */
.panel .story-strip { margin: 8px 10px 0; flex: none; flex-wrap: nowrap; gap: 5px; }
.panel .story-strip .ss-node { flex: 1 1 0; min-width: 0; max-width: none; padding: 6px 8px; background: var(--panel-2); backdrop-filter: none; }
.panel .story-strip .ss-node b { font-size: .76rem; }
.panel .story-strip .ss-node span { font-size: .68rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.panel:not([data-tab="lab"]):not([data-tab="lesson"]) .story-strip { display: none !important; }
@media (max-width: 899px) and (min-height: 521px) { .panel.sheet-small .story-strip { display: none !important; } .panel .story-strip .ss-node span { display: none; } }

/* "what will you learn?": a light purple panel beside the open topic list */
.learn-panel { position: fixed; z-index: 79; top: 50%; left: calc(min(420px, 92vw) + 28px); width: min(520px, calc(100vw - min(420px, 92vw) - 56px)); max-height: calc(100vh - 48px); overflow: auto;
  border-radius: 24px; color: #2a1d4f; background: linear-gradient(145deg, #f6f1ff 0%, #e6dcff 42%, #d2c2ff 100%);
  box-shadow: 0 30px 70px -24px rgba(60, 30, 140, .6), inset 0 1px 0 rgba(255, 255, 255, .8); border: 1px solid rgba(255, 255, 255, .7);
  opacity: 0; transform: translate(-16px, -50%) scale(.98); pointer-events: none; transition: opacity .35s ease .08s, transform .45s cubic-bezier(.2, .8, .2, 1) .08s; }
.learn-panel.open { opacity: 1; transform: translate(0, -50%); pointer-events: auto; }
.lp-glow { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
.lp-glow i { position: absolute; width: 240px; height: 240px; border-radius: 50%; filter: blur(40px); opacity: .55; animation: lpFloat 12s ease-in-out infinite alternate; }
.lp-glow i:nth-child(1) { background: #b79bff; top: -80px; right: -60px; }
.lp-glow i:nth-child(2) { background: #8fd3ff; bottom: -90px; left: -70px; animation-delay: -4s; }
.lp-glow i:nth-child(3) { background: #ffc2ea; top: 40%; left: 45%; width: 160px; height: 160px; opacity: .35; animation-delay: -8s; }
@keyframes lpFloat { from { transform: translate(0, 0) scale(1); } to { transform: translate(-30px, 24px) scale(1.12); } }
.lp-body { position: relative; padding: 26px 26px 22px; }
.learn-panel h3 { margin: 0; font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; color: #2a1760; }
.lp-sub { margin: 6px 0 14px; font-size: .9rem; color: #5a4a86; font-weight: 600; }
.lp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.lp-list button { width: 100%; display: flex; align-items: flex-start; gap: 10px; text-align: left; padding: 9px 12px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .8); cursor: pointer;
  background: rgba(255, 255, 255, .55); color: #2a1d4f; font-size: .86rem; font-weight: 600; line-height: 1.4; box-shadow: 0 2px 0 rgba(120, 90, 200, .18);
  transition: transform .15s, background .15s, box-shadow .15s; }
.lp-list button:hover { background: rgba(255, 255, 255, .85); transform: translateY(-1px); box-shadow: 0 6px 16px -8px rgba(90, 50, 190, .45); }
.lp-g { flex: none; font-size: 1.2rem; line-height: 1.2; }
.learn-panel h4 { margin: 16px 0 6px; font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #6a4fc0; }
.lp-how { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: .84rem; color: #3b2d66; font-weight: 600; }
@media (max-width: 899px) { .learn-panel { display: none; } }

/* phones: the same content folded inside the topic list */
.learn-mini { margin: -2px 16px 10px; border-radius: 12px; border: 1px solid rgba(183, 155, 255, .5); background: linear-gradient(145deg, rgba(246, 241, 255, .1), rgba(183, 155, 255, .14)); font-size: .84rem; }
.learn-mini summary { list-style: none; cursor: pointer; padding: 9px 12px; font-weight: 800; color: #c9b6ff; display: flex; }
.learn-mini summary::-webkit-details-marker { display: none; }
.learn-mini summary::after { content: "+"; margin-left: auto; }
.learn-mini[open] summary::after { content: "\2212"; }
.learn-in .lp-body { padding: 0 12px 12px; }
.learn-in .lp-sub { margin: 0 0 8px; color: var(--muted); font-size: .8rem; }
.learn-in .lp-list button { background: var(--panel-2); color: var(--text); border-color: var(--line); box-shadow: none; font-size: .8rem; }
.learn-in h4 { margin: 12px 0 4px; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: #c9b6ff; }
.learn-in .lp-how { margin: 0; padding-left: 18px; font-size: .8rem; display: grid; gap: 3px; }
@media (min-width: 900px) { .learn-mini { display: none; } }
@media (prefers-reduced-motion: reduce) { .lp-glow i { animation: none; } .learn-panel { transition: opacity .2s; } }

/* ---------- v16: author, sidebar top row, settings ---------- */
/* landing: the author is clearly visible */
.author-card { display: flex; align-items: center; gap: 14px; margin-top: 18px; padding: 12px 16px 12px 12px; border-radius: 16px; width: fit-content; max-width: 100%;
  background: linear-gradient(135deg, color-mix(in srgb, var(--b1) 18%, var(--panel)), var(--panel)); border: 1px solid color-mix(in srgb, var(--b1) 45%, var(--line));
  box-shadow: 0 10px 26px -14px color-mix(in srgb, var(--b2) 80%, transparent); }
.author-card .av, .tb-author .av { flex: none; display: grid; place-items: center; border-radius: 50%; font-weight: 900; color: #fff; letter-spacing: .02em;
  background: linear-gradient(135deg, var(--b1), var(--b2)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--b1) 30%, transparent); }
.author-card .av { width: 54px; height: 54px; font-size: 1.15rem; }
.author-card small { display: block; font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.author-card b { display: block; font-size: 1.45rem; font-weight: 800; line-height: 1.15; color: var(--text); }
.author-card .ac-site { display: block; margin-top: 2px; font-size: .86rem; color: var(--muted); font-weight: 600; }

/* top bar: author on the right */
.tb-author { display: flex; align-items: center; gap: 9px; font-size: .88rem; color: var(--muted); white-space: nowrap; }
.tb-author .av { width: 30px; height: 30px; font-size: .72rem; }
.tb-author b { color: var(--text); font-weight: 800; }
@media (max-width: 640px) { .tb-author .tx { display: none; } }

/* sidebar: main menu key as wide as the search bar, with the close button */
.sb-top { display: flex; align-items: center; gap: 8px; padding: 10px 16px 6px; }
.sb-top .sb-home { flex: 1; height: 44px; justify-content: center; font-size: .92rem; }
.sb-top .sb-home[style*="none"] + .sb-x { margin-left: auto; }
.sb-top .sb-x { flex: none; width: 44px; height: 44px; }

/* settings key at the end of the topic list, in its own colour */
.settings-key { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin: 14px 0 6px; min-height: 52px; border: 0; border-radius: 14px; cursor: pointer;
  font-weight: 800; font-size: .95rem; color: #2a1760; background: linear-gradient(135deg, #f1e9ff, #d4c4ff 60%, #bfaaff);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 4px 0 #8f78d6, 0 10px 18px -8px rgba(90, 60, 190, .55); transition: transform .12s, box-shadow .12s; }
.settings-key:active { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 1px 0 #8f78d6; }
.settings-key svg.i { width: 20px; height: 20px; }

/* settings screen slides over the topic list */
.settings { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; background: var(--panel); transform: translateX(-100%); visibility: hidden;
  transition: transform .3s var(--ease, cubic-bezier(.2, .8, .2, 1)), visibility 0s linear .3s; }
.settings.open { transform: none; visibility: visible; transition: transform .3s var(--ease, cubic-bezier(.2, .8, .2, 1)); }
.set-head { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); }
.set-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 1.1rem; }
.set-head h3 svg.i { width: 20px; height: 20px; color: #b79bff; }
.set-head .tb-btn span { display: inline !important; }
.set-body { flex: 1; overflow-y: auto; padding: 8px 16px 20px; display: grid; gap: 16px; align-content: start; }
.set-sec h5 { margin: 0 0 8px; font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.set-sec .seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.set-sec .seg:has(> :nth-child(2):last-child) { grid-template-columns: 1fr 1fr; }
.set-sec .seg.four { grid-template-columns: repeat(4, 1fr); }
.set-sec .seg .btn3d { min-height: 40px; }
.pal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pal { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border-radius: 14px; border: 2px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; font-weight: 700; font-size: .8rem; }
.pal i { width: 38px; height: 38px; border-radius: 50%; box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 4px 10px -4px rgba(0,0,0,.5); }
.pal[aria-pressed="true"] { border-color: var(--b1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--b1) 30%, transparent); }

/* ---------- v17: opening slides (main page, author page) ---------- */
.slides { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.slide-track { display: flex; width: 200%; height: 100%; transition: transform .9s cubic-bezier(.65, 0, .25, 1); will-change: transform; }
.slide-track > .slide { flex: 0 0 50%; width: 50%; max-width: none; margin: 0; height: 100%; overflow-y: auto; overflow-x: hidden; }
.slide-track > .landing { padding-inline: max(clamp(14px, 4vw, 56px), calc((50% - 1240px) / 2)); padding-bottom: 64px; }

/* small previous / next keys and dots */
.slide-nav { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 80%, transparent); border: 1px solid var(--line); backdrop-filter: blur(8px); }
.snav { width: 30px; height: 30px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; color: var(--text); background: var(--panel-2); }
.snav:hover { background: color-mix(in srgb, var(--b1) 30%, var(--panel-2)); }
.snav svg.i { width: 16px; height: 16px; }
.sdot { width: 9px; height: 9px; padding: 0; border: 0; border-radius: 99px; background: var(--track); cursor: pointer; transition: width .3s, background .3s; }
.sdot[aria-pressed="true"] { width: 26px; background: linear-gradient(90deg, var(--b1), var(--b2)); }

/* author page */
.bio { position: relative; display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); align-items: center; gap: clamp(20px, 5vw, 70px);
  padding: clamp(18px, 5vw, 70px) max(clamp(16px, 5vw, 70px), calc((50% - 1180px) / 2)) 80px;
  background: radial-gradient(50% 60% at 28% 45%, color-mix(in srgb, var(--b1) 22%, transparent), transparent 70%), radial-gradient(40% 50% at 80% 30%, rgba(165, 139, 255, .14), transparent 70%); }
.bio-stars { position: absolute; inset: 0; pointer-events: none; opacity: .55;
  background-image: radial-gradient(1px 1px at 12% 20%, #fff, transparent 60%), radial-gradient(1px 1px at 80% 14%, #cfe0ff, transparent 60%), radial-gradient(1.4px 1.4px at 64% 78%, #fff, transparent 60%),
    radial-gradient(1px 1px at 30% 86%, #cfe0ff, transparent 60%), radial-gradient(1px 1px at 92% 60%, #fff, transparent 60%), radial-gradient(1.2px 1.2px at 46% 10%, #fff, transparent 60%);
  animation: bioTwinkle 6s ease-in-out infinite alternate; }
@keyframes bioTwinkle { from { opacity: .35; } to { opacity: .7; } }
.bio-photo { position: relative; justify-self: center; width: min(420px, 78%); aspect-ratio: 1; animation: bioFloat 7s ease-in-out infinite; }
.bio-photo img { position: relative; z-index: 2; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block;
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .8); }
.bio-photo .ring { position: absolute; inset: -10px; z-index: 1; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 20%, var(--b1) 35%, #b9e2ff 45%, transparent 60% 80%, var(--b2) 92%, transparent);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px)); mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  animation: bioSpin 9s linear infinite; filter: drop-shadow(0 0 8px var(--b1)); }
.bio-photo .halo { position: absolute; inset: -18%; z-index: 0; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--b1) 38%, transparent), transparent);
  animation: bioPulse 5s ease-in-out infinite; }
@keyframes bioFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes bioSpin { to { transform: rotate(360deg); } }
@keyframes bioPulse { 0%, 100% { opacity: .55; transform: scale(.96); } 50% { opacity: .9; transform: scale(1.03); } }

.bio-text { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.bio-kicker { font-size: .8rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.bio-text h2 { margin: 0; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.05; font-weight: 800; letter-spacing: -.02em;
  background: linear-gradient(90deg, var(--text), color-mix(in srgb, var(--b1) 70%, var(--text))); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bio-role { margin: 0; font-size: clamp(1.05rem, 2vw, 1.3rem); font-weight: 700; color: var(--text); }
.bio-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.bio-tags span { padding: 6px 12px; border-radius: 999px; font-size: .84rem; font-weight: 700; color: var(--text);
  background: color-mix(in srgb, var(--b1) 16%, var(--panel)); border: 1px solid color-mix(in srgb, var(--b1) 45%, var(--line)); }
.bio-about { margin: 4px 0 6px; max-width: 34em; color: var(--muted); line-height: 1.55; font-size: .98rem; }

/* the text slides in each time the author page appears */
.bio-text > * { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .7s cubic-bezier(.2, .8, .2, 1); }
.bio.in .bio-text > * { opacity: 1; transform: none; }
.bio.in .bio-text > :nth-child(2) { transition-delay: .1s; } .bio.in .bio-text > :nth-child(3) { transition-delay: .2s; }
.bio.in .bio-text > :nth-child(4) { transition-delay: .3s; } .bio.in .bio-text > :nth-child(5) { transition-delay: .4s; } .bio.in .bio-text > :nth-child(6) { transition-delay: .5s; }

@media (max-width: 899px) {
  .bio { grid-template-columns: 1fr; align-content: start; text-align: center; gap: 18px; padding-top: 24px; }
  .bio-photo { width: min(240px, 62vw); }
  .bio-text { align-items: center; }
  .bio-tags { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .slide-track { transition: none; }
  .bio-photo, .bio-photo .ring, .bio-photo .halo, .bio-stars { animation: none; }
  .bio-text > * { opacity: 1; transform: none; transition: none; }
}

.slides { overflow: clip; }
.slide-track > .slide { overflow-x: clip; }

/* ---------- v18: "what will you learn?" as a full dark screen beside the topic list ---------- */
.tb-author .av { display: none; }
@media (max-width: 640px) { .tb-author .tx { display: inline; font-size: .78rem; } .tb-author .tx-l { display: none; } }

.learn-panel { top: 0; bottom: 0; right: 0; left: min(420px, 92vw); width: auto; max-height: none; transform: none; border-radius: 0; border: 0; box-shadow: none; overflow: auto;
  display: flex; flex-direction: column; gap: clamp(16px, 2.6vh, 28px); padding: clamp(28px, 5vh, 56px) clamp(24px, 4vw, 64px);
  color: #fff; background: radial-gradient(60% 50% at 70% 0%, rgba(45, 180, 255, .10), transparent 70%), radial-gradient(50% 60% at 10% 100%, rgba(45, 226, 208, .07), transparent 70%), #05070d;
  transition: opacity .4s ease; }
.learn-panel.open { transform: none; }
.lx-close { position: absolute; top: 18px; right: 18px; width: 44px; height: 44px; border-radius: 12px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.04); color: #fff; display: grid; place-items: center; cursor: pointer; }
.lx-close:hover { background: rgba(255,255,255,.1); }
.lx-head h2 { margin: 0; font-size: clamp(2rem, 3.6vw, 3.2rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.08; color: #fff; }
.lx-head p { margin: 10px 0 0; font-size: clamp(1rem, 1.4vw, 1.2rem); font-weight: 700; letter-spacing: .04em; color: #6fd8ff; }
.lx-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: clamp(12px, 1.6vw, 22px); }

.lx-card { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: clamp(12px, 1.8vw, 26px); min-height: 150px; padding: clamp(18px, 2.4vw, 32px);
  text-align: left; color: #fff; cursor: pointer; border-radius: 22px; border: 1px solid rgba(111, 216, 255, .14);
  background: linear-gradient(160deg, rgba(20, 34, 60, .9), rgba(8, 13, 24, .95)); transition: transform .25s ease, border-color .25s, box-shadow .25s; --spd: 1; }
.lx-card:hover, .lx-card:focus-visible { transform: translateY(-4px); border-color: rgba(111, 216, 255, .5); box-shadow: 0 18px 40px -20px rgba(45, 200, 255, .55), 0 0 0 1px rgba(111, 216, 255, .2); --spd: .5; outline: none; }
.lx-n { align-self: start; font-size: clamp(2rem, 3.4vw, 3.2rem); font-weight: 800; line-height: .9; letter-spacing: -.03em;
  background: linear-gradient(180deg, #6fd8ff, #2d7fe0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lx-txt { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lx-txt b { font-size: clamp(1.2rem, 1.9vw, 1.7rem); font-weight: 800; line-height: 1.15; }
.lx-d { font-size: clamp(.92rem, 1.1vw, 1.05rem); color: #c6d3ea; line-height: 1.4; }
.lx-txt small { font-size: .8rem; color: #6fd8ff; opacity: .85; line-height: 1.35; }

/* one quiet preview per card */
.lx-pv { width: clamp(76px, 8vw, 118px); aspect-ratio: 1; display: grid; place-items: center; opacity: .9; }
.pv { position: relative; width: 100%; height: 100%; display: grid; place-items: center; }
.pv-brain img { width: 70%; filter: drop-shadow(0 0 14px rgba(45, 180, 255, .55)); animation: pvFloat calc(4s * var(--spd)) ease-in-out infinite; }
.pv-brain .orb { position: absolute; inset: 6%; border-radius: 50%; border: 1.5px solid rgba(111, 216, 255, .35); border-top-color: #6fd8ff; animation: pvSpin calc(6s * var(--spd)) linear infinite; }
.pv-ar { perspective: 300px; }
.pv-ar .cube { position: relative; width: 44%; aspect-ratio: 1; transform-style: preserve-3d; animation: pvCube calc(8s * var(--spd)) linear infinite; }
.pv-ar .cube i { position: absolute; inset: 0; border: 1.5px solid #6fd8ff; background: rgba(45, 180, 255, .08); }
.pv-ar .cube i:nth-child(1) { transform: translateZ(26px); } .pv-ar .cube i:nth-child(2) { transform: rotateY(180deg) translateZ(26px); }
.pv-ar .cube i:nth-child(3) { transform: rotateY(90deg) translateZ(26px); } .pv-ar .cube i:nth-child(4) { transform: rotateY(-90deg) translateZ(26px); }
.pv-ar .cube i:nth-child(5) { transform: rotateX(90deg) translateZ(26px); } .pv-ar .cube i:nth-child(6) { transform: rotateX(-90deg) translateZ(26px); }
.pv-ar .floor { position: absolute; bottom: 8%; width: 70%; height: 14%; border-radius: 50%; border: 1.5px dashed rgba(111, 216, 255, .5); }
.pv-test { display: flex; flex-direction: column; gap: 9%; width: 78%; }
.pv-test span { position: relative; height: 18%; min-height: 12px; border-radius: 8px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .1); }
.pv-test span.ok { border-color: #2de2d0; background: rgba(45, 226, 208, .14); animation: pvOk calc(3s * var(--spd)) ease-in-out infinite; }
.pv-test span.ok::after { content: "\2713"; position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: .8rem; font-weight: 900; color: #2de2d0; }
.pv-chart { display: flex; align-items: flex-end; justify-content: space-between; width: 80%; height: 70%; }
.pv-chart i { width: 16%; border-radius: 5px 5px 0 0; background: linear-gradient(180deg, #6fd8ff, #2d7fe0); transform-origin: bottom; animation: pvBar calc(2.6s * var(--spd)) ease-in-out infinite alternate; }
.pv-chart i:nth-child(1) { height: 30%; } .pv-chart i:nth-child(2) { height: 55%; animation-delay: -.6s; } .pv-chart i:nth-child(3) { height: 42%; animation-delay: -1.2s; } .pv-chart i:nth-child(4) { height: 85%; animation-delay: -1.8s; }
.pv-chart svg { position: absolute; inset: 15% 10%; width: 80%; height: 70%; overflow: visible; }
.pv-chart polyline { fill: none; stroke: #2de2d0; stroke-width: 2; vector-effect: non-scaling-stroke; }
@keyframes pvFloat { 50% { transform: translateY(-6px) rotate(-4deg); } }
@keyframes pvSpin { to { transform: rotate(360deg); } }
@keyframes pvCube { from { transform: rotateX(-20deg) rotateY(0); } to { transform: rotateX(-20deg) rotateY(360deg); } }
@keyframes pvOk { 0%, 100% { box-shadow: 0 0 0 0 rgba(45, 226, 208, 0); } 50% { box-shadow: 0 0 14px 0 rgba(45, 226, 208, .45); } }
@keyframes pvBar { from { transform: scaleY(.55); } to { transform: scaleY(1); } }

/* short screens: the page itself scrolls, never a small inner box */
@media (max-height: 640px) { .lx-grid { grid-template-rows: none; } }
@media (min-width: 900px) and (max-width: 1150px) { .lx-card { grid-template-columns: auto 1fr; } .lx-pv { display: none; } }

/* phones: the same four cards, one column, inside the topic list */
.learn-in { display: grid; gap: 8px; padding: 0 10px 12px; }
.learn-in .lx-card { min-height: 0; grid-template-columns: auto 1fr; padding: 14px; border-radius: 16px; gap: 12px; }
.learn-in .lx-pv { display: none; }
.learn-in .lx-n { font-size: 1.7rem; }
.learn-in .lx-txt b { font-size: 1.05rem; }
.learn-in .lx-d { font-size: .86rem; }
.learn-mini { background: #05070d; border-color: rgba(111, 216, 255, .25); }
.learn-mini summary { color: #6fd8ff; }
.ar-help.flash { box-shadow: 0 0 0 2px #6fd8ff, 0 0 24px rgba(111, 216, 255, .5); transition: box-shadow .3s; }
@media (prefers-reduced-motion: reduce) { .lx-pv * { animation: none !important; } .lx-card { transition: none; } }

/* number above the title, so the text gets the full card width */
.lx-card { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto 1fr; align-items: start; row-gap: 10px; }
.lx-card .lx-n { grid-column: 1; grid-row: 1; }
.lx-card .lx-txt { grid-column: 1; grid-row: 2; }
.lx-card .lx-pv { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.pv-test { height: 64%; justify-content: center; }
.pv-test span { flex: 1; min-height: 0; height: auto; }
@media (min-width: 900px) and (max-width: 1150px) { .lx-card { grid-template-columns: minmax(0, 1fr); } }
.learn-in .lx-card { grid-template-columns: minmax(0, 1fr); }
.pv-test { align-items: stretch; place-items: stretch; }

/* ---------- v19: the chosen colour runs through the whole interface as soft gradients ---------- */
body { background:
    radial-gradient(70% 55% at 0% 0%, color-mix(in srgb, var(--b1) 13%, transparent), transparent 70%),
    radial-gradient(60% 50% at 100% 100%, color-mix(in srgb, var(--b2) 11%, transparent), transparent 70%),
    var(--bg); background-attachment: fixed; }
.topbar { background: linear-gradient(90deg, color-mix(in srgb, var(--b1) 16%, var(--bg-2)), var(--bg-2) 55%, color-mix(in srgb, var(--b2) 10%, var(--bg-2))); border-bottom-color: color-mix(in srgb, var(--b1) 22%, var(--line)); }
.sidebar { background: linear-gradient(180deg, color-mix(in srgb, var(--b1) 12%, var(--panel)), var(--panel) 45%, color-mix(in srgb, var(--b2) 8%, var(--panel))); border-right-color: color-mix(in srgb, var(--b1) 25%, var(--line)); }
.settings { background: linear-gradient(180deg, color-mix(in srgb, var(--b1) 12%, var(--panel)), var(--panel) 60%); }
.panel { background: linear-gradient(180deg, color-mix(in srgb, var(--b1) 9%, var(--panel)), var(--panel) 40%); border-color: color-mix(in srgb, var(--b1) 22%, var(--line)); }
.panel-head { background: linear-gradient(90deg, color-mix(in srgb, var(--b1) 14%, var(--panel-2)), var(--panel-2)); }
.topic:hover, .topic:focus-visible { border-color: color-mix(in srgb, var(--b1) 55%, var(--line)); }
.sb-cat { color: color-mix(in srgb, var(--b1) 55%, var(--muted)); }
.searchbox input:focus { border-color: var(--b1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--b1) 22%, transparent); }
.stage-wrap { background:
    radial-gradient(60% 55% at 22% 18%, color-mix(in srgb, var(--b1) 22%, transparent), transparent 70%),
    radial-gradient(55% 55% at 82% 78%, color-mix(in srgb, var(--b2) 18%, transparent), transparent 70%),
    var(--stage); }
.landing-stage { background: radial-gradient(60% 55% at 30% 25%, color-mix(in srgb, var(--b1) 24%, transparent), transparent 70%), radial-gradient(55% 55% at 80% 80%, color-mix(in srgb, var(--b2) 20%, transparent), transparent 70%), var(--stage); }
.tab-body::-webkit-scrollbar-thumb, .panes::-webkit-scrollbar-thumb, .sb-list::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--b1) 40%, var(--track)); }
.lesson-card { border-left-color: var(--b1); }
.chip[aria-pressed="true"], .vm-key[aria-pressed="true"] { background: linear-gradient(180deg, var(--b1), var(--b2)); }
.pal-save { margin-top: 10px; }
.pal-save:disabled { opacity: .45; cursor: default; }
.pal-grid { grid-template-columns: repeat(4, 1fr); }
.pal { padding: 8px 4px; font-size: .74rem; }
.pal i { width: 34px; height: 34px; }

/* "what will you learn?": a light screen in the chosen colour, clearly different from the rest at a glance */
.learn-panel { color: #10192e; background:
    radial-gradient(60% 55% at 85% 0%, color-mix(in srgb, var(--b1) 35%, transparent), transparent 70%),
    radial-gradient(55% 60% at 0% 100%, color-mix(in srgb, var(--b2) 22%, transparent), transparent 70%),
    linear-gradient(160deg, color-mix(in srgb, var(--b1) 14%, #ffffff), color-mix(in srgb, var(--b2) 10%, #f1f4fa)); }
.learn-panel .lx-head h2 { color: #0d1628; }
.learn-panel .lx-head p { color: var(--b2); }
.learn-panel .lx-close { color: #10192e; border-color: color-mix(in srgb, var(--b2) 30%, transparent); background: rgba(255, 255, 255, .6); }
.learn-panel .lx-close:hover { background: #fff; }
.learn-panel .lx-card { color: #10192e; border-color: color-mix(in srgb, var(--b1) 28%, transparent);
  background: linear-gradient(160deg, rgba(255, 255, 255, .92), color-mix(in srgb, var(--b1) 8%, #ffffff)); box-shadow: 0 10px 30px -22px color-mix(in srgb, var(--b2) 70%, transparent); }
.learn-panel .lx-card:hover, .learn-panel .lx-card:focus-visible { border-color: var(--b1); box-shadow: 0 22px 44px -22px color-mix(in srgb, var(--b2) 80%, transparent), 0 0 0 1px color-mix(in srgb, var(--b1) 40%, transparent); }
.learn-panel .lx-n { background: linear-gradient(180deg, var(--b1), var(--b2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.learn-panel .lx-d { color: #3a465e; }
.learn-panel .lx-txt small { color: var(--b2); opacity: 1; font-weight: 700; }
/* previews in the chosen colour */
.learn-panel .pv-brain .orb { border-color: color-mix(in srgb, var(--b1) 35%, transparent); border-top-color: var(--b2); }
.learn-panel .pv-ar .cube i { border-color: var(--b2); background: color-mix(in srgb, var(--b1) 12%, transparent); }
.learn-panel .pv-ar .floor { border-color: color-mix(in srgb, var(--b2) 60%, transparent); }
.learn-panel .pv-test span { background: color-mix(in srgb, var(--b1) 8%, #fff); border-color: color-mix(in srgb, var(--b1) 25%, transparent); }
.learn-panel .pv-test span.ok { border-color: var(--b2); background: color-mix(in srgb, var(--b1) 18%, #fff); }
.learn-panel .pv-test span.ok::after { color: var(--b2); }
.learn-panel .pv-chart i { background: linear-gradient(180deg, var(--b1), var(--b2)); }
.learn-panel .pv-chart polyline { stroke: var(--bedge); }
/* the phone version in the list follows the same light look */
.learn-mini { background: linear-gradient(160deg, color-mix(in srgb, var(--b1) 14%, #ffffff), color-mix(in srgb, var(--b2) 10%, #f1f4fa)); border-color: color-mix(in srgb, var(--b1) 35%, transparent); }
.learn-mini summary { color: #10192e; }
.learn-in .lx-card { color: #10192e; background: rgba(255, 255, 255, .85); border-color: color-mix(in srgb, var(--b1) 28%, transparent); }
.learn-in .lx-n { background: linear-gradient(180deg, var(--b1), var(--b2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.learn-in .lx-d { color: #3a465e; }
.learn-in .lx-txt small { color: var(--b2); }

/* ---------- v20: colour key for the brain parts ---------- */
.brain-key { position: absolute; z-index: 3; left: 14px; top: 14px; max-width: 220px; padding: 8px 12px; border-radius: 12px; font-size: .76rem;
  background: color-mix(in srgb, var(--panel) 72%, transparent); border: 1px solid var(--line); backdrop-filter: blur(8px); }
.brain-key summary { cursor: pointer; list-style: none; font-weight: 800; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.brain-key summary::-webkit-details-marker { display: none; }
.brain-key summary::after { content: "+"; margin-left: auto; }
.brain-key[open] summary::after { content: "\2212"; }
.brain-key ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.brain-key li { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); }
.brain-key li i { flex: none; width: 16px; height: 10px; border-radius: 4px; box-shadow: 0 0 0 1px rgba(255,255,255,.15); }
.brain-key p { margin: 6px 0 0; color: var(--muted); font-size: .68rem; line-height: 1.35; }
.stage-wrap[data-vm="steps"] .brain-key { top: 14px; }
@media (max-width: 899px) { .brain-key { left: 8px; top: 8px; max-width: 180px; } }

/* ---------- v21: "original design": the look before colour themes (plain surfaces, dark learning screen) ---------- */
:root[data-plain] body { background: var(--bg); }
:root[data-plain] .topbar { background: var(--bg-2); border-bottom-color: var(--line); }
:root[data-plain] .sidebar, :root[data-plain] .settings { background: var(--panel); border-right-color: var(--line); }
:root[data-plain] .panel { background: var(--panel); border-color: var(--line); }
:root[data-plain] .panel-head { background: var(--panel-2); }
:root[data-plain] .sb-cat { color: var(--muted); }
:root[data-plain] .stage-wrap { background: radial-gradient(60% 55% at 22% 18%, rgba(91, 157, 255, .20), transparent 70%), radial-gradient(55% 55% at 82% 78%, rgba(165, 139, 255, .18), transparent 70%), radial-gradient(45% 45% at 70% 12%, rgba(45, 212, 191, .10), transparent 70%), var(--stage); }
:root[data-plain] .landing-stage { background: radial-gradient(60% 55% at 30% 25%, rgba(91, 157, 255, .22), transparent 70%), radial-gradient(55% 55% at 80% 80%, rgba(165, 139, 255, .2), transparent 70%), var(--stage); }
:root[data-plain] .learn-panel { color: #fff; background: radial-gradient(60% 50% at 70% 0%, rgba(45, 180, 255, .10), transparent 70%), radial-gradient(50% 60% at 10% 100%, rgba(45, 226, 208, .07), transparent 70%), #05070d; }
:root[data-plain] .learn-panel .lx-head h2 { color: #fff; }
:root[data-plain] .learn-panel .lx-head p { color: #6fd8ff; }
:root[data-plain] .learn-panel .lx-close { color: #fff; border-color: rgba(255,255,255,.14); background: rgba(255,255,255,.04); }
:root[data-plain] .learn-panel .lx-card { color: #fff; border-color: rgba(111, 216, 255, .14); background: linear-gradient(160deg, rgba(20, 34, 60, .9), rgba(8, 13, 24, .95)); box-shadow: none; }
:root[data-plain] .learn-panel .lx-card:hover { border-color: rgba(111, 216, 255, .5); box-shadow: 0 18px 40px -20px rgba(45, 200, 255, .55), 0 0 0 1px rgba(111, 216, 255, .2); }
:root[data-plain] .learn-panel .lx-n { background: linear-gradient(180deg, #6fd8ff, #2d7fe0); -webkit-background-clip: text; background-clip: text; }
:root[data-plain] .learn-panel .lx-d { color: #c6d3ea; }
:root[data-plain] .learn-panel .lx-txt small { color: #6fd8ff; }
:root[data-plain] .learn-panel .pv-ar .cube i { border-color: #6fd8ff; background: rgba(45, 180, 255, .08); }
:root[data-plain] .learn-panel .pv-test span { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.1); }
:root[data-plain] .learn-panel .pv-test span.ok { border-color: #2de2d0; background: rgba(45, 226, 208, .14); }
:root[data-plain] .learn-panel .pv-chart polyline { stroke: #2de2d0; }
:root[data-plain] .learn-mini { background: #05070d; border-color: rgba(111, 216, 255, .25); }
:root[data-plain] .learn-mini summary { color: #6fd8ff; }
:root[data-plain] .learn-in .lx-card { color: #fff; background: linear-gradient(160deg, rgba(20, 34, 60, .9), rgba(8, 13, 24, .95)); border-color: rgba(111, 216, 255, .14); }
:root[data-plain] .learn-in .lx-d { color: #c6d3ea; }
:root[data-plain] .learn-in .lx-txt small { color: #6fd8ff; }
.pal[data-pal="original"] i { background: conic-gradient(from 200deg, #5f7cab, #2f7ede, #6884b0, #5f7cab) !important; }

/* ---------- v22: scene / brain switch ---------- */
.view-switch { position: absolute; z-index: 4; left: 14px; top: 14px; display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 75%, transparent); border: 1px solid var(--line); backdrop-filter: blur(8px); }
.vs-key { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border: 0; border-radius: 10px; cursor: pointer; font-weight: 800; font-size: .84rem;
  color: var(--text); background: transparent; transition: background .2s, color .2s; }
.vs-key svg.i { width: 18px; height: 18px; }
.vs-key[aria-pressed="true"] { color: #fff; background: linear-gradient(180deg, var(--b1), var(--b2)); box-shadow: 0 2px 0 var(--bedge); }
.scene-cap { position: absolute; z-index: 3; left: 14px; bottom: calc(var(--sheet-h, 0px) + 16px); max-width: min(420px, 55%); margin: 0; padding: 8px 12px; border-radius: 10px;
  font-size: .76rem; line-height: 1.4; color: var(--muted); background: color-mix(in srgb, var(--panel) 75%, transparent); border: 1px solid var(--line); backdrop-filter: blur(6px); }
.scene-cap:empty { display: none; }
.stage-wrap[data-view="scene"] .stage-play { left: auto; right: 16px; transform: none; }
@media (max-width: 899px) {
  .view-switch { left: 8px; top: 8px; }
  .vs-key { height: 32px; padding: 0 10px; font-size: .78rem; }
  .scene-cap { left: 8px; right: 8px; max-width: none; bottom: calc(var(--sheet-h, 0px) + 66px); font-size: .7rem; }
}

/* ---------- v23: bigger simple fact, clear "was → now" rows ---------- */
.scene-cap { max-width: min(540px, 62%); padding: 12px 16px; font-size: .95rem; line-height: 1.5; color: var(--text); font-weight: 600;
  background: color-mix(in srgb, var(--panel) 86%, transparent); border: 1px solid color-mix(in srgb, var(--b1) 35%, var(--line)); border-radius: 14px;
  box-shadow: 0 12px 28px -16px rgba(0, 0, 0, .7); }
@media (max-width: 899px) { .scene-cap { font-size: .82rem; padding: 10px 12px; } }
.wc-cols { display: grid; grid-template-columns: minmax(0, 1fr) auto 104px; gap: 10px; font-size: .66rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 2px 0; }
.wc-row { grid-template-columns: minmax(0, 1fr) auto 104px !important; gap: 10px !important; padding: 5px 0 !important; }
.wc-ch { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.wc-ch b { color: var(--text); font-weight: 800; }
.wc-tag { justify-self: start; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 800; white-space: nowrap; }
.wc-tag.up { color: #2de2d0; background: rgba(45, 226, 208, .12); }
.wc-tag.down { color: #ffb86b; background: rgba(255, 184, 107, .13); }
.wc-tag.same { color: var(--muted); background: var(--panel-2); }

/* offline mode box in settings */
.off-box { display: grid; gap: 8px; }
.off-status { margin: 0; font-size: .86rem; font-weight: 700; }
.off-status.good { color: #3ecf8e; }
.off-status.bad { color: #ffb86b; }
.off-bar { height: 8px; border-radius: 8px; background: var(--track); overflow: hidden; margin-top: 6px; }
.off-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--b1), var(--b2)); transition: width .2s; }

/* ---------- v24: one summary card on the brain view, scene-to-brain transition, scene shows no charts ---------- */
.take-card { display: none; }
.sum-card { position: absolute; z-index: 4; left: 14px; bottom: calc(var(--sheet-h, 0px) + 16px); width: min(460px, 58%); padding: 10px 14px 12px; border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 90%, transparent); border: 1px solid color-mix(in srgb, var(--b1) 45%, var(--line)); backdrop-filter: blur(8px);
  box-shadow: 0 14px 30px -16px rgba(0, 0, 0, .7); color: var(--text); }
.stage-wrap[data-view="scene"] .sum-card { display: none; }
.sum-head { all: unset; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; }
.sum-head small { font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--b1, #2de2d0); }
.sum-head i { width: 16px; height: 16px; opacity: .6; display: grid; place-items: center; }
.sum-head i svg { width: 14px; height: 14px; }
.sum-head:focus-visible { outline: 2px solid var(--b1); outline-offset: 3px; border-radius: 6px; }
.sum-main { margin: 6px 0 0; font-size: .95rem; line-height: 1.45; font-weight: 700; }
.sum-ex { margin: 6px 0 0; font-size: .85rem; line-height: 1.45; color: var(--muted); }
.sum-ex b { color: var(--text); }
.sum-card.folded { width: auto; padding: 8px 12px; }
.sum-card.flash { animation: sumFlash 1.6s ease-out 1; }
@keyframes sumFlash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--b1) 70%, transparent); } 60% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 14px 30px -16px rgba(0, 0, 0, .7); } }

.xfade { position: absolute; inset: 0; z-index: 7; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .5s ease;
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--b1) 25%, #05060d) 0%, #05060d 75%); }
.xfade span { color: #fff; font-weight: 800; font-size: clamp(1rem, 2.4vw, 1.5rem); text-align: center; padding: 0 20px; transform: translateY(8px); transition: transform .5s ease; }
.stage-wrap.xf-on .xfade { opacity: .96; }
.stage-wrap.xf-on .xfade span { transform: none; }

/* the scene is the real-life story: charts and "what changed" belong to the brain view */
.panel[data-view="scene"] .mchart, .panel[data-view="scene"] .change-card { display: none; }

@media (max-width: 899px) {
  .sum-card { left: 8px; right: 8px; width: auto; bottom: calc(var(--sheet-h, 0px) + 66px); padding: 8px 12px 10px; }
  .sum-main { font-size: .84rem; }
  .sum-ex { font-size: .78rem; }
}
@media (prefers-reduced-motion: reduce) { .sum-card.flash { animation: none; } .xfade, .xfade span { transition: none; } }
/* the summary sits bottom left in the brain view, so the play key moves to the right there too */
.stage-wrap .stage-play { left: auto; right: 16px; transform: none; }
@media (max-width: 899px) { .stage-wrap .stage-play { right: 8px; } }
.stage-wrap .stage-play:active { transform: translateY(2px); }

/* ---------- v25: guided experiment on the scene ---------- */
.stage-wrap.has-exp .scene-cap { display: none; }
.exp-card { position: absolute; z-index: 5; left: 14px; bottom: calc(var(--sheet-h, 0px) + 16px); width: min(470px, calc(100% - 200px)); max-height: calc(100% - 150px); overflow-y: auto;
  padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid color-mix(in srgb, var(--b1) 50%, var(--line));
  backdrop-filter: blur(10px); box-shadow: 0 16px 34px -16px rgba(0, 0, 0, .75); color: var(--text); }
.exp-card small { display: block; font-size: .7rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--b1, #2de2d0); }
.exp-say { margin: 6px 0 0; font-size: .95rem; line-height: 1.45; font-weight: 600; }
.exp-q { margin: 10px 0 0; font-size: 1rem; font-weight: 800; }
.exp-opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.exp-btn { min-height: 40px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 70%, #2a3246); color: var(--text);
  font: inherit; font-weight: 700; cursor: pointer; transition: transform .15s, background .15s, border-color .15s; }
.exp-btn:hover:not(:disabled) { border-color: var(--b1); transform: translateY(-1px); }
.exp-btn:disabled { opacity: .5; cursor: default; }
.exp-btn.picked { opacity: 1; border-color: var(--b1); background: color-mix(in srgb, var(--b1) 25%, var(--panel)); }
.exp-btn.primary { background: linear-gradient(180deg, var(--b1, #4d97f0), color-mix(in srgb, var(--b1, #4d97f0) 70%, #000)); border-color: transparent; color: #fff; }
.exp-fb { margin: 10px 0 0; padding: 8px 10px; border-radius: 10px; font-size: .88rem; line-height: 1.45; animation: expIn .35s ease-out; }
.exp-fb.ok { background: rgba(62, 207, 142, .14); border: 1px solid rgba(62, 207, 142, .45); }
.exp-fb.no { background: rgba(242, 180, 90, .12); border: 1px solid rgba(242, 180, 90, .45); }
.exp-fb.why { background: rgba(165, 139, 255, .13); border: 1px solid rgba(165, 139, 255, .45); }
@keyframes expIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.exp-strip { position: absolute; z-index: 4; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; max-width: calc(100% - 330px); }
.exp-st { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap;
  background: color-mix(in srgb, var(--panel) 85%, transparent); border: 1px solid var(--line); color: var(--muted); transition: all .3s; }
.exp-st b { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--line); color: var(--text); font-size: .68rem; }
.exp-st.on { color: var(--text); border-color: var(--b1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--b1) 25%, transparent); }
.exp-st.on b { background: var(--b1); color: #fff; }
.exp-st.done { color: var(--text); }
.exp-st.done b { background: #3ecf8e; color: #06231a; }
.stage-wrap[data-view="brain"] .exp-card, .stage-wrap[data-view="brain"] .exp-strip { display: none; }
@media (max-width: 899px) {
  .exp-card { left: 8px; right: 8px; width: auto; bottom: calc(var(--sheet-h, 0px) + 66px); max-height: 52%; padding: 10px 12px; }
  .exp-say { font-size: .85rem; } .exp-q { font-size: .9rem; } .exp-fb { font-size: .8rem; }
  .exp-strip { top: 52px; left: 8px; right: 8px; transform: none; max-width: none; overflow-x: auto; }
  .exp-st { font-size: .66rem; padding: 4px 8px; }
}
@media (prefers-reduced-motion: reduce) { .exp-fb { animation: none; } .exp-btn { transition: none; } }
.exp-strip { top: 74px; max-width: calc(100% - 40px); }
.panel[data-view="scene"] .mchart, .panel[data-view="scene"] .change-card { display: none !important; }

/* desktop: the experiment card lives in the Tajriba panel, not over the scene */
.panel .exp-card { position: relative; left: auto; bottom: auto; width: auto; max-height: none; margin: 10px 10px 4px; flex: 0 0 auto; backdrop-filter: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--b1) 14%, var(--panel-2, var(--panel))), var(--panel-2, var(--panel))); box-shadow: none; }
.panel[data-view="brain"] .exp-card { display: none; }
.panel .exp-card { position: relative; left: auto; right: auto; bottom: auto; width: auto; max-height: none; }

/* ---------- v26: phone learn pop-up, no step strip ---------- */
.exp-strip { display: none !important; }
.lx-go { display: none; }
@media (max-width: 899px) {
  .learn-panel { display: block !important; position: fixed; z-index: 140; top: 50%; left: 14px; right: 14px; bottom: auto; width: auto; max-height: 82vh; overflow: auto;
    border-radius: 22px; opacity: 0; pointer-events: none; transform: translateY(-46%) scale(.96); transition: opacity .3s, transform .3s; box-shadow: 0 30px 80px -20px rgba(0,0,0,.8); }
  .learn-panel.open:not(.pop) { opacity: 0; pointer-events: none; }
  .learn-panel.pop { opacity: 1; pointer-events: auto; transform: translateY(-50%); }
  .learn-panel .lx-close { display: none; }
  .learn-panel .lx-grid { grid-template-columns: 1fr; gap: 10px; }
  .learn-panel .lx-pv { display: none; }
  .lx-go { display: flex; position: relative; overflow: hidden; width: 100%; justify-content: center; margin-top: 14px; min-height: 48px; font-size: 1rem; }
  .lx-timer { position: absolute; left: 0; bottom: 0; height: 4px; width: 100%; background: rgba(255,255,255,.7); transform-origin: left; }
  .learn-panel.pop .lx-timer { animation: lxTimer 6s linear forwards; }
}
@keyframes lxTimer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .learn-panel.pop .lx-timer { animation: none; } }
@media (max-width: 899px) { .lx-go { position: sticky; bottom: 0; z-index: 2; box-shadow: 0 -12px 24px -6px rgba(255,255,255,.9); } }
.panel:not([data-tab="quiz"]) .exp-card { display: none !important; }   /* the experiment belongs to the Test tab only */

/* phone: the topic list covers the whole screen; AR takes finger gestures */
@media (max-width: 899px) { .sidebar { width: 100vw; border-right: 0; } }
.ar-overlay { pointer-events: auto; touch-action: none; }
.ar-overlay .ar-hint { pointer-events: none; }
