/* ==========================================================================
   STEM Subject Lab · Team Nightmare
   Matches tnightmare.com: #0a0a0a ground, Satoshi headings (-5% tracking),
   Instrument Serif italic accent in #650cf5, Inter for small UI text,
   centred section pills, #141414 fields, 50px containers, no gradients.
   ========================================================================== */
@import url("https://api.fontshare.com/v2/css?f[]=satoshi@300,400,500,700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@400;500;600&display=swap");

:root {
  --bg: #0a0a0a;
  --bg-2: #0d0d0d;
  --surface: #141414;
  --surface-2: #1c1c1c;
  --surface-glass: rgba(13, 13, 13, 0.5);
  --surface-soft: rgba(13, 13, 13, 0.4);
  --ink: #fbfafc;
  --ink-2: rgba(255, 255, 255, 0.69);
  --muted: #999999;
  --muted-2: #ababba;
  --faint: #777777;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);

  --violet: #650cf5;
  --violet-2: #7a3bff;
  --violet-3: #a98bff;
  --violet-soft: rgba(101, 12, 245, 0.16);
  --green: #1aff75;
  --coral: #ff5c7a;
  --white: #ffffff;

  /* semantic aliases used by diagrams: thrust=lavender, drag=coral, rolling/ok=green, pair/other=white */
  --amber: #a98bff;
  --rose: #ff5c7a;
  --emerald: #1aff75;
  --cyan: #ffffff;
  --violet-bright: #a98bff;

  --paper: #f8f6f1;
  --paper-2: #ffffff;
  --paper-ink: #141414;
  --paper-muted: #555555;
  --paper-line: #dcd7cf;
  --paper-accent: #650cf5;

  /* diagram tokens (dark) */
  --d-bg: #0d0d0d;
  --d-grid: rgba(255, 255, 255, 0.04);
  --d-ink: #fbfafc;
  --d-muted: #999999;
  --d-faint: #777777;
  --d-line: rgba(255, 255, 255, 0.22);
  --d-body: #1c1c1c;
  --d-body-2: #262626;
  --d-wheel: #0a0a0a;

  --font: "Satoshi", "Satoshi Placeholder", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --ui: "Inter", "Inter Placeholder", system-ui, sans-serif;

  --max: 1140px;
  --r-card: 24px;
  --r-box: 30px;
  --r-big: 50px;
  --r-field: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
:focus-visible { outline: 2px solid var(--violet-2); outline-offset: 3px; border-radius: 6px; }
::selection { background: rgba(101, 12, 245, 0.45); }
.wrap { width: min(100% - 2.5rem, var(--max)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono, .num { font-family: var(--font); font-variant-numeric: tabular-nums; font-weight: 500; }
.ui { font-family: var(--ui); }
sub, sup { line-height: 0; }
em.accent, .accent { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--violet); }

/* ------------------------------------------------------------ Nav ---- */
.nav { position: sticky; top: 16px; z-index: 40; display: flex; justify-content: center; padding: 0 1rem; margin-bottom: 0.5rem; }
.nav-pill { display: flex; align-items: center; gap: 0.15rem; padding: 10px 12px 10px 16px; border-radius: 999px; background: var(--surface-glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: rgba(255,255,255,0.32) 0.24px 0.24px 1.7px -1.4px, rgba(255,255,255,0.27) 2px 2px 14px -2.75px; max-width: 100%; }
.nav-brand { display: inline-flex; align-items: center; gap: 0.6rem; margin-right: 0.6rem; font-weight: 500; font-size: 14px; color: var(--ink); white-space: nowrap; }
.nav-mark { width: 24px; height: 24px; object-fit: contain; flex: none; }
.nav-links { display: none; align-items: center; gap: 0; }
.nav-links a, .nav-links button { padding: 8px 11px; border-radius: 999px; color: var(--ink); font-size: 14px; font-weight: 500; white-space: nowrap; transition: color .15s, background .15s; opacity: .92; }
.nav-links a:hover, .nav-links button:hover { opacity: 1; background: rgba(255,255,255,0.06); }
.nav-links a[aria-current="page"] { opacity: 1; }
.nav-cta { margin-left: 6px; padding: 9px 14px; border-radius: 999px; background: var(--violet); color: #fff; font-size: 14px; font-weight: 500; white-space: nowrap; box-shadow: rgba(0,0,0,0.05) 0 4px 10px -2px, rgba(0,0,0,0.1) 0 2px 2px -1px, rgba(98,20,217,0.12) 0 0 0 1px; transition: background .15s, transform .15s; }
.nav-cta:hover { background: #7223ff; }
.nav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 999px; color: var(--ink); margin-left: 4px; }
.nav-toggle:hover { background: rgba(255,255,255,0.06); }
@media (min-width: 900px) { .nav-links { display: flex; } .nav-toggle { display: none; } }
.nav-sheet { position: fixed; inset: 0; z-index: 39; display: none; background: rgba(10,10,10,0.92); backdrop-filter: blur(16px); padding: 5.6rem 1.25rem 2rem; }
.nav-sheet.open { display: block; }
.nav-sheet a, .nav-sheet button { display: block; width: 100%; text-align: left; padding: 0.95rem 1.1rem; border-radius: var(--r-field); font-size: 1.05rem; font-weight: 500; color: var(--ink); background: var(--surface); margin-bottom: 0.5rem; }

/* ----------------------------------------------------------- Buttons -- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; min-height: 44px; padding: 0.7rem 1.25rem; border-radius: 999px; font-size: 15px; font-weight: 500; white-space: nowrap; transition: background .18s, transform .18s var(--ease), border-color .18s, opacity .18s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--violet); color: #fff; box-shadow: rgba(98,20,217,0.12) 0 0 0 1px; }
.btn-primary:hover { background: #7223ff; }
.btn-ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { min-height: 36px; padding: 0.45rem 0.95rem; font-size: 14px; }
.btn-block { width: 100%; }
.btn[aria-pressed="true"] { background: var(--violet-soft); box-shadow: inset 0 0 0 1px rgba(101,12,245,0.6); color: #fff; }

/* ------------------------------------------------------- Section head -- */
.section-tag { display: inline-flex; align-items: center; padding: 10px 16px; border-radius: 50px; background: var(--surface-soft); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.10); color: var(--ink); font-size: 15px; font-weight: 500; line-height: 1.1; }
.section-head { display: grid; justify-items: center; text-align: center; gap: 1.1rem; margin: 0 auto 2.2rem; max-width: 760px; }
.section-head h2 { margin: 0; font-size: clamp(2.4rem, 6vw, 4.2rem); font-weight: 500; letter-spacing: -0.05em; line-height: 1; color: var(--ink); }
.section-head h2 em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--violet); letter-spacing: 0; }
.section-head p { margin: 0; max-width: 640px; color: var(--muted); font-size: 17px; font-weight: 500; line-height: 1.5; }
.section { padding: 4.5rem 0 1rem; }

/* -------------------------------------------------------------- Hero -- */
.hero { padding: 6.5rem 0 3rem; text-align: center; }
.hero h1 { margin: 0 auto; max-width: 16ch; font-size: clamp(3rem, 9.5vw, 6.25rem); line-height: 0.85; letter-spacing: -0.05em; font-weight: 500; color: var(--ink); }
.hero h1 em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--violet); letter-spacing: 0; }
.hero-line { margin: 1.6rem auto 0; max-width: 60rem; color: var(--muted); font-size: 18px; font-weight: 500; line-height: 1.5; }
.hero-line span { white-space: nowrap; }
.hero-lead { margin: 1.1rem auto 0; max-width: 40rem; color: var(--ink-2); font-size: 16px; line-height: 1.5; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin-top: 1.8rem; }

