/* The lesson. Dark is home; light keeps the same lines. */
:root {
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --bg: #07090d;
  --bg-2: #0a0e14;
  --panel: rgba(11, 15, 21, 0.9);
  --panel-solid: #0d121a;
  --bar-bg: rgba(7, 9, 13, 0.82);
  --node-bg: #0b1017;
  --line: #1b2430;
  --line-2: #2b3747;
  --line-3: #3d4c5f;
  --ink: #dbe4ee;
  --ink-2: #8d9bab;
  --ink-3: #5b6979;
  --grid: rgba(120, 160, 210, 0.11);
  --grid-2: rgba(120, 160, 210, 0.05);
  --has: #3ee6cf;
  --from: #ffb547;
  --out: #ff8f8a;
  --neutral: #e8f1ff;
  --bad: #ff7d86;
  --sel: rgba(232, 241, 255, 0.08);
  --glow: 1;
  --lvl: 0.16;
  --dim: rgba(2, 4, 8, 0.62);
  --barH: 56px;
  --col: clamp(400px, 33vw, 540px);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f2f4f7;
    --bg-2: #e9edf2;
    --panel: rgba(255, 255, 255, 0.92);
    --panel-solid: #ffffff;
    --bar-bg: rgba(242, 244, 247, 0.86);
    --node-bg: #ffffff;
    --line: #d6dce4;
    --line-2: #bcc6d2;
    --line-3: #95a2b2;
    --ink: #0e1621;
    --ink-2: #4a5767;
    --ink-3: #7b8796;
    --grid: rgba(30, 60, 100, 0.13);
    --grid-2: rgba(30, 60, 100, 0.06);
    --has: #00877a;
    --from: #b86400;
    --out: #c2413b;
    --neutral: #1b3a66;
    --bad: #c8303d;
    --sel: rgba(14, 22, 33, 0.06);
    --glow: 0.35;
    --lvl: 0.13;
    --dim: rgba(20, 30, 46, 0.34);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f2f4f7;
  --bg-2: #e9edf2;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-solid: #ffffff;
  --bar-bg: rgba(242, 244, 247, 0.86);
  --node-bg: #ffffff;
  --line: #d6dce4;
  --line-2: #bcc6d2;
  --line-3: #95a2b2;
  --ink: #0e1621;
  --ink-2: #4a5767;
  --ink-3: #7b8796;
  --grid: rgba(30, 60, 100, 0.13);
  --grid-2: rgba(30, 60, 100, 0.06);
  --has: #00877a;
  --from: #b86400;
  --out: #c2413b;
  --neutral: #1b3a66;
  --bad: #c8303d;
  --sel: rgba(14, 22, 33, 0.06);
  --glow: 0.35;
  --lvl: 0.13;
  --dim: rgba(20, 30, 46, 0.34);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; }
.side-has { --c: var(--has); }
.side-from { --c: var(--from); }
/* Pages that take away from their side (expenses, drawings). */
.tank.minus { --c: var(--out); }
.tank.minus .t-lvl { opacity: calc(var(--lvl) * 2); }
.t-sign { fill: var(--out); }
.t-edge { fill: var(--out); }
.side-ink { --c: var(--ink); }
.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Bar ---------- */
.bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  height: var(--barH);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: var(--bar-bg);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.led {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--ink-3);
  box-shadow: 0 0 0 3px var(--sel);
  transition: background .25s, box-shadow .25s;
}
.led.flash { background: var(--has); box-shadow: 0 0 0 3px var(--sel), 0 0 calc(14px * var(--glow)) var(--has); }
.cells { flex: 1; min-width: 0; display: flex; align-items: center; gap: 18px; }
.mainc { --g: 14px; display: flex; align-items: center; gap: var(--g); }
.subs { --g: 18px; display: flex; align-items: center; gap: var(--g); padding-left: 18px; border-left: 1px solid transparent; transition: border-color .4s; }
.bar.has-subs .subs { border-left-color: var(--line); }
.unit {
  font: 500 11px/1 var(--mono); letter-spacing: .04em;
  color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 4px; padding: 4px 6px;
  opacity: 0; transition: opacity .4s;
}
.unit.on { opacity: 1; }
.cell {
  display: flex; align-items: baseline; gap: 9px;
  opacity: 0; transform: translateY(-5px);
  transition: opacity .45s, transform .45s;
}
.cell.on { opacity: 1; transform: none; }
.cl { font: 500 12px/1 var(--mono); color: var(--c); white-space: nowrap; }
.ca {
  font: 500 18px/1 var(--mono); color: var(--ink); font-variant-numeric: tabular-nums;
  transition: color .3s, text-shadow .3s;
}
.cell.sub .ca { font-size: 15px; color: var(--ink-2); }
.cell.flash .ca { color: var(--c); text-shadow: 0 0 calc(14px * var(--glow)) var(--c); }
.eqs { font: 500 17px/1 var(--mono); color: var(--ink-3); opacity: 0; transition: opacity .4s, color .3s; }
.eqs.on { opacity: 1; }
.eqs.flash { color: var(--ink); }
.tools { display: flex; align-items: center; gap: 6px; }
.tb {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; min-width: 34px; padding: 0 9px; justify-content: center;
  background: transparent; border: 1px solid var(--line-2); border-radius: 8px;
  color: var(--ink-2); cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.tb:hover:not(:disabled), .tb[aria-expanded="true"] { color: var(--ink); border-color: var(--line-3); background: var(--sel); }
.tb:disabled { opacity: .45; cursor: default; }
/* The theme button stays on every screen, at the bar's far end. */
.tb.theme { padding: 0; width: 34px; flex: none; order: 5; display: inline-flex !important; }
.cnt { font: 500 13px/1 var(--mono); min-width: 1ch; }
.tb.bump { animation: bump .7s ease-out; }
@keyframes bump {
  0% { box-shadow: 0 0 0 0 var(--neutral); }
  40% { box-shadow: 0 0 0 5px transparent; color: var(--ink); border-color: var(--neutral); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
:focus-visible { outline: 2px solid var(--neutral); outline-offset: 2px; border-radius: 4px; }

/* ---------- Glossary ---------- */
.gloss {
  position: fixed; z-index: 40;
  top: calc(var(--barH) + 8px); right: 16px;
  width: min(380px, calc(100% - 32px)); max-height: 70vh; overflow: auto;
  background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: 12px;
  padding: 6px 18px 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}

/* ---------- Title ---------- */
.hero-title { padding: 18px 0 6px; }
.ht-course { margin: 0; font: 600 12px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); }
.ht-lesson { margin: 14px 0 0; font-weight: 600; font-size: clamp(30px, 3.3vw, 54px); line-height: 1.06; letter-spacing: -0.02em; color: var(--ink); }
.ht-n { display: block; margin-bottom: 10px; font: 500 13px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--neutral); }
.ht-t { display: block; }
/* The lesson name in the bar is the button that opens the list of lessons. On a wide screen it
   shows the name and a small arrow; on a phone, only the list icon. */
.lesson-tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 8px; margin-left: -8px;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  color: inherit; font: inherit; cursor: pointer;
}
.lesson-tag:hover, .lesson-tag[aria-expanded="true"] { background: var(--sel); }
.lesson-tag > .ic:first-child { display: none; }
.lesson-tag > .ic:last-child { width: 13px; height: 13px; color: var(--ink-2); flex: none; }
/* Room under the line for the tails of g, y and ?: the box cuts off anything outside it. */
.lesson-tag .lt-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.6; }
@media (max-width: 899px) {
  .lesson-tag { width: 34px; padding: 0; margin-left: 0; justify-content: center; border-color: var(--line-2); color: var(--ink-2); }
  .lesson-tag > .ic:first-child { display: block; }
  .lesson-tag .lt-text, .lesson-tag > .ic:last-child { display: none; }
}

