:root {
  --bg: #eef2f0; --panel: #f9fbfa; --panel2: #e4ebe8; --ink: #13201d; --muted: #566762; --grid: #d3ddd9; --line: #c3d0cb;
  --accent: #0b6e79; --accent-ink: #ffffff; --accent-2: #7a3fb0; --accent-2-ink: #ffffff; --amber: #b87708; --danger: #c2412d; --good: #2c8049; --water: #a9d2ec; --hl: #fbe7b5;
  --s1: #0b6e79; --s2: #c2412d; --s3: #7a5cc4; --s4: #b87708;
  --c-am: #f4c7b8; --c-ae: #f7ddb0; --c-tm: #f1e9a8; --c-la: #e6c8ea; --c-ac: #d9c3f0; --c-pm: #cfe0d6; --c-ml: #bfe3dc; --c-nm: #c9ddf6; --c-ha: #b7e4c0; --c-ng: #d7cff5;
  --radius: 10px; --shadow: 0 1px 2px rgba(19,32,29,.06), 0 4px 16px rgba(19,32,29,.06);
  --cL: .47; --cC: .15; --c-ink: #ffffff; --glow: 15%;
  --spectrum: linear-gradient(90deg, oklch(.62 .21 25), oklch(.72 .18 55), oklch(.83 .17 95), oklch(.72 .19 145), oklch(.72 .13 195), oklch(.58 .19 260), oklch(.55 .22 300));
  --f-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --f-body: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1614; --panel: #15201d; --panel2: #1c2926; --ink: #e2ece9; --muted: #93a6a0; --grid: #2a3834; --line: #334541;
    --accent: #4cc3cf; --accent-ink: #062226; --accent-2: #c7a2f0; --accent-2-ink: #1e1133; --amber: #e8b04a; --danger: #f07a63; --good: #6bcb8b; --water: #2d5a78; --hl: #4a3d12;
    --s1: #4cc3cf; --s2: #f07a63; --s3: #b39bf0; --s4: #e8b04a;
    --c-am: #6b3a2e; --c-ae: #6a4f24; --c-tm: #5c5424; --c-la: #573a5c; --c-ac: #4a3a66; --c-pm: #2f4a3c; --c-ml: #245049; --c-nm: #2a4466; --c-ha: #2a5a38; --c-ng: #3f3866;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    --cL: .80; --cC: .13; --c-ink: #0b1512; --glow: 22%;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1614; --panel: #15201d; --panel2: #1c2926; --ink: #e2ece9; --muted: #93a6a0; --grid: #2a3834; --line: #334541;
  --accent: #4cc3cf; --accent-ink: #062226; --accent-2: #c7a2f0; --accent-2-ink: #1e1133; --amber: #e8b04a; --danger: #f07a63; --good: #6bcb8b; --water: #2d5a78; --hl: #4a3d12;
  --s1: #4cc3cf; --s2: #f07a63; --s3: #b39bf0; --s4: #e8b04a;
  --c-am: #6b3a2e; --c-ae: #6a4f24; --c-tm: #5c5424; --c-la: #573a5c; --c-ac: #4a3a66; --c-pm: #2f4a3c; --c-ml: #245049; --c-nm: #2a4466; --c-ha: #2a5a38; --c-ng: #3f3866;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    --cL: .80; --cC: .13; --c-ink: #0b1512; --glow: 22%;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.65 var(--f-body); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; line-height: 1.25; text-wrap: balance; margin: 0; }
h4, h5 { margin: 0 0 .5rem; font-weight: 600; }
small, .muted { color: var(--muted); }
[dir="ltr"] { unicode-bidi: isolate; }
.en { font-family: var(--f-body); color: var(--muted); font-size: .88em; direction: ltr; unicode-bidi: isolate; }
.mono, .eqbig, .eqstack, .path, output, .rv, table.data td { font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: .75rem; padding: .6rem 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); min-width: 0; }
.brand svg, .brand img { flex: none; }
.brand img.brand-logo-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.45), 0 3px 10px rgba(0, 0, 0, 0.28);
  background: #020d1a;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}
.brand:hover img.brand-logo-img {
  transform: scale(1.06);
  box-shadow: 0 0 0 2px var(--accent), 0 5px 14px rgba(11, 110, 121, 0.4);
}
.brand b { font-family: var(--f-display); font-size: 1.15rem; white-space: nowrap; }
.brand .en { display: block; font-size: .72rem; line-height: 1.1; }
.top nav { margin-inline-start: auto; display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.navbtn { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: .3rem .8rem; cursor: pointer; font-size: .9rem; text-decoration: none; color: var(--ink); }
.navbtn.on, .navbtn:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.menubtn { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: .3rem .7rem; cursor: pointer; font: inherit; font-size: .9rem; }
.menubtn:hover, .menubtn:focus-visible, .menubtn[aria-expanded="true"] { background: var(--panel2); outline: none; }
.shell { display: grid; grid-template-columns: minmax(0, 1fr); min-height: calc(100% - 58px); }
/* the lesson list floats over the page: click "Lessons" to show it, click again (or pick a lesson) to hide it */
.side { position: fixed; inset-block: var(--toph, 58px) 0; inset-inline-start: 0; width: min(320px, 88vw); z-index: 30; border-inline-end: 1px solid var(--line); background: var(--panel); padding: 12px; overflow-y: auto; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
.side.open { transform: none; }
.gradechips { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .6rem; }
.gchip { border: 1px solid var(--line); background: transparent; border-radius: 6px; padding: .15rem .55rem; cursor: pointer; font-size: .85rem; }
.gchip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.search { width: 100%; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); margin-bottom: .6rem; }
.mod { margin-bottom: .35rem; }
.mod > summary { cursor: pointer; list-style: none; padding: .35rem .4rem; border-radius: 6px; font-weight: 600; font-size: .92rem; display: flex; gap: .4rem; align-items: baseline; }
.mod > summary::-webkit-details-marker { display: none; }
.mod > summary:hover { background: var(--panel2); }
.mod > summary .mn { font-family: var(--f-mono); color: var(--accent); font-size: .8rem; min-width: 2.2em; }
.lsn { display: flex; gap: .5rem; align-items: center; width: 100%; text-align: start; border: 0; background: transparent; padding: .3rem .5rem .3rem .4rem; border-radius: 6px; cursor: pointer; font-size: .88rem; }
.lsn:hover { background: var(--panel2); }
.lsn.on { background: var(--hl); }
.lsn .st { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--muted); flex: none; }
.st.seen { background: var(--grid); } .st.explored { background: var(--s3); border-color: var(--s3); } .st.challenge { background: var(--amber); border-color: var(--amber); } .st.quiz { background: var(--accent); border-color: var(--accent); } .st.mastered { background: var(--good); border-color: var(--good); }
.lsn .gtag { margin-inline-start: auto; font-family: var(--f-mono); font-size: .7rem; color: var(--muted); }
/* the page fills the window and grows with it; it stops at 1500px on very wide screens and is centred */
main { padding: 18px 16px 60px; min-width: 0; width: 100%; max-width: 1500px; margin-inline: auto; box-sizing: border-box; }
.wrap { max-width: 1200px; margin: 0 auto; }

/* ---------- lesson header ---------- */
.crumbs { color: var(--muted); font-size: .85rem; display: flex; gap: .4rem; flex-wrap: wrap; }
.lhead { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: end; margin: .4rem 0 1rem; }
.lhead h1 { font-size: clamp(1.5rem, 3.4vw, 2.2rem); }
.lhead .en-title { font-family: var(--f-body); font-size: 1rem; color: var(--muted); }
.lnum { font-family: var(--f-mono); font-size: 2.6rem; color: var(--accent); line-height: 1; }
.lhead-main { min-width: 0; }
.lhead-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.lhead-row h1 { margin: 0; min-width: 0; }
.lhead-toggle { flex: none; display: inline-flex; align-items: center; gap: .35rem; font: inherit; font-size: .85rem; padding: .25rem .75rem; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--accent); cursor: pointer; }
.lhead-toggle:hover, .lhead-toggle:focus-visible { background: var(--panel2); outline: none; }
.lhead-chev { display: inline-block; transition: transform .15s; }
.lhead-chev.shut { transform: rotate(-90deg); }
.lhead-body { margin-top: .3rem; }
.lhead-body[hidden] { display: none; }

