:root {
  color-scheme: dark;
  --bg: #0b0e14;
  --bg2: #11151d;
  --panel: #161b26;
  --panel2: #1c2230;
  --border: #252d3d;
  --border-strong: #3a4660;
  --text: #dde4ee;
  --muted: #94a0b4;
  --dim: #7d8aa3;
  --accent: #7aa2f7;
  --accent-press: #5d8af0;
  --on-accent: #0b0e14;
  --good: #42d392;
  --warn: #f0b454;
  --bad: #f76e8a;
  --trend-up: #c6a7ff;
  --trend-down: #64b5ff;
  --trend-flat: #d8bd72;
  --image-bg: #05070b;
  --overlay: rgba(0, 0, 0, .62);
  --focus: 0 0 0 2px rgba(122, 162, 247, .45);
  --r-panel: 12px;
  --r-ctl: 8px;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }
strong { font-weight: 680; }
code, pre { font-family: var(--mono); }
.skip { position: fixed; left: 12px; top: -80px; z-index: 100; padding: 8px 12px; background: var(--accent); color: var(--on-accent); border-radius: var(--r-ctl); }
.skip:focus { top: 12px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 58px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 680; white-space: nowrap; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--r-ctl); background: var(--accent); color: var(--on-accent); font: 700 11px/1 var(--mono); }
.tabs { display: flex; align-self: stretch; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { min-height: 44px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); cursor: pointer; font-size: 13.5px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.tab:focus-visible, .btn:focus-visible, .icon-btn:focus-visible, .side-toggle:focus-visible, .nav-item:focus-visible, .filter-chip:focus-visible, .back-link:focus-visible, .module-card:focus-visible, .phase-btn:focus-visible, .sort-item:focus-visible, .sort-controls button:focus-visible, .question-option:focus-visible, .model3d-object:focus-visible, .t1-flashcard:focus-visible, .real-image-open:focus-visible, .node-route:focus-visible, .node-detail-toggle:focus-visible, summary:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
.side-toggle { flex: none; display: grid; place-items: center; width: 40px; height: 40px; color: var(--muted); background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-ctl); cursor: pointer; }
.side-toggle:hover { color: var(--text); border-color: var(--accent); }
.side-toggle svg { width: 18px; height: 18px; }
.side-toggle[aria-expanded="false"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.top-right { margin-left: auto; display: flex; align-items: center; }
.status { font: 600 10px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--good); border: 1px solid color-mix(in srgb, var(--good) 35%, transparent); background: color-mix(in srgb, var(--good) 10%, transparent); border-radius: 999px; padding: 6px 10px; white-space: nowrap; }
.status.loading { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 38%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.status.error { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: color-mix(in srgb, var(--bad) 10%, transparent); }

.app { max-width: 1440px; min-height: calc(100vh - 58px); margin: 0 auto; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
body[data-pane="t1"] .app { max-width: 1200px; grid-template-columns: minmax(0, 1fr); }
body[data-pane="t1"] .side, body[data-pane="t1"] .mobile-nav { display: none; }
body[data-pane="t1"] .side-toggle { visibility: hidden; }
body[data-pane="t1"] main { width: 100%; }
.side { position: sticky; top: 58px; align-self: start; height: calc(100vh - 58px); overflow-y: auto; padding: 18px 14px 28px; background: var(--bg2); border-right: 1px solid var(--border); }
body.side-collapsed .app { grid-template-columns: minmax(0, 1fr); }
body.side-collapsed .side { display: none; }
.side-next, .timer-box { padding: 14px; margin-bottom: 14px; border: 1px solid var(--border); border-radius: var(--r-panel); background: var(--panel); }
.side-label, .kicker { margin: 0 0 6px; color: var(--dim); font: 600 10px/1.3 var(--mono); letter-spacing: .16em; text-transform: uppercase; }
.next-title { min-height: 42px; margin: 6px 0 12px; font-size: 13.5px; line-height: 1.55; font-weight: 650; }
.timer-box { display: grid; gap: 10px; }
.timer-box strong { display: block; margin-top: 4px; color: var(--accent); font: 700 22px/1 var(--mono); font-variant-numeric: tabular-nums; }
.timer-actions { display: flex; gap: 8px; }
.icon-btn { min-height: 36px; flex: 1; padding: 6px 8px; color: var(--muted); background: var(--panel2); border: 1px solid var(--border-strong); border-radius: var(--r-ctl); cursor: pointer; font-size: 12px; }
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.nav-item { width: 100%; min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0; padding: 7px 10px; color: var(--muted); background: none; border: 0; border-radius: var(--r-ctl); cursor: pointer; text-align: left; font-size: 13.5px; }
.nav-item:hover { color: var(--text); background: var(--panel); }
.nav-item.on { color: var(--text); background: var(--panel2); }
.count { color: var(--dim); font: 11px/1 var(--mono); }
.side-note { margin: 22px 8px 0; color: var(--dim); font-size: 11.5px; line-height: 1.6; }

main { min-width: 0; padding: 30px 32px 80px; }
.pane[hidden] { display: none; }
.pane { animation: rise .28s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.hero, .page-head { max-width: 900px; margin-bottom: 24px; }
.hero h1, .page-head h1 { max-width: 820px; margin: 8px 0 12px; font-size: clamp(30px, 4vw, 46px); line-height: 1.2; letter-spacing: -.025em; }
.lead, .page-head p { max-width: 760px; margin: 0; color: var(--muted); font-size: 17px; line-height: 1.8; }
.lead strong { color: var(--warn); }

.callout { max-width: 980px; display: grid; grid-template-columns: auto 1fr; gap: 12px; margin: 20px 0; padding: 14px 16px; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--r-panel); background: var(--panel); color: var(--muted); font-size: 14px; }
.callout strong { color: var(--text); }
.callout.warn { border-left-color: var(--warn); }
.callout-mark { color: var(--accent); font: 800 14px/1.6 var(--mono); }
.callout.warn .callout-mark { color: var(--warn); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 24px 0 40px; }
.stat { padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r-panel); background: var(--panel); }
.stat-value { color: var(--accent); font-size: 25px; font-weight: 720; line-height: 1.25; font-variant-numeric: tabular-nums; }
.stat-label { margin-top: 4px; color: var(--dim); font: 10px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; }

.t1-shell { max-width: 1040px; margin: 0 auto; }
.t1-boundary { max-width: none; margin-bottom: 24px; }
.t1-snapshot-bar { display: grid; grid-template-columns: minmax(180px, auto) minmax(0, 1fr); align-items: center; gap: 22px; padding: 15px 18px; border: 1px solid var(--border); border-radius: var(--r-panel); background: var(--bg2); }
.t1-snapshot-bar strong { color: var(--accent); font: 650 13px/1.4 var(--mono); font-variant-numeric: tabular-nums; }
.t1-snapshot-bar p:last-child { margin: 0; color: var(--muted); font-size: 13.5px; }
.t1-data-note { margin-top: 10px; padding: 9px 12px; color: var(--warn); border-left: 2px solid var(--warn); background: color-mix(in srgb, var(--warn) 7%, transparent); font-size: 12.5px; }
.t1-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 18px 0 24px; }
.t1-stat { min-width: 0; padding: 15px 17px; border: 1px solid var(--border); border-radius: var(--r-panel); background: var(--panel); }
.t1-stat strong { display: block; color: var(--accent); font: 720 24px/1.2 var(--mono); font-variant-numeric: tabular-nums; }
.t1-stat.low strong { color: var(--warn); }
.t1-stat span { display: block; margin-top: 5px; color: var(--dim); font: 10px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.t1-overall-progress { grid-column: 1 / -1; height: 5px; overflow: hidden; background: var(--border); border-radius: 999px; }
.t1-overall-progress span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .18s ease; }
.t1-local-counts { grid-column: 1 / -1; margin: -5px 0 0; color: var(--dim); font: 11px/1.4 var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.t1-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 19px 20px; border: 1px solid var(--border); border-radius: var(--r-panel); background: var(--panel); }
.t1-controls-head { grid-column: 1 / -1; display: flex; align-items: end; justify-content: space-between; gap: 18px; padding-bottom: 4px; }
.t1-controls-head h2 { margin: 3px 0 0; font-size: 20px; line-height: 1.35; }
.t1-controls-head > p { margin: 0; color: var(--dim); font: 11px/1.4 var(--mono); }
.t1-control { min-width: 0; }
.t1-control > span { display: block; margin-bottom: 5px; color: var(--dim); font: 600 10px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.t1-control select { width: 100%; }
.t1-control-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 9px; padding-top: 2px; }
.t1-filter-note { grid-column: 1 / -1; margin: -2px 0 0; color: var(--dim); font-size: 12px; }
.t1-stage { margin-top: 18px; }
.t1-ready { min-height: 180px; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 18px; padding: 26px; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: var(--r-panel); }
.t1-ready > span { color: var(--border-strong); font: 700 30px/1 var(--mono); }
.t1-ready h2 { margin: 0 0 5px; color: var(--text); font-size: 19px; }
.t1-ready p { max-width: 620px; margin: 0; font-size: 13.5px; }
.t1-empty-state { min-height: 320px; display: grid; place-content: center; justify-items: center; padding: 44px 22px; text-align: center; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: var(--r-panel); background: var(--panel); }
.t1-empty-mark { color: var(--border-strong); font: 700 32px/1 var(--mono); }
.t1-empty-state h2 { margin: 14px 0 5px; color: var(--text); font-size: 20px; }
.t1-empty-state p { max-width: 600px; margin: 0 0 18px; font-size: 13.5px; }
.t1-empty-state code { color: var(--accent); overflow-wrap: anywhere; }
.t1-session { max-width: 860px; margin: 0 auto; }
.t1-session-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.t1-session-head strong { font: 650 13px/1.3 var(--mono); font-variant-numeric: tabular-nums; }
.t1-session-head .back-link { margin: 0; }
.t1-session-progress { height: 6px; margin-bottom: 12px; overflow: hidden; background: var(--border); border-radius: 999px; }
.t1-session-progress span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .18s ease; }
.t1-flashcard { min-height: 360px; display: flex; flex-direction: column; justify-content: center; padding: 28px 30px; border: 1px solid var(--border-strong); border-radius: var(--r-panel); background: var(--bg2); }
.t1-card-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.t1-card-meta span { padding: 3px 8px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; font: 10px/1.35 var(--mono); }
.t1-topic { margin: 0 0 12px; color: var(--accent); font: 600 10px/1.5 var(--mono); letter-spacing: .06em; overflow-wrap: anywhere; }
.t1-flashcard h2 { max-width: 760px; margin: 0; font-size: clamp(20px, 3vw, 26px); line-height: 1.6; overflow-wrap: anywhere; }
.t1-recall-cue { margin: 24px 0 0; color: var(--dim); font-size: 13px; }
.t1-answer { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.t1-answer > p:not(.kicker) { margin: 5px 0 0; color: var(--text); font-size: 18px; line-height: 1.75; overflow-wrap: anywhere; }
.t1-extra-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 18px; }
.t1-extra { min-width: 0; padding: 11px 12px; color: var(--muted); border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--panel); font-size: 12.5px; }
.t1-extra strong { color: var(--warn); font: 650 10px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.t1-extra p { margin: 5px 0 0; overflow-wrap: anywhere; }
.t1-session-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 16px; }
.t1-session-actions .btn { min-width: 130px; }
.t1-shortcuts, .t1-no-anki { margin: 10px 0 0; color: var(--dim); font-size: 11.5px; text-align: center; }
.t1-shortcuts kbd { padding: 1px 5px; color: var(--muted); background: var(--panel); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; font-family: var(--mono); }
.t1-no-anki { margin-top: 6px; font-family: var(--mono); overflow-wrap: anywhere; }
.t1-summary { min-height: 320px; display: grid; place-content: center; justify-items: center; padding: 34px 22px; text-align: center; border: 1px solid var(--border); border-radius: var(--r-panel); background: var(--panel); }
.t1-summary h2 { margin: 4px 0 18px; font-size: 24px; }
.t1-summary > p:not(.kicker) { max-width: 600px; margin: 14px 0 0; color: var(--muted); font-size: 13.5px; }
.t1-summary-score { display: flex; gap: 34px; }
.t1-summary-score span { color: var(--dim); font: 11px/1.3 var(--mono); text-transform: uppercase; }
.t1-summary-score strong { display: block; margin-bottom: 4px; color: var(--accent); font-size: 34px; font-variant-numeric: tabular-nums; }

