@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;600&family=Caveat:wght@700&display=swap');
/*
 * mi.css — EZ Tutor Maths Lab strand.
 * Same brand as the rest of the platform (cream / teal / amber / Playfair +
 * DM Sans). Chrome block copy-adapted from computer-science/css/cs.css
 * (design-language v2 reference implementation), then Maths Lab widget styles:
 * coordinate boards, drag handles, sliders, equation chips, readouts.
 */

:root {
  --cream: #FAF7F2; --warm-white: #FFFDF9;
  --amber: #E8A842; --amber-dark: #C48A28; --amber-light: #FDF0D5;
  --teal: #2D6A6A; --teal-dark: #1E4D4D; --teal-light: #E8F4F4;
  --charcoal: #2C2C2C; --mid-gray: #6B6B6B; --line: #e5e0d9; --line-2: #d8d2c8;
  --ok: #2d8c5a; --ok-bg: #eaf7f0; --ok-ink: #1a5c38;
  --no: #c0392b; --no-bg: #fdf0ee; --no-ink: #8b1a12;
  --code-bg: #1e1e2e; --code-fg: #cdd6f4; --code-green: #a6e3a1; --code-blue: #89b4fa;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  --font-hand:    'Caveat', cursive;
  --r-sm: 10px; --r: 14px; --r-lg: 20px; --r-xl: 24px; --pill: 50px;
  --sh-sm: 0 4px 24px rgba(0,0,0,.06); --sh: 0 12px 40px rgba(0,0,0,.1); --sh-lg: 0 20px 60px rgba(0,0,0,.12);
  --maxw: 1180px;
  /* design-language v2 (output/ui-redesign-spec.md) */
  --ink: #13403f; --teal-bright: #3BA6A0; --surface: #FFFDF8;
  --line-soft: rgba(19,64,63,.08);
  --sh-lift: 0 16px 40px -18px rgba(19,64,63,.35);
  --ease-out: cubic-bezier(.22,1,.36,1);
}

*,*::before,*::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font-body); background: var(--cream); color: var(--charcoal); line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-dark); }
img, svg { max-width: 100%; }
h1,h2,h3,.display { font-family: var(--font-display); font-weight: 700; line-height: 1.18; color: var(--charcoal); letter-spacing: -.01em; }
h1 { font-size: clamp(2rem,4vw,3rem); margin: 14px 0 10px; }
h2 { font-size: clamp(1.5rem,3vw,2.2rem); margin: 30px 0 14px; }
h3 { font-size: 1.15rem; margin: 0 0 4px; font-weight: 700; }
h1 em, h2 em { color: var(--teal); font-style: normal; }
.sub  { color: var(--mid-gray); margin: 0 0 26px; font-size: clamp(1rem,2vw,1.12rem); line-height: 1.7; max-width: 62ch; }
.note { font-size: .86rem; color: var(--mid-gray); line-height: 1.6; }
.err  { color: var(--no); font-size: .9rem; }
.eyebrow { display: inline-block; color: var(--amber-dark); font-size: .79rem; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; margin-bottom: .6rem; }
.center { text-align: center; } .hidden { display: none !important; }
:focus-visible { outline: 3px solid rgba(45,106,106,.4); outline-offset: 2px; border-radius: 6px; }

/* ── layout ─────────────────────────────────────────────────────────────── */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 30px 5vw 80px; }
.wrap.narrow { max-width: 840px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* ── header (glass) ─────────────────────────────────────────────────────── */
.site-header { position: sticky; top: 0; z-index: 200; background: rgba(250,247,242,.85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line-soft); transition: box-shadow .3s; }
.site-header.scrolled { box-shadow: 0 10px 30px -18px rgba(19,64,63,.35); }
.site-header .bar { max-width: var(--maxw); margin: 0 auto; display: flex; align-items: center; gap: 28px; padding: .4rem 5vw; min-height: 70px; }

/* ── product switcher (v2 — the only cross-app nav) ─────────────────────── */
.switch-wrap { position: relative; }
.switch-pill { display: inline-flex; align-items: center; gap: .45rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--pill); padding: .42rem .95rem; font: 600 .82rem var(--font-body); color: var(--charcoal); cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.switch-pill:hover { border-color: var(--teal); box-shadow: var(--sh-sm); }
.switch-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.switch-menu { position: absolute; right: 0; top: calc(100% + 10px); width: 270px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-lg); padding: .55rem; z-index: 300; animation: switch-in .22s var(--ease-out); }
@keyframes switch-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.switch-label { margin: .2rem .6rem .35rem; font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--mid-gray); }
.switch-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 .5rem; padding: .55rem .65rem; border-radius: 12px; transition: background .15s; }
.switch-item b { font-size: .9rem; color: var(--charcoal); }
.switch-item span { grid-column: 1; font-size: .76rem; color: var(--mid-gray); }
.switch-item i { grid-row: 1 / span 2; grid-column: 2; font-style: normal; color: var(--teal); font-weight: 700; }
.switch-item:hover { background: var(--teal-light); }
.switch-item.cur b { color: var(--teal); }

