/* Warm "study notebook" theme: light-first, paper + ink, orange accent. */
:root, :root[data-theme="light"] {
  --bg: #f6f1e9; --panel: #fffdf9; --panel-2: #f8f2e8; --line: #ece3d5; --line-2: #ddd0bb;
  --text: #2b2420; --muted: #7a6d60; --accent: #e8590c; --accent-soft: #fde9da; --on-accent: #fff;
  --dots: rgba(120, 90, 60, .16); --shadow: 0 1px 2px rgba(70, 45, 20, .06), 0 6px 20px rgba(70, 45, 20, .06);
  --code-bg: #2b2420; --code-text: #f6ead9;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1a1714; --panel: #221e1a; --panel-2: #2a2520; --line: #36302a; --line-2: #4a4239;
  --text: #f1e9df; --muted: #a89b8c; --accent: #ff8a3d; --accent-soft: rgba(255, 138, 61, .14); --on-accent: #1a1714;
  --dots: rgba(255, 230, 200, .08); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --code-bg: #120f0d; --code-text: #f1e9df;
  color-scheme: dark;
}
:root { --sans: 'Lexend', system-ui, sans-serif; --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.65 var(--sans); }
button, select, input { font: inherit; color: inherit; }
kbd { border: 1px solid var(--line-2); border-radius: 5px; padding: 0 5px; font: 11px var(--mono); color: var(--muted); }
code { font: .9em var(--mono); background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 0 4px; }
.ink { color: color-mix(in srgb, var(--c) 72%, var(--text)); }

/* header */
.top { display: flex; align-items: center; gap: 16px; padding: 12px 20px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 38px; height: 38px; padding: 6px; border-radius: 12px; background: var(--accent); fill: none; stroke: var(--on-accent); stroke-width: 1.8; stroke-linejoin: round; }
.brand-name { font: 700 20px/1 var(--sans); }
.brand-name em { font-style: normal; color: var(--accent); }
.brand-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.top-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.btn, .icon-btn, select {
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; padding: 7px 14px; cursor: pointer; font-size: 13px; font-weight: 500;
}
.icon-btn { padding: 7px 11px; }
.btn:hover, .icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; min-width: 100px; }
.btn.primary:hover { filter: brightness(1.06); color: var(--on-accent); }
.btn:disabled { opacity: .4; cursor: default; }
.only-mobile { display: none; }

/* view nav + non-explore views */
.views { display: flex; gap: 2px; margin-left: 8px; }
.views a { padding: 7px 14px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.views a:hover { color: var(--text); background: var(--panel-2); }
.views a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.views a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
body:not([data-view="explore"]) .grid, body:not([data-view="explore"]) #menuBtn { display: none; }
body[data-view="explore"] .view { display: none; }
.view { max-width: 1200px; margin: 0 auto; padding: 8px 16px 48px; }
.view-in h1 { font: 700 28px/1.15 var(--sans); margin: 8px 0 4px; }
.view-in h2 { font: 600 18px var(--sans); margin: 28px 0 10px; }
.view .back { display: inline-block; color: var(--muted); text-decoration: none; font-size: 13px; margin-top: 6px; }
.view .back:hover { color: var(--accent); }

/* layout */
.grid {
  display: grid; gap: 14px; padding: 0 16px 16px; height: calc(100vh - 66px);
  grid-template-columns: 300px minmax(0, 1fr) 410px; grid-template-rows: minmax(0, 1fr) 250px;
}
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; min-height: 0; min-width: 0; box-shadow: var(--shadow); }
.panel-title { font: 600 15px/1 var(--sans); margin: 0; }
.side { grid-row: 1 / 3; display: flex; flex-direction: column; padding: 16px; gap: 10px; }
.stage { display: flex; flex-direction: column; overflow: hidden; }
.info { overflow-y: auto; padding: 18px 20px; }
.flow { grid-column: 2 / 4; display: flex; flex-direction: column; overflow: hidden; }