.section { margin: 52px 0; }
.today-section { margin-top: 28px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.section h2, .section-head h2 { margin: 3px 0 0; font-size: 24px; line-height: 1.3; }
.input { min-height: 40px; padding: 8px 12px; color: var(--text); background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-ctl); }
.input:hover { border-color: var(--border-strong); }
.input:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.search { width: min(300px, 100%); }
.daily-tools, .curriculum-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; }
.daily-budget { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.daily-budget .input { min-width: 96px; }
.mobile-only { display: none; }
.btn { min-height: 40px; padding: 8px 14px; color: var(--text); background: var(--panel2); border: 1px solid var(--border-strong); border-radius: var(--r-ctl); cursor: pointer; font-size: 13.5px; }
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); font-weight: 680; }
.btn.primary:hover { background: var(--accent-press); }
.btn.danger { color: var(--bad); background: none; border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); border-color: var(--bad); }
.btn.full { width: 100%; }
.btn[disabled], button[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

.day-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.day-cell { min-height: 76px; padding: 10px 12px; color: var(--text); border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--panel); cursor: pointer; text-align: left; }
.day-cell:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.day-cell:focus-visible { outline: none; box-shadow: var(--focus); }
.day-cell.today { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.day-cell.done { border-color: color-mix(in srgb, var(--good) 45%, var(--border)); }
.day-cell .d { display: block; color: var(--dim); font: 10px/1.2 var(--mono); letter-spacing: .08em; }
.day-cell .t { display: block; margin-top: 5px; font-size: 12px; line-height: 1.4; }
.one-thing { margin-bottom: 14px; padding: 20px 22px; border: 1px solid var(--accent); border-radius: var(--r-panel); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, transparent), color-mix(in srgb, var(--accent) 3%, transparent)); }
.one-thing h3 { margin: 5px 0 6px; font-size: 20px; }
.one-thing > p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.mission-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 18px; }
.mission-reason { display: inline-flex; padding: 3px 9px; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 999px; font: 650 10px/1.4 var(--mono); letter-spacing: .08em; }
.countdown { min-width: 74px; padding-left: 16px; border-left: 1px solid var(--border-strong); text-align: right; }
.countdown strong { display: block; color: var(--accent); font: 720 30px/1 var(--mono); font-variant-numeric: tabular-nums; }
.countdown span { color: var(--dim); font-size: 11px; }
.mission-metrics { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.mission-metrics span { padding: 6px 9px; color: var(--muted); background: var(--bg2); border: 1px solid var(--border); border-radius: 999px; font-size: 11.5px; }
.mission-metrics strong { color: var(--text); font-variant-numeric: tabular-nums; }
.capacity-plan { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0 15px; }
.capacity-plan p { min-width: 0; margin: 0; padding: 9px 10px; color: var(--muted); background: color-mix(in srgb, var(--panel) 72%, transparent); border: 1px solid var(--border); border-radius: var(--r-ctl); font-size: 12px; overflow-wrap: anywhere; }
.capacity-plan strong { display: block; margin-bottom: 3px; color: var(--text); }
.mission-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.mission-wait { color: var(--warn) !important; }
.quick-done { display: flex; align-items: flex-start; gap: 9px; margin-top: 12px; color: var(--muted); font-size: 12.5px; }
.quick-done input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--good); }