/* ── mobile full-screen menu (v2) ───────────────────────────────────────── */
.nav-overlay { position: fixed; inset: 0; z-index: 400; background: linear-gradient(160deg, var(--ink), var(--teal-dark)); color: #fff; display: flex; flex-direction: column; padding: 5rem 7vw 2.5rem; overflow-y: auto; }
.nav-overlay[hidden] { display: none; }
.overlay-close { position: absolute; top: 1.1rem; right: 5vw; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff; font-size: 1.1rem; cursor: pointer; }
.overlay-nav { display: flex; flex-direction: column; gap: .35rem; }
.overlay-nav a { font-family: var(--font-display); font-size: clamp(1.9rem, 7vw, 2.6rem); font-weight: 700; color: #fff; padding: .35rem 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.overlay-nav a.on { color: var(--amber); }
.overlay-auth { display: flex; gap: 1.2rem; align-items: center; margin-top: 1.6rem; }
.overlay-auth a { color: rgba(255,255,255,.85); font-weight: 600; }
.overlay-auth .nav-cta { background: var(--amber); color: var(--ink); }
.overlay-products { margin-top: auto; padding-top: 2rem; }
.overlay-products .switch-label { color: rgba(255,255,255,.55); }
.overlay-products .switch-item { padding: .5rem .2rem; }
.overlay-products .switch-item b { color: rgba(255,255,255,.9); font-size: 1rem; }
.overlay-products .switch-item.cur b { color: var(--amber); }
.overlay-products .switch-item:hover { background: rgba(255,255,255,.06); }
body.menu-open { overflow: hidden; }
.brand { display: inline-flex; align-items: flex-start; gap: 9px; text-decoration: none; line-height: 1; }
.brand svg { height: 46px; width: auto; flex-shrink: 0; }
.mi-badge { font-family: var(--font-display); font-weight: 700; font-size: .72rem; color: #fff; background: var(--amber-dark); padding: .1rem .5rem; border-radius: var(--pill); letter-spacing: .5px; margin-top: 3px; white-space: nowrap; }
.site-nav { display: flex; align-items: center; gap: 1.5rem; margin-left: auto; }
.site-nav a { font-size: .88rem; font-weight: 500; color: var(--charcoal); position: relative; transition: color .2s; }
.site-nav a::after { content:''; position: absolute; bottom: -4px; left: 0; width: 0; height: 2px; background: var(--amber); transition: width .25s; }
.site-nav a:hover { color: var(--teal); } .site-nav a:hover::after,.site-nav a.on::after { width: 100%; }
.site-nav a.on { color: var(--teal); }
.header-right { display: flex; align-items: center; gap: 1.2rem; margin-left: 2rem; }
.header-right .signlink { font-size: .85rem; font-weight: 500; color: var(--mid-gray); }
.header-right .signlink:hover { color: var(--teal); }
.nav-cta { background: var(--teal); color: #fff; padding: .5rem 1.3rem; border-radius: var(--pill); font-size: .85rem; font-weight: 600; transition: background .2s,transform .15s; }
.nav-cta:hover { background: var(--teal-dark); color: #fff; transform: translateY(-1px); }
.who { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--mid-gray); }
.who .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
.nav-toggle { display: none; flex-direction: column; justify-content: center; gap: 5px; width: 38px; height: 38px; background: none; border: none; cursor: pointer; padding: 4px; }
.nav-toggle span,.nav-toggle span::before,.nav-toggle span::after { display: block; width: 22px; height: 2px; background: var(--charcoal); border-radius: 2px; }
.nav-toggle span { position: relative; } .nav-toggle span::before { content:''; position:absolute; top:-7px; } .nav-toggle span::after { content:''; position:absolute; top:7px; }

/* ── footer ─────────────────────────────────────────────────────────────── */
.site-footer { background: var(--charcoal); color: rgba(255,255,255,.75); padding: 3.5rem 5vw 2rem; margin-top: 60px; }
.site-footer .inner { max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 3rem; }
.site-footer .brand svg { height: 46px; }
.site-footer .brand .mi-badge { display: none; }
/* the logo's navy "Tutor" wordmark is invisible on the charcoal footer — lighten it there */
.site-footer .brand svg text { fill: #fff; }
.site-footer .brand svg text[transform] { fill: var(--amber); }   /* keep the "Easy" script amber */
.site-footer .tagline { font-size: .85rem; line-height: 1.7; max-width: 240px; margin: 1rem 0 0; }
.site-footer h4 { color: #fff; font-size: .88rem; margin: 0 0 1rem; font-weight: 600; }
.site-footer a { display: block; color: rgba(255,255,255,.6); font-size: .84rem; padding: .35rem 0; }
.site-footer a:hover { color: var(--amber); }
.site-footer .legal { grid-column: 1/-1; border-top: 1px solid rgba(255,255,255,.08); margin-top: 1rem; padding-top: 1.4rem; font-size: .8rem; color: rgba(255,255,255,.55); }

/* ── hero (v2) ──────────────────────────────────────────────────────────── */
.hero { background: var(--teal-dark); color: #fff; position: relative; overflow: hidden; }
.hero::before { content:''; position: absolute; top: -50%; right: -10%; width: 60%; height: 180%; background: radial-gradient(ellipse at 60% 40%,rgba(232,168,66,.16) 0%,transparent 65%); pointer-events: none; }
.hero-v2 { background: linear-gradient(168deg, var(--ink) 0%, var(--teal-dark) 62%, #1B4444 100%); }
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; opacity: .85; }
.hero-stats { display: flex; gap: clamp(1.2rem, 4vw, 3rem); flex-wrap: wrap; margin-top: 2.2rem; }
.hero-stats > div { display: flex; flex-direction: column; }
.hero-stats b { font-family: var(--font-display); font-size: clamp(1.5rem, 3vw, 2.1rem); color: var(--amber); line-height: 1.1; }
.hero-stats span { font-size: .8rem; color: rgba(255,255,255,.65); letter-spacing: .02em; }
.hero .inner { max-width: var(--maxw); margin: 0 auto; padding: 5rem 5vw 5.5rem; position: relative; z-index: 1; }
.hero h1 { color: #fff; font-size: clamp(2.4rem,5vw,3.8rem); margin: 0 0 1.1rem; max-width: 18ch; }
.hero h1 em { color: var(--amber); }
.hero p.lede { color: rgba(255,255,255,.82); font-size: clamp(1.05rem,2vw,1.25rem); max-width: 52ch; margin: 0 0 1.8rem; line-height: 1.7; }
.hero .cta-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero .pills { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 2.2rem; }
.hero .pill-tag { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); color: rgba(255,255,255,.85); padding: .45rem 1.1rem; border-radius: var(--pill); font-size: .82rem; font-weight: 500; }
/* hub hero: the live grapher demo IS the hero visual (no Three.js in v1) */
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; }
.hero-demo { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); border-radius: var(--r-xl); padding: 1.1rem; box-shadow: var(--sh-lift); }
.hero-demo .mi-board { margin: 0; }
.hero-demo .hero-demo-eqn { font-family: var(--font-hand); font-size: 1.5rem; color: var(--amber); text-align: center; margin: .5rem 0 .1rem; min-height: 1.4em; }
@media (max-width: 880px) { .hero-grid { grid-template-columns: 1fr; } }

/* ── cards / grid ───────────────────────────────────────────────────────── */
.grid { display: grid; gap: 1.3rem; grid-template-columns: repeat(auto-fill, minmax(230px,1fr)); }
.card { display: block; background: var(--warm-white); border: 1.5px solid transparent; border-radius: var(--r-lg); padding: 1.5rem; color: inherit; box-shadow: var(--sh-sm); transition: transform .25s,border-color .25s,box-shadow .25s; }
a.card:hover { transform: translateY(-5px); border-color: var(--teal); box-shadow: 0 12px 36px rgba(45,106,106,.12); }
.card h3 { font-size: 1.1rem; } .card .meta { color: var(--mid-gray); font-size: .85rem; }
.card .ico { font-size: 26px; display: block; margin-bottom: .5rem; }
.card .pill { display: inline-block; margin-top: .9rem; font-size: .74rem; font-weight: 700; color: var(--teal-dark); background: var(--teal-light); padding: .25rem .8rem; border-radius: var(--pill); }
.card.completed .pill { background: var(--ok-bg); color: var(--ok-ink); }
.card.locked { opacity: .65; background: #f3efe8; border-style: dashed; border-color: var(--line-2); cursor: not-allowed; }
.card.coming-soon { opacity: .55; cursor: default; }
.badge-bar { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .6rem; }
.badge-tag { font-size: .7rem; font-weight: 700; padding: .15rem .6rem; border-radius: var(--pill); background: var(--teal-light); color: var(--teal-dark); }
.strand-card { border-left: 5px solid var(--teal); padding-left: 1.3rem; }
.strand-card.amber-accent { border-left-color: var(--amber); }
.strand-card.locked { border-left-color: var(--line-2); }

/* ── chips / forms / buttons ─────────────────────────────────────────────── */
.chooser { display: flex; flex-wrap: wrap; gap: .7rem; margin: .7rem 0; }
.chip { border: 1.5px solid var(--line-2); background: var(--warm-white); border-radius: var(--pill); padding: .55rem 1.3rem; font-weight: 600; cursor: pointer; color: var(--charcoal); font-size: .88rem; font-family: var(--font-body); transition: .15s; }
.chip:hover { border-color: var(--teal); color: var(--teal); }
.chip.on { background: var(--teal); color: #fff; border-color: var(--teal); }
.field { display: block; margin: 1rem 0; }
.field > span,.field label { display: block; font-size: .81rem; font-weight: 600; margin-bottom: .45rem; }
.field input,.field select { width: 100%; padding: .75rem 1rem; border: 1.5px solid var(--line); border-radius: 12px; font-size: 1rem; background: var(--cream); color: var(--charcoal); font-family: var(--font-body); }
.field input:focus,.field select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(45,106,106,.1); background: #fff; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; background: var(--warm-white); color: var(--charcoal); border: 1.5px solid var(--line-2); border-radius: var(--pill); padding: .75rem 1.7rem; font-weight: 600; font-size: .92rem; font-family: var(--font-body); cursor: pointer; text-decoration: none; transition: background .2s,transform .15s,box-shadow .2s,border-color .2s; }
.btn:hover { border-color: var(--teal); color: var(--teal); transform: translateY(-2px); }
.btn.primary { background: var(--teal); color: #fff; border-color: var(--teal); box-shadow: 0 4px 20px rgba(45,106,106,.28); }
.btn.primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.btn.amber { background: var(--amber); color: #fff; border-color: var(--amber); }
.btn.amber:hover { background: var(--amber-dark); border-color: var(--amber-dark); color: #fff; }
.btn.ghost { background: transparent; }
.btn.white { background: #fff; border-color: #fff; color: var(--ink); }
.btn.white:hover { background: var(--cream); border-color: var(--cream); color: var(--ink); }
.btn.lg { padding: .95rem 2rem; font-size: 1rem; }
.btn.block { width: 100%; } .btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn[hidden] { display: none !important; }   /* carried-over CS gotcha: the class display beats [hidden] — finale Play/Skip/Next toggle via the attribute */
.empty { color: var(--mid-gray); padding: 2.4rem 1.5rem; text-align: center; background: var(--warm-white); border: 1.5px dashed var(--line-2); border-radius: var(--r); }
.skeleton { background: linear-gradient(100deg,#efe9e1 30%,#f7f2ec 50%,#efe9e1 70%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r); height: 90px; }
@keyframes sk { to { background-position: -200% 0; } }
.spinner { width: 22px; height: 22px; border: 3px solid var(--teal-light); border-top-color: var(--teal); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: -4px; }
@keyframes spin { to { transform: rotate(360deg); } }
.banner { background: var(--amber-light); border: 1px solid var(--amber); border-radius: var(--r); padding: .8rem 1.1rem; font-size: .9rem; margin: 1rem 0; }
.banner.info { background: var(--teal-light); border-color: var(--teal); }

/* ── progress bar / crumbs ──────────────────────────────────────────────── */
.prog-bar { height: 8px; background: var(--teal-light); border-radius: 5px; overflow: hidden; }
.prog-bar i { display: block; height: 100%; background: var(--ok); border-radius: 5px; transition: width .4s ease; }
.crumbs { font-size: .85rem; margin: .2rem 0 .9rem; color: var(--mid-gray); }
.crumbs a { color: var(--teal-dark); }
.crumbs .sep { margin: 0 .3rem; opacity: .5; }
.crumbs .cur { color: var(--charcoal); font-weight: 600; }

/* ── lesson chrome (used by mi-lesson-render) ───────────────────────────── */
.lesson-hero { background: linear-gradient(135deg, var(--teal-dark) 0%, #1a4040 100%); color: #fff; padding: 2.8rem 5vw; border-radius: 0 0 24px 24px; margin-bottom: 2rem; }
.lesson-hero h1 { color: #fff; margin: 0 0 .5rem; font-size: clamp(1.8rem,3.5vw,2.8rem); }
.lesson-hero p { color: rgba(255,255,255,.8); margin: 0; max-width: 60ch; }
.lesson-meta { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1rem; align-items: center; }
.lesson-meta .tag { background: rgba(255,255,255,.12); color: rgba(255,255,255,.9); border: 1px solid rgba(255,255,255,.2); padding: .3rem .9rem; border-radius: var(--pill); font-size: .8rem; font-weight: 600; }
/* live "✅ 3/6 checks" pill in the lesson header (soft gating) */
.mi-checks-pill { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.25); padding: .3rem .9rem; border-radius: var(--pill); font-size: .8rem; font-weight: 700; }
.mi-checks-pill.all-done { background: var(--ok); border-color: var(--ok); }

.objectives { background: var(--ok-bg); border: 1px solid #a8dfc0; border-radius: var(--r); padding: 1rem 1.3rem; margin: 1.5rem 0; }
.objectives h3 { color: var(--ok-ink); margin: 0 0 .6rem; font-size: .95rem; }
.objectives ul { margin: 0; padding-left: 1.2rem; }
.objectives li { color: var(--ok-ink); font-size: .9rem; padding: .2rem 0; }

.watch-box { margin: 1.5rem 0; background: #fff7ec; border: 1px solid #f0d8a8; border-radius: var(--r); padding: 1rem 1.2rem; }
.watch-box h3 { margin: 0 0 .5rem; color: #b06b00; font-size: 1rem; }
.watch-box ul { margin: 0; padding-left: 1.2rem; }
.watch-box li { padding: .25rem 0; color: var(--charcoal); font-size: .9rem; line-height: 1.6; }

/* figures (renderer-emitted; .cs-figure kept as an alias for the verbatim-ported renderer) */
.mi-figure, .cs-figure { background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.4rem; margin: 1rem 0; text-align: center; }
.mi-figure svg, .cs-figure svg { max-width: 100%; height: auto; max-height: 420px; }
.mi-figure figcaption, .cs-figure figcaption { margin-top: .8rem; font-size: .85rem; color: var(--mid-gray); }
.mi-figure.dual, .cs-figure.dual { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: center; text-align: left; }
.dual .dual-words { font-size: .95rem; }
.dual .dual-words li { margin: .35rem 0; }
@media (max-width: 680px) { .mi-figure.dual, .cs-figure.dual { grid-template-columns: 1fr; } }

/* worked example — numbered reveal-on-click steps (chunking) */
.worked { margin: 1.2rem 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--warm-white); padding: 1.2rem 1.4rem; }
.worked h3 { color: var(--teal-dark); }
.worked-steps { list-style: none; margin: .8rem 0 0; padding: 0; counter-reset: ws; }
.worked-step { counter-increment: ws; position: relative; margin: .45rem 0; padding: .6rem .9rem .6rem 2.6rem; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; transition: border-color .15s, background .15s; }
.worked-step::before { content: counter(ws); position: absolute; left: .7rem; top: .6rem; width: 22px; height: 22px; border-radius: 50%; background: var(--teal-light); color: var(--teal-dark); display: grid; place-items: center; font-weight: 700; font-size: .78rem; }
.worked-step:not(.open) { color: transparent; user-select: none; background: var(--cream); }
.worked-step:not(.open)::after { content: 'Click to reveal step ' counter(ws); position: absolute; left: 2.6rem; top: .6rem; color: var(--mid-gray); font-size: .88rem; }
.worked-step.open { cursor: default; }
.worked-step:not(.open):hover { border-color: var(--teal); }

/* ── lesson panes (slides) ──────────────────────────────────────────────── */
.lesson-block { margin: 1.1rem 0; }
.lesson-block > h3 { margin: .2rem 0 .6rem; }
.pane { animation: pane-in .25s ease; }
@keyframes pane-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.pane-kicker { font-family: var(--font-display); color: var(--teal-dark); font-size: 1.3rem; margin: 1.6rem 0 .2rem; }
.pane-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pane-dots { display: flex; gap: .5rem; flex: 1; justify-content: center; flex-wrap: wrap; }
.pane-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); cursor: pointer; transition: transform .2s, background .2s; border: none; padding: 0; }
.pane-dot:hover { background: var(--mid-gray); }
.pane-dot.on { background: var(--teal); transform: scale(1.35); }
.pane-dot.done { background: var(--amber); }
.lesson-end { display: flex; gap: .8rem; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 1.4rem; padding: 1.5rem; background: var(--teal-light); border: 1px solid rgba(45,106,106,.2); border-radius: var(--r-lg); }
.recap-chips { display: flex; gap: .6rem; flex-wrap: wrap; margin: .8rem 0; }
.recap-chip { background: var(--warm-white); border: 1px solid var(--line); border-left: 4px solid var(--amber); border-radius: var(--r-sm); padding: .6rem .9rem; font-size: .9rem; max-width: 320px; }

/* ── E/N/F/C/X stage badges (the maths analogue of PRIMM) ──────────────── */
.mi-stage { display: inline-flex; align-items: center; gap: .45rem; font-size: .72rem; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; padding: .3rem .8rem; border-radius: var(--pill); margin: 2.2rem 0 .4rem; }
.mi-stage::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.mi-explore   { color: #7a4fb5; background: #f1e9fb; }            /* 🧪 Explore — the "play" colour */
.mi-notice    { color: var(--teal); background: var(--teal-light); }   /* 👀 Notice */
.mi-formalise { color: var(--ink); background: rgba(19,64,63,.08); }   /* 📐 Formalise */
.mi-check     { color: var(--ok-ink); background: var(--ok-bg); }      /* ✅ Check */
.mi-challenge { color: #b5400f; background: #fdeede; }                 /* 🏆 Challenge */

/* ═══════════════════════════════════════════════════════════════════════════
   Interactive widgets (mi-widgets.js) — CS .iw conventions exactly
   ═══════════════════════════════════════════════════════════════════════════ */
.iw { background: var(--warm-white); border: 1px solid var(--line); border-left: 4px solid var(--teal); border-radius: var(--r); padding: 1.1rem 1.3rem; margin: 1.1rem 0; }
.iw-grapher   { border-left-color: var(--teal); }
.iw-dragpoint { border-left-color: var(--amber); }
.iw-steps     { border-left-color: var(--teal-dark); }
.iw-check     { border-left-color: var(--ok); }
.iw-mcq       { border-left-color: var(--ok); }
.iw-head { font-size: .95rem; margin-bottom: .7rem; }
.iw-tag { display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .5px; padding: .2rem .6rem; border-radius: var(--pill); margin-right: .5rem; }
.iw-tag.grapher   { background: var(--teal-light); color: var(--teal-dark); }
.iw-tag.dragpoint { background: var(--amber-light); color: var(--amber-dark); }
.iw-tag.steps     { background: #dcecec; color: var(--teal-dark); }
.iw-tag.check     { background: var(--ok-bg); color: var(--ok-ink); }
.iw-tag.mcq       { background: var(--ok-bg); color: var(--ok-ink); }
.iw-tag.inequal { background: var(--teal-light); color: var(--teal-dark); }
.iw-tag.similar { background: var(--amber-light); color: var(--amber-dark); }
.iw-tag.ratio   { background: var(--teal-light); color: var(--teal-dark); }
.iw-tag.histo   { background: var(--amber-light); color: var(--amber-dark); }
.iw-tag.regress  { background: var(--teal-light); color: var(--teal-dark); }
.iw-tag.momentum { background: var(--amber-light); color: var(--amber-dark); }
.iw-tag.complex  { background: var(--teal-light); color: var(--teal-dark); }
.iw-tag.matrices { background: var(--teal-light); color: var(--teal-dark); }
.iw-tag.induction { background: var(--amber-light); color: var(--amber-dark); }
.iw-tag.series   { background: var(--teal-light); color: var(--teal-dark); }
.iw-tag.roots    { background: var(--amber-light); color: var(--amber-dark); }
.iw-tag.hyperbolic { background: var(--teal-light); color: var(--teal-dark); }
.iw-tag.polar    { background: var(--amber-light); color: var(--amber-dark); }
.iw-tag.diffeq   { background: var(--teal-light); color: var(--teal-dark); }
.iw-tag.vectors3d { background: var(--amber-light); color: var(--amber-dark); }
.iw-label { display: block; font-size: .82rem; font-weight: 600; margin: .6rem 0 .25rem; }
.iw-input { width: 100%; font-family: var(--font-mono); font-size: .9rem; padding: .55rem .7rem; border: 1px solid var(--line-2); border-radius: var(--r-sm); }
.iw-input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(45,106,106,.1); }
.iw-input.ok  { background: var(--ok-bg); border-color: var(--ok); }
.iw-input.bad { background: #fdecea; border-color: var(--no); animation: mi-shake .3s; }
@keyframes mi-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.iw-actions { display: flex; gap: .5rem; margin-top: .7rem; flex-wrap: wrap; align-items: center; }
.iw-feedback { margin-top: .8rem; padding: .7rem .9rem; border-radius: var(--r-sm); font-size: .9rem; }
.iw-feedback.ok   { background: var(--ok-bg); color: var(--ok-ink); }
.iw-feedback.bad  { background: #fdecea; color: #b3271b; }
.iw-feedback.info { background: var(--amber-light); color: var(--amber-dark); }
.mi-explain, .mi-hint-auto { margin-top: .5rem; padding-top: .5rem; border-top: 1px dashed rgba(0,0,0,.12); }

/* MCQ (CS shape) */
.iw-q { font-size: .95rem; margin-bottom: .7rem; }
.iw-options { display: flex; flex-direction: column; gap: .45rem; }
.iw-opt { display: flex; align-items: center; gap: .6rem; text-align: left; background: #fff; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: .6rem .8rem; font: inherit; font-size: .9rem; cursor: pointer; transition: border-color .15s, background .15s; }
.iw-opt:hover { border-color: var(--teal); }
.iw-opt-key { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--cream); font-weight: 700; font-size: .78rem; flex-shrink: 0; }
.iw-opt.correct { background: var(--ok-bg); border-color: var(--ok); }
.iw-opt.correct .iw-opt-key { background: var(--ok); color: #fff; }
.iw-opt.wrong { background: #fdecea; border-color: var(--no); }
.iw-opt.wrong .iw-opt-key { background: var(--no); color: #fff; }

/* commit-only prediction (mountPredict) — a stake, not a check: the picked
 * option holds a neutral teal (never the ok/no marking colours) */
.iw-predict { border-left-color: #7a4fb5; }            /* Explore violet — kin to the finale, not the checks */
.iw-tag.predict { background: #f1e9fb; color: #7a4fb5; }
.iw-opt.picked { background: var(--teal-light); border-color: var(--teal); }
.iw-opt.picked .iw-opt-key { background: var(--teal); color: #fff; }
.iw-opt:disabled { cursor: default; }
.iw-opt:disabled:not(.picked) { opacity: .55; }

/* steps control bar + caption (CS verbatim) */
.iw-steps-cap { min-height: 2.6em; font-size: .92rem; padding: .6rem .2rem; }
.iw-step-count { align-self: center; }

/* scene-element highlighting (same hooks/CSS as CS flow diagrams) */
.flow-node { transition: opacity .25s ease, filter .25s ease; }
.flow-node.flow-mute { opacity: .22; }
.flow-node.flow-active { filter: drop-shadow(0 0 7px rgba(232,168,66,.9)); animation: flow-pulse 1.3s ease-in-out infinite; }
@keyframes flow-pulse { 0%,100% { filter: drop-shadow(0 0 5px rgba(232,168,66,.6)); } 50% { filter: drop-shadow(0 0 11px rgba(232,168,66,1)); } }

/* live value chips + bump (CS verbatim) */
.iw-vars { display: flex; gap: .5rem; flex-wrap: wrap; margin: .6rem 0 .2rem; }
.iw-var { background: var(--teal-light); border: 1px solid var(--teal); border-radius: 9px; padding: .25rem .7rem; font-family: var(--font-mono); font-size: .85rem; color: var(--teal-dark); }
.iw-var span { font-weight: 700; }
.iw-var.bump { animation: var-bump .4s ease; }
@keyframes var-bump { 0% { transform: scale(1); } 35% { transform: scale(1.18); background: var(--amber-light); border-color: var(--amber); } 100% { transform: scale(1); } }

/* ── coordinate board (mi-board.js) ─────────────────────────────────────── */
.mi-board { background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--r); padding: .6rem; margin: .6rem 0; box-shadow: inset 0 1px 3px rgba(0,0,0,.04); }
/* no touch-action:none on the svg itself — boards must not block page panning;
   draggable handle groups opt out individually (inline style set in mi-board.js point()) */
/* Size to CONTENT, capped by width and height. The boards use square units, so
   a data plot with a tall y-range and narrow x-range (e.g. drone height vs time
   → ~93×320 viewBox) under the old width:100% stretched to the container width
   and exploded its on-screen height to ~1000px+, scaling the axis font up with
   it (owner's "too big / endless scroll" report). With intrinsic px set on the
   SVG (mi-board.js) plus width/height:auto, max-width and max-height shrink the
   board PROPORTIONALLY (box hugs content — no letterbox, so pointer math stays
   correct). max-height keeps the whole graph on screen at a legible font. */
.mi-board svg { display: block; width: auto; height: auto; max-width: 100%; max-height: 52vh; margin-inline: auto; user-select: none; -webkit-user-select: none; }

/* drag handles: amber dot, white stroke, soft shadow, grab cursor + 44px hit ring */
.mi-handle-g { outline: none; }
.mi-handle-g .mi-handle { filter: drop-shadow(0 2px 4px rgba(0,0,0,.22)); transition: r .15s ease; }
.mi-handle-g.dragging .mi-handle { r: 13; filter: drop-shadow(0 5px 9px rgba(0,0,0,.3)); }
.mi-handle-g.dragging { cursor: grabbing !important; }
.mi-handle-g:focus-visible .mi-handle { stroke: var(--teal); stroke-width: 3; }
.mi-handle-g:focus-visible .mi-halo { opacity: .4; }
.mi-handle-g.locked { opacity: .85; }
.mi-handle-g text { pointer-events: none; }

/* slider rows: teal track / amber thumb, live value chips */
.mi-sliders { margin: .6rem 0 .2rem; }
.mi-slider-row { display: grid; grid-template-columns: minmax(96px, auto) 1fr 58px; align-items: center; gap: .8rem; margin: .55rem 0; }
.mi-slider-label { font-size: .88rem; font-weight: 600; color: var(--charcoal); }
.mi-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; cursor: pointer; margin: 0; }
.mi-slider::-webkit-slider-runnable-track { height: 6px; border-radius: 4px; background: var(--teal-light); border: 1px solid rgba(45,106,106,.25); }
.mi-slider::-moz-range-track { height: 6px; border-radius: 4px; background: var(--teal-light); border: 1px solid rgba(45,106,106,.25); }
.mi-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--amber); border: 2.5px solid #fff; box-shadow: var(--sh-sm); margin-top: -9px; transition: transform .12s; }
.mi-slider::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--amber); border: 2.5px solid #fff; box-shadow: var(--sh-sm); transition: transform .12s; }
.mi-slider:active::-webkit-slider-thumb { transform: scale(1.18); }
.mi-slider:focus-visible { outline: 3px solid rgba(45,106,106,.4); outline-offset: 2px; border-radius: var(--pill); }
.mi-slider-val { font-family: var(--font-mono); font-size: .85rem; font-weight: 600; text-align: center; background: var(--teal-light); color: var(--teal-dark); border-radius: 8px; padding: .2rem .3rem; }
.mi-lock-chip { font-family: var(--font-mono); font-size: .85rem; color: var(--mid-gray); background: var(--cream); border: 1px dashed var(--line-2); border-radius: 8px; padding: .2rem .7rem; justify-self: start; }

/* live equation chip — code aesthetic on the dark code palette */
.mi-eqn { display: inline-block; font-family: var(--font-mono); font-size: .98rem; background: var(--code-bg); color: var(--code-fg); padding: .4rem 1rem; border-radius: var(--r-sm); margin: .5rem 0 .1rem; letter-spacing: .02em; }

/* readout chips — handwritten Caveat for the "discovery" feel */
.mi-readouts { display: flex; gap: .7rem; flex-wrap: wrap; margin: .4rem 0; }
.mi-readout { font-family: var(--font-hand); font-size: 1.3rem; color: var(--teal-dark); background: #fff; border: 1.5px dashed var(--line-2); border-radius: 12px; padding: .1rem .9rem; line-height: 1.5; }
.mi-readout b { color: var(--amber-dark); }
.mi-readout.bump { animation: var-bump .4s ease; }
.mi-ro-label { opacity: .85; }

/* stacked column vector — CSS-bracket trick, inherits currentColor.
 * Allowed in any HTML-trusted text (questions, intros, hints, explains,
 * readout values) — NEVER in esc()'d titles. */
.cvec{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;
  position:relative;vertical-align:middle;padding:.05em .34em;margin:0 .1em;
  line-height:1.1;font-weight:600;font-variant-numeric:tabular-nums}
.cvec::before,.cvec::after{content:"";position:absolute;top:0;bottom:0;width:.3em;
  border:1.6px solid currentColor}
.cvec::before{left:0;border-right:0;border-radius:.55em 0 0 .55em}
.cvec::after{right:0;border-left:0;border-radius:0 .55em .55em 0}

/* target + check bits */
.mi-target { display: inline-block; font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; background: var(--amber-light); color: var(--amber-dark); border: 1px solid var(--amber); border-radius: var(--r-sm); padding: .35rem .9rem; margin: .2rem 0 .5rem; }
.mi-check-row { display: flex; align-items: center; gap: .6rem; max-width: 340px; }
.mi-check-in { text-align: center; font-size: 1.05rem; }
.mi-check-suffix { font-size: .95rem; color: var(--mid-gray); white-space: nowrap; }

/* ── wheel widget (mi-wheel.js) — rotation drag, no dials, no grid-surface ─ */
.iw-wheel { border-left-color: var(--amber); }
.iw-tag.wheel { background: var(--amber-light); color: var(--amber-dark); }
.mi-wheel-grid { display: grid; gap: 1rem; align-items: start; }
.mi-wheel-grid.has-trace { grid-template-columns: minmax(0, auto) minmax(0, 1fr); }
.mi-wheel-stage { background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--r); padding: .6rem; margin: .6rem 0; box-shadow: inset 0 1px 3px rgba(0,0,0,.04); }
.mi-wheel-stage svg { display: block; width: 100%; max-width: 420px; height: auto; margin: 0 auto; user-select: none; -webkit-user-select: none; }
.mi-wheel-g { cursor: grab; outline: none; }
.mi-wheel-g.dragging { cursor: grabbing; }
.mi-wheel-g:focus-visible .mi-rim { stroke-width: 5; }
.mi-wheel-g:focus-visible .mi-wheel-hit { stroke: rgba(45,106,106,.4); stroke-width: 4; }
.mi-pod.pod-you rect { filter: drop-shadow(0 0 6px rgba(232,168,66,.9)); }
.mi-trace-host { min-width: 0; }
.mi-trace-clear { padding: .4rem 1rem; font-size: .8rem; }
@media (max-width: 820px) { .mi-wheel-grid.has-trace { grid-template-columns: 1fr; } }

/* ── sim widget (mi-sim.js) — run-a-machine evidence accumulation 🎰 ─────── */
.iw-sim { border-left-color: var(--amber); }
.iw-tag.sim { background: var(--amber-light); color: var(--amber-dark); }
.mi-sim-grid { display: grid; gap: 1rem; align-items: start; grid-template-columns: minmax(0, auto) minmax(0, 1fr); margin: .6rem 0; }
.mi-sim-grid.has-grid { grid-template-columns: minmax(0, auto) minmax(0, 1fr) minmax(0, auto); }
.mi-sim-grid.grid-only { grid-template-columns: minmax(0, auto) minmax(0, auto); justify-content: start; }
.mi-sim-machine, .mi-sim-bars, .mi-sim-ss { background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--r); padding: .6rem; box-shadow: inset 0 1px 3px rgba(0,0,0,.04); min-width: 0; }
.mi-sim-machine svg { display: block; width: 100%; max-width: 230px; min-width: 150px; height: auto; margin: 0 auto; user-select: none; -webkit-user-select: none; }
.mi-sim-bars svg { display: block; width: 100%; max-width: 480px; height: auto; margin: 0 auto; user-select: none; -webkit-user-select: none; }
.mi-run-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .6rem 0 .2rem; }
.mi-run-row .mi-bar-mode { margin-left: auto; padding: .4rem 1rem; font-size: .8rem; }
.mi-run-row .mi-stop { padding: .4rem 1rem; font-size: .8rem; }
/* 6×6 sample-space grid — first die across, second die down */
.mi-ss-grid { display: grid; grid-template-columns: repeat(7, 31px); gap: 3px; }
.mi-ss-row { display: contents; }                       /* role="row" wrappers stay grid-transparent */
.mi-ss-cell { width: 31px; height: 31px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 7px; background: #fff; font-family: var(--font-mono); font-size: .72rem; color: var(--teal-dark); padding: 0; transition: background-color .25s ease, border-color .15s ease; }
.mi-ss-hdr { background: var(--cream); border-color: transparent; font-weight: 700; color: var(--mid-gray); }
.mi-ss-cell.lit { border-color: var(--teal); font-weight: 700; }
.mi-ss-cell.hot { color: #fff; }
.mi-ss-cell.win { box-shadow: inset 0 0 0 2.5px var(--amber); background: var(--amber-light); }
button.mi-ss-cell { cursor: pointer; font: inherit; font-family: var(--font-mono); font-size: .72rem; }
button.mi-ss-cell:hover { border-color: var(--teal); }
button.mi-ss-cell.sel { background: var(--amber); border-color: var(--amber-dark); color: #fff; font-weight: 700; }
button.mi-ss-cell:focus-visible { outline: 3px solid rgba(45,106,106,.4); outline-offset: 1px; }
/* screen-reader-only live region (batch summaries) */
.mi-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (max-width: 820px) { .mi-sim-grid, .mi-sim-grid.has-grid { grid-template-columns: 1fr; } .mi-sim-machine svg { max-width: 200px; } }

/* ── tiles widget (mi-tiles.js) — constructive placement, the builder's yard 🧱 */
.iw-tiles { border-left-color: var(--amber); }
.iw-tag.tiles { background: var(--amber-light); color: var(--amber-dark); }
/* the pattern-frame strip: mini thumbnails + count badges */
.mi-frame-strip { display: flex; gap: .7rem; flex-wrap: wrap; align-items: flex-end; margin: .6rem 0 .2rem; }
.mi-frame { margin: 0; background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--r); padding: .5rem .6rem .35rem; text-align: center; }
.mi-frame-you { border-color: var(--amber); box-shadow: 0 0 0 2.5px var(--amber-light); }
.mi-frame-mini { display: grid; gap: 2px; margin: 0 auto; }
.mi-frame-mini span { border-radius: 2.5px; background: #f1ece4; }          /* .on cells take an inline paint colour */
.mi-frame figcaption { margin-top: .35rem; font-size: .78rem; color: var(--mid-gray); white-space: nowrap; }
.mi-frame-count { font-family: var(--font-mono); font-weight: 600; color: var(--teal-dark); }
.mi-frame-hidden .mi-frame-mini { display: grid; place-items: center; min-width: 52px; min-height: 40px; background: var(--cream); border: 1.5px dashed var(--line-2); border-radius: 8px; }
.mi-frame-q { font-family: var(--font-display); font-size: 1.3rem; color: var(--mid-gray); }
/* the canvas: div grid of <button> cells (mi-ss-grid kin, cols set inline) */
.mi-tile-grid { display: grid; gap: 3px; --mi-cell: 34px; background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--r); padding: .6rem; margin: .6rem 0; width: max-content; max-width: 100%; overflow-x: auto; box-shadow: inset 0 1px 3px rgba(0,0,0,.04); }
.mi-tile-row { display: contents; }                     /* role="row" wrappers stay grid-transparent */
.mi-tile-cell { width: var(--mi-cell); height: var(--mi-cell); border: 1px solid var(--line-2); border-radius: 7px; background: #fff; padding: 0; }
button.mi-tile-cell { cursor: pointer; transition: background-color .15s ease, border-color .15s ease; }
button.mi-tile-cell:hover { border-color: var(--teal); }
button.mi-tile-cell:focus-visible { outline: 3px solid rgba(45,106,106,.4); outline-offset: 1px; }
.mi-tile-cell.laid { border-color: rgba(19,64,63,.35); }
/* ghost target cells: dashed outline + 20%-alpha wash of the required colour
 * (--ghost/--ghostb set inline per cell by mi-tiles.js) */
.mi-tile-cell.mi-tile-ghost { border: 1.6px dashed var(--ghostb, var(--line-2)); background: var(--ghost, transparent); }
.mi-tile-void { border-color: transparent; background: transparent; }       /* group-mode spacers keep the shape */
/* group annotation ring: the paint stays visible underneath — annotated, not repainted */
.mi-tile-cell.grouped { box-shadow: inset 0 0 0 4px var(--ring, var(--amber)); }
/* palette chips (build mode, radiogroup) + group legend */
.mi-palette { display: flex; gap: .5rem; flex-wrap: wrap; margin: .4rem 0; }
.mi-pal-chip { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem 1rem; font-size: .84rem; }
.mi-swatch { width: 13px; height: 13px; border-radius: 4px; display: inline-block; border: 1px solid rgba(0,0,0,.18); flex-shrink: 0; }
.mi-group-legend { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; margin: .4rem 0; }
.mi-group-chip { display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem; font-weight: 600; color: var(--charcoal); background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--pill); padding: .25rem .8rem; }
.mi-group-chip i { width: 12px; height: 12px; border-radius: 50%; }
.mi-group-chip i.none { background: #fff; border: 1.5px dashed var(--line-2); }
/* stamp pop + frame-reveal flip: pure CSS, ONLY when motion is welcome —
 * nothing in the tiles widget animates autonomously */
@media (prefers-reduced-motion: no-preference) {
  .mi-tile-cell.pop { animation: mi-stamp .22s ease; }
  .mi-frame.revealed { animation: mi-frame-flip .5s var(--ease-out); }
}
@keyframes mi-stamp { 40% { transform: scale(1.22); } }
@keyframes mi-frame-flip { from { transform: rotateY(75deg) scale(.9); opacity: 0; } }
@media (max-width: 520px) { .mi-tile-grid { --mi-cell: 27px; } }

/* ── finale timeline player (mi-finale.js) — the lesson reward 🎬 ────────── */
.iw-finale { border-left-color: #7a4fb5; }            /* the Explore violet — a treat, not a check */
.iw-tag.finale { background: #f1e9fb; color: #7a4fb5; }
.mi-finale-stage { position: relative; border-radius: var(--r); overflow: hidden; background: linear-gradient(168deg, var(--ink), var(--teal-dark)); margin: .6rem 0; }
.mi-finale-scene, .mi-finale-scene svg { display: block; width: 100%; height: 100%; }
.mi-finale-lock { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-size: 1.7rem; background: rgba(250,247,242,.55); backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px); transition: opacity .6s var(--ease-out); }
.mi-finale-lock.away { opacity: 0; pointer-events: none; }
.mi-finale-lock p { margin: .3rem 0; font-size: .95rem; font-weight: 600; color: var(--charcoal); }
.mi-finale-count { font-size: .9rem; color: var(--teal-dark); }
.mi-finale-cap { min-height: 2.6em; font-size: .95rem; padding: .6rem .2rem; }
.mi-finale-play.pulse { animation: mi-finale-pulse 1.1s ease 2; }
@keyframes mi-finale-pulse { 50% { transform: scale(1.07); box-shadow: 0 6px 26px rgba(45,106,106,.45); } }

/* ── circle widget (mi-circle.js) — camera-rail + angle-measure + logbook 📐 */
.iw-circle { border-left-color: var(--amber); }
.iw-tag.circle { background: var(--amber-light); color: var(--amber-dark); }

/* the SVG stage: same box as .mi-wheel-stage */
.mi-circle-stage { background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--r); padding: .6rem; margin: .6rem 0; box-shadow: inset 0 1px 3px rgba(0,0,0,.04); }
.mi-circle-stage svg { display: block; width: 100%; max-width: 420px; height: auto; margin: 0 auto; user-select: none; -webkit-user-select: none; }

/* layout: stage left, logbook right when both present */
.mi-circle-layout { display: grid; gap: 1rem; align-items: start; }
.mi-circle-layout:has(.mi-circle-logbook) { grid-template-columns: minmax(0, auto) minmax(0, 1fr); }
@media (max-width: 820px) { .mi-circle-layout:has(.mi-circle-logbook) { grid-template-columns: 1fr; } }

/* camera handle: teal dot, white stroke, focus ring, grab cursor */
.mi-circle-cam { outline: none; }
.mi-circle-cam .mi-handle { filter: drop-shadow(0 2px 4px rgba(0,0,0,.22)); transition: r .15s ease; }
.mi-circle-cam.dragging .mi-handle { r: 12; filter: drop-shadow(0 5px 9px rgba(0,0,0,.3)); }
.mi-circle-cam.dragging { cursor: grabbing !important; }
.mi-circle-cam:focus-visible .mi-handle { stroke: var(--teal-dark); stroke-width: 3; }
.mi-circle-cam:focus-visible .mi-halo { opacity: .4; }

/* B-drag handle: amber, same shape as mi-board draggable points */
.mi-circle-bdrag { outline: none; }
.mi-circle-bdrag .mi-handle { filter: drop-shadow(0 2px 4px rgba(0,0,0,.22)); transition: r .15s ease; }
.mi-circle-bdrag.dragging .mi-handle { r: 12; filter: drop-shadow(0 5px 9px rgba(0,0,0,.3)); }
.mi-circle-bdrag.dragging { cursor: grabbing !important; }
.mi-circle-bdrag:focus-visible .mi-handle { stroke: var(--amber-dark); stroke-width: 3; }
.mi-circle-bdrag:focus-visible .mi-halo { opacity: .4; }

/* instrument logbook table */
.mi-circle-logbook { min-width: 0; }
.mi-log { width: 100%; border-collapse: collapse; font-size: .88rem; margin: .5rem 0; }
.mi-log th { background: var(--teal-light); color: var(--teal-dark); font-weight: 700; padding: .45rem .7rem; border: 1px solid rgba(45,106,106,.18); text-align: left; font-size: .82rem; }
.mi-log td { padding: .4rem .7rem; border: 1px solid var(--line); font-family: var(--font-mono); font-size: .85rem; background: #fff; }
.mi-log tr:nth-child(even) td { background: var(--cream); }
/* new-row pulse: CSS keyframe, RM-gated — mirrors the tile stamp pop */
@media (prefers-reduced-motion: no-preference) {
  .mi-log-new { animation: mi-log-bump .45s var(--ease-out); }
}
@keyframes mi-log-bump { from { background: var(--amber-light); } to { background: inherit; } }

/* ── balance widget (mi-balance.js) — two coupled brass scales ⚖️ ──────── */
.iw-balance { border-left-color: var(--amber); }
.iw-tag.balance { background: var(--amber-light); color: var(--amber-dark); }

/* two scale cards, side-by-side on ≥720px, stacked below */
.mi-balance-scales {
  display: grid;
  gap: 1rem;
  margin: .7rem 0;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* individual scale card */
.mi-scale-card {
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  padding: .9rem 1rem .7rem;
  transition: border-color .2s, box-shadow .2s;
}
.mi-scale-card.is-level {
  border-color: var(--ok);
  box-shadow: 0 0 0 2px rgba(45,140,90,.18);
  animation: mi-level-flash .5s ease;
}
@keyframes mi-level-flash {
  0%   { box-shadow: 0 0 0 0 rgba(45,140,90,.55); }
  50%  { box-shadow: 0 0 0 7px rgba(45,140,90,.18); }
  100% { box-shadow: 0 0 0 2px rgba(45,140,90,.18); }
}

.mi-scale-title {
  font-size: .88rem;
  font-weight: 700;
  color: var(--teal-dark);
  margin: 0 0 .4rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* the SVG balance diagram */
.mi-scale-svg {
  display: block;
  width: 100%;
  max-width: 260px;
  height: auto;
  margin: .2rem auto .5rem;
  user-select: none;
  -webkit-user-select: none;
}

/* beam-group rotation transition (160ms) — dropped under prefers-reduced-motion */
.mi-pan {
  transition: transform 160ms ease;
  /* The rotate(a,100,50) ATTRIBUTE already encodes its own pivot. A CSS
   * transform-origin wraps the whole attribute transform in an extra
   * translate pair — with fill-box it displaced the rotation centre, sliding
   * the beam off the fulcrum and out of frame at any tilt. Keep the SVG
   * default (view-box, 0 0) so the attribute's pivot is the only one. */
  transform-box: view-box;
  transform-origin: 0 0;
}
@media (prefers-reduced-motion: reduce) {
  .mi-pan { transition: none; }
}

/* equation row: items + live total + "=" + target */
.mi-scale-row {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
  font-size: .9rem;
  margin: .3rem 0 .5rem;
}
.mi-scale-expr {
  font-size: 1.05rem;
  color: var(--charcoal);
}
.mi-scale-plus {
  color: var(--mid-gray);
  margin: 0 .1rem;
}
.mi-scale-item { white-space: nowrap; }
.mi-scale-eq {
  color: var(--mid-gray);
  font-weight: 700;
  margin: 0 .1rem;
}
.mi-scale-total.mi-scale-live {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--teal-dark);
  min-width: 3.8ch;
  text-align: right;
}
.mi-scale-target {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--charcoal);
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .1rem .45rem;
}

/* difference bar */
.mi-diff-bar {
  height: 7px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
  margin-top: .2rem;
}
.mi-diff-fill {
  height: 100%;
  border-radius: 4px;
  width: 0%;
  transition: width 100ms ease, background 200ms ease;
  background: var(--ok);
}
@media (prefers-reduced-motion: reduce) {
  .mi-diff-fill { transition: none; }
}

/* shared slider rail for balance variables */
.mi-balance-sliders {
  margin: .5rem 0 .2rem;
}
.mi-balance-slider-row {
  display: grid;
  grid-template-columns: minmax(104px, auto) 1fr 58px;
  align-items: center;
  gap: .8rem;
  margin: .55rem 0;
}

/* ── power widget (mi-power.js) — chain-of-boxes / build the power 🔬 ─── */
.iw-power { border-left-color: var(--teal-dark); }
.iw-tag.power { background: #dcecec; color: var(--teal-dark); }

/* intro text block inside the widget head */
.mi-power-intro { margin-top: .4rem; font-size: .92rem; }

/* outer chain container */
.mi-power-chain {
  margin: .7rem 0 .5rem;
}

/* a single row: label + lens rail + +/- controls */
.mi-chain-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin: .45rem 0;
  padding: .5rem .7rem;
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  transition: opacity .36s var(--ease-out), max-height .36s var(--ease-out);
  max-height: 160px;
  overflow: hidden;
}

/* hide the main chain row until sub-chains merge */
.mi-chain-hidden {
  display: none;
}

/* sub-chain rows collapse away after merge */
.mi-chain-merged {
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  border-width: 0;
  pointer-events: none;
  /* visibility:hidden blocks keyboard focus in browsers without full `inert` support */
  visibility: hidden;
}

/* reduced-motion: collapse is instant */
@media (prefers-reduced-motion: reduce) {
  .mi-chain-row { transition: none; }
}

/* sub-chain label badge */
.mi-chain-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--teal-dark);
  text-transform: uppercase;
  letter-spacing: .07em;
  white-space: nowrap;
  flex-shrink: 0;
}

/* sub-chain live readout */
.mi-sub-readout {
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--mid-gray);
  white-space: nowrap;
  margin-left: auto;
  flex-shrink: 0;
}

/* the horizontal lens icon row — wraps when chain is long */
.mi-lens-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  flex: 1;
  min-width: 0;
}

/* each lens icon is a real <button> with a ≥ 40px tap target */
.mi-lens-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 6px;          /* 28px icon + 12px padding = 40px touch target */
  margin: 0;
  cursor: pointer;
  border-radius: 50%;
  transition: background .15s;
  flex-shrink: 0;
}

.mi-lens-icon-btn:hover {
  background: var(--teal-light);
}

.mi-lens-icon-btn:focus-visible {
  outline: 3px solid rgba(45,106,106,.4);
  outline-offset: 2px;
}

/* the SVG lens glyph inside each button */
.mi-lens-icon {
  display: block;
  pointer-events: none;
  flex-shrink: 0;
}

/* new-lens pop animation (suppressed under reduced-motion) */
@media (prefers-reduced-motion: no-preference) {
  .mi-lens-icon-btn:last-child {
    animation: mi-lens-pop .18s ease;
  }
}

@keyframes mi-lens-pop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.18); }
  100% { transform: scale(1); opacity: 1; }
}

/* +/- control group beside the lens row */
.mi-chain-controls {
  display: flex;
  gap: .3rem;
  flex-shrink: 0;
}

/* override .btn sizing for the compact +/- and merge buttons */
.mi-lens-btn {
  min-width: 44px;
  min-height: 44px;
  padding: .55rem .9rem;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  border-radius: var(--pill);
}

/* MERGE button */
.mi-merge-btn {
  display: block;
  margin: .3rem auto;
  min-width: 120px;
  padding: .65rem 1.6rem;
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .04em;
  background: var(--amber);
  color: #fff;
  border: none;
  border-radius: var(--pill);
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(232,168,66,.32);
  transition: background .2s, transform .15s, box-shadow .2s;
}

.mi-merge-btn:hover {
  background: var(--amber-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(232,168,66,.4);
}

.mi-merge-btn:focus-visible {
  outline: 3px solid rgba(45,106,106,.4);
  outline-offset: 3px;
}

/* readout line: baseLabel^power = result */
.mi-power-readout {
  display: flex;
  align-items: baseline;
  gap: .2rem;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--charcoal);
  padding: .5rem .2rem .2rem;
  flex-wrap: wrap;
}

.mi-power-label {
  color: var(--teal-dark);
}

.mi-power-exp {
  color: var(--teal-dark);
  font-size: .85em;
  line-height: 1;
  vertical-align: super;
}

.mi-power-eq {
  color: var(--mid-gray);
  font-size: 1.1rem;
  font-weight: 400;
  margin: 0 .2rem;
}

.mi-power-result {
  color: var(--amber-dark);
  min-width: 3ch;
}

/* screen-reader-only live region (reuses .mi-visually-hidden from sim widget) */

/* ════════════════════════════════════════════ mi-paper widget (surds) ════ */

/* ── iw-tag for the paper widget ──────────────────────────────────────── */
.iw-tag.paper {
  background: var(--amber-light);
  color: var(--amber-dark);
  border: 1px solid rgba(200,138,40,.25);
}

/* ── paper stage: SVG container ────────────────────────────────────────── */
.iw-paper-fold .mi-paper-stage,
.iw-paper-scale .mi-paper-stage {
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  margin: .6rem 0;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.iw-paper-fold .mi-paper-stage svg,
.iw-paper-scale .mi-paper-stage svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ── intro text ────────────────────────────────────────────────────────── */
.mi-paper-intro {
  font-size: .93rem;
  color: var(--charcoal);
  line-height: 1.6;
  margin-top: .35rem;
}

/* ── fold action buttons ───────────────────────────────────────────────── */
.mi-fold-btn {
  min-width: 88px;
  font-weight: 700;
  letter-spacing: .04em;
}

/* ── scale dial row ─────────────────────────────────────────────────────── */
.mi-scale-row {
  display: flex;
  align-items: center;
  gap: .7rem;
  flex-wrap: wrap;
  margin-bottom: .4rem;
}

.mi-scale-label {
  font-size: .88rem;
  font-weight: 600;
  color: var(--charcoal);
  min-width: 7rem;
}

.mi-scale-range {
  flex: 1 1 180px;
  min-height: 44px;   /* touch target */
  accent-color: var(--teal);
  cursor: pointer;
}

.mi-scale-val {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--teal-dark);
  min-width: 4ch;
  text-align: right;
}

/* ── bracketing chips (best under / best over) ─────────────────────────── */
.mi-bracket-chips {
  display: flex;
  gap: .55rem;
  flex-wrap: wrap;
  margin: .3rem 0 .5rem;
}

.mi-bracket-chip {
  display: inline-block;
  padding: .22rem .75rem;
  border-radius: var(--pill);
  background: var(--teal-light);
  color: var(--teal-dark);
  font-family: var(--font-mono);
  font-size: .82rem;
  font-weight: 600;
  border: 1px solid rgba(45,106,106,.18);
  transition: background .2s, color .2s;
}

.mi-bracket-chip.bracket-set {
  background: var(--ok-bg);
  color: var(--ok-ink);
  border-color: rgba(45,140,90,.25);
}

/* ── fold-flap animation (CSS keyframe, reduced-motion gated) ───────────── */
@media (prefers-reduced-motion: no-preference) {
  .iw-paper-fold .mi-paper-stage svg [data-layer="flap"] rect {
    transition: x .28s var(--ease-out), y .28s var(--ease-out),
                width .28s var(--ease-out), height .28s var(--ease-out);
  }
  .iw-paper-fold .mi-paper-stage svg [data-layer="sheet"] rect:first-child {
    transition: x .28s var(--ease-out), y .28s var(--ease-out),
                width .28s var(--ease-out), height .28s var(--ease-out);
  }
}

/* goal state: gold rim pulse on the sheet stage */
.iw-paper[data-goal="1"] .mi-paper-stage {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-light);
}

@media (prefers-reduced-motion: no-preference) {
  .iw-paper[data-goal="1"] .mi-paper-stage {
    animation: paper-goal-pulse .5s var(--ease-out);
  }
}

@keyframes paper-goal-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(232,168,66,.6); }
  60%  { box-shadow: 0 0 0 8px rgba(232,168,66,.15); }
  100% { box-shadow: 0 0 0 3px var(--amber-light); }
}

/* ── toast / confetti ───────────────────────────────────────────────────── */
.mi-toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%,24px); z-index: 9999; background: #1A3045; color: #fff; padding: .8rem 1.4rem; border-radius: 14px; box-shadow: 0 14px 36px rgba(0,0,0,.28); opacity: 0; pointer-events: none; transition: opacity .35s,transform .35s; font-size: .95rem; font-weight: 600; white-space: nowrap; }
.mi-toast.show { opacity: 1; transform: translate(-50%,0); }
.mi-toast.error { background: var(--no); }
.confetti-piece { position: fixed; top: -10px; z-index: 9998; border-radius: 3px; animation: confetti-fall 1.6s ease-in forwards; pointer-events: none; }
@keyframes confetti-fall { to { transform: translateY(110vh) rotate(720deg); opacity: 0; } }

/* ── features (hub) ─────────────────────────────────────────────────────── */
.features { display: grid; gap: 1.3rem; grid-template-columns: repeat(auto-fill, minmax(250px,1fr)); }
.feature { background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.4rem; box-shadow: var(--sh-sm); }
.feature .ico { font-size: 28px; margin-bottom: .5rem; }
.feature p { margin: .3rem 0 0; font-size: .9rem; color: var(--mid-gray); line-height: 1.65; }

/* ════════════════════════════════════ mi-pedal widget (transforms) ════════ */

/* Widget border accent */
.iw-pedal { border-left-color: var(--teal); }

/* Tag pill */
.iw-tag.pedal {
  background: #e5f0f0;
  color: var(--teal-dark);
  border: 1px solid rgba(45,106,106,.2);
}

/* Intro text */
.mi-pedal-intro { margin-top: .4rem; font-size: .92rem; line-height: 1.65; }

/* Board host — pedal boards are portrait-ish (y-range > x-range) and sit in
   a full-width column, so the global `.mi-board svg { width:100% }` would
   blow them up past the viewport (the probe drifted off-layout). Cap by
   HEIGHT and centre: every pane's board (255×340 … 191×360) stays readable. */
.mi-pedal-board-host { margin: .6rem 0; }
.mi-pedal-board-host.mi-board svg { width: auto; max-width: 100%; max-height: 460px; margin: 0 auto; }

/* Column-vector notation (GCSE mark-scheme form) */
.mi-col-vec {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-left: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  padding: 0 .25em;
  margin: 0 .15em;
  line-height: 1.2;
  vertical-align: middle;
  font-size: .9em;
}
.mi-col-vec > span {
  display: block;
  text-align: center;
  line-height: 1.3;
}

/* Equation chips */
.mi-pedal-eqn,
.mi-pedal-factor {
  font-family: var(--font-mono);
  font-size: .92rem;
  color: var(--ink);
  background: var(--teal-light);
  border: 1px solid rgba(45,106,106,.18);
  border-radius: 8px;
  padding: .35rem .75rem;
  margin: .25rem 0;
  min-height: 1.7rem;
  display: flex;
  align-items: center;
}
.mi-pedal-factor { background: var(--amber-light); border-color: rgba(200,138,40,.2); }

/* ── Chain area (slot wells + wire bar) ──────────────────────────────────── */
.mi-pedal-chain-area {
  position: relative;
  margin: .9rem 0 .5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mi-pedal-chain {
  display: flex;
  gap: 0;
  align-items: stretch;
  min-height: 116px;
  position: relative;
  z-index: 1;
}

/* wire bar: sits below the chain row, spans across all slots + end caps */
.mi-pedal-wire-bar {
  display: flex;
  align-items: center;
  padding: 0 8px;
  margin-top: -8px;
  pointer-events: none;
}
.mi-pedal-wire {
  flex: 1;
  height: 4px;
  background: var(--teal-light);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
/* pulse LED animation — skipped under reduced-motion */
.mi-pedal-pulse {
  position: absolute;
  top: 0; left: -30%;
  width: 30%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, var(--teal) 50%, transparent 100%);
  border-radius: 2px;
}
@media (prefers-reduced-motion: no-preference) {
  .mi-pedal-pulse {
    animation: pedal-pulse 1.4s ease-in-out infinite;
  }
}
@keyframes pedal-pulse { 0% { left: -30%; } 100% { left: 110%; } }
@media (prefers-reduced-motion: reduce) {
  .mi-pedal-pulse { display: none; }
  .mi-pedal-wire { background: var(--teal); opacity: .3; }
}

/* slot well: wraps one card or the empty placeholder */
.mi-pedal-slot-well {
  flex: 0 0 auto;
  width: 130px;
  min-width: 100px;
  background: #fff;
  border: 2px dashed var(--line-2);
  border-radius: var(--r);
  margin: 4px 4px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  transition: border-color .15s, background .15s;
  position: relative;
}
.mi-pedal-slot-well.drop-target {
  border-color: var(--teal);
  background: var(--teal-light);
}

.mi-pedal-slot-empty {
  font-size: .72rem;
  color: var(--mid-gray);
  text-transform: uppercase;
  letter-spacing: .08em;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: .6rem;
  user-select: none;
}

/* ── Pedal card ──────────────────────────────────────────────────────────── */
.mi-pedal-card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  padding: .45rem .55rem .5rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-width: 100px;
  width: 100%;
  user-select: none;
  position: relative;
  transition: box-shadow .15s, border-color .15s, opacity .15s;
}
.mi-pedal-card:focus-visible {
  outline: 3px solid rgba(45,106,106,.45);
  outline-offset: 2px;
}
.mi-pedal-card.in-chain { border-color: var(--teal); }
.mi-pedal-card.in-rack  { border-color: var(--line-2); background: var(--cream); cursor: grab; }
.mi-pedal-card.in-rack:active { cursor: grabbing; }
.mi-pedal-card.dragging { opacity: .45; }
.mi-pedal-card.kb-grabbed { box-shadow: 0 0 0 3px var(--teal), 0 6px 20px rgba(45,106,106,.25); }
.mi-pedal-card[data-locked='1'] { cursor: default; }
.mi-pedal-card[data-locked='1'] .mi-pedal-grip { cursor: default; }
.mi-pedal-card.mi-pedal-drag-ghost {
  box-shadow: 0 8px 32px rgba(0,0,0,.22);
  transform: rotate(2deg);
  pointer-events: none;
}

/* Grip strip (the draggable zone) — touch-action:none set inline in JS */
.mi-pedal-grip {
  display: flex;
  align-items: center;
  gap: .4rem;
  cursor: grab;
  min-height: 36px;
  border-radius: 8px;
  padding: .15rem .3rem;
  background: var(--teal-light);
}
.mi-pedal-grip:active { cursor: grabbing; }

.mi-pedal-glyph {
  font-size: 1.2rem;
  line-height: 1;
  flex-shrink: 0;
  pointer-events: none;
}
.mi-pedal-name {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--teal-dark);
  flex: 1;
  pointer-events: none;
}
/* LED indicator */
.mi-pedal-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-2);
  flex-shrink: 0;
  transition: background .2s;
}
.mi-pedal-led.on { background: var(--ok); box-shadow: 0 0 5px rgba(45,140,90,.6); }
@media (prefers-reduced-motion: reduce) {
  .mi-pedal-led.on { box-shadow: none; }
}

/* Dial row */
.mi-pedal-dial-row {
  display: flex;
  align-items: center;
  gap: .35rem;
}
.mi-pedal-dial {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  min-height: 28px;
  /* thumb size: balance slider precedent (≥ 44px tap surface via track height + pointer slop) */
}
.mi-pedal-dial:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 2px; }
.mi-pedal-dial-val {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--teal-dark);
  font-weight: 700;
  min-width: 2.6ch;
  text-align: right;
}

/* Formula chip */
.mi-pedal-chip {
  font-size: .72rem;
  color: var(--mid-gray);
  font-family: var(--font-mono);
  background: var(--cream);
  border-radius: 5px;
  padding: .15rem .4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ◄ ► × buttons */
.mi-pedal-btns {
  display: flex;
  gap: .2rem;
  justify-content: flex-end;
}
.mi-pedal-btns .btn {
  font-size: .72rem;
  padding: .2rem .45rem;
  min-height: 28px;
  min-width: 28px;
  line-height: 1;
}

/* ── Rack ────────────────────────────────────────────────────────────────── */
.mi-pedal-rack {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .6rem .4rem;
  background: var(--cream);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  margin-top: .6rem;
  min-height: 52px;
}
.mi-pedal-rack-item { display: flex; }
.mi-pedal-rack-empty {
  font-size: .78rem;
  color: var(--mid-gray);
  padding: .3rem;
  font-style: italic;
}
.mi-pedal-rack .mi-pedal-card { width: 120px; flex-shrink: 0; }

/* ── probe handle focus ring (SVG element via CSS filter) ────────────────── */
circle[role='slider']:focus-visible {
  outline: 3px solid rgba(45,106,106,.45);
}
circle[role='slider'].dragging { opacity: .8; }

/* aria-live region */
.mi-pedal-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .site-nav,.header-right .who-text,.header-right .signlink,.header-right .nav-cta,.switch-wrap { display: none; }
  .header-right { margin-left: auto; }
  .nav-toggle { display: flex; }
  .site-footer .inner { grid-template-columns: 1fr 1fr; gap: 2rem; }
}
/* ═══════════════════════════════════════════════════ mi-flow widget ════ */
/*
 * Four stations: .iw-flow-mix / .iw-flow-tap / .iw-flow-shop / .iw-flow-crew
 * Scene art: jug + crates (mix), urn + valve (tap), scale + offers (shop),
 * sink row + countdown (crew). Liquid fills via height %; reduced-motion
 * guards on all CSS transitions.
 */

/* ── shared flow layout ──────────────────────────────────────────────────── */
.iw-flow {}

.mi-flow-intro {
  font-size: .92rem;
  line-height: 1.55;
  color: var(--charcoal);
  margin-top: .4rem;
}

.mi-flow-scene {
  margin: 1rem 0 .5rem;
  border-radius: var(--r);
  background: var(--warm-white);
  border: 1px solid var(--line-2);
  padding: 1rem;
  overflow: hidden;
}

.mi-flow-controls {
  margin: .5rem 0;
}

.mi-flow-control-row {
  display: grid;
  grid-template-columns: 120px 1fr 64px;
  align-items: center;
  gap: .5rem;
  margin-bottom: .5rem;
}

.mi-flow-ctrl-label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--teal-dark);
  cursor: pointer;
}

.mi-flow-range {
  width: 100%;
  min-height: 44px;
  cursor: pointer;
  accent-color: var(--teal);
}
.mi-flow-range:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 2px;
}

.mi-flow-range-val {
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 700;
  color: var(--teal-dark);
  text-align: right;
  min-width: 58px;
}

/* chip — live readout near the scene element */
.mi-flow-chip {
  font-size: .8rem;
  font-family: var(--font-mono);
  background: var(--teal-light);
  color: var(--teal-dark);
  border-radius: var(--r-sm);
  padding: .25rem .55rem;
  text-align: center;
  margin-top: .35rem;
  transition: background .2s, color .2s;
  font-weight: 600;
}
.mi-flow-chip.ok {
  background: var(--ok-bg);
  color: var(--ok-ink);
}
@media (prefers-reduced-motion: reduce) {
  .mi-flow-chip { transition: none; }
}

/* logbook */
.mi-flow-logbook {
  list-style: disc;
  padding-left: 1.4rem;
  margin: .4rem 0 .6rem;
  font-size: .82rem;
  color: var(--mid-gray);
  font-family: var(--font-mono);
}
.mi-flow-logbook li { margin-bottom: .18rem; }

/* board host */
.mi-flow-board-host {
  margin: .6rem 0;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--line-2);
}

/* aria-live region */
.mi-flow-live {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

/* ── mix station ──────────────────────────────────────────────────────────── */
.mi-flow-mix-scene {
  display: flex;
  align-items: flex-end;
  gap: 1.2rem;
  justify-content: center;
  min-height: 180px;
}

.mi-flow-crate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
}

.mi-flow-crate-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--mid-gray);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.mi-flow-crate-cups {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: 120px;
  min-height: 60px;
  padding: 6px;
  background: var(--cream);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
}

/* cup card */
.mi-flow-cup {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 2px solid var(--line-2);
  background: var(--warm-white);
  cursor: pointer;
  transition: transform .12s, background .12s;
  flex-shrink: 0;
  touch-action: none;
}
.mi-flow-cup:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}
.mi-flow-cup:hover { transform: scale(1.1); }
.mi-flow-cup.dragging { opacity: .4; }
.iw-flow-mix .mi-flow-cup[data-cup='cordial'].in-jug { background: #e74c3c; border-color: #c0392b; }
.iw-flow-mix .mi-flow-cup[data-cup='water'].in-jug   { background: #3BA6A0; border-color: #2D6A6A; }
.iw-flow-mix .mi-flow-cup[data-cup='cordial']:not(.in-jug) { background: rgba(231,76,60,.18); border-color: #e74c3c; }
.iw-flow-mix .mi-flow-cup[data-cup='water']:not(.in-jug)   { background: rgba(59,166,160,.18); border-color: #3BA6A0; }

@media (prefers-reduced-motion: reduce) {
  .mi-flow-cup { transition: none; }
  .mi-flow-cup:hover { transform: none; }
}

.mi-flow-cup-btns {
  display: flex;
  gap: .3rem;
}
.mi-flow-cup-btns .btn {
  min-height: 32px;
  min-width: 36px;
  font-size: 1rem;
  padding: .1rem .5rem;
}

/* jug */
.mi-flow-jug-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
}

.mi-flow-jug {
  width: 80px;
  height: 120px;
  border: 2px solid var(--teal);
  border-radius: 6px 6px 10px 10px;
  background: rgba(255,255,255,.7);
  position: relative;
  overflow: hidden;
}

.mi-flow-jug-inner {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column-reverse;
}

.mi-flow-jug-water {
  height: 0;
  background: #3BA6A0;
  transition: height .3s var(--ease-out);
}
.mi-flow-jug-cordial {
  height: 0;
  background: #e74c3c;
  transition: height .3s var(--ease-out);
}
@media (prefers-reduced-motion: reduce) {
  .mi-flow-jug-water, .mi-flow-jug-cordial { transition: none; }
}

.mi-flow-jug-label {
  position: absolute;
  bottom: 4px;
  left: 0; right: 0;
  text-align: center;
  font-size: .65rem;
  color: var(--charcoal);
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(255,255,255,.8);
  pointer-events: none;
}

/* ── tap station ──────────────────────────────────────────────────────────── */
.mi-flow-tap-scene {
  display: flex;
  align-items: flex-end;
  gap: 2rem;
  justify-content: center;
}

.mi-flow-urn-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
}

.mi-flow-urn {
  width: 80px;
  height: 120px;
  border: 2px solid var(--teal);
  border-radius: 6px 6px 12px 12px;
  background: rgba(255,255,255,.7);
  position: relative;
  overflow: hidden;
}

.mi-flow-urn-fill {
  position: absolute;
  bottom: 0;
  left: 2px; right: 2px;
  height: 0;
  background: linear-gradient(to top, var(--teal), #3BA6A0);
  border-radius: 0 0 10px 10px;
  transition: height .25s linear;
}
.mi-flow-urn-fill.full {
  background: linear-gradient(to top, var(--ok), #2ecc71);
}
@media (prefers-reduced-motion: reduce) {
  .mi-flow-urn-fill { transition: none; }
}

.mi-flow-urn-cap {
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  transform: translateY(-50%);
  text-align: center;
  font-size: .65rem;
  font-weight: 700;
  color: var(--teal-dark);
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(255,255,255,.9);
}

.mi-flow-urn-chip {
  font-size: .8rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--teal-dark);
  background: var(--teal-light);
  border-radius: 5px;
  padding: .2rem .5rem;
}

.mi-flow-valve-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
}

.mi-flow-valve-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--mid-gray);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.mi-flow-clock {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--teal-dark);
  letter-spacing: .05em;
}

.mi-flow-run {
  min-height: 36px;
  padding: .3rem .9rem;
}

/* ── shop station ─────────────────────────────────────────────────────────── */
.mi-flow-shop-scene {
  display: flex;
  flex-direction: column;
  gap: .8rem;
  align-items: center;
}

.mi-flow-scale-wrap { display: flex; justify-content: center; }

.mi-flow-scale-platform {
  width: 120px;
  height: 44px;
  background: var(--cream);
  border: 2px solid var(--teal);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mi-flow-scale-display {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--teal-dark);
}

.mi-flow-shop-offers {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.mi-flow-offer {
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--warm-white);
  padding: .6rem .9rem;
  min-width: 130px;
  text-align: center;
}

.mi-flow-offer-name {
  font-weight: 700;
  font-size: .88rem;
  color: var(--teal-dark);
  margin-bottom: .3rem;
}

.mi-flow-offer-unitrate {
  font-size: .75rem;
  font-family: var(--font-mono);
  color: var(--mid-gray);
  margin-bottom: .2rem;
}

.mi-flow-offer-cost {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--charcoal);
  transition: color .2s;
}
@media (prefers-reduced-motion: reduce) {
  .mi-flow-offer-cost { transition: none; }
}