/* drawing board: a pen and eraser layer over the page */
/* a slim tab on the left edge, so it never covers the page (the periodic table tab sits on the right edge) */
.board-launch { position: fixed; left: 0; top: 50%; transform: translateY(-50%); writing-mode: vertical-rl; z-index: 880; font: inherit; font-size: .85rem; font-weight: 600; padding: .8rem .45rem; border-radius: 0 12px 12px 0; border: 1px solid var(--line); border-left: 0; background: var(--panel); color: var(--ink); box-shadow: var(--shadow); cursor: pointer; }
.board-launch:hover, .board-launch:focus-visible { background: var(--panel2); outline: none; }
.board-layer { position: fixed; inset: 0; z-index: 890; }
.board-layer[hidden] { display: none; }
.board-canvas { position: absolute; left: 0; top: 0; touch-action: none; background: rgba(255,255,255,.04); }
.board-bar { position: absolute; top: .6rem; left: 50%; transform: translateX(-50%); display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 1.2rem); padding: .4rem .6rem; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); }
.board-btn { font: inherit; font-size: .88rem; padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--line); background: var(--panel2); color: var(--ink); cursor: pointer; }
.board-btn[aria-pressed="true"] { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.board-close { background: var(--panel); }
.board-sw { width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.board-sw.on { box-shadow: 0 0 0 2px var(--ink); }
.board-range { width: 110px; }
@media (max-width: 640px) { .board-launch { padding: .6rem .35rem; font-size: .78rem; } }
.types { display: flex; gap: .35rem; flex-wrap: wrap; margin: .3rem 0 0; }
.type { font-size: .78rem; border-radius: 4px; padding: .1rem .45rem; background: var(--panel2); border: 1px solid var(--line); }
.fq { border-inline-start: 3px solid var(--amber); padding: .4rem .8rem; background: var(--panel); border-radius: 0 8px 8px 0; margin: .6rem 0 1rem; }
.fq b { color: var(--amber); font-size: .8rem; display: block; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: thin; }
.tab { border: 0; background: transparent; padding: .55rem .9rem; cursor: pointer; border-bottom: 2.5px solid transparent; white-space: nowrap; font-weight: 500; }
.tab small { display: block; font-size: .68rem; line-height: 1; }
.tab.on { border-bottom-color: var(--accent); color: var(--accent); }
.pane[hidden] { display: none !important; }

/* ---------- learn ---------- */
.learn { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.card h3 { font-size: 1.05rem; margin-bottom: .5rem; display: flex; gap: .5rem; align-items: baseline; }
.card h3 .en { font-size: .75rem; }
.card ul, .card ol { margin: 0; padding-inline-start: 1.2rem; }
.card li { margin: .25rem 0; }
.vocab { display: grid; grid-template-columns: 1fr 1fr; gap: .15rem 1rem; font-size: .9rem; }
.vocab div { display: flex; justify-content: space-between; gap: .5rem; border-bottom: 1px dashed var(--grid); padding: .15rem 0; }
.eqlist { list-style: none; padding: 0 !important; }
.eqlist li { font-family: var(--f-mono); direction: ltr; text-align: left; background: var(--panel2); border-radius: 6px; padding: .35rem .6rem; font-size: .9rem; overflow-x: auto; }
.mis { background: color-mix(in srgb, var(--danger) 9%, var(--panel)); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.real { background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.stack { display: grid; gap: 1rem; align-content: start; }

/* ---------- lab ---------- */
.lab { display: grid; gap: .8rem; }
.vartags { display: flex; gap: .4rem; flex-wrap: wrap; font-size: .82rem; }
.vt { border-radius: 6px; padding: .2rem .55rem; border: 1px solid var(--line); background: var(--panel); }
.vt b { font-weight: 600; }
.vt.indep b { color: var(--accent); } .vt.dep b { color: var(--danger); } .vt.const b { color: var(--muted); }
.labgrid { display: grid; grid-template-columns: 250px minmax(0, 1fr) 250px; gap: .8rem; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; min-width: 0; }
.panel h4 { font-family: var(--f-display); font-size: .98rem; display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.panel h4 small { font-family: var(--f-body); font-size: .7rem; direction: ltr; }
.ctrls { display: grid; gap: .6rem; }
.ctl { display: grid; grid-template-columns: 1fr auto; gap: .15rem .5rem; align-items: center; font-size: .88rem; }
.ctl .lbl { display: flex; flex-direction: column; }
.ctl .lbl i { font-style: normal; font-size: .7rem; color: var(--muted); direction: ltr; text-align: start; }
.ctl output { font-family: var(--f-mono); font-size: .82rem; color: var(--accent); direction: ltr; }
.ctl input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }
.ctl input[type=range]:disabled { opacity: .45; }
.ctl select, .ctl input[type=text], .ctl input[type=number], .numrow input { grid-column: 1 / -1; width: 100%; padding: .35rem .45rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.numrow { grid-column: 1 / -1; display: flex; gap: .4rem; align-items: center; }
.unit { font-family: var(--f-mono); font-size: .8rem; color: var(--muted); }
.stagewrap { min-width: 0; }
.stage { display: grid; gap: .7rem; }
canvas.simcv, canvas.graph { width: 100%; display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); max-width: 100%; }
.reads { display: grid; gap: .35rem; }
.ro { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; border-bottom: 1px dashed var(--grid); padding: .2rem 0; font-size: .86rem; }
.ro .rl { color: var(--muted); }
.ro .rv { font-family: var(--f-mono); text-align: end; font-size: .86rem; }
.ro.key .rv { color: var(--accent); font-weight: 600; font-size: .95rem; }
.ro.good .rv { color: var(--good); } .ro.warn .rv { color: var(--danger); }
.ro.warn .rl, .ro.warn .rv { font-family: var(--f-body); }
.whypanel .why { font-size: .93rem; max-width: 80ch; }
.whypanel { border-inline-start: 3px solid var(--accent); }
.labbtns, .chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; }
.btn { border: 0; background: var(--accent); color: var(--accent-ink); border-radius: 8px; padding: .42rem .9rem; cursor: pointer; font-weight: 500; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: .22rem .7rem; cursor: pointer; font-size: .84rem; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip.ghost { background: transparent; }
.datagrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: .8rem; }
.tblscroll { overflow-x: auto; max-height: 280px; overflow-y: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: .84rem; }
table.data th, table.data td { border-bottom: 1px solid var(--grid); padding: .3rem .45rem; text-align: center; white-space: nowrap; }
table.data th { font-weight: 600; background: var(--panel2); position: sticky; top: 0; }
table.data th small { font-weight: 400; }
table.data td.empty { color: var(--muted); white-space: normal; }
table.data.mini { font-size: .8rem; }
table.data input { width: 7em; padding: .2rem .3rem; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); }
.fitline { font-family: var(--f-mono); font-size: .8rem; color: var(--muted); margin: .4rem 0 0; text-align: start; }
.fitline.note { font-family: var(--f-body); background: transparent; padding: 0; }
.miniTool { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .8rem; }
.miniTool h5 { font-family: var(--f-display); font-size: .92rem; }
.miniTool h5 small { font-family: var(--f-body); direction: ltr; }
.miniTool .row { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.miniTool input[type=number], .miniTool input[type=text], .miniTool select { padding: .3rem .4rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); max-width: 100%; }
.miniTool input[type=number] { width: 8em; }
.convout { font-family: var(--f-mono); font-size: .85rem; direction: ltr; text-align: left; overflow-x: auto; }
.eqbig { font-family: var(--f-mono); font-size: 1.15rem; text-align: center; padding: .6rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; white-space: nowrap; }
.eqbig.small { font-size: .92rem; }
.eqbig .arrow { color: var(--muted); margin: 0 .4rem; }
.eqstack { display: grid; gap: .3rem; font-family: var(--f-mono); font-size: .88rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; overflow-x: auto; }
.eqstack small { font-family: var(--f-body); display: block; color: var(--muted); font-size: .72rem; }
.eqstack .net { color: var(--accent); font-weight: 600; }
.wordeq { text-align: center; color: var(--muted); margin: 0; font-size: .9rem; }
.fb { font-size: .86rem; margin: .3rem 0 0; }
.fb.good { color: var(--good); } .fb.bad { color: var(--danger); }
.sfout { font-family: var(--f-mono); font-size: 1.4rem; letter-spacing: .06em; margin: .3rem 0; }
.sfout .sig { color: var(--accent); font-weight: 700; } .sfout .nsig { color: var(--muted); }
.sorter { display: grid; gap: .3rem; }
.sortrow { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; font-size: .86rem; border-bottom: 1px dashed var(--grid); padding-bottom: .3rem; }
.sortrow > span:first-child { flex: 1 1 12rem; }
.tl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.tlc { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--amber); border-radius: 8px; padding: .6rem; font-size: .88rem; }
.tlc p { margin: .3rem 0 0; }
ol.dalton { padding-inline-start: 1.2rem; margin: 0; font-size: .88rem; }
ol.dalton li { margin-bottom: .4rem; }
.orbitals { display: flex; flex-wrap: wrap; gap: .8rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; justify-content: center; }
.sublevel { display: grid; justify-items: center; gap: .2rem; font-family: var(--f-mono); }
.sublevel .boxes { display: flex; }
.obox { width: 30px; height: 34px; border: 1.5px solid var(--ink); margin-inline-start: -1.5px; display: grid; place-items: center; font-size: 1.05rem; color: var(--accent); }
.dotstruct { text-align: center; font-family: var(--f-mono); font-size: 1.6rem; }
.dotstruct .dots { color: var(--danger); letter-spacing: .1em; font-size: 1.2rem; margin-inline-start: .3rem; }
.ptscroll { overflow-x: auto; padding-bottom: .3rem; }
.ptable { display: grid; grid-template-columns: repeat(18, minmax(38px, 1fr)); gap: 3px; min-width: 720px; }
.pt { border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent); border-radius: 4px; padding: 2px 1px; cursor: pointer; display: grid; justify-items: center; line-height: 1.1; min-height: 44px; color: var(--ink); }
.pt small { font-size: .58rem; font-family: var(--f-mono); color: var(--ink); opacity: .75; }
.pt b { font-family: var(--f-mono); font-size: .9rem; }
.pt i { font-style: normal; font-size: .55rem; font-family: var(--f-mono); }
.pt.on { outline: 2.5px solid var(--ink); outline-offset: 1px; }
.pt.dim { opacity: .18; }
.ptgap { height: 10px; }
.legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .78rem; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-inline-end: .3rem; vertical-align: -1px; border: 1px solid var(--line); }
.meter { height: 10px; background: var(--grid); border-radius: 5px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--danger); transition: width .3s; }
.meter.ok i { background: var(--good); }
.iontiles { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; }
.tile { font-family: var(--f-mono); padding: .35rem .6rem; border-radius: 8px; font-weight: 600; }
.tile.pos { background: color-mix(in srgb, var(--s1) 22%, var(--panel)); border: 1px solid var(--s1); }
.tile.neg { background: color-mix(in srgb, var(--s2) 22%, var(--panel)); border: 1px solid var(--s2); }
.steppers { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.stp { display: flex; align-items: center; gap: .2rem; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .15rem .3rem; font-family: var(--f-mono); }
.stp button { width: 24px; height: 24px; border: 1px solid var(--line); background: var(--panel); border-radius: 5px; cursor: pointer; line-height: 1; }
.stp b { min-width: 1.4em; text-align: center; color: var(--accent); }
.stp .arrow { margin-inline-start: .3rem; color: var(--muted); }
.path { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; justify-content: center; }
.pbox { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .4rem .6rem; text-align: center; min-width: 90px; }
.pbox small { display: block; font-size: .7rem; color: var(--muted); font-family: var(--f-body); }
.pbox b { font-family: var(--f-mono); display: block; }
.pbox i { font-style: normal; font-size: .7rem; color: var(--muted); font-family: var(--f-mono); }
.pbox.on { border-color: var(--amber); box-shadow: 0 0 0 2px color-mix(in srgb, var(--amber) 35%, transparent); }
.pbox.key { border-color: var(--accent); }
.parr { display: grid; justify-items: center; color: var(--muted); font-family: var(--f-mono); font-size: .8rem; }
.parr span { font-size: .68rem; white-space: nowrap; }
.ratios { font-family: var(--f-mono); font-size: .75rem; color: var(--muted); direction: ltr; text-align: left; }
.pctin { display: grid; gap: .5rem; }
.hess { display: grid; gap: .45rem; font-family: var(--f-mono); font-size: .85rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem; overflow-x: auto; }
.hess .target { font-weight: 600; color: var(--amber); }
.hrow { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.hrow > span { flex: 1 1 18rem; }
.hsum { border-top: 1px solid var(--line); padding-top: .4rem; }
.hsum.ok { color: var(--good); font-weight: 600; }
.rolepick { display: flex; flex-wrap: wrap; gap: .6rem; }
.rolepick label { display: grid; gap: .2rem; font-family: var(--f-mono); }
.rolepick select { padding: .25rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.tower { display: grid; gap: 3px; max-width: 360px; margin: 0 auto; }
.frac { border: 1px solid var(--line); border-radius: 4px; padding: .3rem; cursor: pointer; background: color-mix(in srgb, var(--amber) calc(12% + var(--k) * 12%), var(--panel)); font-size: .82rem; }
.dataedit input { width: 6em; }

/* ---------- practice / challenge / quiz ---------- */
.qcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; max-width: 820px; }
.qcard .q { font-size: 1.02rem; margin-bottom: .7rem; }
.opts { display: grid; gap: .4rem; }
.opt { text-align: start; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: .5rem .7rem; cursor: pointer; }
.opt:hover { border-color: var(--accent); }
.opt.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, var(--panel)); }
.opt.wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--panel)); }
.ansrow { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.ansrow input { padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); width: 14em; direction: ltr; }
.hintbox { margin-top: .7rem; font-size: .9rem; border-inline-start: 3px solid var(--amber); padding: .3rem .7rem; background: color-mix(in srgb, var(--amber) 8%, var(--panel)); border-radius: 0 6px 6px 0; }
.solution { margin-top: .6rem; font-family: var(--f-mono); font-size: .88rem; direction: ltr; text-align: left; background: var(--panel2); padding: .5rem .7rem; border-radius: 6px; overflow-x: auto; }
.levels { display: flex; gap: .4rem; margin-bottom: .8rem; flex-wrap: wrap; }
.lvl { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: .35rem .8rem; cursor: pointer; }
.lvl.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.lvl.done::after { content: " ✓"; color: var(--good); }
.lvl:disabled { opacity: .45; cursor: not-allowed; }
.score { font-family: var(--f-mono); font-size: 2rem; color: var(--accent); }

/* ---------- tutor ---------- */
.tutor { display: grid; grid-template-rows: auto minmax(min(260px, 100%), 1fr) auto; gap: .6rem; max-width: 860px; }
.ctxline { font-size: .8rem; color: var(--muted); background: var(--panel2); border-radius: 6px; padding: .3rem .6rem; }
.chat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; overflow-y: auto; max-height: 60vh; display: grid; gap: .6rem; align-content: start; }
.msg { max-width: 88%; padding: .5rem .75rem; border-radius: 10px; white-space: pre-wrap; font-size: .93rem; }
.msg.u { background: var(--accent); color: var(--accent-ink); justify-self: start; }
.msg.a { background: var(--panel2); justify-self: end; }
.msg.a.err { background: color-mix(in srgb, var(--danger) 12%, var(--panel)); }
.askrow { display: flex; gap: .4rem; }
.askrow textarea { flex: 1; min-height: 44px; resize: vertical; padding: .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font: inherit; }

/* ---------- source ---------- */
.source { margin-top: 1.2rem; font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .3rem 1rem; border-top: 1px solid var(--line); padding-top: .5rem; }
.source b { color: var(--ink); font-weight: 600; }

