:root {
  --bg: #0b0d12; --panel: #12151d; --panel2: #171b25; --line: #232836; --text: #e6e8ee; --muted: #8a90a2;
  --accent: #7cc4ff;
  --c-lens: #e36bd0; --c-origin: #9b8cff; --c-less: #4fd1a5; --c-more: #f2c94c; --c-found: #7cc4ff; --c-bench: #ff7a59; --c-cosmos: #b8e986;
  --t-est: #4fd1a5; --t-con: #f2c94c; --t-spe: #ff7a59; --t-ana: #e36bd0; --t-hyp: #7cc4ff;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --sans: Inter, system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); }
button { font: inherit; color: inherit; cursor: pointer; }

header { display: flex; align-items: center; gap: 18px; padding: 10px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-family: var(--mono); letter-spacing: .12em; font-size: 13px; }
.brand b { color: var(--accent); font-weight: 600; }
nav { display: flex; gap: 4px; }
nav button { background: none; border: 1px solid transparent; padding: 6px 12px; border-radius: 6px; color: var(--muted); }
nav button.on { color: var(--text); border-color: var(--line); background: var(--panel); }
nav button:disabled { opacity: .35; cursor: default; }
.sub { margin-left: auto; color: var(--muted); font-size: 12px; }

body { display: flex; flex-direction: column; }
main { display: flex; flex: 1; min-height: 0; }
#stage { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#aside { width: var(--aside-w, 400px); flex-shrink: 0; border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; padding: 20px 22px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 20px; border-bottom: 1px solid var(--line); align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: none; font-size: 12px; color: var(--muted); }
.chip.on { color: var(--text); background: var(--panel2); }
.chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.spacer { flex: 1; }
.btn { padding: 5px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); font-size: 12px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { border-color: var(--accent); color: var(--accent); }

#atlas { flex: 1; min-height: 0; }
#atlas svg { width: 100%; height: 100%; display: block; }
.hole-label { font: 600 12px var(--sans); fill: var(--text); text-anchor: middle; }
.hole-id { font: 11px var(--mono); fill: var(--muted); text-anchor: middle; }
.lane-label { font: 11px var(--mono); fill: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.axis text { font: 11px var(--mono); fill: var(--muted); }
.idea-label { font: 11px var(--sans); fill: var(--muted); pointer-events: none; }
.arc { pointer-events: none; fill: none; stroke-width: 1.2; transition: opacity .15s; }
.node { cursor: pointer; transition: opacity .15s; }
.dim { opacity: .12; }

/* aside content */
.eyebrow { font: 11px var(--mono); color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
h2, h1.ttl { font-size: 20px; margin: 4px 0 6px; line-height: 1.25; }
h3 { font-size: 13px; margin: 18px 0 6px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
p { margin: 0 0 10px; }
.meta { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.tag { display: inline-block; font: 600 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; border: 1px solid; }
.tag.ESTABLISHED { color: var(--t-est); } .tag.CONTESTED { color: var(--t-con); } .tag.SPECULATIVE { color: var(--t-spe); }
.tag.ANALOGY { color: var(--t-ana); } .tag.RULEDOUT { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; } .tag.HYPOTHESIS { color: var(--t-hyp); border-style: dashed; }
.pillrow { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.holepill { font: 11px var(--mono); padding: 2px 8px; border-radius: 4px; background: var(--panel2); border: 1px solid var(--line); cursor: pointer; }
.holepill:hover { border-color: var(--accent); }
.bench { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 4px; }
.bench td { padding: 5px 0; border-bottom: 1px solid var(--line); }
.bench td:last-child { text-align: right; font-family: var(--mono); }
.v-yes { color: var(--t-est); } .v-part { color: var(--t-con); } .v-no { color: var(--t-spe); } .v-na, .v-unk { color: var(--muted); }
.note { border-left: 2px solid var(--line); padding-left: 10px; color: var(--muted); font-size: 13px; }
.bars { margin-top: 8px; }
.barrow { display: grid; grid-template-columns: 30px 1fr 24px; gap: 8px; align-items: center; font: 11px var(--mono); color: var(--muted); margin: 4px 0; cursor: pointer; }
.stack { display: flex; height: 10px; border-radius: 2px; overflow: hidden; background: var(--panel2); }
.caveat { font-size: 12px; color: var(--muted); margin-top: 16px; }

/* test bench table view */
#benchview { flex: 1; overflow: auto; padding: 16px 20px; display: none; }
#benchview table { border-collapse: collapse; width: 100%; font-size: 13px; }
#benchview th { text-align: left; font: 11px var(--mono); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; padding: 8px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); }
#benchview td { padding: 7px 10px; border-bottom: 1px solid var(--line); }
#benchview tr:hover td { background: var(--panel); cursor: pointer; }
#benchview td.sym { font-family: var(--mono); text-align: center; }
.camp-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 8px; }

/* modal */
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: center; justify-content: center; z-index: 10; }
#modal .box { width: min(560px, 92vw); max-height: 90vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 22px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 4px; }
input[type=text], textarea, select { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 8px; font: inherit; }
textarea { min-height: 64px; resize: vertical; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.checks label { display: inline-flex; gap: 4px; margin: 0; color: var(--text); font: 11px var(--mono); border: 1px solid var(--line); padding: 3px 8px; border-radius: 4px; }
.row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* flatland */
#flatland { flex: 1; min-height: 0; display: none; flex-direction: column; }
#fl-canvas-wrap { flex: 1; min-height: 0; position: relative; }
#fl-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ctl { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-right: 10px; }
.ctl input[type=range] { width: 160px; accent-color: var(--accent); }
.ctl output { font-family: var(--mono); color: var(--text); min-width: 44px; }
.chapters { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 16px; }
.chapters button { font: 11px var(--mono); padding: 4px 9px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel2); color: var(--muted); }
.chapters button.on { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.try { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 12px 0; font-size: 13px; }
.try b { color: var(--accent); }
blockquote { margin: 10px 0; padding-left: 12px; border-left: 2px solid var(--c-lens); color: var(--text); font-style: italic; }
table.counts { border-collapse: collapse; width: 100%; font: 12px var(--mono); margin-top: 6px; }
table.counts td, table.counts th { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: right; }
table.counts th { color: var(--muted); font-weight: 400; }
table.counts td:first-child, table.counts th:first-child { text-align: left; }
table.counts tr.cur td { color: var(--accent); }
.hidden-val { color: var(--muted); cursor: pointer; border-bottom: 1px dashed var(--muted); }
#aside a { color: var(--accent); }

/* Build 2: nav groups, level control, tiers */
nav { flex-wrap: wrap; align-items: center; }
.navgrp { font: 10px var(--mono); color: var(--muted); letter-spacing: .1em; text-transform: uppercase; margin: 0 2px 0 10px; opacity: .7; }
nav button { padding: 5px 10px; font-size: 13px; }
#levelctl { display: flex; align-items: center; gap: 4px; }
.lvl-label { font: 10px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin-right: 4px; }
.lvl { font-size: 11px; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); background: none; color: var(--muted); }
.lvl.on.lvl1 { color: var(--bg); background: var(--t-est); border-color: var(--t-est); }
.lvl.on.lvl2 { color: var(--bg); background: var(--t-spe); border-color: var(--t-spe); }
.lvl.on.lvl3 { color: var(--t-hyp); border-style: dashed; border-color: var(--t-hyp); background: rgba(124,196,255,.08); }
.tier { display: inline-block; font: 600 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px; border-radius: 4px; }
.tier-main { background: rgba(79,209,165,.15); color: var(--t-est); }
.tier-front { background: rgba(255,122,89,.15); color: var(--t-spe); }
.tier-exp { border: 1px dashed var(--t-hyp); color: var(--t-hyp); }
.tier-lens { background: rgba(227,107,208,.15); color: var(--t-ana); }
.exp-banner { border: 1px dashed var(--t-hyp); background: rgba(124,196,255,.07); color: var(--text); border-radius: 8px; padding: 8px 12px; margin: 10px 0; font-size: 12.5px; }
.exp-banner b { color: var(--t-hyp); }
.exp-box { margin-top: 14px; }
.exp-ctl { color: var(--t-hyp); }
.expdot { color: var(--t-hyp); }
.legend > div { margin: 8px 0; }
#lab { flex: 1; min-height: 0; display: none; flex-direction: column; }
#lab-canvas-wrap { flex: 1; min-height: 0; position: relative; }
#lab-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#doc { flex: 1; overflow: auto; display: none; }
.docwrap { padding: 20px 24px 40px; max-width: 1400px; }
.dintro { max-width: 820px; }
.dgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 16px; }
.dgroup { border-top: 3px solid var(--gc); background: var(--panel); border-radius: 6px; padding: 10px; }
.dhead { font: 600 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--gc); margin-bottom: 8px; }
.dcard { border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; margin-bottom: 10px; background: var(--bg); }
.dcard.exp { border: 1px dashed var(--t-hyp); }
.dname { font-weight: 600; font-size: 13px; margin-bottom: 6px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.dcard dl { margin: 0; font-size: 11.5px; }
.dcard dt { color: var(--muted); font: 10px var(--mono); margin-top: 5px; }
.dcard dd { margin: 0; }
.dnative { font-size: 12px; color: var(--text); border-top: 1px solid var(--line); padding-top: 8px; }
.dnative ul { margin: 4px 0 0 16px; padding: 0; color: var(--muted); }
table.orph { border-collapse: collapse; width: 100%; font-size: 13px; margin-top: 8px; }
table.orph th { text-align: left; font: 11px var(--mono); color: var(--muted); padding: 7px 10px; border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: .05em; }
table.orph td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.biglist li { margin: 6px 0; }
code { font-family: var(--mono); font-size: 12px; }
.hole-label { font-size: 11px; }

/* Build 2.1: navigation segments, help */
header { gap: 14px; }
nav { flex: 1; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.navseg { --gcol: #7cc4ff; display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--gcol) 35%, transparent); background: color-mix(in srgb, var(--gcol) 7%, transparent); }
.navseg.g-labs { --gcol: #4fd1a5; }
.navseg.g-method { --gcol: #f2c94c; }
.navseg .navgrp { color: var(--gcol); opacity: 1; margin: 0 6px 0 8px; font-size: 10px; }
.navseg button { border: 0; border-radius: 7px; padding: 5px 10px; font-size: 13px; color: var(--text); opacity: .72; background: none; }
.navseg button:hover { opacity: 1; background: color-mix(in srgb, var(--gcol) 16%, transparent); }
.navseg button.on { opacity: 1; background: var(--gcol); color: #0b0d12; font-weight: 600; }
.hdr-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.helpbtn { border: 1px solid var(--accent); color: var(--accent); background: rgba(124,196,255,.08); border-radius: 999px; padding: 5px 14px; font-size: 13px; font-weight: 600; }
.helpbtn:hover { background: var(--accent); color: var(--bg); }
#help { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: none; align-items: flex-start; justify-content: center; z-index: 20; overflow-y: auto; padding: 40px 16px; }
.helpbox { position: relative; width: min(980px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px 32px 24px; }
.hclose { position: absolute; top: 14px; right: 16px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel2); font-size: 20px; line-height: 1; }
.hclose:hover { border-color: var(--accent); }
.helpbox h2 { font-size: 26px; margin: 4px 0 10px; }
.hlead { font-size: 15px; max-width: 760px; }
.hsec { margin-top: 22px; --gcol: var(--muted); }
.hsec.g-explore { --gcol: #7cc4ff; } .hsec.g-labs { --gcol: #4fd1a5; } .hsec.g-method { --gcol: #f2c94c; } .hsec.g-voyages { --gcol: #e36bd0; } .hsec.g-cosmos { --gcol: #9b8cff; }
.hsec h3 { font-size: 15px; color: var(--text); margin: 0 0 2px; display: flex; align-items: center; gap: 8px; }
.hdot { width: 10px; height: 10px; border-radius: 3px; background: var(--gcol); display: inline-block; }
.hgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 8px; }
.hcard { text-align: left; display: flex; flex-direction: column; gap: 6px; background: var(--bg); border: 1px solid var(--line); border-left: 3px solid var(--gcol); border-radius: 8px; padding: 12px 14px; }
.hcard:hover { border-color: var(--gcol); }
.hname { font-weight: 600; font-size: 14px; }
.hdesc { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.hgo { font-size: 12px; color: var(--gcol); margin-top: auto; }
#hint { position: fixed; right: 20px; bottom: 20px; z-index: 15; display: none; align-items: center; gap: 10px; background: var(--panel2); border: 1px solid var(--accent); border-radius: 999px; padding: 8px 10px 8px 16px; font-size: 13px; box-shadow: 0 6px 24px rgba(0,0,0,.4); transition: opacity 1s; }
#hint.fade { opacity: .55; }
#hint button { background: none; border: 0; color: var(--accent); font-weight: 600; }
#hint #hint-x { color: var(--muted); font-size: 18px; padding: 0 4px; }
.navseg button { padding: 4px 8px; font-size: 12.5px; }
.navseg .navgrp { margin: 0 4px 0 6px; }
nav { gap: 6px; }
.lvl { padding: 3px 8px; }
@media (max-width: 1750px) { .brand-sub { display: none; } }
@media (max-width: 1360px) and (min-width: 901px) { .navseg .navgrp { display: none; } }

/* Learn | Lab mode switch */
.modesw { display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.modesw button { font-size: 12px; padding: 4px 12px; border-radius: 999px; border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; }
.modesw button.on { color: var(--bg); background: var(--t-est); }
.modesw button.lab.on { color: var(--t-hyp); background: rgba(124,196,255,.1); border: 1px dashed var(--t-hyp); }
/* Learn mode: idea names appear only for the focused hole/idea, so the Atlas reads as a map, not a knot */
.mode-learn #atlas .idea .idea-label { opacity: 0; transition: opacity .15s ease-out; }
.mode-learn #atlas .idea.hot .idea-label { opacity: 1; }
/* Next-question hand-off at the end of each lab */
.nextq { display: block; margin-top: 18px; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; background: var(--panel2); color: var(--text); text-decoration: none; }
.nextq:hover { border-color: var(--accent); }
.nextq .nq { display: block; margin: 4px 0 6px; font-size: 14px; color: var(--text); }
.nextq .hgo { font-size: 13px; color: var(--accent); }

/* ---------- Phase B: home, tour, predict, progress, glossary, your scores ---------- */
.brand { text-decoration: none; color: var(--text); }
.brand:hover b { text-decoration: underline; }
nav button.seen:not(.on)::after, .chapters button.seen:not(.on)::after { content: " ✓"; color: var(--t-est); font-size: .85em; }

.home { max-width: 1040px; }
.home h1 { font-size: clamp(26px, 3.2vw, 40px); line-height: 1.15; margin: 8px 0 14px; }
.home .lede { font-size: 17px; line-height: 1.55; color: var(--text); max-width: 760px; }
.continue { display: inline-block; margin: 6px 0 4px; color: var(--accent); text-decoration: none; }
.continue:hover { text-decoration: underline; }
.doors { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 22px 0 16px; }
.door { display: flex; flex-direction: column; gap: 8px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); text-decoration: none; }
.door h2 { margin: 0; font-size: 20px; }
.door p { margin: 0; color: var(--muted); line-height: 1.5; }
.door .btn { align-self: flex-start; margin-top: auto; }
a.door:hover { border-color: var(--accent); }
.door.d-tour { border-color: var(--accent); background: linear-gradient(160deg, rgba(124,196,255,.10), var(--panel) 60%); }
.door.d-lab { border: 1px dashed var(--t-hyp); }
.door .hgo { margin-top: auto; color: var(--accent); }
.labchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.labchips a { font-size: 13px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); text-decoration: none; }
.labchips a:hover { border-color: var(--t-est); }
.labchips a.seen { color: var(--t-est); }

#tourbar { display: none; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--accent); background: linear-gradient(90deg, rgba(124,196,255,.12), var(--panel)); flex-wrap: wrap; }
.tb-step { font: 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); white-space: nowrap; }
.tb-q { flex: 1; min-width: 240px; }
.tb-q .meta { margin-left: 6px; }
.tb-btns { display: flex; gap: 6px; }
body.touring .nextq { display: none; }

.predict { margin: 14px 0; padding: 12px 14px; border: 1px solid var(--t-con); border-radius: 8px; background: rgba(242,201,76,.06); }
.predict .eyebrow { color: var(--t-con); }
.predict p { margin: 6px 0; }
.popts { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.popts .btn { text-align: left; white-space: normal; }
.linkish { background: none; border: 0; padding: 0; color: var(--muted); font-size: 12px; text-decoration: underline; cursor: pointer; }

dfn.gl { font-style: normal; text-decoration: underline dotted var(--muted); text-underline-offset: 3px; cursor: help; }
dfn.gl:focus { outline: 1px solid var(--accent); outline-offset: 2px; }
#gltip { display: none; position: fixed; z-index: 50; max-width: 300px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); color: var(--text); font-size: 13px; line-height: 1.45; box-shadow: 0 8px 24px rgba(0,0,0,.4); pointer-events: none; }

table.bench .why { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.bench td.sc { text-align: left; font-family: var(--sans); padding-left: 10px; }
.bench td.sc > span { font-family: var(--mono); }
.yours { display: flex; align-items: center; gap: 6px; margin-top: 5px; font-size: 11px; color: var(--muted); }
.myscore { font-size: 11px; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 2px 4px; }
sup.mine { font-size: 10px; margin-left: 2px; }

/* ---------- Flatland: chapter bar (three acts) and contents card ---------- */
#fl-steps { display: flex; align-items: flex-end; gap: 10px; padding: 8px 12px 8px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.flact { display: flex; flex-direction: column; gap: 4px; }
.flact-name { font: 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.flact-chs { display: flex; gap: 3px; }
.flstep { display: flex; align-items: center; gap: 5px; padding: 4px 9px 4px 5px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 12px; cursor: pointer; white-space: nowrap; }
.flstep .n { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--panel2); color: var(--muted); font: 11px var(--mono); }
.flstep .star { color: var(--t-con); font-size: 11px; }
.flstep:hover { border-color: var(--accent); }
.flstep.seen .n { background: rgba(79,209,165,.18); color: var(--t-est); }
.flstep.on { border-color: var(--accent); background: rgba(124,196,255,.14); }
.flstep.on .n { background: var(--accent); color: var(--bg); }
.flhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.flhead .linkish { color: var(--accent); white-space: nowrap; }
#fl-intro { display: none; position: absolute; inset: 0; z-index: 5; align-items: flex-start; justify-content: center; overflow: auto; padding: 28px 20px; background: rgba(11,13,18,.9); backdrop-filter: blur(3px); }
.flintro { max-width: 980px; }
.flintro h2 { font-size: 28px; margin: 6px 0 10px; }
.flintro > p { font-size: 16px; line-height: 1.55; max-width: 760px; }
.flacts { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 16px; margin: 20px 0; }
.flacts > div { display: flex; flex-direction: column; gap: 8px; }
.flacts > div:nth-child(2) { display: grid; grid-template-columns: 1fr 1fr; align-content: start; }
.flacts > div:nth-child(2) > .eyebrow { grid-column: 1 / -1; }
.flpick { text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); cursor: pointer; font-size: 14px; }
.flpick i.seen-mark { font-style: normal; }
.flpick span { color: var(--muted); font-size: 13px; line-height: 1.45; }
.flpick.star { border-color: rgba(242,201,76,.55); background: linear-gradient(160deg, rgba(242,201,76,.08), var(--panel) 60%); }
.flpick:hover { border-color: var(--accent); }
.seen-mark { color: var(--t-est); }

/* ---------- Home: the tour as hero, with its itinerary ---------- */
.tourhero { margin: 22px 0 8px; padding: 20px 20px 16px; border: 1px solid var(--accent); border-radius: 14px; background: linear-gradient(160deg, rgba(124,196,255,.10), var(--panel) 55%); }
.th-head { display: flex; gap: 20px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.th-head h2 { margin: 4px 0 6px; font-size: 22px; }
.th-head p { margin: 0; color: var(--muted); max-width: 560px; }
.th-go { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.btn.big { font-size: 15px; padding: 9px 18px; background: var(--accent); color: var(--bg); }
.itinerary { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; position: relative; }
.itinerary li button { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 10px 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); cursor: pointer; }
.itinerary li button:hover { border-color: var(--accent); }
.it-dot { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--accent); color: var(--accent); font: 12px var(--mono); }
.it-q { font-weight: 600; font-size: 13px; line-height: 1.3; }
.it-see { font-size: 12px; color: var(--muted); line-height: 1.4; }
.it-where { margin-top: auto; font: 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.itinerary li.done .it-dot { background: rgba(79,209,165,.18); border-color: var(--t-est); color: var(--t-est); }
.itinerary li.here button { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.itinerary li.here .it-dot { background: var(--accent); color: var(--bg); }

/* ======================================================================
   Small screens (D-029)
   Portrait phones and tablets: the page scrolls as one column — header, then the stage (simulation
   first), then the explanation. Short landscape phones keep side-by-side with a narrower panel.
   ====================================================================== */
#fl-canvas { touch-action: none; }   /* Flatland drags (rotate, move A Square) must not scroll the page */

@media (max-width: 900px) and (orientation: portrait), (max-width: 600px) {
  html, body { height: auto; min-height: 100%; }
  body { display: block; }
  header { padding: 8px 12px; gap: 8px; row-gap: 6px; }
  .brand { order: 1; flex: 1 1 100%; }                     /* row 1: the brand alone; row 2: Tours · Explore · Guide, aligned */
  .hdr-right { order: 3; gap: 8px; flex-shrink: 0; }
  nav { order: 2; flex: 1 1 0; min-width: 0; flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding-bottom: 2px; scrollbar-width: none; }
  nav::-webkit-scrollbar { display: none; }
  /* Fade at the right edge says 'swipe for more'. Not a mask: a mask would also hide the drop-down menus inside nav. */
  #fl-steps { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  nav::after { content: ""; position: sticky; right: -1px; flex: 0 0 28px; align-self: stretch; margin-left: -28px; background: linear-gradient(90deg, transparent, var(--bg)); pointer-events: none; }
  /* Phone menus: a full-width sheet under the header, scrollable if long */
  .navmenu { max-width: none; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .navmenu [data-view] { padding: 11px 12px; }
  .navseg { flex-shrink: 0; }
  .navseg button { white-space: nowrap; }
  .helpbtn { padding: 5px 10px; }
  .modesw button { padding: 4px 10px; }

  main { display: flex; flex-direction: column; }
  #stage { flex: none; }
  #aside { width: auto; border-left: 0; border-top: 1px solid var(--line); overflow: visible; padding: 18px 16px 40px; }

  /* canvas views get a fixed, generous height; everything else takes its natural height */
  #lab, #flatland { flex: none; height: auto; }
  /* the stage sets its own height: taller than wide, so two-panel labs stack at full width instead of two ~170 px columns */
  #lab-canvas-wrap, #fl-canvas-wrap { flex: none; height: min(125vw, 78vh); height: min(125vw, 78svh); }
  #doc, #benchview { flex: none; overflow: visible; }
  #atlas { flex: none; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #atlas svg { width: 980px; height: auto; max-width: none; }
  #benchview { overflow-x: auto; padding: 12px; }
  #benchview table { min-width: 680px; }
  .toolbar { padding: 8px 12px; }

  #fl-steps { flex-wrap: nowrap; overflow-x: auto; padding: 8px 12px; scrollbar-width: none; }
  #fl-steps::-webkit-scrollbar { display: none; }
  .flact { flex-shrink: 0; }
  .flacts { grid-template-columns: 1fr; }
  .flacts > div:nth-child(2) { grid-template-columns: 1fr; }
  #fl-intro { padding: 16px 12px; }
  .flintro h2 { font-size: 22px; }

  #tourbar { padding: 8px 12px; gap: 8px; }
  .tb-q { min-width: 0; flex-basis: 100%; order: 2; }
  .tb-btns { order: 3; flex-wrap: wrap; }
  .tb-q .meta { display: block; margin: 2px 0 0; }

  .docwrap { padding: 16px 14px 28px; }
  .home h1 { font-size: 28px; }
  .home .lede { font-size: 15px; }
  .th-go { align-items: stretch; width: 100%; }
  .itinerary { grid-template-columns: 1fr 1fr; }
  table.orph { display: block; overflow-x: auto; }
  .helpbox { padding: 20px 16px; }
}
/* the Atlas map is wide by nature: say so on small screens */
.atlas-hint { display: none; }
@media (max-width: 900px) and (orientation: portrait), (max-width: 600px) {
  .atlas-hint { display: block; padding: 8px 12px 0; font-size: 12px; color: var(--muted); }
}
/* short landscape phones: keep side by side, slimmer panel */
@media (max-height: 520px) and (orientation: landscape) {
  header { padding: 6px 12px; }
  #aside { width: 300px; padding: 14px; }
  .toolbar { padding: 6px 12px; }
}

/* ---------- Header: five navigation groups with drop-down menus (D-031) ---------- */
.navgroup { --gcol: #7cc4ff; position: relative; flex-shrink: 0; }
.navgroup.g-voyages { --gcol: #e36bd0; } .navgroup.g-labs { --gcol: #4fd1a5; } .navgroup.g-cosmos { --gcol: #9b8cff; } .navgroup.g-method { --gcol: #f2c94c; }
.navtop { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 9px; font-size: 13px; color: var(--text); background: color-mix(in srgb, var(--gcol) 7%, transparent); border: 1px solid color-mix(in srgb, var(--gcol) 35%, transparent); cursor: pointer; white-space: nowrap; }
.navtop:hover, .navgroup.open .navtop { background: color-mix(in srgb, var(--gcol) 18%, transparent); }
.navgroup.active .navtop { background: var(--gcol); color: #0b0d12; border-color: var(--gcol); font-weight: 600; }
.navtop b { font-weight: 600; } .navtop i { font-style: normal; font-size: 10px; opacity: .7; }
.navmenu { display: none; position: fixed; z-index: 30; min-width: 280px; max-width: min(360px, calc(100vw - 16px)); padding: 6px; border-radius: 12px; background: var(--panel); border: 1px solid color-mix(in srgb, var(--gcol) 45%, var(--line)); box-shadow: 0 14px 40px rgba(0,0,0,.5); }
.navgroup.open .navmenu { display: block; }
.navscale { font: 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--gcol); padding: 6px 10px 4px; }
.navmenu [data-view] { display: block; box-sizing: border-box; text-decoration: none; font-family: inherit; line-height: 1.35; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font-size: 14px; cursor: pointer; }
.navmenu [data-view] span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.navmenu [data-view]:hover { background: color-mix(in srgb, var(--gcol) 14%, transparent); }
.navmenu [data-view].on { background: color-mix(in srgb, var(--gcol) 22%, transparent); }
.navmenu [data-view].seen::after { content: none; }
.navmenu [data-view].seen { padding-right: 28px; position: relative; }
.navmenu [data-view].seen::before { content: "✓"; position: absolute; right: 10px; top: 9px; color: var(--t-est); }
nav { gap: 8px; }

/* ---------- Home: tour tabs, three scales, threads (D-031) ---------- */
.th-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.th-tabs button { font-size: 12px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); cursor: pointer; }
.th-tabs button.on { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.home h2.sect { font-size: 20px; margin: 30px 0 4px; }
.scales { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 12px 0; }
.scale { padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--sc) 45%, var(--line)); border-radius: 12px; background: linear-gradient(160deg, color-mix(in srgb, var(--sc) 9%, transparent), var(--panel) 60%); }
.scale .eyebrow { color: var(--sc); }
.scale h3 { margin: 2px 0 10px; font-size: 18px; color: var(--text); }
.threadlist { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 6px; }
.thread { display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; font-size: 13px; line-height: 1.6; }
.th-name { font-weight: 600; min-width: 170px; }
.th-stops a { color: var(--accent); text-decoration: none; }
.th-stops a:hover { text-decoration: underline; }
.th-stops i { font-style: normal; font: 9px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.threads { margin: 18px 0 4px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; display: flex; flex-direction: column; gap: 8px; }
.threads .thread { display: block; font-size: 12.5px; }
.threads .th-name { display: block; min-width: 0; font-size: 11px; font-family: var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
.threads .th-stops b { color: var(--text); }

/* ---------- "The controls" block in every lab's right panel (D-032) ---------- */
.guide { margin: 12px 0 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); }
.guide summary { cursor: pointer; padding: 8px 12px; font: 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); list-style: none; }
.guide summary::-webkit-details-marker { display: none; }
.guide summary::before { content: "▸"; display: inline-block; margin-right: 6px; transition: transform .15s; }
.guide[open] summary::before { transform: rotate(90deg); }
.guide dl { margin: 0; padding: 0 12px 10px; display: grid; grid-template-columns: minmax(96px, 38%) 1fr; gap: 6px 12px; font-size: 13px; }
.guide dt { font-weight: 600; color: var(--text); }
.guide dd { margin: 0; color: var(--muted); line-height: 1.45; }
.guide dt.gsub { text-align: left; grid-column: 1 / -1; margin-top: 4px; font: 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
@media (max-width: 900px) and (orientation: portrait), (max-width: 600px) { .guide dl { grid-template-columns: 1fr; gap: 2px; } .guide dd { margin-bottom: 6px; } }

/* ---------- Menu affordance: a chevron in its own segment, flipping when open (D-032) ---------- */
.navtop { padding: 0 0 0 12px; gap: 0; height: 34px; }
.nt-name { padding-right: 10px; }
.nt-chev { display: inline-grid; place-items: center; align-self: stretch; width: 28px; border-left: 1px solid color-mix(in srgb, var(--gcol) 35%, transparent); color: var(--gcol); transition: transform .15s ease-out; }
.nt-chev svg { transition: transform .15s ease-out; }
.navgroup.open .nt-chev svg { transform: rotate(180deg); }
.navgroup.active .nt-chev { color: #0b0d12; border-left-color: rgba(11,13,18,.25); }
.navgroup.g-method .navtop { padding: 0 12px; }
.navtop:hover .nt-chev { background: color-mix(in srgb, var(--gcol) 16%, transparent); }
.navmenu .navtour { display: block; width: 100%; text-align: left; margin-top: 6px; padding: 9px 10px; border: 0; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; background: none; color: var(--gcol); font-size: 13px; font-weight: 600; cursor: pointer; }
.navmenu .navtour:hover { background: color-mix(in srgb, var(--gcol) 14%, transparent); }

/* ---------- Home: two tour cards, easy to tell apart (D-032) ---------- */
.tourpick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 16px; }
.tp { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; }
.tp:hover { border-color: var(--accent); }
.tp.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: color-mix(in srgb, var(--accent) 10%, var(--bg)); }
.tp.tp-zoom.on { border-color: var(--c-lens); box-shadow: 0 0 0 1px var(--c-lens) inset; background: color-mix(in srgb, var(--c-lens) 10%, var(--bg)); }
.tp-icon { font-size: 30px; line-height: 1; }
.tp-body { display: flex; flex-direction: column; gap: 3px; }
.tp-num { font: 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.tp-name { font-size: 17px; font-weight: 600; line-height: 1.25; }
.tp-blurb { font-size: 13px; color: var(--muted); line-height: 1.4; }
.tp-new, .tp-done { font-style: normal; font-family: var(--sans); letter-spacing: 0; text-transform: none; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; margin-left: 4px; }
.tp-new { background: var(--c-lens); color: #0b0d12; }
.tp-done { color: var(--t-est); border: 1px solid var(--t-est); }
@media (max-width: 700px) { .tourpick { grid-template-columns: 1fr; } }

/* Links inside page text use the app's accent, not the browser default */
#doc a:not(.door):not(.continue):not(.labchips a), .home .meta a { color: var(--accent); text-decoration: none; }
#doc .meta a:hover, #doc p a:hover { text-decoration: underline; }
/* Threads on Home: name column fixed, stops wrap within their own column */
.threadlist .thread { display: grid; grid-template-columns: 190px 1fr; gap: 12px; flex-wrap: nowrap; }
.threadlist .th-name { min-width: 0; }
@media (max-width: 700px) { .threadlist .thread { grid-template-columns: 1fr; gap: 0; } }

/* ---------- Reading pattern (D-033): intro before predicting, Remember at the end ---------- */
#aside { font-size: 15px; line-height: 1.55; }
#aside .intro { font-size: 15px; color: var(--text); margin: 10px 0 12px; padding-left: 10px; border-left: 2px solid var(--line); }
.remember { margin: 18px 0 6px; padding: 12px 14px; border-radius: 8px; background: color-mix(in srgb, var(--t-est) 9%, var(--panel2)); border: 1px solid color-mix(in srgb, var(--t-est) 35%, var(--line)); font-size: 15px; font-weight: 600; color: var(--text); }
.remember b { display: block; font: 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--t-est); margin-bottom: 4px; font-weight: 400; }
.dim { opacity: .25; }
.bench:not(.scoring) .yours { display: none; }
.scoreme { margin-top: 6px; color: var(--accent); }
.hurdles { margin: 0 0 10px; }
.hurdles dt { font-weight: 600; color: var(--text); margin-top: 8px; }
.hurdles dd { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- Concepts: ⓘ markers, popup, pages (D-034) ---------- */
button.info { display: inline-grid; place-items: center; width: 17px; height: 17px; padding: 0; margin: 0 2px; vertical-align: 1px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent); font: italic 700 11px Georgia, "Times New Roman", serif; line-height: 1; cursor: help; text-transform: none; letter-spacing: 0; }
button.info:hover, button.info:focus-visible { background: var(--accent); color: var(--bg); outline: none; }
#infopop { display: none; position: fixed; z-index: 60; width: min(340px, calc(100vw - 16px)); padding: 12px 14px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--panel2); color: var(--text); box-shadow: 0 14px 40px rgba(0,0,0,.5); font-size: 14px; line-height: 1.5; }
#infopop p { margin: 4px 0 8px; }
#infopop .ip-title { font-weight: 600; color: var(--accent); }
#infopop .ip-tags { margin-bottom: 8px; }
#infopop .ip-more { color: var(--accent); text-decoration: none; font-weight: 600; font-size: 13px; }
#infopop .ip-more:hover { text-decoration: underline; }
.h3link { font-size: 12px; font-weight: 400; color: var(--accent); text-decoration: none; margin-left: 6px; }
.concept { max-width: 820px; }
.concept h1 { font-size: 32px; margin: 4px 0 10px; }
.concept .lede { font-size: 18px; line-height: 1.55; color: var(--text); margin: 12px 0 8px; }
.concept section h2, .concept > h2 { font-size: 19px; margin: 28px 0 8px; }
.concept p, .concept li, .concept dd { font-size: 15.5px; line-height: 1.65; }
.concept a:not(.chip):not(.ccard) { color: var(--accent); }
.backlink { font-size: 13px; color: var(--accent); text-decoration: none; }
.evidence { padding-left: 18px; } .evidence li { margin-bottom: 6px; }
.tagdefs dt { margin-top: 10px; } .tagdefs dd { margin: 4px 0 0; color: var(--muted); }
.labchips a.chip { font-size: 13px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); text-decoration: none; }
.labchips a.chip:hover { border-color: var(--accent); }
.cgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 18px; }
.ccard { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); text-decoration: none; }
.ccard:hover { border-color: var(--accent); }
.ccard .cc-icon { font-size: 22px; }
.ccard b { font-size: 17px; } .ccard span { color: var(--muted); font-size: 14px; line-height: 1.45; }
.ccard .hgo { margin-top: auto; color: var(--accent); }
.barlist { display: flex; flex-direction: column; gap: 4px; }
.barlist a { color: var(--text); text-decoration: none; padding: 5px 8px; border-radius: 6px; }
.barlist a:hover, .barlist a.on { background: var(--panel2); color: var(--accent); }
#benchview th button.info { width: 15px; height: 15px; font-size: 10px; }
/* Key ideas row in lab panels (D-034) */
.keyideas { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 16px 0 4px; font-size: 13px; }
.ki-label { font: 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.ki { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 10px; border: 1px solid var(--line); border-radius: 999px; }
.ki a { color: var(--text); text-decoration: none; } .ki a:hover { color: var(--accent); }
.concept table.orph { margin: 8px 0 12px; }
.further { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 10px; }
.further li { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.further a { font-weight: 600; text-decoration: none; }
.further span { color: var(--muted); font-size: 14px; }
/* Quantum scale (D-036) */
.navgroup.g-quantum { --gcol: #5ee0e6; } .hsec.g-quantum { --gcol: #5ee0e6; }
.tourpick { grid-template-columns: repeat(3, 1fr); }
.tp.tp-time.on { border-color: var(--t-con); box-shadow: 0 0 0 1px var(--t-con) inset; background: color-mix(in srgb, var(--t-con) 10%, var(--bg)); }
@media (max-width: 1100px) { .tourpick { grid-template-columns: 1fr; } }

/* ---------- Making it stick (D-037): Picture it, Common trap, quizzes and review ---------- */
.picture { margin: 14px 0 6px; padding: 10px 14px; border-left: 2px solid var(--t-ana); background: color-mix(in srgb, var(--t-ana) 6%, transparent); border-radius: 0 8px 8px 0; }
.picture > b, .trap summary b { font: 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--t-ana); font-weight: 400; margin-right: 6px; }
.picture p { margin: 6px 0 0; }
.picture .meta { font-size: 13px; }
.trap { margin: 10px 0 6px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.trap summary { cursor: pointer; list-style: none; }
.trap summary::-webkit-details-marker { display: none; }
.trap summary b { color: var(--t-spe); display: block; margin-bottom: 3px; }
.trap summary b::after { content: " ▸ what's really going on"; text-transform: none; letter-spacing: 0; color: var(--muted); }
.trap[open] summary b::after { content: " ▾"; }
.trap summary span { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--t-spe) 60%, transparent); color: var(--text); }
.trap p { margin: 8px 0 0; }
.quiz .qcard { margin: 14px 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); max-width: 760px; }
.quiz .qcard.right { border-color: color-mix(in srgb, var(--t-est) 50%, var(--line)); }
.quiz .qcard.wrong { border-color: color-mix(in srgb, var(--t-con) 50%, var(--line)); }
.qq { font-size: 17px; font-weight: 600; margin: 6px 0 10px; }
.qopts { display: flex; flex-direction: column; gap: 6px; }
.qopts .btn { text-align: left; white-space: normal; font-size: 14px; padding: 8px 12px; }
.qopts .btn:disabled { cursor: default; opacity: .55; }
.qopts .btn.ok { opacity: 1; border-color: var(--t-est); color: var(--t-est); }
.qopts .btn.no { opacity: 1; border-color: var(--t-con); color: var(--t-con); }
.qwhy { margin: 10px 0 0; }
.qscore { margin: 18px 0; padding: 16px; border-radius: 10px; background: var(--panel2); max-width: 760px; }
.qscore h2 { margin: 0 0 6px; }
.qtours { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 900px; }
.qtour { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); text-decoration: none; color: var(--text); }
.qtour:hover { border-color: var(--accent); }
@media (max-width: 700px) { .qtours { grid-template-columns: 1fr; } }
.continue.revdue { display: block; margin: 8px 0; padding: 10px 14px; border: 1px solid color-mix(in srgb, var(--t-est) 40%, var(--line)); border-radius: 8px; color: var(--text); }
#doc a.qtour { color: var(--text); }

/* ---------- Navigation, reorganised (D-039): Home, Workbench, Guide menu, breadcrumb, Filter menu ---------- */
.homebtn { display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 13px; flex-shrink: 0; }
.homebtn span[aria-hidden] { font-size: 15px; }
.homebtn:hover { border-color: var(--accent); color: var(--accent); }
.navgroup.g-work { --gcol: #7cc4ff; } .navgroup.g-work .navtop { border-style: dashed; }
.navgroup.g-guide { --gcol: #7cc4ff; }
.hsec.g-guide { --gcol: #7cc4ff; } .hsec.g-work { --gcol: #7cc4ff; }
.navmenu button[data-help-open], .navmenu button[data-hyp] { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font-size: 14px; cursor: pointer; }
.navmenu button[data-help-open] span, .navmenu button[data-hyp] span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.navmenu button[data-help-open]:hover, .navmenu button[data-hyp]:hover { background: color-mix(in srgb, var(--gcol) 14%, transparent); }
.g-guide .navmenu .navtour { margin-top: 0; border-top: 0; border-radius: 8px; }
.g-guide .navmenu .navscale { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin: -6px 0 12px; font-size: 12px; color: var(--muted); }
.crumb a { color: var(--accent); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }
.crumb i { font-style: normal; opacity: .6; }
.home .hook { font-size: 16px; margin: 4px 0 10px; }
.home .hook .linkish { color: var(--accent); font-size: 16px; text-decoration: none; }
.home .hook .linkish:hover { text-decoration: underline; }
/* Filter menu (Atlas and Test bench) */
.fdrop { position: relative; }
.fpanel { display: none; position: absolute; z-index: 25; top: calc(100% + 6px); left: 0; min-width: 420px; padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.fdrop.open .fpanel { display: block; }
.fcols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fcol label { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; cursor: pointer; }
.fcol .eyebrow { margin-bottom: 4px; }
.fpanel .meta { margin: 10px 0 4px; }
.fsum { font-size: 12px; }
.fsum .linkish { color: var(--accent); }
@media (max-width: 600px) { .fpanel { min-width: 0; width: calc(100vw - 32px); } .fcols { grid-template-columns: 1fr; } }
/* Workbench: exploratory ideas */
.xgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin: 10px 0 8px; }
.xcard { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px dashed color-mix(in srgb, var(--t-hyp) 45%, var(--line)); border-radius: 10px; background: var(--panel); color: var(--text); text-decoration: none; }
.xcard:hover { border-style: solid; border-color: var(--t-hyp); }
.xcard > span:not(.eyebrow):not(.hgo) { font-size: 13px; color: var(--muted); }
#doc a.xcard { color: var(--text); }
.xbtns { margin: 16px 0; }
@media (max-width: 900px) and (orientation: portrait), (max-width: 600px) { .homebtn { display: none; } .brand::before { content: "⌂ "; color: var(--accent); } }


/* ---------- How it all fits together (D-041): the comic strip ---------- */
.story .stcast { display: grid; grid-template-columns: 1.4fr 1.1fr 0.8fr; gap: 10px; margin: 16px 0 20px; }
.stgroup { padding: 10px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.stgroup.g0 { border-top: 3px solid #8fd3ff; } .stgroup.g1 { border-top: 3px solid #ff7a59; } .stgroup.g2 { border-top: 3px solid #4fd1a5; }
.stgroup .eyebrow span { text-transform: none; letter-spacing: 0; }
.stitems { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; }
.stitem { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.stitem svg, .stchip svg { width: 22px; height: 22px; flex-shrink: 0; }
.stgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.stpanel { margin: 0; padding: 10px 12px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.sthead { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.stnum { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--bg); font: 600 12px var(--mono); flex-shrink: 0; }
.stgauges { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
.stclock { position: relative; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #e36bd0; }
.stclock::after { content: ""; position: absolute; left: 50%; top: 50%; width: 2px; height: 6px; background: #e36bd0; transform-origin: 50% 0; transform: translate(-50%, 0) rotate(calc(var(--a) + 180deg)); }
.stmeter { width: 46px; height: 8px; border-radius: 4px; border: 1px solid #4fd1a5; overflow: hidden; }
.stmeter i { display: block; height: 100%; background: #4fd1a5; }
.stpanel canvas { width: 100%; height: 170px; border-radius: 8px; display: block; }
.stwho { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12px; color: var(--muted); }
.stchip { display: inline-flex; align-items: center; gap: 4px; color: var(--text); }
.stchip svg { width: 16px; height: 16px; }
.starrow::before { content: "→ "; }
.stpanel figcaption { font-size: 14px; line-height: 1.5; }
.stfoot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: auto; font-size: 13px; }
.stq { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.5; }
.stq li { margin: 6px 0; }
.stq .sthyp { list-style: "◌  "; color: var(--text); }
@media (max-width: 900px) { .story .stcast { grid-template-columns: 1fr; } }
@media (max-width: 900px) and (orientation: portrait), (max-width: 600px) { .g-guide .navtop b { display: none; } }

/* ---------- Predict first, honestly (D-042, UX spec P0): nothing gives the answer away until the guess is run ---------- */
#lab-canvas-wrap.locked #lab-canvas { filter: blur(9px) brightness(.5) saturate(.6); }
#lab-veil { position: absolute; inset: 0; display: none; place-items: center; pointer-events: none; }
#lab-canvas-wrap.locked #lab-veil { display: grid; pointer-events: auto; }
.veil-msg { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 340px; padding: 18px 22px; text-align: center; border-radius: 12px; background: rgba(11,13,18,.72); border: 1px solid var(--t-con); }
.veil-msg b { font-size: 17px; }
.veil-msg span { font-size: 13px; color: var(--muted); }
#lab-controls.locked { opacity: .35; pointer-events: none; }
#lab-predict:empty { display: none; }
#lab-predict { padding: 10px 12px 0; }
#lab-predict .predict { margin: 0; }
.proutes { margin-top: 8px; font-size: 12px; color: var(--muted); }
.proutes .linkish { color: var(--accent); }

/* ---------- Tour stop end card (D-043, UX spec §6) ---------- */
.endcard { margin: 18px 0 8px; padding: 14px 16px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 7%, var(--panel2)); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); }
.endcard .ec-take { font-size: 15px; font-weight: 600; margin: 6px 0; }
.endcard .ec-hand { margin: 10px 0 12px; font-style: italic; color: var(--text); }
.endcard .btn.primary { width: 100%; padding: 9px 12px; font-size: 14px; white-space: normal; text-align: left; }
.endcard .ec-go { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; font-size: 13px; }
.veil-routes { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }

/* ---------- Missions (D-044, UX spec §8) ---------- */
.mission { margin: 14px 0; padding: 12px 14px; border-radius: 10px; background: var(--panel2); border: 1px solid color-mix(in srgb, var(--t-est) 35%, var(--line)); }
.mission .m-title { font-weight: 600; margin: 4px 0 8px; }
.m-bar { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.m-bar i { display: block; height: 100%; width: 0; background: var(--t-est); transition: width .15s linear; }
.mission .m-status { margin: 6px 0 2px; }
.m-btns { font-size: 12px; color: var(--muted); }
.m-btns .linkish, .mission .linkish { color: var(--accent); }
.mission.done { border-color: var(--t-est); background: color-mix(in srgb, var(--t-est) 8%, var(--panel2)); }
.mission.done .eyebrow { color: var(--t-est); }
@keyframes mpulse { 0% { box-shadow: inset 0 0 0 0 rgba(79,209,165,.0); } 30% { box-shadow: inset 0 0 0 6px rgba(79,209,165,.55); } 100% { box-shadow: inset 0 0 0 0 rgba(79,209,165,0); } }
#lab-canvas-wrap.pulse { animation: mpulse 1s ease-out; }

/* ---------- Continue card and resume chip (UX spec §3, §5) ---------- */
.contcard { margin: 14px 0 6px; padding: 14px 16px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 8%, var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); max-width: 760px; }
.contcard p { margin: 4px 0 10px; }
#doc a.btn.primary { color: var(--accent); text-decoration: none; display: inline-block; }
#tourchip { display: flex; align-items: center; }
#tourchip:empty { display: none; }
.tchip { height: 30px; padding: 0 10px; border-radius: 15px 0 0 15px; border: 1px solid var(--t-con); background: color-mix(in srgb, var(--t-con) 12%, transparent); color: var(--t-con); font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tchip-x { height: 30px; width: 26px; border-radius: 0 15px 15px 0; border: 1px solid var(--t-con); border-left: 0; background: transparent; color: var(--t-con); cursor: pointer; }
@media (max-width: 900px) and (orientation: portrait), (max-width: 600px) { .tchip { font-size: 11px; padding: 0 8px; } }

/* ---------- Top bar, UX spec Phase 2 (D-045): Tours · Explore mega-menu · Guide with the mode switch ---------- */
.navgroup.g-tours { --gcol: #f2c94c; }
.navmenu.tourmenu { min-width: 340px; }
.tmenu { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); cursor: pointer; }
.tmenu:hover { background: color-mix(in srgb, var(--gcol) 14%, transparent); }
.tm-icon { font-size: 20px; line-height: 1.2; }
.tm-body { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.tm-body span { font-size: 12px; color: var(--muted); }
.navmenu.mega { min-width: min(980px, calc(100vw - 16px)); max-width: calc(100vw - 16px); padding: 10px; }
.mcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 4px 10px; }
.mcol.g-quantum { --gcol: #5ee0e6; } .mcol.g-voyages { --gcol: #e36bd0; } .mcol.g-labs { --gcol: #4fd1a5; } .mcol.g-cosmos { --gcol: #9b8cff; } .mcol.g-work { --gcol: #7cc4ff; }
.mcol .navscale { border-bottom: 1px solid color-mix(in srgb, var(--gcol) 35%, transparent); margin-bottom: 4px; }
.mcol.g-work { border: 1px dashed color-mix(in srgb, var(--gcol) 45%, var(--line)); border-radius: 10px; }
.mrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 4px 10px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.mega [data-view] span { display: none; }
.mega .mrow [data-view] span { display: block; }
#levelctl { padding: 4px 10px 8px; }
#levelctl .modesw { display: inline-flex; }
.wbbadge { display: none; height: 30px; align-items: center; padding: 0 10px; border-radius: 15px; border: 1px dashed var(--t-hyp); color: var(--t-hyp); font-size: 12px; text-decoration: none; white-space: nowrap; }
body.mode-lab .wbbadge { display: inline-flex; }
@media (max-width: 900px) and (orientation: portrait), (max-width: 600px) { .mcols, .mrow { grid-template-columns: 1fr 1fr; } .wbbadge { padding: 0 8px; font-size: 11px; } }
.navmenu.mega { min-width: min(1180px, calc(100vw - 16px)); overflow-y: auto; }
.mcols { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
@media (max-width: 1100px) { .mcols { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); } }
@media (max-width: 900px) and (orientation: portrait), (max-width: 600px) { .mcols { grid-auto-flow: row; grid-template-columns: 1fr 1fr; } }

/* ---------- Home, UX spec §5 (D-045): five blocks, no sidebar ---------- */
body.onhome #aside, body.onhome #aside-grip { display: none; }
.home2 { max-width: 1180px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px; align-items: center; margin: 10px 0 8px; }
.hero h1 { margin: 6px 0 10px; }
.hero .btn.big { margin: 8px 0 4px; }
.hero-sim { display: flex; flex-direction: column; gap: 6px; }
#hero-cv { width: 100%; height: 360px; border-radius: 12px; background: var(--bg); box-shadow: 0 0 0 1px color-mix(in srgb, var(--t-est) 30%, transparent), 0 0 40px color-mix(in srgb, var(--t-est) 10%, transparent); }
.hero-ctl { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.hero-ctl b { color: var(--t-est); }
.hero-ctl input { flex: 1; }
.hero-sim .meta a { color: var(--accent); }
.tourpick3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tourpick3 .tp { text-align: left; }
.tp-meta { display: block; margin-top: 8px; font-size: 12px; color: var(--muted); }
.tp-prog { display: block; height: 4px; margin-top: 6px; border-radius: 2px; background: var(--bg); overflow: hidden; }
.tp-prog i { display: block; height: 100%; background: var(--t-est); }
.allstops { margin: 10px 0 0; font-size: 13px; }
.allstops summary { cursor: pointer; color: var(--accent); }
.allstops-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 8px; }
.allstops ol { margin: 4px 0; padding-left: 18px; }
.allstops .linkish { color: var(--text); font-size: 13px; text-decoration: none; text-align: left; }
.deeper { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.dcard { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); text-decoration: none; }
#doc a.dcard { color: var(--text); }
.dcard span { font-size: 13px; color: var(--muted); }
.dcard:hover { border-color: var(--accent); }
.dcard.d-lab { border-style: dashed; }
@media (max-width: 1100px) { .tourpick3, .allstops-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } #hero-cv { height: 220px; } }
.btn.ghost { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
@media (max-width: 900px) { #hero-cv { height: 270px; } }
@media (max-width: 600px) { .hero-ctl { flex-wrap: wrap; } .hero-ctl input { flex: 1 1 100%; order: 3; } }

/* ---------- Lab template, UX spec §6 (D-046) ---------- */
details.picture { padding: 8px 14px; }
details.picture summary { cursor: pointer; list-style: none; font-size: 14px; }
details.picture summary::-webkit-details-marker { display: none; }
details.picture summary span { color: var(--text); }
details.picture summary::after { content: " ▸"; color: var(--muted); }
details.picture[open] summary::after { content: " ▾"; }
#ctl-pop, #fl-pop { margin: 0 12px 8px; padding: 10px 14px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); max-height: 45vh; overflow-y: auto; }
#ctl-pop .guide, #fl-pop .guide { margin: 0; border: 0; padding: 0; background: none; }
#ctl-pop .guide summary, #fl-pop .guide summary { display: none; }
.btn.ctlhelp { border-style: dashed; color: var(--muted); }
#aside .endcard a.btn.primary { display: block; text-decoration: none; color: var(--accent); padding: 9px 12px; font-size: 14px; }
.endcard .ec-go a i { font-style: normal; font: 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.endcard .ec-rev { margin: 10px 0 0; }
#ctl-pop, #fl-pop { position: absolute; top: 8px; left: 12px; right: 12px; z-index: 20; margin: 0; box-shadow: 0 12px 30px rgba(0,0,0,.5); }
#ctl-pop[hidden], #fl-pop[hidden] { display: none; }
.contcard { position: relative; }
.cc-x { position: absolute; top: 10px; right: 12px; background: none; border: 0; color: var(--muted); font-size: 12px; cursor: pointer; }
.cc-x:hover { color: var(--text); text-decoration: underline; }
#hero-cv { height: 260px; }
@media (max-width: 900px) { #hero-cv { height: 250px; } }
/* Atlas legibility (SOL, 2026-09-26): larger labels, stronger baseline lines */
.hole-label { font-size: 15px; }
.idea-label { font-size: 13px; fill: #aab0c0; }
#atlas .arc { stroke-width: 1.4; }
.mode-lab .idea-label { font-size: 11px; }

/* ===== Visual system (UX spec, Phase 3b-1) — three levels of emphasis =====
   1 · Stage: sim canvas, prediction and mission cards — brightest surface, no border, soft glow in the scale colour
   2 · Content: explanation, end card, Try — 16 px body, told apart by surface, not borders
   3 · Chrome: nav, breadcrumbs, eyebrows, sources — 12 px, secondary grey
   Later rules here override the older ones above; the older token names stay as aliases. */
:root {
  --surface-1: #11141b; --surface-2: #151924;
  --text-2: #b9bfcc; --text-3: var(--muted);
  --quantum: #5ee0e6; --voyages: #e36bd0; --physics: #4fd1a5; --cosmos: #9b8cff;
  --ok: #4fd1a5; --miss: #ff7a59;
  --radius-s: 6px; --radius-m: 10px; --radius-l: 16px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px; --space-7: 28px; --space-8: 32px;
  --scale: var(--accent);
}
body[data-scale="quantum"] { --scale: var(--quantum); }
body[data-scale="voyages"] { --scale: var(--voyages); }
body[data-scale="labs"] { --scale: var(--physics); }
body[data-scale="cosmos"] { --scale: var(--cosmos); }

/* level 1 · stage */
#lab-canvas-wrap::after, #fl-canvas-wrap::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--scale) 16%, transparent), inset 0 0 56px -18px color-mix(in srgb, var(--scale) 45%, transparent); }
.predict { border: 0; border-radius: var(--radius-m); background: color-mix(in srgb, var(--t-con) 7%, var(--surface-2));
  box-shadow: 0 8px 28px -16px color-mix(in srgb, var(--t-con) 70%, transparent); }
.mission { border: 0; border-radius: var(--radius-m); background: color-mix(in srgb, var(--t-est) 5%, var(--surface-2));
  box-shadow: 0 8px 28px -16px color-mix(in srgb, var(--t-est) 60%, transparent); }
.mission.done { border: 0; background: color-mix(in srgb, var(--t-est) 11%, var(--surface-2)); }

/* level 2 · content */
#aside { background: var(--bg); font-size: 16px; line-height: 1.55; }
#aside .intro { font-size: 16px; }
.try { border: 0; border-radius: var(--radius-m); background: var(--surface-1); }
.endcard { border: 0; border-radius: var(--radius-m); background: color-mix(in srgb, var(--accent) 7%, var(--surface-1)); }

/* level 3 · chrome */
.eyebrow { font-size: 12px; color: var(--text-3); }
.crumb, .caveat { font-size: 12px; color: var(--text-3); }

/* accessibility: visible focus, touch targets, reduced motion */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (pointer: coarse) {
  .btn, header button, .popts .btn { min-height: 44px; }
  .linkish { display: inline-flex; align-items: center; min-height: 44px; }
  input[type="range"] { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* readout bar (3b-2): part of the stage — up to three big labelled numbers */
#lab-readouts, #fl-readouts { display: flex; flex-wrap: wrap; gap: 8px 36px; padding: 10px 20px 12px; background: var(--surface-2);
  border-top: 1px solid color-mix(in srgb, var(--scale) 22%, transparent); }
#lab-readouts[hidden], #fl-readouts[hidden] { display: none; }
#lab-readouts .ro b, #fl-readouts .ro b { display: block; font: 600 30px/1.15 var(--sans); font-variant-numeric: tabular-nums; color: var(--text); }
#lab-readouts .ro span, #fl-readouts .ro span { font: 12px var(--mono); letter-spacing: .02em; color: var(--text-3); }   /* no uppercasing: it would turn γ into Γ */
@media (max-width: 900px) and (orientation: portrait), (max-width: 600px) {
  #lab-readouts { gap: 4px 14px; padding: 8px 16px 10px; flex-wrap: nowrap; } #lab-readouts .ro { min-width: 0; flex: 1 1 auto; }
  #lab-readouts .ro b { font-size: 20px; } #lab-readouts .ro span { font-size: 10.5px; display: block; line-height: 1.3; }
}

/* mission circles: where you are among a lab's missions; each one can be picked or replayed */
.mission .m-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.m-dots { display: flex; gap: 7px; flex-shrink: 0; }
.m-dot { width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--t-est) 55%, transparent);
  background: transparent; color: var(--bg); font: 700 11px/1 var(--sans); cursor: pointer; display: grid; place-items: center; }
.m-dot.done { background: var(--t-est); border-color: var(--t-est); }
.m-dot.cur { border-color: var(--t-est); box-shadow: 0 0 0 3px color-mix(in srgb, var(--t-est) 30%, transparent); }
.m-dot:hover { border-color: var(--t-est); }
@media (pointer: coarse) { .m-dot { width: 30px; height: 30px; } }

/* control hints (3c): a grey line under a slider, in Learn mode until it's first used */
.ctl.has-hint { flex-wrap: wrap; row-gap: 2px; }
.ctl .hint { flex: 0 0 100%; contain: inline-size; font-size: 11.5px; line-height: 1.35; color: var(--text-3); font-style: normal; }

/* "Go deeper" tiles: a small moving picture at the top of each card */
.dcard .dcv { display: block; width: 100%; height: 60px; margin-top: auto; border-radius: var(--radius-m); background: var(--surface-2); }
.dcard span + .dcv { margin-top: auto; } .dcard span { margin-bottom: 12px; }   /* text first; the picture is a quiet strip along the bottom */
.dcard .dcv { transition: opacity .3s; }
@media (max-width: 900px) and (orientation: portrait), (max-width: 600px) {
  #fl-readouts { gap: 4px 14px; padding: 8px 16px 10px; flex-wrap: nowrap; } #fl-readouts .ro { min-width: 0; flex: 1 1 auto; }
  #fl-readouts .ro b { font-size: 20px; } #fl-readouts .ro span { font-size: 10.5px; display: block; line-height: 1.3; }
}

/* Atlas on phones: the holes as a tappable list */
.holelist { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 18px; }
.holelist .hl { text-align: left; padding: 10px 12px; border: 0; border-radius: var(--radius-m); background: var(--surface-1); color: var(--text); cursor: pointer; }
.holelist .hl b { display: block; font-size: 14px; font-weight: 600; }
.holelist .hl span { display: block; font-size: 13px; color: var(--text-3); margin-top: 2px; }
.holelist .hl:hover, .holelist .hl:focus-visible { background: color-mix(in srgb, var(--accent) 10%, var(--surface-1)); }

/* ===== Phase 4a · the passport and its header bar ===== */
#progbar { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text-3); font: 11px var(--mono); }
#progbar .pb-track { position: relative; display: block; width: 72px; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.08); overflow: hidden; }
#progbar .pb-track i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); border-radius: 2px; transition: width .4s; }
#progbar:hover, #progbar:focus-visible { color: var(--text); }
header #progbar { order: 5; margin-left: auto; } header .hdr-right { order: 6; margin-left: 0; }
@media (max-width: 900px) and (orientation: portrait), (max-width: 600px) {
  /* phones: a thin bar right across the screen between the brand and the buttons; the whole strip is the tap target */
  .brand { flex: 1 1 100%; }
  header #progbar { order: 1; flex: 1 1 100%; margin: -2px 0 0; padding: 2px 0; }
  #progbar .pb-track { flex: 1; width: auto; height: 3px; }
  header nav { order: 2; } header .hdr-right { order: 3; }
}
.passport { max-width: 1100px; }
.passport h1 { margin: 4px 0 6px; }
.pp-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 16px 0 6px; }
.pp-sum div { padding: 12px 14px; border-radius: var(--radius-m); background: var(--surface-1); }
.pp-sum b { display: block; font: 600 28px/1.1 var(--sans); } .pp-sum b i { font-style: normal; font-size: 16px; color: var(--text-3); }
.pp-sum span { font: 12px var(--mono); color: var(--text-3); }
.stamps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.stamp { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--radius-m); background: var(--surface-1); }
.stamp svg { width: 72px; height: 72px; flex-shrink: 0; }
.stamp .st-ring { fill: none; stroke: rgba(255,255,255,0.14); stroke-width: 3; stroke-dasharray: 6 5; }
.stamp .st-inner { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 1.5; }
.stamp .st-icon { font-size: 34px; opacity: .25; filter: grayscale(1); }
.stamp.on .st-ring { stroke: var(--sc); stroke-dasharray: none; } .stamp.on .st-inner { stroke: var(--sc); fill: color-mix(in srgb, var(--sc) 12%, transparent); }
.stamp.on .st-icon { opacity: 1; filter: none; }
.stamp.on svg { transform: rotate(-8deg); }
.stamp b { display: block; margin: 2px 0; } .stamp .meta { font-size: 12.5px; }
.pp-labs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
#doc .pp-lab, .pp-lab { padding: 5px 10px; border-radius: 999px; font-size: 13px; text-decoration: none; color: var(--text-3); background: rgba(255,255,255,0.03); }
#doc .pp-lab.seen, .pp-lab.seen { color: var(--text); background: color-mix(in srgb, var(--sc, var(--accent)) 12%, transparent); }
.pp-lab i { font-style: normal; color: var(--t-con); letter-spacing: 1px; }
.pp-docs { margin: 12px 0 4px; align-items: center; } .pp-docs .eyebrow { margin-right: 6px; }
.pp-missed { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
#doc .pp-missed a, .pp-missed a { display: block; padding: 10px 12px; border-radius: var(--radius-m); background: var(--surface-1); text-decoration: none; color: var(--text); }
.pp-missed a span { display: block; font-size: 13px; color: var(--text-3); margin-top: 2px; }
.recap { margin: 6px 0 10px; } .recap summary { cursor: pointer; color: var(--accent); font-size: 14px; }
.recap ol { margin: 8px 0 0; padding-left: 20px; font-size: 14px; } .recap li { margin: 4px 0; }
@media (max-width: 700px) { .pp-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Home on wide screens: centre the column, and line the header up with it, so nothing sits orphaned at the far edges.
   Labs keep the full width (sim + side panel), header included. */
body.onhome .home2 { margin-inline: auto; }
@media (min-width: 1300px) { body.onhome header { padding-inline: calc((100% - 1180px) / 2 + 24px); } }

/* challenge links (4b) */
.pfriend { margin: 0 0 8px; padding: 8px 10px; border-radius: var(--radius-s); background: color-mix(in srgb, var(--accent) 10%, transparent); font-size: 14px; }
.pshare { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }

/* ===== Phase 4c · teacher mode ===== */
#classbar { padding: 8px 20px; background: color-mix(in srgb, var(--t-con) 8%, var(--bg)); border-bottom: 1px solid color-mix(in srgb, var(--t-con) 30%, transparent); font-size: 14px; }
#classbar[hidden] { display: none; }
#classbar .cb-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
#classbar .cb-name { font-weight: 600; } #classbar .cb-what { color: var(--text-2); }
#classbar .cb-labs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
#classbar .cb-labs a { font-size: 13px; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,0.04); color: var(--text-2); text-decoration: none; }
#classbar .cb-labs a.seen { color: var(--text); background: color-mix(in srgb, var(--t-est) 14%, transparent); }
#classbar .cb-code { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; }
#classbar .cb-code code { font: 600 20px var(--mono); letter-spacing: .04em; padding: 4px 10px; border-radius: var(--radius-s); background: var(--surface-2); color: var(--text); }
.teach .tform { display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.teach label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.teach label.tch { flex-direction: row; align-items: center; gap: 8px; }
.teach input[type="text"], .teach textarea { padding: 8px 10px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface-1); color: var(--text); font: 14px var(--sans); }
.teach textarea { font-family: var(--mono); }
.teach fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; } .teach legend { font-size: 14px; margin-bottom: 4px; }
.teach .tlabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; padding: 10px 0 0 24px; }
.teach .tlabs[hidden] { display: none; }
.teach .tlink { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; } .teach .tlink input { flex: 1 1 320px; font-family: var(--mono); font-size: 12px; }
.ctable { border-collapse: collapse; font-size: 14px; margin: 8px 0; } .ctable th, .ctable td { text-align: left; padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); }
.ctable th { font: 12px var(--mono); color: var(--text-3); } .ctable tr.bad td { color: var(--t-spe); }
.worksheet .ws-q { margin: 18px 0; break-inside: avoid; } .worksheet ul { list-style: none; padding-left: 8px; margin: 6px 0; } .worksheet li { margin: 3px 0; }
.worksheet .ws-why { margin: 8px 0 2px; font-size: 13px; color: var(--text-3); }
.worksheet .ws-lines { height: 58px; background: repeating-linear-gradient(transparent 0 27px, var(--line) 27px 28px); } .worksheet .ws-lines.short { height: 30px; }
@media print {
  header, #aside, #classbar, #tourbar, #filters, .noprint, #lab-readouts { display: none !important; }
  html, body, main, #stage, #doc { background: #fff !important; color: #000 !important; height: auto !important; overflow: visible !important; display: block !important; }
  .worksheet, .worksheet * { color: #000 !important; } .worksheet .eyebrow, .worksheet .meta, .worksheet .ws-why { color: #444 !important; }
  .worksheet .ws-lines { background: repeating-linear-gradient(transparent 0 27px, #999 27px 28px) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.teach label.tch .meta { margin: 0; display: inline; } .teach fieldset { gap: 2px; }

/* the maths pages (D-057) */
.maths .eqs dt { font: 600 17px/1.4 var(--sans); margin-top: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.maths .eqs dd { margin: 4px 0 0 0; color: var(--text-2); font-size: 15px; }
.maths .mt { border-collapse: collapse; margin: 6px 0 10px; font-size: 14px; } .maths .mt td { padding: 6px 16px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.maths .chk { font: 12px var(--mono); color: var(--t-est); margin-left: 8px; }

/* Concepts · Entropy: "One entropy, two ledgers" powers-of-ten ruler (D-058) */
.ledger { margin: 12px 0 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--panel2); }
.ledger .lg-row { display: grid; grid-template-columns: minmax(120px, 34%) 1fr 64px; gap: 10px; align-items: center; margin: 6px 0; }
.ledger .lg-lab b { display: block; font-size: 13px; } .ledger .lg-lab span { display: block; font-size: 11px; color: var(--muted); }
.ledger .lg-bar { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; } .ledger .lg-bar i { display: block; height: 100%; border-radius: 5px; }
.ledger .lg-n { font-family: var(--mono); font-size: 13px; text-align: right; }
.ledger .meta { margin: 8px 0 0; }
@media (max-width: 560px) { .ledger .lg-row { grid-template-columns: 1fr 56px; } .ledger .lg-bar { grid-column: 1 / -1; grid-row: 2; } }

/* Concepts · Entropy: "Words people mix up" (D-058) */
.words { width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-size: 14px; }
.words th { text-align: left; white-space: nowrap; padding: 8px 14px 8px 0; vertical-align: top; color: var(--text); font-weight: 600; }
.words td { padding: 8px 0; color: var(--muted); } .words tr + tr th, .words tr + tr td { border-top: 1px solid var(--line); }
@media (max-width: 560px) { .words th { white-space: normal; width: 34%; } }

/* Tour pages (D-059) */
.tourpage .tp-card { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 4px 16px 8px; margin: 12px 0; background: var(--panel2); }
.tourpage .tp-card h2 { font-size: 18px; } .tourpage .tp-card h2 a { color: var(--text); text-decoration: none; }
.tourpage .tp-stops { padding-left: 22px; } .tourpage .tp-stops li { margin: 0 0 14px; }
.tourpage .tp-stops b, .tourpage .tp-stops span, .tourpage .tp-stops a { display: block; } .tourpage .tp-stops span { color: var(--muted); font-size: 14px; }
.tm-all { display: block; padding: 8px 10px; font-size: 13px; color: var(--accent); text-decoration: none; border-top: 1px solid var(--line); margin-top: 4px; }

/* About this lab (D-059): shown while a lab waits for your prediction */
.about-lab { margin: 18px 0 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.about-lab h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-family: var(--mono); font-weight: 400; margin: 0 0 6px; }
.about-lab p { color: var(--text); }

/* Keyboard focus on Atlas nodes and Test-bench rows (D-062) */
#atlas svg g[tabindex]:focus { outline: none; } #atlas svg g[tabindex]:focus-visible circle { stroke: var(--accent); stroke-width: 3; }
[data-go-hole][tabindex]:focus-visible, [data-go-idea][tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Atlas: every hole and idea as plain links (D-064) — for lists over maps, keyboards, and search engines */
.atlas-index { margin: 14px 0; } .atlas-index summary { cursor: pointer; color: var(--accent); }
.atlas-index h4 { margin: 10px 0 4px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-family: var(--mono); font-weight: 400; }
.atlas-index ul { list-style: none; padding: 0; margin: 0; } .atlas-index li { margin: 3px 0; font-size: 14px; }
.atlas-index li .meta { font-size: 12px; }
.fl-chapters { line-height: 1.7; }

/* ---------- Resizable panel grip (desktop only) ---------- */
#aside-grip { flex: none; width: 7px; margin-right: -4px; position: relative; z-index: 5; cursor: col-resize; touch-action: none; }
#aside-grip::after { content: ""; position: absolute; inset: 0 2px 0 3px; border-radius: 2px; transition: background .15s; }
#aside-grip:hover::after, #aside-grip:focus-visible::after, body.resizing #aside-grip::after { background: var(--accent); opacity: .6; }
#aside-grip:focus-visible { outline: none; }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing canvas, body.resizing iframe { pointer-events: none; }
@media (max-width: 900px) and (orientation: portrait), (max-width: 600px), (max-height: 520px) and (orientation: landscape) { #aside-grip { display: none; } }

/* ---------- Missions: "Your turn", the control it needs, and where the reading starts ---------- */
.mission .m-turn { color: var(--t-est); }
.mission .m-btns { display: flex; align-items: baseline; gap: 4px; }
.mission .m-opt { margin-left: auto; font-size: 11px; color: var(--muted); }
.idea-rule { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; }
.idea-rule::after { content: ""; flex: 1; height: 1px; background: var(--line); }
@keyframes mcue { 0%, 100% { outline-color: color-mix(in srgb, var(--t-est) 55%, transparent); box-shadow: 0 0 0 0 transparent; }
                  50% { outline-color: var(--t-est); box-shadow: 0 0 16px 3px color-mix(in srgb, var(--t-est) 30%, transparent); } }
.m-cue { outline: 1.5px solid var(--t-est); outline-offset: 4px; border-radius: 8px; animation: mcue 2.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .m-cue { animation: none; } }
