/* Rust, from the ground up: the Spectrum design system.
   Surfaces, code and terminal colors come from Cursor's own themes:
   Pastel sits on Cursor Light, the dark theme on Cursor Dark.
   Each Rust concept owns one pastel; a chapter sets --c, --c-2 and --c-ink
   from its concept, and every component reads those three.
   Parts are set apart by tone and space, not by borders. */
:root {
  /* Cursor Light: panels #F3F3F3, editor #FCFCFC, text #141414 */
  --bg: #f3f3f3;
  --surface: #fcfcfc;
  --sunk: #f3f3f3;
  --raised: #ffffff;
  --ink: #141414;
  --ink-2: rgba(20, 20, 20, .72);
  --ink-3: rgba(20, 20, 20, .5);
  --ink-4: rgba(20, 20, 20, .36);
  --hover: rgba(20, 20, 20, .05);
  --press: rgba(20, 20, 20, .08);
  --track: rgba(20, 20, 20, .09);
  --code-bg: rgba(20, 20, 20, .055);
  --btn-bg: #141414; --btn-fg: #fcfcfc; --btn-hover: #2b2b2b; --btn-off: rgba(20, 20, 20, .2);
  --soft-shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 6px 24px rgba(20, 20, 20, .05);

  /* Cursor Light editor and terminal */
  --ed-bg: #fcfcfc; --ed-fg: #141414; --ed-line: #eaeaea; --ed-num: rgba(20, 20, 20, .36); --ed-num-on: rgba(20, 20, 20, .74);
  --ed-sel: rgba(20, 20, 20, .08); --ed-caret: #141414;
  --term-bg: #f3f3f3; --term-fg: #141414; --term-dim: rgba(20, 20, 20, .55);
  --ansi-red: #be1744; --ansi-blue: #2778c1; --ansi-cyan: #176c74; --ansi-green: #007041; --ansi-yellow: #8b5700; --ansi-magenta: #92156a;

  --base: #fff0c4;  --base-2: #f0cd6a;  --base-ink: #835c0b;   /* foundations */
  --own: #ffe2d4;   --own-2: #f7b79a;   --own-ink: #a54a22;    /* ownership */
  --borrow: #dcebff; --borrow-2: #9cc2f5; --borrow-ink: #2c5f9e; /* borrowing */
  --life: #ebe3ff;  --life-2: #bba7f0;  --life-ink: #5b3fb0;   /* lifetimes */
  --trait: #dbf4e6; --trait-2: #96d6b2; --trait-ink: #2a7350;  /* traits */
  --err: #fde4e6;   --err-2: #f1a3ac;   --err-ink: #a8323f;
  --ok: #dbf4e6;    --ok-ink: #2a7350;

  --c: var(--base); --c-2: var(--base-2); --c-ink: var(--base-ink);

  --sans: "Hanken Grotesk", system-ui, sans-serif;
  --mono: Menlo, Monaco, "Courier New", monospace;   /* Cursor's default editor font on macOS */
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

/* Cursor Dark: panels #141414, editor #181818, text #F0F0F0 */
:root[data-theme="dark"] {
  --bg: #141414;
  --surface: #181818;
  --sunk: #141414;
  --raised: #1f1f1f;
  --ink: #f0f0f0;
  --ink-2: rgba(240, 240, 240, .74);
  --ink-3: rgba(240, 240, 240, .5);
  --ink-4: rgba(240, 240, 240, .36);
  --hover: rgba(240, 240, 240, .067);
  --press: rgba(240, 240, 240, .1);
  --track: rgba(240, 240, 240, .12);
  --code-bg: #262626;
  --btn-bg: #81a1c1; --btn-fg: #191c22; --btn-hover: #93b0cd; --btn-off: #333333;
  --soft-shadow: none;

  --ed-bg: #181818; --ed-fg: #f0f0f0; --ed-line: #262626; --ed-num: rgba(240, 240, 240, .36); --ed-num-on: #f0f0f0;
  --ed-sel: rgba(64, 64, 64, .6); --ed-caret: #f0f0f0;
  --term-bg: #141414; --term-fg: #f0f0f0; --term-dim: rgba(240, 240, 240, .5);
  --ansi-red: #fc6b83; --ansi-blue: #87a6c4; --ansi-cyan: #88c0d0; --ansi-green: #70b489; --ansi-yellow: #f1b467; --ansi-magenta: #b48ead;

  --base: #2a2415;  --base-2: #e9c66a;  --base-ink: #f3d68a;
  --own: #2e1f18;   --own-2: #f0a988;   --own-ink: #f5c2aa;
  --borrow: #182230; --borrow-2: #8fb6ea; --borrow-ink: #a9c9f5;
  --life: #221d33;  --life-2: #ad98ea;  --life-ink: #c7b8f5;
  --trait: #15251d; --trait-2: #7fc79f; --trait-ink: #a3dcbb;
  --err: #2e161c;   --err-2: #a8445c;   --err-ink: #f08aa3;
  --ok: #15251d;    --ok-ink: #6fcf97;
  color-scheme: dark;
}
.c-base { --c: var(--base); --c-2: var(--base-2); --c-ink: var(--base-ink); }
.c-own { --c: var(--own); --c-2: var(--own-2); --c-ink: var(--own-ink); }
.c-borrow { --c: var(--borrow); --c-2: var(--borrow-2); --c-ink: var(--borrow-ink); }
.c-life { --c: var(--life); --c-2: var(--life-2); --c-ink: var(--life-ink); }
.c-trait { --c: var(--trait); --c-2: var(--trait-2); --c-ink: var(--trait-ink); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.65 var(--sans); -webkit-font-smoothing: antialiased; }
::selection { background: var(--c); }
code { font: .84em var(--mono); background: var(--code-bg); padding: .12em .38em; border-radius: 5px; }
a { color: var(--c-ink); text-underline-offset: 3px; }

.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }

