:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dde1e7;
  --text: #17202b;
  --muted: #5d6877;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e3f3f1;
  --ok: #15803d;
  --ok-soft: #e4f5ea;
  --cue: #a16207;
  --cue-soft: #fbf1d9;
  --bad: #b91c1c;
  --bad-soft: #fbe7e7;
  --m0: #eceff3;
  --m1: #f9d9c4;
  --m2: #f4dc8c;
  --m3: #b9dea4;
  --m4: #5fbf9a;
  --m5: #1d7f68;
  --m-ink: #17202b;
  --m5-ink: #ffffff;
  --hy: #7c3aed;
  --hy-soft: #f1eafe;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .06);
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141a;
    --surface: #161d25;
    --surface-2: #1d2630;
    --border: #2a3542;
    --text: #e6ebf1;
    --muted: #93a0b0;
    --accent: #2dd4bf;
    --accent-ink: #0b1a18;
    --accent-soft: #12302d;
    --ok: #4ade80;
    --ok-soft: #143323;
    --cue: #fbbf24;
    --cue-soft: #3a2f12;
    --bad: #f87171;
    --bad-soft: #3b1a1a;
    --m0: #1d2630;
    --m1: #5b3626;
    --m2: #6a5820;
    --m3: #3d6b39;
    --m4: #2b9273;
    --m5: #4fe0b0;
    --m-ink: #e6ebf1;
    --m5-ink: #0b1a18;
    --hy: #c4b5fd;
    --hy-soft: #2a2145;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.7rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
kbd {
  font: 11px var(--mono);
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
}
.muted { color: var(--muted); }
.small { font-size: .85em; }
.lead { font-size: 1.05rem; }
.mini { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1rem 0 .4rem; }
.warn { background: var(--cue-soft); color: var(--cue); padding: .6rem 1rem; text-align: center; }

