/* lk — minimal default look for the runtime's injected UI.
   Everything reads CSS custom properties; a site restyles lk by redefining the --lk-* tokens
   (or any .lk-* rule). lk never styles the page itself (body, headings, layout). */

:root {
  --lk-font: inherit;
  --lk-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --lk-bg: #faf9f6;
  --lk-surface: #ffffff;
  --lk-fg: #1c1c1a;
  --lk-muted: #5c5a54;
  --lk-line: #dcd8cf;
  --lk-accent: #2b5bc8;
  --lk-accent-fg: #ffffff;
  --lk-accent-soft: #e8eefb;
  --lk-ok: #1d6f46;
  --lk-ok-soft: #e4f3ea;
  --lk-bad: #b0271f;
  --lk-bad-soft: #fbe9e7;
  --lk-warn: #7d5200;
  --lk-warn-soft: #fcf1d8;
  --lk-mark-q: #ffd7cd;
  --lk-mark-k: #fdeea0;
  --lk-mark-d: #d7e4fd;
  --lk-mark-x: #d9f0cf;
  --lk-radius: 10px;
  --lk-radius-sm: 6px;
  --lk-hit: 44px;
  --lk-gap: 12px;
  --lk-shadow: 0 8px 28px rgb(0 0 0 / 0.14);
  --lk-top-offset: 0px;   /* measured and updated by lk: the band a sticky / fixed header covers at the top */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --lk-bg: #151618; --lk-surface: #1d1f23; --lk-fg: #ebe9e4; --lk-muted: #a8a59d; --lk-line: #393c43;
    --lk-accent: #8eaefc; --lk-accent-fg: #0d1830; --lk-accent-soft: #1d2945;
    --lk-ok: #74d19f; --lk-ok-soft: #15301f; --lk-bad: #ff8f85; --lk-bad-soft: #3b1b18; --lk-warn: #f0c35e; --lk-warn-soft: #382c10;
    --lk-mark-q: #5d2f27; --lk-mark-k: #56491a; --lk-mark-d: #243a5e; --lk-mark-x: #294826;
    --lk-shadow: 0 8px 28px rgb(0 0 0 / 0.5);
  }
}
:root[data-theme="dark"] {
  --lk-bg: #151618; --lk-surface: #1d1f23; --lk-fg: #ebe9e4; --lk-muted: #a8a59d; --lk-line: #393c43;
  --lk-accent: #8eaefc; --lk-accent-fg: #0d1830; --lk-accent-soft: #1d2945;
  --lk-ok: #74d19f; --lk-ok-soft: #15301f; --lk-bad: #ff8f85; --lk-bad-soft: #3b1b18; --lk-warn: #f0c35e; --lk-warn-soft: #382c10;
  --lk-mark-q: #5d2f27; --lk-mark-k: #56491a; --lk-mark-d: #243a5e; --lk-mark-x: #294826;
  --lk-shadow: 0 8px 28px rgb(0 0 0 / 0.5);
}

/* ---------- landing below a sticky header: the browser's own jumps (#id, scrollIntoView) keep clear of the
   covered band too. Zero specificity: a site rule wins. Do not also set scroll-padding-top on html (they add up). */
:where([data-lk], h2, h3, :target) { scroll-margin-top: calc(var(--lk-top-offset, 0px) + 12px); }

/* ---------- basics */
[data-lk-ui][hidden], [data-lk] > [data-part][hidden] { display: none !important; }
[data-lk-ui] { box-sizing: border-box; font-family: var(--lk-font); }
.lk-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:where([data-lk-ui], .lk-mark):focus-visible { outline: 3px solid var(--lk-accent); outline-offset: 2px; }
.lk-card { background: var(--lk-surface); color: var(--lk-fg); border: 1px solid var(--lk-line); border-radius: var(--lk-radius); padding: 16px 18px; margin: 16px 0; }
.lk-help { color: var(--lk-muted); font-size: 0.88em; margin: 6px 0; }
.lk-help[data-tone="bad"], p[data-tone="bad"] { color: var(--lk-bad); }
.lk-label { display: block; font-size: 0.9em; font-weight: 600; margin: 12px 0 6px; }
.lk-h { font-size: 1.1em; margin: 28px 0 10px; }
.lk-empty { padding: 16px; border: 1px dashed var(--lk-line); border-radius: var(--lk-radius); color: var(--lk-muted); background: var(--lk-surface); }
.lk-error { border: 1px dashed var(--lk-bad); color: var(--lk-bad); background: var(--lk-bad-soft); padding: 8px 12px; border-radius: var(--lk-radius-sm); font-size: 0.9em; margin: 8px 0; white-space: pre-wrap; }
.lk-fatal { margin: 12px; }
html[data-lk-debug] [data-lk] { outline: 1px dashed var(--lk-accent); outline-offset: 4px; }