.filter-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.filter-chip { min-height: 34px; padding: 6px 11px; color: var(--muted); background: none; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: 12px; }
.filter-chip:hover { color: var(--text); border-color: var(--border-strong); }
.filter-chip.on { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.module-card { min-height: 186px; padding: 18px; display: flex; flex-direction: column; text-align: left; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-panel); cursor: pointer; transition: border-color .18s ease, transform .18s ease; }
.module-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.module-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--dim); font: 10px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.module-card h3 { margin: 12px 0 8px; font-size: 17px; line-height: 1.45; }
.module-card p { margin: 0 0 14px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.module-footer { margin-top: auto; display: flex; align-items: center; gap: 9px; }
.progress-track { flex: 1; height: 5px; overflow: hidden; background: var(--border); border-radius: 999px; }
.progress-fill { height: 100%; background: var(--accent); border-radius: inherit; }
.module-status { color: var(--dim); font: 10px/1 var(--mono); white-space: nowrap; }
.module-card.stable { border-color: color-mix(in srgb, var(--good) 40%, var(--border)); }
.module-card.learning { border-color: color-mix(in srgb, var(--warn) 38%, var(--border)); }
.empty { padding: 48px 20px; text-align: center; color: var(--dim); }
.empty span { display: block; color: var(--border-strong); font: 28px/1 var(--mono); }
.empty p { margin: 10px 0 16px; }

.module-view { width: 100%; max-width: 960px; min-width: 0; margin: 0 auto; overflow-wrap: anywhere; }
.module-head { margin-bottom: 20px; }
.back-link { margin: 0 0 12px; padding: 0; color: var(--muted); background: none; border: 0; cursor: pointer; font-size: 13px; }
.back-link:hover { color: var(--accent); }
.module-head-row { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.module-head h1 { margin: 6px 0 8px; font-size: clamp(28px, 4vw, 40px); line-height: 1.25; }
.module-objective { max-width: 760px; margin: 0; color: var(--muted); }
.module-badges { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.badge { padding: 3px 9px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; font: 10px/1.4 var(--mono); }
.badge.anki { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.phase-nav { position: sticky; top: 70px; z-index: 12; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 18px 0 26px; padding: 8px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-panel); }
.phase-btn { min-height: 42px; padding: 7px 9px; color: var(--muted); background: none; border: 1px solid transparent; border-radius: var(--r-ctl); cursor: pointer; font-size: 12px; }
.phase-btn:hover { color: var(--text); background: var(--panel); }
.phase-btn.on { color: var(--accent); background: var(--panel2); border-color: var(--border-strong); }
.phase-btn.done::after { content: " ✓"; color: var(--good); }
.phase-panel[hidden] { display: none; }
.phase-panel { animation: rise .22s ease both; }

.map-box { width: 100%; max-width: 100%; min-width: 0; margin: 0 0 22px; padding: 18px 20px; overflow-x: auto; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--r-panel); background: var(--bg2); }
.map-flow { display: flex; align-items: center; gap: 9px; min-width: max-content; }
.map-node { max-width: 190px; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--r-ctl); background: var(--panel); font-size: 13px; text-align: center; }
.map-arrow { color: var(--accent); font-family: var(--mono); }
.digest-brief { min-width: 0; margin: 0 0 24px; padding: 22px; overflow-wrap: anywhere; border: 1px solid var(--border-strong); border-top: 3px solid var(--accent); border-radius: var(--r-panel); background: var(--panel); }
.digest-brief * { min-width: 0; }
.digest-fallback { margin: 0 0 24px; padding: 16px 18px; color: var(--muted); background: color-mix(in srgb, var(--warn) 7%, var(--panel)); border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--border)); border-left: 3px solid var(--warn); border-radius: var(--r-panel); }
.digest-fallback strong { color: var(--text); }
.digest-fallback p:last-child { margin: 5px 0 0; font-size: 13px; }
.digest-head { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.digest-head h2 { max-width: 760px; margin: 5px 0 0; font-size: clamp(20px, 3vw, 26px); line-height: 1.45; }
.digest-count { flex: none; padding: 5px 9px; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent); border-radius: 999px; font: 600 10px/1.3 var(--mono); }
.digest-one { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 16px; align-items: start; margin: 20px 0 14px; padding: 16px; background: color-mix(in srgb, var(--accent) 9%, var(--bg2)); border-left: 3px solid var(--accent); border-radius: var(--r-ctl); }
.digest-one span, .digest-check span { color: var(--accent); font: 700 10px/1.5 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.digest-one strong { font-size: 16px; line-height: 1.7; }
.digest-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.digest-panel { min-width: 0; padding: 16px 17px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-panel); }
.digest-panel.must { border-left: 3px solid var(--good); }
.digest-panel.traps { border-left: 3px solid var(--warn); }
.digest-panel h3 { margin: 0 0 10px; font-size: 14px; }
.digest-panel ol, .digest-panel ul { display: grid; gap: 8px; margin: 0; padding-left: 21px; }
.digest-panel li { padding-left: 3px; color: var(--muted); font-size: 13.5px; line-height: 1.65; }
.digest-panel.must li::marker { color: var(--good); font-family: var(--mono); font-weight: 700; }
.digest-panel.traps li::marker { color: var(--warn); }
.digest-more { margin: 12px 0 0; background: var(--bg2); }
.digest-more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 0 15px 14px; }
.digest-more-grid h3 { margin: 0 0 7px; font-size: 13px; }
.digest-more-grid ul { display: grid; gap: 7px; margin: 0; padding-left: 20px; }
.digest-more-grid li { color: var(--muted); font-size: 13px; line-height: 1.6; }
.digest-check { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 16px; margin-top: 12px; padding: 13px 16px; background: color-mix(in srgb, var(--good) 7%, var(--bg2)); border: 1px solid color-mix(in srgb, var(--good) 30%, var(--border)); border-radius: var(--r-ctl); }
.digest-check span { color: var(--good); }
.digest-check strong { font-size: 13.5px; line-height: 1.65; }
.node-roadmap { margin-top: 14px; background: var(--bg2); }
.node-roadmap nav { padding: 0 12px 12px; }
.node-roadmap nav > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.node-route { min-width: 0; min-height: 54px; padding: 9px 11px; color: var(--text); background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-ctl); cursor: pointer; text-align: left; font-size: 12.5px; line-height: 1.45; overflow-wrap: anywhere; }
.node-route:hover { border-color: var(--accent); background: var(--panel2); }
.node-route span { display: block; margin-bottom: 3px; color: var(--accent); font: 600 9.5px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.reading-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 14px; padding: 14px 16px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-ctl); }
.reading-toolbar strong { display: block; max-width: 56ch; font-size: 12.5px; line-height: 1.55; }
.reading-mode-status { display: block; margin-top: 4px; color: var(--accent); font: 600 10px/1.4 var(--mono); }
.reading-mode-switch { flex: 0 1 270px; }
.teach-list { min-width: 0; display: grid; gap: 12px; }
.teach-card, .worked-card, .lab-card, .recall-card, .quiz-card, .anki-panel { min-width: 0; padding: 20px 22px; border: 1px solid var(--border); border-radius: var(--r-panel); background: var(--panel); }
.digest-node { scroll-margin-top: 142px; }
.digest-node.is-expanded { border-color: var(--border-strong); }
.node-head .kicker { display: flex; align-items: center; gap: 8px; }
.node-tag { padding: 2px 7px; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 999px; letter-spacing: .08em; }
.node-head h2:focus { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 3px; }
.node-core { margin: 13px 0 11px; padding: 15px 16px 13px; background: color-mix(in srgb, var(--accent) 7%, var(--bg2)); border-left: 3px solid var(--accent); border-radius: var(--r-ctl); }
.node-core-label { margin: 0 0 5px !important; color: var(--accent) !important; font: 700 9.5px/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.node-core-text { min-width: 0; margin: 0 !important; overflow-wrap: anywhere; color: var(--text) !important; font-size: 16px; font-weight: 680; line-height: 1.7; }
.digest-node[data-digest-tag="陷阱"] .node-core { border-left-color: var(--warn); }
.digest-node[data-digest-tag="陷阱"] .node-core-label, .digest-node[data-digest-tag="陷阱"] .node-tag { color: var(--warn); }
.digest-node[data-digest-tag="影像"] .node-core, .digest-node[data-digest-tag="計算"] .node-core { border-left-color: var(--good); }
.digest-node[data-digest-tag="影像"] .node-core-label, .digest-node[data-digest-tag="影像"] .node-tag, .digest-node[data-digest-tag="計算"] .node-core-label, .digest-node[data-digest-tag="計算"] .node-tag { color: var(--good); }
.node-cue { min-width: 0; display: flex; gap: 10px; margin: 10px 0 0 !important; padding-top: 10px; overflow-wrap: anywhere; color: var(--muted) !important; border-top: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border)); font-size: 12.5px; line-height: 1.6; }
.node-cue span { flex: none; color: var(--good); font: 700 9.5px/1.6 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.node-detail-toggle { width: 100%; min-height: 42px; padding: 8px 11px; color: var(--muted); background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-ctl); cursor: pointer; text-align: left; font-size: 12px; }
.node-detail-toggle::before { content: "＋"; margin-right: 7px; color: var(--accent); font-family: var(--mono); }
.node-detail-toggle[aria-expanded="true"]::before { content: "−"; }
.node-detail-toggle[aria-expanded="true"] { width: auto; min-height: 32px; display: block; margin-left: auto; padding: 5px 9px; color: var(--dim); background: transparent; font-size: 11px; }
.node-detail-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.node-content { min-width: 0; padding-top: 9px; overflow-wrap: anywhere; }
.node-content[hidden] { display: none; }
.node-content > p { max-width: 76ch; }
.key-term-rail { display: grid; grid-template-columns: 94px minmax(0, 1fr); gap: 12px; align-items: start; margin: 12px 0 16px; padding: 12px 14px; background: color-mix(in srgb, var(--accent) 5%, var(--bg2)); border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border)); border-radius: var(--r-ctl); }
.key-term-label { padding-top: 5px; color: var(--accent); font: 700 9.5px/1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.key-term-rail ul { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; }
.key-term-rail li { margin: 0; padding: 5px 9px; color: var(--text); background: color-mix(in srgb, var(--accent) 11%, var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); border-radius: 999px; font-size: 12.5px; font-weight: 650; line-height: 1.45; }
.node-content .teach-lead { margin: 16px 0 8px; color: var(--text); font-weight: 680; line-height: 1.65; }
.node-content .concept-list, .node-content .concept-steps { display: grid; gap: 8px; margin: 8px 0 18px; padding: 0; list-style: none; }
.node-content .concept-list > li, .node-content .concept-steps > li { position: relative; min-width: 0; margin: 0; padding: 10px 12px 10px 15px; color: var(--muted); background: var(--bg2); border: 1px solid var(--border); border-left: 3px solid var(--border-strong); border-radius: var(--r-ctl); line-height: 1.72; }
.node-content .concept-list > li strong { color: var(--accent); }
.node-content .concept-steps { counter-reset: concept-step; }
.node-content .concept-steps > li { counter-increment: concept-step; padding-left: 46px; border-left-color: var(--accent); }
.node-content .concept-steps > li::before { content: counter(concept-step); position: absolute; top: 10px; left: 12px; width: 23px; height: 23px; display: grid; place-items: center; color: var(--on-accent); background: var(--accent); border-radius: 999px; font: 750 10px/1 var(--mono); }
.node-content .concept-steps > li strong { color: var(--text); }
.node-content .body-lead { padding: 12px 14px; color: var(--text); background: var(--bg2); border-radius: var(--r-ctl); font-weight: 560; }
.node-content .body-caution, .node-content .body-reasoning { position: relative; margin-top: 14px; padding: 28px 14px 12px; border-radius: var(--r-ctl); }
.node-content .body-caution { background: color-mix(in srgb, var(--warn) 8%, var(--bg2)); border-left: 3px solid var(--warn); }
.node-content .body-reasoning { background: color-mix(in srgb, var(--good) 7%, var(--bg2)); border-left: 3px solid var(--good); }
.node-content .body-caution::before, .node-content .body-reasoning::before { position: absolute; top: 8px; left: 14px; font: 700 9px/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.node-content .body-caution::before { content: "易混邊界"; color: var(--warn); }
.node-content .body-reasoning::before { content: "推導結果"; color: var(--good); }
.node-content :is(p, li) > strong { color: var(--text); text-decoration-line: underline; text-decoration-color: color-mix(in srgb, var(--accent) 58%, transparent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.node-content .body-caution > strong { color: var(--warn); text-decoration-color: color-mix(in srgb, var(--warn) 58%, transparent); }
.node-content .body-reasoning > strong { color: var(--good); text-decoration-color: color-mix(in srgb, var(--good) 58%, transparent); }
.teach-card h2, .worked-card h2, .lab-card h2, .recall-card h2, .quiz-card h2, .anki-panel h2 { margin: 0 0 10px; font-size: 18px; }
.teach-card h3 { margin: 20px 0 8px; font-size: 16px; }
.teach-card p, .teach-card li, .worked-card p, .worked-card li { color: var(--muted); }
.teach-card p, .worked-card p { margin: 10px 0; }
.teach-card ul, .teach-card ol, .worked-card ol { padding-left: 22px; }
.lesson-figure { width: 100%; max-width: 100%; min-width: 0; margin: 20px 0 8px; overflow-x: auto; overscroll-behavior-inline: contain; break-inside: avoid; background: var(--image-bg); border: 1px solid var(--border); border-radius: var(--r-ctl); }
.lesson-figure img { display: block; width: 100%; height: auto; object-fit: contain; background: var(--image-bg); border: 0; border-radius: calc(var(--r-ctl) - 1px); }
.lesson-figure img[src*="/anatomy/"],
.lesson-figure img[src*="/visuals/m01-"],
.lesson-figure img[src*="/visuals/m02-"],
.lesson-figure img[src*="/visuals/m03-"],
.lesson-figure img[src*="/visuals/m04-"],
.lesson-figure img[src*="/visuals/m09-"],
.lesson-figure img[src*="/visuals/m10-"],
.lesson-figure img[src*="/visuals/m11-"],
.lesson-figure img[src*="/visuals/m12-"],
.lesson-figure img[src*="/visuals/m13-"] { background: #fff; filter: invert(1) hue-rotate(180deg); }
.lesson-figure figcaption { margin-top: 8px; padding-left: 10px; color: var(--dim); border-left: 2px solid var(--border-strong); font-size: 12.5px; line-height: 1.65; }
.real-atlas { margin: 0 0 24px; padding: 20px; border: 1px solid var(--border); border-left: 3px solid var(--good); border-radius: var(--r-panel); background: var(--bg2); }
.node-real-atlas { margin: 12px 0; padding: 14px; background: color-mix(in srgb, var(--good) 4%, var(--bg2)); }
.node-real-atlas .real-atlas-head { align-items: start; }
.node-real-atlas .real-atlas-head { margin-bottom: 12px; }
.node-real-atlas .real-atlas-head h2 { font-size: 16px; }
.node-real-atlas .real-atlas-head > p { font-size: 12px; }
.real-atlas-head { display: flex; align-items: end; justify-content: space-between; gap: 22px; margin-bottom: 16px; }
.real-atlas-head h2 { margin: 5px 0 0; font-size: 20px; }
.real-atlas-head > p { max-width: 48ch; margin: 0; color: var(--muted); font-size: 13px; }
.real-image-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.real-image-grid.single { grid-template-columns: minmax(0, 760px); }
.real-image-card { min-width: 0; display: grid; grid-template-columns: minmax(180px, 42%) minmax(0, 1fr); overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-panel); background: var(--panel); }
.real-image-open { position: relative; align-self: start; width: 100%; display: block; padding: 0; color: inherit; background: var(--image-bg); border: 0; cursor: zoom-in; text-align: left; }
.real-image-frame { position: relative; height: 230px; min-height: 190px; min-width: 0; display: grid; place-items: center; overflow: hidden; background: var(--image-bg); }
.real-image-frame img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; max-width: 100%; max-height: 100%; object-fit: contain; }
.real-image-open.is-concealed img { filter: blur(24px) saturate(.45); }
.sensitive-image-cover { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; gap: 5px; padding: 18px; color: var(--text); background: color-mix(in srgb, var(--bg) 72%, transparent); text-align: center; }
.sensitive-image-cover strong { font-size: 13px; }
.sensitive-image-cover span { color: var(--muted); font-size: 11.5px; }
.real-image-open:not(.is-concealed) .sensitive-image-cover { display: none; }
.real-image-missing { max-width: 28ch; padding: 28px; color: var(--muted); font-size: 13px; text-align: center; }
.real-image-missing[hidden] { display: none; }
.real-image-open.is-broken { cursor: default; }
.real-image-zoom { position: absolute; right: 10px; bottom: 10px; padding: 5px 8px; color: #fff; background: rgba(11, 14, 20, .82); border: 1px solid rgba(255, 255, 255, .25); border-radius: 6px; font: 600 10px/1.3 var(--mono); }
.real-image-body { min-width: 0; padding: 13px 14px 14px; }
.real-image-body h3 { margin: 3px 0 7px; font-size: 15px; line-height: 1.45; }
.real-image-prompt { min-height: 0; margin: 0 0 9px; color: var(--muted); font-size: 12.5px; line-height: 1.58; }
.real-image-prompt strong, .real-image-answer strong { color: var(--text); }
.real-image-body details { margin: 0; background: var(--bg2); }
.real-image-answer p { margin: 7px 0; line-height: 1.65; }
.real-image-credit { padding-top: 9px; border-top: 1px solid var(--border); color: var(--dim); font-size: 11.5px; overflow-wrap: anywhere; }
.reading-focus .node-real-atlas { margin: 8px 0; padding: 8px; border-left-width: 2px; }
.reading-focus .node-real-atlas .real-atlas-head { display: none; }
.reading-focus .real-image-grid, .reading-focus .real-image-grid.single { grid-template-columns: 1fr; gap: 7px; }
.reading-focus .real-image-card { grid-template-columns: 104px minmax(0, 1fr); min-height: 92px; border-radius: var(--r-ctl); }
.reading-focus .real-image-frame { height: 100%; min-height: 92px; }
.reading-focus .real-image-body { display: grid; align-content: center; padding: 8px 10px; }
.reading-focus .real-image-body .kicker { margin-bottom: 3px; }
.reading-focus .real-image-body h3 { margin: 0; font-size: 13px; }
.reading-focus .real-image-prompt, .reading-focus .real-image-body details { display: none; }
.reading-focus .real-image-zoom { right: 5px; bottom: 5px; padding: 3px 5px; font-size: 8px; }
.teach-table-wrap { width: 100%; max-width: 100%; margin: 16px 0 18px; overflow-x: auto; overscroll-behavior-inline: contain; border: 1px solid var(--border-strong); border-radius: var(--r-panel); background: var(--bg2); scrollbar-color: var(--border-strong) var(--bg2); }
.teach-table-scroll-hint { display: none; }
.teach-table-wrap:focus-visible { outline: none; box-shadow: var(--focus); }
.teach-table-wrap table, .teach-card table { width: 100%; min-width: 540px; margin: 0; border-collapse: collapse; font-size: 13px; }
.teach-card th, .teach-card td { padding: 9px 10px; border: 1px solid var(--border); overflow-wrap: anywhere; text-align: left; vertical-align: top; }
.teach-card th { color: var(--text); background: var(--panel2); font: 650 10px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.teach-table-wrap thead th { position: sticky; top: 0; z-index: 2; }
.teach-card td { color: var(--muted); }
.teach-card tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--panel2) 34%, transparent); }
.teach-card tbody tr:hover td { background: color-mix(in srgb, var(--accent) 7%, var(--bg2)); }
.teach-card td:first-child { color: var(--text); font-weight: 650; }
.teach-card tbody tr:nth-child(n) td.trend-up-cell { background: color-mix(in srgb, var(--trend-up) 8%, var(--bg2)); }
.teach-card tbody tr:nth-child(n) td.trend-down-cell { background: color-mix(in srgb, var(--trend-down) 8%, var(--bg2)); }
.teach-card tbody tr:nth-child(n) td.trend-flat-cell { background: color-mix(in srgb, var(--trend-flat) 7%, var(--bg2)); }
.trend-arrow, .trend-flat-term { display: inline-flex; align-items: center; justify-content: center; min-width: 1em; font-weight: 800; }
.trend-up { color: var(--trend-up); }
.trend-down { color: var(--trend-down); }
.trend-flat { color: var(--trend-flat); }
.trend-legend { display: flex; flex-wrap: wrap; gap: 7px 12px; margin-top: 7px; color: var(--dim); font: 600 10px/1.4 var(--mono); }
.trend-legend > span { white-space: nowrap; }
.trend-legend-note { flex-basis: 100%; font-weight: 500; }
pre.flow { padding: 13px 16px; overflow-x: auto; color: var(--muted); background: var(--bg2); border-left: 2px solid var(--accent); border-radius: var(--r-ctl); white-space: pre-wrap; font-size: 12px; line-height: 1.7; }
.worked-section { min-width: 0; margin-top: 26px; overflow-wrap: anywhere; }
.worked-section > header { margin-bottom: 12px; }
.worked-section > header h2 { margin: 5px 0 3px; font-size: 21px; }
.worked-section > header > p:not(.kicker) { margin: 0; color: var(--muted); font-size: 13px; }
.worked-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 0; }
.worked-stem { padding: 11px 12px; background: var(--bg2); border-left: 2px solid var(--accent); border-radius: var(--r-ctl); }
.worked-stem span, .worked-card .takeaway span { display: block; margin-bottom: 4px; color: var(--accent); font: 700 9px/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.reasoning-chain { display: grid; gap: 7px; margin: 14px 0 0; }
.reasoning-chain li { padding-left: 4px; line-height: 1.65; }
.reasoning-chain li::marker { color: var(--accent); font-family: var(--mono); font-weight: 700; }
.worked-content { min-width: 0; overflow-wrap: anywhere; }
.worked-content[hidden] { display: none; }
.worked-toggle { margin-top: 10px; }
.worked-card .takeaway { min-width: 0; margin-top: 14px; padding: 12px; overflow-wrap: anywhere; color: var(--text); background: color-mix(in srgb, var(--good) 7%, var(--bg2)); border-left: 2px solid var(--good); border-radius: var(--r-ctl); font-weight: 600; }
.worked-card .takeaway span { color: var(--good); }
.phase-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.inline-state { color: var(--dim); font-size: 12px; }
.inline-state.good { color: var(--good); }
.inline-state.bad { color: var(--bad); }

.sort-list { display: grid; gap: 8px; margin: 16px 0; }
.sort-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; min-height: 48px; padding: 9px 10px; color: var(--text); background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-ctl); cursor: grab; }
.sort-item.dragging { opacity: .45; border-color: var(--accent); }
.sort-handle { color: var(--dim); font-family: var(--mono); }
.sort-controls { display: flex; gap: 5px; }
.sort-controls button { width: 34px; height: 34px; color: var(--muted); background: var(--panel2); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.match-grid { display: grid; gap: 10px; margin: 16px 0; }
.match-row { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(180px, 1fr); align-items: center; gap: 12px; }
.match-left { color: var(--text); font-size: 13.5px; }
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0; }
.calc-field label { display: block; margin-bottom: 4px; color: var(--dim); font: 10px/1.4 var(--mono); }
.calc-output { margin-top: 14px; padding: 12px; background: var(--bg2); border-radius: var(--r-ctl); color: var(--muted); }