/* Layout */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .7rem max(16px, calc((100vw - 1100px) / 2));
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: .5rem; }
.brand-mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); font-size: 14px; }
.topbar nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); text-decoration: none; padding: .35rem .7rem; border-radius: 8px; font-size: .92rem; }
.topbar nav a:hover { background: var(--surface-2); color: var(--text); }
.topbar nav a[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 1.5rem 16px 4rem; }
.wrap.narrow { max-width: 720px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow); margin-bottom: 1rem; min-width: 0;
}
.grid2 > .card { margin-bottom: 0; }
.card-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.card-head h2, .card-head h3 { margin: 0; margin-right: auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin-bottom: .2rem; }
.crumb { margin: 0 0 .3rem; font-size: .85rem; color: var(--muted); }
.crumb a { color: var(--muted); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.actions.left { justify-content: flex-start; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
  font: inherit; font-weight: 600; font-size: .92rem;
  padding: .55rem 1rem; border-radius: 9px; cursor: pointer; text-decoration: none;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.primary kbd { background: transparent; color: inherit; border-color: currentColor; opacity: .8; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn.small { padding: .35rem .7rem; font-size: .85rem; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; box-shadow: var(--shadow); min-width: 0; }
.tile-label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.tile-value { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: .1rem 0; }
.tile-sub { font-size: .82rem; color: var(--muted); }

/* Mastery colours */
.m0 { background: var(--m0); color: var(--muted); }
.m1 { background: var(--m1); color: var(--m-ink); }
.m2 { background: var(--m2); color: var(--m-ink); }
.m3 { background: var(--m3); color: var(--m-ink); }
.m4 { background: var(--m4); color: var(--m-ink); }
.m5 { background: var(--m5); color: var(--m5-ink); }
rect.m1 { fill: var(--m1); } rect.m2 { fill: var(--m2); } rect.m3 { fill: var(--m3); } rect.m4 { fill: var(--m4); } rect.m5 { fill: var(--m5); }
.pill { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .55rem; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.lv1 { background: var(--m1); color: var(--m-ink); }
.pill.lv2 { background: var(--m2); color: var(--m-ink); }
.pill.lv3 { background: var(--m3); color: var(--m-ink); }
.pill.lv4 { background: var(--m4); color: var(--m-ink); }
.pill.lv5 { background: var(--m5); color: var(--m5-ink); }
.dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; margin-right: .45rem; vertical-align: baseline; flex: none; }
.dot.m0 { border: 1px dashed var(--muted); background: transparent; }

/* Due list */
.due-list { list-style: none; margin: 0; padding: 0; }
.due-item { display: flex; align-items: center; gap: .75rem; padding: .5rem .6rem; border-radius: 8px; color: var(--text); text-decoration: none; }
.due-item:hover { background: var(--surface-2); }
.due-title { font-weight: 600; margin-right: auto; }

/* Heatmap */
.heat-group { margin-bottom: .5rem; }
.heat-row { display: grid; grid-template-columns: minmax(150px, 230px) 1fr 110px; gap: .75rem; align-items: center; padding: .3rem 0; }
.heat-name { color: var(--text); font-weight: 600; text-decoration: none; font-size: .92rem; }
.heat-name:hover { color: var(--accent); text-decoration: underline; }
.cells { display: flex; gap: 3px; min-width: 0; }
.cell {
  flex-basis: 0; min-width: 30px; height: 38px; border-radius: 6px; text-decoration: none;
  display: flex; flex-direction: column; justify-content: center; padding: 0 .4rem; overflow: hidden;
  font-size: .72rem; line-height: 1.15; transition: transform .1s;
}
.cell span { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell small { opacity: .75; }
a.cell:hover { transform: translateY(-1px); outline: 2px solid var(--accent); }
.cell.m0 { background: repeating-linear-gradient(135deg, var(--m0) 0 6px, var(--surface-2) 6px 12px); border: 1px dashed var(--border); }
.heat-meta { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; }
@media (max-width: 700px) {
  .heat-row { grid-template-columns: 1fr auto; grid-template-areas: "name meta" "cells cells"; gap: .3rem .75rem; padding: .5rem 0; border-bottom: 1px solid var(--border); }
  .heat-name { grid-area: name; }
  .cells { grid-area: cells; }
  .heat-meta { grid-area: meta; flex-direction: row; align-items: center; gap: .5rem; }
  .cell { min-width: 24px; padding: 0 .25rem; }
}
.legend { display: flex; flex-wrap: wrap; gap: .3rem .8rem; font-size: .75rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .3rem; }
.legend i.cell { display: inline-block; width: 14px; min-width: 14px; height: 14px; padding: 0; border-radius: 3px; }

/* Activity calendar */
.cal { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; width: 100%; max-width: 460px; }
.cal .day { aspect-ratio: 1; border-radius: 3px; background: var(--surface-2); }
.cal .d1 { background: var(--m2); } .cal .d2 { background: var(--m3); } .cal .d3 { background: var(--m4); } .cal .d4 { background: var(--m5); }

/* Tables */
.table-wrap { overflow-x: auto; }
table.steps { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.steps th { text-align: left; font-weight: 600; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; padding: .4rem .5rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.steps td { padding: .45rem .5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.steps tr:last-child td { border-bottom: 0; }
table.steps.fixed { table-layout: fixed; min-width: 640px; }
table.steps.fixed .c-n { width: 2.2em; }
table.steps.fixed .c-m { width: 140px; }
table.steps.fixed .c-s { width: 56px; }
table.steps.fixed .c-t { width: 70px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
thtable.steps.fixed { table-layout: fixed; min-width: 640px; }
table.steps.fixed .c-n { width: 2.2em; }
table.steps.fixed .c-m { width: 140px; }
table.steps.fixed .c-s { width: 56px; }
table.steps.fixed .c-t { width: 70px; }
.num { text-align: right; }
.ok-t { color: var(--ok); } .cue-t { color: var(--cue); } .bad-t { color: var(--bad); }
.bar { display: inline-block; width: 70px; height: 7px; background: var(--surface-2); border-radius: 4px; overflow: hidden; vertical-align: middle; margin-right: .4rem; }
.bar i { display: block; height: 100%; }
.tbar { display: inline-block; width: 100%; max-width: 160px; min-width: 60px; height: 7px; background: var(--surface-2); border-radius: 4px; overflow: hidden; vertical-align: middle; }
.tbar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

.weak { margin: 0; padding-left: 1.3rem; }
.weak li { margin: .35rem 0; }
.runs { list-style: none; padding: 0; margin: .5rem 0 0; font-size: .86rem; }
.runs a { display: grid; grid-template-columns: 80px 1fr 64px 92px 64px 36px; gap: .5rem; padding: .35rem .3rem; color: var(--text); text-decoration: none; border-radius: 6px; font-variant-numeric: tabular-nums; }
.runs a:hover { background: var(--surface-2); }
.runs a span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .runs a { grid-template-columns: 1fr auto auto; } .runs a span:nth-child(1), .runs a span:nth-child(5) { display: none; } }
.trend { margin: 0 0 .5rem; }
.trend svg { width: 100%; height: 90px; display: block; background: var(--surface-2); border-radius: 8px; }

/* Checklist (study + results) */
details.study summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
details.study summary::-webkit-details-marker { display: none; }
details.study summary h2 { margin: 0; }
details.study summary h2::before { content: "▸ "; color: var(--muted); }
details.study[open] summary h2::before { content: "▾ "; }
details.study[open] summary { margin-bottom: 1rem; }
.cl-section { margin-bottom: 1.2rem; }
.cl-section h3 { margin-bottom: .4rem; }
ol.cl { margin: 0; padding: 0; list-style: none; counter-reset: cl; }
ol.cl li { counter-increment: cl; position: relative; padding: .5rem .6rem .5rem 2.4rem; border-radius: 8px; margin-bottom: 3px; background: var(--surface-2); }
ol.cl li::before { content: counter(cl); position: absolute; left: .7rem; top: .55rem; font: 600 .78rem var(--mono); color: var(--muted); }
ol.cl li.ok { background: var(--ok-soft); }
ol.cl li.cue { background: var(--cue-soft); }
ol.cl li.bad { background: var(--bad-soft); }
.cl-main { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.detail { color: var(--muted); font-size: .88rem; margin-top: .1rem; }
.cl-stat { display: flex; align-items: center; gap: .4rem; flex: none; width: 300px; justify-content: flex-end; flex-wrap: wrap; }
.cl-stat .tbar { width: 100px; min-width: 0; }
.cl-stat .small { width: 3.5em; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .cl-main { flex-direction: column; gap: .3rem; } .cl-stat { width: 100%; justify-content: flex-start; } }
.tag { font-size: .7rem; font-weight: 600; padding: .05rem .45rem; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); }
.tag.ok { color: var(--ok); border-color: currentColor; }
.tag.cue { color: var(--cue); border-color: currentColor; }
.tag.bad { color: var(--bad); border-color: currentColor; }
.tag.slow { color: var(--cue); }
.tips { background: var(--accent-soft); border-radius: 10px; padding: .8rem 1rem; }
.tips h3 { margin-bottom: .3rem; }
.tips ul { margin: 0; padding-left: 1.2rem; }
.tips li { margin: .25rem 0; }

/* Play */
.play { min-height: 100vh; display: flex; flex-direction: column; }
.play-bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .75rem;
  padding: .6rem 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.play-title { margin-right: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.play-stats { display: flex; gap: 1rem; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.play-stats b { color: var(--text); font-family: var(--mono); font-size: 1.05rem; }
@media (max-width: 560px) { .play-title { display: none; } .play-bar { justify-content: space-between; } .play-stats { gap: .7rem; } }
.play-main { flex: 1; width: 100%; max-width: 900px; margin: 0 auto; padding: 1rem 16px 1rem; }
.outline { display: flex; flex-direction: column; gap: .6rem; }
.osec { border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem .9rem; background: var(--surface); transition: opacity .2s; }
.osec.future { opacity: .55; }
.osec.current { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); opacity: 1; }
.osec-head { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .45rem; }
.osec-head h2 { margin: 0; font-size: 1rem; }
.osec.current .osec-head h2 { color: var(--accent); }
.osec-head .count { font: 600 .9rem var(--mono); color: var(--muted); margin-right: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; padding: .22rem .6rem; border-radius: 7px; border: 1px solid transparent; }
.chip em { font: normal 600 .7rem var(--mono); opacity: .6; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.cue { background: var(--cue-soft); color: var(--cue); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.hint { background: var(--cue-soft); color: var(--cue); font-family: var(--mono); letter-spacing: .05em; }
.chip.empty { min-width: 2.3rem; justify-content: center; border: 1px dashed var(--border); color: var(--muted); }
.chip.empty.next { border-color: var(--accent); border-style: solid; }
.chip.pop { animation: pop .35s ease-out; }
@keyframes pop { 0% { transform: scale(.85); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }

.play-input {
  position: sticky; bottom: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--border);
  padding: .7rem 16px calc(.7rem + env(safe-area-inset-bottom));
}
.play-input > * { max-width: 900px; margin-left: auto; margin-right: auto; }
.play-input form { display: flex; gap: .5rem; }
.play-input input {
  flex: 1; min-width: 0; font: inherit; font-size: 1.15rem; padding: .7rem .9rem;
  border: 2px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text);
}
.play-input input:focus { border-color: var(--accent); outline: none; }
.play-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-top: .5rem; }
.play-actions .mode { margin-left: auto; }
.fb { min-height: 1.6em; font-weight: 600; margin-bottom: .4rem; font-size: .95rem; }
.fb.ok { color: var(--ok); } .fb.bad { color: var(--bad); } .fb.warn { color: var(--cue); }
.shake { animation: shake .3s; border-color: var(--bad) !important; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .shake, .chip.pop { animation: none; } }

.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(10, 14, 20, .55); display: grid; place-items: center; padding: 16px; }
.overlay[hidden] { display: none; }
.overlay-box { background: var(--surface); border-radius: var(--radius); padding: 1.5rem 2rem; text-align: center; max-width: 360px; }

/* Forms & prose */
.form { display: flex; flex-direction: column; gap: 1rem; }
.check { display: flex; gap: .7rem; align-items: flex-start; cursor: pointer; }
.check input { margin-top: .3rem; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field select, .field input { font: inherit; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); max-width: 100%; }
.prose { max-width: 760px; }
.prose li { margin: .45rem 0; }
.prose h2 { margin-top: 1.8rem; }
.steps-plan li::marker { font-weight: 700; color: var(--accent); }

/* Touch screens: no physical keyboard, so hide shortcut badges. */
@media (hover: none) and (pointer: coarse) {
  .play-actions kbd, .btn.primary kbd { display: none; }
}

/* High-yield steps */
.star { color: var(--hy); margin-right: .3rem; font-style: normal; }
.hy-legend { color: var(--hy); font-weight: 600; margin: 0 0 .6rem; }
ol.cl li.hy { box-shadow: inset 3px 0 0 var(--hy); }
ol.cl li.hy b { color: var(--hy); }
table.steps tr.hy td:nth-child(2) { color: var(--hy); font-weight: 600; }
.chip.hy { box-shadow: inset 0 0 0 1.5px var(--hy); }
.chip.hy::before { content: "★"; color: var(--hy); font-size: .75em; }
.chip.empty.hy { border-color: var(--hy); }
.btn.hy-btn { color: var(--hy); border-color: var(--hy); }
.btn.hy-btn:hover { background: var(--hy-soft); }
.pill.hy-pill { background: var(--hy-soft); color: var(--hy); }

/* Score pills, tabs, cram banner */
.score-pill { display: inline-grid; place-items: center; min-width: 2.4rem; height: 1.6rem; padding: 0 .4rem; border-radius: 7px; font: 700 .85rem var(--mono); background: var(--surface-2); color: var(--muted); border: 1px dashed var(--border); }
.score-pill.lv1 { background: var(--m1); color: var(--m-ink); border: 0; }
.score-pill.lv2 { background: var(--m2); color: var(--m-ink); border: 0; }
.score-pill.lv3 { background: var(--m3); color: var(--m-ink); border: 0; }
.score-pill.lv4 { background: var(--m4); color: var(--m-ink); border: 0; }
.score-pill.lv5 { background: var(--m5); color: var(--m5-ink); border: 0; }
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.tabs button { font: inherit; font-weight: 600; font-size: .92rem; background: none; border: 0; border-bottom: 2px solid transparent; padding: .5rem .8rem; color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs button:disabled { opacity: .45; cursor: default; }
.cram { border-color: var(--accent); }
.cram-main { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.cram-count, .cram-stats div { display: flex; flex-direction: column; }
.cram-count b { font-size: 1.6rem; line-height: 1.1; color: var(--accent); }
.cram-stats { display: flex; gap: 1.5rem; }
.cram-stats b { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.cram-count span, .cram-stats span { font-size: .8rem; color: var(--muted); }
.cram-date { margin-left: auto; display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); gap: .2rem; }
.cram-date input { font: inherit; padding: .35rem .5rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); }
.cram p { margin: .6rem 0 0; }

/* Source panel */
.with-source { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 42%); align-items: start; }
.with-source > .wrap { max-width: none; margin: 0; padding-right: 8px; }
.source { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-left: 1px solid var(--border); background: var(--surface); }
.src-head { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.src-head .muted { margin-right: auto; }
.source .src-body { flex: 1; overflow: auto; padding: .8rem; background: var(--surface-2); }
.src-page { margin: 0 0 .8rem; }
.src-page img { width: 100%; height: auto; display: block; border-radius: 6px; box-shadow: var(--shadow); background: #fff; }
.src-page figcaption { font-size: .75rem; color: var(--muted); text-align: center; margin-top: .2rem; }
.src-frame { width: 100%; height: 100%; min-height: 70vh; border: 0; border-radius: 6px; background: #fff; display: block; }
.src-mobile-note { display: none; }
.source-inline { display: none; }
.source-inline summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.source-inline summary::-webkit-details-marker { display: none; }
.source-inline summary h2 { margin: 0; }
.source-inline summary h2::before { content: "▸ "; color: var(--muted); }
.source-inline[open] summary h2::before { content: "▾ "; }
.source-inline .src-body { margin-top: .8rem; max-height: 80vh; overflow: auto; }
.wrap > .source-inline { display: block; }
@media (max-width: 1000px) {
  .with-source { display: block; }
  .with-source > .wrap { padding-right: 16px; }
  .source { display: none; }
  .with-source .source-inline { display: block; }
}
@media (max-width: 1000px), (hover: none) and (pointer: coarse) {
  .src-frame { display: none; }
  .src-mobile-note { display: block; }
}
.with-source:not(:has(.source)) .source-inline { display: block; }
@media (min-width: 1001px) { .with-source .source-inline { display: none; } }