/* ---------- buttons and fields */
.lk-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--lk-hit); padding: 0 16px;
  border: 1px solid var(--lk-line); border-radius: var(--lk-radius-sm); background: var(--lk-surface); color: var(--lk-fg);
  font: inherit; font-size: 0.95em; line-height: 1.2; cursor: pointer; text-decoration: none; text-align: center;
}
.lk-btn:hover:not(:disabled) { border-color: var(--lk-accent); }
.lk-btn[data-variant="primary"] { background: var(--lk-accent); border-color: var(--lk-accent); color: var(--lk-accent-fg); font-weight: 600; }
.lk-btn[data-variant="primary"]:hover:not(:disabled) { filter: brightness(1.08); }
.lk-btn[data-variant="ghost"] { background: transparent; border-color: transparent; color: var(--lk-accent); }
.lk-btn[data-variant="ghost"]:hover:not(:disabled) { background: var(--lk-accent-soft); }
.lk-btn[data-variant="danger"] { color: var(--lk-bad); border-color: var(--lk-bad); background: transparent; }
.lk-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.lk-icon-btn { display: inline-grid; place-items: center; min-width: var(--lk-hit); min-height: var(--lk-hit); border: 1px solid var(--lk-line); border-radius: var(--lk-radius-sm); background: var(--lk-surface); color: var(--lk-fg); font: inherit; font-size: 1.1em; cursor: pointer; }
.lk-icon-btn:disabled { opacity: 0.35; cursor: default; }
.lk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.lk-input, .lk-ta, [data-lk-ui] select {
  min-height: var(--lk-hit); padding: 8px 12px; border: 1px solid var(--lk-line); border-radius: var(--lk-radius-sm);
  background: var(--lk-surface); color: var(--lk-fg); font: inherit;
}
.lk-input { width: min(14em, 100%); font-variant-numeric: tabular-nums; }
.lk-ta { display: block; width: 100%; min-height: 4.5em; resize: vertical; line-height: 1.5; }
.lk-input:disabled, .lk-ta:disabled { opacity: 1; background: var(--lk-bg); color: var(--lk-fg); }
.lk-badge { display: inline-block; padding: 2px 9px; border: 1px solid var(--lk-line); border-radius: 999px; font-size: 0.8em; line-height: 1.6; color: var(--lk-muted); }
.lk-badge[data-level="shaky"] { border-color: var(--lk-warn); color: var(--lk-warn); }
.lk-badge[data-tone="bad"], .lk-badge[data-level="new"] { border-color: var(--lk-bad); color: var(--lk-bad); }
.lk-badge[data-level="known"] { border-color: var(--lk-ok); color: var(--lk-ok); }