.hero-stage { position: relative; margin: 3.2rem auto 0; border-radius: var(--r-big); background: var(--surface-soft); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06); overflow: hidden; text-align: left; }
.hero-stage-inner { display: grid; gap: 1.2rem; padding: 1.4rem; }
@media (min-width: 880px) { .hero-stage-inner { grid-template-columns: 1.3fr 0.8fr; padding: 1.6rem; align-items: stretch; } }
.hero-diagram { position: relative; border-radius: var(--r-box); background: var(--bg); padding: 0.6rem; min-height: 260px; overflow: hidden; }
.hero-diagram svg { width: 100%; height: auto; }
.hero-aside { display: flex; flex-direction: column; justify-content: space-between; gap: 1rem; padding: 0.4rem 0.3rem; }
.hero-aside h2 { margin: 0; font-size: 1.6rem; font-weight: 500; letter-spacing: -0.03em; line-height: 1.05; }
.hero-aside p { margin: 0.6rem 0 0; color: var(--muted); font-size: 15px; }
.phase-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface); }
.phase-tabs button { padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--muted); transition: all .15s; }
.phase-tabs button[aria-selected="true"] { background: var(--violet); color: #fff; }
.force-legend { display: grid; gap: 0.45rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.force-legend li { display: flex; gap: 0.6rem; align-items: baseline; color: var(--muted-2); font-family: var(--ui); font-size: 13px; }
.force-legend i { flex: none; width: 9px; height: 9px; border-radius: 50%; transform: translateY(0); }
.hero-foot { margin: 0; color: var(--faint); font-family: var(--ui); font-size: 12px; letter-spacing: 0.02em; }

/* ---------------------------------------------------------- Filters --- */
.filter-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; margin: -0.6rem 0 1.6rem; }
.filter-row button { padding: 9px 14px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 14px; font-weight: 500; transition: all .15s; }
.filter-row button:hover { color: var(--ink); }
.filter-row button[aria-pressed="true"] { background: var(--violet); color: #fff; }
.filter-row .count { margin-left: 0.3rem; opacity: .7; }

/* ------------------------------------------------------------ Packs --- */
.pack-grid { display: grid; gap: 0.9rem; }
@media (min-width: 680px) { .pack-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .pack-grid { grid-template-columns: repeat(3, 1fr); } }
.pack-link { position: relative; display: grid; grid-template-rows: auto auto 1fr auto; gap: 0.85rem; min-height: 100%; padding: 1.2rem 1.25rem 1.1rem; border-radius: var(--r-card); background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); transition: background .2s, transform .25s var(--ease), box-shadow .2s; overflow: hidden; }
.pack-link:hover { background: var(--surface); transform: translateY(-3px); box-shadow: inset 0 0 0 1px var(--line-2); }
.pack-link[hidden] { display: none; }
.pack-link.featured { grid-column: 1 / -1; }
@media (min-width: 860px) { .pack-link.featured { grid-template-columns: 1fr 1.1fr; grid-template-rows: auto auto auto; align-items: center; column-gap: 1.6rem; } .pack-link.featured .pack-art { grid-row: 1 / span 3; grid-column: 2; height: 100%; min-height: 180px; } }
.pack-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.chip { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; background: var(--surface); color: var(--ink-2); font-family: var(--ui); font-size: 12px; font-weight: 500; white-space: nowrap; }
.chip.new { background: var(--violet-soft); color: #d9ccff; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.pack-code { color: var(--faint); font-family: var(--ui); font-size: 12px; font-weight: 500; letter-spacing: 0.02em; }
.pack-art { height: 96px; border-radius: 16px; background: var(--bg); overflow: hidden; }
.pack-art svg { width: 100%; height: 100%; }
.pack-link h3 { margin: 0; font-size: 1.35rem; font-weight: 500; letter-spacing: -0.03em; line-height: 1.15; }
.pack-link p { margin: 0.45rem 0 0; color: var(--muted); font-size: 15px; }
.pack-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding-top: 0.7rem; border-top: 1px solid var(--line); color: var(--faint); font-family: var(--ui); font-size: 13px; }
.pack-foot strong { color: var(--ink); font-weight: 500; }
.arrow { color: var(--violet-3); font-weight: 500; }
.pack-feat { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; color: var(--faint); font-family: var(--ui); font-size: 12px; }
.pack-feat span::before { content: "·"; margin-right: 0.4rem; color: var(--violet-3); }

/* ------------------------------------------------------------ Bench --- */
.bench { display: grid; gap: 1.2rem; padding: 1.5rem; border-radius: var(--r-big); background: var(--surface-soft); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06); }
@media (min-width: 900px) { .bench { grid-template-columns: 260px minmax(0,1fr); padding: 1.8rem; } }
.bench-controls { display: grid; gap: 0.9rem; align-content: start; }
.bench-stage { display: grid; gap: 0.9rem; min-width: 0; }
.bench-canvases { display: grid; gap: 0.9rem; }
@media (min-width: 1100px) { .bench-canvases { grid-template-columns: 1.15fr 1fr; } }
.bench h3 { margin: 0; font-size: 1.4rem; font-weight: 500; letter-spacing: -0.03em; }
.bench .lede { margin: 0.35rem 0 0.3rem; color: var(--muted); font-size: 15px; }
.go-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.verdict { padding: 0.85rem 1rem; border-radius: 16px; background: var(--bg); color: var(--muted-2); font-family: var(--ui); font-size: 13.5px; line-height: 1.5; }
.verdict b { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------- Steps / how -- */
.steps { display: grid; gap: 0.8rem; }
@media (min-width: 800px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.step { padding: 1.3rem 1.25rem; border-radius: var(--r-card); background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); }
.step-num { display: block; margin-bottom: 0.7rem; color: var(--violet); font-family: var(--serif); font-style: italic; font-size: 2rem; line-height: 1; }
.step h3 { margin: 0; font-size: 1.15rem; font-weight: 500; letter-spacing: -0.02em; }
.step p { margin: 0.45rem 0 0; color: var(--muted); font-size: 14.5px; }

/* ------------------------------------------------------ Teacher strip -- */
.teacher-strip { margin: 2.6rem 0 0; padding: 2rem; border-radius: var(--r-big); background: var(--surface-soft); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06); display: grid; gap: 1.4rem; }
@media (min-width: 820px) { .teacher-strip { grid-template-columns: 1.25fr 1fr; align-items: center; padding: 2.4rem; } }
.teacher-strip h2 { margin: 0; font-size: 2.2rem; font-weight: 500; letter-spacing: -0.04em; line-height: 1; }
.teacher-strip h2 em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--violet); letter-spacing: 0; }
.teacher-strip p { margin: 0.7rem 0 0; color: var(--muted); font-size: 16px; }
.checklist { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.55rem; }
.checklist li { display: flex; gap: 0.65rem; align-items: start; color: var(--muted-2); font-family: var(--ui); font-size: 14px; }
.checklist li::before { content: ""; width: 7px; height: 7px; margin-top: 0.45rem; border-radius: 50%; background: var(--green); flex: none; }