/* ── crew station ─────────────────────────────────────────────────────────── */
.mi-flow-crew-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
}

.mi-flow-sink-row {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: center;
  min-height: 48px;
  align-items: center;
}

.mi-flow-washer {
  font-size: 1.6rem;
  opacity: .2;
  transition: opacity .25s, transform .25s;
}
.mi-flow-washer.active {
  opacity: 1;
  transform: scale(1.1);
}
@media (prefers-reduced-motion: reduce) {
  .mi-flow-washer { transition: none; }
  .mi-flow-washer.active { transform: none; }
}

.mi-flow-countdown {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--teal-dark);
  letter-spacing: .05em;
}

.mi-flow-crew-product {
  font-family: var(--font-mono);
  font-size: .88rem;
  color: var(--mid-gray);
  background: var(--cream);
  border-radius: 5px;
  padding: .2rem .55rem;
}

@media (max-width: 520px) {
  .wrap { padding: 22px 1.2rem 64px; }
  .hero .inner { padding: 3.5rem 1.4rem 4rem; }
  .site-footer .inner { grid-template-columns: 1fr; }
  .mi-slider-row { grid-template-columns: 1fr 58px; }
  .mi-slider-row .mi-slider-label { grid-column: 1 / -1; margin-bottom: -.3rem; }
}