/* ---------- home / map / dashboard ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 1.2rem; align-items: center; margin-bottom: 1.4rem; }
.hero h1 { font-size: clamp(1.8rem, 4.5vw, 2.8rem); }
.hero p { max-width: 58ch; }
.flow { font-family: var(--f-mono); font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .25rem; }
.flow span { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: .05rem .4rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .6rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem; }
.stat b { font-family: var(--f-mono); font-size: 1.6rem; color: var(--accent); display: block; }
.stat span { font-size: .8rem; color: var(--muted); }
.mapgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: .7rem; }
.mapmod { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem; }
.mapmod h3 { font-size: .95rem; margin-bottom: .45rem; }
.mapmod h3 .mn { font-family: var(--f-mono); color: var(--accent); margin-inline-end: .3rem; }
.maplsn { display: grid; grid-template-columns: auto 1fr auto; gap: .45rem; align-items: center; width: 100%; border: 0; background: transparent; text-align: start; padding: .25rem .2rem; border-radius: 6px; cursor: pointer; font-size: .85rem; }
.maplsn:hover { background: var(--panel2); }
.steps5 { display: flex; gap: 2px; }
.steps5 i { width: 14px; height: 6px; border-radius: 2px; background: var(--grid); }
.steps5 i.on { background: var(--accent); }
.steps5 i.m { background: var(--good); }
.legendrow { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .8rem; color: var(--muted); margin: .4rem 0 1rem; }
.legendrow span { display: inline-flex; gap: .3rem; align-items: center; }
.audit { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.audit table { font-size: .84rem; }
.audit table.data { border-collapse: collapse; width: 100%; table-layout: auto; }
.audit table.data th,
.audit table.data td {
  padding: .55rem .75rem;
  line-height: 1.45;
  vertical-align: middle;
  text-align: start;
  border-bottom: 1px solid var(--grid);
}
.audit table.data td {
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}
.audit table.data th {
  white-space: nowrap;
  background: var(--panel2);
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 2;
}
.yes { color: var(--good); font-weight: 600; } .no { color: var(--muted); }
.tbar { height: 8px; background: var(--grid); border-radius: 4px; overflow: hidden; min-width: 60px; }
.tbar i { display: block; height: 100%; background: var(--accent); }
.note { font-size: .85rem; background: var(--panel2); border-radius: 8px; padding: .6rem .8rem; }
.sectionh { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin: 1.4rem 0 .6rem; flex-wrap: wrap; }
.sectionh h2 { font-size: 1.3rem; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .labgrid { grid-template-columns: 1fr 1fr; } .stagewrap { grid-column: 1 / -1; order: -1; } }
@media (max-width: 900px) {
  .learn, .hero, .datagrid { grid-template-columns: 1fr; }
  .tl { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .labgrid { grid-template-columns: 1fr; }
  .top nav .navbtn { padding: .25rem .55rem; font-size: .8rem; }
  .brand .en { display: none; }
  .vocab { grid-template-columns: 1fr; }
  .lnum { font-size: 1.8rem; }
}
/* ---------- merged platform components ---------- */
a { color: var(--accent); }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.netchip { font-size: .75rem; padding: .15rem .6rem; border-radius: 999px; background: var(--amber); color: #1b1300; font-weight: 600; align-self: center; }
.unitlink { display: block; font-size: .8rem; padding: .2rem .5rem .4rem 2.9rem; text-decoration: none; }
.intro { max-width: 70ch; margin: .4rem 0 .2rem; font-size: 1.02rem; }
.sech { font-size: 1.05rem; margin: 1.3rem 0 .6rem; }
h2.sech { font-size: 1.3rem; }
.lessonnav { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin: 1.5rem 0 .5rem; }
.lessonnav .btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; min-height: 40px; }
.hintbox.good { border-inline-start-color: var(--good); background: color-mix(in srgb, var(--good) 9%, var(--panel)); }
.qcard.isright { border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.qcard.iswrong { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.bankquiz { display: grid; gap: .7rem; }
.opts.tf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ansrow input { min-width: 0; flex: 1 1 10rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.banksec { margin-top: 1.2rem; }
.card.exit { margin-top: 1.5rem; border-inline-start: 4px solid var(--s3); }
.fld { display: grid; gap: .3rem; margin-top: .7rem; font-weight: 500; font-size: .92rem; }
.fld textarea { width: 100%; padding: .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-weight: 400; }
.conf { display: flex; gap: .4rem; flex-wrap: wrap; }
.conf .chip { min-height: 36px; }
.sendbox { margin-top: .8rem; border-top: 1px dashed var(--line); padding-top: .7rem; }
.rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .7rem; }
.rcard { display: flex; flex-direction: column; gap: .5rem; background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--kc, var(--accent)); border-radius: var(--radius); padding: .8rem; box-shadow: var(--shadow); }
.rcard .btn { margin-top: auto; align-self: flex-start; }
.rtop { display: flex; justify-content: space-between; gap: .4rem; align-items: center; }
.rkind { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.net { font-size: .7rem; padding: .1rem .45rem; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.net.off { color: var(--good); border-color: color-mix(in srgb, var(--good) 50%, var(--line)); }
.net.on { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 50%, var(--line)); }
.k-lab { --kc: var(--s1); } .k-simulation { --kc: var(--s3); } .k-video { --kc: var(--s2); } .k-files, .k-document { --kc: var(--s4); } .k-activity { --kc: var(--good); }
details.teacher, .teacherzone { margin-top: 1.4rem; border: 1px dashed var(--s3); border-radius: var(--radius); padding: .7rem .9rem; background: color-mix(in srgb, var(--s3) 6%, var(--panel)); }
details.teacher > summary { cursor: pointer; font-weight: 600; color: var(--s3); }
.teacherzone { margin: 0 0 1rem; }
.teacherzone details.teacher { margin-top: .5rem; border: 0; padding: 0; background: none; }
.pbar { position: relative; height: 12px; border-radius: 999px; background: var(--panel2); overflow: hidden; margin: .35rem 0 .5rem; }
.pbar i { position: absolute; inset-block: 0; inset-inline-start: 0; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--good))); border-radius: 999px; transition: width .4s; }
.pbar span { position: absolute; inset-inline-end: .4rem; top: -1px; font-size: .62rem; font-weight: 700; color: var(--ink); }
.modlink { text-decoration: none; color: var(--ink); }
.modlink:hover { color: var(--accent); }
.unithead { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; margin: .6rem 0 1rem; }
.unithead h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); margin: .2rem 0 .5rem; }
.kicker { font-family: var(--f-mono); font-size: .78rem; color: var(--accent); letter-spacing: .04em; text-transform: uppercase; }
.lcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: .8rem; }
.lcard { display: flex; flex-direction: column; gap: .35rem; text-decoration: none; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.lcard:hover { transform: translateY(-2px); border-color: var(--accent); }
.lcard p { margin: 0; color: var(--muted); font-size: .88rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lctop, .lcfoot { display: flex; justify-content: space-between; align-items: center; gap: .4rem; flex-wrap: wrap; }
.lcfoot { margin-top: auto; font-size: .78rem; }
.lctop .mn, .simtile .mn { font-family: var(--f-mono); color: var(--accent); font-weight: 600; }
.badge { font-size: .7rem; padding: .1rem .5rem; border-radius: 999px; background: var(--panel2); color: var(--muted); }
.badge.mastered { background: var(--good); color: #fff; } .badge.quiz { background: color-mix(in srgb, var(--good) 25%, var(--panel)); color: var(--ink); }
.simgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .5rem; }
.simtile { display: grid; gap: .1rem; text-decoration: none; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; }
.simtile:hover { border-color: var(--accent); }
.tabs { overflow-x: auto; scrollbar-width: thin; }
.labembed { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); box-shadow: var(--shadow); margin-bottom: 1rem; }
.labbar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .65rem 1rem; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(11, 110, 121, 0.08), var(--panel)); }
.labbar b { font-family: var(--f-display); font-size: 1.05rem; font-weight: 600; color: var(--ink); }
.labbar .net.off { font-size: .75rem; font-weight: 600; padding: .2rem .55rem; border-radius: 999px; background: rgba(14, 138, 90, 0.12); color: var(--good); border: 1px solid rgba(14, 138, 90, 0.25); }
.labbar .btn { margin-inline-start: auto; min-height: 34px; padding: .3rem .8rem; border-radius: 8px; font-weight: 600; }
.ldate { display: block; font-size: .9rem; color: var(--muted); margin: .15rem 0 .35rem; font-variant-numeric: tabular-nums; }
.gradepick { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 0 0 1.2rem; box-shadow: var(--shadow); }
.gradepick h2 { font-size: 1.15rem; margin-bottom: .6rem; }
.gradebtns { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .6rem; }
.gradebtn { display: grid; gap: .1rem; text-align: start; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 10px; padding: .7rem .9rem; cursor: pointer; min-height: 56px; }
.gradebtn b { font-size: 1.05rem; } .gradebtn span { font-size: .8rem; color: var(--muted); }
.gradebtn:hover { border-color: var(--accent); }
.gradebtn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.gradebtn.on span { color: inherit; opacity: .85; }
.mhecard { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; background: linear-gradient(135deg, color-mix(in srgb, #c8102e 9%, var(--panel)), var(--panel)); border: 1px solid var(--line); border-inline-start: 5px solid #c8102e; border-radius: var(--radius); padding: 1rem 1.1rem; margin: 0 0 1.2rem; box-shadow: var(--shadow); }
.mhecard h2 { font-size: 1.2rem; margin: .15rem 0 .3rem; }
.mhecard p { margin: 0; max-width: 60ch; }
.mhecard .fb { flex-basis: 100%; }
.navbtn.mhe { border-color: color-mix(in srgb, #c8102e 55%, var(--line)); }
.sitefoot { margin: 2.5rem 0 1rem; padding: 1rem 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; text-align: center; }
.sitefoot b { color: var(--ink); font-weight: 600; }
.labshadow { background: var(--bg); color: var(--ink); }
.labdlg { width: min(1140px, 96vw); max-height: 94vh; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--ink); overflow: auto; box-shadow: 0 16px 40px rgba(0,0,0,.25); }
.labdlg::backdrop { background: rgba(10, 20, 18, .6); backdrop-filter: blur(2px); }
.labdlg .labembed { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.labdlg .labbar { position: sticky; top: 0; z-index: 2; background: var(--panel); border-bottom: 1px solid var(--line); }
.labdlg .labbar .btn { margin-inline-start: .4rem; }
.labdlg .labbar .btn:first-of-type { margin-inline-start: auto; }
@media (max-width: 900px) { .unithead { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .lessonnav .btn { flex: 1 1 100%; }
  .top { flex-wrap: wrap; row-gap: .4rem; }
  .top nav { order: 3; flex: 1 1 100%; margin: 0; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding-bottom: 2px; }
  .top nav .navbtn { white-space: nowrap; }
  .top nav > span.muted { display: none; }
}
/* ================= Spectrum colour system =================
   Any element below gets --c (strong colour), --c-soft / --c-tint (backgrounds) and --c-line (borders)
   from its hue --h. Modules follow the visible spectrum (red → violet); grades, tabs, experience types
   and content cards have their own hues. Lightness/chroma come from theme tokens, so both themes stay readable. */
[data-m], [data-g], [data-k], [data-t], .hue, .stat, .opt, .vocab > div, .rcard, .navbtn, .badge, .lvl, .mhecard {
  --c: oklch(var(--cL) var(--cC) var(--h, 200));
  --c-soft: color-mix(in oklab, var(--c) 11%, var(--panel));
  --c-tint: color-mix(in oklab, var(--c) 20%, var(--panel));
  --c-line: color-mix(in oklab, var(--c) 42%, var(--line));
}
[data-g="9"] { --h: 25; } [data-g="10"] { --h: 145; } [data-g="11"] { --h: 250; } [data-g="12"] { --h: 305; } [data-g="0"] { --h: 200; }
.tab[data-k="learn"] { --h: 255; } .tab[data-k="explore"] { --h: 185; } .tab[data-k="experiment"] { --h: 300; } .tab[data-k="practice"] { --h: 145; }
.tab[data-k="challenge"] { --h: 50; } .tab[data-k="quiz"] { --h: 345; } .tab[data-k="resources"] { --h: 80; } .tab[data-k="tutor"] { --h: 275; }
[data-t="A"] { --h: 185; } [data-t="B"] { --h: 300; } [data-t="C"] { --h: 145; } [data-t="D"] { --h: 50; }
[data-t="E"] { --h: 255; } [data-t="F"] { --h: 330; } [data-t="G"] { --h: 95; } [data-t="H"] { --h: 20; }

/* page ground: soft coloured light, like a lab bench under coloured lamps */
body { background:
  radial-gradient(1100px 540px at -8% -12%, color-mix(in oklab, oklch(.72 .14 195) var(--glow), transparent), transparent 70%),
  radial-gradient(900px 500px at 108% -8%, color-mix(in oklab, oklch(.66 .2 330) var(--glow), transparent), transparent 70%),
  var(--bg); background-repeat: no-repeat; }

/* header: spectrum strip + colourful logo + colour-coded menu */
.top::after { content: ""; position: absolute; inset-inline: 0; bottom: -1px; height: 3px; background: var(--spectrum); pointer-events: none; }
.brand svg { width: 38px; height: 38px; padding: 4px; border-radius: 11px; color: #fff; background: linear-gradient(135deg, oklch(.63 .2 25), oklch(.74 .17 65) 32%, oklch(.64 .14 185) 64%, oklch(.52 .21 295)); box-shadow: 0 3px 10px color-mix(in oklab, oklch(.52 .21 295) 30%, transparent); }
.brand svg path + path { stroke: #fff; opacity: .8; }
.brand svg circle { fill: #fff; }
.navbtn { border-color: var(--c-line); }
.navbtn[href="#labs"] { --h: 300; } .navbtn[href="#map"] { --h: 145; } .navbtn[href="#teacher"] { --h: 255; } .navbtn[href="#audit"] { --h: 50; } .navbtn.mhe { --h: 22; }
.navbtn.on, .navbtn:hover { background: var(--c); color: var(--c-ink); border-color: var(--c); }

/* buttons & chips take the colour of where they are (module, card, resource …) */
.btn { background: var(--c, var(--accent)); color: var(--c-ink); box-shadow: 0 1px 2px color-mix(in oklab, var(--c, var(--accent)) 35%, transparent); transition: transform .12s, box-shadow .12s, filter .12s; }
.btn:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 5px 14px color-mix(in oklab, var(--c, var(--accent)) 32%, transparent); }
.btn.ghost { background: var(--panel); color: var(--ink); border: 1px solid var(--c-line, var(--line)); box-shadow: none; }
.btn.ghost:hover:not(:disabled) { background: var(--c-soft, var(--panel2)); border-color: var(--c, var(--accent)); box-shadow: none; }
.chip:hover { border-color: var(--c, var(--accent)); }
.chip.on { background: var(--c, var(--accent)); color: var(--c-ink); border-color: var(--c, var(--accent)); }
.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent); }

/* sidebar */
.gchip { border-color: var(--c-line); font-weight: 500; }
.gchip:hover { background: var(--c-soft); }
.gchip.on { background: var(--c); color: var(--c-ink); border-color: var(--c); }
.gchip[data-g="0"].on { border: 2px solid transparent; background: linear-gradient(var(--ink), var(--ink)) padding-box, var(--spectrum) border-box; color: var(--bg); }
.mod > summary .mn { background: var(--c); color: var(--c-ink); border-radius: 6px; padding: 0 .35rem; min-width: 2.7em; text-align: center; font-weight: 700; }
.mod > summary:hover { background: var(--c-soft); }
.mod[open] > summary { color: var(--c); }
.lsn:hover { background: var(--c-soft); }
.lsn.on { background: var(--c-tint); box-shadow: inset 3px 0 0 var(--c); font-weight: 600; }
.unitlink { color: var(--c); font-weight: 500; }
.st.seen { background: oklch(.66 .13 255); border-color: oklch(.66 .13 255); }
.st.explored { background: oklch(.7 .12 185); border-color: oklch(.7 .12 185); }
.st.challenge { background: oklch(.75 .15 65); border-color: oklch(.75 .15 65); }
.st.quiz { background: oklch(.6 .19 300); border-color: oklch(.6 .19 300); }
.st.mastered { background: var(--good); border-color: var(--good); }

/* home */
.hero { padding: 1.4rem 1.5rem; border-radius: 18px; border: 1px solid var(--line); box-shadow: var(--shadow); background:
  radial-gradient(circle at 6% 10%, color-mix(in oklab, oklch(.7 .19 25) var(--glow), transparent), transparent 42%),
  radial-gradient(circle at 94% 6%, color-mix(in oklab, oklch(.64 .2 285) var(--glow), transparent), transparent 42%),
  radial-gradient(circle at 70% 105%, color-mix(in oklab, oklch(.72 .17 155) var(--glow), transparent), transparent 46%),
  var(--panel); }
.hw { color: var(--c); }
.hero .labbtns .btn:not(.ghost) { background: linear-gradient(95deg, oklch(.55 .15 200), oklch(.5 .2 290)); color: #fff; }
.hspec { margin: 1rem 0 0; max-width: 460px; }
.hspec-bar { position: relative; height: 22px; border-radius: 6px; background: #07090d; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.hspec-bar::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #7a00d4, #3b3bff, #00b3ff, #00d98c, #b8e600, #ffd000, #ff7a00, #ff1f1f); opacity: .16; }
.hspec-bar i { position: absolute; top: 0; bottom: 0; width: 3px; margin-inline-start: -1.5px; background: var(--lc); box-shadow: 0 0 8px 2px var(--lc); }
.hspec-bar i[data-nm="410"] { --lc: #9747ff; } .hspec-bar i[data-nm="434"] { --lc: #5b5dff; } .hspec-bar i[data-nm="486"] { --lc: #22c9ff; } .hspec-bar i[data-nm="656"] { --lc: #ff3030; }
.hspec figcaption { font-family: var(--f-mono); font-size: .72rem; color: var(--muted); margin-top: .3rem; letter-spacing: .02em; }
.stat { border-top: 4px solid var(--c); background: linear-gradient(180deg, var(--c-soft), var(--panel)); }
.stat b { color: var(--c); }
.stat:nth-child(1) { --h: 185; } .stat:nth-child(2) { --h: 300; } .stat:nth-child(3) { --h: 50; } .stat:nth-child(4) { --h: 145; }
.gradepick { position: relative; overflow: hidden; }
.gradepick::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--spectrum); }
.gradebtn { position: relative; overflow: hidden; background: var(--c-soft); border-color: var(--c-line); transition: transform .12s, border-color .12s; padding-inline-start: 1.15rem; }
.gradebtn::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 6px; background: var(--c); }
.gradebtn b { color: var(--c); }
.gradebtn:hover { border-color: var(--c); transform: translateY(-1px); }
.gradebtn.on { background: var(--c); border-color: var(--c); color: var(--c-ink); }
.gradebtn.on b { color: inherit; }
.gradebtn.on::before { background: color-mix(in oklab, var(--c-ink) 35%, transparent); }
.gradebtn[data-g="0"]::before { background: var(--spectrum); }
.gradebtn[data-g="0"].on { border: 2px solid transparent; background: linear-gradient(var(--ink), var(--ink)) padding-box, var(--spectrum) border-box; color: var(--bg); }
.sectionh h2::before, h2.sech::before { content: ""; display: inline-block; width: .6em; height: .6em; border-radius: 3px; margin-inline-end: .45rem; vertical-align: .08em; background: var(--c, var(--spectrum)); }
.sectionh[data-g] h2 { color: var(--c); }
.mapmod[data-m] { border-top: 4px solid var(--c); background: linear-gradient(180deg, var(--c-soft), var(--panel) 4.5rem); }
.mapmod[data-m] h3 .mn { background: var(--c); color: var(--c-ink); border-radius: 6px; padding: .05rem .38rem; font-size: .78rem; }
.mapmod[data-m] .maplsn:hover { background: var(--c-soft); }
.modlink:hover { color: var(--c, var(--accent)); }
.pbar { background: color-mix(in oklab, var(--c, var(--accent)) 12%, var(--panel2)); }
.pbar i { background: linear-gradient(90deg, var(--c, var(--accent)), color-mix(in oklab, var(--c, var(--accent)) 55%, var(--panel))); }
.steps5 i:nth-child(1).on { background: oklch(.66 .13 255); } .steps5 i:nth-child(2).on { background: oklch(.7 .12 185); }
.steps5 i:nth-child(3).on { background: oklch(.75 .15 65); } .steps5 i:nth-child(4).on { background: oklch(.6 .19 300); }
.mhecard { --h: 22; }

/* lesson page (the whole page carries its module colour) */
.wrap[data-m] .crumbs a { color: var(--c); font-weight: 500; }
.lhead { padding: 1rem 1.2rem; border-radius: 16px; background: linear-gradient(118deg, var(--c-tint, var(--panel)), var(--panel) 78%); border: 1px solid var(--c-line, var(--line)); border-inline-start: 6px solid var(--c, var(--accent)); box-shadow: var(--shadow); }
.lnum { color: var(--c, var(--accent)); font-weight: 700; }
.type[data-t] { background: var(--c-soft); border-color: var(--c-line); color: var(--c); font-weight: 600; border-radius: 999px; padding: .12rem .6rem; }
.fq { border-inline-start: 4px solid var(--c, var(--amber)); background: var(--c-soft, var(--panel)); }
.fq b { color: var(--c, var(--amber)); }
.tabs { gap: .2rem; border-bottom: 2px solid var(--line); }
.tab { display: inline-flex; align-items: center; gap: .45rem; border-radius: 10px 10px 0 0; color: var(--ink); border-bottom: 3px solid transparent; }
.tab::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.tab:hover { background: var(--c-soft); }
.tab.on { color: var(--c); border-bottom-color: var(--c); background: var(--c-soft); font-weight: 600; }
.card.hue { border-top: 4px solid var(--c); background: linear-gradient(180deg, var(--c-soft), var(--panel) 5.5rem); }
.card.hue > h3 { color: var(--c); }
.card.hue li::marker { color: var(--c); font-weight: 700; }
.card.hue .eqlist li { background: var(--c-soft); border-inline-start: 3px solid var(--c); }
.vocab { display: flex; flex-wrap: wrap; gap: .45rem; }
.vocab > div { display: inline-flex; border: 1px solid var(--c-line); background: var(--c-soft); border-radius: 999px; padding: .18rem .75rem; font-weight: 500; }
.vocab > div:nth-child(7n+1) { --h: 25; } .vocab > div:nth-child(7n+2) { --h: 60; } .vocab > div:nth-child(7n+3) { --h: 100; } .vocab > div:nth-child(7n+4) { --h: 150; }
.vocab > div:nth-child(7n+5) { --h: 195; } .vocab > div:nth-child(7n+6) { --h: 255; } .vocab > div:nth-child(7n) { --h: 305; }
.lvl:nth-child(1) { --h: 145; } .lvl:nth-child(2) { --h: 55; } .lvl:nth-child(3) { --h: 20; }
.lvl { border-color: var(--c-line); }
.lvl.on { border-color: var(--c); color: var(--c); background: var(--c-soft); }
.score { color: var(--c, var(--accent)); }
.msg.u { background: var(--c, var(--accent)); color: var(--c-ink); }
.whypanel { border-inline-start-color: var(--c, var(--accent)); }

/* answer options: coloured letter badges, ✓ / ✗ when answered */
.opts { counter-reset: opt; }
.opt { display: flex; align-items: center; gap: .65rem; }
.opt::before { counter-increment: opt; content: counter(opt, upper-alpha); flex: none; width: 1.75rem; height: 1.75rem; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: var(--c-soft); color: var(--c); border: 1px solid var(--c-line); }
.opt:nth-child(4n+1) { --h: 255; } .opt:nth-child(4n+2) { --h: 145; } .opt:nth-child(4n+3) { --h: 50; } .opt:nth-child(4n+4) { --h: 330; }
.opt:hover:not(:disabled) { border-color: var(--c); background: var(--c-soft); }
.opts .opt.right::before { content: "✓"; background: var(--good); color: var(--c-ink); border-color: var(--good); }
.opts .opt.wrong::before { content: "✗"; background: var(--danger); color: var(--c-ink); border-color: var(--danger); }

/* resources, labs, unit pages */
.rcard { --h: 200; border-top: 4px solid var(--c); background: linear-gradient(180deg, var(--c-soft), var(--panel) 60%); }
.rcard.k-lab { --h: 300; } .rcard.k-simulation { --h: 185; } .rcard.k-video { --h: 25; } .rcard.k-files { --h: 70; } .rcard.k-document { --h: 255; } .rcard.k-activity { --h: 145; } .rcard.k-teacher { --h: 280; }
.rcard .rkind { color: var(--c); }
.labbar { background: linear-gradient(90deg, color-mix(in oklab, var(--accent) 12%, var(--panel)), var(--panel)); }
.simtile { border-inline-start: 4px solid var(--c, var(--accent)); }
.simtile:hover { background: var(--c-soft, var(--panel2)); border-color: var(--c, var(--accent)); }
.lctop .mn, .simtile .mn { color: var(--c, var(--accent)); }
.unithead > div:first-child { padding: 1.2rem 1.3rem; border-radius: 16px; background: linear-gradient(125deg, var(--c-tint, var(--panel)), var(--panel) 80%); border: 1px solid var(--c-line, var(--line)); border-inline-start: 6px solid var(--c, var(--accent)); box-shadow: var(--shadow); }
.kicker { color: var(--c, var(--accent)); font-weight: 600; }
.lcard { border-top: 4px solid var(--c, var(--accent)); }
.lcard:hover { border-color: var(--c, var(--accent)); box-shadow: 0 10px 24px color-mix(in oklab, var(--c, var(--accent)) 22%, transparent); }
.badge.seen { --h: 255; } .badge.explored { --h: 185; } .badge.challenge { --h: 55; } .badge.quiz { --h: 300; }
.badge.seen, .badge.explored, .badge.challenge, .badge.quiz { background: var(--c-tint); color: var(--c); font-weight: 600; }
.badge.mastered { color: var(--c-ink); }
table.data th { background: color-mix(in oklab, var(--accent) 12%, var(--panel)); }
.sitefoot { position: relative; border-top: 0; }
.sitefoot::before { content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: min(420px, 80%); height: 3px; border-radius: 3px; background: var(--spectrum); }

/* ---------- glossary, DOK levels, lab checks, class groups ---------- */
.gloss { margin: 0; display: grid; gap: .35rem; }
.gloss > div { border: 1px solid var(--c-line, var(--line)); background: var(--c-soft, var(--panel2)); border-radius: 8px; padding: .35rem .65rem; }
.gloss > div:nth-child(7n+1) { --h: 25; } .gloss > div:nth-child(7n+2) { --h: 60; } .gloss > div:nth-child(7n+3) { --h: 100; } .gloss > div:nth-child(7n+4) { --h: 150; }
.gloss > div:nth-child(7n+5) { --h: 195; } .gloss > div:nth-child(7n+6) { --h: 255; } .gloss > div:nth-child(7n) { --h: 305; }
.gloss dt { font-weight: 650; }
.gloss dd { margin: 0; font-size: .9rem; color: var(--ink); }
.gloss.hide > div { cursor: pointer; }
.gloss.hide > div:not(.shown) dd { color: transparent; background: var(--grid); border-radius: 4px; user-select: none; }
.gloss.hide > div:not(.shown) dd::selection { color: transparent; }
.dok { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .03em; padding: .08rem .5rem; border-radius: 999px; border: 1px solid var(--c-line, var(--line)); background: var(--c-soft, var(--panel2)); color: var(--c, var(--muted)); margin-bottom: .35rem; white-space: nowrap; }
.dok.d1 { --h: 145; } .dok.d2 { --h: 215; } .dok.d3 { --h: 55; } .dok.d4 { --h: 20; }
.dokrow { display: flex; gap: .4rem; flex-wrap: wrap; margin: .3rem 0; }
.dokrow .dok { font-size: .82rem; padding: .15rem .65rem; }
.rub { display: block; padding: .25rem 0; font-size: .92rem; cursor: pointer; }
.solution.model { font-family: var(--f-body); white-space: normal; }
.labcheck { border: 1px solid var(--line); border-inline-start: 5px solid var(--s3); border-radius: var(--radius); padding: .7rem 1rem; margin: -.4rem 0 1.2rem; background: var(--panel); }
.labcheck > summary { cursor: pointer; font-weight: 650; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.labcheck p { margin: .5rem 0; }
.labcheck ol { margin: .3rem 0 .6rem; padding-inline-start: 1.3rem; }
.gnum { width: 7rem; padding: .5rem .6rem; font-size: 1.3rem; font-weight: 650; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.fld select, .fld textarea { width: 100%; padding: .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font-weight: 400; }
.stratgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: .6rem; }
.strat { display: grid; gap: .3rem; text-align: start; align-content: start; background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--c, var(--accent)); border-radius: var(--radius); padding: .7rem .8rem; cursor: pointer; color: var(--ink); }
.strat:nth-child(8n+1) { --h: 25; } .strat:nth-child(8n+2) { --h: 60; } .strat:nth-child(8n+3) { --h: 145; } .strat:nth-child(8n+4) { --h: 185; }
.strat:nth-child(8n+5) { --h: 215; } .strat:nth-child(8n+6) { --h: 255; } .strat:nth-child(8n+7) { --h: 300; } .strat:nth-child(8n) { --h: 330; }
.strat span { font-size: .84rem; color: var(--muted); }
.strat small { color: var(--c, var(--accent)); font-weight: 600; }
.strat:hover { border-color: var(--c, var(--accent)); }
.strat.on { background: var(--c-soft, var(--panel2)); border-color: var(--c, var(--accent)); box-shadow: 0 0 0 2px var(--c, var(--accent)); }
.gsummary { margin-top: 1.2rem; padding: 1rem 1.2rem; border-radius: 14px; border: 1px solid var(--line); border-inline-start: 6px solid var(--accent); background: var(--panel); box-shadow: var(--shadow); }
.gsummary h2 { font-size: 1.3rem; }
.gsummary p { margin: .3rem 0 .2rem; font-size: 1.05rem; }
.gsummary .chips { align-items: center; margin-top: 0; }
.gtable { margin-bottom: .8rem; }
.gtable caption { text-align: start; font-weight: 650; padding: .3rem 0; }
.gtable table.data { font-size: .92rem; }
.gtable table.data td { white-space: normal; text-align: start; vertical-align: top; }
.gtable table.data td:first-child { white-space: nowrap; font-weight: 600; }
.gsteps { display: grid; gap: .5rem; padding-inline-start: 1.6rem; margin: 0 0 1rem; }
.gsteps li { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .9rem; }
.gsteps li::marker { font-weight: 700; color: var(--accent); }
.gstephead { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.gstephead b { font-size: 1.02rem; }
.gsteps p { margin: .3rem 0 0; }
.gtools { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .8rem; align-items: start; }
.gtool.wide { grid-column: 1 / -1; }
.gtime { font-family: var(--f-mono); font-size: clamp(3rem, 9vw, 5.5rem); font-weight: 700; line-height: 1.1; color: var(--accent); }
.gtime.low { color: var(--amber); } .gtime.done { color: var(--danger); }
.gpick { font-size: clamp(1.6rem, 4vw, 2.6rem); font-weight: 700; color: var(--accent); min-height: 1.3em; }
.gscore { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .6rem; }
.gscore > div { border: 1px solid var(--line); border-radius: 10px; padding: .5rem; text-align: center; background: var(--bg); }
.gscore b { display: block; font-family: var(--f-mono); font-size: 2rem; color: var(--accent); }
.gscore .chip { margin: 0 .15rem; }
.gqtext { font-size: clamp(1.1rem, 2.2vw, 1.5rem); margin: .3rem 0 .6rem; }
.gqopts { font-size: clamp(1rem, 1.8vw, 1.25rem); margin: 0 0 .8rem; padding-inline-start: 1.6rem; }
.gqopts li { margin: .3rem 0; }
.labpick { margin: 0 0 .8rem; }
.labpick .chip { min-height: 38px; font-weight: 500; }
.printonly { display: none; }
.navbtn[href="#groups"] { --h: 185; }
@media print {
  .top, .side, .sitefoot, .noprint, .stratgrid { display: none !important; }
  .shell { display: block; } main { padding: 0; }
  .printonly { display: inline; }
  .gsummary, .gsteps li, .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
  /* printing one group task: hide everything except that card, placed at the top of the first page */
  body.printing-group * { visibility: hidden; }
  body.printing-group .lessonwork, body.printing-group .lessonwork * { visibility: visible; }
  body.printing-group .lessonwork { position: absolute; left: 0; top: 0; width: 100%; border: 0; }
  /* printing a lab: only the lab sheet is printed */
  body.printing-lab * { visibility: hidden; }
  body.printing-lab .labprint-sheet, body.printing-lab .labprint-sheet * { visibility: visible; }
  body.printing-lab .labprint-sheet { display: block; position: absolute; left: 0; top: 0; width: 100%; }
  .labprint-lines { min-height: 8rem; border-bottom: 1px solid #999; }
}
.labprint-sheet { display: none; }
.exp-auto { font-weight: 700; }
.lw-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; flex-wrap: wrap; }
.lw-meta { color: var(--muted); font-size: .9rem; }
.bank-export { margin-top: 1rem; padding: .8rem 1rem; border: 1px dashed var(--line); border-radius: 12px; display: grid; gap: .3rem; background: var(--panel); }
.bank-export .labbtns { margin: .2rem 0 0; }
.lvl.graphs { border-color: var(--accent); }
.qti-question-image { display: block; max-width: 100%; height: auto; margin: .5rem 0; background: #fff; border-radius: 10px; border: 1px solid var(--line); }
.timeline-box { margin-top: .8rem; }
.timeline-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.timeline-row input[type=range] { flex: 1; min-width: 180px; }
.timeline-box .note { margin: .4rem 0 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

body.ap-mode .menubtn,
body.ap-mode .side,
#app.ap-active .menubtn,
#app.ap-active .side {
  display: none !important;
}

/* matching questions and drag-and-drop */
.matchq { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.55fr); gap: .75rem; align-items: start; margin: .6rem 0; }
.matchq .mcol { display: grid; gap: .5rem; }
.matchq .mcol-header { font-size: .75rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .2rem; }
.matchq .mterm, .matchq .mdef, .matchq .opt { width: 100%; text-align: start; position: relative; display: flex; align-items: center; gap: .75rem; padding: .65rem .85rem; border-radius: 10px; border: 1.5px solid var(--c-line, var(--line)); background: var(--bg); transition: transform .15s, border-color .15s, background-color .15s, box-shadow .15s; }
.matchq .mterm::before, .matchq .mdef::before, .matchq .opt::before { display: none !important; }
.matchq .mbadge { flex: none; width: 1.9rem; height: 1.9rem; border-radius: 8px; display: grid; place-items: center; font-weight: 750; font-size: .88rem; background: var(--c-soft, var(--panel2)); color: var(--c, var(--accent)); border: 1.5px solid var(--c-line, var(--line)); transition: all .2s; }
.matchq .mterm { font-weight: 700; cursor: grab; user-select: none; }
.matchq .mterm:active { cursor: grabbing; }
.matchq .mterm.on { outline: 3px solid var(--accent); outline-offset: 1px; background: var(--c-soft); border-color: var(--accent); }
.matchq .mterm.is-dragging { opacity: .4; transform: scale(0.97); }
.matchq .mterm.matched { opacity: .65; border-color: var(--good); background: color-mix(in srgb, var(--good) 8%, var(--panel)); cursor: default; }
.matchq .mterm.matched .mbadge, .matchq .mbadge-matched { background: var(--good) !important; color: #fff !important; border-color: var(--good) !important; }
.matchq .mterm-text { flex: 1; line-height: 1.4; }
.matchq .mdef { cursor: pointer; align-items: flex-start; }
.matchq .mdef.drag-over { border-color: var(--accent) !important; background: color-mix(in srgb, var(--accent) 15%, var(--panel)) !important; transform: scale(1.02); box-shadow: 0 4px 14px rgba(99,102,241,0.25); }
.matchq .mdef.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 12%, var(--panel)); opacity: 1; cursor: default; }
.matchq .mdef.right .mbadge-matched { background: var(--good); color: #fff; border-color: var(--good); }
.matchq .mdef.wrong { animation: shake .4s; border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--panel)); }
.matchq .mdrag-handle { margin-inline-start: auto; color: var(--muted); font-size: .85rem; opacity: .5; padding-left: 4px; }
.matchq .mdef-content { flex: 1; line-height: 1.45; font-size: .92rem; }
.matchq .mmatched-term-tag { margin-bottom: .3rem; }
.matchq .mmatched-pill { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--good); color: #fff; font-size: .8rem; font-weight: 750; letter-spacing: .02em; }
.matchq .mdef-text { color: var(--ink); }
.matchq .mmatched-term { color: var(--ink); font-weight: 750; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (max-width: 560px) { .matchq { grid-template-columns: 1fr; } }

/* ordering questions with drag and drop */
.orderq { margin: .6rem 0; display: grid; gap: .7rem; }
.orderq .order-hint { font-size: .82rem; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: .4rem; }
.order-list { display: grid; gap: .5rem; }
.order-item { display: flex; align-items: center; gap: .75rem; padding: .65rem .85rem; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); cursor: grab; user-select: none; transition: transform .15s, background .15s, border-color .15s, box-shadow .15s; }
.order-item:active { cursor: grabbing; }
.order-item.is-dragging { opacity: .4; transform: scale(0.98); background: var(--panel2); }
.order-item.drag-target-above { border-top: 3px solid var(--accent); }
.order-item.drag-target-below { border-bottom: 3px solid var(--accent); }
.order-grip { color: var(--muted); font-size: 1rem; cursor: grab; padding: 0 .2rem; flex: none; }
.order-num { flex: none; width: 1.85rem; height: 1.85rem; border-radius: 8px; display: grid; place-items: center; font-weight: 750; font-size: .88rem; background: var(--panel2); color: var(--accent); border: 1px solid var(--line); }
.order-text { flex: 1; font-weight: 600; font-size: .92rem; line-height: 1.4; }
.order-actions { display: flex; gap: .25rem; flex: none; }
.order-btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 6px; width: 1.65rem; height: 1.65rem; display: grid; place-items: center; font-size: .75rem; cursor: pointer; transition: background .12s, border-color .12s; }
.order-btn:hover:not(:disabled) { background: var(--panel2); border-color: var(--accent); }
.order-btn:disabled { opacity: .35; cursor: default; }
.order-item.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 10%, var(--panel)); cursor: default; }
.order-item.right .order-num { background: var(--good); color: #fff; border-color: var(--good); }
.order-item.wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--panel)); animation: shake .35s; }
.order-toolbar { display: flex; gap: .6rem; align-items: center; margin-top: .4rem; }
.qtigrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }
.qti .fld input[type=number] { padding: .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.qti .chips .rub { display: inline-block; margin-inline-end: 1rem; }

/* year plan editor */
.yptable td:not(:first-child), .yptable th:not(:first-child) { text-align: center; width: 4.2rem; }
.yptable input[type=checkbox] { width: 1.25rem; height: 1.25rem; }
.yptable .ypmod th, .yptable .ypmod td { background: var(--panel2); font-weight: 700; }
.yearplan .ansrow input[type=text], .yearplan .labbtns input[type=text] { flex: 1; min-width: 14rem; padding: .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.yearplan select { padding: .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }

/* Switch between the 5E journey and the traditional lesson (see the view mode in js/app.js) */
.crumbs .view-switch { margin-inline-start: auto; font-size: .85rem; padding: .2rem .7rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--accent); white-space: nowrap; }
.crumbs .view-switch:hover, .crumbs .view-switch:focus-visible { background: var(--panel); outline: none; text-decoration: underline; }

/* whole-book and grade lists: the grade and semester shown on each lesson */
.maplsn .lesson-tag { display: block; margin-inline-start: 1.4rem; font-size: .75rem; color: var(--muted); }

/* link back to the landing page, to choose another view */
.chooser-link { margin-inline-start: auto; font-size: .85rem; padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--accent); white-space: nowrap; }
.chooser-link:hover, .chooser-link:focus-visible { background: var(--panel); outline: none; text-decoration: underline; }
@media (max-width: 600px) { .chooser-link { font-size: .75rem; padding: .25rem .5rem; } }