/* ---------- rail ---------- */
.rail { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 28px 22px; }
.home { display: inline-block; font-weight: 700; font-size: 13px; letter-spacing: .01em; color: var(--ink-3); text-decoration: none; margin: 0 0 14px; }
.home:hover { color: var(--ink); }
.book { font-weight: 600; font-size: 15px; letter-spacing: -.01em; margin: 0 0 26px; }
.book span { display: block; font-weight: 400; color: var(--ink-3); font-size: 13px; }
.rail h4 { font-size: 12px; font-weight: 500; color: var(--ink-3); margin: 22px 0 8px; }
.rail ol { list-style: none; margin: 0; padding: 0; }
.rail li > a { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 14px; transition: background .15s, color .15s; }
.rail li > a:hover { background: var(--hover); color: var(--ink); }
.rail li > a.on { background: var(--surface); color: var(--ink); font-weight: 500; }
.rail li > .soon { display: flex; align-items: center; gap: 10px; padding: 6px 8px; color: var(--ink-3); font-size: 14px; cursor: default; }
.rail li > .soon .dot { opacity: .45; }
.rail .n { width: 20px; color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: 13px; }
.rail .dot { width: 8px; height: 8px; border-radius: 50%; margin-left: auto; flex: none; background: var(--ink-4); }
.rail .sub { margin: 4px 0 6px 30px; }
.rail .sub a { display: block; font-size: 13.5px; padding: 4px 10px; border-radius: 6px; color: var(--ink-3); text-decoration: none; transition: color .15s; }
.rail .sub a:hover { color: var(--ink); }
.rail .sub a.on { color: var(--ink); font-weight: 500; background: var(--hover); }
.progress { margin-top: 26px; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.progress .bar { height: 4px; background: var(--track); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.progress .bar i { display: block; height: 100%; width: 100%; background: var(--c-2); border-radius: 2px; transform-origin: left; transform: scaleX(0); transition: transform .5s var(--ease); }

/* theme switch */
.theme-switch { display: flex; background: var(--hover); border-radius: 9px; padding: 3px; gap: 2px; margin: -8px 0 22px; }
.theme-switch button { flex: 1; border: 0; background: transparent; color: var(--ink-2); font: 500 12.5px/1 var(--sans); padding: 7px 6px; border-radius: 7px; cursor: pointer; white-space: nowrap; transition: background .2s, color .2s; }
.theme-switch button:hover { color: var(--ink); }
.theme-switch button[aria-checked="true"] { background: var(--surface); color: var(--ink); }
.theme-switch button:focus-visible { outline: 2px solid var(--c-ink); outline-offset: 1px; }
.mobile-bar { display: none; }

/* ---------- main column ---------- */
main { padding: 40px 56px 140px; min-width: 0; }
.col { max-width: 780px; margin: 0 auto; }
.opener { background: var(--c); border-radius: 22px; padding: 46px 46px 38px; margin-bottom: 48px; }
.opener .kick { font-size: 14px; color: var(--c-ink); font-weight: 500; margin: 0 0 18px; }
.opener h1 { font-size: 58px; line-height: 1.02; letter-spacing: -.035em; font-weight: 600; margin: 0; text-wrap: balance; }
.opener .dek { font-size: 20px; color: color-mix(in srgb, var(--c-ink) 70%, var(--ink)); margin: 14px 0 0; max-width: 42ch; line-height: 1.45; }
.opener .meta { margin: 30px 0 0; font-size: 14px; color: color-mix(in srgb, var(--c-ink) 80%, var(--ink)); font-variant-numeric: tabular-nums; }

h2 { font-size: 28px; letter-spacing: -.025em; line-height: 1.2; font-weight: 600; margin: 64px 0 12px; text-wrap: balance; scroll-margin-top: 24px; }
h2 .num { color: var(--ink-3); font-weight: 500; margin-right: 10px; font-variant-numeric: tabular-nums; }
h2 code { font-size: .76em; }
p { margin: 0 0 1em; max-width: 68ch; }
.concept { background: linear-gradient(transparent 62%, var(--c) 62%); padding: 0 1px; }
:root[data-theme="dark"] .concept { background: linear-gradient(transparent 62%, color-mix(in srgb, var(--c-2) 30%, transparent) 62%); }

.card { background: var(--surface); border-radius: 16px; box-shadow: var(--soft-shadow); }
.label { font-size: 13px; font-weight: 500; color: var(--ink-3); margin: 0 0 8px; }

/* ---------- buttons: filled, no outlines ---------- */
.btn { font: 500 14px/1 var(--sans); color: var(--ink); background: var(--hover); border: 0; border-radius: 999px; padding: 10px 16px; cursor: pointer; transition: background .15s, color .15s; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--press); }
.btn:active:not(:disabled) { background: var(--track); }
.btn:disabled { color: var(--ink-4); cursor: default; background: transparent; }
.btn:focus-visible, .fig:focus-visible { outline: 2px solid var(--c-ink); outline-offset: 2px; }
.btn.primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn.primary:hover:not(:disabled) { background: var(--btn-hover); }
.btn.primary:disabled { background: var(--btn-off); color: var(--btn-fg); }
.btn.quiet { background: transparent; color: var(--ink-2); padding: 10px 10px; }
.btn.quiet:hover:not(:disabled) { color: var(--ink); background: var(--hover); }

/* ---------- code: Shiki tokens carry both Cursor themes ---------- */
.t { color: var(--l); font-style: var(--ls, normal); font-weight: var(--lw, inherit); }
:root[data-theme="dark"] .t { color: var(--d); font-style: var(--ds, normal); font-weight: var(--dw, inherit); }
pre.code { margin: 0; font: 13.5px/1.7 var(--mono); padding: 18px 20px; overflow-x: auto; white-space: pre; color: var(--ed-fg); background: var(--ed-bg); }
.listing { margin: 0; font: 13px/1.85 var(--mono); color: var(--ed-fg); background: var(--ed-bg); border-radius: 12px; padding: 10px 0; white-space: pre; overflow-x: auto; }
.listing .ln { display: block; padding-right: 14px; transition: background .3s; }
.listing .ln-no { display: inline-block; width: 30px; text-align: right; margin-right: 14px; color: var(--ed-num); user-select: none; }
.listing .ln.on { background: var(--ed-line); }
.listing .ln.on .ln-no { color: var(--ed-num-on); }
.code ::selection, .listing ::selection, .editor ::selection { background: var(--ed-sel); }

/* terminal and compiler output, colored as Cursor's terminal shows rustc and cargo */
/* a terminal is a card of its own: a small "Terminal" header, then the session */
.term { background: var(--surface); color: var(--term-fg); border-radius: 16px; box-shadow: var(--soft-shadow); font: 13px/1.7 var(--mono); padding: 14px 20px 18px; white-space: pre; overflow-x: auto; margin: 22px 0; }
.term::before, .run-out::before { content: "Terminal"; display: block; font: 500 12.5px/1 var(--sans); color: var(--ink-3); margin: 0 0 12px; letter-spacing: .01em; }
.run-out::before { content: "Output"; }
.term .cmd::before { content: "$ "; color: var(--term-dim); }
.a-b { font-weight: 700; }
.a-red { color: var(--ansi-red); } .a-blue { color: var(--ansi-blue); } .a-cyan { color: var(--ansi-cyan); }
.a-green { color: var(--ansi-green); } .a-yellow { color: var(--ansi-yellow); } .a-magenta { color: var(--ansi-magenta); } .a-dim { color: var(--term-dim); }

/* ---------- runner ---------- */
.runner { margin: 22px 0 8px; overflow: hidden; background: var(--ed-bg); }
.editor { position: relative; font: 13.5px/1.7 var(--mono); background: var(--ed-bg); }
.editor textarea, .editor .ed-hl { margin: 0; border: 0; width: 100%; white-space: pre; overflow: auto; font: inherit; line-height: inherit; tab-size: 4; padding: 18px 20px; box-sizing: border-box; }
.editor .ed-hl { position: absolute; inset: 0; pointer-events: none; color: var(--ed-fg); }
.editor textarea { position: relative; display: block; resize: vertical; background: transparent; color: transparent; -webkit-text-fill-color: transparent; caret-color: var(--ed-caret); outline: none; min-height: 7em; }
.editor textarea:focus-visible { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c-2) 70%, transparent); border-radius: inherit; }
.run-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px 14px; }
.run-status { margin-left: auto; font-size: 13px; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.run-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-4); flex: none; }
[data-state="running"] .run-status::before { background: var(--c-2); animation: blink 1s infinite; }
[data-state="error"] .run-status { color: var(--err-ink); } [data-state="error"] .run-status::before { background: var(--err-ink); }
[data-state="ok"] .run-status { color: var(--ok-ink); } [data-state="ok"] .run-status::before { background: var(--ok-ink); }
@keyframes blink { 50% { opacity: .3; } }
.run-out { margin: 0; padding: 16px 20px 18px; font: 12.5px/1.65 var(--mono); white-space: pre; overflow-x: auto; background: var(--term-bg); color: var(--term-fg); }
.run-out:empty { display: none; }