/* ── lens widget (iw-lens*) ───────────────────────────────────────────────── */
/* Board host: the main coordinate plane the lens overlay sits inside */
.iw-lens .mi-lens-board-host {
  position: relative;
}

/* The SVG lens glass overlay — positioned by JS transform */
.iw-lens .mi-lens-overlay {
  pointer-events: none;
}
.iw-lens .mi-lens-glass {
  pointer-events: none;
}

/* Gradient label on the lens */
.iw-lens .mi-lens-grad-label {
  font-size: 13px;
  font-weight: 700;
  transition: fill .2s;
}
@media (prefers-reduced-motion: reduce) {
  .iw-lens .mi-lens-grad-label { transition: none; }
}

/* Focus handle label (inherits from mi-board draggable handle) */
.iw-lens .mi-handle-g { cursor: grab; }
.iw-lens .mi-handle-g.dragging { cursor: grabbing; }
.iw-lens .mi-handle-g.locked { cursor: default; }

/* Controls row */
.iw-lens .mi-lens-controls {
  margin-top: .75rem;
}
.iw-lens .mi-lens-ctrl-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.iw-lens .mi-lens-ctrl-label {
  font-size: .88rem;
  font-weight: 600;
  color: var(--teal-dark);
  min-width: 5rem;
  flex-shrink: 0;
}
.iw-lens .mi-lens-range-wrap {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex: 1;
}
.iw-lens .mi-lens-range {
  flex: 1;
  height: 6px;
  accent-color: var(--teal);
  cursor: pointer;
  min-width: 80px;
}
.iw-lens .mi-lens-range-val {
  font-family: var(--font-mono);
  font-size: .82rem;
  font-weight: 600;
  color: var(--teal-dark);
  min-width: 2.8rem;
  text-align: right;
}
/* +/- zoom step buttons */
.iw-lens .mi-lens-zoom-dec,
.iw-lens .mi-lens-zoom-inc {
  min-height: 32px;
  min-width: 36px;
  font-size: 1.1rem;
  padding: .1rem .5rem;
}