/* ---------- questions */
.lk-mq-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 0.85em; color: var(--lk-muted); }
.lk-topic { color: var(--lk-muted); }
.lk-mq-state { margin-left: auto; font-weight: 600; }
.lk-mq[data-state="right"] .lk-mq-state { color: var(--lk-ok); }
.lk-mq[data-state="wrong"] .lk-mq-state { color: var(--lk-bad); }
.lk-mq-stem { margin: 10px 0 14px; font-size: 1.02em; line-height: 1.6; }
.lk-mq-stem > :first-child { margin-top: 0; }
.lk-mq-stem > :last-child { margin-bottom: 0; }
.lk-opts { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
.lk-opt {
  display: flex; align-items: flex-start; gap: 10px; min-height: var(--lk-hit); padding: 10px 12px;
  border: 1px solid var(--lk-line); border-radius: var(--lk-radius-sm); background: var(--lk-surface); cursor: pointer; line-height: 1.5;
}
.lk-opt input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--lk-accent); }
.lk-opt-key { flex: none; min-width: 1.1em; font-weight: 600; color: var(--lk-muted); }
.lk-opt-text > :first-child { margin-top: 0; }
.lk-opt-text > :last-child { margin-bottom: 0; }
.lk-opt:hover { border-color: var(--lk-accent); }
.lk-opt:has(input:checked) { border-color: var(--lk-accent); background: var(--lk-accent-soft); }
.lk-opt:has(input:disabled) { cursor: default; }
.lk-opt-row[data-correct="true"] .lk-opt { border-color: var(--lk-ok); background: var(--lk-ok-soft); }
.lk-opt-row[data-picked="true"][data-correct="false"] .lk-opt { border-color: var(--lk-bad); background: var(--lk-bad-soft); }
.lk-why { margin: 6px 4px 2px 42px; font-size: 0.92em; line-height: 1.55; }
.lk-why-tag { font-weight: 600; }
.lk-opt-row[data-correct="true"] .lk-why-tag { color: var(--lk-ok); }
.lk-opt-row[data-picked="true"][data-correct="false"] .lk-why-tag { color: var(--lk-bad); }
.lk-num-row { display: flex; align-items: center; gap: 8px; }
.lk-unit { color: var(--lk-muted); }
.lk-order { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; counter-reset: lk-o; }
.lk-order-item { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 12px; border: 1px solid var(--lk-line); border-radius: var(--lk-radius-sm); background: var(--lk-surface); }
.lk-order-item::before { counter-increment: lk-o; content: counter(lk-o); flex: none; min-width: 1.2em; font-weight: 600; color: var(--lk-muted); }
.lk-order-text { flex: 1; min-width: 0; }
.lk-order-btns { display: flex; gap: 4px; }
.lk-order-item[data-ok="true"] { border-color: var(--lk-ok); background: var(--lk-ok-soft); }
.lk-order-item[data-ok="false"] { border-color: var(--lk-bad); background: var(--lk-bad-soft); }
.lk-hints { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.lk-hint { padding: 8px 12px; border-left: 3px solid var(--lk-accent); background: var(--lk-accent-soft); border-radius: 0 var(--lk-radius-sm) var(--lk-radius-sm) 0; line-height: 1.55; }
.lk-hint-n { font-weight: 600; margin-right: 8px; }
.lk-submit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lk-submit-label { color: var(--lk-muted); font-size: 0.9em; }
.lk-conf-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.lk-conf-btn { border-color: var(--lk-accent); color: var(--lk-accent); font-weight: 600; }
.lk-conf-btn:hover:not(:disabled) { background: var(--lk-accent-soft); }
.lk-conf-btn[aria-pressed="true"] { background: var(--lk-accent); color: var(--lk-accent-fg); opacity: 1; }
.lk-help-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lk-help-toggle::after { content: ""; width: 0.4em; height: 0.4em; margin: 0 0 0.2em 2px; border-right: 2px solid; border-bottom: 2px solid; transform: rotate(45deg); }
.lk-help-toggle[aria-expanded="true"]::after { margin: 0.25em 0 0 2px; transform: rotate(-135deg); }
.lk-help-menu { display: flex; flex-wrap: wrap; gap: 6px; }
.lk-fb { margin-top: 12px; line-height: 1.6; }
.lk-fb:empty { display: none; }
.lk-fb[data-tone="nudge"] { color: var(--lk-warn); font-weight: 600; }
.lk-verdict { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0 0 8px; }
.lk-verdict-icon { display: inline-grid; place-items: center; width: 1.5em; height: 1.5em; border-radius: 50%; font-weight: 700; font-size: 0.9em; color: var(--lk-surface); background: var(--lk-muted); }
.lk-verdict[data-ok="true"] .lk-verdict-icon { background: var(--lk-ok); }
.lk-verdict[data-ok="false"] .lk-verdict-icon { background: var(--lk-bad); }
.lk-verdict[data-ok="true"] strong { color: var(--lk-ok); }
.lk-verdict[data-ok="false"] strong { color: var(--lk-bad); }
.lk-solution, .lk-ref { margin-top: 10px; padding: 10px 14px; border-radius: var(--lk-radius-sm); background: var(--lk-bg); border: 1px solid var(--lk-line); }
.lk-solution > :first-child, .lk-ref > :first-child { margin-top: 0; }
.lk-solution > :last-child, .lk-ref > :last-child { margin-bottom: 0; }
.lk-ref-h { font-weight: 600; margin: 0 0 6px; }
.lk-sched { color: var(--lk-muted); font-size: 0.85em; margin: 10px 0 0; }
.lk-selfgrade { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.lk-after { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.lk-after:empty { display: none; }
.lk-retry-slot > .lk-mq { border-style: dashed; }

/* ---------- predict / checkpoint */
.lk-predict { margin: 12px 0; }
.lk-predict-opts { display: grid; gap: 8px; }
.lk-predict-opt {
  display: block; width: 100%; min-height: var(--lk-hit); padding: 10px 14px; text-align: left; line-height: 1.5;
  border: 1px solid var(--lk-line); border-radius: var(--lk-radius-sm); background: var(--lk-surface); color: var(--lk-fg); font: inherit; cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}
.lk-predict-opt:hover:not(:disabled) { border-color: var(--lk-accent); background: var(--lk-accent-soft); }
.lk-predict-opt:disabled { cursor: default; }
.lk-predict-opt[data-picked="true"] { border-width: 2px; border-color: var(--lk-accent); background: var(--lk-accent-soft); }
.lk-predict-opt[data-correct="true"] { border-color: var(--lk-ok); background: var(--lk-ok-soft); }
.lk-predict-opt[data-picked="true"][data-correct="false"] { border-color: var(--lk-bad); background: var(--lk-bad-soft); }
.lk-predict-opt[data-picked="true"]::after { content: " ←"; font-weight: 700; }
.lk-predict-msg { font-weight: 600; margin: 10px 0 0; }
.lk-predict-msg:empty { display: none; }
[data-lk="predict"][data-state="right"] .lk-predict-msg { color: var(--lk-ok); }
[data-lk="predict"][data-state="wrong"] .lk-predict-msg { color: var(--lk-bad); }
.lk-cp { margin-top: 8px; }
.lk-cp-note { margin: 6px 0; padding-left: 12px; border-left: 3px solid var(--lk-line); }
[data-lk-flash] { animation: lk-flash 1.8s ease-out; }
@keyframes lk-flash { from { background-color: var(--lk-accent-soft); } to { background-color: transparent; } }

/* ---------- highlights */
.lk-mark { color: inherit; border-radius: 2px; padding: 0 1px; cursor: pointer; background: var(--lk-mark-k); }
.lk-mark[data-color="q"] { background: var(--lk-mark-q); }
.lk-mark[data-color="d"] { background: var(--lk-mark-d); }
.lk-mark[data-color="x"] { background: var(--lk-mark-x); }
.lk-mark[data-note] { text-decoration: underline dotted; text-underline-offset: 3px; }
.lk-hl-bar { position: absolute; z-index: 1000; display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; max-width: calc(100vw - 16px); background: var(--lk-surface); border: 1px solid var(--lk-line); border-radius: var(--lk-radius); box-shadow: var(--lk-shadow); }
.lk-hl-bar button { min-height: var(--lk-hit); min-width: var(--lk-hit); padding: 0 10px; border: 0; border-radius: var(--lk-radius-sm); background: transparent; color: var(--lk-fg); font: inherit; font-size: 0.9em; cursor: pointer; }
.lk-hl-bar button:hover { background: var(--lk-accent-soft); }
.lk-hl-color { box-shadow: inset 0 -5px 0 var(--lk-mark-k); }
.lk-hl-color[data-color="q"], .lk-chip[data-color="q"] { box-shadow: inset 0 -5px 0 var(--lk-mark-q); }
.lk-hl-color[data-color="d"], .lk-chip[data-color="d"] { box-shadow: inset 0 -5px 0 var(--lk-mark-d); }
.lk-hl-color[data-color="x"], .lk-chip[data-color="x"] { box-shadow: inset 0 -5px 0 var(--lk-mark-x); }
.lk-chip[data-color="k"] { box-shadow: inset 0 -5px 0 var(--lk-mark-k); }
.lk-hl-card { position: absolute; z-index: 1000; width: min(380px, calc(100vw - 16px)); margin: 0; box-shadow: var(--lk-shadow); }
.lk-hl-quote { margin: 0 0 8px; padding-left: 12px; border-left: 3px solid var(--lk-line); color: var(--lk-muted); line-height: 1.55; }

/* ---------- chips, dialogs */
.lk-chips { border: 0; padding: 0; margin: 10px 0; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.lk-chips > legend { font-size: 0.9em; font-weight: 600; margin-bottom: 6px; padding: 0; }
.lk-chip { display: inline-flex; align-items: center; gap: 6px; min-height: var(--lk-hit); padding: 4px 12px; border: 1px solid var(--lk-line); border-radius: 999px; cursor: pointer; line-height: 1.25; }
.lk-chip input { accent-color: var(--lk-accent); margin: 0; }
.lk-chip small { display: block; color: var(--lk-muted); font-size: 0.78em; }
.lk-chip:has(input:checked) { border-color: var(--lk-accent); background: var(--lk-accent-soft); }
.lk-chip:has(input:focus-visible) { outline: 3px solid var(--lk-accent); outline-offset: 2px; }
dialog.lk-ask { width: min(720px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--lk-line); border-radius: var(--lk-radius); background: var(--lk-surface); color: var(--lk-fg); box-shadow: var(--lk-shadow); }
dialog.lk-ask::backdrop, dialog.lk-lightbox::backdrop { background: rgb(0 0 0 / 0.45); }
.lk-ask-inner { padding: 14px 20px 18px; }
.lk-ask-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lk-ask-head h2 { font-size: 1.15em; margin: 0; }
.lk-ask-text { font-family: var(--lk-mono); font-size: 0.85em; min-height: 12em; }
.lk-ask-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.lk-ask-grade { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--lk-line); }
dialog.lk-lightbox { max-width: 96vw; max-height: 96dvh; padding: 8px; border: 0; border-radius: var(--lk-radius); background: var(--lk-surface); color: var(--lk-fg); }
dialog.lk-lightbox img { display: block; max-width: 100%; max-height: 84dvh; object-fit: contain; margin: 0 auto; }
dialog.lk-lightbox .lk-icon-btn { float: right; }
/* A figure reserves its box before its image arrives. One image with a width attribute: the figure is that wide (never
   wider than the column; lk sets --lk-fig-w from the attribute); otherwise it takes the column. The image scales inside it
   with the aspect ratio of its width / height attributes. Not width: fit-content — that is measured from the loaded image,
   so a lazy image that arrives later moves everything below it. All zero-specificity defaults a site rule overrides. */
.lk-fig { position: relative; max-width: 100%; }
:where(.lk-fig) { width: var(--lk-fig-w, auto); }
:where(.lk-fig img) { max-width: 100%; height: auto; }
.lk-fig-zoom { position: absolute; top: 8px; right: 8px; min-width: var(--lk-hit); min-height: var(--lk-hit); border: 1px solid var(--lk-line); border-radius: 50%; background: color-mix(in srgb, var(--lk-surface) 88%, transparent); color: var(--lk-fg); font-size: 1.1em; cursor: pointer; }
.lk-status { position: fixed; left: 12px; bottom: 12px; z-index: 999; max-width: min(440px, calc(100vw - 24px)); padding: 10px 14px; border: 1px solid var(--lk-warn); border-radius: var(--lk-radius-sm); background: var(--lk-warn-soft); color: var(--lk-warn); font-size: 0.9em; line-height: 1.45; }

/* ---------- labs */
.lk-canvas { display: block; width: 100%; height: auto; max-width: 100%; border-radius: var(--lk-radius-sm); touch-action: pan-y; }
.lk-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-top: 10px; }
.lk-ctl { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: var(--lk-hit); max-width: 100%; }
.lk-ctl-label { font-size: 0.92em; }
.lk-ctl input[type="range"] { width: min(220px, 48vw); min-width: 0; flex: 1 1 120px; accent-color: var(--lk-accent); min-height: var(--lk-hit); }
.lk-ctl input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--lk-accent); }
.lk-ctl-out { min-width: 3.5em; font-variant-numeric: tabular-nums; color: var(--lk-muted); }
/* api.canvas(w, h, {fit: 'box'}): the site's CSS decides width and height; without a height the w:h aspect (zero specificity) */
:where(.lk-canvas[data-fit="box"]) { aspect-ratio: var(--lk-canvas-aspect, auto); }
/* handle.enable(false): still visible, not usable by the reader (tours still drive it) */
.lk-ctl[data-disabled] { opacity: 0.5; }
.lk-ctl[data-disabled] :is(input, select), button.lk-ctl[data-disabled] { cursor: not-allowed; }
/* data-gate: the note inside a lab whose prediction gate has not been answered yet */
.lk-gate-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 10px; padding: 6px 12px; border: 1px dashed var(--lk-line); border-radius: var(--lk-radius-sm); color: var(--lk-muted); font-size: 0.92em; }
.lk-gate-text { flex: 1 1 14em; min-width: 0; }