/* ---------- figure / stepper ---------- */
.fig { margin: 24px 0 8px; padding: 24px; }
.fig-foot { display: flex; gap: 18px; align-items: center; margin-top: 24px; }
.fig-caption { margin: 0; font-size: 15px; color: var(--ink-2); flex: 1; min-height: 3.4em; }
.fig-dots { display: flex; gap: 6px; }
/* the bar is 6px, the tap area 24px */
.fig-dot { width: 26px; height: 24px; border-radius: 3px; border: 0; padding: 0; background: linear-gradient(var(--track), var(--track)) center / 100% 6px no-repeat; cursor: pointer; transition: background .25s; }
.fig-dot.on { background: linear-gradient(var(--c-2), var(--c-2)) center / 100% 6px no-repeat; }
.fig-dot:focus-visible { outline: 2px solid var(--c-ink); outline-offset: 2px; }

/* ---------- callouts and terms ---------- */
.why { padding: 22px 24px; margin: 28px 0; background: var(--c); box-shadow: none; }
.why h3 { font-size: 16px; font-weight: 600; margin: 0 0 4px; letter-spacing: -.01em; }
.why p { margin: 0; color: color-mix(in srgb, var(--c-ink) 55%, var(--ink)); font-size: 15.5px; }
.terms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.terms .card { padding: 18px 20px; box-shadow: none; }
.terms b { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 4px; }
.terms b i { width: 8px; height: 8px; border-radius: 50%; background: var(--c-2); }
.terms span { font-size: 14.5px; color: var(--ink-2); line-height: 1.5; display: block; }