.image-lab-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.image-question { min-width: 0; padding: 14px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-panel); }
.image-question.is-correct { border-color: color-mix(in srgb, var(--good) 65%, var(--border)); }
.image-question.is-wrong { border-color: color-mix(in srgb, var(--bad) 65%, var(--border)); }
.histo-frame { min-height: 250px; display: grid; place-items: center; overflow: hidden; background: var(--image-bg); border: 1px solid var(--border-strong); border-radius: var(--r-ctl); }
.histo-frame img { display: block; width: 100%; height: 330px; object-fit: contain; }
.image-fallback { width: 100%; min-height: 250px; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 24px; color: var(--on-accent); text-align: center; }
.image-fallback[hidden] { display: none; }
.image-fallback span { max-width: 30ch; font-size: 13px; }
.image-fallback .btn { color: var(--on-accent); background: transparent; border-color: color-mix(in srgb, var(--on-accent) 45%, transparent); }
.image-number { margin: 12px 0 4px; color: var(--accent); font: 700 10px/1.4 var(--mono); letter-spacing: .12em; }
.image-question h3 { min-height: 3.2em; margin: 0 0 10px; font-size: 15px; line-height: 1.6; }
.image-options { display: grid; gap: 7px; }
.image-options .question-option { width: 100%; }
.image-options .question-option:disabled { cursor: default; opacity: 1; }
.image-feedback { margin-top: 12px; padding: 11px 12px; color: var(--muted); background: var(--panel); border-left: 2px solid var(--accent); border-radius: 5px; font-size: 13px; }
.image-feedback strong { color: var(--text); }
.image-feedback p { margin: 5px 0 7px; }
.image-feedback small { display: block; color: var(--dim); line-height: 1.55; }