/* ---------- review, progress, notes, unit nav */
.lk-review-count { font-weight: 600; }
.lk-review-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.lk-review-top progress { flex: 1 1 120px; height: 8px; accent-color: var(--lk-accent); }
.lk-review-pos { font-variant-numeric: tabular-nums; color: var(--lk-muted); }
.lk-review-filter { display: inline-flex; align-items: center; gap: 8px; }
.lk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.lk-stat { padding: 14px 16px; border: 1px solid var(--lk-line); border-radius: var(--lk-radius); background: var(--lk-surface); }
.lk-stat-v { font-size: 2em; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.lk-stat-l { font-weight: 600; margin-top: 4px; }
.lk-stat-n, .lk-stat-cmp { color: var(--lk-muted); font-size: 0.85em; margin-top: 4px; }
.lk-stat-warn { color: var(--lk-bad); font-weight: 600; }
.lk-rows { list-style: none; margin: 0; padding: 0; }
.lk-row { padding: 10px 0; border-bottom: 1px solid var(--lk-line); }
.lk-row-inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lk-row-inline > .lk-badge { flex: none; white-space: nowrap; }   /* a long name wraps, the badge stays one pill */
.lk-row-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lk-bar { display: flex; height: 10px; margin: 8px 0 6px; border-radius: 999px; overflow: hidden; background: var(--lk-line); }
.lk-bar-seg[data-level="mastered"] { background: var(--lk-ok); }
.lk-bar-seg[data-level="learning"] { background: var(--lk-accent); }
.lk-bar-seg[data-level="weak"] { background: var(--lk-bad); }
.lk-bar-seg[data-level="new"] { background: transparent; }
.lk-row-counts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.82em; color: var(--lk-muted); }
.lk-row-counts span::before { content: ""; display: inline-block; width: 0.7em; height: 0.7em; margin-right: 5px; border-radius: 2px; vertical-align: -0.05em; border: 1px solid var(--lk-line); }
.lk-row-counts [data-level="mastered"]::before { background: var(--lk-ok); }
.lk-row-counts [data-level="learning"]::before { background: var(--lk-accent); }
.lk-row-counts [data-level="weak"]::before { background: var(--lk-bad); }
.lk-note { padding: 12px 0; border-bottom: 1px solid var(--lk-line); }
.lk-note .lk-mq-head a { margin-left: auto; }
.lk-note-text { margin: 6px 0 0; }
.lk-diag-start { font-weight: 600; margin-top: 14px; }
.lk-unitnav { margin: 32px 0; }
.lk-unitnav-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lk-unitnav-link { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: var(--lk-hit); padding: 10px 14px; border: 1px solid var(--lk-line); border-radius: var(--lk-radius); background: var(--lk-surface); color: var(--lk-fg); text-decoration: none; }
.lk-unitnav-link:hover { border-color: var(--lk-accent); }
.lk-unitnav-link small { color: var(--lk-muted); }
.lk-unitnav-link[data-rel="next"] { text-align: right; grid-column: 2; }
.lk-unitnav-map { margin-top: 12px; }
.lk-unitnav-map summary { display: flex; align-items: center; min-height: var(--lk-hit); cursor: pointer; color: var(--lk-accent); }
.lk-unitnav-map ol { margin: 4px 0 0; padding-left: 1.6em; }
.lk-unitnav-map li > a, .lk-unitnav-map li > span { display: inline-flex; align-items: center; min-height: var(--lk-hit); }
.lk-unitnav-map li[data-state="current"] { font-weight: 600; }
.lk-unitnav-map small { color: var(--lk-muted); font-weight: 400; }

/* ---------- modes */
@media (prefers-reduced-motion: reduce) {
  [data-lk-ui], [data-lk-flash] { transition: none !important; animation: none !important; }
}
html[data-lk-shot] [data-lk-ui], html[data-lk-shot] [data-lk-flash] { transition: none !important; animation: none !important; }
html[data-lk-film] :is(.lk-hl-bar, .lk-hl-card, .lk-status, .lk-help-wrap, .lk-fig-zoom) { display: none !important; }

/* D13: printing never shows hints, answers or explanations of unanswered questions, nor any controls. */
@media print {
  :is(.lk-hl-bar, .lk-hl-card, .lk-status, .lk-actions, .lk-after, .lk-help-wrap, .lk-fig-zoom, .lk-controls, .lk-unitnav-map, dialog) { display: none !important; }
  .lk-mq[data-state="open"] :is(.lk-hints, .lk-fb, .lk-why, .lk-solution, .lk-ref) { display: none !important; }
  [data-lk="predict"]:not([data-state]) > [data-part="reveal"] { display: none !important; }
  .lk-card, .lk-stat { break-inside: avoid; box-shadow: none; }
}