.edge-tab { position: fixed; right: 0; top: 50%; translate: 0 -50%; writing-mode: vertical-rl; background: var(--c); color: var(--c-ink); font-size: 12.5px; font-weight: 600; padding: 16px 7px; border-radius: 8px 0 0 8px; letter-spacing: .02em; }

.next-ch { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px 24px; margin-top: 64px; text-decoration: none; color: inherit; transition: background .2s; }
.next-ch:hover { background: var(--raised); }
.next-ch small { display: block; color: var(--ink-3); font-size: 13px; }
.next-ch b { font-size: 19px; font-weight: 600; letter-spacing: -.015em; }

/* ==================== chapter components ==================== */
/* ---------- 1.1 project ---------- */
.project { display: grid; grid-template-columns: 200px minmax(0, 1fr); margin: 22px 0 14px; overflow: hidden; background: var(--ed-bg); }
.tree { margin: 0; padding: 16px 18px; font: 13px/1.9 var(--mono); background: var(--sunk); white-space: pre; }
.tree .dir { color: var(--ink-3); }
.tree .sel { background: var(--c); border-radius: 4px; padding: 1px 5px; margin-left: -5px; }
.file { min-width: 0; }
.file-name { font: 13px var(--mono); color: var(--ink-3); padding: 14px 20px 0; }