.model3d-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 14px; margin-top: 18px; }
.model3d-view { min-width: 0; }
.model3d-toolbar { display: flex; justify-content: flex-end; gap: 7px; margin-bottom: 7px; }
.model3d-toolbar .icon-btn { min-width: 42px; flex: 0 0 auto; }
.model3d-stage { position: relative; width: 100%; height: 470px; overflow: hidden; background: var(--bg2); border: 1px solid var(--border-strong); border-radius: var(--r-panel); }
.model3d-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.model3d-stage canvas:active { cursor: grabbing; }
.model3d-stage canvas[hidden] { display: none; }
.model3d-orientation span { position: absolute; z-index: 2; color: var(--dim); font: 700 10px/1 var(--mono); pointer-events: none; }
.model3d-orientation span:nth-child(1) { top: 12px; left: 50%; transform: translateX(-50%); }
.model3d-orientation span:nth-child(2) { bottom: 12px; left: 50%; transform: translateX(-50%); }
.model3d-orientation span:nth-child(3) { top: 50%; left: 12px; transform: translateY(-50%); }
.model3d-orientation span:nth-child(4) { top: 50%; right: 12px; transform: translateY(-50%); }
.model3d-loading, .model3d-fallback { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 7px; padding: 28px; color: var(--muted); text-align: center; font-size: 13px; }
.model3d-loading[hidden], .model3d-fallback[hidden] { display: none; }
.model3d-fallback strong { color: var(--warn); font-size: 17px; }
.model3d-fallback span { max-width: 42ch; }
.model3d-hint { margin: 7px 0 0; color: var(--dim); font: 11px/1.5 var(--mono); text-align: center; }
.model3d-side { min-width: 0; display: grid; align-content: start; gap: 10px; }
.model3d-layers { min-width: 0; margin: 0; padding: 12px 13px; border: 1px solid var(--border); border-radius: var(--r-ctl); }
.model3d-layers legend { padding: 0 5px; color: var(--dim); font: 600 10px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.model3d-layers label { min-height: 34px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.model3d-layers input { width: 17px; height: 17px; accent-color: var(--accent); }
.model3d-object-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.model3d-object { min-width: 0; min-height: 38px; padding: 7px 8px; color: var(--muted); background: var(--panel2); border: 1px solid var(--border); border-radius: var(--r-ctl); cursor: pointer; font-size: 11.5px; line-height: 1.35; text-align: left; overflow-wrap: anywhere; }
.model3d-object:hover { color: var(--text); border-color: var(--border-strong); }
.model3d-object[aria-pressed="true"] { color: var(--text); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--panel2)); }
.model3d-detail { margin-top: 12px; padding: 10px 12px; color: var(--muted); background: var(--bg2); border-left: 2px solid var(--accent); border-radius: 5px; font-size: 12.5px; }
.model3d-challenge { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; margin-top: 14px; padding: 15px 16px; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--bg2); }
.model3d-challenge h3 { margin: 4px 0 0; font-size: 15px; line-height: 1.6; }
.model3d-challenge-actions { display: flex; align-items: center; gap: 9px; }
.model3d-feedback { grid-column: 1 / -1; margin: 2px 0 0; color: var(--dim); font-size: 12.5px; }
.model3d-feedback.good { color: var(--good); }
.model3d-feedback.bad { color: var(--bad); }

