/* Desmos Chops, "quiet tool" identity: white, ink and one violet accent. The graph is the hero.
   Inter Tight for headings, Inter for text, STIX Two for math. Fonts are self-hosted (SIL OFL, fonts/LICENSE-*.txt). */
@font-face { font-family: "Inter"; src: url("fonts/inter-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter Tight"; src: url("fonts/inter-tight-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter Tight"; src: url("fonts/inter-tight-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "STIX Two Text"; src: url("fonts/stix-two-text-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "STIX Two Text"; src: url("fonts/stix-two-text-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "STIX Two Text"; src: url("fonts/stix-two-text-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --bg: #ffffff; --ink: #15171c; --soft: #4a4f5c; --muted: #6b7180; --rule: #e6e8ee; --tint: #f6f7f9;
  --accent: #4b3bff; --accent-ink: #3a2be0; --accent-tint: #efedff;
  --good: #0f7b55; --good-tint: #e5f4ed; --bad: #c7362f; --bad-tint: #fcebea; --point: #8b93a5;
  --grid-minor: #f2f3f6; --grid-major: #e3e6ec;
  --g-minor: #f5f6f8; --g-major: #e9ebf0; --g-axis: #15171c; --g-label: #3b4050;
  --c1: #4b3bff; --c2: #15171c; --c3: #e0661b; --c4: #0f8a5f; --c5: #c2338a; --c6: #1f7ae0;
  --head: "Inter Tight", "Inter", system-ui, sans-serif; --body: "Inter", system-ui, sans-serif;
  --mathf: "STIX Two Text", "Times New Roman", Georgia, serif;
  --pink: #E0287F; --logo-bracket: #3D2BD9; --logo-ink: #0B0D12;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  color-scheme: dark; --bg: #060607; --ink: #f1f1f2; --soft: #bbbbc0; --muted: #8f8f96; --rule: #27272a; --tint: #121214;
  --accent: #9a90ff; --accent-ink: #b3abff; --accent-tint: #201e3e; --good: #4fd3a0; --good-tint: #112a20; --bad: #ff8078; --bad-tint: #331715; --point: #85858d;
  --grid-minor: #121213; --grid-major: #262629;
  --g-minor: #0e0e10; --g-major: #1f1f22; --g-axis: #f1f1f2; --g-label: #c8c8cd;
  --c1: #9a90ff; --c2: #eceef3; --c3: #ff9a57; --c4: #45c995; --c5: #f07ac0; --c6: #6aaeff;
  --pink: #FF4FA3; --logo-bracket: #8C82FF; --logo-ink: #EEF1F6; } }
:root[data-theme="dark"] {
  color-scheme: dark; --bg: #060607; --ink: #f1f1f2; --soft: #bbbbc0; --muted: #8f8f96; --rule: #27272a; --tint: #121214;
  --accent: #9a90ff; --accent-ink: #b3abff; --accent-tint: #201e3e; --good: #4fd3a0; --good-tint: #112a20; --bad: #ff8078; --bad-tint: #331715; --point: #85858d;
  --grid-minor: #121213; --grid-major: #262629;
  --g-minor: #0e0e10; --g-major: #1f1f22; --g-axis: #f1f1f2; --g-label: #c8c8cd;
  --c1: #9a90ff; --c2: #eceef3; --c3: #ff9a57; --c4: #45c995; --c5: #f07ac0; --c6: #6aaeff;
  --pink: #FF4FA3; --logo-bracket: #8C82FF; --logo-ink: #EEF1F6; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.55; -webkit-text-size-adjust: 100%; }
button, input { font: inherit; color: inherit; }
a { color: var(--accent-ink); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 24px 48px; display: flex; flex-direction: column; gap: 28px; }
.view { display: flex; flex-direction: column; gap: 26px; min-width: 0; }

/* header */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-bottom: 4px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--head); font-weight: 700; font-size: 21px; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.brand svg { width: 26px; height: 26px; flex: none; }
.meta { display: flex; gap: 6px 22px; flex-wrap: wrap; font-size: 15px; font-weight: 500; }
.meta a { color: var(--soft); text-decoration: none; padding: 4px 0; }
.meta a:hover { color: var(--ink); }

/* type */
h1 { font-family: var(--head); font-weight: 700; font-size: clamp(34px, 4.6vw, 52px); line-height: 1.04; letter-spacing: -0.03em; margin: 0; text-wrap: balance; }
h2 { font-family: var(--head); font-weight: 600; font-size: 24px; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 12px; }
h3 { font-family: var(--head); font-weight: 600; font-size: 18px; line-height: 1.3; letter-spacing: -0.01em; margin: 0; }
.lede { font-size: 19px; max-width: 40em; margin: 0; color: var(--soft); }
.small { font-size: 14px; } .soft { color: var(--muted); } .err { color: var(--bad); }
.eyebrow, .lab { font-size: 15px; font-weight: 500; color: var(--muted); margin: 0; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 4px; background: var(--tint); color: var(--soft); border: 1px solid var(--rule); margin-left: 4px; vertical-align: 1px; }

/* surfaces + buttons */
.sheet { background: var(--bg); border: 1px solid var(--rule); border-radius: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.go { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; font-weight: 600; font-size: 16px; padding: 10px 20px; border-radius: 8px; background: var(--ink); color: var(--bg); border: 1px solid var(--ink); text-decoration: none; cursor: pointer; }
.go:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.go[disabled] { opacity: .4; cursor: default; background: var(--ink); border-color: var(--ink); color: var(--bg); }
.go.ghost { background: var(--bg); color: var(--ink); border-color: var(--rule); }
.go.ghost:hover { border-color: var(--ink); background: var(--bg); color: var(--ink); }
.linkbtn { background: none; border: 0; padding: 4px 0; color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 15px; font-weight: 500; }
.linkbtn.soft { color: var(--muted); }
.crumbs { display: flex; gap: 18px; align-items: baseline; flex-wrap: wrap; font-size: 15px; color: var(--muted); }
.crumbs a { color: var(--soft); }
.mnext { margin: 0; background: var(--tint); border-radius: 8px; padding: 12px 14px; font-size: 16px; }
.disclaimer { margin: 6px 0 0; max-width: 70em; color: var(--muted); }
.bar-prog { height: 6px; background: var(--grid-major); border-radius: 3px; overflow: hidden; }
.bar-prog i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* ---------- home ---------- */
.hero { position: relative; min-height: 440px; display: flex; align-items: center; border-bottom: 1px solid var(--rule); margin: 0 -24px; padding: 0 24px; overflow: hidden; }
.hero-graph { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-copy { position: relative; display: flex; flex-direction: column; gap: 20px; max-width: 600px; padding: 30px 28px 40px 0; background: linear-gradient(90deg, var(--bg) 82%, transparent); }
.hero h1 { font-size: clamp(42px, 6vw, 70px); line-height: 1; letter-spacing: -0.04em; }
.hero .lede { font-size: 20px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.sec-head h2 { margin: 0; }
.prog-line { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.prog-line .bar-prog { flex: 1; }
/* each group of moves is its own part: a heavy rule, a part label, a real heading and one line on what it is for */
.group { margin-top: 44px; padding-top: 16px; border-top: 2px solid var(--ink); }
.prog-line + .group { margin-top: 28px; }
.group-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; align-items: baseline; margin-bottom: 8px; }
.group-part { grid-column: 1 / -1; margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.group-h { margin: 0; font-family: var(--head); font-size: 26px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.15; color: var(--ink); }
.group-count { font-size: 14px; color: var(--muted); white-space: nowrap; }
.group-desc { grid-column: 1 / -1; margin: 4px 0 0; font-size: 16px; color: var(--soft); max-width: 62ch; }
.moves { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; }
.move { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 4px 10px; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.move .mk { font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 15px; }
.move .mk.done { color: var(--accent); }
.move h3 a { color: var(--ink); text-decoration: none; }
.move h3 a:hover { color: var(--accent-ink); text-decoration: underline; }
.move .ex { font-family: var(--mathf); font-style: italic; color: var(--muted); font-size: 17px; white-space: nowrap; }
.move p { grid-column: 2 / -1; margin: 0; font-size: 15px; color: var(--soft); }
.move .acts { grid-column: 2 / -1; display: flex; gap: 18px; font-size: 15px; font-weight: 500; flex-wrap: wrap; }
.move .acts span { color: var(--muted); font-weight: 400; }
.checkrow { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding: 22px 24px; margin-top: 28px; background: var(--tint); border-radius: 12px; }
.checkrow h2 { margin: 0 0 4px; } .checkrow p { margin: 0; color: var(--soft); }
.facts { padding: 24px 26px; }
.facts ul { margin: 0 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- lesson ---------- */
.lesson-head { display: flex; flex-direction: column; gap: 10px; }
.lesson { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
.steps { padding: 18px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.steps-top { display: flex; flex-direction: column; gap: 8px; }
.steps-top .lab b { color: var(--ink); font-weight: 600; }
.ovals { display: flex; gap: 3px; }
.ovals i { flex: 1; height: 4px; border-radius: 2px; background: var(--grid-major); }
.ovals i.on { background: var(--accent); } .ovals i.now { background: var(--ink); }
.step { border: 1.5px solid var(--accent); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.step.finish { border-color: var(--good); }
.step.finish h2 { margin: 0; }
.step-text { margin: 0; font-size: 17px; font-weight: 500; }
.step-btns { gap: 18px; }
.nudge { margin: 0; color: var(--soft); font-size: 15px; font-weight: 500; } .nudge:empty { display: none; }
.nudge.bad { color: var(--bad); }
.hint { margin: 0; font-size: 15px; background: var(--tint); border-radius: 6px; padding: 8px 10px; }
.done-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.done-list li { display: flex; gap: 10px; font-size: 15px; border-top: 1px solid var(--rule); padding-top: 10px; }
.done-list li p { margin: 0; } .done-list li p:first-child { color: var(--muted); }
.done-list .ok { color: var(--ink); }
.done-list .tick { flex: 0 0 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; margin-top: 2px; }
.done-list .skipped .tick { background: var(--grid-major); color: var(--soft); }
.simwrap { padding: 0; overflow: hidden; min-width: 0; }
.tips { padding: 20px 24px; } .tips ul { margin: 0 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; align-items: center; gap: 12px; text-align: left; padding: 8px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--bg); cursor: pointer; min-height: 44px; }
.choice:hover:not([disabled]) { border-color: var(--ink); }
.choice .bub { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--soft); display: grid; place-items: center; font-weight: 600; font-size: 14px; color: var(--soft); }
.choice.sel { border-color: var(--accent); background: var(--accent-tint); } .choice.sel .bub { background: var(--accent); border-color: var(--accent); color: #fff; }
.choice.right { border-color: var(--good); background: var(--good-tint); } .choice.right .bub { background: var(--good); border-color: var(--good); color: #fff; }
.choice.wrong { border-color: var(--bad); background: var(--bad-tint); } .choice.wrong .bub, .choice.wrong.sel .bub { background: var(--bg); border-color: var(--bad); color: var(--bad); }
.choice[disabled] { cursor: default; }

/* ---------- quiz ---------- */
.qstrip { display: flex; gap: 4px; max-width: 900px; }
.qstrip span { flex: 1; height: 6px; border-radius: 3px; background: var(--grid-major); font-size: 0; }
.qstrip .now { background: var(--ink); } .qstrip .right { background: var(--good); } .qstrip .wrong { background: var(--bad); }
.q { padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px 24px; max-width: 900px; }
.q-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.q-side { min-width: 0; } .q-side[hidden] { display: none; }
.side-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.q-side .scratch, .q > .solution { margin-top: 0; }
.q-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.q-head .qn { font-family: var(--head); font-weight: 600; font-size: 17px; }
.q-head .tag { margin: 0; }
.stem { font-size: 19px; }
.spr { display: flex; flex-direction: column; gap: 6px; max-width: 280px; }
.spr input { padding: 10px 12px; border: 1px solid var(--soft); border-radius: 8px; background: var(--bg); font-size: 19px; }
.q-btns { gap: 18px; }
.verdict { padding: 12px 16px; border-radius: 8px; font-size: 17px; }
.verdict.yes { background: var(--good-tint); } .verdict.no { background: var(--bad-tint); }
.verdict .v-head { font-family: var(--head); font-weight: 700; margin-right: 4px; }
.why { margin: 12px 0; }
.solution, .scratch { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.solution > div, .scratch > div { border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.solution[hidden], .scratch[hidden] { display: none; }
.say { margin: 0; font-weight: 600; font-size: 17px; }
.result { padding: 28px; display: flex; flex-direction: column; gap: 16px; max-width: 900px; }
.mtotal { display: flex; align-items: baseline; gap: 12px; }
.mtotal .num { font-family: var(--head); font-weight: 700; font-size: 88px; line-height: .9; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.mtotal .of { font-weight: 500; font-size: 20px; color: var(--muted); }
.skillres { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0 24px; }
.skillres li { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.skillres li span { font-weight: 700; } .skillres .yes span { color: var(--good); } .skillres .no span { color: var(--bad); }
.qtable { border-collapse: collapse; margin: 10px 0; font-size: 17px; }
.qtable th, .qtable td { border: 1px solid var(--rule); padding: 5px 14px; text-align: center; }
.qtable th { background: var(--tint); font-weight: 600; }

/* ---------- math ---------- */
.math, .mathd { font-family: var(--mathf); font-size: 1.1em; white-space: nowrap; }
.mathd { display: block; text-align: center; margin: 6px 0; font-size: 1.15em; }
.math i, .mathd i { font-style: italic; }
.math sup, .mathd sup { font-size: .72em; }
.math sup.idx { font-size: .6em; margin-right: -.3em; vertical-align: .7em; }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; font-size: .9em; line-height: 1.1; }
.frac > span:first-child { border-bottom: 1px solid currentColor; padding: 0 2px; }
.rad { border-top: 1px solid currentColor; padding: 0 2px; }

/* ---------- practice grapher ---------- */
.sim { display: grid; grid-template-columns: minmax(250px, 330px) minmax(0, 1fr); height: 560px; background: var(--bg); }
.sim-compact { height: 420px; grid-template-columns: minmax(210px, 280px) minmax(0, 1fr); }
.simwrap.tall .sim { height: min(78vh, 760px); }
.sim-list { border-right: 1px solid var(--rule); display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.sim-tools { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--rule); background: var(--tint); position: relative; }
.sim-title { flex: 1; font-size: 13px; font-weight: 500; color: var(--muted); }
.sim-icon { width: 34px; height: 32px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--soft); cursor: pointer; padding: 0; }
.sim-icon svg { width: 20px; height: 20px; }
.sim-icon[data-act="keys"] svg { width: 22px; height: 15px; }
.sim-icon:hover, .sim-icon.on, .sim-icon[aria-pressed="true"] { background: var(--bg); border-color: var(--rule); color: var(--ink); }
.sim-addwrap { position: relative; }
.sim-menu { position: absolute; top: 36px; left: 0; z-index: 5; min-width: 150px; background: var(--bg); border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 8px 24px rgba(21, 23, 28, .12); padding: 4px; display: flex; flex-direction: column; }
.sim-menu[hidden] { display: none; }
.sim-menu button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.sim-menu button:hover { background: var(--tint); }
.sim.readonly .sim-tools { display: none; }
.sim-rows { flex: 1 1 auto; overflow: auto; }
.srow { display: grid; grid-template-columns: 22px 22px minmax(0, 1fr) 24px; gap: 6px; align-items: start; padding: 8px 6px 8px 4px; border-bottom: 1px solid var(--rule); border-left: 3px solid transparent; }
.srow.on { border-left-color: var(--rc); background: var(--tint); }
.srow-n { font-size: 12px; color: var(--muted); text-align: right; padding-top: 8px; font-variant-numeric: tabular-nums; }
.srow-sw { width: 16px; height: 16px; margin-top: 8px; justify-self: center; border-radius: 50%; border: 2px solid var(--rc); background: var(--rc); padding: 0; cursor: pointer; }
.srow-sw.off { background: transparent; }
.srow-in { width: 100%; border: 0; background: transparent; padding: 4px 2px; font-family: var(--mathf); font-size: 20px; outline: none; border-bottom: 1.5px solid transparent; }
.srow-in:focus { border-bottom-color: var(--rc); }
.sim.readonly .srow-in { cursor: default; }
.srow-out { font-size: 15px; padding: 0 2px; }
.srow-out:empty { display: none; }
.srow-out.val { text-align: right; font-family: var(--mathf); font-size: 19px; font-weight: 600; }
/* the fraction icon takes the color dot's place when an answer can be shown as a fraction */
.srow-lead { display: grid; justify-items: center; }
.srow-frac { width: 22px; height: 22px; margin-top: 5px; display: grid; place-items: center; padding: 0; border: 1.5px solid var(--soft); border-radius: 50%; background: var(--bg); color: var(--soft); cursor: pointer; }
.srow-frac svg { width: 12px; height: 12px; }
.srow-frac[hidden] { display: none; }
.srow-frac:hover, .srow-frac[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-tint); }
.srow-out.err { color: var(--muted); font-size: 14px; }
.srow-out.reg { display: flex; flex-wrap: wrap; gap: 2px 14px; font-family: var(--mathf); font-size: 17px; }
.srow-out.sld { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.srow-out.sld input { flex: 1 1 auto; accent-color: var(--rc); min-width: 0; }
.srow-x { border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; padding: 4px 0; cursor: pointer; }
.srow-x:hover { color: var(--bad); }
.chipbtn { font-family: var(--mathf); font-style: italic; font-size: 17px; padding: 0 10px; border: 1px solid var(--accent); border-radius: 999px; background: var(--accent-tint); color: var(--accent-ink); cursor: pointer; margin-left: 2px; }
.srow-new { width: 100%; text-align: left; padding: 12px 14px 12px 56px; border: 0; background: none; color: var(--muted); font-size: 14px; cursor: text; }
.srow-new:hover { color: var(--ink); }
.stable { border-collapse: collapse; font-family: var(--mathf); font-size: 17px; }
.stable th { font-style: italic; font-weight: 400; padding: 2px 8px; border-bottom: 1.5px solid var(--ink); }
.stable td { border-bottom: 1px solid var(--rule); padding: 0; }
.stable td + td, .stable th + th { border-left: 1px solid var(--rule); }
.stable input { width: 64px; border: 0; background: transparent; padding: 3px 6px; font: inherit; text-align: center; }
.sim-keys { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 8px; border-top: 1px solid var(--rule); background: var(--tint); }
.sim-keys[hidden] { display: none; }
.sim-keys button { padding: 7px 2px; border: 1px solid var(--rule); background: var(--bg); border-radius: 6px; cursor: pointer; font-family: var(--mathf); font-size: 15px; }
.sim-keys button:hover { border-color: var(--ink); }
.sim-graph { position: relative; min-width: 0; min-height: 0; }
.sim-graph canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }
.sim-zoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 8px; }
.sim-zoom > button, .sim-stack button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--rule); background: var(--bg); color: var(--soft); cursor: pointer; padding: 0; box-shadow: 0 1px 3px rgba(21, 23, 28, .08); }
.sim-zoom > button { border-radius: 8px; }
.sim-zoom svg { width: 18px; height: 18px; }
.sim-stack { display: flex; flex-direction: column; border-radius: 8px; box-shadow: 0 1px 3px rgba(21, 23, 28, .08); }
.sim-stack button { box-shadow: none; }
.sim-stack button:first-child { border-radius: 8px 8px 0 0; border-bottom: 0; }
.sim-stack button:last-child { border-radius: 0 0 8px 8px; }
.sim-zoom button:hover, .sim-wrench[aria-expanded="true"] { color: var(--ink); border-color: var(--soft); }
.sim-wrench[aria-expanded="true"] { background: var(--tint); }
.sim-settings { position: absolute; top: 10px; right: 56px; z-index: 6; width: 220px; background: var(--bg); border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 10px 28px rgba(21, 23, 28, .14); padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.sim-settings[hidden] { display: none; }
.sim-set-h { margin: 0; font-weight: 600; font-size: 14px; }
.sim-check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.sim-check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.sim-seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.sim-seg button { border: 0; background: var(--bg); padding: 8px 0; font-size: 14px; cursor: pointer; color: var(--soft); }
.sim-seg button + button { border-left: 1px solid var(--rule); }
.sim-seg button[aria-checked="true"] { background: var(--accent); color: #fff; font-weight: 600; }

/* ---------- footer ---------- */
.logo { height: 1.15em; width: auto; display: block; flex: 0 0 auto; }
.lg-bracket { fill: var(--logo-bracket); } .lg-ink { fill: var(--logo-ink); } .lg-pink { fill: var(--pink); }
.byline { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: .5em; font-weight: 500; font-size: 14px; }
.byline:hover span { text-decoration: underline; }
.foot { display: flex; justify-content: center; }
.themebar { display: flex; justify-content: center; gap: 0; }
.themebar .tb { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13px; padding: 5px 12px; border: 1px solid var(--rule); background: var(--bg); color: var(--soft); cursor: pointer; }
.themebar .tb:first-child { border-radius: 6px 0 0 6px; } .themebar .tb:last-child { border-radius: 0 6px 6px 0; border-left: 0; }
.themebar .tb[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.themebar svg { width: 14px; height: 14px; flex: 0 0 auto; }

/* ---------- small screens ---------- */
@media (max-width: 920px) {
  .moves { grid-template-columns: 1fr; }
  .lesson { grid-template-columns: 1fr; }
  /* the step card stays pinned above the grapher, so the instruction and the typing line share the screen */
  .steps { position: sticky; top: 0; z-index: 8; max-height: 52vh; padding: 12px; gap: 10px; border-radius: 0 0 12px 12px; box-shadow: 0 8px 20px rgba(21, 23, 28, .12); }
  .steps .done-list { display: none; }
  .step { padding: 10px 12px; gap: 8px; }
  .step-text { font-size: 16px; }
  .intro-toggle { display: inline-block; }
  .intro.shut .lede { display: none; }
}
@media (max-width: 680px) {
  .wrap { padding: 16px 16px 40px; }
  .hero { margin: 0 -16px; padding: 0 16px; min-height: 0; flex-direction: column; align-items: stretch; }
  .hero-graph { position: relative; height: 220px; order: 2; }
  .hero-copy { background: none; padding: 16px 0 8px; }
  .sim, .sim-compact { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; height: auto; }
  .sim-graph { order: -1; height: 320px; }
  .sim-list { border-right: 0; border-top: 1px solid var(--rule); max-height: 300px; }
  .simwrap.tall .sim { height: auto; } .simwrap.tall .sim-graph { height: 55vh; }
  .move .ex { display: none; }
  .q { padding: 16px; } .mtotal .num { font-size: 68px; }
}

/* ---------- completion ---------- */
.move .mk { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; align-self: start; margin-top: 1px; }
.move .mk svg { width: 14px; height: 14px; }
.move .mk.half { border: 1.5px solid var(--accent); color: var(--accent); }
.move .mk.full { background: var(--accent); color: #fff; }
.move .donelab { margin-left: 10px; font-family: var(--body); font-size: 12px; font-weight: 600; color: var(--accent-ink); background: var(--accent-tint); border-radius: 999px; padding: 2px 9px; vertical-align: 2px; }
.move .acts { align-items: center; gap: 6px 10px; }
.move .acts a + .chip, .move .acts .chip { margin-right: 8px; }
.chip { font-size: 12px; font-weight: 500; color: var(--soft); background: var(--tint); border: 1px solid var(--rule); border-radius: 999px; padding: 1px 8px; }
.chip.ok { color: var(--accent-ink); background: var(--accent-tint); border-color: transparent; }
.status { margin: 0; display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; font-size: 15px; color: var(--soft); background: var(--tint); border-radius: 999px; padding: 5px 14px 5px 6px; }
.status.ok { color: var(--accent-ink); background: var(--accent-tint); }
.status-ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--grid-major); color: var(--soft); flex: none; }
.status.ok .status-ic { background: var(--accent); color: #fff; }

/* ---------- lesson step results ---------- */
.small-go { min-height: 36px; padding: 6px 16px; font-size: 15px; }
.step.solved { border-color: var(--good); }
.step-result { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--rule); padding-top: 12px; }
.step-result[hidden] { display: none; }
.step-result p { margin: 0; }
.res-head { display: flex; align-items: center; gap: 8px; font-family: var(--head); font-weight: 700; font-size: 17px; color: var(--good); }
.res-ic { width: 22px; height: 22px; border-radius: 50%; background: var(--good); color: #fff; display: grid; place-items: center; font-size: 12px; }
.res-body { font-size: 16px; }
.step-btns[hidden], .hint[hidden] { display: none; }

/* ---------- test picker, next move ---------- */
.testpick { display: inline-flex; align-items: center; }
.testpick .lab { margin-right: 10px; font-size: 14px; }
.testpick button { min-height: 36px; padding: 6px 14px; border: 1px solid var(--rule); background: var(--bg); color: var(--soft); font-size: 14px; font-weight: 500; cursor: pointer; }
.testpick button + button { border-left: 0; }
.testpick button:first-of-type { border-radius: 8px 0 0 8px; } .testpick button:last-of-type { border-radius: 0 8px 8px 0; }
.testpick button[aria-checked="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.move.next { background: var(--accent-tint); margin: 0 -12px; padding: 14px 12px; border-radius: 10px; border-bottom-color: transparent; }
.move .nextlab { margin-left: 10px; font-family: var(--body); font-size: 12px; font-weight: 600; color: var(--bg); background: var(--accent); border-radius: 999px; padding: 2px 9px; vertical-align: 2px; white-space: nowrap; }
.move .acts a { display: inline-flex; align-items: center; min-height: 32px; }

/* ---------- lesson: intro toggle, your-turn step ---------- */
.intro { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.intro-toggle { display: none; }
.solo-lab { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .01em; color: var(--accent-ink); }
.step.finish.retry { border-color: var(--soft); }

/* ---------- quiz: side grapher, move tag, retype ---------- */
.again-note { margin: 0; font-size: 15px; color: var(--soft); background: var(--tint); border-radius: 8px; padding: 8px 12px; }
.qstrip .again { outline: 2px solid var(--ink); outline-offset: 1px; }
.movetag { margin: 12px 0 0; display: flex; gap: 6px 10px; align-items: baseline; flex-wrap: wrap; font-size: 16px; }
.movetag .tag { margin: 0; }
.retype { margin: 4px 0 0; display: flex; gap: 8px 14px; align-items: center; flex-wrap: wrap; }
.retype-msg { margin: 8px 0 0; font-size: 15px; font-weight: 500; color: var(--soft); background: var(--tint); border-radius: 8px; padding: 8px 12px; }
.retype-msg.ok { color: var(--good); background: var(--good-tint); }
.retype-msg[hidden] { display: none; }
@media (min-width: 1000px) {
  .q { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); max-width: none; align-items: start; }
  .qstrip { max-width: none; }
  .q-side, .q-side[hidden] { display: block; }
  .q > .solution { grid-column: 1 / -1; }
  .scratch-toggle { display: none; }
  .q-side .sim-compact { height: 470px; grid-template-columns: minmax(150px, 210px) minmax(0, 1fr); }
}

/* ---------- touch targets ---------- */
@media (pointer: coarse), (max-width: 680px) {
  .linkbtn { padding: 12px 2px; }
  .step-btns { gap: 4px 18px; }
  .move .acts a, .crumbs a, .meta a { display: inline-flex; align-items: center; min-height: 44px; }
  .move h3 a { display: inline-block; padding: 6px 0; }
  .testpick button { min-height: 44px; }
  .themebar .tb { min-height: 40px; }
  .srow { grid-template-columns: 22px 30px minmax(0, 1fr) 28px; }
  .srow-frac { width: 30px; height: 30px; margin-top: 1px; } .srow-frac svg { width: 14px; height: 14px; }
  .srow-new { padding-left: 64px; }
}