/* ---------- 1.3 error anatomy ---------- */
.anatomy { display: grid; grid-template-columns: minmax(0, 1fr) 260px; overflow: hidden; margin: 22px 0 8px; }
.err-msg { margin: 0; padding: 20px; font: 13px/1.7 var(--mono); background: var(--term-bg); color: var(--term-fg); white-space: pre; overflow-x: auto; }
.err-msg .part { border-radius: 4px; cursor: pointer; transition: background .2s; }
.err-msg .part:hover, .err-msg .part.on { background: color-mix(in srgb, var(--c-2) 32%, transparent); }
.parts { list-style: none; margin: 0; padding: 10px; display: grid; align-content: start; gap: 2px; }
.parts li { padding: 10px 12px; border-radius: 10px; cursor: pointer; transition: background .2s; font-size: 14.5px; color: var(--ink-2); line-height: 1.45; }
.parts li b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 2px; }
.parts li:hover, .parts li.on { background: var(--c); }
.parts li:focus-visible { outline: 2px solid var(--c-ink); outline-offset: -2px; }

/* ---------- 1.4 shadowing vs mut ---------- */
.sm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.sm-col .label { display: flex; justify-content: space-between; }
.slots { margin-top: 14px; display: grid; gap: 8px; min-height: 170px; align-content: start; }
.slot { display: grid; grid-template-columns: minmax(44px, auto) 1fr auto; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; background: var(--sunk); font: 14px var(--mono); transition: opacity .4s var(--ease), transform .4s var(--ease), background .3s; }
.slot .nm { font-weight: 500; }
.slot .ty { font-size: 13px; color: var(--ink-3); }
.slot .v { font-weight: 500; transition: color .3s; white-space: nowrap; }
.slot.gone { opacity: 0; transform: translateY(-6px); pointer-events: none; }
.slot.old { opacity: .45; }
.slot.old .nm { text-decoration: line-through; text-decoration-color: var(--ink-3); }
.slot.now { background: var(--c); }
.slot.bad { background: var(--err); }
.slot.flash .v { color: var(--c-ink); }
.slot-note { font-size: 13px; color: var(--ink-3); margin: 2px 2px 0; transition: opacity .3s; }
.slot-note.err { color: var(--ansi-red); font-family: var(--mono); font-weight: 700; }
.slot-note.off { opacity: 0; }

/* ---------- 1.5 inlay types: Cursor's inlay hint color, no chip ---------- */
:root { --inlay: rgba(20, 20, 20, .74); }
:root[data-theme="dark"] { --inlay: rgba(240, 240, 240, .36); }
.inlay-card { overflow: hidden; margin: 22px 0 8px; background: var(--ed-bg); }
.inlay-bar { display: flex; align-items: center; gap: 12px; padding: 14px 20px 4px; }
.inlay-bar small { color: var(--ink-3); font-size: 13px; margin-left: auto; }
.switch { display: inline-flex; align-items: center; gap: 10px; font: 500 14.5px var(--sans); background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--ink); }
.switch .track { width: 34px; height: 20px; border-radius: 10px; background: var(--track); position: relative; transition: background .2s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: translate .2s var(--ease); }
.switch[aria-pressed="true"] .track { background: var(--c-ink); }
.switch[aria-pressed="true"] .track::after { translate: 14px 0; }
.switch:focus-visible { outline: 2px solid var(--c-ink); outline-offset: 3px; border-radius: 6px; }
.inlay-code { margin: 0; padding: 10px 0; font: 14px/1.95 var(--mono); white-space: pre; overflow-x: auto; color: var(--ed-fg); }
.inlay-code .ln { display: block; padding: 0 20px; cursor: pointer; transition: background .2s; }
.inlay-code .ln:hover { background: color-mix(in srgb, var(--ed-line) 55%, transparent); }
.inlay-code .ln.on { background: var(--ed-line); }
.inlay { display: none; color: var(--inlay); }
.show-types .inlay { display: inline; animation: inlay-in .3s var(--ease); }
@keyframes inlay-in { from { opacity: 0; } }
.inlay-explain { max-width: none; padding: 16px 20px 18px; background: var(--sunk); font-size: 14.5px; color: var(--ink-2); min-height: 3.6em; margin: 0; }
.inlay-explain b { color: var(--ink); font-family: var(--mono); font-weight: 500; font-size: 14px; }