/* Shared shell for the registered 2D simulators. All geometry and colour stay
   in the course tokens so the packs can focus on mechanisms rather than UI. */
.simulation-lab, .simulation-lab [data-simulation-host], .sim-shell { min-width: 0; }
.sim-shell { display: grid; gap: 16px; }
.sim-note, .sim-intro { max-width: 78ch; margin: 0; color: var(--muted); font-size: 13.5px; }
.sim-layout { min-width: 0; display: grid; grid-template-columns: minmax(250px, .85fr) minmax(0, 1.35fr); align-items: start; gap: 12px; }
.sim-view, .sim-canvas-host { min-width: 0; }
.sim-view { display: grid; align-content: start; gap: 10px; }
.sim-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 10px; }
.sim-section-head { grid-column: 1 / -1; min-width: 0; }
.sim-section-head h3 { margin: 3px 0 1px; color: var(--text); font-size: 15px; }
.control { min-width: 0; display: grid; align-content: start; gap: 9px; padding: 12px 13px; color: var(--muted); background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-ctl); }
.clabel { min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 5px 12px; color: var(--muted); font: 600 10px/1.45 var(--mono); letter-spacing: .04em; }
.clabel > span:first-child { overflow-wrap: anywhere; }
.cval { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.control input[type="range"] { width: 100%; min-height: 28px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.control select, .sim-challenge-actions select { width: 100%; min-width: 0; min-height: 40px; padding: 7px 9px; color: var(--text); background: var(--panel2); border: 1px solid var(--border-strong); border-radius: var(--r-ctl); cursor: pointer; font-size: 12px; text-overflow: ellipsis; }
.control input[type="range"]:focus-visible, .control select:focus-visible, .seg button:focus-visible, .sim-challenge-actions select:focus-visible { outline: none; box-shadow: var(--focus); }
.seg { min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.seg-control > .seg { margin-top: 1px; }
.seg button { min-width: 0; min-height: 38px; flex: 1 1 110px; padding: 7px 9px; color: var(--muted); background: var(--panel2); border: 1px solid var(--border); border-radius: var(--r-ctl); cursor: pointer; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.seg button:hover { color: var(--text); border-color: var(--border-strong); }
.seg button.on, .seg button[aria-pressed="true"] { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.readout { min-width: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: 8px; }
.metric { min-width: 0; padding: 11px 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-ctl); }
.metric .k { display: block; min-height: 2.8em; color: var(--dim); font: 600 10px/1.4 var(--mono); letter-spacing: .04em; overflow-wrap: anywhere; }
.metric .v { min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 6px; margin-top: 5px; color: var(--text); }
.metric .num { min-width: 0; color: var(--accent); font: 700 20px/1.25 var(--mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric.good .num { color: var(--good); }
.metric.warn .num { color: var(--warn); }
.metric.bad .num { color: var(--bad); }
.metric .u { color: var(--dim); font: 10px/1.3 var(--mono); overflow-wrap: anywhere; }
.lab-canvas-wrap { position: relative; width: 100%; min-width: 0; overflow: hidden; background: var(--bg2); border: 1px solid var(--border-strong); border-radius: var(--r-panel); }
.lab-canvas-wrap canvas { display: block; width: 100%; max-width: 100%; height: auto; touch-action: pan-y; }
.sim-mirror { margin: 0; padding: 9px 11px; color: var(--muted); background: var(--bg2); border-left: 2px solid var(--accent); border-radius: 5px; font-size: 12px; overflow-wrap: anywhere; }
.sim-challenge-list { min-width: 0; display: grid; gap: 9px; }
.sim-challenge-list > .kicker { margin-bottom: 0; }
.sim-challenge { min-width: 0; padding: 13px 14px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-ctl); }
.sim-challenge.done { border-color: color-mix(in srgb, var(--good) 58%, var(--border)); }
.sim-challenge-head { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 8px; }
.sim-challenge-head h3 { margin: 0; font-size: 13.5px; line-height: 1.55; overflow-wrap: anywhere; }
.sim-challenge-index { color: var(--accent); font: 700 10px/1.8 var(--mono); }
.sim-challenge-actions { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; margin-top: 10px; }
.sim-challenge-actions .btn { white-space: nowrap; }
.sim-challenge .sim-feedback { min-width: 0; margin: 9px 0 0; color: var(--dim); font-size: 12.5px; overflow-wrap: anywhere; }
.sim-challenge .sim-feedback.good { color: var(--good); }
.sim-challenge .sim-feedback.bad { color: var(--bad); }
.sim-progress { color: var(--dim); font: 11px/1.4 var(--mono); font-variant-numeric: tabular-nums; }
.sim-challenges { min-width: 0; padding-top: 2px; }
.sim-presets, .sim-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sim-presets .btn { flex: 0 1 auto; }
.sim-question { margin: 14px 0 9px; color: var(--text); font-weight: 620; overflow-wrap: anywhere; }
.sim-answers { margin-bottom: 12px; }
.sim-answers .btn { min-width: 0; flex: 1 1 180px; white-space: normal; overflow-wrap: anywhere; }
.sim-answers .btn.on, .sim-answers .btn[aria-pressed="true"] { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.sim-actions .sim-status { color: var(--dim); font: 11px/1.4 var(--mono); font-variant-numeric: tabular-nums; }
.sim-feedback.callout { max-width: none; display: block; margin: 11px 0 0; overflow-wrap: anywhere; }
.sim-feedback.good { border-left-color: var(--good); }
.sim-feedback.bad { border-left-color: var(--bad); }
.lab-done { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 13px; padding: 10px 12px; color: var(--good); background: color-mix(in srgb, var(--good) 8%, var(--bg2)); border: 1px solid color-mix(in srgb, var(--good) 42%, var(--border)); border-radius: var(--r-ctl); font-size: 13px; }
.lab-done .chk { display: inline-grid; place-items: center; min-width: 26px; height: 22px; color: var(--bg); background: var(--good); border-radius: 5px; font: 800 9px/1 var(--mono); }
.btn-sm { min-height: 36px; padding: 6px 10px; font-size: 12px; }

.recall-list { display: grid; gap: 9px; margin: 14px 0 18px; counter-reset: recall; }
.recall-item { counter-increment: recall; display: grid; grid-template-columns: auto 1fr; gap: 10px; color: var(--muted); }
.recall-item::before { content: counter(recall, decimal-leading-zero); color: var(--accent); font: 10px/1.8 var(--mono); }
.recall-check { display: flex; align-items: flex-start; gap: 9px; margin: 14px 0; color: var(--text); }
.recall-check input { width: 18px; height: 18px; margin-top: 4px; accent-color: var(--accent); }
.weak-input { width: 100%; min-height: 90px; resize: vertical; }

.question-list { display: grid; gap: 14px; }
.question { padding: 16px; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--bg2); }
.question-title { margin: 0 0 10px; font-weight: 620; }
.options { display: grid; gap: 7px; }
.question-option { min-height: 42px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 9px; padding: 8px 10px; color: var(--muted); background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-ctl); cursor: pointer; text-align: left; }
.question-option:hover { color: var(--text); border-color: var(--border-strong); }
.question-option.selected { color: var(--text); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.question-option.correct { border-color: var(--good); }
.question-option.wrong { border-color: var(--bad); }
.option-letter { color: var(--accent); font: 700 11px/1 var(--mono); }
.rationale { margin: 10px 0 0; padding: 11px 12px; color: var(--muted); background: var(--panel); border-left: 2px solid var(--accent); border-radius: 5px; font-size: 13px; }
.rationale strong { color: var(--text); }
.locked { padding: 28px 20px; border: 1px dashed var(--border-strong); border-radius: var(--r-panel); color: var(--dim); text-align: center; }
.transfer-wait { display: grid; gap: 6px; }
.transfer-wait strong { color: var(--warn); }
.score-box { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--bg2); }
.score-value { color: var(--accent); font: 720 22px/1 var(--mono); }

.anki-panel { margin-top: 20px; border-left: 3px solid var(--good); }
.anki-panel p { color: var(--muted); }
.anki-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.anki-state { margin-top: 10px; color: var(--dim); font-size: 12px; }
.anki-state.connected { color: var(--good); }
.anki-complete { display: flex; align-items: flex-start; gap: 9px; margin: 14px 0; color: var(--text); font-size: 13px; }
.anki-complete input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--good); }
.offline-preview { margin-top: 14px; background: var(--bg2); }
.offline-preview .details-body > p { margin: 4px 0 12px; }

.card-dialog { width: min(720px, calc(100vw - 32px)); max-width: 720px; min-height: 440px; }
.real-image-dialog { width: min(1120px, calc(100vw - 32px)); max-width: 1120px; padding: 18px; }
.real-image-dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.real-image-dialog-head h2 { margin: 5px 0 0; }
.real-image-dialog-head form { margin: 0; }
.real-image-dialog-stage { width: 100%; height: clamp(360px, 68vh, 760px); max-height: calc(100vh - 260px); display: grid; place-items: center; overflow: hidden; margin-top: 14px; background: #000; border: 1px solid var(--border); border-radius: var(--r-ctl); }
.real-image-dialog-stage img { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
.real-image-dialog-caption { margin: 13px 2px 7px; color: var(--text); font-size: 13.5px; line-height: 1.65; }
.real-image-dialog-source { margin: 0 2px; color: var(--dim); font-size: 11.5px; overflow-wrap: anywhere; }
.card-session-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.card-session-head span:last-child { color: var(--dim); font: 11px/1 var(--mono); }
.flashcard { min-height: 300px; display: flex; flex-direction: column; justify-content: center; padding: 24px; border: 1px solid var(--border); border-radius: var(--r-panel); background: var(--bg2); }
.flash-topic { margin: 0 0 12px; color: var(--accent); font: 10px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.flash-q { margin: 0; font-size: 21px; line-height: 1.6; }
.flash-a { margin: 18px 0 0; padding-top: 16px; color: var(--text); border-top: 1px solid var(--border); font-size: 18px; line-height: 1.7; }
.flash-extra { margin-top: 12px; padding: 10px 12px; color: var(--muted); background: var(--panel); border-radius: var(--r-ctl); font-size: 13px; }
.flash-extra strong { color: var(--warn); }
.flash-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 16px; }
.flash-actions .btn { min-width: 120px; }
.dialog-close { display: flex; justify-content: flex-end; margin-top: 14px; }
.card-summary { min-height: 300px; display: grid; place-content: center; text-align: center; }
.card-summary strong { color: var(--accent); font-size: 34px; }
.card-summary p { color: var(--muted); }

details { margin: 10px 0; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--panel); }
summary { padding: 12px 15px; cursor: pointer; list-style: none; font-weight: 620; }
summary::before { content: "▸"; display: inline-block; margin-right: 8px; color: var(--accent); transition: transform .15s ease; }
details[open] summary::before { transform: rotate(90deg); }
.details-body { min-width: 0; padding: 0 15px 14px; overflow-wrap: anywhere; color: var(--muted); font-size: 13px; }
.details-body li { min-width: 0; overflow-wrap: anywhere; }

.coverage-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 1050px; }
.coverage-card { padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r-panel); background: var(--panel); }
.coverage-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.coverage-head h2 { margin: 0; font-size: 16px; }
.coverage-head span { color: var(--dim); font: 11px/1 var(--mono); }
.coverage-bar { height: 7px; margin: 11px 0 8px; overflow: hidden; background: var(--border); border-radius: 999px; }
.coverage-bar div { height: 100%; background: var(--accent); border-radius: inherit; }
.coverage-card p { margin: 0; color: var(--muted); font-size: 12.5px; }
.readiness { display: grid; gap: 9px; max-width: 900px; }
.readiness-row { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--panel); }
.readiness-mark { color: var(--warn); font-family: var(--mono); }
.readiness-row.pass .readiness-mark { color: var(--good); }
.readiness-row span:last-child { color: var(--dim); font: 11px/1 var(--mono); }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 1050px; counter-reset: method; }
.step { padding: 18px; border: 1px solid var(--border); border-radius: var(--r-panel); background: var(--panel); }
.step > span { color: var(--accent); font: 11px/1 var(--mono); }
.step h2 { margin: 8px 0 6px; font-size: 17px; }
.step p { margin: 0; color: var(--muted); font-size: 13px; }
.settings p { color: var(--muted); }
.settings-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.mobile-nav { display: none; }
dialog { width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; padding: 22px 24px; color: var(--text); background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--r-panel); }
dialog::backdrop { background: var(--overlay); }
dialog h2 { margin: 0 0 8px; font-size: 18px; }
dialog p { margin: 0 0 18px; color: var(--muted); }
dialog form { display: flex; justify-content: flex-end; gap: 9px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translateX(-50%); max-width: min(560px, calc(100vw - 32px)); padding: 10px 16px; color: var(--text); background: var(--panel2); border: 1px solid var(--border-strong); border-radius: var(--r-ctl); font-size: 13.5px; }
.toast.good { border-color: var(--good); }
.toast.bad { border-color: var(--bad); }