/* Intro text */
.iw-lens .mi-lens-intro {
  margin-top: .35rem;
  font-size: .93rem;
  color: var(--charcoal);
}

/* Logbook */
.iw-lens .mi-lens-logbook {
  margin: .5rem 0 0;
  padding-left: 1.3rem;
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--teal-dark);
  list-style: disc;
  max-height: 140px;
  overflow-y: auto;
}
.iw-lens .mi-lens-logbook li {
  margin: .15rem 0;
}

/* Second board label */
.iw-lens .mi-lens-log-board-host {
  margin-top: 1rem;
  position: relative;
}
.iw-lens .mi-lens-log-board-host::before {
  content: 'Gradient function board';
  display: block;
  font-size: .78rem;
  font-weight: 700;
  color: var(--mid-gray);
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: .3rem;
}

/* IW tag badge */
.iw-tag.lens {
  background: rgba(45, 106, 106, .12);
  color: var(--teal-dark);
}

@media (max-width: 520px) {
  .iw-lens .mi-lens-ctrl-row { gap: .35rem; }
  .iw-lens .mi-lens-zoom-dec,
  .iw-lens .mi-lens-zoom-inc { min-width: 32px; }
}

/* ════════════════════════════════════════════ mi-fill widget (integral) ══ */

/* IW tag badge */
.iw-tag.fill {
  background: rgba(192, 57, 43, .10);
  color: #8b1a12;
  border: 1px solid rgba(192, 57, 43, .22);
}