/* ---------- 1.6 exercises ---------- */
.ex-progress { display: flex; align-items: center; gap: 12px; font-size: 14.5px; color: var(--ink-2); margin: 18px 0 4px; font-variant-numeric: tabular-nums; }
.ex-progress .pips { display: flex; gap: 5px; }
.ex-progress .pips i { width: 22px; height: 6px; border-radius: 3px; background: var(--track); transition: background .3s; }
.ex-progress .pips i.on { background: var(--ok-ink); }
.ex { margin: 16px 0; overflow: hidden; }
.ex-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 18px 20px 0; }
.ex-head .n { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ex-head b { font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
.ex-head .goal { margin-left: auto; font-size: 13px; color: var(--ink-3); }
.ex .ex-text { padding: 4px 20px 0; margin: 0; font-size: 14.5px; color: var(--ink-2); }
.ex .hint { margin: 0 20px 14px; padding: 12px 14px; background: var(--c); border-radius: 10px; font-size: 14.5px; color: color-mix(in srgb, var(--c-ink) 60%, var(--ink)); }
.ex .done-mark { display: none; color: var(--ok-ink); font-weight: 600; font-size: 13px; }
.ex.solved .done-mark { display: inline-flex; align-items: center; gap: 6px; }
.ex.solved .goal { display: none; }
.ex.solved .run-bar { background: var(--ok); }

@media (max-width: 1060px) { .anatomy { grid-template-columns: minmax(0, 1fr); } .parts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .project { grid-template-columns: minmax(0, 1fr); }
  .sm-grid, .parts { grid-template-columns: minmax(0, 1fr); }
  .slots { min-height: 0; }
  .slot.gone { display: none; }
  .slot:not(.gone) { animation: slot-in .35s var(--ease); }
  .err-msg { font-size: 12px; padding: 16px; }
  .ex-head .goal { margin-left: 0; flex-basis: 100%; }
  .inlay-bar small { display: none; }
}
@keyframes slot-in { from { opacity: 0; transform: translateY(-6px); } }
@media (pointer: coarse) {
  .switch { min-height: 44px; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .mobile-bar { display: grid; gap: 10px; margin: 0 0 16px; }
  .mobile-bar .book { margin: 0; font-size: 14px; }
  .mobile-bar .home { margin: 0; color: var(--ink-2); font-size: 14px; }
  .mobile-bar .theme-switch { margin: 0; }
  .mobile-bar .theme-switch button { padding: 11px 6px; font-size: 13px; }
  main { padding: 20px 16px 100px; }
  .opener { padding: 30px 22px 26px; border-radius: 18px; }
  .opener h1 { font-size: 42px; hyphens: auto; overflow-wrap: break-word; }
  .terms { grid-template-columns: minmax(0, 1fr); }
  .edge-tab { display: none; }
  .fig { padding: 16px; }
  .fig-foot { flex-wrap: wrap; }
  .fig-caption { flex-basis: 100%; min-height: 0; }
  .fig-dots { margin-right: auto; }
  pre.code, .listing, .editor { font-size: 13px; }
  .run-out, .term { font-size: 12px; }
}
/* touch screens: every control gets at least a 44px tap height */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .theme-switch button { min-height: 44px; }
  .fig-dot { height: 44px; }
}
/* long one-word titles ("Comprehensions") must fit a 320 px phone */
@media (max-width: 380px) { .opener h1 { font-size: 34px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