@media (max-width: 1100px) {
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .app { display: block; }
  .side { display: none; }
  .side-toggle { visibility: hidden; }
  body[data-pane="learn"] .mobile-nav { position: sticky; top: 58px; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--bg2); border-bottom: 1px solid var(--border); }
  .mobile-nav label { color: var(--dim); font: 10px/1 var(--mono); white-space: nowrap; }
  .mobile-nav select { width: 100%; }
  main { padding: 24px 18px 70px; }
  .phase-nav { top: 116px; overflow-x: auto; grid-template-columns: repeat(5, minmax(112px, 1fr)); }
  .coverage-grid { grid-template-columns: 1fr; }
  body[data-pane="t1"] main { padding-top: 24px; }
}

@media (max-width: 680px) {
  body { font-size: 15.5px; }
  .topbar { padding: 0 12px; gap: 10px; }
  .brand > span:last-child, .top-right { display: none; }
  .tab { padding: 0 11px; }
  .hero { margin-bottom: 16px; }
  .hero h1, .page-head h1 { font-size: 28px; }
  .lead, .page-head p { font-size: 15.5px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section { margin: 42px 0; }
  .today-section { margin-top: 18px; }
  .section-head { align-items: stretch; flex-direction: column; }
  .daily-tools, .curriculum-tools { align-items: stretch; justify-content: flex-start; }
  .daily-budget { flex: 1 1 150px; }
  .daily-budget .input { flex: 1; }
  .mobile-only { display: inline-flex; }
  .search { width: 100%; }
  .day-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .one-thing { display: flex; flex-direction: column; }
  .mission-head { order: 1; }
  .one-thing > p { order: 2; }
  .mission-wait { order: 3; }
  .mission-actions { order: 4; }
  .quick-done { order: 5; }
  .mission-metrics { order: 6; }
  .capacity-plan { order: 7; }
  .mission-head { grid-template-columns: 1fr; gap: 10px; }
  .countdown { display: flex; align-items: baseline; justify-content: flex-start; gap: 7px; padding: 0; border: 0; text-align: left; }
  .countdown strong { font-size: 26px; }
  .capacity-plan { grid-template-columns: 1fr; }
  .mission-actions .btn { flex: 1 1 100%; }
  .module-grid { grid-template-columns: 1fr; }
  .module-grid.mobile-compact .module-card:nth-child(n+7) { display: none; }
  .module-card { min-height: 160px; }
  .module-head-row { display: block; }
  .worked-grid, .steps { grid-template-columns: 1fr; }
  .digest-brief { padding: 18px 16px; }
  .digest-head { align-items: start; }
  .digest-one, .digest-check { grid-template-columns: 1fr; gap: 5px; }
  .digest-grid, .digest-more-grid, .node-roadmap nav > div { grid-template-columns: 1fr; }
  .reading-toolbar { align-items: stretch; flex-direction: column; }
  .reading-mode-switch { flex-basis: auto; width: 100%; }
  .key-term-rail { grid-template-columns: 1fr; gap: 7px; padding: 11px 12px; }
  .key-term-label { padding-top: 0; }
  .key-term-rail ul { gap: 6px; }
  .key-term-rail li { padding: 4px 8px; font-size: 12px; }
  .node-cue { align-items: flex-start; flex-direction: column; gap: 4px; }
  .node-content .concept-list > li, .node-content .concept-steps > li { padding-top: 10px; padding-bottom: 10px; }
  .node-content .concept-steps > li { padding-left: 43px; }
  .teach-table-wrap { margin-left: -1px; margin-right: -1px; }
  .teach-table-scroll-hint { display: flex; align-items: center; justify-content: flex-end; gap: 5px; margin: 12px 0 -8px !important; color: var(--dim) !important; font: 650 9.5px/1.4 var(--mono); letter-spacing: .04em; }
  .teach-table-scroll-hint span { color: var(--accent); font-size: 12px; }
  .teach-table-wrap table, .teach-card table { min-width: 520px; }
  .image-lab-grid { grid-template-columns: 1fr; }
  .real-atlas { padding: 17px 16px; }
  .real-atlas-head { align-items: start; flex-direction: column; gap: 7px; }
  .real-image-grid { grid-template-columns: 1fr; }
  .real-image-card { grid-template-columns: 1fr; }
  .real-image-frame { height: min(68vw, 300px); min-height: 210px; }
  .reading-focus .real-image-card { grid-template-columns: 94px minmax(0, 1fr); }
  .reading-focus .real-image-frame { height: 100%; min-height: 88px; }
  .real-image-prompt { min-height: 0; }
  .histo-frame img { height: min(76vw, 390px); }
  .image-question h3 { min-height: 0; }
  .model3d-layout { grid-template-columns: 1fr; }
  .model3d-stage { height: 360px; }
  .model3d-object-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .model3d-challenge { grid-template-columns: 1fr; }
  .model3d-challenge-actions, .model3d-feedback { grid-column: 1; }
  .sim-layout { grid-template-columns: 1fr; }
  .sim-controls { grid-template-columns: 1fr; }
  .readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sim-presets .btn, .sim-actions .btn { flex: 1 1 170px; }
  .sim-answers { display: grid; grid-template-columns: 1fr; }
  .sim-answers .btn { width: 100%; }
  .sim-challenge-actions { grid-template-columns: 1fr; }
  .sim-challenge-actions .btn { width: 100%; white-space: normal; }
  .teach-card, .worked-card, .lab-card, .recall-card, .quiz-card, .anki-panel { padding: 17px 16px; }
  .lesson-figure { margin: 16px 0 6px; }
  .lesson-figure img { width: 680px; max-width: none; }
  .lesson-figure figcaption { font-size: 12px; }
  .match-row { grid-template-columns: 1fr; gap: 5px; }
  .calc-grid { grid-template-columns: repeat(2, 1fr); }
  .anki-actions .btn { flex: 1 1 45%; }
  .map-box { margin-left: -2px; margin-right: -2px; }
  .t1-snapshot-bar { grid-template-columns: 1fr; gap: 8px; }
  .t1-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .t1-controls { grid-template-columns: 1fr; padding: 17px 16px; }
  .t1-controls-head, .t1-control-actions, .t1-filter-note { grid-column: 1; }
  .t1-controls-head { align-items: flex-start; flex-direction: column; gap: 4px; }
  .t1-control-actions .btn { flex: 1 1 45%; }
  .t1-ready { grid-template-columns: 1fr; gap: 10px; padding: 22px 18px; }
  .t1-flashcard { min-height: 330px; padding: 22px 18px; }
  .t1-extra-grid { grid-template-columns: 1fr; }
  .t1-session-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .t1-session-actions .btn { min-width: 0; width: 100%; }
  .settings-actions .btn { flex: 1 1 100%; }
  .t1-session-actions .btn:only-child { grid-column: 1 / -1; }
  .t1-shortcuts { line-height: 2; }
  .btn, .icon-btn, .filter-chip, .phase-btn, .question-option, .model3d-object { min-height: 44px; }
  .real-image-dialog { padding: 14px; }
  .real-image-dialog-stage { max-height: calc(100vh - 250px); }
}

@media (max-width: 380px) {
  .readout { grid-template-columns: 1fr; }
  .metric .k { min-height: 0; }
  .sim-actions { align-items: stretch; flex-direction: column; }
  .sim-actions .btn { width: 100%; }
}

@media (forced-colors: active) {
  .seg button.on, .seg button[aria-pressed="true"], .sim-answers .btn.on, .sim-answers .btn[aria-pressed="true"] { outline: 2px solid Highlight; outline-offset: 1px; }
  .lab-done { border-color: CanvasText; }
}

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

@media print {
  :root { --bg: #ffffff; --bg2: #f5f6f8; --panel: #ffffff; --panel2: #f0f2f5; --border: #cccccc; --border-strong: #999999; --text: #111111; --muted: #444444; --dim: #666666; --accent: #245fb8; --good: #137548; --warn: #8a5b00; --bad: #a32d43; --trend-up: #5f3d9e; --trend-down: #1f5f9e; --trend-flat: #735900; }
  .topbar, .side, .mobile-nav, .phase-nav, .phase-actions, .anki-panel, .toast, .node-detail-toggle, .reading-toolbar, .node-roadmap { display: none !important; }
  .app, main { display: block; max-width: none; padding: 0; }
  .pane[hidden], .phase-panel[hidden], .node-content[hidden], .worked-content[hidden] { display: block !important; }
  .teach-table-wrap { overflow: visible; }
  .teach-table-scroll-hint { display: none; }
  .teach-table-wrap table, .teach-card table { min-width: 0; }
  .teach-table-wrap thead th { position: static; }
  .module-card, .teach-card, .worked-card, .lab-card, .recall-card, .quiz-card { break-inside: avoid; }
}