/* ── Layout: board beside tank column ────────────────────────────────────── */
.mi-fill-layout {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.mi-fill-board-host {
  flex: 1 1 260px;
  min-width: 0;
}

/* ── Tank gauge ───────────────────────────────────────────────────────────── */
.mi-fill-tank-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
  min-width: 60px;
}

.mi-fill-tank {
  position: relative;
  width: 48px;
  height: 180px;
  background: var(--teal-light);
  border: 2px solid var(--teal);
  border-radius: 8px 8px 4px 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.mi-fill-tank-fill {
  width: 100%;
  height: 0%;
  background: var(--teal);
  border-radius: 0 0 3px 3px;
  transition: height .35s var(--ease-out), background .25s;
}

@media (prefers-reduced-motion: reduce) {
  .mi-fill-tank-fill { transition: none; }
}

.mi-fill-tank-label {
  position: absolute;
  bottom: -1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: .65rem;
  font-weight: 700;
  color: var(--mid-gray);
  white-space: nowrap;
  text-align: center;
  letter-spacing: .03em;
}

/* ── Odometer (area value beneath tank) ─────────────────────────────────── */
.mi-fill-odometer {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--teal-dark);
  min-width: 5ch;
  text-align: center;
  background: var(--teal-light);
  border-radius: var(--r-sm);
  padding: .3rem .5rem;
  margin-top: 1.6rem;  /* clear the tank label */
  transition: color .2s;
}