/* ---------------------------------------------------------- Partners -- */
.partner-row { display: grid; gap: 0.9rem; }
@media (min-width: 720px) { .partner-row { grid-template-columns: 1fr 1fr; } }
.partner { padding: 1.3rem 1.35rem; border-radius: var(--r-card); background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: start; }
.partner-mark { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: 0.02em; color: #fff; background: var(--surface-2); }
.partner h3 { margin: 0; font-size: 1.05rem; font-weight: 500; }
.partner p { margin: 0.35rem 0 0; color: var(--muted); font-size: 14.5px; }
.quote { padding: 2rem 2.2rem; border-radius: var(--r-box); background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); text-align: center; }
.quote p { margin: 0 auto; font-family: var(--serif); font-style: italic; font-size: clamp(1.5rem, 3vw, 2.2rem); line-height: 1.2; color: var(--ink); max-width: 28ch; }
.quote small { display: block; margin-top: 0.9rem; color: var(--faint); font-family: var(--ui); font-size: 12px; }

/* ------------------------------------------------------------ Footer -- */
.site-foot { margin-top: 5rem; padding: 2rem 0 2.6rem; border-top: 1px solid var(--line); color: var(--faint); font-family: var(--ui); font-size: 13px; }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; justify-content: space-between; align-items: center; }
.site-foot a:hover { color: var(--ink); }

