/* Layout: single centered column, course pages as unit ledgers, lesson as a focused stage */
:root {
  --bg: #f4f2ec; --surface: #ffffff; --ink: #1b2422; --muted: #5a6662; --line: #dcd8cc;
  --brand: #14594b; --brand-ink: #ffffff; --brand-soft: #e3efe9; --sand: #c8963e; --sand-soft: #f6ead3;
  --good: #2e7d4f; --good-soft: #e3f2e8; --bad: #b3261e; --bad-soft: #fbe5e3; --warn: #8a5a00; --warn-soft: #fbf0d9;
  --stage: #0f1715; --stage-panel: #17221f; --stage-line: #34433e; --stage-ink: #eef4f1; --stage-muted: #a9b9b3;
  --display: "Literata", Georgia, "Times New Roman", serif;
  --body: "Public Sans", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #121816; --surface: #1a2220; --ink: #e7ece9; --muted: #a2afaa; --line: #2e3a36;
  --brand: #4fb39a; --brand-ink: #0b1311; --brand-soft: #1d332d; --sand: #e0b360; --sand-soft: #3a2f1c;
  --good: #6fcf97; --good-soft: #1c3426; --bad: #ff8a80; --bad-soft: #3d1f1d; --warn: #f0c36a; --warn-soft: #3a2f17;
  color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #121816; --surface: #1a2220; --ink: #e7ece9; --muted: #a2afaa; --line: #2e3a36;
  --brand: #4fb39a; --brand-ink: #0b1311; --brand-soft: #1d332d; --sand: #e0b360; --sand-soft: #3a2f1c;
  --good: #6fcf97; --good-soft: #1c3426; --bad: #ff8a80; --bad-soft: #3d1f1d; --warn: #f0c36a; --warn-soft: #3a2f17;
  color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.55 var(--body); }
a { color: var(--brand); }
.wrap { max-width: 1040px; margin: 0 auto; padding-inline: 16px; }
main.wrap { padding-block: 24px 48px; outline: none; }
h1, h2, h3 { font-family: var(--display); line-height: 1.2; text-wrap: balance; margin: 0 0 .4em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .8em; max-width: 68ch; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--sand); }

.demo-bar { background: var(--sand-soft); color: var(--ink); font-size: .85rem; padding: 6px 16px; text-align: center; border-bottom: 1px solid var(--line); }
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; }
.top-in { max-width: 1040px; margin: 0 auto; padding: 10px 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.mark { width: 26px; height: 26px; border-radius: 6px; background: linear-gradient(135deg, var(--brand) 0 55%, var(--sand) 55% 100%); flex: none; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.nav a, .nav button { font: 600 .9rem var(--body); color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 6px; border: 0; background: none; cursor: pointer; }
.nav a.on, .nav a:hover, .nav button:hover { color: var(--ink); background: var(--brand-soft); }
.lang { border: 1px solid var(--line) !important; }

.btn { display: inline-flex; align-items: center; gap: 6px; font: 600 .95rem var(--body); padding: 10px 16px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.sand { background: var(--sand); color: #1b1408; }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn:focus-visible, .nav a:focus-visible, .choice:focus-visible { outline: 3px solid var(--sand); outline-offset: 2px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; align-items: center; padding-block: 12px 28px; }
.hero > * { min-width: 0; }
.hero p.lead { font-size: 1.1rem; color: var(--muted); }
.loop { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.loop ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; counter-reset: s; }
.loop li { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; counter-increment: s; }
.loop li::before { content: counter(s); width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: .85rem; display: grid; place-items: center; }
.loop li b { display: block; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-block: 8px 28px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat b { font-family: var(--display); font-size: 1.6rem; display: block; font-variant-numeric: tabular-nums; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.card h3 { margin: 0; }
.card .grow { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.chip.sand { background: var(--sand-soft); color: var(--warn); }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.gray { background: var(--line); color: var(--muted); }

.units { display: grid; gap: 10px; margin-top: 16px; }
.unit { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: start; }
.unit > * { min-width: 0; }
.unit .num { font-family: var(--display); font-size: 1.4rem; font-weight: 700; color: var(--sand); text-align: center; }
.unit h3 { margin-bottom: 4px; }
.unit .vids { font-size: .85rem; color: var(--muted); margin: 6px 0 0; padding-left: 18px; }
.unit .acts { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 150px; }
.unit .acts .btn { justify-content: center; padding: 8px 12px; font-size: .88rem; }
.unit.locked { opacity: .65; }

.stage-wrap { background: var(--stage); border-radius: 12px; padding: 12px; color: var(--stage-ink); }
.stage { position: relative; aspect-ratio: 16/9; width: 100%; max-width: 100%; background: #000; border-radius: 8px; overflow: hidden; }
.stage > div, .stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
.overlay { position: absolute; inset: 0; background: rgba(10,16,14,.95); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 5; }
.qcard { width: min(640px, 100%); max-height: 100%; overflow: auto; }
.qcard .tag { color: #bfe3d8; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.qcard .q { font-size: 1.12rem; margin: 6px 0 12px; }
.choices { display: grid; gap: 8px; }
.choice { text-align: left; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--stage-line); background: var(--stage-panel); color: var(--stage-ink); font: 1rem var(--body); cursor: pointer; }
.choice.sel { border-color: #8fd1bd; background: #23403a; }
.stage-wrap input[type=text], .stage-wrap textarea { width: 100%; padding: 10px; border-radius: 8px; border: 1px solid var(--stage-line); background: #0b110f; color: var(--stage-ink); font: 1rem var(--body); }
.stage-wrap textarea { min-height: 120px; resize: vertical; }
.fb { margin-top: 10px; }
.fb.good { color: #9be29f; } .fb.bad { color: #ffb4ab; }
.note { font-size: .8rem; color: var(--stage-muted); margin-top: 6px; }
.stage-meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .85rem; color: var(--stage-muted); margin-top: 8px; }
.bar { height: 6px; background: var(--stage-line); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; width: 0; background: #4fb39a; transition: width .3s; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.step { padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: .8rem; color: var(--muted); background: var(--surface); }
.step.on { border-color: var(--brand); color: var(--brand); font-weight: 700; }
.step.done { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.on-dark { background: #4fb39a; color: #0b1311; }
.btn.ghost-dark { background: transparent; color: var(--stage-ink); border-color: var(--stage-line); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-top: 16px; }
.panel textarea, .panel input[type=text], .panel select { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: 1rem var(--body); }
.panel textarea { min-height: 200px; resize: vertical; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
td.num { font-variant-numeric: tabular-nums; }
.timer { font-family: var(--display); font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.timer.low { color: var(--bad); }
.qtest { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.qtest .choices .choice { background: var(--bg); color: var(--ink); border-color: var(--line); }
.qtest .choices .choice.sel { background: var(--brand-soft); border-color: var(--brand); }
.qtest input[type=text] { max-width: 240px; }
video.rec { width: 100%; max-width: 480px; border-radius: 8px; background: #000; aspect-ratio: 4/3; }
.callout { border-left: 4px solid var(--sand); background: var(--sand-soft); padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 12px 0; }
.callout.good { border-color: var(--good); background: var(--good-soft); }
.callout.bad { border-color: var(--bad); background: var(--bad-soft); }
.rubric td select { width: auto; }
.foot { border-top: 1px solid var(--line); padding-block: 18px; color: var(--muted); font-size: .85rem; }
.crumb { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.crumb a { color: var(--muted); }
[hidden] { display: none !important; }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .unit { grid-template-columns: 1fr; }
  .unit .num { text-align: left; }
  .unit .acts { min-width: 0; flex-direction: row; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