.mi-fill-odometer.mi-fill-odo-neg {
  color: var(--no);
  background: var(--no-bg);
}

.mi-fill-odometer.mi-fill-odo-zero {
  color: var(--mid-gray);
  background: var(--cream);
}

/* ── Controls row ────────────────────────────────────────────────────────── */
.mi-fill-ctrl-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  padding: .5rem 0;
}

.mi-fill-ctrl-label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--charcoal);
  min-width: 8ch;
  flex-shrink: 0;
}

.mi-fill-range-wrap {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex: 1 1 200px;
}

.mi-fill-range {
  flex: 1 1 120px;
  min-width: 80px;
  cursor: pointer;
  min-height: 28px;
  accent-color: var(--teal);
}

.mi-fill-range:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: 3px;
}

.mi-fill-range-val {
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--teal-dark);
  font-weight: 700;
  min-width: 4.5ch;
  text-align: right;
}

/* ── Strip-mode over/under legend ────────────────────────────────────────── */
.mi-fill-strip-legend {
  display: flex;
  gap: .8rem;
  flex-wrap: wrap;
  font-size: .78rem;
  color: var(--mid-gray);
  margin: .3rem 0;
}

.mi-fill-legend-teal::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  background: rgba(45, 106, 106, .30);
  border: 1px solid #2D6A6A;
  border-radius: 2px;
  vertical-align: -2px;
  margin-right: .3rem;
}

.mi-fill-legend-amber::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  background: rgba(232, 168, 66, .22);
  border: 1px solid #C48A28;
  border-radius: 2px;
  vertical-align: -2px;
  margin-right: .3rem;
}

/* ── SweepLog second board + logbook ─────────────────────────────────────── */
.mi-fill-log-board-host {
  margin-top: 1rem;
  position: relative;
}

.mi-fill-log-board-host::before {
  content: 'Area function board';
  display: block;
  font-size: .78rem;
  font-weight: 700;
  color: var(--mid-gray);
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: .3rem;
}

.mi-fill-logbook {
  margin: .5rem 0 0;
  padding-left: 1.3rem;
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--teal-dark);
  list-style: disc;
  max-height: 140px;
  overflow-y: auto;
}

.mi-fill-logbook li {
  margin: .15rem 0;
}

/* ── Intro text ──────────────────────────────────────────────────────────── */
.mi-fill-intro {
  font-size: .92rem;
  color: var(--mid-gray);
  margin: .3rem 0 .1rem;
  line-height: 1.6;
}

/* ── Signed-area signed colours on shaded polygons (via SVG fill attr — CSS
 *    override not needed; the teal/red fills are set inline by the engine) */

/* ── Maths table (reverse-power-rule partial table in pane 6) ─────────────── */
.mi-table {
  border-collapse: collapse;
  margin: .8rem 0;
  font-size: .92rem;
  width: auto;
}
.mi-table th,
.mi-table td {
  padding: .35rem .9rem;
  border: 1px solid var(--line-2);
  text-align: left;
}
.mi-table th {
  background: var(--teal-light);
  font-weight: 700;
  color: var(--teal-dark);
}
.mi-table td strong {
  color: var(--teal);
}

/* ── Screen-reader live region ───────────────────────────────────────────── */
.mi-fill-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 520px) {
  .mi-fill-ctrl-row { gap: .35rem; }
  .mi-fill-n-dec,
  .mi-fill-n-inc { min-width: 32px; }
  .mi-fill-tank { width: 36px; height: 140px; }
  .mi-fill-layout { gap: .5rem; }
}

/* ── growthlog widget (mi-growthlog.js) ──────────────────────────────────── */

.iw-growthlog { display: flex; flex-direction: column; gap: 1rem; }

/* Tag variants */
.iw-tag.growthlog { background: var(--teal-light); color: var(--teal-dark); }
.iw-tag.growthlog.ruler { background: var(--amber-light); color: var(--amber-dark); }
.iw-tag.growthlog.logaxis { background: #eaf0ff; color: #1a3080; }

/* Intro text */
.mi-gl-intro {
  font-size: .92rem;
  color: var(--mid-gray);
  margin: .3rem 0 .1rem;
  line-height: 1.6;
}

/* ── GROW mode ────────────────────────────────────────────────────────────── */

.mi-gl-grow-layout {
  display: flex;
  gap: 1.2rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.mi-gl-dish-wrap {
  flex: 0 0 auto;
}

.mi-gl-dish-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--mid-gray);
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: .3rem;
}

.mi-gl-dish {
  display: block;
  border-radius: 50%;
  box-shadow: var(--sh-sm);
}

.mi-gl-table-wrap {
  flex: 1 1 180px;
  overflow-x: auto;
}

/* Highlight most recent row */
.mi-gl-row-new td {
  background: var(--amber-light);
  font-weight: 700;
  transition: background .25s;
}

.mi-gl-count { font-family: var(--font-mono); font-size: .9rem; }

/* STEP controls */
.mi-gl-controls { display: flex; flex-direction: column; gap: .5rem; }

.mi-gl-ctrl-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.mi-gl-range {
  flex: 1 1 120px;
  accent-color: var(--teal);
  height: 4px;
  cursor: pointer;
}

.mi-gl-range-val {
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--teal-dark);
  min-width: 4.5rem;
}

/* ── RULER mode ───────────────────────────────────────────────────────────── */

.mi-gl-ruler-wrap {
  overflow-x: auto;
  margin: .5rem 0;
  padding: .5rem 0;
}

.mi-gl-ruler-svg {
  display: block;
  height: 110px;
  touch-action: none;
}

/* Marker handle cursor feedback */
.mi-gl-marker { cursor: grab; }
.mi-gl-marker:active,
.mi-gl-marker[data-dragging] { cursor: grabbing; }
.mi-gl-marker:focus-visible .mi-gl-marker-hit {
  stroke: var(--teal);
  stroke-width: 2.5;
  fill: rgba(45,106,106,.12);
}

/* Ruler controls row */
.mi-gl-ruler-controls {
  display: flex;
  align-items: center;
  gap: .8rem;
  flex-wrap: wrap;
  margin-top: .4rem;
}

.mi-gl-landing-readout {
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--teal-dark);
  line-height: 1.5;
  max-width: 46ch;
  word-break: break-word;
}

/* ── LOGAXIS mode ─────────────────────────────────────────────────────────── */

.mi-gl-logaxis-layout {
  display: flex;
  flex-direction: column;
  gap: .7rem;
}

.mi-gl-logaxis-board-host {
  position: relative;
}

.mi-gl-logaxis-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.mi-gl-toggle-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 600;
  color: var(--charcoal);
  cursor: pointer;
  user-select: none;
}

.mi-gl-toggle-label input[type="checkbox"] {
  width: 2.6rem;
  height: 1.4rem;
  accent-color: var(--teal);
  cursor: pointer;
}

.mi-gl-axis-hint {
  font-size: .84rem;
  color: var(--mid-gray);
  font-style: italic;
}

/* ── Shared live region (screen reader) ──────────────────────────────────── */
.mi-gl-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 520px) {
  .mi-gl-grow-layout { gap: .6rem; }
  .mi-gl-dish { width: 110px; height: 110px; }
  .mi-gl-ruler-svg { height: 90px; }
  .mi-gl-ctrl-row { gap: .35rem; }
}