/* ---------------------------------------------------------- Pack page -- */
.pack-top { padding: 4rem 0 1.6rem; text-align: center; display: grid; justify-items: center; gap: 1rem; }
.crumb { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; align-items: center; color: var(--faint); font-family: var(--ui); font-size: 13px; }
.crumb a:hover { color: var(--ink); }
.pack-top h1 { margin: 0.2rem auto 0; max-width: 18ch; font-size: clamp(2.4rem, 6.5vw, 4.4rem); font-weight: 500; letter-spacing: -0.05em; line-height: 0.95; }
.pack-top h1 em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--violet); letter-spacing: 0; }
.pack-top .lead { margin: 0.4rem auto 0; max-width: 46rem; color: var(--muted); font-size: 17px; font-weight: 500; }
.pack-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin-top: 0.6rem; }

.pack-layout { display: grid; gap: 1rem; padding-bottom: 3rem; margin-top: 1.6rem; }
@media (min-width: 980px) { .pack-layout { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; } }

.panel { padding: 1.5rem 1.6rem; border-radius: var(--r-box); background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); }
.panel + .panel { margin-top: 1rem; }
.panel > h2 { margin: 0 0 0.9rem; font-size: 1.5rem; font-weight: 500; letter-spacing: -0.03em; display: flex; align-items: center; gap: 0.7rem; line-height: 1.1; }
.panel > h2 .num { color: var(--violet); font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 1.5rem; }
.panel h3 { margin: 1.2rem 0 0.5rem; font-size: 1.05rem; font-weight: 500; }
.panel p, .panel li { color: var(--muted-2); font-size: 15px; line-height: 1.55; }
.panel p { margin: 0 0 0.8rem; }
.panel ul, .panel ol { margin: 0 0 0.8rem; padding-left: 1.15rem; }
.panel li + li { margin-top: 0.35rem; }
.panel strong { color: var(--ink); font-weight: 500; }
.panel-sim { background: var(--surface-soft); box-shadow: inset 0 0 0 1px rgba(101,12,245,0.35); }

.objectives { display: grid; gap: 0.5rem; }
.objective { display: grid; grid-template-columns: auto 1fr; gap: 0.8rem; padding: 0.8rem 0.95rem; border-radius: 16px; background: var(--surface); }
.objective span { color: var(--violet); font-family: var(--serif); font-style: italic; font-size: 1.25rem; line-height: 1.1; }
.objective p { margin: 0; }