/* sidebar */
#search { width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
#search:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip { border: 1px solid var(--line-2); background: var(--panel); border-radius: 99px; padding: 2px 11px; font-size: 12px; cursor: pointer; color: var(--muted); }
.chip.on { border-color: var(--c, var(--accent)); color: var(--text); background: color-mix(in srgb, var(--c, var(--accent)) 16%, var(--panel)); font-weight: 600; }
.list { overflow-y: auto; margin: 0 -8px; padding: 0 8px; flex: 1; }
.group { font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--muted); margin: 16px 0 6px; display: flex; align-items: center; gap: 8px; }
.group::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.item { display: block; width: 100%; text-align: left; background: none; border: 1px solid transparent; border-radius: 10px; padding: 8px 11px; cursor: pointer; margin-bottom: 2px; }
.item:hover { background: var(--panel-2); }
.item.on { border-color: color-mix(in srgb, var(--c) 55%, transparent); background: color-mix(in srgb, var(--c) 10%, var(--panel)); }
.item b { display: block; font-weight: 600; }
.item small { color: var(--muted); font-size: 12px; line-height: 1.4; display: block; }
.steps { list-style: none; margin: 4px 0 10px 14px; padding: 0 0 0 4px; border-left: 2px solid var(--line); }
.steps button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; background: none; border: 0; padding: 4px 8px; cursor: pointer; color: var(--muted); font-size: 13px; border-radius: 8px; }
.steps button:hover { color: var(--text); background: var(--panel-2); }
.steps .on button { color: var(--text); font-weight: 600; }
.num { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; font-size: 11px; background: var(--panel); }
.steps .done .num { background: color-mix(in srgb, var(--c) 30%, var(--panel)); border-color: var(--c); }
.steps .on .num { background: var(--c); border-color: var(--c); color: #1a1714; font-weight: 700; }
.empty { color: var(--muted); padding: 12px 4px; }

/* stage */
.stage-bar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { background: none; border: 0; padding: 4px 14px; font-size: 13px; cursor: pointer; color: var(--muted); border-radius: 8px; }
.seg button.on { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.stage-title { margin-left: auto; color: var(--muted); font-size: 13px; text-align: right; }
.stage-title b { color: color-mix(in srgb, var(--c) 72%, var(--text)); }
.canvas {
  flex: 1; min-height: 0; position: relative; overflow: auto; border-top: 1px solid var(--line);
  background-image: radial-gradient(var(--dots) 1.2px, transparent 1.3px); background-size: 22px 22px;
}
.canvas > svg { display: block; width: 100%; height: 100%; }
.edge { stroke: var(--line-2); stroke-width: 2; stroke-dasharray: 5 7; fill: none; stroke-linecap: round; }
/* steps(), not linear: dashoffset repaints the whole diagram on the main thread, so a smooth run costs a repaint per display frame (240/s on fast screens). */
.edge.hot { stroke: var(--accent); opacity: .85; animation: dash 1s steps(12) infinite; }
@keyframes dash { to { stroke-dashoffset: -24; } }
.node { transition: opacity .3s; }
.node.dim { opacity: .4; }
.node .box { fill: var(--panel); stroke: var(--line-2); stroke-width: 2; }
.node.focus .box { stroke: var(--c); stroke-width: 3; fill: color-mix(in srgb, var(--c) 14%, var(--panel)); }
.node .ico { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.node.focus .ico { stroke: var(--text); }
.node .lbl { fill: var(--text); font: 600 18px var(--sans); text-anchor: middle; }
.node .sub { fill: var(--muted); font: 13px var(--mono); text-anchor: middle; }
.pulse { fill: none; stroke-width: 3; animation: pulse 1s ease-out forwards; }
@keyframes pulse { from { r: 40; opacity: 1; } to { r: 80; opacity: 0; } }
.pkt-label { font: 600 15px var(--sans); paint-order: stroke; stroke: var(--panel); stroke-width: 5; }

/* sequence */
.seq text { font-family: var(--sans); }
.seq-head { position: sticky; top: 0; z-index: 1; background: var(--panel); border-bottom: 1px solid var(--line); }
.seq .life { stroke: var(--line-2); stroke-dasharray: 3 5; }
.seq .head { fill: var(--text); font-weight: 600; font-size: 12px; text-anchor: middle; }
.seq .headsub { fill: var(--muted); font-size: 10px; text-anchor: middle; font-family: var(--mono); }
.seq .stepline { fill: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; }
.seq .msg { font-size: 12px; fill: var(--text); }

/* info panel + reader shared typography */
.kicker { color: color-mix(in srgb, var(--c) 72%, var(--text)); font-size: 12px; font-weight: 600; letter-spacing: .08em; }
.info h1, .reader-body h1 { font: 700 28px/1.15 var(--sans); margin: 6px 0 4px; }
.info h3, .reader-body h3 { font: 600 13px var(--sans); letter-spacing: .04em; color: var(--muted); margin: 20px 0 6px; text-transform: uppercase; }
.info p, .reader-body p { margin: 8px 0; white-space: pre-line; }
.lead { color: var(--muted); margin-top: 0; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.badge { background: color-mix(in srgb, var(--c) 18%, var(--panel)); border-radius: 99px; padding: 2px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tabs { display: flex; gap: 2px; background: var(--panel-2); border-radius: 10px; padding: 3px; margin: 14px 0 6px; }
.tabs button { flex: 1; background: none; border: 0; padding: 6px 4px; cursor: pointer; color: var(--muted); font-size: 12.5px; border-radius: 8px; white-space: nowrap; }
.tabs button.on { color: var(--text); background: var(--panel); font-weight: 600; box-shadow: var(--shadow); }
dl.facts { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; margin: 8px 0; }
dl.facts dt, dl.facts dd { margin: 0; padding: 8px 6px; border-bottom: 1px solid var(--line); }
dl.facts dt { color: var(--muted); font-size: 12px; }
ul.bul, ol.bul { padding-left: 20px; margin: 6px 0; }
.bul li { margin: 5px 0; }
.bul li::marker { color: var(--accent); font-weight: 600; }
.tip { background: var(--accent-soft); padding: 10px 14px; border-radius: 12px; margin: 14px 0; }
details.qa { border: 1px solid var(--line); border-radius: 12px; margin: 8px 0; background: var(--panel); }
details.qa summary { cursor: pointer; padding: 11px 14px; font-weight: 500; list-style: none; display: flex; gap: 10px; align-items: baseline; }
details.qa summary::-webkit-details-marker { display: none; }
details.qa[open] summary { border-bottom: 1px dashed var(--line); }
details.qa p { padding: 10px 14px 14px; margin: 0; white-space: pre-line; }
.lvl { flex: none; font: 600 10px var(--mono); padding: 1px 7px; border-radius: 6px; background: var(--panel-2); color: var(--muted); }
.lvl.senior { background: #fde9da; color: #a63e00; }
.lvl.staff { background: #ece3fb; color: #5b2bb5; }
:root[data-theme="dark"] .lvl.senior { background: rgba(255, 138, 61, .18); color: #ffb27d; }
:root[data-theme="dark"] .lvl.staff { background: rgba(167, 139, 250, .18); color: #c9b6ff; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.tags span { font-size: 12px; background: var(--panel-2); border-radius: 6px; padding: 1px 8px; color: var(--muted); }
.rels { display: flex; flex-wrap: wrap; gap: 6px; }
.rel { border: 1px solid var(--line-2); background: var(--panel); border-radius: 99px; padding: 3px 12px; font-size: 12.5px; cursor: pointer; }
.rel:hover { border-color: var(--accent); color: var(--accent); }
.cta { width: 100%; margin-top: 16px; }
.sec { scroll-margin-top: 12px; }
pre { background: var(--code-bg); color: var(--code-text); border-radius: 12px; padding: 14px 16px; overflow-x: auto; font: 12.5px/1.6 var(--mono); }
pre code { background: none; border: 0; padding: 0; color: inherit; }
.tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; margin: 10px 0; }
.tbl table { font: 13px/1.5 var(--sans); }
.tbl td { white-space: normal; vertical-align: top; min-width: 120px; }

/* flow table */
.flow-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; padding: 12px 16px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.legend span::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--t); margin-right: 5px; }
.controls { margin-left: auto; display: flex; gap: 6px; }
.table-wrap { overflow: auto; flex: 1; }
table { width: 100%; border-collapse: collapse; font: 12.5px var(--mono); }
th { position: sticky; top: 0; background: var(--panel); text-align: left; color: var(--muted); font: 600 11.5px var(--sans); padding: 7px 12px; border-bottom: 1px solid var(--line); }
td { padding: 7px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.info-col { white-space: normal; min-width: 260px; }
tr.new { animation: flash 1.4s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } }
.dot { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--t); color: #1a1714; font-weight: 600; font-size: 10.5px; }
.type { color: color-mix(in srgb, var(--t) 75%, var(--text)); font-weight: 600; }

/* dialogs */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 18px; padding: 0; width: min(1200px, 96vw); max-height: 92vh; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
dialog::backdrop { background: rgba(40, 28, 18, .45); backdrop-filter: blur(2px); }
dialog[open] { display: flex; flex-direction: column; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; font: 600 17px var(--sans); }
#compareBody td { white-space: normal; vertical-align: top; min-width: 150px; font-family: var(--sans); }
#compareBody td:first-child { color: var(--muted); font-size: 12px; min-width: 120px; }
#compareBody th { color: var(--text); font-size: 13px; }
#compareBody .note { color: var(--muted); font-size: 12px; padding: 10px 18px; }
#reader { width: min(1320px, 97vw); height: 92vh; }
.reader { display: grid; grid-template-columns: 290px minmax(0, 1fr); flex: 1; min-height: 0; }
.reader-nav { overflow-y: auto; padding: 12px 14px; border-right: 1px solid var(--line); background: var(--panel-2); }
.reader-body { overflow-y: auto; padding: 28px clamp(16px, 4vw, 56px) 60px; }
.reader-body > * { max-width: 860px; }
.reader-body h3 { font-size: 16px; text-transform: none; letter-spacing: 0; color: var(--text); margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--line); }
.reader-body p, .reader-body li { font-size: var(--read-size, 15px); line-height: var(--read-lh, 1.65); }
.reader-body .ar-prose, .reader-body > .ar > .ar-main p { max-width: var(--read-width, 860px); }
.reader-body .bank-h { border: 0; padding-top: 0; }
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0; padding: 14px; background: var(--panel-2); border-radius: 12px; }
.toc button { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 2px 10px; font-size: 12.5px; cursor: pointer; }
.toc button:hover { border-color: var(--accent); color: var(--accent); }

/* responsive */
@media (max-width: 1280px) { .hide-sm, .brand-sub { display: none; } } /* make room for the view nav */
@media (max-width: 1200px) {
  .grid { grid-template-columns: 260px minmax(0, 1fr) 350px; }
  .hide-md { display: none; }
}
@media (max-width: 900px) {
  .only-mobile { display: inline-block; }
  .hide-sm, .brand-sub { display: none; }
  .top { padding: 10px 16px; flex-wrap: wrap; row-gap: 6px; }
  .views { order: 3; width: 100%; margin-left: 0; overflow-x: auto; }
  .views a { flex: 1 0 auto; text-align: center; padding: 7px 10px; }
  .grid { display: flex; flex-direction: column; height: auto; padding: 0 16px 16px; }
  .side { display: none; max-height: 70vh; }
  .side.open { display: flex; }
  .stage { height: 60vh; }
  .flow { height: 360px; }
  .controls { margin-left: 0; width: 100%; }
  .controls .primary { flex: 1; }
  .reader { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .reader-nav { max-height: 28vh; border-right: 0; border-bottom: 1px solid var(--line); }
}

/* explore additions: state table, predict, component view, practise row */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.node[data-node] { cursor: pointer; }
.node[data-node]:focus-visible { outline: none; }
.node[data-node]:focus-visible .box { stroke: var(--accent); stroke-width: 4; }
.mark { font-size: 11px; margin-left: 4px; color: var(--muted); }
.mark.s2 { color: var(--accent); }
.mark.s3 { color: #2f9e44; }
:root[data-theme="dark"] .mark.s3 { color: #69db7c; }
table.state { width: 100%; font: 12.5px var(--mono); table-layout: fixed; }
table.state th { position: static; width: 38%; text-align: left; font: 500 12px var(--sans); color: var(--muted); padding: 6px; border-bottom: 1px solid var(--line); background: none; vertical-align: top; }
table.state td { white-space: normal; overflow-wrap: anywhere; padding: 6px; color: var(--muted); }
table.state tr.chg td { color: var(--text); background: var(--accent-soft); }
table.state tr.chg th { color: var(--text); background: var(--accent-soft); font-weight: 600; }
table.state s { color: var(--muted); }
.opts { display: grid; gap: 8px; margin: 14px 0; }
.opt { display: flex; gap: 10px; align-items: flex-start; text-align: left; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; cursor: pointer; color: var(--text); font: inherit; }
.opt:hover:not(:disabled), .opt:focus-visible { border-color: var(--accent); }
.opt kbd { flex: none; min-width: 22px; text-align: center; border: 1px solid var(--line-2); border-radius: 6px; font: 600 11px var(--mono); padding: 1px 5px; background: var(--panel); }
.opt:disabled { cursor: default; opacity: .6; color: var(--text); }
.opt.right { opacity: 1; border-color: #2f9e44; background: color-mix(in srgb, #2f9e44 16%, var(--panel)); }
.opt.wrong { opacity: 1; border-color: #e03131; background: color-mix(in srgb, #e03131 14%, var(--panel)); }
.fb.right { color: #2f9e44; font-weight: 600; }
.fb.wrong { color: #e03131; font-weight: 600; }
:root[data-theme="dark"] .fb.right { color: #69db7c; }
:root[data-theme="dark"] .fb.wrong { color: #ff8787; }
.comp-step { margin: 14px 0; }
.comp-step .rel b { color: var(--accent); margin-right: 4px; }
.comp-step .bul { margin: 4px 0 0; }
.comp-step .bul li { font-size: 13px; overflow-wrap: anywhere; }
.done-card, .practise { margin-top: 12px; }
.done-card { border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 14px; padding: 4px 14px 14px; margin-top: 20px; }
.done-card h3 { margin-top: 12px; }
.pred-score { font-weight: 600; color: var(--accent); }
.pr-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0; }
.tools-row .rel, .sources a { min-height: 44px; display: inline-flex; align-items: center; }
.sources { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 8px; }
.sources-note { color: var(--muted); font-size: 13px; }
.pr-l { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-right: 2px; }
.practise .btn { font-size: 12.5px; }
.reader-body .practise { margin: 14px 0; }
@media (max-width: 900px) { .controls { flex-wrap: wrap; } }

/* study block: mastery levels + five-session plan (narrow column first) */
.study { margin: 12px 0; min-width: 0; }
.st-h { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 8px 0 6px; }
.lvl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; }
.lvl-btn { display: flex; flex-direction: column; gap: 3px; text-align: left; min-width: 0; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel); cursor: pointer; overflow-wrap: normal; word-break: normal; hyphens: none; }
.lvl-btn:hover { border-color: var(--accent); }
.lvl-btn b { font-size: 13px; }
.lvl-btn span { font-size: 12px; color: var(--muted); line-height: 1.4; }
.lvl-btn .ev { font-style: normal; font-size: 11px; color: #2f9e44; }
:root[data-theme="dark"] .lvl-btn .ev { color: #69db7c; }
.lvl-btn.fill { background: var(--accent-soft); }
.lvl-btn[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.plan-note { font-size: 12.5px; color: var(--muted); margin: 4px 0 8px; }
.ses-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ses { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; background: var(--panel); min-width: 0; }
.ses-h { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; font-size: 13px; }
.ses-h span { font-size: 12px; color: var(--muted); }
.ses .ses-st { margin-left: auto; }
.ses.done .ses-st { color: #2f9e44; }
:root[data-theme="dark"] .ses.done .ses-st { color: #69db7c; }
.ses.locked { opacity: .6; }
.ses.due { border-color: var(--accent); background: var(--accent-soft); }
.ses.due .ses-st { color: var(--accent); font-weight: 600; }
.ses .btn { font-size: 12.5px; margin: 4px 0 2px; }
.plan-ask { border: 1px dashed var(--accent); border-radius: 10px; padding: 8px 10px; margin: 0 0 8px; font-size: 13px; background: var(--accent-soft); }

/* ---------- concept article reader (lib/article.js) ---------- */
.ar { position: relative; }
.ar-eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ar-hint { color: var(--muted); font-size: 13px; }
.ar button:focus-visible, .ar summary:focus-visible, .ar textarea:focus-visible, .ar input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ar .btn, .ar .rel { min-height: 34px; }
.ar-know { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 14px 0; }
.ar-lv { font: 600 11px var(--mono); margin-left: 4px; color: var(--accent); }
.ar-lv.new { color: var(--muted); font-weight: 400; }
.ar-modes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 12px 0; }
.ar-modes .btn { font-size: 12.5px; padding: 3px 14px; }
.ar-gated .ar-main { opacity: .45; }
.ar-gate, .ar-guesses { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 14px; padding: 4px 18px 18px; margin: 16px 0; }
.ar-gate h3, .ar-guesses h3 { border: 0; margin-top: 14px; padding-top: 0; }
.ar-q { border: 0; padding: 0; margin: 14px 0 0; min-width: 0; }
.ar-q legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.ar-q label { display: flex; gap: 10px; align-items: baseline; padding: 6px 10px; margin: 3px 0; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel); cursor: pointer; font-size: 14px; }
.ar-q label:has(input:checked) { border-color: var(--accent); }
.ar-q input { accent-color: var(--accent); }
.ar-g { border-top: 1px dashed var(--line-2); padding-top: 4px; }
.ar-g p { margin: 4px 0; }
.ar-g.right b::before { content: '✓ '; color: #2f9e44; }
.ar-g.wrong b::before { content: "○ "; color: var(--muted); }
.ar-toc { margin-top: 8px; }
.ar-ess { border-left: 3px solid var(--c, var(--accent)); padding-left: clamp(10px, 2.5vw, 22px); margin: 10px 0 24px; }
.ar-ess > .ar-eyebrow { margin-top: 4px; color: color-mix(in srgb, var(--c, var(--accent)) 72%, var(--text)); }
.ar-sbody > .ar-realh { font-size: 12px; color: var(--muted); margin: 4px 0; }
.ar-qrow { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.reader-body .ar-qrow h3 { border: 0; margin: 0; padding: 0; font-weight: 500; }
.ar-rc { padding: 10px 0; }
.reader-body .ar-sec.ar-rc h3 { margin-top: 0; }
.ar-sixty { margin: 8px 0; }
.ar-model { margin-top: 10px; padding: 4px 14px; background: var(--panel-2); border-radius: 12px; }
.ar-code { margin: 10px 0; min-width: 0; }
.ar-code pre { margin: 0; }
.ar-runrow { margin: 6px 0; }
.ar-out { margin: 0; background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.ar-err { color: #e03131; font-weight: 600; }
:root[data-theme="dark"] .ar-err { color: #ff8787; }
.ar pre { max-width: 100%; }

/* "Why?" drill-downs and the checkpoint: visibly secondary to the prose */
.ar-whys { margin: 12px 0; }
details.why { margin: 6px 0; border-left: 2px solid var(--line-2); padding-left: 12px; }
details.why > summary { cursor: pointer; list-style: none; font-size: 13.5px; color: var(--muted); padding: 4px 0; }
details.why > summary::-webkit-details-marker, .ar-lens > summary::-webkit-details-marker, .ar-deeper > summary::-webkit-details-marker, .ar-dsec > summary::-webkit-details-marker { display: none; }
.ar-lens > summary::before, .ar-dsec > summary::before { content: '+'; display: inline-block; width: 16px; font-weight: 700; color: var(--accent); }
.ar-lens[open] > summary::before, .ar-dsec[open] > summary::before { content: '–'; }
.why-k { font-weight: 700; color: var(--accent); }
details.why[open] > summary { color: var(--text); }
.why-b { padding-bottom: 8px; }
.why-b p, .why-b li { font-size: 14px; }
.ar-claim { margin: 6px 0; padding: 4px 12px; border-left: 3px solid var(--line-2); color: var(--muted); font-style: italic; font-size: 14px; }
.ar-check { margin: 18px 0; padding: 12px 16px; border: 1px dashed var(--line-2); border-radius: 12px; background: var(--panel-2); }
.ar-check p { margin: 6px 0; }
.ar-check textarea { width: 100%; resize: vertical; background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px; font: 14px/1.5 var(--sans); }
.ar-pts { margin: 6px 0; }
.ar-grade { align-items: center; margin-top: 10px; }
.ar-saved { font-size: 12.5px; color: var(--muted); }

/* principle cards */
.ar-principles, .ar-confused { margin-top: 28px; }
.ar-cards, .ar-conf-grid { display: grid; gap: 14px; }
.ar-card { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--c, var(--accent)); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.reader-body .ar-card h4, .reader-body .ar-conf h4 { margin: 0; font: 600 16px/1.3 var(--sans); }
.ar-one { color: var(--muted); margin: 4px 0 8px; }
.ar-bar { display: flex; justify-content: flex-end; margin: 4px 0; }
.ar-bar .btn { font-size: 12px; padding: 1px 12px; min-height: 28px; }
.ar-lens { border-top: 1px solid var(--line); }
.ar-lens > summary { cursor: pointer; list-style: none; padding: 8px 2px; font-size: 13.5px; font-weight: 500; }
.ar-lens-b { padding: 0 2px 10px 18px; }
.ar-lens-b p { font-size: 14px; }
.ar-lens-lab { padding: 8px 0; }
.ar-labwrap { margin: 12px 0; min-width: 0; }
.ar-labslot { margin-top: 8px; min-width: 0; overflow-x: auto; }
.ar-chal-h { margin: 14px 0 4px; font: 600 14px var(--sans); }

/* figure */
.ar-fig { margin: 22px 0; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.ar-figt { font-weight: 600; margin-bottom: 6px; }
.ar-fig-scroll { overflow-x: auto; }
.ar-cap { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.dg { display: block; width: 100%; min-width: 560px; height: auto; }
.dg-node { fill: var(--panel-2); stroke: var(--line-2); stroke-width: 1.5; }
.dg-node.tone-accent { fill: var(--accent-soft); stroke: var(--accent); }
.dg-node.tone-warn { fill: rgba(224, 49, 49, .12); stroke: #e03131; }
.dg-node.tone-good { fill: rgba(47, 158, 68, .13); stroke: #2f9e44; }
.dg-node.tone-muted { opacity: .7; stroke: var(--line); }
.dg-label { fill: var(--text); font: 600 12.5px var(--sans); }
.dg-sub { fill: var(--muted); font: 11px var(--sans); }
.dg-edge { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.dg-edge.dashed { stroke-dasharray: 5 4; }
.dg-arrow { color: var(--muted); }
.dg-elbg { fill: var(--panel); }
.dg-elabel { fill: var(--muted); font: 11px var(--sans); }

/* often confused with */
.ar-conf { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.ar-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.ar-cols > div { min-width: 0; }
.ar-cols p, .ar-tell { font-size: 14px; margin: 4px 0; }

/* go deeper */
.ar-deeper { margin: 28px 0; border: 1px solid var(--line-2); border-radius: 14px; background: var(--panel); }
.ar-deeper > summary { cursor: pointer; list-style: none; padding: 14px 18px; font-weight: 600; }
.ar-deeper > summary::before { content: '▸ '; color: var(--accent); }
.ar-deeper[open] > summary::before { content: '▾ '; }
.ar-deeper[open] > summary { border-bottom: 1px solid var(--line); }
.ar-deep-in { padding: 6px 18px 14px; }
.ar-dsec { border-bottom: 1px solid var(--line); }
.ar-dsec:last-child { border-bottom: 0; }
.ar-dsec > summary { cursor: pointer; list-style: none; padding: 12px 0; font-weight: 500; }
.ar-sbody { min-width: 0; }

/* glossary */
.gl { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: help; border-bottom: 1.5px dotted var(--accent); }
.gl:hover, .gl[aria-expanded="true"] { background: var(--accent-soft); }
.ar-pop { position: absolute; z-index: 5; width: min(340px, 100%); background: var(--panel); border: 1px solid var(--accent); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); }
.ar-pop[hidden] { display: none; }
.reader-body .ar-pop p { font-size: 13.5px; margin: 4px 0 8px; }

@media (max-width: 600px) {
  .ar-cols { grid-template-columns: 1fr; }
  .ar-ess { padding-left: 10px; }
  .ar-deep-in { padding: 4px 12px 10px; }
  .ar-qrow { flex-direction: column; gap: 6px; }
}
@media (min-width: 900px) { .ar-cards { grid-template-columns: 1fr 1fr; } .ar-cards:has(> :only-child) { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: no-preference) { .ar-main { transition: opacity .2s; } }

/* reader top: compact progress, one row for prerequisites + mode, contents folded */
.ar-progress { margin: 8px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.ar-progress > summary { cursor: pointer; padding: 8px 14px; font-size: 13px; color: var(--muted); }
.ar-progress > summary:focus-visible, .ar-tocd > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ar-progress[open] > summary { border-bottom: 1px solid var(--line); }
.ar-progress .study { padding: 0 12px 12px; }
.reader-body .practise { margin: 8px 0; }
.ar-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 20px; }
.ar-top .ar-know, .ar-top .ar-modes { margin: 8px 0; }
.ar-modehint { margin: 0 0 6px; }
.ar-modehint:empty { display: none; }
.ar-tocd { margin: 6px 0; }
.ar-tocd > summary { cursor: pointer; font-size: 13px; color: var(--muted); padding: 4px 0; }
.ar-tocd .toc { margin: 6px 0; }
.ar-sbody:focus { outline: none; }
.ar-runrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.ar-runnote { font-size: 12px; flex: 1 1 220px; }
.ar-outl { margin-top: 6px; }

/* ---------- finish layer: focus mode, read-aloud, calm, the walk bar ---------- */
#reader.focus .reader-nav { display: none; }
#reader.focus .reader { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.ar-focus .ar-fpos { margin: 6px 0 2px; }
.ar-fpos:focus { outline: none; }
.ar-focusmode .ar-sec h3 { margin-top: 6px; }
.ar-sayrow { margin: 4px 0; }
.ar .ar-say { font-size: 12.5px; min-height: 36px; }
/* nothing animates behind an open dialog */
body:has(dialog[open]) .grid * { animation-play-state: paused !important; }
/* calm: the setting, or the system asks for reduced motion (app.js sets data-calm for both) */
:root[data-calm] *, :root[data-calm] *::before, :root[data-calm] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
.sitbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 16px 10px; padding: 8px 12px; background: var(--panel); border: 2px solid var(--accent); border-radius: 14px; font-size: 13.5px; }
.sitbar[hidden] { display: none; }
.sitbar .sb-meta { color: var(--muted); }
.sitbar .sit-kind { font-weight: 600; color: color-mix(in srgb, var(--accent) 75%, var(--text)); }
.sitbar .sb-where { margin: 0; flex: 1 1 200px; }
.sitbar .sb-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.sitbar .btn { min-height: 44px; }
.sitbar .tick { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 700; }
body.walking .grid { height: calc(100vh - 140px); }
@media (max-width: 900px) { body.walking .grid { height: auto; } }
.ar-top[hidden] { display: none; }