/* discovery story: scientist, step-by-step experiment, historical note, check question */
.discovery-story { margin: 0 0 1.2rem; }
.ds-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.ds-count { font-size: .85rem; color: var(--muted); }
.ds-dots { display: flex; gap: .3rem; margin: .5rem 0 .8rem; }
.ds-dots i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.ds-dots i.on { background: var(--accent); }
.ds-stage { min-height: 9rem; }
.ds-stage h4 { margin: .3rem 0 .2rem; font-size: 1.1rem; }
.ds-when { color: var(--muted); margin: 0 0 .4rem; }
.ds-step { font-size: 1.05rem; }
.ds-fact { margin-top: .6rem; padding: .6rem .8rem; border-left: 4px solid var(--accent); background: var(--panel); border-radius: 8px; }
.ds-q { font-weight: 600; }
.ds-options { display: grid; gap: .4rem; margin: .5rem 0; }
.ds-option { text-align: start; padding: .5rem .7rem; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); cursor: pointer; font: inherit; }
.ds-option:disabled { cursor: default; }
.ds-option.right { border-color: var(--good, #2e7d32); background: rgba(46, 125, 50, .12); }
.ds-option.wrong { border-color: #c62828; background: rgba(198, 40, 40, .1); }
.ds-feedback { min-height: 1.4rem; }
.ds-nav { justify-content: space-between; }

/* watch the experiment: interactive canvas, controls, readouts and the scientist's voice */
.discovery-wrap { display: grid; gap: 1rem; margin: 0 0 1.2rem; }
.discovery-wrap .discovery-story { margin: 0; }
.experiment-box { margin: 0; }
.exp-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .6rem; }
.exp-tab { border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: .3rem .8rem; font: inherit; font-size: .88rem; cursor: pointer; }
.exp-tab.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #fff); }
.exp-frame { display: grid; gap: .6rem; }
.exp-title { font-size: 1.05rem; }
.exp-canvas { width: 100%; height: auto; aspect-ratio: 640 / 300; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); display: block; }
.exp-bar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.exp-controls { display: grid; gap: .7rem; }
.exp-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .5rem .9rem; align-items: end; }
.exp-fields:empty, .exp-actions:empty { display: none; }
.exp-fields > * { min-width: 0; }
.exp-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.exp-actions .exp-auto { margin-inline-start: auto; }
.exp-field { display: grid; gap: .2rem; font-size: .9rem; min-width: 0; }
.exp-field select, .exp-field input[type=range] { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
.exp-field select { padding: .3rem .4rem; border-radius: 8px; }
.exp-field output { font-variant-numeric: tabular-nums; color: var(--muted); }
.exp-btn { font-size: .9rem; }
.exp-readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .5rem; }
.exp-read { border: 1px solid var(--line); border-radius: 10px; padding: .4rem .6rem; background: var(--panel); }
.exp-read small { display: block; color: var(--muted); }
.exp-read strong { font-size: 1rem; }
.exp-voice { display: grid; grid-template-columns: auto 1fr; gap: .4rem .8rem; align-items: start; border-top: 1px dashed var(--line); padding-top: .6rem; }
.exp-speaker { display: flex; align-items: center; gap: .5rem; grid-column: 1; }
.exp-speaker b, .exp-speaker small { display: block; }
.exp-speaker small { color: var(--muted); }
.exp-avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--accent); color: #fff; font-weight: 700; flex: none; }
.exp-avatar-img { object-fit: cover; object-position: center 20%; background: var(--line); border: 2px solid var(--accent); }
/* the scientist card beside the virtual lab: horizontal ribbon below apparatus, fully responsive */
.exp-layout { display: flex; flex-direction: column; gap: 1.25rem; width: 100%; }
.experiment-box.has-sci .exp-layout,
dialog .experiment-box.has-sci .exp-layout,
.cb-exp .experiment-box.has-sci .exp-layout,
.book-leaf .experiment-box.has-sci .exp-layout,
.exp-portal-slot .experiment-box.has-sci .exp-layout {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  gap: 1.25rem !important;
}
.exp-main,
dialog .exp-main,
.cb-exp .exp-main,
.book-leaf .exp-main,
.exp-portal-slot .exp-main {
  min-width: 0 !important;
  width: 100% !important;
}
.exp-canvas,
dialog .exp-canvas,
.cb-exp .exp-canvas,
.book-leaf .exp-canvas,
.exp-portal-slot .exp-canvas {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  aspect-ratio: 640 / 300 !important;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  display: block;
}
.exp-side:empty { display: none; }
.exp-side,
dialog .exp-side,
.cb-exp .exp-side,
.book-leaf .exp-side,
.exp-portal-slot .exp-side {
  width: 100% !important;
  order: 2 !important;
  position: static !important;
  margin-top: 0.5rem !important;
}
.exp-sci,
dialog .exp-sci,
.cb-exp .exp-sci,
.book-leaf .exp-sci,
.exp-portal-slot .exp-sci {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  display: grid !important;
  grid-template-columns: 88px 1fr auto !important;
  align-items: center !important;
  gap: 1.15rem !important;
  padding: 1rem 1.25rem !important;
  margin: 0.75rem 0 0 !important;
  border: 1.5px solid var(--line, rgba(0,0,0,0.1)) !important;
  border-radius: 14px !important;
  background: var(--card, var(--panel, #fff)) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05) !important;
  z-index: 1 !important;
}
.exp-sci-portrait,
dialog .exp-sci-portrait,
.cb-exp .exp-sci-portrait,
.book-leaf .exp-sci-portrait,
.exp-portal-slot .exp-sci-portrait {
  width: 88px !important;
  height: 88px !important;
  aspect-ratio: 1 !important;
  border-radius: 50% !important;
  overflow: hidden !important;
  border: 2.5px solid var(--accent, #0b6e79) !important;
  background: var(--line) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}
.exp-sci-img,
dialog .exp-sci-img,
.cb-exp .exp-sci-img,
.book-leaf .exp-sci-img,
.exp-portal-slot .exp-sci-img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center 20% !important;
  display: block !important;
}
.exp-sci-text,
dialog .exp-sci-text,
.cb-exp .exp-sci-text,
.book-leaf .exp-sci-text,
.exp-portal-slot .exp-sci-text {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.25rem !important;
  min-width: 0 !important;
}
.exp-sci-kicker,
dialog .exp-sci-kicker,
.cb-exp .exp-sci-kicker,
.book-leaf .exp-sci-kicker,
.exp-portal-slot .exp-sci-kicker {
  font-size: 0.72rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.12em !important;
  color: var(--accent, #0b6e79) !important;
}
.exp-sci-name,
dialog .exp-sci-name,
.cb-exp .exp-sci-name,
.book-leaf .exp-sci-name,
.exp-portal-slot .exp-sci-name {
  font-size: 1.18rem !important;
  line-height: 1.25 !important;
  font-weight: 800 !important;
  color: var(--ink) !important;
}
.exp-sci-dates,
dialog .exp-sci-dates,
.cb-exp .exp-sci-dates,
.book-leaf .exp-sci-dates,
.exp-portal-slot .exp-sci-dates {
  color: var(--muted) !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
}
.exp-sci-exp,
dialog .exp-sci-exp,
.cb-exp .exp-sci-exp,
.book-leaf .exp-sci-exp,
.exp-portal-slot .exp-sci-exp {
  margin: 0.2rem 0 0 !important;
  font-size: 0.88rem !important;
  line-height: 1.4 !important;
  color: var(--ink) !important;
}
.exp-sci-quote,
dialog .exp-sci-quote,
.cb-exp .exp-sci-quote,
.book-leaf .exp-sci-quote,
.exp-portal-slot .exp-sci-quote {
  margin: 0.35rem 0 0 !important;
  padding: 0 0 0 0.6rem !important;
  border-left: 3px solid var(--accent, #0b6e79) !important;
  font-style: italic !important;
  color: var(--muted) !important;
  font-size: 0.84rem !important;
  line-height: 1.45 !important;
  display: block !important;
}
.exp-sci-play,
dialog .exp-sci-play,
.cb-exp .exp-sci-play,
.book-leaf .exp-sci-play,
.exp-portal-slot .exp-sci-play {
  grid-column: auto !important;
  width: auto !important;
  align-self: center !important;
  white-space: nowrap !important;
  padding: 0.65rem 1.15rem !important;
  font-weight: 700 !important;
  font-size: 0.88rem !important;
  justify-content: center !important;
}
@media (max-width: 720px) {
  .exp-sci,
  dialog .exp-sci,
  .cb-exp .exp-sci,
  .book-leaf .exp-sci,
  .exp-portal-slot .exp-sci {
    grid-template-columns: 72px 1fr !important;
  }
  .exp-sci-portrait,
  dialog .exp-sci-portrait,
  .cb-exp .exp-sci-portrait,
  .book-leaf .exp-sci-portrait,
  .exp-portal-slot .exp-sci-portrait {
    width: 72px !important;
    height: 72px !important;
  }
  .exp-sci-play,
  dialog .exp-sci-play,
  .cb-exp .exp-sci-play,
  .book-leaf .exp-sci-play,
  .exp-portal-slot .exp-sci-play {
    grid-column: 1 / -1 !important;
    width: 100% !important;
  }
}
.exp-quote { margin: 0; font-style: italic; grid-column: 2; font-size: 1rem; }
.exp-voice .btn { grid-column: 2; justify-self: start; }
@media (max-width: 600px) { .exp-voice { grid-template-columns: 1fr; } .exp-quote, .exp-voice .btn { grid-column: 1; } }

/* ---------- Auto-Run Full Experiment Controls & Telemetry ---------- */
.exp-autorun-btn {
  background: linear-gradient(135deg, #0b6e79 0%, #0891b2 100%) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border: none !important;
  box-shadow: 0 2px 8px rgba(11, 110, 121, 0.35) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  padding: 0.55rem 1.05rem !important;
  border-radius: 9px !important;
  cursor: pointer !important;
  font-size: 0.88rem !important;
}
.exp-autorun-btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 14px rgba(11, 110, 121, 0.45) !important;
  filter: brightness(1.1) !important;
}
.exp-autorun-btn.exp-autorun-active {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%) !important;
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.25) !important;
  animation: expPulse 1.8s infinite !important;
}
@keyframes expPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(225, 29, 72, 0); }
}
.exp-autostatus {
  margin: 0.85rem 0;
  padding: 0.9rem 1.15rem;
  background: rgba(11, 110, 121, 0.08);
  border: 1.5px solid rgba(11, 110, 121, 0.3);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  animation: expFadeIn 0.25s ease;
}
@keyframes expFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.exp-autostatus-bar {
  width: 100%;
  height: 6px;
  background: rgba(11, 110, 121, 0.18);
  border-radius: 999px;
  overflow: hidden;
}
.exp-autostatus-fill {
  height: 100%;
  background: linear-gradient(90deg, #0b6e79, #06b6d4);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.exp-autostatus-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.exp-autostatus-badge {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #0b6e79;
  color: #fff;
  display: inline-flex;
  align-items: center;
}
.exp-autostatus-badge.ok {
  background: #16a34a !important;
}
.exp-autostatus-title {
  font-size: 0.96rem;
  color: var(--ink);
}
.exp-autostatus-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}
.exp-autostatus-complete {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Chemistry Quest game */
.quest-bar{display:flex;flex-wrap:wrap;gap:.6rem;align-items:center;margin:.6rem 0}
.quest-pad{display:flex;gap:.3rem;margin-inline-start:auto}
.quest-pad .btn{min-width:2.6rem;padding:.35rem .5rem}
.quest-stage{position:relative;max-width:1100px}
.quest-canvas{display:block;width:100%;height:auto;border-radius:14px;background:#0c141c;outline:none}
.quest-canvas:focus-visible{box-shadow:0 0 0 3px var(--accent,#0b6e79)}
.quest-q{position:absolute;inset:8% 10% auto;background:var(--panel,#fff);color:var(--ink,#14262b);border-radius:14px;padding:1rem 1.2rem;box-shadow:0 12px 40px rgba(0,0,0,.45);max-height:84%;overflow:auto}
.quest-q[hidden]{display:none}
.quest-qtext{font-size:1.05rem;margin:.4rem 0 .7rem}
.quest-opts{display:grid;gap:.45rem}
.quest-opts .btn{text-align:start;white-space:normal}
.quest-opts .btn.ok{background:#1f8a4c;color:#fff;border-color:#1f8a4c}
.quest-opts .btn.no{background:#b33a2e;color:#fff;border-color:#b33a2e}
.quest-fb{margin:.7rem 0 .5rem;font-weight:600}

/* automatic experiment run: analysis of the recorded trials (js/ui.js) */
.lab-analysis { margin-top: .7rem; padding: .75rem .95rem; border-radius: 12px; border: 1px solid var(--line, #d6dee6); background: var(--panel2, rgba(11, 110, 121, .06)); font-size: .92rem; line-height: 1.5; }
.lab-analysis h5 { margin: 0 0 .35rem; font-size: 1rem; }
.lab-analysis p { margin: .3rem 0; }
.lab-analysis .lab-conclusion { border-left: 3px solid var(--accent, #0b6e79); padding-left: .6rem; }

/* link from a grade-level lesson to the same AP topics (links only; the platforms are kept apart) */
.ap-samelink-std { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .45rem; font-size: .8rem; }
.ap-samelink-std .chip { font-size: .75rem; padding: .2rem .55rem; text-decoration: none; }

/* ---- lesson share links (js/share-links.js) ---- */
.lhead-share { color: var(--accent); }
body.shared-view .side, body.shared-view .menubtn, body.shared-view .top nav, body.shared-view .chooser-link, body.shared-view .crumbs, body.shared-view .ap-samelink-std { display: none !important; }
body.shared-view .brand { pointer-events: none; }
.share-banner { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; justify-content: space-between; margin: 0 0 1rem; padding: .6rem .9rem; border: 1px solid var(--line); border-inline-start: 4px solid var(--accent); border-radius: 10px; background: var(--panel2); font-weight: 700; }
.share-banner-when { font-weight: 500; color: var(--muted); font-size: .9rem; }
.share-backdrop { position: fixed; inset: 0; z-index: 100001; display: grid; place-items: center; padding: 16px; background: rgba(10, 18, 30, .55); }
.share-card { width: min(540px, 100%); max-height: calc(100vh - 32px); overflow: auto; display: grid; gap: .7rem; padding: 1.1rem 1.2rem; border-radius: 16px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0, 0, 0, .3); }
.share-head { display: flex; align-items: center; gap: .6rem; }
.share-head h3 { margin: 0; flex: 1; font-size: 1.15rem; }
.share-x, .share-mini { border: 1px solid var(--line); background: transparent; color: inherit; border-radius: 8px; padding: .25rem .6rem; cursor: pointer; font: inherit; font-size: .85rem; }
.share-x { width: 32px; height: 32px; padding: 0; }
.share-lesson { margin: 0; }
.share-label { margin: .2rem 0 0; font-weight: 700; }
.share-days { display: flex; flex-wrap: wrap; gap: .4rem; }
.share-day { border: 1px solid var(--line); background: var(--panel); color: inherit; border-radius: 999px; padding: .35rem .8rem; cursor: pointer; font: inherit; font-size: .9rem; }
.share-day.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.share-until, .share-note, .share-small { margin: 0; color: var(--muted); font-size: .88rem; }
.share-make, .share-copy { justify-self: start; border: 0; border-radius: 10px; padding: .55rem 1rem; background: var(--accent); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.share-out { display: grid; gap: .4rem; }
.share-url-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.share-url { flex: 1 1 220px; min-width: 0; font: inherit; font-size: .85rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); color: inherit; }
.share-made { display: grid; gap: .35rem; }
.share-made h4 { margin: .4rem 0 0; font-size: .9rem; }
.share-made-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .85rem; }
.share-made-row.gone { opacity: .6; }
.share-made-when { flex: 1; color: var(--muted); }
.share-pill { padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--panel2); }
.share-pill.live { background: rgba(34, 197, 94, .15); color: #15803d; }
.share-pill.forever { background: rgba(56, 189, 248, .15); color: #0369a1; }
.share-pill.gone { background: rgba(148, 163, 184, .2); }
.share-stop { max-width: 520px; margin: 12vh auto; text-align: center; display: grid; gap: .6rem; padding: 2rem 1.2rem; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.share-stop-icon { font-size: 2.6rem; }
.share-stop h1 { margin: 0; font-size: 1.5rem; }
.share-stop p { margin: 0; color: var(--muted); }

/* Keep Saudi Tests (NAFS & NESMO) completely isolated and visually aligned to its teal/violet studio palette */
html body.saudi-mode {
  --bg: #eef2f0; --panel: #f9fbfa; --panel2: #e4ebe8; --ink: #13201d; --muted: #566762; --grid: #d3ddd9; --line: #c3d0cb;
  --accent: #0b6e79; --accent-ink: #ffffff; --accent-2: #7a3fb0; --accent-2-ink: #ffffff;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]):not([data-theme="dark"]) body.saudi-mode {
    --bg: #0e1614; --panel: #15201d; --panel2: #1c2926; --ink: #e2ece9; --muted: #93a6a0; --grid: #2a3834; --line: #334541;
    --accent: #4cc3cf; --accent-ink: #062226; --accent-2: #c7a2f0; --accent-2-ink: #1e1133;
  }
}
html[data-theme="dark"] body.saudi-mode {
  --bg: #0e1614; --panel: #15201d; --panel2: #1c2926; --ink: #e2ece9; --muted: #93a6a0; --grid: #2a3834; --line: #334541;
  --accent: #4cc3cf; --accent-ink: #062226; --accent-2: #c7a2f0; --accent-2-ink: #1e1133;
}
body.saudi-mode .periodic-float,
body.saudi-mode .periodic-float-launch,
body.saudi-mode .periodic-float-drawer,
body.saudi-mode #periodic-float-drawer,
body.saudi-mode #nextgen-floating-orb,
body.saudi-mode .nextgen-orb-wrap {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Native in-page NESMO Olympiad Hub layout & tokens */
.nesmo-native-wrap {
  --surface: var(--panel);
  --surface-2: var(--panel2);
  --surface-3: var(--grid);
  --primary: var(--accent);
  --primary-hover: var(--accent);
  --primary-ink: var(--accent-ink);
  --primary-soft: color-mix(in srgb, var(--accent) 14%, var(--panel));
  --primary-soft-ink: var(--accent);
  --danger-soft: color-mix(in srgb, var(--danger) 14%, var(--panel));
  --success: var(--good);
  --success-soft: color-mix(in srgb, var(--good) 14%, var(--panel));
  --warning-soft: color-mix(in srgb, var(--amber) 14%, var(--panel));
  --shadow-1: var(--shadow);
  --ink-2: var(--ink);
  --line-strong: var(--line);
  --font: var(--f-body);
  --font-num: var(--f-body);
}
.nesmo-native-wrap .stack { display: grid; gap: 1rem; }
.nesmo-native-wrap .row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.nesmo-native-wrap .row.between { justify-content: space-between; }
.nesmo-native-wrap .btn-row { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }
.nesmo-native-wrap .grid,
.nesmo-native-wrap .grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: .9rem; }
.nesmo-native-wrap .card-flat { box-shadow: none; background: var(--panel2); }
.nesmo-native-wrap .btn-primary,
.nesmo-native-wrap .btn.on,
.nafs-route .btn.primary { background: var(--accent, #0b6e79); color: var(--accent-ink, #ffffff); border-color: var(--accent, #0b6e79); font-weight: 700; }
.nesmo-native-wrap [data-set-round="1"].btn.on,
.nesmo-native-wrap #btn-nesmo-lang-switch { background: var(--accent-2, #7a3fb0); color: var(--accent-2-ink, #ffffff); border-color: var(--accent-2, #7a3fb0); }
.nesmo-native-wrap .btn-outline { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.nesmo-native-wrap .btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.nesmo-native-wrap .btn-sm { padding: .35rem .75rem; min-height: 34px; font-size: .84rem; }
.nesmo-native-wrap .chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .22rem .65rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--ink);
}
.nesmo-native-wrap .field { display: flex; flex-direction: column; gap: .35rem; font-size: .88rem; font-weight: 600; }
.nesmo-native-wrap .input,
.nesmo-native-wrap .select {
  width: 100%;
  padding: .48rem .65rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}
.nesmo-native-wrap .options { display: grid; gap: .5rem; }
.nesmo-native-wrap .opt {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .6rem .8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
}
.nesmo-native-wrap .opt:has(input:checked) { border-color: var(--accent); background: var(--primary-soft); }
.nesmo-native-wrap .opt.is-correct { border-color: var(--good); background: var(--success-soft); }
.nesmo-native-wrap .opt.is-wrong { border-color: var(--danger); background: var(--danger-soft); }
.nesmo-native-wrap .opt-key { font-weight: 800; color: var(--accent); min-width: 1.4em; }
.nesmo-native-wrap .callout {
  padding: .7rem .9rem;
  border-radius: 10px;
  border-inline-start: 4px solid var(--accent);
  background: var(--primary-soft);
}
.nesmo-native-wrap .callout-success { border-inline-start-color: var(--good); background: var(--success-soft); }
.nesmo-native-wrap .callout-warn { border-inline-start-color: var(--amber); background: var(--warning-soft); }
.nesmo-native-wrap .callout-info { border-inline-start-color: var(--accent); background: var(--primary-soft); }
.nesmo-native-wrap .q-figure,
.nesmo-native-wrap .opt-fig { max-width: 100%; margin: .5rem 0; }
.nesmo-native-wrap .q-figure svg,
.nesmo-native-wrap .opt-fig svg { max-width: 100%; height: auto; display: block; margin-inline: auto; }

/* ========================================================
   PLATFORM IDENTITY: AHMED KHALIFA BRANDING
   ======================================================== */
.teacher-badge-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: linear-gradient(135deg, rgba(11, 110, 121, 0.08), rgba(122, 63, 176, 0.06));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem 1.4rem;
  margin: 1.25rem 0;
  box-shadow: var(--shadow);
}
.teacher-badge-img {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid var(--accent);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 0 0 3px rgba(255, 255, 255, 0.35);
  background: #020d1a;
  flex-shrink: 0;
}
.teacher-badge-name {
  font-size: 1.22rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.teacher-badge-role {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 0.15rem;
}
.teacher-badge-motto {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.25rem;
  font-style: italic;
}
.sitefoot {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 1.2rem 1rem;
  font-size: 0.88rem;
  border-top: 1px solid var(--line);
  margin-top: 2rem;
  color: var(--muted);
}
.sitefoot .foot-logo {
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--accent);
  background: #020d1a;
  vertical-align: middle;
}

/* ================= McGraw-Hill Inspire Chemistry Periodic Module Cards ================= */
.chem-modules-shelf-wrap {
  position: relative;
  margin: 1.5rem 0 2rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem 1.4rem 0.8rem;
  box-shadow: var(--shadow);
}
.chem-modules-shelf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}
.chem-modules-shelf-header h3 {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
}
.chem-modules-shelf-sub {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0.2rem 0 0.8rem;
}
.chem-modules-shelf {
  display: flex;
  gap: 1.35rem;
  overflow-x: auto;
  padding: 0.6rem 0.4rem 1.2rem;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  align-items: flex-start;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.chem-modules-shelf::-webkit-scrollbar {
  height: 6px;
}
.chem-modules-shelf::-webkit-scrollbar-track {
  background: transparent;
}
.chem-modules-shelf::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}
.chem-modules-shelf::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* Individual Module Element Card */
.chem-module-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-decoration: none;
  cursor: pointer;
  flex: 0 0 auto;
  width: 98px;
  text-align: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.18s ease;
  user-select: none;
  background: transparent;
  border: none;
  padding: 0;
}
.chem-module-card:hover {
  transform: translateY(-5px);
}
.chem-module-card:active {
  transform: translateY(-1px) scale(0.97);
}
.chem-module-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 10px;
}

/* The Element Tile Box */
.chem-module-tile {
  position: relative;
  width: 62px;
  height: 62px;
  border: 2.2px solid var(--mod-border, var(--c));
  border-radius: 10px;
  background: var(--mod-bg, var(--c-soft));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.chem-module-card:hover .chem-module-tile {
  box-shadow: 0 6px 18px color-mix(in srgb, var(--mod-border, var(--c)) 30%, transparent);
}

/* Top-Left Atomic / Chapter Number */
.chem-module-num {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  font-family: var(--f-mono, monospace), system-ui, sans-serif;
  color: var(--mod-border, var(--c));
}

/* Center 2-Letter Chemical Symbol */
.chem-module-sym {
  font-size: 25px;
  font-weight: 700;
  line-height: 1;
  font-family: 'Times New Roman', Times, 'Liberation Serif', Georgia, serif;
  color: var(--mod-color, var(--c));
  margin-top: 6px;
  letter-spacing: -0.5px;
}

/* Title text below the tile */
.chem-module-title {
  margin-top: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
  width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}
.chem-module-card:hover .chem-module-title {
  color: var(--mod-border, var(--accent));
}

/* Sizing Modifiers */
.chem-module-tile-sm {
  width: 38px;
  height: 38px;
  border-width: 1.8px;
  border-radius: 7px;
  flex-shrink: 0;
  box-shadow: none;
}
.chem-module-tile-sm .chem-module-num {
  font-size: 8px;
  top: 2px;
  left: 3px;
}
.chem-module-tile-sm .chem-module-sym {
  font-size: 16px;
  margin-top: 4px;
}

.chem-module-tile-mini {
  width: 28px;
  height: 28px;
  border-width: 1.5px;
  border-radius: 6px;
  flex-shrink: 0;
  display: inline-flex;
  margin-inline-end: 0.45rem;
  vertical-align: middle;
}
.chem-module-tile-mini .chem-module-num {
  font-size: 7px;
  top: 1px;
  left: 2px;
}
.chem-module-tile-mini .chem-module-sym {
  font-size: 12px;
  margin-top: 2px;
}

.chem-module-tile-hero {
  width: 86px;
  height: 86px;
  border-width: 3px;
  border-radius: 14px;
  flex-shrink: 0;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--mod-border, var(--c)) 25%, transparent);
}
.chem-module-tile-hero .chem-module-num {
  font-size: 14px;
  top: 6px;
  left: 8px;
}
.chem-module-tile-hero .chem-module-sym {
  font-size: 38px;
  margin-top: 10px;
}

/* Dark theme */
body:not([data-theme="light"]) .chem-module-tile,
[data-theme="dark"] .chem-module-tile {
  background: color-mix(in srgb, var(--mod-border, var(--c)) 16%, #0f172a);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
body:not([data-theme="light"]) .chem-module-sym,
[data-theme="dark"] .chem-module-sym {
  color: color-mix(in srgb, var(--mod-color, var(--c)) 85%, #ffffff);
}
body:not([data-theme="light"]) .chem-module-num,
[data-theme="dark"] .chem-module-num {
  color: color-mix(in srgb, var(--mod-border, var(--c)) 85%, #ffffff);
}



/* ═══════════════════════════════════════════════════════════════
   GLOBAL SEARCH — command-palette overlay (Ctrl+K)
   ═══════════════════════════════════════════════════════════════ */

/* ── Trigger button in the header ─── */
.gs-trigger-wrap { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; }
.gs-trigger-btn {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); border-radius: 8px;
  color: #fff; font-size: 1.05rem; padding: 4px 10px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.gs-trigger-btn:hover { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.45); }
.gs-trigger-hint {
  display: inline-block; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18);
  border-radius: 4px; padding: 1px 5px; font-size: .65rem; color: rgba(255,255,255,.6);
  font-family: system-ui, sans-serif; pointer-events: none;
}
@media (max-width: 700px) { .gs-trigger-hint { display: none; } }

/* ── Overlay backdrop ─── */
.gs-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: min(12vh, 100px);
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease;
}
.gs-overlay.gs-open { opacity: 1; pointer-events: auto; }
body.gs-no-scroll { overflow: hidden; }

/* ── Palette card ─── */
.gs-palette {
  width: min(640px, 92vw); max-height: 70vh;
  background: #1a1e2e; border: 1px solid rgba(255,255,255,.12); border-radius: 14px;
  box-shadow: 0 12px 48px rgba(0,0,0,.55), 0 0 0 1px rgba(92,199,211,.12);
  display: flex; flex-direction: column;
  transform: translateY(-12px) scale(.97); transition: transform .2s ease;
  overflow: hidden;
}
.gs-open .gs-palette { transform: translateY(0) scale(1); }

/* ── Input row ─── */
.gs-input-row {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.gs-icon { font-size: 1.2rem; opacity: .6; flex-shrink: 0; }
.gs-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: #e2e8f0; font-size: 1rem; font-family: inherit;
}
.gs-input::placeholder { color: rgba(255,255,255,.35); }
.gs-esc {
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 4px;
  padding: 2px 7px; font-size: .68rem; color: rgba(255,255,255,.45); flex-shrink: 0;
}

/* ── Results list ─── */
.gs-results {
  overflow-y: auto; flex: 1; padding: 6px 0;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent;
}
.gs-results::-webkit-scrollbar { width: 5px; }
.gs-results::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }

.gs-group-header {
  padding: 8px 16px 4px; font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--cmd-cyan, #5cc7d3); opacity: .75;
}
.gs-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; cursor: pointer; border-radius: 0;
  transition: background .1s;
}
.gs-item:hover, .gs-item.gs-active {
  background: rgba(92,199,211,.12);
}
.gs-item-icon { font-size: 1.15rem; flex-shrink: 0; width: 24px; text-align: center; }
.gs-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.gs-item-label {
  font-size: .88rem; font-weight: 600; color: #e2e8f0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-transform: capitalize;
}
.gs-item-sub {
  font-size: .72rem; color: rgba(255,255,255,.45);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gs-item-type {
  flex-shrink: 0; font-size: .6rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: rgba(255,255,255,.3); padding: 2px 6px;
  border: 1px solid rgba(255,255,255,.08); border-radius: 4px;
}
.gs-empty {
  padding: 24px 16px; text-align: center;
  color: rgba(255,255,255,.35); font-size: .85rem;
}

/* ── Footer ─── */
.gs-footer {
  padding: 8px 16px; border-top: 1px solid rgba(255,255,255,.06);
  font-size: .65rem; color: rgba(255,255,255,.25); text-align: center;
}

/* ==========================================================================
   Modern Streamlined Navigation, Monoline Icons & View Transitions
   ========================================================================== */

.nav-svg-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  vertical-align: -2px;
  margin-right: 0.35rem;
  flex-shrink: 0;
}
.nav-svg-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
}

.nav-dropdown {
  position: relative;
  display: inline-block;
}
.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 3px 8px rgba(0, 0, 0, 0.08);
  padding: 0.4rem;
  display: none;
  flex-direction: column;
  z-index: 1000;
  backdrop-filter: blur(16px);
}
.nav-dropdown.open .nav-dropdown-menu {
  display: flex;
}
.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.88rem;
  color: var(--ink, #1e293b);
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.nav-dropdown-item:hover {
  background: rgba(11, 110, 121, 0.08);
  color: var(--accent, #0b6e79);
}
.nav-dropdown-divider {
  height: 1px;
  background: var(--line, #e2e8f0);
  margin: 0.35rem 0.5rem;
  opacity: 0.6;
}

[data-theme="dark"] .nav-dropdown-menu,
body:not([data-theme="light"]) .nav-dropdown-menu {
  background: #111a22;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] .nav-dropdown-item,
body:not([data-theme="light"]) .nav-dropdown-item {
  color: #e2e8f0;
}
[data-theme="dark"] .nav-dropdown-item:hover,
body:not([data-theme="light"]) .nav-dropdown-item:hover {
  background: rgba(92, 199, 211, 0.15);
  color: #5cc7d3;
}
[data-theme="dark"] .nav-dropdown-divider,
body:not([data-theme="light"]) .nav-dropdown-divider {
  background: rgba(255, 255, 255, 0.1);
}

/* Native View Transitions (smooth page cross-fade) */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.15s;
  animation-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }
}

/* native labs (cfg.native): platform theme and components, with the lab notebook card under the lab */
.lab-notebook { margin-top: 1rem; }
.lab-notebook textarea { resize: vertical; }
.lab { container: lab / inline-size; grid-template-columns: minmax(0, 1fr); }
@container lab (max-width: 860px) { .labgrid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .labgrid > .stagewrap { grid-column: 1 / -1; order: -1; } }
@container lab (max-width: 540px) { .labgrid { grid-template-columns: minmax(0, 1fr); } }
/* a wide table or equation scrolls inside its own box instead of stretching the lab on phones */
.lab .stage { grid-template-columns: minmax(0, 1fr); }
.lab .stage > * { min-width: 0; max-width: 100%; }
.lab .stage > .miniTool, .lab .stage > .eqbig, .lab .stage > .stagehtml { overflow-x: auto; }
.lab .stage table.data.mini { display: block; overflow-x: auto; }
/* 3D molecule viewer: laid out like a lab; only the model's own parts are styled here */
.mol-viewer canvas.mol-canvas { height: 460px; cursor: grab; touch-action: pan-y; }
.mol-viewer canvas.mol-canvas:active { cursor: grabbing; }
.mol-hint { margin: .35rem 0 0; font-size: .8rem; text-align: center; }
.mol-legend { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; gap: .35rem; font-size: .86rem; }
.mol-legend li { display: flex; gap: .5rem; align-items: center; }
.mol-swatches { display: inline-flex; gap: 2px; flex: none; min-width: 26px; }
.mol-swatches i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.35); }

/* model studios (visual-labs.js): the same panels, buttons and theme as the lesson labs */
.visual-lab { display: grid; grid-template-columns: minmax(0, 1fr); gap: .8rem; margin: 1rem 0; container: studio / inline-size; }
.visual-lab-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .8rem; flex-wrap: wrap; }
.visual-lab-head h2 { font-size: 1.2rem; }
.visual-lab-head p { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; }
.visual-lab-kicker { display: block; font-weight: 750; letter-spacing: .13em; font-size: .68rem; text-transform: uppercase; color: var(--accent); margin-bottom: .3rem; }
.visual-lab-status { display: none; }
.visual-lab-body { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: .8rem; align-items: start; }
@container studio (max-width: 760px) { .visual-lab-body { grid-template-columns: minmax(0, 1fr); } }
.visual-lab-sidebar, .visual-lab-main, .visual-controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: .8rem; min-width: 0; }
.visual-lab-card, .visual-lab-facts, .visual-canvas-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; min-width: 0; }
.visual-lab-card h3 { font-size: .98rem; margin-bottom: .6rem; }
.visual-lab-facts { display: grid; gap: .3rem; font-size: .9rem; line-height: 1.5; }
.visual-molecule-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .4rem; }
.visual-molecule-option, .visual-pill { border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 12px; padding: .4rem .6rem; font: inherit; cursor: pointer; text-align: start; }
.visual-molecule-option b, .visual-molecule-option small { display: block; }
.visual-molecule-option small { color: var(--muted); font-size: .76rem; }
.visual-pill { border-radius: 999px; font-size: .88rem; }
.visual-molecule-option:hover, .visual-pill:hover { border-color: var(--accent); }
.visual-molecule-option.on, .visual-molecule-option.active, .visual-molecule-option[aria-pressed="true"], .visual-pill.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #fff); }
.visual-molecule-option.on small, .visual-molecule-option.active small, .visual-molecule-option[aria-pressed="true"] small { color: inherit; }
.visual-pill-row, .visual-button-row, .visual-toggle-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.visual-button { border: 0; background: var(--c, var(--accent)); color: var(--c-ink, var(--accent-ink, #fff)); border-radius: 12px; padding: .45rem .9rem; min-height: 40px; font: inherit; font-size: .88rem; font-weight: 650; cursor: pointer; }
.visual-button.ghost { background: var(--panel); border: 1px solid var(--line); color: var(--accent); }
.visual-button:hover { filter: brightness(1.05); }
.visual-toggle { display: inline-flex; gap: .35rem; align-items: center; font-size: .88rem; }
.visual-canvas-tools { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; font-size: .72rem; font-weight: 700; letter-spacing: .08em; color: var(--muted); margin-bottom: .5rem; }
.visual-lab-canvas { width: 100%; display: block; background: var(--panel); border-radius: 10px; touch-action: pan-y; }
.visual-control { display: grid; gap: .25rem; font-size: .88rem; min-width: 0; }
.visual-control select, .visual-control input[type=number] { width: 100%; min-width: 0; padding: .35rem .45rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.visual-range { display: flex; gap: .5rem; align-items: center; }
.visual-range input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }
.visual-range output { font-family: var(--f-mono); font-size: .82rem; color: var(--accent); }
.visual-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem; }
.visual-metric { border: 1px solid var(--line); border-radius: 10px; padding: .4rem .6rem; background: var(--panel); display: grid; }
.visual-metric small, .visual-metric span { color: var(--muted); font-size: .76rem; }
.visual-metric strong { font-size: 1rem; }
.visual-note, .visual-status { font-size: .86rem; color: var(--muted); margin: 0; }