.diagram-frame { position: relative; margin: 0.5rem 0 0.6rem; padding: 0.8rem; border-radius: 20px; background: var(--d-bg); background-image: radial-gradient(var(--d-grid) 1px, transparent 1px); background-size: 18px 18px; box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.diagram-frame svg { width: 100%; height: auto; }
.diagram-caption { margin: 0 0 1rem; color: var(--faint); font-family: var(--ui); font-size: 12.5px; line-height: 1.5; }
.diagram-caption b { color: var(--muted); font-weight: 600; }

/* SVG diagram classes — theme-aware */
.dia { font-family: var(--ui); }
.dia .ink { fill: var(--d-ink); }
.dia .muted { fill: var(--d-muted); }
.dia .faint { fill: var(--d-faint); }
.dia .serif { font-family: var(--serif); font-style: italic; }
.dia .mono { font-family: var(--font); font-weight: 500; }
.dia .line { stroke: var(--d-line); fill: none; }
.dia .thin { stroke: var(--d-line); stroke-width: 1; fill: none; }
.dia .box { fill: rgba(255,255,255,0.025); stroke: rgba(255,255,255,0.10); }
.dia .track { stroke: rgba(255,255,255,0.2); stroke-width: 2; }
.dia .t-violet { fill: var(--violet-3); } .dia .t-coral { fill: var(--coral); } .dia .t-green { fill: var(--green); } .dia .t-white { fill: #fff; }
.dia .t-cyan { fill: var(--cyan); } .dia .t-amber { fill: var(--amber); } .dia .t-emerald { fill: var(--emerald); } .dia .t-rose { fill: var(--rose); }
.dia .body { fill: var(--d-body); stroke: var(--violet-3); stroke-width: 1.4; }
.dia .wheel { fill: var(--d-wheel); stroke: #fff; stroke-width: 1.4; }
.dia .hub { fill: var(--violet-3); }
.dia .flow { fill: none; stroke-width: 1.3; stroke-dasharray: 6 8; animation: flow 1.6s linear infinite; }
.dia .flow.f1 { stroke: var(--violet-3); opacity: .8; }
.dia .flow.f2 { stroke: #fff; opacity: .35; }
.dia .flow.f3 { stroke: var(--violet-2); opacity: .5; }
@keyframes flow { to { stroke-dashoffset: -28; } }
.dia text { font-size: 12px; }
.dia .lbl { font-size: 11px; font-weight: 500; }
.dia .cap { font-size: 15px; }

/* Formula & worked */
.formula { margin: 0.7rem 0 1rem; padding: 1rem 1.1rem; border-radius: 16px; background: var(--surface); color: var(--ink); font-size: 1.05rem; font-weight: 500; letter-spacing: -0.01em; overflow-x: auto; line-height: 1.7; }
.formula small { color: var(--muted); font-family: var(--ui); font-size: 12.5px; font-weight: 400; }
.worked { border-left: 2px solid var(--violet); padding: 0.2rem 0 0.2rem 1rem; margin: 0.8rem 0 1rem; }
.worked p { margin: 0 0 0.45rem; }
.worked .step-line { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.callout { display: grid; grid-template-columns: auto 1fr; gap: 0.8rem; padding: 0.95rem 1.05rem; margin: 0.6rem 0 1rem; border-radius: 16px; background: var(--surface); }
.callout .ic { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; font-family: var(--ui); font-size: 12px; font-weight: 600; background: var(--violet); color: #fff; }
.callout.info .ic { background: var(--surface-2); color: var(--ink); }
.callout.ok .ic { background: var(--green); color: #0a0a0a; }
.callout p { margin: 0; font-size: 14.5px; }

/* Questions */
.q { margin: 0.7rem 0; padding: 1rem 1.1rem; border-radius: 16px; background: var(--surface); }
.q-label { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.45rem; color: var(--violet-3); font-family: var(--ui); font-size: 12px; font-weight: 600; }
.q-label .marks { color: var(--faint); font-weight: 500; }
.q > p { margin: 0; color: var(--ink); font-size: 15.5px; }
.answer-lines { display: grid; gap: 0.55rem; margin-top: 0.8rem; }
.answer-lines span { display: block; height: 1px; background: rgba(255,255,255,0.1); }
.answer { margin-top: 0.75rem; padding: 0.8rem 0.95rem; border-radius: 12px; background: var(--bg); box-shadow: inset 0 0 0 1px rgba(26,255,117,0.35); }
.answer summary { cursor: pointer; color: var(--green); font-family: var(--ui); font-size: 12px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 0.5rem; }
.answer summary::-webkit-details-marker { display: none; }
.answer summary::before { content: "▸"; transition: transform .15s; }
.answer[open] summary::before { transform: rotate(90deg); }
.answer p { margin: 0.5rem 0 0; font-size: 14.5px; color: var(--muted-2); }
.answer p b { color: var(--ink); }
.answer .step-line { color: var(--ink); font-weight: 500; }
body:not(.teacher) .answer { display: none; }

/* Sim UI */
.sim { display: grid; gap: 1.1rem; }
@media (min-width: 760px) { .sim { grid-template-columns: 240px minmax(0, 1fr); } }
.sim-controls { display: grid; gap: 0.9rem; align-content: start; }
.ctl { display: grid; gap: 0.35rem; }
.ctl label { display: flex; justify-content: space-between; gap: 0.5rem; color: var(--ink); font-size: 14px; font-weight: 500; }
.ctl label output, .ctl label .val { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13.5px; font-weight: 500; }
.ctl input[type="range"] { width: 100%; accent-color: var(--violet); height: 1.4rem; margin: 0; }
.ctl select, .ctl input[type="number"], .ctl input[type="text"] { width: 100%; padding: 12px 14px; border-radius: var(--r-field); border: 0; background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; }
.ctl select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2.2rem; }
.seg { display: grid; grid-auto-flow: column; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface); }
.seg button { padding: 8px 6px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--muted); transition: all .15s; }
.seg button[aria-pressed="true"] { background: var(--violet); color: #fff; }
.sim-stage { display: grid; gap: 0.9rem; min-width: 0; }
.sim-canvas { border-radius: 20px; background: var(--bg); background-image: radial-gradient(var(--d-grid) 1px, transparent 1px); background-size: 18px 18px; box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.sim-canvas canvas, .sim-canvas svg { width: 100%; height: auto; display: block; }
.readouts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
@media (min-width: 560px) { .readouts { grid-template-columns: repeat(4, 1fr); } .readouts.three { grid-template-columns: repeat(3, 1fr); } .readouts.two { grid-template-columns: repeat(2, 1fr); } }
.readout { padding: 0.85rem 1rem; border-radius: 16px; background: var(--surface); min-width: 0; }
.readout strong { display: block; font-size: 1.5rem; font-weight: 500; letter-spacing: -0.04em; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; line-height: 1.1; }
.readout strong small { font-size: 0.8rem; color: var(--muted); font-weight: 500; margin-left: 0.2rem; letter-spacing: 0; }
.readout span { display: block; margin-top: 0.3rem; color: var(--faint); font-family: var(--ui); font-size: 12px; }
.readout.hi { background: var(--violet); }
.readout.hi strong, .readout.hi strong small, .readout.hi span { color: #fff; }
.readout.hi span { opacity: .8; }
.sim-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.sim-note { margin: 0; color: var(--faint); font-family: var(--ui); font-size: 12.5px; line-height: 1.5; }
.energy-bars { display: grid; gap: 0.5rem; }
.ebar { display: grid; grid-template-columns: 120px 1fr auto; gap: 0.7rem; align-items: center; font-family: var(--ui); font-size: 13px; color: var(--muted-2); }
.ebar .bar { height: 10px; border-radius: 999px; background: var(--surface); overflow: hidden; }
.ebar .bar i { display: block; height: 100%; border-radius: 999px; background: var(--c, var(--violet)); transition: width .3s var(--ease); }
.ebar .v { color: var(--ink); font-weight: 500; min-width: 4.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; }
.data-table th { color: var(--faint); font-family: var(--ui); font-weight: 500; font-size: 12px; }
.data-table td { color: var(--muted-2); font-variant-numeric: tabular-nums; }
.data-table input { width: 5.6rem; padding: 0.4rem 0.55rem; border-radius: 10px; border: 0; background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; }
.data-table tr.outlier td { color: var(--coral); }
.three-line { display: grid; gap: 0.4rem; padding: 1rem 1.1rem; border-radius: 16px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }
.three-line .l { display: grid; grid-template-columns: 6.2rem 1fr; gap: 0.6rem; }
.three-line .k { color: var(--faint); font-family: var(--ui); font-size: 12px; font-weight: 500; align-self: center; }
.three-line .ok { color: var(--green); } .three-line .bad { color: var(--coral); }
.pill-warn, .pill-ok { display: inline-flex; gap: 0.4rem; align-items: center; padding: 6px 10px; border-radius: 999px; font-family: var(--ui); font-size: 12px; font-weight: 500; }
.pill-warn { background: rgba(255,92,122,0.14); color: #ffb3c1; }
.pill-ok { background: rgba(26,255,117,0.12); color: #a8ffcc; }

/* Sidebar */
.side-sticky { position: sticky; top: 5.4rem; display: grid; gap: 0.8rem; }
.side-card { padding: 1.15rem 1.2rem; border-radius: var(--r-card); background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); }
.side-card h2 { margin: 0 0 0.7rem; font-size: 1rem; font-weight: 500; display: flex; align-items: center; justify-content: space-between; letter-spacing: -0.01em; }
.side-card p, .side-card li { margin: 0; color: var(--muted); font-size: 14px; }
.side-card ul { margin: 0; padding-left: 1rem; display: grid; gap: 0.35rem; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 0.9rem; font-size: 14px; margin: 0; }
.facts dt { color: var(--faint); font-family: var(--ui); font-size: 12.5px; padding-top: 2px; }
.facts dd { margin: 0; color: var(--ink); }
.plan { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.35rem; }
.plan li { display: grid; grid-template-columns: 3.4rem 1fr; gap: 0.6rem; align-items: baseline; font-size: 13.5px; color: var(--muted); }
.plan li b { color: var(--violet-3); font-weight: 500; font-size: 13px; font-variant-numeric: tabular-nums; }
.sponsor-note { margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }
.sponsor-note strong { color: var(--ink); font-weight: 500; }
.tag-row { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.85rem; }
.mini-tag { padding: 5px 9px; border-radius: 999px; background: var(--surface); color: var(--muted); font-family: var(--ui); font-size: 11.5px; }
.qr-box { display: grid; place-items: center; margin: 0.6rem 0; padding: 0.6rem; border-radius: 16px; background: #fff; min-height: 128px; }
.qr-box img, .qr-box canvas { width: 116px !important; height: 116px !important; }
.link-field { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.link-field input { flex: 1; min-width: 0; padding: 0.55rem 0.7rem; border-radius: 10px; border: 0; background: var(--surface); color: var(--muted); font-family: var(--ui); font-size: 12px; }
.teacher-toggle { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.8rem 0.95rem; border-radius: 14px; background: var(--surface); }
.teacher-toggle span { font-size: 14px; color: var(--ink); font-weight: 500; }
.switch { position: relative; width: 42px; height: 24px; border-radius: 999px; background: #2a2a2a; transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.switch[aria-checked="true"] { background: var(--violet); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; margin-top: 1.2rem; }
.pager a { padding: 1rem 1.1rem; border-radius: 20px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); font-family: var(--ui); font-size: 12.5px; color: var(--faint); transition: background .15s; }
.pager a:hover { background: var(--surface); }
.pager a b { display: block; color: var(--ink); font-family: var(--font); font-size: 15px; font-weight: 500; margin-top: 0.2rem; letter-spacing: -0.01em; }
.pager a.next { text-align: right; }

/* ------------------------------------------------------------- Paper -- */
.paper-sheet { margin-top: 1rem; padding: 1.5rem 1.4rem; border-radius: 20px; background: var(--paper); color: var(--paper-ink); font-size: 14px; }
.paper-sheet + .paper-sheet { margin-top: 1.2rem; }
.paper-sheet h2, .paper-sheet h3, .paper-sheet strong { color: var(--paper-ink); }
.paper-sheet p, .paper-sheet li { color: var(--paper-muted); }
.paper-sheet p { margin: 0 0 0.5rem; }
.paper-head { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: 0.9rem; margin-bottom: 1rem; border-bottom: 1.5px solid var(--paper-ink); }
.paper-brand { font-weight: 700; letter-spacing: -0.02em; font-size: 15px; }
.paper-brand em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--paper-accent); }
.paper-meta { text-align: right; font-family: var(--ui); font-size: 11.5px; color: var(--paper-muted); line-height: 1.5; flex: none; }
.paper-title { margin: 0.2rem 0 0.4rem; font-size: 1.4rem; font-weight: 500; letter-spacing: -0.03em; }
.paper-sub { margin: 0; font-size: 13px; }
.paper-grid { display: grid; gap: 0.7rem; }
@media (min-width: 700px) { .paper-grid.two { grid-template-columns: 1fr 1fr; } .paper-grid.three { grid-template-columns: 1fr 1fr 1fr; } }
.paper-box { padding: 0.8rem 0.9rem; border: 1px solid var(--paper-line); border-radius: 12px; background: var(--paper-2); }
.paper-box h3 { margin: 0 0 0.45rem; font-family: var(--ui); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--paper-accent); font-weight: 600; }
.paper-box p { margin: 0; font-size: 13.5px; }
.paper-box p + p { margin-top: 0.35rem; }
.paper-box .f { font-weight: 500; font-size: 14px; color: var(--paper-ink); }
.paper-q { margin-top: 0.85rem; padding-top: 0.8rem; border-top: 1px dashed var(--paper-line); }
.paper-q strong { display: inline-block; margin-right: 0.35rem; font-size: 14px; font-weight: 700; }
.paper-q .marks { float: right; font-family: var(--ui); font-size: 11.5px; color: var(--paper-muted); }
.paper-q .qt { font-size: 14px; color: var(--paper-muted); }
.write-line { margin-top: 0.6rem; border-bottom: 1px solid #cfc7ba; height: 1.15rem; }
.write-box { margin-top: 0.6rem; border: 1px dashed #cfc7ba; border-radius: 10px; background: #fff; min-height: 110px; }
.paper-diagram { padding: 0.7rem; border: 1px solid var(--paper-line); border-radius: 12px; background: #fff; margin-top: 0.8rem; }
.paper-diagram .dia { --d-ink: #141414; --d-muted: #555; --d-faint: #8a8a8a; --d-line: rgba(20,20,20,0.35); --d-body: #efe9fb; --d-body-2: #ddd1f8; --d-wheel: #fff; --violet-3: #650cf5; --violet-2: #650cf5; --violet-bright: #650cf5; --coral: #c8102e; --rose: #c8102e; --green: #0a8a3a; --emerald: #0a8a3a; --cyan: #141414; --amber: #650cf5; }
.paper-diagram .dia .wheel { stroke: #141414; }
.paper-diagram .dia .box { fill: #faf8f4; stroke: #ddd6cb; }
.paper-diagram .dia .track { stroke: #cfc7ba; }
.paper-diagram .dia .flow { animation: none; stroke-dasharray: 4 5; }
.paper-diagram .dia .t-white { fill: #141414; }
.paper-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; font-size: 13px; }
.paper-table th, .paper-table td { border: 1px solid var(--paper-line); padding: 0.45rem 0.55rem; text-align: left; }
.paper-table th { background: #f1ede6; font-family: var(--ui); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--paper-muted); font-weight: 600; }
.paper-table td { height: 1.8rem; background: #fff; }
.paper-vocab { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.paper-vocab span { padding: 0.2rem 0.55rem; border: 1px solid var(--paper-line); border-radius: 999px; font-family: var(--ui); font-size: 11.5px; background: #fff; }
.paper-foot { margin-top: 1.1rem; padding-top: 0.6rem; border-top: 1px solid var(--paper-line); display: flex; justify-content: space-between; gap: 1rem; font-family: var(--ui); font-size: 11px; color: var(--paper-muted); }
.key-sheet { background: #f2f9f5; }
.key-sheet .paper-head { border-color: #0a8a3a; }
.key-sheet .paper-brand em { color: #0a8a3a; }
.key-sheet .k { margin-top: 0.75rem; padding-top: 0.65rem; border-top: 1px dashed #bfe3d3; font-size: 13.5px; color: var(--paper-muted); }
.key-sheet .k b { color: var(--paper-ink); }
.key-sheet .k .step-line { display: block; font-weight: 500; font-size: 13.5px; color: #0a6b2f; font-variant-numeric: tabular-nums; }
body:not(.teacher) .key-sheet { display: none; }

/* -------------------------------------------------------------- Toast -- */
.toast { position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%) translateY(120%); padding: 0.75rem 1.1rem; border-radius: 999px; background: var(--surface); box-shadow: rgba(255,255,255,0.2) 0 0 0 1px, 0 10px 30px rgba(0,0,0,0.5); color: var(--ink); font-size: 14px; font-weight: 500; opacity: 0; transition: transform .25s var(--ease), opacity .25s; z-index: 60; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ---------------------------------------------------------- Teachers --- */
.map-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.map-table th, .map-table td { padding: 0.8rem 0.85rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.map-table th { color: var(--faint); font-family: var(--ui); font-weight: 500; font-size: 12px; }
.map-table td { color: var(--muted-2); }
.map-table td:first-child { color: var(--ink); font-weight: 500; white-space: nowrap; }
.map-table .code { display: block; color: var(--faint); font-family: var(--ui); font-size: 11.5px; font-weight: 500; margin-top: 0.15rem; }
.table-scroll { overflow-x: auto; border-radius: var(--r-card); background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); }
.table-scroll table { min-width: 760px; }
.faq { display: grid; gap: 0.6rem; max-width: 820px; margin: 0 auto; }
.faq details { padding: 1rem 1.2rem; border-radius: 18px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); }
.faq summary { cursor: pointer; font-weight: 500; font-size: 16px; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--violet-3); font-weight: 400; }
.faq details[open] summary::after { content: "−"; }
.faq p { margin: 0.6rem 0 0; color: var(--muted); font-size: 15px; }
.big-toggle { display: flex; align-items: center; gap: 1.2rem; padding: 1.3rem 1.5rem; border-radius: var(--r-card); background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); max-width: 820px; margin: 0 auto; }
.big-toggle h3 { margin: 0; font-size: 1.1rem; font-weight: 500; }
.big-toggle p { margin: 0.25rem 0 0; color: var(--muted); font-size: 14.5px; }
.big-toggle .switch { width: 54px; height: 30px; }
.big-toggle .switch::after { width: 24px; height: 24px; }
.big-toggle .switch[aria-checked="true"]::after { transform: translateX(24px); }

/* ---------------------------------------------------------- Motion ---- */
.rise { animation: rise .7s var(--ease) both; }
.rise-2 { animation: rise .7s var(--ease) .08s both; }
.rise-3 { animation: rise .7s var(--ease) .16s both; }
.rise-4 { animation: rise .8s var(--ease) .24s both; }
.pack-grid .pack-link { animation: rise .55s var(--ease) both; }
.pack-grid .pack-link:nth-child(2) { animation-delay: .05s; } .pack-grid .pack-link:nth-child(3) { animation-delay: .1s; } .pack-grid .pack-link:nth-child(4) { animation-delay: .15s; } .pack-grid .pack-link:nth-child(5) { animation-delay: .2s; } .pack-grid .pack-link:nth-child(6) { animation-delay: .25s; } .pack-grid .pack-link:nth-child(7) { animation-delay: .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .rise, .rise-2, .rise-3, .rise-4, .pack-grid .pack-link { animation: none; } .dia .flow { animation: none; } html { scroll-behavior: auto; } }

/* ----------------------------------------------------------- Print ---- */
@page { margin: 13mm 14mm; }
@media print {
  body { background: #fff !important; color: #000; font-size: 11pt; }
  .nav, .nav-sheet, .pack-actions, .side-sticky, .site-foot, .hero-actions, .toast, .no-print, .pack-top, .pager, .panel:not(.print-keep) { display: none !important; }
  .pack-layout { display: block; padding: 0; width: 100%; margin: 0; }
  .panel.print-keep { box-shadow: none; background: none; padding: 0; margin: 0; }
  .paper-sheet { border-radius: 0; padding: 0; margin: 0; background: #fff; color: #000; font-size: 10.5pt; page-break-after: always; }
  .paper-sheet:last-child { page-break-after: auto; }
  .paper-box, .paper-diagram, .write-box, .paper-table td { background: #fff; }
  .paper-q, .paper-box, .paper-diagram { page-break-inside: avoid; }
  .key-sheet { background: #fff; page-break-before: always; }
  a { text-decoration: none; color: inherit; }
}