/* ---------- Lessons ---------- */
.lessons {
  position: fixed; z-index: 40;
  top: calc(var(--barH) + 8px); left: 16px;
  width: min(420px, calc(100% - 32px)); max-height: 70vh; overflow: auto;
  background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: 12px;
  padding: 6px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}
.lessons ol { list-style: none; margin: 0; padding: 0; }
.lsn {
  display: grid; grid-template-columns: 86px 1fr; gap: 10px; align-items: baseline;
  width: 100%; padding: 11px 12px; text-align: left;
  background: transparent; border: 0; border-radius: 8px;
  color: var(--ink); font: 500 15px/1.35 var(--sans); cursor: pointer;
}
.lsn:hover { background: var(--sel); }
.lsn[aria-current="true"] { background: var(--sel); box-shadow: inset 3px 0 0 var(--neutral); }
.lsn-n { font: 500 12px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }

/* ---------- Focus: how a step points at the picture ----------
   The part the step talks about stays lit in a window while everything around it dims for a moment.
   The step's card lights up with it. Then only a thin outline stays. */
.spot-wrap { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.spot {
  position: absolute; border-radius: 14px; opacity: 0;
  box-shadow: 0 0 0 4000px var(--dim);
}
.spot-many { position: absolute; left: 0; top: 0; width: 100%; height: 100%; opacity: 0; overflow: visible; }
.spot-many path { fill: var(--dim); }
.spot-ring {
  position: absolute; border-radius: 14px; opacity: 0;
  border: 1.5px solid var(--c, var(--neutral));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c, var(--neutral)) 14%, transparent);
  --c: var(--neutral);
}
.spot-ring.side-has { --c: var(--has); }
.spot-ring.side-from { --c: var(--from); }
/* A lesson's opening screen in the column: its number and its name, set large, no box around it. */
.card.lesson-open { background: none; border-color: transparent; box-shadow: none; padding-left: 0; padding-right: 0; }
.card.lesson-open.lit, .card.lesson-open.act { border-color: transparent; box-shadow: none; }
.card.lesson-open { --ra: 1; --rb: 1; --rc: 1; --rd: 1; --re: 1; }
.lo-course { margin: 0; font: 600 12px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); opacity: var(--rb); }
.lo-title { margin: 14px 0 0; font-weight: 600; font-size: clamp(30px, 3.1vw, 50px); line-height: 1.06; letter-spacing: -0.02em; color: var(--ink); }
.lo-n { display: block; margin-bottom: 10px; font: 500 13px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--neutral); opacity: var(--rc); transform: translateY(calc((1 - var(--rc)) * 14px)); }
.lo-t { display: block; opacity: var(--rd); transform: translateY(calc((1 - var(--rd)) * 24px)); }
/* The title arrives line by line, and a short rule in the two sides' colours draws under it last. */
.lo-title::after { content: ''; display: block; width: 132px; height: 3px; margin-top: 20px; border-radius: 2px; background: linear-gradient(90deg, var(--has), var(--from)); transform-origin: left; transform: scaleX(var(--re)); }
.step.k-lesson { min-height: calc((100vh - var(--barH)) * .8); }
/* The header's edge when a lesson turns over. */
.bar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: linear-gradient(90deg, var(--has), var(--from)); transform: scaleX(0); transform-origin: left; opacity: 0; pointer-events: none; }
.bar.turn::after { animation: bar-turn 1.1s cubic-bezier(.2, .7, .2, 1); }
@keyframes bar-turn { 0% { transform: scaleX(0); opacity: 1; } 70% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .bar.turn::after { animation: none; } }
/* The choose exercise: a row of numbers, one of them right. */
.seg.choose { display: flex; gap: 8px; margin: 16px 0 4px; }
.seg.choose .opt.num { flex: 1; justify-content: center; font-family: var(--mono); font-size: 16px; padding: 10px 8px; }
/* The equity cell adds up the two cells after it. */
/* Until it is taught, the equity cell takes no room at all; then it opens, and the cells beside it
 * glide aside instead of jumping. */
.cell.eqt { max-width: 240px; overflow: hidden; white-space: nowrap; padding-right: 14px; border-right: 1px solid var(--line);
  transition: opacity .4s, transform .4s, max-width .5s cubic-bezier(.2, .7, .2, 1), padding .5s, margin .5s; }