/* ── radians widget (family #13: wrap-the-radius + unit-circle identity) ──── */
.iw-radians .mi-rd-intro { margin-top: .4rem; color: var(--ink, #13403f); line-height: 1.45; }
.mi-rd-wrap-layout,
.mi-rd-uc-layout {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1.2rem;
  margin: .8rem 0;
}
.mi-rd-svg-host,
.mi-rd-uc-board-host { flex: 1 1 260px; min-width: 0; }
.mi-rd-info-col,
.mi-rd-uc-readouts { flex: 1 1 200px; min-width: 180px; }
.mi-rd-readout-box {
  background: #FDF0D5; border: 1px solid #E8C98A; border-radius: 12px;
  padding: .7rem .9rem; display: flex; flex-direction: column; gap: .4rem;
}
.mi-rd-readout-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: .8rem;
}
.mi-rd-label { color: #6B6B6B; font-size: .85rem; }
.mi-rd-value {
  font-weight: 700; color: #1E4D4D; font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
}
.mi-rd-value.mi-rd-identity { color: #2d8c5a; }   /* x² + y² always reads 1 */

/* draggable handle affordance (both modes) */
.mi-rd-handle:focus-visible,
.iw-radians [role="slider"]:focus-visible {
  outline: 3px solid #2D6A6A; outline-offset: 2px; border-radius: 50%;
}

/* tick "pop" only honoured when the user allows motion */
@media (prefers-reduced-motion: no-preference) {
  .iw-radians-wrap [data-layer="ticks"] g { transition: opacity .18s ease; }
}

@media (max-width: 520px) {
  .mi-rd-wrap-layout,
  .mi-rd-uc-layout { gap: .7rem; }
  .mi-rd-info-col,
  .mi-rd-uc-readouts { min-width: 0; flex-basis: 100%; }
}

/* ════════════════════════════════════════════════════════════════════════
   Fraction wall widget (mi-fracwall.js — Foundation `fractions` strand)
   ════════════════════════════════════════════════════════════════════════ */
.iw-tag.fracwall {
  background: var(--amber-light);
  color: var(--amber-dark);
  border: 1px solid rgba(200,138,40,.25);
}
.mi-fracwall-intro { font-size: .93rem; color: var(--charcoal); line-height: 1.6; margin-top: .35rem; }
.mi-fracwall-stage {
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  margin: .6rem 0;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mi-fracwall-stage svg { display: block; max-width: 100%; height: auto; }
/* shaded cells settle gently; killed under reduced motion */
.mi-fracwall-stage rect { transition: fill .18s ease, stroke .18s ease; }
@media (prefers-reduced-motion: reduce) { .mi-fracwall-stage rect { transition: none; } }

/* stepper: − value + */
.mi-fw-stepper { display: inline-flex; align-items: center; gap: .4rem; }
.mi-fw-stepper-label { font-weight: 700; font-size: .82rem; color: var(--teal-dark); margin-right: .15rem; }
.mi-fw-dec, .mi-fw-inc { min-width: 40px; font-weight: 800; font-size: 1.1rem; line-height: 1; padding: .3rem .55rem; }
.mi-fw-stepper-val { min-width: 1.6em; text-align: center; font-weight: 800; font-size: 1.05rem; color: var(--charcoal); }

/* inline stacked fraction (numerator over denominator) for readouts/copy */
.mi-frac {
  display: inline-flex; flex-direction: column; align-items: center;
  vertical-align: middle; line-height: 1; font-weight: 700; margin: 0 .12em;
}
.mi-frac > span:first-child { border-bottom: 1.6px solid currentColor; padding: 0 .25em .05em; }
.mi-frac > span:last-child { padding: .05em .25em 0; }

/* ════════════════════════════════════════════════════════════════════════
   Percentage bar widget (mi-percent.js — Foundation `percentages` strand)
   ════════════════════════════════════════════════════════════════════════ */
.iw-tag.percent {
  background: var(--teal-light);
  color: var(--teal-dark);
  border: 1px solid rgba(45,106,106,.22);
}
.mi-percent-intro { font-size: .93rem; color: var(--charcoal); line-height: 1.6; margin-top: .35rem; }
.mi-percent-stage {
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  margin: .6rem 0;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mi-percent-stage svg { display: block; max-width: 100%; height: auto; }
.mi-percent-stage rect { transition: fill .15s ease; }
@media (prefers-reduced-motion: reduce) { .mi-percent-stage rect { transition: none; } }

/* slider row */
.mi-pct-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; width: 100%; }
.mi-pct-label { font-weight: 700; font-size: .82rem; color: var(--teal-dark); }
.mi-pct-range { flex: 1; min-width: 160px; accent-color: var(--teal); }
.mi-pct-val { min-width: 3.2em; text-align: center; font-weight: 800; font-size: 1.05rem; color: var(--charcoal); }

/* ════════════════════════════════════════════════════════════════════════
   Number line widget (mi-numline.js — Foundation `negatives` strand)
   ════════════════════════════════════════════════════════════════════════ */
.iw-tag.numline {
  background: #e1edf8;
  color: #2f5e94;
  border: 1px solid rgba(58,120,194,.22);
}
.mi-numline-intro { font-size: .93rem; color: var(--charcoal); line-height: 1.6; margin-top: .35rem; }
.mi-numline-stage {
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  margin: .6rem 0;
  min-height: 110px;
  display: flex; align-items: center; justify-content: center;
}
.mi-numline-stage svg { display: block; max-width: 100%; height: auto; }
.mi-numline-stage circle, .mi-numline-stage path, .mi-numline-stage line { transition: none; }

.mi-nl-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; width: 100%; }
.mi-nl-label { font-weight: 700; font-size: .82rem; color: var(--teal-dark); }
.mi-nl-range { flex: 1; min-width: 160px; accent-color: var(--teal); }
.mi-nl-val { min-width: 2.6em; text-align: center; font-weight: 800; font-size: 1.05rem; color: var(--charcoal); }

/* ════════════════════════════════════════════════════════════════════════
   Tiling-yard widget (mi-tilegrid.js — Foundation `area` strand)
   ════════════════════════════════════════════════════════════════════════ */
.iw-tag.tilegrid {
  background: #e6f2da;
  color: #4a7a2e;
  border: 1px solid rgba(90,154,62,.25);
}
.mi-tilegrid-intro { font-size: .93rem; color: var(--charcoal); line-height: 1.6; margin-top: .35rem; }
.mi-tilegrid-stage {
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden; margin: .6rem 0; min-height: 120px;
  display: flex; align-items: center; justify-content: center;
}
.mi-tilegrid-stage svg { display: block; max-width: 100%; height: auto; }

.mi-tg-stepper { display: inline-flex; align-items: center; gap: .4rem; margin-right: .4rem; }
.mi-tg-stepper-label { font-weight: 700; font-size: .82rem; color: var(--teal-dark); }
.mi-tg-dec, .mi-tg-inc { min-width: 40px; font-weight: 800; font-size: 1.1rem; line-height: 1; padding: .3rem .55rem; }
.mi-tg-stepper-val { min-width: 1.5em; text-align: center; font-weight: 800; font-size: 1.05rem; color: var(--charcoal); }

/* ════════════════════════════════════════════════════════════════════════
   Averages widget (mi-blocks.js — Foundation `averages` strand)
   ════════════════════════════════════════════════════════════════════════ */
.iw-tag.blocks {
  background: #e7e1f5;
  color: #5a4a8a;
  border: 1px solid rgba(90,74,138,.22);
}
.mi-blocks-intro { font-size: .93rem; color: var(--charcoal); line-height: 1.6; margin-top: .35rem; }
.mi-blocks-stage {
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden; margin: .6rem 0; min-height: 120px;
  display: flex; align-items: center; justify-content: center;
}
.mi-blocks-stage svg { display: block; max-width: 100%; height: auto; }
.mi-blocks-stage rect { transition: fill .15s ease; }
/* draggable number cards: non-dragged cards glide to their slot; the dragged
   one follows the pointer with no transition. */
.mi-bcard { transition: transform .18s ease; }
.mi-bcard.dragging { transition: none; }
@media (prefers-reduced-motion: reduce) { .mi-blocks-stage rect, .mi-bcard { transition: none; } }
.mi-blocks-even, .mi-blocks-sort { font-weight: 700; }

/* ════════════════════════════════════════════════════════════════════════
   Standard-deviation widget (mi-spread.js — A-level `spread` strand)
   ════════════════════════════════════════════════════════════════════════ */
.iw-tag.spread {
  background: #dcecec;
  color: var(--teal-dark);
  border: 1px solid rgba(45,106,106,.22);
}
.mi-spread-intro { font-size: .93rem; color: var(--charcoal); line-height: 1.6; margin-top: .35rem; }
.mi-spread-stage {
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden; margin: .6rem 0; min-height: 120px;
  display: flex; align-items: center; justify-content: center;
}
.mi-spread-stage svg { display: block; max-width: 100%; height: auto; }
/* focusable data dots — clear keyboard focus ring (a11y) */
.mi-spread-dot { outline: none; }
.mi-spread-dot:focus-visible circle, .mi-spread-dot:focus circle { stroke: var(--amber-dark); stroke-width: 3.5; }
.mi-spread-next { font-weight: 700; }
.mi-spread-table { border-collapse: collapse; margin: .4rem auto; font-family: var(--font-hand, inherit); }
.mi-spread-table th, .mi-spread-table td { border: 1.5px solid var(--line); padding: .35rem .7rem; text-align: center; font-size: 1.1rem; min-width: 2.4rem; }
.mi-spread-table th { background: var(--warm-white); color: var(--teal-dark); font-weight: 800; }
.mi-spread-table td.sq { color: var(--amber-dark); font-weight: 700; }

/* ════════════════════════════════════════════════════════════════════════
   Normal-distribution widget (mi-normal.js — A-level `normal` strand)
   ════════════════════════════════════════════════════════════════════════ */
.iw-tag.normal {
  background: #efe2f3;
  color: #6b4a85;
  border: 1px solid rgba(107,74,133,.22);
}
.mi-normal-intro { font-size: .93rem; color: var(--charcoal); line-height: 1.6; margin-top: .35rem; }
.mi-normal-stage {
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden; margin: .6rem 0; min-height: 120px;
  display: flex; align-items: center; justify-content: center;
}
.mi-normal-stage svg { display: block; max-width: 100%; height: auto; }
/* focusable boundary handle — clear keyboard focus ring (a11y) */
.mi-normal-bound { outline: none; }
.mi-normal-bound:focus-visible rect, .mi-normal-bound:focus rect { stroke: var(--teal-dark); stroke-width: 3; }

/* ════════════════════════════════════════════════════════════════════════
   Hypothesis-test widget (mi-hyptest.js — A-level `hyptest` strand)
   ════════════════════════════════════════════════════════════════════════ */
.iw-tag.hyptest {
  background: #f3e2e0;
  color: #9a3b2e;
  border: 1px solid rgba(154,59,46,.22);
}
.mi-ht-intro { font-size: .93rem; color: var(--charcoal); line-height: 1.6; margin-top: .35rem; }
.mi-ht-stage {
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden; margin: .6rem 0; min-height: 120px;
  display: flex; align-items: center; justify-content: center;
}
.mi-ht-stage svg { display: block; max-width: 100%; height: auto; }
.mi-ht-marker { outline: none; }
.mi-ht-marker:focus-visible path, .mi-ht-marker:focus path { stroke: var(--teal-dark); stroke-width: 2; }
.mi-ht-verdict { font-size: .9rem; color: var(--charcoal); margin: .2rem 0 .4rem; }
.mi-ht-tag { display: inline-block; font-weight: 800; font-size: .8rem; padding: .12rem .6rem; border-radius: var(--pill); margin-right: .4rem; }
.mi-ht-tag.reject { background: #f6d9d4; color: #9a3b2e; }
.mi-ht-tag.keep { background: var(--warm-white); color: var(--mid-gray, #6b6b6b); border: 1px solid var(--line); }

/* ════════════════════════════════════════════════════════════════════════
   Sampling / CLT widget (mi-sampling.js — A-level `sampling` strand)
   ════════════════════════════════════════════════════════════════════════ */
.iw-tag.sampling {
  background: #ece2f3;
  color: #6b4a85;
  border: 1px solid rgba(107,74,133,.22);
}
.mi-sm-intro { font-size: .93rem; color: var(--charcoal); line-height: 1.6; margin-top: .35rem; }
.mi-sm-stage {
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden; margin: .6rem 0; min-height: 120px;
  display: flex; align-items: center; justify-content: center;
}
.mi-sm-stage svg { display: block; max-width: 100%; height: auto; }
.mi-sm-dec, .mi-sm-inc { font-weight: 700; }

/* ════════════════════════════════════════════════════════════════════════
   Kinematics widget (mi-motion.js — A-level `kinematics` strand)
   ════════════════════════════════════════════════════════════════════════ */
.iw-tag.motion {
  background: #e2eef3;
  color: #2a5b6e;
  border: 1px solid rgba(42,91,110,.22);
}
.mi-mo-intro { font-size: .93rem; color: var(--charcoal); line-height: 1.6; margin-top: .35rem; }
.mi-mo-stage {
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden; margin: .6rem 0; min-height: 110px;
  display: flex; align-items: center; justify-content: center;
}
.mi-mo-stage svg { display: block; max-width: 100%; height: auto; }
.mi-mo-stage text { transition: none; }
.mi-mo-range { vertical-align: middle; width: 46%; max-width: 280px; accent-color: var(--teal); }
.mi-mo-dec, .mi-mo-inc { font-weight: 700; }

/* ════════════════════════════════════════════════════════════════════════
   Projectiles widget (mi-projectile.js — A-level `projectiles` strand)
   ════════════════════════════════════════════════════════════════════════ */
.iw-tag.projectile {
  background: #e8eef0;
  color: #3a5a52;
  border: 1px solid rgba(45,106,106,.24);
}
.mi-pj-intro { font-size: .93rem; color: var(--charcoal); line-height: 1.6; margin-top: .35rem; }
.mi-pj-stage {
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden; margin: .6rem 0; min-height: 150px;
  display: flex; align-items: center; justify-content: center;
}
.mi-pj-stage svg { display: block; max-width: 100%; height: auto; }
.mi-pj-stage text { transition: none; }
.mi-pj-range { vertical-align: middle; width: 46%; max-width: 280px; accent-color: var(--teal); }
.mi-pj-dec, .mi-pj-inc { font-weight: 700; }

/* ════════════════════════════════════════════════════════════════════════
   Forces / Newton's laws widget (mi-forces.js — A-level `forces` strand)
   ════════════════════════════════════════════════════════════════════════ */
.iw-tag.forces {
  background: #f0ead8;
  color: #7a5e2e;
  border: 1px solid rgba(122,94,46,.24);
}
.mi-fc-intro { font-size: .93rem; color: var(--charcoal); line-height: 1.6; margin-top: .35rem; }
.mi-fc-stage {
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden; margin: .6rem 0; min-height: 150px;
  display: flex; align-items: center; justify-content: center;
}
.mi-fc-stage svg { display: block; max-width: 100%; height: auto; }
.mi-fc-stage text { transition: none; }
.mi-fc-range { vertical-align: middle; width: 44%; max-width: 280px; accent-color: var(--teal); }
.mi-fc-dec, .mi-fc-inc { font-weight: 700; }

/* ════════════════════════════════════════════════════════════════════════
   Slopes & friction widget (mi-ramp.js — A-level `ramp` strand)
   ════════════════════════════════════════════════════════════════════════ */
.iw-tag.ramp {
  background: #e6ecdf;
  color: #4d6238;
  border: 1px solid rgba(77,98,56,.24);
}
.mi-rm-intro { font-size: .93rem; color: var(--charcoal); line-height: 1.6; margin-top: .35rem; }
.mi-rm-stage {
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden; margin: .6rem 0; min-height: 160px;
  display: flex; align-items: center; justify-content: center;
}
.mi-rm-stage svg { display: block; max-width: 100%; height: auto; }
.mi-rm-stage text { transition: none; }
.mi-rm-range { vertical-align: middle; width: 44%; max-width: 280px; accent-color: var(--teal); }
.mi-rm-dec, .mi-rm-inc { font-weight: 700; }

/* ════════════════════════════════════════════════════════════════════════
   Connected particles / pulley widget (mi-pulley.js — A-level `pulley` strand)
   ════════════════════════════════════════════════════════════════════════ */
.iw-tag.pulley {
  background: #e3eaee;
  color: #3c5663;
  border: 1px solid rgba(60,86,99,.24);
}
.mi-pl-intro { font-size: .93rem; color: var(--charcoal); line-height: 1.6; margin-top: .35rem; }
.mi-pl-stage {
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden; margin: .6rem 0; min-height: 160px;
  display: flex; align-items: center; justify-content: center;
}
.mi-pl-stage svg { display: block; max-width: 100%; height: auto; }
.mi-pl-stage text { transition: none; }
.mi-pl-range { vertical-align: middle; width: 44%; max-width: 280px; accent-color: var(--teal); }
.mi-pl-dec, .mi-pl-inc { font-weight: 700; }

/* ════════════════════════════════════════════════════════════════════════
   Confidence intervals widget (mi-confint.js — A-level `confint` strand)
   ════════════════════════════════════════════════════════════════════════ */
.iw-tag.confint {
  background: #e6efe9;
  color: #2f5f4e;
  border: 1px solid rgba(47,95,78,.24);
}
.mi-ci-intro { font-size: .93rem; color: var(--charcoal); line-height: 1.6; margin-top: .35rem; }
.mi-ci-stage {
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden; margin: .6rem 0; min-height: 130px;
  display: flex; align-items: center; justify-content: center;
}
.mi-ci-stage svg { display: block; max-width: 100%; height: auto; }
.mi-ci-stage text { transition: none; }
.mi-ci-range { vertical-align: middle; width: 40%; max-width: 240px; accent-color: var(--teal); }
.mi-ci-dec, .mi-ci-inc { font-weight: 700; }

/* ════════════════════════════════════════════════════════════════════════
   Tier section headers in the strand catalogue (hub + learn index)
   — full-width rows inside the .grid (mi-strands.js strandGroupedHtml)
   ════════════════════════════════════════════════════════════════════════ */
.tier-head {
  grid-column: 1 / -1;
  display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap;
  margin: 1.6rem 0 .1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--line);
  font-family: var(--font-display);
}
.tier-head:first-child { margin-top: 0; }
.tier-head-label { font-size: 1.15rem; font-weight: 700; color: var(--charcoal); }
.tier-sub { font-size: .82rem; font-weight: 600; color: var(--amber-dark); letter-spacing: .02em; text-transform: uppercase; }
