:root {
  --bg: #ffffff;
  --surface: #f6f6f4;
  --surface-2: #efefec;
  --surface-3: #e8e8e4;
  --line: #e4e4df;
  --line-strong: #cfcfc9;
  --text: #161616;
  --text-2: #3a3a37;
  --muted: #66665f;
  --faint: #8c8c84;
  --charcoal: #2b2b2b;
  --charcoal-2: #3d3d3d;
  --blue: #1d5fc4;
  --blue-dark: #174d9f;
  --blue-soft: #eaf1fc;
  --green: #1c7a3f;
  --green-soft: #e9f5ed;
  --green-line: #b9dcc5;
  --red: #c13a2f;
  --red-soft: #fcefed;
  --red-line: #efc2bd;
  --orange: #b85a00;
  --orange-soft: #fdf2e6;
  --teal: #0e6f69;
  --teal-soft: #e7f3f2;
  --purple: #6b3fa0;
  --purple-soft: #f2edf8;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --topbar: 56px;
  --sidebar: 288px;
  --measure: 46rem;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--topbar) + 16px); }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 16px; line-height: 1.62; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body.no-scroll { overflow: hidden; }
a { color: var(--blue); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--blue-dark); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { color: var(--text); line-height: 1.25; font-weight: 650; letter-spacing: -0.005em; }
h1 { font-size: 1.85rem; margin: 0 0 0.4rem; }
h2 { font-size: 1.32rem; margin: 2.2rem 0 0.6rem; }
h3 { font-size: 1.08rem; margin: 1.6rem 0 0.4rem; }
h4 { font-size: 1rem; margin: 1.2rem 0 0.3rem; }
p { margin: 0 0 0.85rem; }
ul, ol { margin: 0 0 0.9rem; padding-left: 1.4rem; }
li { margin: 0.2rem 0; }
li::marker { color: var(--muted); }
strong { font-weight: 650; color: var(--text); }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
code, kbd, pre, .mono { font-family: var(--mono); }
:not(pre) > code { font-size: 0.86em; background: var(--surface-2); color: #8a2a1a; padding: 0.12em 0.38em; border-radius: 4px; white-space: break-spaces; }
a code { color: inherit; }
kbd { font-size: 0.8em; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0.05em 0.4em; background: var(--bg); color: var(--text-2); }
input, textarea, select, button { font: inherit; color: inherit; }
input[type="text"], input[type="number"], input:not([type]), textarea, select { background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 0.45rem 0.6rem; min-width: 0; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
textarea { resize: vertical; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--blue); }
.hidden { display: none !important; }
.small { font-size: 0.875rem; }
.tiny { font-size: 0.78rem; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.good-text { color: var(--green); }
.bad-text { color: var(--red); }
.warn-text { color: var(--orange); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.topbar { position: sticky; top: 0; z-index: 40; height: var(--topbar); display: flex; align-items: center; gap: 1rem; padding: 0 1.25rem; background: rgba(255, 255, 255, 0.97); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 0.6rem; color: var(--text); text-decoration: none; font-weight: 650; white-space: nowrap; }
.brand:hover { color: var(--text); }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 7px; background: var(--charcoal); color: #fff; font-family: var(--mono); font-size: 0.8rem; font-weight: 600; }
.topnav { display: flex; gap: 0.25rem; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.topnav a { color: var(--text-2); text-decoration: none; padding: 0.4rem 0.7rem; border-radius: var(--radius-sm); font-size: 0.93rem; white-space: nowrap; display: inline-flex; align-items: center; gap: 0.45rem; }
.topnav a:hover { background: var(--surface); color: var(--text); }
.topnav a.active { color: var(--text); background: var(--surface-2); font-weight: 600; }
.topnav .count { font-size: 0.72rem; background: var(--orange); color: #fff; border-radius: 999px; padding: 0 0.42rem; font-weight: 600; line-height: 1.5; }
.icon-button { border: 0; background: transparent; width: 38px; height: 38px; border-radius: var(--radius-sm); color: var(--text-2); cursor: pointer; }
.icon-button:hover { background: var(--surface); }
.menu-button { display: none; }

.layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: calc(100vh - var(--topbar)); }
.sidebar { position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); padding: 1rem 0.75rem 3rem; font-size: 0.9rem; }
.main { min-width: 0; padding: 2rem 2.5rem 6rem; outline: none; }
.page { max-width: var(--measure); margin: 0 auto; }
.page.wide { max-width: 64rem; }

.side-section { margin: 0.25rem 0 1.1rem; }
.side-heading { font-size: 0.74rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; padding: 0 0.6rem; margin-bottom: 0.3rem; }
.side-week { margin-bottom: 0.2rem; }
.side-week > button { width: 100%; display: flex; align-items: center; gap: 0.5rem; border: 0; background: transparent; padding: 0.4rem 0.6rem; border-radius: var(--radius-sm); cursor: pointer; text-align: left; color: var(--text); font-weight: 600; }
.side-week > button:hover { background: var(--surface-2); }
.side-week > button .chev { margin-left: auto; color: var(--faint); font-size: 0.7rem; transition: transform 0.15s; }
.side-week.open > button .chev { transform: rotate(90deg); }
.side-week .week-progress { font-size: 0.75rem; color: var(--muted); font-weight: 500; font-family: var(--mono); }
.side-lessons { display: none; list-style: none; margin: 0.1rem 0 0.5rem; padding: 0; }
.side-week.open .side-lessons { display: block; }
.side-lessons a { display: flex; align-items: flex-start; gap: 0.55rem; padding: 0.3rem 0.6rem 0.3rem 0.8rem; border-radius: var(--radius-sm); color: var(--text-2); text-decoration: none; line-height: 1.35; }
.side-lessons a:hover { background: var(--surface-2); color: var(--text); }
.side-lessons a.active { background: var(--bg); color: var(--text); box-shadow: 0 0 0 1px var(--line); font-weight: 550; }
.side-link { display: flex; align-items: center; gap: 0.55rem; padding: 0.4rem 0.6rem; color: var(--text-2); text-decoration: none; border-radius: var(--radius-sm); }
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.active { background: var(--bg); box-shadow: 0 0 0 1px var(--line); color: var(--text); font-weight: 550; }
.side-link i { width: 16px; text-align: center; color: var(--muted); }

.status-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--line-strong); margin-top: 0.38em; background: var(--bg); }
.status-dot.learning { border-color: var(--blue); background: var(--blue-soft); box-shadow: inset 0 0 0 2px var(--bg); background-color: var(--blue); }
.status-dot.mastered { border-color: var(--green); background: var(--green); }
.status-dot.due { border-color: var(--orange); background: var(--orange); }

.chip { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.76rem; line-height: 1; padding: 0.32rem 0.6rem; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-weight: 550; white-space: nowrap; vertical-align: middle; }
.chip.blue { background: var(--blue-soft); color: var(--blue-dark); }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.orange { background: var(--orange-soft); color: var(--orange); }
.chip.teal { background: var(--teal-soft); color: var(--teal); }
.chip.purple { background: var(--purple-soft); color: var(--purple); }
.chip.outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.chip.mono { font-family: var(--mono); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); padding: 0.55rem 1rem; font-size: 0.93rem; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; white-space: nowrap; }
.btn:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.btn.primary { background: var(--charcoal); border-color: var(--charcoal); color: #fff; }
.btn.primary:hover { background: #111; }
.btn.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.blue:hover { background: var(--blue-dark); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface); }
.btn.small { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.btn.link { border: 0; background: none; padding: 0; color: var(--blue); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.btn-row.end { justify-content: flex-end; }

.eyebrow { font-size: 0.82rem; color: var(--muted); margin-bottom: 0.35rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.eyebrow a { color: var(--muted); }
.lede { font-size: 1.08rem; color: var(--text-2); margin-bottom: 1.2rem; }
.page-head { margin-bottom: 1.6rem; }
.page-head .chips { margin-top: 0.6rem; }

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); padding: 1.1rem 1.25rem; }
.panel.soft { background: var(--surface); border-color: transparent; }
.panel + .panel { margin-top: 0.75rem; }
.panel-title { font-weight: 650; margin: 0 0 0.4rem; display: flex; align-items: center; gap: 0.5rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
.stat { font-size: 1.7rem; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-label { font-size: 0.85rem; color: var(--muted); }
.meter { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.meter.blue > span { background: var(--blue); }

.note { border-radius: var(--radius); padding: 0.85rem 1.05rem; margin: 1.1rem 0; background: var(--surface); }
.note > :last-child { margin-bottom: 0; }
.note-label { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 0.35rem; color: var(--muted); }
.note.trap { background: var(--orange-soft); }
.note.trap .note-label { color: var(--orange); }
.note.real { background: var(--teal-soft); }
.note.real .note-label { color: var(--teal); }
.note.exam { background: var(--purple-soft); }
.note.exam .note-label { color: var(--purple); }
.note.tip { background: var(--blue-soft); }
.note.tip .note-label { color: var(--blue-dark); }
.note.background { background: var(--surface); }
.note.rule { background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-strong); }
.note.rule .note-label { color: var(--text); }

.term { text-decoration: underline dotted var(--muted); text-decoration-thickness: 1.5px; text-underline-offset: 4px; cursor: help; }
.term:hover, .term:focus { text-decoration-color: var(--blue); color: var(--text); outline: none; }
.term-popover { position: absolute; z-index: 80; max-width: 22rem; background: var(--charcoal); color: #fff; border-radius: 8px; padding: 0.6rem 0.8rem; font-size: 0.86rem; line-height: 1.45; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18); }
.term-popover strong { color: #fff; }
.term-popover code { background: rgba(255, 255, 255, 0.14) !important; color: #fff !important; }

.table-wrap { overflow-x: auto; margin: 0.9rem 0 1.2rem; }
.md-table, .data-table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
.md-table th, .md-table td, .data-table th, .data-table td { border-bottom: 1px solid var(--line); padding: 0.5rem 0.7rem; text-align: left; vertical-align: top; }
.md-table th, .data-table th { font-weight: 650; color: var(--text); background: var(--surface); border-bottom-color: var(--line-strong); font-size: 0.86rem; }
.md-table tr:last-child td, .data-table tr:last-child td { border-bottom: 0; }

pre[class*="language-"], pre.code { margin: 0.8rem 0 1rem; padding: 0.85rem 1rem; background: var(--surface); border-radius: var(--radius-sm); overflow-x: auto; font-size: 0.86rem; line-height: 1.6; color: #24292f; tab-size: 4; }
pre code { background: none !important; padding: 0 !important; color: inherit !important; font-size: inherit; white-space: pre; }
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #6e7781; font-style: italic; }
.token.punctuation { color: #57606a; }
.token.keyword, .token.important, .token.atrule { color: #cf222e; }
.token.property, .token.tag, .token.constant, .token.symbol, .token.deleted, .token.boolean { color: #0550ae; }
.token.number { color: #0550ae; }
.token.string, .token.char, .token.attr-value, .token.regex, .token.inserted { color: #0a3069; }
.token.selector, .token.attr-name, .token.builtin { color: #116329; }
.token.operator, .token.entity, .token.url { color: #cf222e; }
.token.function, .token.class-name { color: #8250df; }
.token.macro, .token.directive, .token.directive-hash { color: #953800; }
.token.variable, .token.parameter { color: #953800; }
.token.shebang { color: #6e7781; }
.language-bash .token.function { color: #8250df; }
.language-makefile .token.symbol { color: #8250df; }

.annotated { border-radius: var(--radius); background: var(--surface); margin: 1rem 0 1.2rem; overflow: hidden; }
.annotated-title { padding: 0.55rem 1rem; font-size: 0.82rem; color: var(--muted); border-bottom: 1px solid var(--line); font-family: var(--mono); }
.annotated > .annotated-row:first-of-type, .annotated-title + .annotated-row { padding-top: 0.6rem; }
.annotated-row { display: grid; grid-template-columns: 3rem minmax(0, 1fr); font-family: var(--mono); font-size: 0.86rem; line-height: 1.65; }
.annotated-num { text-align: right; padding-right: 1rem; color: var(--faint); user-select: none; }
.annotated-code { overflow-x: auto; white-space: pre; padding-right: 1rem; color: #24292f; }
.annotated-code code { background: none !important; padding: 0 !important; color: inherit !important; font-size: inherit !important; }
.annotated-row.has-note { cursor: pointer; }
.annotated-row.has-note .annotated-num { color: var(--blue); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.annotated-row.has-note:hover { background: var(--surface-2); }
.annotated-row.active { background: var(--blue-soft); }
.annotated-note { margin: 0.25rem 1rem 0.5rem 3rem; padding: 0.6rem 0.85rem; background: var(--bg); border-radius: var(--radius-sm); font-family: var(--sans); font-size: 0.92rem; line-height: 1.55; box-shadow: 0 0 0 1px var(--line); }
.annotated-note > :last-child { margin-bottom: 0; }
.annotated-hint { padding: 0.5rem 1rem; font-size: 0.82rem; color: var(--muted); border-top: 1px solid var(--line); display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.annotated-hint .btn { padding: 0.2rem 0.55rem; font-size: 0.8rem; }
.annotated-output { border-top: 1px solid var(--line); padding: 0.5rem 1rem 0.2rem; background: var(--bg); }
.annotated-output pre { margin: 0.35rem 0 0.7rem !important; background: var(--surface) !important; }
.output-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: 0.82rem; color: var(--muted); }
.show-spaces-toggle { cursor: pointer; user-select: none; }
.output-pre.show-spaces .sp { position: relative; }
.output-pre.show-spaces .sp::after { content: '·'; position: absolute; left: 0; right: 0; text-align: center; color: var(--orange); }
.output-pre.show-spaces .tab { background: var(--orange-soft); }
.annotated-run { padding: 0.5rem 1rem; border-top: 1px solid var(--line); }

.lesson-section { margin: 0 0 2.4rem; scroll-margin-top: calc(var(--topbar) + 16px); }
.lesson-section > h2:first-child { margin-top: 0; }
.section-kicker { font-size: 0.8rem; font-weight: 650; color: var(--muted); margin-bottom: 0.25rem; display: flex; align-items: center; gap: 0.45rem; }
.section-kicker .num { font-family: var(--mono); color: var(--faint); }
.lesson-text p:last-child { margin-bottom: 0.4rem; }
.lesson-text h3 { margin-top: 1.4rem; }
.lesson-outline { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.5rem 0 1.6rem; }
.lesson-outline span { font-size: 0.78rem; padding: 0.26rem 0.55rem; border-radius: 999px; background: var(--surface); color: var(--muted); }
.lesson-outline span.done { background: var(--green-soft); color: var(--green); }
.lesson-outline span.current { background: var(--charcoal); color: #fff; }
.continue-row { margin: 1.4rem 0 0; display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.locked-next { color: var(--muted); font-size: 0.9rem; display: flex; gap: 0.5rem; align-items: center; }

.qcard { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); margin: 1.2rem 0; overflow: hidden; }
.qcard-head { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; padding: 0.7rem 1.1rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.qcard-head .label { font-size: 0.8rem; font-weight: 650; color: var(--text-2); margin-right: 0.2rem; }
.qcard-head .spacer { flex: 1; }
.qcard-body { padding: 1rem 1.1rem 1.1rem; }
.qcard .question-prompt { margin-bottom: 0.8rem; font-size: 1rem; }
.qcard .question-prompt p:last-child { margin-bottom: 0.3rem; }
.qcard-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 1rem; }
.qcard-actions .grow { flex: 1; }
.qcard.correct { border-color: var(--green-line); }
.qcard.wrong { border-color: var(--red-line); }
.qcard-help { margin-top: 0.8rem; display: grid; gap: 0.6rem; }
.hint-box { background: var(--blue-soft); border-radius: var(--radius-sm); padding: 0.65rem 0.85rem; font-size: 0.94rem; }
.hint-box .note-label { color: var(--blue-dark); margin-bottom: 0.15rem; }
.hint-box > :last-child { margin-bottom: 0; }
.verdict { margin-top: 1rem; border-radius: var(--radius-sm); padding: 0.85rem 1rem; }
.verdict.good { background: var(--green-soft); }
.verdict.bad { background: var(--red-soft); }
.verdict-title { font-weight: 700; display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.3rem; }
.verdict.good .verdict-title { color: var(--green); }
.verdict.bad .verdict-title { color: var(--red); }
.verdict > :last-child { margin-bottom: 0; }
.verdict .answer-block { background: var(--bg); border-radius: var(--radius-sm); padding: 0.65rem 0.85rem; margin: 0.6rem 0; }
.verdict .answer-block > :last-child { margin-bottom: 0; }
.verdict .answer-block pre { margin: 0.4rem 0 0.2rem; }
.verdict-sub { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0.7rem 0 0.25rem; }

.question-format { display: none; }
.question-header { display: none; }
.question-prompt { margin-bottom: 0.8rem; }
.question-body { min-width: 0; overflow-x: auto; }
.mc-options { display: grid; gap: 0.45rem; }
.mc-option { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.65rem 0.85rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); cursor: pointer; line-height: 1.45; }
.mc-option:hover { border-color: var(--blue); background: var(--blue-soft); }
.mc-option:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.mc-option.inline { display: inline-flex; padding: 0.45rem 0.9rem; }
.mc-option input { margin-top: 0.22rem; }
.mc-letter { color: var(--muted); font-family: var(--mono); font-size: 0.84rem; padding-top: 0.08rem; }
.mc-option.is-correct { border-color: var(--green); background: var(--green-soft); }
.mc-option.is-wrong { border-color: var(--red); background: var(--red-soft); }
.answer-box { width: 100%; font-family: var(--mono); font-size: 0.9rem; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 0.6rem 0.75rem; }
.fill-text { line-height: 2.4; }
.fill-blank { margin: 0 0.2rem; padding: 0.15rem 0.5rem !important; font-family: var(--mono); font-size: 0.9rem; }
.fill-pre { line-height: 2.3 !important; white-space: pre-wrap; }
.is-correct { border-color: var(--green) !important; background: var(--green-soft); }
.is-wrong { border-color: var(--red) !important; background: var(--red-soft); }
.ws { color: var(--orange); }
.diff-table { border-collapse: collapse; width: 100%; margin: 0.5rem 0 0.3rem; font-size: 0.84rem; background: var(--bg); border-radius: var(--radius-sm); overflow: hidden; }
.diff-table th, .diff-table td { padding: 0.25rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; white-space: pre; }
.diff-table th { font-family: var(--sans); color: var(--muted); font-weight: 600; }
.diff-table tr.diff-bad td { background: var(--red-soft); }
.feedback-explanation { margin-top: 0.5rem; }
.trace-table { border-collapse: collapse; margin: 0.5rem 0; background: var(--bg); }
.trace-table th, .trace-table td { border: 1px solid var(--line); padding: 0.3rem 0.6rem; text-align: left; font-size: 0.9rem; }
.trace-table th { background: var(--surface); font-weight: 600; }
.trace-cell { width: 7ch; padding: 0.15rem 0.35rem !important; font-family: var(--mono); }
.numbered-code pre { margin-top: 0.3rem !important; }

.bit-work { display: inline-block; margin: 0.4rem 0 0.7rem; padding: 0.7rem 0.85rem; background: var(--surface); border-radius: var(--radius-sm); overflow-x: auto; max-width: 100%; }
.bit-row { display: flex; align-items: center; gap: 2px; margin: 3px 0; }
.bit-label { width: 74px; flex-shrink: 0; color: var(--muted); font-size: 0.82rem; text-align: right; padding-right: 10px; white-space: nowrap; font-family: var(--mono); }
.bit { width: 24px; height: 27px; display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 0.9rem; border-radius: 4px; color: var(--text); }
.bit.nibble { margin-left: 8px; }
.bit-row.answer .bit, .bit.editable { border: 1px solid var(--line-strong); background: var(--bg); cursor: pointer; padding: 0; }
.bit.editable:hover { border-color: var(--blue); }
.bit.on { color: var(--blue); font-weight: 700; }
.bit-row.index .bit { height: 16px; font-size: 0.65rem; color: var(--faint); }
.bit-row.result .bit, .bit-row.solution .bit { color: var(--green); font-weight: 600; }
.bit-row.result { border-top: 1.5px solid var(--text-2); padding-top: 3px; }
.bit-meta { margin-left: 12px; color: var(--muted); white-space: nowrap; font-family: var(--mono); font-size: 0.82rem; }
.bit-values { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; color: var(--muted); }
.bit-hex { margin-top: 4px; }
.bit-hex-input { width: 12ch; }
.bit-shift-note { margin: 2px 0 2px 84px; }
.convert-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; font-size: 1rem; }
.convert-input { width: 22ch; font-family: var(--mono); }

.regex-command { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; background: var(--surface); border-radius: var(--radius-sm); padding: 0.55rem 0.75rem; font-family: var(--mono); }
.regex-command label { font-size: 0.82rem; color: var(--text-2); font-family: var(--sans); display: inline-flex; gap: 0.25rem; align-items: center; }
.regex-input { flex: 1; min-width: 160px; font-family: var(--mono); }
.regex-lines { margin-top: 0.6rem; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.regex-line { display: flex; gap: 0.6rem; padding: 0.22rem 0.7rem; border-bottom: 1px solid var(--line); font-size: 0.88rem; align-items: baseline; font-family: var(--mono); }
.regex-line:last-child { border-bottom: none; }
.regex-line.hit { background: var(--blue-soft); }
.regex-line.dim { color: var(--faint); }
.regex-want { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); width: 48px; flex-shrink: 0; font-family: var(--sans); font-weight: 600; }
.regex-result { margin-left: auto; font-size: 0.75rem; color: var(--blue); font-family: var(--sans); }
.regex-line mark { background: #fde7b0; color: var(--text); border-radius: 2px; padding: 0 1px; }
.regex-status { margin-top: 0.35rem; color: var(--orange); min-height: 1em; font-size: 0.86rem; }

.command-line { display: flex; align-items: center; background: #1e1e1e; border-radius: var(--radius-sm); padding: 0.55rem 0.75rem; font-family: var(--mono); font-size: 0.9rem; }
.command-line .term-prompt { color: #7ec699; white-space: nowrap; }
.command-input { flex: 1; background: transparent !important; border: none !important; box-shadow: none !important; padding: 0 !important; color: #f0f0f0 !important; font-family: var(--mono); font-size: 0.9rem; caret-color: #f0f0f0; }
.command-output { margin-top: 0.5rem !important; max-height: 240px; overflow: auto; }
.command-context { margin-bottom: 0.4rem; }
.command-context pre { margin: 0.3rem 0 0.7rem !important; }

.lsl-line { background: var(--surface); border-radius: var(--radius-sm); padding: 0.65rem 0.85rem; font-size: 0.95rem; overflow-x: auto; white-space: pre; margin-bottom: 0.7rem; font-family: var(--mono); }
.lsl-parts { display: grid; gap: 0.45rem; }
.lsl-ask { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; justify-content: space-between; padding: 0.45rem 0.7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.lsl-ask input { width: 14ch; font-family: var(--mono); }
.order-list { display: grid; gap: 0.4rem; margin-top: 0.4rem; }
.order-row { display: flex; gap: 0.6rem; align-items: center; padding: 0.45rem 0.7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.order-select { width: 7.5em; }
.tf-statement { padding: 0.7rem 0.9rem; background: var(--surface); border-radius: var(--radius-sm); margin-bottom: 0.7rem; }
.tf-choice { margin-bottom: 0.7rem; }
.match-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 1rem; }
.match-items, .match-defs { display: grid; gap: 0.4rem; align-content: start; }
.match-row { display: flex; gap: 0.6rem; align-items: center; padding: 0.45rem 0.7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.match-def { padding: 0.45rem 0.7rem; background: var(--surface); border-radius: var(--radius-sm); font-size: 0.93rem; }

.editor-toolbar { display: flex; justify-content: flex-end; margin-bottom: 0.25rem; }
.vim-toggle { cursor: pointer; user-select: none; display: inline-flex; gap: 0.3rem; align-items: center; }
.editor-host { margin-bottom: 0.5rem; }
.test-results { margin-top: 0.5rem; display: grid; gap: 0.4rem; }
.test-row { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.45rem 0.7rem; font-size: 0.9rem; }
.test-row.fail { border-color: var(--red-line); background: var(--red-soft); }
.test-row.pass { border-color: var(--green-line); }
.compile-error pre { color: var(--red); }
.feedback-title { font-weight: 700; }
.callout { border-radius: var(--radius-sm); padding: 0.6rem 0.8rem; background: var(--surface); margin: 0.5rem 0; }
.callout-label { display: block; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 0.2rem; }

.visual { border-radius: var(--radius); margin: 1.1rem 0; background: var(--surface); overflow: hidden; }
.visual-title { padding: 0.55rem 1rem; border-bottom: 1px solid var(--line); font-size: 0.84rem; color: var(--text-2); font-weight: 650; }
.visual-body { padding: 1rem; overflow-x: auto; }
.visual-caption { margin-top: 0.7rem; font-size: 0.92rem; color: var(--text-2); }
.visual .btn:not(.primary) { background: var(--bg); }
.mem-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.mem-cell { min-width: 96px; text-align: center; }
.mem-name { font-size: 0.84rem; font-weight: 600; margin-bottom: 3px; font-family: var(--mono); }
.mem-box { border: 1px solid var(--line-strong); background: var(--bg); padding: 10px 14px; border-radius: 6px; font-size: 1rem; color: #0550ae; font-family: var(--mono); }
.mem-cell.highlight .mem-box { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.mem-meta { font-size: 0.7rem; color: var(--muted); margin-top: 3px; font-family: var(--mono); }
.array-row { display: flex; }
.array-cell { display: flex; flex-direction: column; align-items: center; border: 1px solid var(--line-strong); margin-left: -1px; background: var(--bg); padding: 6px 12px; cursor: pointer; color: var(--text); font: inherit; min-width: 58px; font-family: var(--mono); }
.array-cell.selected { border-color: var(--blue); background: var(--blue-soft); position: relative; z-index: 1; }
.array-value { font-size: 1rem; color: #0550ae; }
.array-index { font-size: 0.75rem; color: var(--blue); }
.array-addr { font-size: 0.65rem; color: var(--muted); }
.pointer-visual { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pointer-gap { width: 26px; }
.pointer-arrows { margin-top: 10px; display: grid; gap: 4px; }
.stream-tabs { margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.stream-tabs .btn code { background: none; padding: 0; color: inherit; }
.stream-diagram { display: grid; grid-template-columns: auto auto 1fr; gap: 18px; align-items: center; }
.stream-process { border: 1.5px solid var(--charcoal); border-radius: 8px; padding: 12px 18px; text-align: center; background: var(--bg); font-weight: 600; }
.stream-outputs, .stream-source { display: grid; gap: 8px; font-family: var(--mono); font-size: 0.84rem; }
.stream-target { display: inline-block; border-radius: 5px; padding: 2px 8px; margin-left: 6px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-strong); }
.stream-target.tty { color: var(--blue); }
.stream-target.file { color: var(--orange); }
.stream-target.null { color: var(--faint); text-decoration: line-through; }
.perm-grid { display: grid; grid-template-columns: 110px repeat(3, 44px) 50px; gap: 6px; align-items: center; }
.perm-bit { height: 34px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--faint); border-radius: 6px; font-family: var(--mono); font-size: 1rem; cursor: pointer; }
.perm-bit.on { color: var(--green); border-color: var(--green); background: var(--green-soft); font-weight: 700; }
.perm-summary { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: 0.86rem; color: var(--text-2); }
.phase-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.phase { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 12px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); border-radius: 8px; cursor: pointer; font: inherit; font-size: 0.9rem; }
.phase.selected { border-color: var(--blue); background: var(--blue-soft); }
.phase-step { font-size: 0.7rem; color: var(--blue); min-height: 1em; }
.layers { display: grid; gap: 6px; }
.layer { padding: 10px; border: 1px solid var(--line-strong); background: var(--bg); border-radius: 8px; color: var(--text); font: inherit; cursor: pointer; }
.layer.selected { border-color: var(--blue); background: var(--blue-soft); }
.dep-graph { width: 100%; max-width: 760px; height: auto; }
.dep-edge { stroke: #a3a39b; stroke-width: 1.5; }
.dep-node rect { fill: var(--bg); stroke: #8c8c84; stroke-width: 1.2; }
.dep-node.source rect { stroke-dasharray: 4 3; }
.dep-node.target rect { stroke: var(--blue); }
.dep-node.phony rect { stroke: var(--purple); }
.dep-node.changed rect { stroke: var(--orange); stroke-width: 2.2; fill: var(--orange-soft); }
.dep-node text { fill: var(--text); font-family: var(--mono); font-size: 12px; }
.filetree { display: grid; gap: 1px; }
.tree-entry { text-align: left; background: none; border: none; color: var(--text); font: inherit; font-size: 0.84rem; padding: 3px 8px; border-radius: 4px; cursor: pointer; font-family: var(--mono); }
.tree-entry:hover { background: var(--surface-2); }
.tree-entry.selected { background: var(--blue-soft); }
.tree-entry.cwd { color: var(--blue); font-weight: 600; }
.tree-entry i { color: var(--faint); width: 16px; }
.stepper { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; }
.stepper-code { background: var(--bg); border-radius: 8px; padding: 8px 0; overflow-x: auto; box-shadow: inset 0 0 0 1px var(--line); }
.stepper-line { display: grid; grid-template-columns: 34px 1fr; font-family: var(--mono); font-size: 0.84rem; white-space: pre; }
.stepper-line.current { background: var(--blue-soft); }
.stepper-line code { background: none !important; padding: 0 !important; color: inherit !important; }
.stepper-side { display: grid; gap: 8px; align-content: start; }
.vars-table { border-collapse: collapse; background: var(--bg); }
.vars-table td { border: 1px solid var(--line); padding: 4px 10px; font-family: var(--mono); font-size: 0.86rem; }
.vars-table td.changed { color: var(--blue); font-weight: 700; background: var(--blue-soft); }
.stepper-output { min-height: 2.4em; margin: 0 !important; }
.fp-row { display: flex; flex-wrap: wrap; }
.fp-cell { display: flex; flex-direction: column; align-items: center; border: 1px solid var(--line-strong); margin-left: -1px; padding: 6px 8px; min-width: 38px; background: var(--bg); font-family: var(--mono); }
.fp-cell.current { border-color: var(--blue); background: var(--blue-soft); position: relative; z-index: 1; }
.fp-cell.eof span:first-child { color: var(--muted); font-size: 0.7rem; }
.fp-offset { font-size: 0.65rem; color: var(--muted); }
.fp-step { margin-top: 10px; color: var(--orange); }
.fd-layout { display: grid; grid-template-columns: auto 1fr; gap: 18px; }
.fd-table { border-collapse: collapse; background: var(--bg); }
.fd-table td, .fd-table th { border: 1px solid var(--line); padding: 4px 10px; font-size: 0.84rem; text-align: left; }
.fd-table tr.changed td { background: var(--blue-soft); }
.lsl-decoder { display: flex; flex-wrap: wrap; gap: 4px; }
.lsl-piece { background: var(--bg); border: 1px solid var(--line-strong); color: var(--text); border-radius: 5px; padding: 4px 7px; font: inherit; font-family: var(--mono); font-size: 0.9rem; cursor: pointer; }
.lsl-piece.selected { border-color: var(--blue); background: var(--blue-soft); }

.playground { border-radius: var(--radius); background: var(--surface); margin: 1rem 0; padding: 0.75rem 0.9rem; }
.playground-head { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; margin-bottom: 0.4rem; flex-wrap: wrap; }
.playground-options { display: grid; grid-template-columns: 1fr 2fr; gap: 0.6rem; margin-bottom: 0.4rem; }
.playground-options.compact { grid-template-columns: 1fr 1fr; }
.playground-options label { display: grid; gap: 0.2rem; }
.playground-options input, .playground-options textarea { width: 100%; font-family: var(--mono); font-size: 0.86rem; }
.pg-status { min-height: 1.4em; }
.pg-console { background: #1e1e1e; border-radius: var(--radius-sm); font-family: var(--mono); font-size: 0.86rem; white-space: pre-wrap; padding: 0.7rem 0.85rem; min-height: 60px; max-height: 360px; overflow-y: auto; color: #e8e8e8; }
.pg-stderr, .pg-error { color: #ff8f84; }
.pg-warning { color: #f4c26b; }
.pg-echo { color: #8cc4ff; }
.pg-inline-input { background: transparent !important; border: none !important; border-bottom: 1px solid #8cc4ff !important; border-radius: 0 !important; color: #8cc4ff; font-family: var(--mono); font-size: 0.86rem; padding: 0 2px !important; min-width: 120px; box-shadow: none !important; }
.pg-notes { margin-top: 0.5rem; background: var(--bg); border-radius: var(--radius-sm); padding: 0.55rem 0.8rem; font-size: 0.9rem; }
.terminal-note .note-label { color: var(--blue-dark); }
.editor-frame .cm-editor { border-radius: var(--radius-sm); }

.xterm-wrap { border-radius: var(--radius); overflow: hidden; background: #1e1e1e; margin: 1rem 0 0.5rem; }
.xterm-bar { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.8rem; background: #2a2a2a; color: #bdbdbd; font-family: var(--mono); font-size: 0.76rem; }
.xterm-bar .dots { display: inline-flex; gap: 5px; }
.xterm-bar .dots span { width: 10px; height: 10px; border-radius: 50%; background: #4a4a4a; }
.xterm-bar .title { flex: 1; text-align: center; }
.xterm-host { padding: 0.5rem 0.25rem 0.5rem 0.7rem; height: 340px; }
.xterm-host.tall { height: 460px; }
.xterm-host.short { height: 240px; }
.xterm-notes { background: #262626; color: #e8e8e8; padding: 0.6rem 0.9rem; font-size: 0.86rem; border-top: 1px solid #333; }
.xterm-notes .note-label { color: #8cc4ff; }
.xterm-notes button { margin-top: 0.4rem; }
.term-suggest { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin: 0.4rem 0 1rem; }
.term-suggest .label { font-size: 0.8rem; color: var(--muted); margin-right: 0.15rem; }
.term-suggest button { font-family: var(--mono); font-size: 0.8rem; border: 1px solid var(--line-strong); background: var(--bg); border-radius: 999px; padding: 0.22rem 0.65rem; cursor: pointer; }
.term-suggest button:hover { border-color: var(--blue); color: var(--blue); }
.term-task { margin: 0.6rem 0 0.2rem; }
.setup-files { margin: 0.4rem 0 0.3rem; font-size: 0.86rem; }
.setup-files summary { cursor: pointer; color: var(--blue); }
.setup-file { margin: 0.4rem 0; }
.setup-file pre { margin: 0.2rem 0 0; max-height: 300px; }

.vim-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(20, 20, 20, 0.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.vim-frame { width: min(980px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 8px; background: var(--bg); border-radius: var(--radius); padding: 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25); }
.vim-title { color: var(--muted); font-size: 0.84rem; font-family: var(--mono); }
.vim-host { min-height: 360px; overflow: auto; }
.vim-help { color: var(--muted); }

.ladder { display: flex; gap: 0.35rem; flex-wrap: wrap; margin: 0.6rem 0 0.4rem; }
.ladder-step { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.78rem; padding: 0.3rem 0.6rem; border-radius: 999px; background: var(--surface); color: var(--muted); font-weight: 550; }
.ladder-step .n { font-family: var(--mono); font-weight: 600; }
.ladder-step.current { background: var(--charcoal); color: #fff; }
.ladder-step.done { background: var(--green-soft); color: var(--green); }
.ladder-step.optional { box-shadow: inset 0 0 0 1px dashed var(--line-strong); }

.lesson-list { list-style: none; padding: 0; margin: 0.6rem 0 1.4rem; border-top: 1px solid var(--line); }
.lesson-list li { margin: 0; border-bottom: 1px solid var(--line); }
.lesson-list a { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.75rem 0.4rem; color: var(--text); text-decoration: none; }
.lesson-list a:hover { background: var(--surface); }
.lesson-list .title { flex: 1; font-weight: 550; line-height: 1.4; }
.lesson-list .title small { display: block; font-weight: 400; color: var(--muted); font-size: 0.86rem; margin-top: 0.1rem; }
.lesson-list .meta { display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.week-block { margin-bottom: 2.4rem; }
.week-block h2 { margin-bottom: 0.2rem; display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.week-block h2 .tag { font-size: 0.8rem; font-weight: 600; color: var(--muted); font-family: var(--mono); }

.today-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 0.85rem; margin: 1.2rem 0 2rem; }
.quiz-focus { margin-top: 1.2rem; }
.quiz-focus .btn-row { margin-top: 0.6rem; }
.plan-list { list-style: none; padding: 0; margin: 0.4rem 0 0; counter-reset: plan; }
.plan-list li { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.7rem 0; border-top: 1px solid var(--line); counter-increment: plan; }
.plan-list li:first-child { border-top: 0; }
.plan-list li::before { content: counter(plan); flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--surface-2); color: var(--text-2); font-size: 0.8rem; font-weight: 650; display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); }
.plan-list li.done::before { content: '\2713'; background: var(--green-soft); color: var(--green); }
.plan-list .what { flex: 1; }
.plan-list .what strong { display: block; }
.plan-list .what span { color: var(--muted); font-size: 0.9rem; }

.session-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.progress-dots { display: flex; gap: 4px; flex-wrap: wrap; }
.progress-dots span { width: 22px; height: 6px; border-radius: 999px; background: var(--surface-3); }
.progress-dots span.done { background: var(--green); }
.progress-dots span.miss { background: var(--red); }
.progress-dots span.current { background: var(--charcoal); }
.result-table td:last-child { text-align: right; font-family: var(--mono); }
.mistake { border-top: 1px solid var(--line); padding: 1rem 0; }
.mistake:first-child { border-top: 0; }
.mistake-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.2rem 0.8rem; font-size: 0.92rem; margin: 0.4rem 0 0.5rem; }
.mistake-grid dt { color: var(--muted); }
.mistake-grid dd { margin: 0; }
.mistake-grid pre { margin: 0; padding: 0.3rem 0.5rem; }
.notebook-entry { border-top: 1px solid var(--line); padding: 1.1rem 0; }
.notebook-entry textarea { width: 100%; min-height: 5rem; margin-top: 0.4rem; }
.glossary-list { display: grid; gap: 0; margin-top: 1rem; }
.glossary-item { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 1rem; padding: 0.7rem 0; border-top: 1px solid var(--line); }
.glossary-item dt { font-weight: 650; }
.glossary-item dd { margin: 0; color: var(--text-2); }
.search-input { width: 100%; padding: 0.6rem 0.8rem; font-size: 1rem; }
.tool-tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.6rem 0 1.4rem; }
.tool-tabs a { text-decoration: none; padding: 0.4rem 0.8rem; border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: 0.9rem; font-weight: 550; }
.tool-tabs a.active { background: var(--charcoal); color: #fff; }
.tool-tabs a:hover:not(.active) { background: var(--surface-2); color: var(--text); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.3rem 1rem; font-size: 0.93rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); }
.loading { color: var(--muted); padding: 3rem 0; text-align: center; }
.empty { color: var(--muted); padding: 1.2rem 0; }
.explain-box textarea { width: 100%; min-height: 4.5rem; }
.model-answer { margin-top: 0.7rem; background: var(--surface); border-radius: var(--radius-sm); padding: 0.75rem 0.9rem; }
.remember { background: var(--surface); border-radius: var(--radius); padding: 1rem 1.2rem; }
.remember ul { margin: 0.3rem 0 0; }
.done-banner { display: flex; gap: 0.9rem; align-items: center; background: var(--green-soft); border-radius: var(--radius); padding: 1rem 1.2rem; margin: 1.2rem 0; }
.done-banner i { color: var(--green); font-size: 1.4rem; }
.done-banner > div { flex: 1; }
.testout { display: flex; gap: 0.8rem; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--surface); border-radius: var(--radius); padding: 0.8rem 1rem; margin: 0 0 1.8rem; }
.testout p { margin: 0; color: var(--text-2); font-size: 0.93rem; }
.prereq-list { font-size: 0.9rem; color: var(--muted); }
.exam-nav { display: flex; flex-wrap: wrap; gap: 4px; margin: 0.6rem 0; }
.exam-dot { min-width: 30px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 5px; font-family: var(--mono); font-size: 0.75rem; background: var(--surface); color: var(--muted); text-decoration: none; }
.exam-dot.answered { background: var(--blue-soft); color: var(--blue-dark); }
.exam-dot.current { background: var(--charcoal); color: #fff; }
.timer { font-family: var(--mono); font-size: 1.15rem; font-weight: 600; }

@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-button { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar { position: fixed; z-index: 50; top: var(--topbar); left: 0; width: min(320px, 88vw); transform: translateX(-102%); transition: transform 0.18s ease; box-shadow: 0 0 30px rgba(0, 0, 0, 0.12); }
  .sidebar.open { transform: none; }
  .main { padding: 1.4rem 1rem 5rem; }
  .today-grid { grid-template-columns: minmax(0, 1fr); }
  .topnav a span { display: none; }
}
@media (max-width: 640px) {
  html, body { font-size: 15.5px; }
  h1 { font-size: 1.55rem; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .match-layout { grid-template-columns: minmax(0, 1fr); }
  .stream-diagram, .stepper, .fd-layout { grid-template-columns: minmax(0, 1fr); }
  .glossary-item { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; }
  .brand-name { display: none; }
  .bit-label { width: 52px; }
  .bit { width: 20px; }
  .bit.nibble { margin-left: 5px; }
  .playground-options { grid-template-columns: minmax(0, 1fr); }
  .annotated-row { grid-template-columns: 2.2rem minmax(0, 1fr); }
  .annotated-num { padding-right: 0.6rem; }
  .annotated-note { margin-left: 1rem; }
  .xterm-host { height: 300px; }
}
@media print {
  .topbar, .sidebar, .qcard-actions, .btn { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; }
}

.tl-page .tool-tabs { margin-top: 0; }
.tl-list-icon { width: 1.4rem; text-align: center; color: var(--muted); margin-top: 0.25rem; }
.tl-body h2 { font-size: 1.12rem; margin: 1.8rem 0 0.5rem; }
.tl-label { font-size: 0.84rem; color: var(--muted); margin: 0.6rem 0 0.3rem; }
.tl-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; margin: 0.4rem 0 0.8rem; }
.tl-field { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.88rem; color: var(--text-2); }
.tl-field.tl-wide { display: grid; gap: 0.3rem; width: 100%; margin: 0.6rem 0 0.4rem; }
.tl-field.tl-wide input { width: 100%; font-family: var(--mono); }
.tl-field.tl-grow { flex: 1 1 16rem; }
.tl-field.tl-grow input { flex: 1; min-width: 0; }
.tl-num { width: 5.5rem; }
.tl-full { width: 100%; font-family: var(--mono); }
.tl-bad, .tl-bad:focus { border-color: var(--red) !important; box-shadow: 0 0 0 3px var(--red-soft) !important; }
.tl-seg { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; }
.tl-seg button, .tl-chip { font: inherit; font-size: 0.84rem; line-height: 1.2; padding: 0.32rem 0.7rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text-2); cursor: pointer; }
.tl-chip.mono { font-family: var(--mono); font-size: 0.8rem; }
.tl-seg button:hover, .tl-chip:hover { border-color: var(--blue); color: var(--blue); }
.tl-seg button.active, .tl-chip.active { background: var(--charcoal); border-color: var(--charcoal); color: #fff; }
.tl-chip.active .faint { color: #cfcfc9; }
.tl-starters, .tl-examples { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; margin: 0.2rem 0 0.7rem; }
.tl-samples { margin: 0.1rem 0 0.6rem; }
.tl-scroll { overflow-x: auto; max-width: 100%; }
.tl-term .xterm-wrap { margin-top: 0.4rem; }
.tl-try { list-style: none; padding: 0; margin: 0.4rem 0 0; border-top: 1px solid var(--line); }
.tl-try li { display: grid; grid-template-columns: minmax(0, 17rem) minmax(0, 1fr); gap: 0.3rem 1rem; align-items: baseline; padding: 0.5rem 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; color: var(--text-2); }
.tl-cmd { justify-self: start; max-width: 100%; text-align: left; font-family: var(--mono); font-size: 0.84rem; color: var(--blue-dark); background: var(--blue-soft); border: 1px solid transparent; border-radius: var(--radius-sm); padding: 0.25rem 0.55rem; cursor: pointer; overflow-wrap: anywhere; }
.tl-cmd:hover { border-color: var(--blue); }
.tl-operands { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
.tl-operand { background: var(--surface); border-radius: var(--radius); padding: 0.75rem 0.9rem; min-width: 0; }
.tl-operand-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6rem; margin-bottom: 0.3rem; }
.tl-bitbox { display: inline-block; padding: 0.2rem 0; }
.tl-bases { display: flex; flex-wrap: wrap; gap: 0.5rem 0.9rem; margin-top: 0.5rem; }
.tl-bases .tl-field span { width: 1.8rem; color: var(--muted); font-family: var(--mono); font-size: 0.8rem; }
.tl-bases input { width: 9.5rem; font-family: var(--mono); font-size: 0.86rem; }
.tl-bases input[data-base="2"] { width: min(22rem, 70vw); }
.tl-input-error { min-height: 1.2em; margin-top: 0.2rem; }
.tl-stack { margin-top: 0.6rem; }
.tl-bits-table td, .tl-bits-table th { white-space: nowrap; }
.tl-bits-table .tl-operand-row td { color: var(--muted); }
.tl-flags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.2rem 0 0.6rem; }
.tl-flag { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.6rem; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 0.86rem; cursor: pointer; background: var(--bg); }
.tl-flag:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-dark); }
.tl-command { background: var(--surface); border-radius: var(--radius-sm); padding: 0.55rem 0.8rem; font-size: 0.9rem; overflow-x: auto; white-space: pre; margin: 0.4rem 0 0.3rem; }
.tl-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 25rem), 1fr)); gap: 0.4rem 1rem; margin-top: 0.4rem; }
.tl-split > * { min-width: 0; }
.tl-textarea { width: 100%; font-family: var(--mono); font-size: 0.86rem; line-height: 1.55; }
.tl-regex-lines { margin-top: 0; }
.tl-regex-lines .regex-line { gap: 0.5rem; }
.tl-ln { width: 1.6rem; flex-shrink: 0; text-align: right; color: var(--faint); font-size: 0.78rem; }
.tl-line-text { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-prints { flex-shrink: 0; font-family: var(--sans); font-size: 0.72rem; color: var(--blue-dark); }
.tl-output { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 0.2rem; }
.tl-perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: 0.75rem; margin-bottom: 0.4rem; }
.tl-perm-grid .panel { min-width: 0; }
.tl-perm-grid .panel + .panel { margin-top: 0; }
.tl-perm-table { display: grid; grid-template-columns: minmax(6.5rem, auto) repeat(3, 2.6rem) 3rem; gap: 6px; align-items: center; margin-top: 0.4rem; }
.tl-perm-head { text-align: center; font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.tl-perm-label { font-size: 0.88rem; color: var(--text-2); }
.tl-perm-bit { height: 2.2rem; border: 1px solid var(--line-strong); background: var(--bg); color: var(--faint); border-radius: var(--radius-sm); font-family: var(--mono); font-size: 1rem; cursor: pointer; }
.tl-perm-bit:hover { border-color: var(--blue); }
.tl-perm-bit.on { color: var(--blue-dark); border-color: var(--blue); background: var(--blue-soft); font-weight: 700; }
.tl-perm-digit { text-align: center; font-weight: 650; }
.tl-lsline { background: var(--surface); border-radius: var(--radius-sm); padding: 0.6rem 0.8rem; font-size: 0.92rem; white-space: pre; overflow-x: auto; margin-bottom: 0.7rem; }
.tl-perm-grid .kv dd { overflow-wrap: anywhere; }
.tl-perm-grid .kv { grid-template-columns: max-content minmax(0, 1fr); }
.tl-ws { color: var(--orange); }
.tl-printf-out { font-size: 1rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-printed { white-space: pre; }
.tl-files td { vertical-align: middle; padding: 0.35rem 0.5rem; }
.tl-time { width: 9.6rem; font-family: var(--mono); font-size: 0.82rem; padding: 0.25rem 0.4rem; }
.tl-make-out { min-height: 8rem; max-height: 22rem; overflow-y: auto; }
.tl-why { list-style: none; padding: 0; margin: 0.2rem 0 0; }
.tl-why li { padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.tl-why li:last-child { border-bottom: 0; }
.tl-why .chip { margin-left: 0.25rem; }
.tl-cmds { margin: 0.3rem 0 0; padding: 0.4rem 0.6rem; font-size: 0.8rem; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .tl-try li { grid-template-columns: minmax(0, 1fr); }
  .tl-perm-table { grid-template-columns: minmax(5.5rem, auto) repeat(3, 2.4rem) 2.4rem; }
  .tl-bases input { width: 8rem; }
}

.lab-intro { margin-bottom: 1.2rem; }
.lab-steps-nav { list-style: none; counter-reset: labstep; padding: 0; margin: 0.4rem 0 2.2rem; border-top: 1px solid var(--line); }
.lab-steps-nav li { counter-increment: labstep; margin: 0; border-bottom: 1px solid var(--line); }
.lab-steps-nav button { display: flex; align-items: center; gap: 0.7rem; width: 100%; text-align: left; border: 0; background: none; padding: 0.5rem 0.4rem; color: var(--text-2); cursor: pointer; font-size: 0.93rem; }
.lab-steps-nav button:hover { background: var(--surface); color: var(--text); }
.lab-steps-nav button::before { content: counter(labstep); flex: none; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-family: var(--mono); font-size: 0.75rem; display: inline-flex; align-items: center; justify-content: center; }
.lab-steps-nav li.done button::before { content: '\2713'; background: var(--green-soft); color: var(--green); }
.lab-step { padding-top: 0.4rem; }
.lab-step .section-kicker { gap: 0.5rem; }
.lab-step-foot { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center; margin-top: 1rem; }
.lab-step-toggle.is-done { color: var(--green); border-color: var(--green-line); background: var(--green-soft); }
.lab-pager { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.lab-pager .grow { flex: 1; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.25rem; min-width: 0; }
.section-head .section-kicker { margin-bottom: 0; }
.note-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.35rem; }
.note-head .note-label { margin-bottom: 0; }
.source-tag { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.74rem; line-height: 1.2; color: var(--muted); background: var(--surface); border-radius: 999px; padding: 0.24rem 0.6rem; white-space: nowrap; max-width: 62%; overflow: hidden; text-overflow: ellipsis; font-weight: 500; flex: none; }
.source-tag i { font-size: 0.72rem; }
.note .source-tag { background: rgba(255, 255, 255, 0.7); }
.source-tag.real { color: var(--teal); }
.source-tag.background { color: var(--text-2); }
.qcard-head .source-tag { background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
@media (max-width: 640px) { .source-tag { max-width: 55%; } }