.cell.eqt:not(.on) { max-width: 0; padding-right: 0; margin-right: calc(-1 * var(--g, 18px)); border-right-color: transparent; }
/* A small cell that is not shown takes no room (a lesson may hide some), and opens smoothly when shown. */
.cell.sub { max-width: 260px; overflow: hidden; white-space: nowrap; transition: opacity .45s, transform .45s, max-width .5s cubic-bezier(.2, .7, .2, 1), margin .5s; }
.cell.sub:not(.on) { max-width: 0; margin-right: calc(-1 * var(--g, 18px)); }
/* What the business owes, and the plus that joins it to equity once the equation is taught. */
.cell.owd { max-width: 240px; overflow: hidden; white-space: nowrap; transition: opacity .4s, transform .4s, max-width .5s cubic-bezier(.2, .7, .2, 1), margin .5s; }
.cell.owd:not(.on) { max-width: 0; margin-right: calc(-1 * var(--g, 18px)); }
.bar .plus { font: 500 15px/1 var(--mono); color: var(--ink-3); max-width: 0; overflow: hidden; opacity: 0; margin-right: calc(-1 * var(--g, 18px)); transition: max-width .5s, opacity .4s, margin .5s; }
.bar .plus.on { max-width: 20px; opacity: 1; margin-right: 0; }
/* Read as the equation, the bar drops 'Came from' (its two parts now stand after the equals sign). */
.cell[data-cell="from"] { max-width: 260px; overflow: hidden; white-space: nowrap; transition: opacity .45s, transform .45s, max-width .5s cubic-bezier(.2, .7, .2, 1), margin .5s; }
.bar.equation .cell[data-cell="from"] { max-width: 0; opacity: 0; margin-right: calc(-1 * var(--g, 18px)); }
.bar.equation .subs { border-left-color: transparent; padding-left: 0; }
.bar.equation .cell.eqt { border-right-color: transparent; }
.card.lit { border-color: var(--c, var(--neutral)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c, var(--neutral)) 14%, transparent); }
.card { transition: border-color .4s, box-shadow .4s; }

/* ---------- Labels and links inside the picture ---------- */
.actor-lbl { font: 600 15px var(--sans); fill: var(--ink); }
.actor-tag { font: 500 14px var(--mono); letter-spacing: .04em; fill: var(--ink-2); }
.arc-line, .arc-head { fill: none; stroke: var(--neutral); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.arc-lbl { font: 500 14px var(--mono); fill: var(--ink); }
.q-lbl { font: 500 16.5px var(--sans); fill: var(--c); }
.you-hl { fill: none; stroke: var(--neutral); stroke-width: 3; }

/* ---------- Notes: what to remember ---------- */
.nlist { list-style: none; margin: 0; padding: 0; }
.note { display: block; padding: 7px 0 8px 12px; border-left: 2px solid var(--c, var(--line-3)); margin: 0 0 10px; break-inside: avoid; }
.note.rule { --c: var(--neutral); }
.nw { display: block; font-weight: 600; font-size: 14.5px; line-height: 1.3; color: var(--c); }
.nm { display: block; margin-top: 2px; font-size: 14px; line-height: 1.45; color: var(--ink); }
.nn { display: flex; gap: 6px; margin-top: 4px; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.nn .ic { flex: none; width: 12px; height: 12px; margin-top: 3px; color: var(--c); }
.nl { display: block; font-size: 14.5px; line-height: 1.45; font-weight: 500; color: var(--ink); }
.note.new { animation: land 1.4s ease-out; }
@keyframes land {
  0% { background: color-mix(in srgb, var(--c, var(--neutral)) 26%, transparent); transform: translateY(6px); opacity: 0; }
  25% { opacity: 1; transform: none; }
  100% { background: transparent; }
}
.notes { display: none; }
.gloss .nlist { padding-top: 12px; }
.closer .nlist { padding: 8px 0 0; }

/* On a smaller desktop the reading column is a little narrower, so a wide picture fills its area. */
@media (min-width: 900px) and (max-width: 1439px) { :root { --col: clamp(380px, 30vw, 540px); } }

/* ---------- Popover ---------- */
.pop {
  position: absolute; z-index: 50;
  width: min(330px, calc(100% - 24px));
  background: var(--panel-solid); border: 1px solid var(--line-2); border-left: 2px solid var(--c);
  border-radius: 10px; padding: 12px 16px 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}
.pop .pw { margin: 0; font-weight: 600; color: var(--c); font-size: 16px; }
.pop .pm { margin: 4px 0 0; font-size: 15px; line-height: 1.5; }
.pop .px { margin: 8px 0 0; display: flex; gap: 8px; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.pop .px .ic { margin-top: 3px; color: var(--c); }

/* ---------- Stage ---------- */
.stage {
  position: fixed; z-index: 10;
  top: var(--barH); left: var(--col); right: 0; bottom: 0;
  border-left: 1px solid var(--line);
  background: radial-gradient(120% 90% at 60% 40%, var(--bg-2), var(--bg) 70%);
}
.stage svg { display: block; width: 100%; height: 100%; }

@media (min-width: 900px) {
  :root { --notesH: 0px; }


  /* The picture's box and the notes panel move as one: same distance, same time, same curve. */
  .stage { bottom: var(--notesH); transition: left .55s cubic-bezier(.2, .7, .2, 1), right .55s cubic-bezier(.2, .7, .2, 1), bottom .5s cubic-bezier(.2, .7, .2, 1); }
  .notes {
    display: flex; flex-direction: column;
    position: fixed; z-index: 11;
    left: var(--col); right: 0; bottom: 0; height: var(--notesH);
    padding: 14px 26px 12px;
    background: var(--panel-solid);
    border-left: 1px solid var(--line); border-top: 1px solid var(--line-2);
  }
  .notes[hidden] { display: none; }
  .notes { overflow: hidden; opacity: 0; transition: height .5s cubic-bezier(.2, .7, .2, 1), opacity .3s; }
  /* Scrolling back, the picture rewinds fast; the notes panel and the picture's box keep pace with
   * it, so the two never pull against each other. */
  body.rewind .stage, body.rewind .notes { transition-duration: .18s; }
  body.has-notes .notes { opacity: 1; }
  .nh { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font: 600 11.5px/1 var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--ink-2); }
  .nh .ic { width: 15px; height: 15px; }
  .notes .nlist {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: 6px;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 30px; align-content: start;
  }
  .tb { display: none; }

  /* The opener. The page moves these with the scroll: the diagram starts at full width, and the
   * first sentence starts inside the business box and lifts out onto the line. */
  body.hero .stage { transition: none; }
  body.hero .tree { opacity: 0; }
  .tree { transition: opacity .4s; }
  .step.first { min-height: 150vh; align-items: flex-end; padding-bottom: 18vh; }
  .step.first .card {
    --h: 1;
    opacity: max(var(--f), calc(1 - var(--h)));
    background: color-mix(in srgb, var(--panel) calc(var(--h) * 100%), transparent);
    border-color: color-mix(in srgb, var(--line) calc(var(--h) * 100%), transparent);
    will-change: transform;
  }
  .step.first .card::before, .step.first .card::after { opacity: calc(var(--h) * var(--h)); }
  .hero-title {
    position: fixed; z-index: 14; left: 50%; top: 20vh;
    transform: translateX(-50%);
    text-align: center; white-space: nowrap; pointer-events: none;
    opacity: 0;
  }
  .lesson-tag { font: 500 12px/1 var(--mono); letter-spacing: .03em; color: var(--ink-2); white-space: nowrap; opacity: 0; }

  /* The closer: the finished diagram beside everything worth remembering. */
  body.closing .stage { left: 0; right: var(--closeR, 44%); bottom: 0; }
  body.closing .notes { left: calc(100% - var(--closeR, 44%)); top: var(--barH); height: auto; padding: 34px 44px 28px; border-top: 0; }
  /* During a hand-over between two lessons the page sets these by the scroll, frame by frame. */
  body.turning .stage, body.turning .notes, body.turning .story { transition: none; }
  body.closing .notes .nlist { grid-template-columns: 1fr; max-width: 620px; }
  /* A list longer than its column scrolls inside it; the fade at the foot shows there is more. */
  body.closing .notes .nlist.more { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 56px), transparent); }
  /* A long lesson's list sets in two columns on its closing screen, so it fits without scrolling. */
  body.closing .notes.many .nlist { grid-template-columns: 1fr 1fr; column-gap: 26px; max-width: none; }
  body.closing .notes.many .note { margin-bottom: 7px; padding: 4px 0 5px 14px; }
  body.closing .notes.many .nw { font-size: 15px; }
  body.closing .notes.many .nm, body.closing .notes.many .nl { font-size: 14px; line-height: 1.36; }
  body.closing .notes.many .nn { font-size: 12.5px; }
  body.closing .notes { padding-top: 26px; padding-bottom: 18px; }
  body.closing .note { margin-bottom: 9px; padding: 5px 0 6px 16px; }
  body.closing .nw { font-size: 16px; }
  body.closing .nm, body.closing .nl { font-size: 15px; line-height: 1.4; }
  body.closing .nn { font-size: 13.5px; }
  body.closing .story { opacity: 0; pointer-events: none; }
  /* On a short window the closing list sets tighter, so a lesson's notes fit without scrolling. */
  @media (max-height: 860px) {
    body.closing .notes { padding-top: 16px; padding-bottom: 10px; }
    body.closing .note { margin-bottom: 5px; padding: 3px 0 4px 14px; }
    body.closing .nw { font-size: 14.5px; }
    body.closing .nm, body.closing .nl { font-size: 13.5px; line-height: 1.32; }
    body.closing .nn { font-size: 12.5px; }
    body.closing .notes.many .note { margin-bottom: 4px; padding: 2px 0 3px 12px; }
    body.closing .notes.many .nw { font-size: 14px; }
    body.closing .notes.many .nm, body.closing .notes.many .nl { font-size: 13px; line-height: 1.3; }
    body.closing .notes.many .nn { font-size: 11.5px; }
  }
  .closer { min-height: 160vh; }
  .closer .nlist { display: none; }
}
.g-dot { fill: var(--grid); }
.g-line { fill: none; stroke: var(--grid-2); stroke-width: 1; }
.hatch-line { stroke: var(--has); stroke-width: 1.4; opacity: .55; }

.biz-box { fill: var(--node-bg); stroke: var(--line-3); stroke-width: 1.2; }
.node-fill { fill: var(--neutral); opacity: .1; }
.node-surf { stroke: var(--neutral); stroke-width: 1.6; opacity: .8; }
.node-amt { font-family: var(--mono); font-size: 30px; font-weight: 500; fill: var(--ink); }
.glyph { fill: none; stroke: var(--ink-2); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.glyph.thin { stroke: var(--ink-3); }
.divider { stroke: var(--line-3); stroke-width: 1; stroke-dasharray: 3 6; }
.node-box { fill: var(--node-bg); stroke: var(--line-3); stroke-width: 1.2; }
.ring { fill: none; stroke: var(--neutral); stroke-width: 1; }

.ch { --c: var(--ink-2); }
.ch.c-has { --c: var(--has); }
.ch.c-from { --c: var(--from); }
.ch-halo { fill: none; stroke: var(--c); stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.ch-core { fill: none; stroke: var(--c); stroke-linecap: round; stroke-linejoin: round; }
.ch-core.dashed { stroke-dasharray: 2 6; stroke: var(--ink-3); }
.ch-head { fill: none; stroke: var(--c); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.junction { fill: var(--bg); stroke: var(--ink-2); stroke-width: 1.5; }

.col-hl { fill: none; stroke: var(--c); stroke-width: 1; stroke-dasharray: 4 5; }
.col-head .h-lbl { font-family: var(--mono); font-size: 19px; font-weight: 500; fill: var(--c); }
.col-head .h-tot { font-family: var(--mono); font-size: 19px; font-weight: 500; fill: var(--ink); }
.h-base { stroke: var(--line-2); stroke-width: 3; stroke-linecap: round; }
.h-gauge { stroke: var(--c); stroke-width: 3; stroke-linecap: round; }
.eq { fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; }

.t-box { fill: var(--node-bg); stroke: var(--line-3); stroke-width: 1.2; }
.t-well { fill: none; stroke: var(--line); stroke-width: 1; }
.t-lvl { fill: var(--c); opacity: var(--lvl); }
.t-lvl.claim { opacity: calc(var(--lvl) * .5); }
.t-hatch { opacity: .9; }
.t-surf { stroke: var(--c); stroke-width: 2; }
.t-surf-halo { stroke: var(--c); stroke-width: 9; stroke-opacity: calc(.16 * var(--glow)); }
.t-ticks { fill: none; stroke: var(--line-3); stroke-width: 1; }
.t-fold-bg { fill: var(--bg); }
.t-fold { fill: none; stroke: var(--line-3); stroke-width: 1.2; stroke-linejoin: round; }
.t-rule { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 2 4; }
.t-name { font-family: var(--sans); font-size: 19px; font-weight: 500; fill: var(--c); }
.t-amt { font-family: var(--mono); font-size: 29px; font-weight: 500; fill: var(--ink); }
.t-delta { font-family: var(--mono); font-size: 19px; font-weight: 500; fill: var(--c); }
.t-hl-blur { fill: none; stroke: var(--c); stroke-width: 6; opacity: calc(.75 * var(--glow)); }
.t-hl-line { fill: none; stroke: var(--c); stroke-width: 1.6; }
.t-badge .b-ring { fill: var(--node-bg); stroke: var(--line-3); stroke-width: 1.2; }
.t-badge .b-glyph { fill: none; stroke: var(--ink-2); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.t-badge.b-wait .b-ring { stroke-dasharray: 3 4; }
.t-badge.b-pick .b-ring { stroke: var(--ink-2); }
.t-badge.b-pick .b-glyph { stroke: var(--ink); }
.t-badge.b-right .b-ring { stroke: var(--c); }
.t-badge.b-right .b-glyph { stroke: var(--c); }
.t-badge.b-role .b-ring { stroke: var(--neutral); }
.t-badge.b-role .b-glyph { stroke: var(--neutral); }

.doc { fill: var(--node-bg); stroke: var(--neutral); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.inv-hl { fill: var(--neutral); fill-opacity: .25; }

.tl-box { fill: var(--node-bg); stroke: var(--line-3); stroke-width: 1.2; }
/* The owner's panel (lesson 2): rows of label, amount and a bar. */
.st-lbl { font-family: var(--sans); font-size: 21px; font-weight: 500; fill: var(--ink); }
.st-lbl.st-total { font-weight: 600; }
.st-title { font-family: var(--sans); font-size: 22px; font-weight: 600; fill: var(--ink); }
.st-period { font-family: var(--mono); font-size: 16px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; fill: var(--neutral); }
.actor-lbl.sm { font-size: 15.5px; }
/* A compact statement (one line per row), and the names of groups of pages in a column. */
.st-title.sm { font-size: 19px; }
.st-lbl.sm { font-size: 17px; }
.st-amt.sm { font-size: 20px; }
.grp-amt { font-family: var(--mono); font-size: 13px; font-weight: 600; fill: var(--c); }
.grp-lbl { font-family: var(--mono); font-size: 13px; font-weight: 500; letter-spacing: .02em; text-transform: uppercase; fill: var(--c); }
.st-amt { font-family: var(--mono); font-size: 28px; font-weight: 500; fill: var(--ink); }
.st-base { fill: none; stroke: var(--line); stroke-width: 1; }
.st-bar { fill: var(--c); opacity: calc(var(--lvl) * 2.2); }
/* A statement with many lines: name and amount share a line, the bar just under them. */
.st-lbl.dense { font-size: 17px; }
.st-amt.dense { font-size: 20px; }
/* Each statement line's mark: + an income, − an expense, = what is left. */
.st-sign { font-family: var(--mono); font-size: 20px; font-weight: 600; }
.st-sign.sm { font-size: 15px; }
.st-sign.plus { fill: var(--from); }
.st-sign.minus { fill: var(--out); }
.st-sign.eq { fill: var(--ink-2); }
/* An expense row: the total it is cut from (faint), and its slice in the subtract colour. */
.st-ghost { fill: var(--c); opacity: calc(var(--lvl) * 1.1); }
.st-cut { fill: color-mix(in srgb, var(--out) 22%, transparent); stroke: var(--out); stroke-width: 1.4; stroke-dasharray: 5 4; }
.st-rule { stroke: var(--line-3); stroke-width: 1.2; }
.tl-axis { fill: none; stroke: var(--line-3); stroke-width: 1.2; }
.tl-split { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 3 5; }
.tl-base { fill: none; stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 2 4; }
.tl-lbl { font-family: var(--mono); font-size: 18px; font-weight: 500; fill: var(--c); }
.tl-amt { font-family: var(--mono); font-size: 18px; font-weight: 500; fill: var(--c); }
/* Lesson 5: each page's debit and credit footer, its account number, and the books panel. */
.t-dc { font-family: var(--mono); font-size: 12px; font-weight: 500; fill: var(--ink-2); }
.t-no { font-family: var(--mono); font-size: 12px; font-weight: 500; fill: var(--ink-3); }
@media (max-width: 599px) { .t-dc { font-size: 15px; } .t-no { font-size: 14px; } }
.bk-col { font-family: var(--mono); font-size: 13px; font-weight: 600; letter-spacing: .06em; fill: var(--ink-2); }
.jr-h { font-family: var(--sans); font-size: 13px; font-weight: 600; fill: var(--ink-2); }
.jr-n { font-family: var(--sans); font-size: 14px; font-weight: 400; fill: var(--ink); }
.jr-no { font-family: var(--mono); font-size: 13px; font-weight: 500; fill: var(--ink-3); }
.jr-a { font-family: var(--mono); font-size: 14px; font-weight: 500; fill: var(--ink); }
.jr-tot { font-weight: 700; }
/* Lesson 6's papers: a dot on a document that made a journal entry, an arrow to the next one. */
.doc-dot { fill: var(--neutral); }
.doc-arrow { fill: none; stroke: var(--ink-3); stroke-width: 1.4; marker-end: none; }
/* On a phone the books panel uses bigger type (stage.js drawBooks lays it out in taller rows). */
.bkp.phone [data-jr] .jr-n, .bkp.phone [data-jr] .jr-a { font-size: 18px; }
.bkp.phone [data-jr] .jr-h { font-size: 17px; }
.bkp.phone [data-tb] .jr-n, .bkp.phone [data-tb] .jr-a { font-size: 16px; }
.bkp.phone [data-tb] .jr-no { font-size: 14px; }
.bkp.phone [data-ta] .jr-a { font-size: 20px; }
.bkp.phone .bk-col { font-size: 16px; }
.bkp.phone [data-sub] .jr-n, .bkp.phone [data-sub] .jr-a,
.bkp.phone [data-rec] .jr-n, .bkp.phone [data-rec] .jr-a,
.bkp.phone [data-docs] .jr-n, .bkp.phone [data-docs] .jr-a { font-size: 16px; }
/* Lesson 7's shelf: a laptop is a screen over a base; ordered ones are an outline; the count marks
 * a missing one with a red outline and a damaged one with a crack. */
.sh-u { fill: color-mix(in srgb, var(--has) 14%, var(--panel-solid)); stroke: var(--has); stroke-width: 1.3; }
.sh-u.ordered { fill: none; stroke: var(--ink-3); stroke-dasharray: 3 2.5; }
.sh-b { fill: var(--has); }
.sh-miss { fill: none; stroke: var(--out); stroke-width: 1.5; stroke-dasharray: 3 2.5; }
.sh-crack { fill: none; stroke: var(--ink); stroke-width: 1.3; stroke-linejoin: round; }
.sh-pick { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.sh-dn { font-family: var(--mono); font-size: 13px; font-weight: 500; fill: var(--ink-2); }
.sh-tot { font-family: var(--mono); font-size: 20px; font-weight: 600; fill: var(--ink); }
.bkp.phone [data-shelf] .jr-n, .bkp.phone [data-shelf] .jr-a { font-size: 16px; }
.bkp.phone .sh-dn { font-size: 16px; }
/* Lesson 8's views: a job sheet per job, a chip that says how a cost moves, the break-even chart,
 * and a variance coloured by which way it went. */
.mg-job { fill: color-mix(in srgb, var(--has) 12%, var(--panel-solid)); stroke: var(--has); stroke-width: 1.3; stroke-linejoin: round; }
.mg-job-l { fill: none; stroke: var(--has); stroke-width: 1.2; opacity: .65; }
.mg-chip { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .05em; fill: var(--ink-2); }
.mg-chip.variable, .mg-chip.direct { fill: var(--has); }
.mg-axis { stroke: var(--ink-3); stroke-width: 1.2; }
.mg-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.mg-tick { font-family: var(--mono); font-size: 12px; fill: var(--ink-2); }
.mg-line { fill: none; stroke-width: 2.6; stroke-linecap: round; }
.mg-ghost { fill: none; stroke-width: 1.3; stroke-dasharray: 4 4; opacity: .45; }
.mg-line.rev, .mg-ghost.rev { stroke: var(--has); }
.mg-line.cost, .mg-ghost.cost { stroke: var(--out); }
.mg-dot.rev { fill: var(--has); }
.mg-dot.cost { fill: var(--out); }
.mg-mark { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.mg-gap { stroke-width: 6; stroke-linecap: round; opacity: .3; }
.mg-gap.loss { stroke: var(--out); }
.mg-gap.profit { stroke: var(--has); }
.mg-lbl { font-family: var(--sans); font-size: 13px; font-weight: 600; }
.mg-lbl.rev { fill: var(--has); }
.mg-lbl.cost { fill: var(--out); }
.mg-even { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.mg-even-l { font-family: var(--sans); font-size: 12.5px; font-weight: 600; fill: var(--ink); }
.jr-a.mg-up { fill: var(--has); }
.jr-a.mg-down { fill: var(--out); }
.bkp.phone [data-mg] .jr-n, .bkp.phone [data-mg] .jr-a { font-size: 16px; }
.bkp.phone .mg-chip { font-size: 16px; letter-spacing: 0; }
/* Column heads sit close together in these tables: no extra letter spacing. */
.mg-colh { letter-spacing: 0; }
/* Lesson 9's bars: parts of what the business has (green), of what it came from (orange), what is
 * taken away (red), profit, and the gap a business carries itself. */
.mg-bar { stroke: none; }
.mg-bar.has { fill: color-mix(in srgb, var(--has) 62%, var(--panel-solid)); }
.mg-bar.has.alt { fill: color-mix(in srgb, var(--has) 40%, var(--panel-solid)); }
.mg-bar.from, .mg-bar.liab { fill: color-mix(in srgb, var(--from) 62%, var(--panel-solid)); }
.mg-bar.from.alt { fill: color-mix(in srgb, var(--from) 40%, var(--panel-solid)); }
.mg-bar.eq { fill: color-mix(in srgb, var(--from) 26%, var(--panel-solid)); stroke: var(--from); stroke-width: 1.2; }
.mg-bar.cost { fill: color-mix(in srgb, var(--out) 48%, var(--panel-solid)); }
.mg-bar.profit { fill: var(--has); }
.mg-bar.gap { fill: color-mix(in srgb, var(--ink) 16%, var(--panel-solid)); stroke: var(--ink-2); stroke-width: 1.2; stroke-dasharray: 4 3; }
.mg-track { fill: color-mix(in srgb, var(--ink) 5%, transparent); stroke: var(--line); stroke-width: 1; }
.mg-out { fill: none; stroke: var(--has); stroke-width: 1.4; stroke-dasharray: 4 3; }
.mg-fit { fill: color-mix(in srgb, var(--from) 18%, transparent); stroke: var(--from); stroke-width: 1.3; }
.bkp.phone .mg-colh { font-size: 16px; }
.bkp.phone .mg-tick, .bkp.phone .mg-lbl, .bkp.phone .mg-even-l { font-size: 16px; }
/* Lesson 4's cash panel: one line per movement of cash, its lanes (the three doors), its statement rows. */
.cf-lbl { font-family: var(--sans); font-size: 15px; font-weight: 400; fill: var(--ink-2); }
.cf-amt { font-family: var(--mono); font-size: 15px; font-weight: 500; }
.cf-line.in .cf-amt { fill: var(--has); }
.cf-line.out .cf-amt { fill: var(--out); }
.cf-lane { font-family: var(--mono); font-size: 13px; font-weight: 500; letter-spacing: .02em; text-transform: uppercase; fill: var(--ink-2); }
.cf-tot { font-family: var(--mono); font-size: 17px; font-weight: 600; fill: var(--ink); }
.cf-bar { fill: var(--has); opacity: calc(var(--lvl) * 2.6); }
.cf-bar.neg { fill: var(--out); }
.cf-bar-net { fill: var(--has); }
.wave { fill: none; stroke: var(--c); stroke-width: 2.4; stroke-linejoin: round; }
.tl-head { stroke: var(--neutral); stroke-width: 1.2; }
.tl-dot { fill: var(--c); stroke: var(--bg); stroke-width: 2; }

.pt { --c: var(--neutral); }
.pt.p-has { --c: var(--has); }
.pt.p-from { --c: var(--from); }
.pt-core { fill: var(--c); }
.pt-halo { fill: var(--c); opacity: calc(.22 * var(--glow)); }

/* ---------- Story ---------- */
.story {
  position: relative; z-index: 12;
  width: var(--col);
  padding: var(--barH) 28px 0 var(--padL);
  --spine: 32px; --padL: 64px; --strand: 9px; --dotTop: 32px; --dot: 36.5px;
  transition: opacity .35s;
}

/* The line: one trunk that divides into a "has" strand and a "came from" strand. */
.tree { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--spine) * 2); pointer-events: none; }
.tree-svg { position: absolute; left: 0; top: 0; overflow: visible; }
.tree-lit { position: absolute; left: 0; top: 0; width: 100%; height: 0; overflow: hidden; }
.tl { fill: none; stroke-width: 1.5; stroke-linecap: round; }
.dim .tl { stroke: var(--line-2); }
.lit .tl { stroke-width: 2; }
.lit .tl-trunk { stroke: var(--neutral); }
.lit .tl-has { stroke: var(--has); }
.lit .tl-from { stroke: var(--from); }

.step {
  min-height: calc((100vh - var(--barH)) * .52);
  display: flex; align-items: center;
  padding: 28px 0;
}
.step.ev { min-height: calc((100vh - var(--barH)) * .7); }
.step.tall { min-height: calc((100vh - var(--barH)) * 1.05); }
.s-has { --dx: calc(var(--strand) * -1); --dc: var(--has); }
.s-from { --dx: var(--strand); --dc: var(--from); }

.card {
  --f: 1;
  position: relative; width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px 26px 22px;
  opacity: var(--f);
  transition: border-color .4s;
}
.card::before {
  content: ""; position: absolute;
  left: calc(var(--spine) - var(--padL) - 4.5px + var(--dx, 0px)); top: var(--dotTop);
  width: 9px; height: 9px; border-radius: 5px;
  background: var(--bg); border: 1.5px solid var(--line-3);
  transition: background .3s, border-color .3s, box-shadow .3s;
}
.s-both .card::before {
  left: calc(var(--spine) - var(--padL) - 4.5px - var(--strand));
  width: calc(var(--strand) * 2 + 9px);
}
.card.past::before { border-color: var(--dc, var(--neutral)); background: var(--dc, var(--neutral)); }
.s-both .card.past::before { background: linear-gradient(90deg, var(--has), var(--from)); border-color: transparent; }
.card.act::before { box-shadow: 0 0 0 4px var(--sel), 0 0 calc(12px * var(--glow)) var(--dc, var(--neutral)); }
.card.act { border-color: var(--line-2); }
.card::after {
  content: ""; position: absolute; inset: -1px; border-radius: 12px; pointer-events: none;
  background:
    linear-gradient(var(--line-3), var(--line-3)) top left / 14px 1px,
    linear-gradient(var(--line-3), var(--line-3)) top left / 1px 14px,
    linear-gradient(var(--line-3), var(--line-3)) bottom right / 14px 1px,
    linear-gradient(var(--line-3), var(--line-3)) bottom right / 1px 14px;
  background-repeat: no-repeat;
  opacity: 0; transition: opacity .4s;
}
.card.act::after { opacity: 1; }
.title { margin: 0 0 12px; font-size: 27px; line-height: 1.22; font-weight: 600; letter-spacing: -0.01em; }
.body p { margin: 0 0 10px; }
.body p:last-child { margin-bottom: 0; }
.body p.dim { opacity: .36; }
.body p { transition: opacity .35s; }
.evm { color: var(--neutral); margin-bottom: 10px; display: flex; }
.evm .ic { width: 22px; height: 22px; stroke-width: 1.4; }
.evm { align-items: center; gap: 10px; }
.evm .evd { font: 500 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
/* A review card: the lessons it joins, above its title. */
.rvm { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; color: var(--neutral); font: 500 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.rvm .ic { width: 22px; height: 22px; stroke-width: 1.4; margin-right: 2px; }
.rvm .rv-k { color: var(--ink-2); }
.rvm { flex-wrap: wrap; row-gap: 6px; }
.rvm .rv-l { padding: 5px 8px 4px; border: 1px solid var(--line-3); border-radius: 6px; color: var(--ink-2); letter-spacing: .06em; white-space: nowrap; }
.rvm .rv-k + .rv-l { margin-left: 6px; }
.rvm .rv-and { color: var(--ink-3); }
.rv-rule { margin: 0 0 12px; }
.rv-std { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.rv-s { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px 4px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--sel); color: var(--ink-2); font: 500 12px/1.2 var(--mono); letter-spacing: .02em; }
.rv-s .ic { width: 14px; height: 14px; stroke-width: 1.3; }
.rv-ex { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--sel); }
.rv-ex > .ic { width: 20px; height: 20px; margin-top: 3px; color: var(--ink-2); stroke-width: 1.3; }
.rv-ex .body { font-variant-numeric: tabular-nums; }

/* Word birth */
.card.word { padding-top: 26px; }
.card.word { --ra: 1; --rb: 1; --rc: 1; --rd: 1; --re: 1; }
.tw {
  margin: 0; font-size: 50px; line-height: 1.08; font-weight: 600; letter-spacing: -0.02em;
  color: var(--c);
}
.tw-t {
  display: inline-block;
  padding-bottom: 0.08em;
  clip-path: inset(0 calc((1 - var(--ra)) * 100%) 0 0);
  text-shadow: 0 0 calc(28px * var(--glow)) color-mix(in srgb, var(--c) 45%, transparent);
}
.tw-line {
  height: 2px; margin: 14px 0 16px; background: var(--c);
  transform-origin: left; transform: scaleX(var(--ra));
  box-shadow: 0 0 calc(12px * var(--glow)) var(--c);
}
.means {
  margin: 0; font-size: 21px; line-height: 1.45; font-weight: 500;
  opacity: var(--rb); transform: translateY(calc((1 - var(--rb)) * 10px));
}
.more, .not {
  display: flex; gap: 10px; margin: 14px 0 0; font-size: 16px; line-height: 1.55; color: var(--ink-2);
}
.more { opacity: var(--rc); transform: translateY(calc((1 - var(--rc)) * 10px)); }
.not { opacity: var(--rd); transform: translateY(calc((1 - var(--rd)) * 10px)); }
.more .ic, .not .ic { margin-top: 4px; color: var(--c); }
.not .ic { color: var(--bad); }
.wtext {
  margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line-2);
  opacity: var(--re);
}
.wtext p { margin: 0 0 8px; }
.wtext p:last-child { margin: 0; }

/* Term links */
.term {
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; line-height: inherit; color: inherit; cursor: pointer;
  border-bottom: 1px dashed var(--c);
  text-decoration: none;
  transition: color .2s, background .2s;
}
.term:hover, .term[aria-expanded="true"] { color: var(--c); background: var(--sel); }

/* Views */
.views { margin-top: 6px; }
.switch { display: none; gap: 0; margin-bottom: 12px; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; }
.sw {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; background: none; border: 0; color: var(--ink-2); cursor: pointer;
  font: 500 14px/1 var(--mono);
}
.sw + .sw { border-left: 1px solid var(--line-2); }
.sw[aria-pressed="true"] { background: var(--sel); color: var(--ink); }
.panels { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.panel { border: 1px solid var(--line-2); border-radius: 10px; padding: 14px 16px 16px; background: var(--bg); }
.ph { display: flex; align-items: center; gap: 9px; color: var(--neutral); margin-bottom: 8px; }
.ph h3 { margin: 0; font: 500 14px/1 var(--mono); color: var(--ink); }
.does { margin: 0 0 10px; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.says { margin: 0; font: 400 14.5px/1.55 var(--mono); color: var(--ink); border-left: 2px solid var(--neutral); padding-left: 11px; }

/* Exercises */
.rows { margin-top: 14px; }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap;
  padding: 11px 0; border-top: 1px solid var(--line);
}
.an { font-weight: 500; color: var(--c); font-size: 16px; }
.seg { display: flex; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; }
.opt {
  display: flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 11px;
  background: none; border: 0; color: var(--ink-2); cursor: pointer;
  font: 500 13px/1 var(--mono);
  transition: background .2s, color .2s;
}
.opt + .opt { border-left: 1px solid var(--line-2); }
.opt:hover { color: var(--ink); }
.opt[aria-pressed="true"] { background: var(--sel); color: var(--ink); box-shadow: inset 0 -2px 0 var(--neutral); }
.ctl { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; }
.check {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px;
  background: var(--neutral); color: var(--bg); border: 0; border-radius: 9px; cursor: pointer;
  font: 600 14px/1 var(--mono);
}
.check:disabled { background: transparent; color: var(--ink-3); border: 1px solid var(--line-2); cursor: default; }
.fb { margin: 12px 0 0; display: flex; gap: 10px; font-size: 16px; line-height: 1.5; }
.fb:empty { display: none; }
.fb .ic { margin-top: 4px; }
.fb.right { color: var(--has); }
.fb.wrong { color: var(--bad); }
.card.is-right { border-color: color-mix(in srgb, var(--has) 45%, var(--line)); }

/* Audit failure */
.audit { padding: 24px; font: 500 15px/1.6 var(--mono); color: var(--bad); }

/* ---------- Narrow screens: stage on top, cards below ---------- */
@media (max-width: 899px) {
  :root { --barH: 70px; --stageH: 42svh; --col: 100%; }
  .bar { padding: 0 16px; gap: 12px; align-items: center; }
  .cells { flex-wrap: wrap; gap: 4px 12px; align-content: center; }
  .mainc { --g: 10px; }
  .subs { --g: 14px; flex-basis: 100%; border-left: 0; padding-left: 0; }
  .cell { flex-direction: column; align-items: flex-start; gap: 3px; }
  .cell.sub .cl { font-size: 10.5px; }
  .cell.sub .ca { font-size: 12.5px; }
  .cl { font-size: 11px; }
  .ca { font-size: 16px; }
  .unit { padding: 3px 5px; font-size: 10px; }
  .stage {
    top: var(--barH); left: 0; right: 0; bottom: auto; height: var(--stageH);
    border-left: 0; border-bottom: 1px solid var(--line);
    z-index: 20;
  }
  .story { width: 100%; padding: calc(var(--barH) + var(--stageH)) 16px 0 var(--padL); --spine: 20px; --padL: 42px; --strand: 6px; --dotTop: 26px; --dot: 30.5px; }
  .step, .step.first { min-height: calc((100svh - var(--barH) - var(--stageH)) * .86); padding: 16px 0; align-items: center; }
  .step.ev { min-height: calc((100svh - var(--barH) - var(--stageH)) * 1.1); }
  .step.tall { min-height: calc((100svh - var(--barH) - var(--stageH)) * 1.5); }
  .closer { padding: 8px 0 45svh; }
  .card { padding: 18px 18px 18px; }
  .title { font-size: 22px; margin-bottom: 10px; }
  body { font-size: 16px; }
  .tw { font-size: 38px; }
  .tw-line { margin: 10px 0 12px; }
  .means { font-size: 18px; }
  .more, .not { font-size: 15px; margin-top: 10px; }
  .wtext { margin-top: 14px; padding-top: 10px; }
  .gloss { top: calc(var(--barH) + 6px); right: 12px; width: calc(100% - 24px); }
}
@media (max-width: 599px) {
  .switch { display: flex; }
  .panels { grid-template-columns: 1fr; }
  .panel { display: none; }
  .panel.sel { display: block; }
  .ph { display: none; }
  .row { padding: 9px 0; }
  .row { flex-wrap: nowrap; }
  .an { min-width: 0; }
  .opt { width: 40px; padding: 0; justify-content: center; }
  .opt span { display: none; }
}

/* ---------- Wide screens: the header reads lesson name on the left, the numbers on the right ---------- */
@media (min-width: 900px) {
  .bar .tools { order: -1; min-width: 0; flex: 0 1 auto; }
  /* A long lesson name gives way to the numbers: it shortens with an ellipsis, never runs under them. */
  .bar .lesson-tag { min-width: 0; }
  .bar .cells { justify-content: flex-end; }
  /* Wide screens (Bakr, 2026-11-28): the change light first, before the lesson name; the currency last, right of
   * the light/dark button. */
  .bar .led { order: -2; }
  .bar > .unit { order: 6; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .tw-t { clip-path: none; }
}
/* Lesson 11: marks in the panel's cells. */
.jr-a.mk-yes { fill: var(--has); font-weight: 700; font-size: 17px; }
.jr-a.mk-no { fill: var(--out); font-weight: 700; font-size: 17px; }
