/* ==========================================================================
   Agentic Systems for Enterprise Engineering — design system
   Palette and card language adapted from the Harvard CS2680 slide deck:
   navy titles, crimson accent bars, white cards, dark call-out banners.
   ========================================================================== */

/* Tokens below are scoped to .course-app (this program's own root wrapper),
   never to :root/html, because several names (--accent, --radius,
   --radius-sm, --shadow-sm, color-scheme) collide with the sitewide tokens
   defined in web/src/styles/global.css. Writing them to :root would silently
   override those for the whole document, including Base.astro's own header
   and footer, for as long as this page is open. Scoping avoids that while
   still letting every value below resolve from the site's semantic tokens,
   which already flip with html[data-theme]. */
.course-app {
  /* Fixed brand accents — intentionally constant across light/dark, same as
     this course's original navy/crimson/sky/etc (none of those were
     redefined in the original dark block either). */
  --navy: #16258f;      /* was a fixed navy; now the site's brand-700 step */
  --navy-2: #1e32c4;    /* brand-600 */
  --crimson: var(--accent-solid);        /* CTA/highlight fills */
  --crimson-2: var(--color-brand-400);   /* hover state for the above */
  --sky: var(--color-brand-400);         /* focus rings, info accents */
  --teal: var(--color-brand-500);        /* secondary decorative accent; also used as text, so kept dark enough to read */
  --blue: var(--color-brand-600);        /* secondary decorative accent; also used as text */
  --amber: var(--warn);                  /* warnings / optional / capstone */
  --green: var(--up);                    /* success / correct / ready */

  /* Structural tokens — aliases of the site's own semantic vars, so they
     automatically track html[data-theme] without a separate dark block. */
  --bg: var(--surface);
  --surface: var(--surface-card);
  --surface-2: var(--surface-raised);
  --ink: var(--text-primary);
  --title: var(--text-primary);
  /* --accent and --shadow-sm are DELIBERATELY NOT redeclared here: the site
     already defines both on :root (global.css), and .course-app is a
     descendant of :root, so they inherit straight through with the correct
     value and automatic light/dark tracking. Writing "--accent: var(--accent)"
     here looks like an alias but is actually a same-name self-reference: the
     browser treats it as a cycle (the value this element's --accent depends
     on is itself), making --accent compute to the guaranteed-invalid value
     everywhere it's used inside .course-app - confirmed empirically (resolved
     to black instead of the intended blue). Simply omitting the line is both
     correct and simpler than aliasing through an intermediate property name. */
  --muted: var(--text-muted);
  --line: var(--border);
  --ok-bg: var(--up-tint);
  --bad-bg: var(--down-tint);
  --shadow: var(--shadow-md);

  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 328px;
  --topbar-h: 56px;
  --content-w: 900px;

  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.62;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
/* :where(.course-app) keeps these at the ORIGINAL low specificity (same as
   plain h1{}/a{}/button{} would have) while still only matching inside this
   program's own container — :where() contributes zero specificity of its
   own. Without it, e.g. ".course-app a" (0,1,1) would outrank single-class
   component rules like ".btn--light" (0,1,0) and break their text color,
   which is exactly what happened before this fix. */
:where(.course-app) h1, :where(.course-app) h2, :where(.course-app) h3, :where(.course-app) h4 { color: var(--title); line-height: 1.2; margin: 0; letter-spacing: -.01em; }
:where(.course-app) p { margin: 0 0 1em; }
:where(.course-app) a { color: var(--accent); }
:where(.course-app) code, :where(.course-app) pre { font-family: "Cascadia Code", "SF Mono", Consolas, Menlo, monospace; }
:where(.course-app) code { background: var(--surface-2); padding: .1em .38em; border-radius: 6px; font-size: .9em; overflow-wrap: anywhere; }
.dx__body code, .cc__body code { background: none; padding: 0; overflow-wrap: normal; }
:where(.course-app) button { font: inherit; color: inherit; }
:where(.course-app) :focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---------- Reading progress ---------- */
.readbar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; pointer-events: none; }
.readbar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--sky), var(--crimson-2)); transition: width .1s linear; }

/* ---------- Secondary toolbar ----------
   This is deliberately NOT a second full header bar: Base.astro already
   renders the sitewide header (logo, nav, subscribe) above this. This strip
   only carries the three controls app.js/widgets.js reach for by id
   (#menuBtn, #progressPill, #themeBtn) plus the SVGs they toggle
   (.i-moon/.i-sun) — restyled with this program's own tokens, in normal
   document flow rather than fixed, so it never overlaps Base's own header. */
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: var(--surface); color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.spacer { flex: 1; }
.iconbtn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid var(--line); color: var(--ink); cursor: pointer;
  transition: background .15s;
}
.iconbtn:hover { background: var(--surface-2); }
.menu-btn { display: none; }
.i-sun { display: none; }
[data-theme="dark"] .i-sun { display: block; }
[data-theme="dark"] .i-moon { display: none; }
.progress-pill { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; background: var(--surface-2); padding: 6px 12px; border-radius: 999px; color: var(--ink); }
.progress-pill__bar { width: 84px; height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress-pill__bar i { display: block; height: 100%; width: 0; background: var(--amber); border-radius: 99px; transition: width .4s; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line);
  overscroll-behavior: contain;
}
.sidebar__head { position: sticky; top: 0; z-index: 2; background: var(--surface); padding: 14px 14px 10px; border-bottom: 1px solid var(--line); }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 0; font: inherit; color: var(--ink); outline: none; }
.search:focus-within { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(109, 130, 255, .25); }
.main { padding: 32px clamp(16px, 4vw, 48px) 120px; min-width: 0; outline: none; }
.page { max-width: var(--content-w); margin: 0 auto; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.scrim { display: none; }

/* ---------- Curriculum tree ---------- */
.tree { padding: 10px 10px 40px; }
/* Course heading above each group of tracks in the sidebar. */
.tree__group {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center;
  margin: 14px 0 6px; padding: 8px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; border: 1px solid var(--line);
}
.tree__group:hover { color: var(--text); border-color: var(--accent); }
.tree__group.is-current { color: var(--text); border-color: var(--accent); background: var(--accent-soft, transparent); }
.tree__groupnum {
  display: inline-grid; place-items: center; width: 26px; height: 22px; border-radius: 7px;
  background: var(--line); color: var(--text); font-size: 11px; letter-spacing: 0;
}
.tree__track { border-radius: 12px; margin-bottom: 4px; }
.tree__trackbtn {
  width: 100%; display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; text-align: left;
  padding: 10px 10px; border: 0; background: transparent; border-radius: 12px; cursor: pointer;
}
.tree__trackbtn:hover { background: var(--surface-2); }
.tree__track.is-open > .tree__trackbtn { background: var(--surface-2); }
.tree__num { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--navy); color: #fff; font-weight: 700; font-size: 14px; }
.tree__track.is-active .tree__num { background: var(--crimson); }
.tree__ttl { font-weight: 650; font-size: 14px; color: var(--title); line-height: 1.25; }
.tree__sub { display: block; font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.tree__chev { transition: transform .2s; color: var(--muted); }
.tree__track.is-open .tree__chev { transform: rotate(90deg); }
.tree__mods { list-style: none; margin: 2px 0 8px 22px; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: none; }
.tree__track.is-open .tree__mods { display: block; }
.tree__mod {
  display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: start; padding: 7px 8px; border-radius: 8px;
  text-decoration: none; color: var(--ink); font-size: 13.5px; line-height: 1.35;
}
a.tree__mod:hover { background: var(--surface-2); }
.tree__mod.is-current { background: color-mix(in srgb, var(--crimson) 12%, transparent); font-weight: 650; color: var(--title); }
.tree__mod.is-soon { color: var(--muted); cursor: default; }
.tree__min { font-size: 11.5px; color: var(--muted); white-space: nowrap; margin-top: 1px; }
.tick { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; margin-top: 1px; }
.tick.is-done { background: var(--green); border-color: var(--green); }
.tick.is-done::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.tick.is-soon { border-style: dashed; opacity: .6; }
.tree__empty { color: var(--muted); font-size: 14px; padding: 14px; }

/* ---------- Generic UI ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.badge--foundation { background: color-mix(in srgb, var(--teal) 18%, transparent); color: var(--teal); }
.badge--practitioner { background: color-mix(in srgb, var(--blue) 20%, transparent); color: var(--blue); }
.badge--advanced { background: color-mix(in srgb, var(--crimson) 16%, transparent); color: var(--accent); }
.badge--capstone { background: color-mix(in srgb, var(--amber) 28%, transparent); color: #8A6400; }
[data-theme="dark"] .badge--capstone { color: var(--amber); }
.badge--optional { background: color-mix(in srgb, var(--amber) 26%, transparent); color: #8A6400; }
[data-theme="dark"] .badge--optional { color: var(--amber); }
.badge--ready { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.badge--soon { background: var(--surface-2); color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 12px;
  border: 1px solid transparent; font-weight: 650; cursor: pointer; text-decoration: none; font-size: 15px; transition: transform .1s, box-shadow .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--crimson); color: #fff; box-shadow: 0 6px 16px rgba(166, 25, 46, .3); }
.btn--primary:hover { background: var(--crimson-2); }
.btn--ghost { background: var(--surface); color: var(--title); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--light { background: #fff; color: var(--navy); }
.btn--outline-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .5); }
.btn--outline-light:hover { background: rgba(255, 255, 255, .12); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px;
  box-shadow: var(--shadow-sm); position: relative;
}
.card--bar { padding-left: 26px; }
.card--bar::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 5px; border-radius: 0 6px 6px 0; background: var(--crimson); }
.card h3 { font-size: 17px; margin-bottom: 6px; }
.card p:last-child { margin-bottom: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 700; color: var(--accent); }

/* ---------- Home ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; color: #fff; padding: clamp(28px, 5vw, 56px);
  background: radial-gradient(1200px 400px at 90% -10%, rgba(109, 130, 255, .35), transparent 60%),
              linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 55%, var(--crimson) 120%);
  box-shadow: var(--shadow);
}
.hero::after { content: ""; position: absolute; inset: auto -60px -80px auto; width: 320px; height: 320px; border-radius: 50%; border: 44px solid rgba(255, 255, 255, .06); }
.hero .eyebrow { color: var(--amber); }
.hero h1 { color: #fff; font-size: clamp(30px, 5vw, 50px); margin: 10px 0 14px; max-width: 18ch; }
.hero p { font-size: clamp(16px, 2vw, 19px); max-width: 60ch; opacity: .92; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 22px 0 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; text-align: left; }
.stat b { display: block; font-size: 28px; color: var(--title); line-height: 1.1; }
.stat span { font-size: 13px; color: var(--muted); }
.section-title { margin: 40px 0 6px; font-size: clamp(22px, 3vw, 28px); }
.section-title--sub { margin: 26px 0 10px; font-size: clamp(15px, 2vw, 17px); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
/* Cheat sheets quote long setting keys and glob patterns, which have no break
   opportunity of their own and would otherwise widen the card past the page. */
.cheat-list, .cheat-list li { min-width: 0; overflow-wrap: anywhere; }
/* The two course cards on the home page sit above the track grid. */
.coursecard h3 { font-size: clamp(18px, 2.4vw, 22px); }
.section-sub { color: var(--muted); margin-bottom: 18px; max-width: 70ch; }
.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--auto { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.trackcard { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .2s; }
.trackcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.trackcard__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.trackcard__num { width: 40px; height: 40px; border-radius: 12px; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 800; }
.trackcard h3 { font-size: 17px; }
.trackcard p { color: var(--muted); font-size: 14.5px; margin: 0; flex: 1; }
.trackcard__meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--sky)); border-radius: 99px; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.checklist li { display: grid; grid-template-columns: 24px 1fr; gap: 10px; }
.checklist li::before { content: "✓"; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: color-mix(in srgb, var(--green) 20%, transparent); color: var(--green); font-weight: 800; font-size: 13px; margin-top: 2px; }
.how { counter-reset: how; }
.how .card::after { counter-increment: how; content: counter(how); position: absolute; right: 16px; top: 12px; font-size: 40px; font-weight: 800; color: color-mix(in srgb, var(--crimson) 14%, transparent); }
.footer { margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }

/* ---------- Track / module pages ---------- */
.crumbs { font-size: 13.5px; color: var(--muted); margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: clamp(28px, 4.2vw, 40px); margin: 8px 0 10px; }
.page-head__meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--muted); font-size: 14px; }
.lead { font-size: clamp(17px, 2.2vw, 20px); color: var(--title); font-weight: 500; line-height: 1.55; }
.blk { margin: 0 0 22px; }
.blk-h { font-size: clamp(21px, 2.8vw, 26px); margin: 36px 0 10px; padding-left: 14px; border-left: 5px solid var(--crimson); }
.blk-list { padding-left: 1.2em; margin: 0 0 1.1em; }
.blk-list li { margin: .4em 0; }
.blk-list.check { list-style: none; padding: 0; }
.blk-list.check li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; }
.blk-list.check li::before { content: "✓"; color: var(--green); font-weight: 800; }
.callout { display: grid; grid-template-columns: 38px 1fr; gap: 14px; border-radius: var(--radius); padding: 18px 20px; margin: 0 0 22px; border: 1px solid transparent; }
.callout p { margin: 4px 0 0; }
.callout strong { color: inherit; }
.callout__icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 17px; background: rgba(255, 255, 255, .18); }
.callout--key { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; }
.callout--key .callout__icon { background: var(--crimson); }
.callout--tip { background: color-mix(in srgb, var(--teal) 13%, var(--surface)); border-color: color-mix(in srgb, var(--teal) 40%, transparent); }
.callout--tip .callout__icon { background: var(--teal); color: #fff; }
.callout--warn { background: color-mix(in srgb, var(--amber) 22%, var(--surface)); border-color: color-mix(in srgb, var(--amber) 60%, transparent); }
.callout--warn .callout__icon { background: var(--amber); color: #3b2c00; }
.callout--insight { background: var(--surface); border-color: var(--line); border-left: 6px solid var(--crimson); }
.callout--insight .callout__icon { background: color-mix(in srgb, var(--crimson) 14%, transparent); color: var(--accent); }
.cards { display: grid; gap: 14px; margin-bottom: 22px; }
.cards--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card .tag { display: inline-block; font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.compare__col { border-radius: var(--radius); padding: 18px 20px; border: 1px solid var(--line); background: var(--surface); position: relative; overflow: hidden; }
.compare__col::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--teal); }
.compare__col--bad::before { background: var(--crimson); }
.compare__col h3 { font-size: 16px; margin-bottom: 10px; }
.compare__col ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.compare__col li { display: grid; grid-template-columns: 20px 1fr; gap: 8px; font-size: 15px; }
.compare__col li::before { content: "▲"; color: var(--teal); font-size: 11px; margin-top: 5px; }
.compare__col--bad li::before { content: "▼"; color: var(--crimson); }
.table-wrap { overflow-x: auto; max-width: 100%; margin-bottom: 22px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; min-width: 520px; }
th { background: var(--navy); color: #fff; text-align: left; padding: 12px 14px; font-weight: 650; }
td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: top; }
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
td:first-child { font-weight: 650; color: var(--title); }
.steps { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 12px; counter-reset: st; }
.steps li { counter-increment: st; display: grid; grid-template-columns: 44px 1fr; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.steps li::before { content: counter(st); display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--crimson); color: #fff; font-weight: 800; font-size: 18px; }
.steps strong { display: block; color: var(--title); margin-bottom: 2px; }
.steps p { margin: 0; color: var(--muted); }
.code { background: #0B1A2A; color: #DCE9F5; border-radius: var(--radius-sm); padding: 16px 18px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; margin: 0 0 22px; border: 1px solid #1d3a56; }
.code .c-sys { color: #7FD1FF; } .code .c-usr { color: #FFD479; } .code .c-ast { color: #9BE3A5; } .code .c-tool { color: #FF8FA3; } .code .c-cmt { color: #8AA4BE; }
.flow { margin: 0 0 22px; display: grid; gap: 14px; }
.flow__row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.flow__label { font-size: 12.5px; font-weight: 800; letter-spacing: .01em; color: var(--muted); margin-bottom: 10px; }
.flow__chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fchip { padding: 8px 14px; border-radius: 10px; font-size: 14px; font-weight: 650; background: var(--crimson); color: #fff; }
.fchip--navy { background: var(--navy); }
.fchip--tool { background: var(--teal); }
.fchip--dim { background: var(--surface-2); color: var(--muted); }
.farrow { color: var(--muted); font-weight: 800; }
.takeaways { background: linear-gradient(135deg, color-mix(in srgb, var(--navy) 94%, #000), var(--navy-2)); color: #fff; border-radius: var(--radius); padding: 22px 24px; margin: 30px 0 22px; }
.takeaways h3 { color: #fff; font-size: 18px; margin-bottom: 10px; }
.takeaways ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.takeaways li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; }
.takeaways li::before { content: "◆"; color: var(--amber); }
.takeaways code, .callout--key code { background: rgba(255, 255, 255, .18); color: #fff; }
.credits { font-size: 13px; color: var(--muted); margin: 26px 0 0; padding-top: 14px; border-top: 1px dashed var(--line); }
.pager { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.modlist { display: grid; gap: 10px; margin-bottom: 20px; }
.modrow { display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; text-decoration: none; color: inherit; transition: transform .12s, box-shadow .15s; }
a.modrow:hover { transform: translateX(3px); box-shadow: var(--shadow-sm); border-color: color-mix(in srgb, var(--crimson) 40%, var(--line)); }
.modrow.is-soon { opacity: .72; }
.modrow__num { font-weight: 800; color: var(--accent); font-size: 14px; }
.modrow__num--intro { color: var(--amber); font-size: 16px; }
.modrow strong { color: var(--title); display: block; }
.modrow small { color: var(--muted); }

/* ---------- Quiz ---------- */
.quiz { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin: 28px 0; box-shadow: var(--shadow-sm); }
.quiz__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; }
.quiz__head strong { font-size: 17px; color: var(--title); }
.quiz__score { background: var(--surface-2); padding: 4px 12px; border-radius: 99px; font-weight: 700; font-size: 13px; }
.quiz__q { padding: 14px 0; border-top: 1px solid var(--line); }
.quiz__q:first-of-type { border-top: 0; }
.quiz__q h4 { font-size: 16px; margin-bottom: 10px; font-weight: 650; }
.opts { display: grid; gap: 8px; }
.opt { text-align: left; padding: 11px 14px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color .12s, background .12s; display: grid; grid-template-columns: 24px 1fr; gap: 10px; }
.opt:hover:not([disabled]) { border-color: var(--sky); background: var(--surface-2); }
.opt__k { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.opt.is-ok { background: var(--ok-bg); border-color: var(--green); }
.opt.is-ok .opt__k { background: var(--green); color: #fff; border-color: var(--green); }
.opt.is-bad { background: var(--bad-bg); border-color: var(--crimson); }
.opt.is-bad .opt__k { background: var(--crimson); color: #fff; border-color: var(--crimson); }
.opt[disabled] { cursor: default; }
.quiz__fb { margin-top: 10px; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); font-size: 14.5px; }
.quiz__done { margin-top: 16px; padding: 16px; border-radius: 12px; background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- Interactive widgets ---------- */
.widget { background: var(--surface); border: 1.5px solid var(--line); border-radius: 20px; margin: 8px 0 26px; overflow: hidden; box-shadow: var(--shadow); }
.widget__head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 18px; background: linear-gradient(90deg, var(--navy), var(--navy-2)); color: #fff; }
.widget__head strong { font-size: 15px; }
.widget__badge { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; background: var(--crimson); padding: 3px 9px; border-radius: 99px; }
.widget__hint { margin-left: auto; font-size: 12.5px; opacity: .78; }
.widget__body { padding: 18px; }
.fineprint { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sbtn { padding: 9px 16px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 650; font-size: 14px; transition: background .12s, border-color .12s; }
.sbtn:hover { background: var(--surface-2); }
.sbtn--primary { background: var(--crimson); color: #fff; border-color: var(--crimson); }
.sbtn--primary:hover { background: var(--crimson-2); }
.sbtn[disabled] { opacity: .45; cursor: not-allowed; }
.chip-btn { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-size: 13px; }
.chip-btn:hover { border-color: var(--sky); }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.widget textarea { width: 100%; resize: vertical; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; font: 15px/1.5 "Cascadia Code", Consolas, monospace; background: var(--surface); color: var(--ink); }
.widget textarea:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px rgba(109, 130, 255, .25); }
.tok-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; min-height: 44px; }
.tok { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; background: hsl(var(--h) 75% 86%); color: #14212E; border-radius: 8px; padding: 4px 7px 3px; animation: pop .25s ease both; }
.tok__t { font-family: "Cascadia Code", Consolas, monospace; font-size: 14px; white-space: pre; }
.tok__id { font-family: "Cascadia Code", Consolas, monospace; font-size: 10px; color: hsl(var(--h) 45% 32%); opacity: .85; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

/* two-memory model */
.mem { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mem__card { border: 1.5px solid var(--line); border-radius: 16px; padding: 16px; background: var(--surface); }
.mem__card--weights { background: color-mix(in srgb, var(--navy) 6%, var(--surface)); }
.mem__card--ctx { background: color-mix(in srgb, var(--sky) 7%, var(--surface)); }
.mem__cap { margin-bottom: 12px; }
.mem__cap b { display: block; color: var(--title); font-size: 16px; }
.mem__cap span { font-size: 12.5px; color: var(--muted); }
.mem__disk { display: grid; place-items: center; gap: 2px; height: 96px; border-radius: 12px; margin-bottom: 12px; color: #fff; background: linear-gradient(135deg, var(--navy), var(--navy-2)); border: 1px solid var(--navy-2); }
.mem__disk-t { font-weight: 800; letter-spacing: .14em; font-size: 15px; }
.mem__disk small { opacity: .8; font-size: 12px; }
.mem__ctx { display: flex; flex-direction: column; gap: 5px; min-height: 96px; padding: 10px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line); margin-bottom: 10px; }
.mem__chip { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; font-size: 12.5px; animation: pop .2s ease both; }
.mem__empty { color: var(--muted); font-size: 13px; font-style: italic; margin: auto 0; }
.mem__list { margin: 12px 0 0; padding-left: 1.1em; display: grid; gap: 7px; }
.mem__list li { font-size: 13.5px; line-height: 1.45; }
.mem__note:not(:empty) { margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--amber) 18%, var(--surface)); border: 1px solid color-mix(in srgb, var(--amber) 55%, transparent); font-size: 14px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 12px; }
.mini { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; }
.mini b { display: block; font-size: 22px; color: var(--title); line-height: 1.15; }
.mini span { font-size: 12.5px; color: var(--muted); }
.mini--hot b { color: var(--accent); }
.mini--good b { color: var(--green); }
.stat-row--context-cost { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
.stat-row--context-cost .mini { min-width: 0; padding: 8px; }
.stat-row--context-cost .mini b { font-size: 16px; overflow-wrap: anywhere; }
.stat-row--context-cost .mini span { display: block; font-size: 11px; line-height: 1.3; }
.cost-summary { margin: 12px 0 4px; padding: 11px 14px; border-left: 3px solid var(--crimson); background: var(--surface-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-bottom: 14px; }
.slider label { display: flex; justify-content: space-between; font-size: 14px; font-weight: 650; margin-bottom: 6px; }
.slider output { color: var(--accent); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--crimson); height: 28px; }
.price-intro { margin: 4px 0 8px; font-size: 13px; color: var(--muted); }
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.price-field { display: grid; gap: 6px; font-size: 13px; font-weight: 650; }
.price-field__control { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.price-field input { width: 100%; min-width: 0; border: 0; outline: none; background: transparent; color: var(--ink); font: inherit; font-variant-numeric: tabular-nums; }
.price-field small { flex: 0 0 auto; color: var(--muted); font-weight: 500; }
@media (max-width: 820px) { .stat-row--context-cost { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 560px) { .stat-row--context-cost { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding: 8px; background: var(--surface-2); border-radius: 12px; }
.bars i { flex: 1; min-width: 2px; background: linear-gradient(180deg, var(--sky), var(--blue)); border-radius: 3px 3px 0 0; transition: height .25s; }
.bars i:last-child { background: linear-gradient(180deg, var(--crimson-2), var(--crimson)); }
.axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* match */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 28px; }
.match__col { display: grid; gap: 10px; align-content: start; }
.mbtn { padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; font-weight: 650; transition: transform .12s, border-color .12s, background .12s; }
.mbtn:hover:not([disabled]) { border-color: var(--sky); }
.mbtn.is-sel { border-color: var(--sky); background: color-mix(in srgb, var(--sky) 14%, var(--surface)); transform: scale(1.02); }
.mbtn.is-ok { border-color: var(--green); background: var(--ok-bg); }
.mbtn.is-shake { animation: shake .35s; border-color: var(--crimson); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.mnote { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 14.5px; min-height: 48px; }
.mnote small { color: var(--muted); }

/* agent loop */
.rail { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
.stage { appearance: none; font: inherit; text-align: center; padding: 10px 6px; border-radius: 12px; font-weight: 700; font-size: 13.5px; background: var(--surface-2); color: var(--muted); border: 2px solid transparent; cursor: pointer; transition: all .25s; }
.stage:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.stage.is-on { color: #fff; transform: translateY(-3px); box-shadow: 0 8px 18px rgba(0, 0, 0, .18); }
.stage[data-s="Plan"].is-on { background: var(--blue); }
.stage[data-s="Act"].is-on { background: var(--crimson); }
.stage[data-s="Observe"].is-on { background: var(--teal); }
.stage[data-s="Adapt"].is-on { background: #C98F00; }
.stage[data-s="Deliver"].is-on { background: var(--green); }
.log { display: grid; gap: 8px; max-height: 330px; overflow-y: auto; padding-right: 4px; }
.log__item { display: grid; grid-template-columns: 78px 1fr; gap: 12px; align-items: start; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); animation: rise .3s both; }
.log__tag { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 4px 0; text-align: center; border-radius: 8px; color: #fff; }
.log__tag[data-s="Plan"] { background: var(--blue); } .log__tag[data-s="Act"] { background: var(--crimson); } .log__tag[data-s="Observe"] { background: var(--teal); } .log__tag[data-s="Adapt"] { background: #C98F00; } .log__tag[data-s="Deliver"] { background: var(--green); }
.log__item p { margin: 0; font-size: 14.5px; }
.log__item small { color: var(--muted); }
.ctxbar { height: 12px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 12px 0 4px; }
.ctxbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--sky), var(--crimson-2)); transition: width .4s; }

/* ReAct trajectory stepper */
.log--rt .log__item { grid-template-columns: 104px 1fr; }
.log__tag[data-r="Thought"] { background: var(--blue); }
.log__tag[data-r="Action"] { background: var(--crimson); }
.log__tag[data-r="Observation"] { background: var(--teal); }
.rt-q { background: var(--surface-2); border-left: 4px solid var(--navy); border-radius: 0 12px 12px 0; padding: 12px 14px; margin: 0 0 12px; }
.rt-meter { margin-bottom: 10px; }
.rt-count { font-size: 13px; font-weight: 700; color: var(--accent); background: var(--surface-2); padding: 5px 12px; border-radius: 99px; display: inline-block; }
@media (max-width: 720px) { .log--rt .log__item { grid-template-columns: 1fr; } }

/* Simulated session timeline */
.st-meter { background: var(--surface-2); border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; }
.st-num { display: flex; align-items: baseline; gap: 9px; margin-bottom: 9px; }
.st-num b { font-size: 28px; color: var(--title); line-height: 1; font-variant-numeric: tabular-nums; }
.st-num span { font-size: 12.5px; color: var(--muted); }
.st-log { max-height: 360px; }
.st-item { grid-template-columns: 118px 1fr; }
.st-item p { margin: 0 0 2px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.st-item small { color: var(--muted); line-height: 1.45; }
.st-item--reset { background: color-mix(in srgb, var(--amber) 16%, var(--surface-2)); }
.st-phase { font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); align-self: start; padding-top: 3px; }
.st-delta { font-family: "Cascadia Code", Consolas, monospace; font-size: 12.5px; font-weight: 700; color: var(--accent); }
.st-delta--reset { color: var(--green); }
.st-badge { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; background: color-mix(in srgb, var(--green) 20%, transparent); color: var(--green); padding: 2px 8px; border-radius: 99px; }
@media (max-width: 720px) { .st-item { grid-template-columns: 1fr; } .st-phase { padding-top: 0; } }

/* Agentic loop diagram */
.al { padding: 4px 0 2px; }
.al__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.al__io { background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 12px; padding: 14px 18px; font-weight: 650; font-size: 14.5px; color: var(--title); }
.al__io--done { background: var(--surface); }
.al__arrow { color: var(--muted); font-weight: 800; font-size: 17px; }
.al__loop { border: 2px dashed var(--line); border-radius: 16px; padding: 10px 14px 12px; background: color-mix(in srgb, var(--teal) 4%, var(--surface)); }
.al__cap { text-align: center; font-size: 11.5px; letter-spacing: .06em; text-transform: lowercase; color: var(--muted); font-weight: 700; margin-bottom: 9px; }
.al__phases { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.al__phase { background: color-mix(in srgb, var(--teal) 22%, var(--surface)); border: 1.5px solid color-mix(in srgb, var(--teal) 45%, transparent); color: var(--title); border-radius: 10px; padding: 12px 15px; font-weight: 650; font-size: 14px; cursor: pointer; transition: transform .12s, box-shadow .15s, background .15s; }
.al__phase:hover { background: color-mix(in srgb, var(--teal) 32%, var(--surface)); }
.al__phase.is-on { background: var(--teal); color: #fff; border-color: var(--teal); transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0, 0, 0, .16); }
.al__repeat { margin-top: 9px; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--green); }
.al__you { margin: 14px auto 16px; max-width: 420px; text-align: center; font-size: 13px; color: var(--accent); border: 1.5px dashed color-mix(in srgb, var(--crimson) 45%, transparent); border-radius: 12px; padding: 9px 14px; background: color-mix(in srgb, var(--crimson) 4%, transparent); }
@media (max-width: 720px) { .al__row, .al__phases { flex-direction: column; } .al__arrow { transform: rotate(90deg); } }

/* Context stack (what fills context before you type) */
.cs-bar { display: flex; height: 44px; border-radius: 12px; overflow: hidden; background: var(--surface-2); margin-bottom: 10px; }
.cs-seg { display: block; height: 100%; transition: opacity .15s, filter .15s; opacity: .55; }
.cs-seg.is-on { opacity: 1; filter: saturate(1.2); }
.cs-seg--navy { background: var(--navy); } .cs-seg--blue { background: var(--blue); }
.cs-seg--teal { background: var(--teal); } .cs-seg--amber { background: #C98F00; }
.cs-seg--crimson { background: var(--crimson); }
.cs-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.cs-btn { padding: 7px 13px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-size: 13.5px; font-weight: 650; display: inline-flex; align-items: center; gap: 7px; }
.cs-btn::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--muted); }
.cs-btn--navy::before { background: var(--navy); } .cs-btn--blue::before { background: var(--blue); }
.cs-btn--teal::before { background: var(--teal); } .cs-btn--amber::before { background: #C98F00; }
.cs-btn--crimson::before { background: var(--crimson); }
.cs-btn.is-on { border-color: var(--sky); background: var(--surface-2); }

/* Permission simulator */
.perm-row { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: start; margin-bottom: 12px; }
.perm-lbl { font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding-top: 10px; }
.perm-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.perm-opts .sbtn.is-on { background: var(--navy); color: #fff; border-color: var(--navy); }
.perm-out { margin-top: 6px; }
.perm-hint { color: var(--muted); font-size: 14px; font-style: italic; margin: 0; }
.perm-verdict { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; padding: 12px 16px; border-radius: 12px; margin-bottom: 10px; }
.perm-verdict b { font-size: 16px; }
.perm-verdict span { font-size: 13px; opacity: .8; font-family: "Cascadia Code", Consolas, monospace; }
.perm-verdict--allow { background: var(--ok-bg); border: 1.5px solid var(--green); }
.perm-verdict--ask { background: color-mix(in srgb, var(--amber) 22%, var(--surface)); border: 1.5px solid color-mix(in srgb, var(--amber) 70%, transparent); }
.perm-verdict--deny { background: var(--bad-bg); border: 1.5px solid var(--crimson); }
@media (max-width: 720px) { .perm-row { grid-template-columns: 1fr; } .perm-lbl { padding-top: 0; } }

/* Compaction: what survives */
.comp-list { display: grid; gap: 8px; margin-top: 14px; }
.comp-item { display: grid; grid-template-columns: 136px 1fr; gap: 12px; padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); animation: rise .25s both; }
.comp-item p { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.comp-item b { color: var(--title); font-size: 14.5px; }
.comp-tag { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; align-self: start; padding: 4px 9px; border-radius: 99px; text-align: center; }
.comp-item--keep { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); }
.comp-item--keep .comp-tag { background: color-mix(in srgb, var(--green) 20%, transparent); color: var(--green); }
.comp-item--part .comp-tag { background: color-mix(in srgb, var(--amber) 26%, transparent); color: #8A6400; }
[data-theme="dark"] .comp-item--part .comp-tag { color: var(--amber); }
.comp-item--lose { border-color: color-mix(in srgb, var(--crimson) 35%, var(--line)); }
.comp-item--lose .comp-tag { background: color-mix(in srgb, var(--crimson) 16%, transparent); color: var(--accent); }
.ctxbar i.is-hot { background: linear-gradient(90deg, var(--amber), var(--crimson)); }
@media (max-width: 720px) { .comp-item { grid-template-columns: 1fr; } .comp-tag { justify-self: start; } }

/* ReAct loop nested in the agent lifecycle */
.rl-wrap { padding: 18px; }
.rl { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.rl__stage { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; border-radius: 12px; padding: 10px 16px; text-align: center; min-width: 92px; }
.rl__stage b { display: block; font-size: 15px; }
.rl__stage small { opacity: .8; font-size: 11.5px; }
.rl__arrow { color: var(--muted); font-weight: 800; font-size: 18px; }
.rl__loop { border: 2px dashed var(--accent); border-radius: 16px; padding: 10px 12px 12px; background: color-mix(in srgb, var(--crimson) 5%, var(--surface)); }
.rl__loop-cap { font-size: 11.5px; font-weight: 800; letter-spacing: .02em; color: var(--accent); margin-bottom: 8px; text-align: center; }
.rl__cycle { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.rl__beat { border-radius: 10px; padding: 8px 12px; text-align: center; color: #fff; min-width: 82px; }
.rl__beat b { display: block; font-size: 13.5px; }
.rl__beat small { font-size: 11px; opacity: .92; }
.rl__beat--t { background: var(--blue); }
.rl__beat--a { background: var(--crimson); }
.rl__beat--o { background: var(--teal); }
.rl__repeat { font-size: 12px; font-weight: 700; color: var(--accent); background: var(--surface); border: 1px solid var(--accent); border-radius: 99px; padding: 5px 11px; }
.rl-cap { font-size: 13px; color: var(--muted); margin: 14px 0 0; text-align: center; }
@media (max-width: 720px) { .rl, .rl__cycle { flex-direction: column; } .rl__arrow { transform: rotate(90deg); } }

/* classify */
.cls { display: grid; gap: 12px; }
.cls__item { border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 16px; background: var(--surface); }
.cls__item.is-ok { border-color: var(--green); background: var(--ok-bg); }
.cls__item.is-bad { border-color: var(--crimson); background: var(--bad-bg); }
.cls__text { margin: 0 0 10px; font-weight: 600; }
.cls__opts { display: flex; flex-wrap: wrap; gap: 8px; }
.cls__why { margin: 10px 0 0; font-size: 14px; }
.scorebar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; flex-wrap: wrap; }
.scorebar b { font-size: 15px; }

/* latency */
.stack { display: flex; height: 34px; border-radius: 10px; overflow: hidden; background: var(--surface-2); margin: 6px 0; }
.stack i { display: block; height: 100%; transition: width .3s; }
.stack .s-model { background: var(--navy-2); }
.stack .s-tool { background: var(--teal); }
.stack .s-tail { background: var(--crimson); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--c); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--crimson); }

/* tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { padding: 10px 18px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700; }
.tab.is-on { background: var(--navy); color: #fff; border-color: var(--navy); }
.panel { border-radius: 14px; background: var(--surface-2); padding: 16px 18px; animation: rise .25s both; }
.para-def { margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 15.5px; line-height: 1.55; }
.panel dl { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; margin: 0; }
.panel dt { font-weight: 700; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; padding-top: 2px; }
.panel dd { margin: 0; }
.acc { display: grid; gap: 10px; }
.acc__item { border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.acc__btn { width: 100%; text-align: left; padding: 14px 16px; background: transparent; border: 0; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; font-weight: 650; }
.acc__btn small { display: block; font-weight: 500; color: var(--muted); }
.acc__body { padding: 0 16px 14px; display: none; }
.acc__item.is-open .acc__body { display: block; animation: rise .25s both; }
.acc__item.is-open .acc__chev { transform: rotate(90deg); }
.acc__chev { transition: transform .2s; color: var(--muted); }
.mitig { background: var(--ok-bg); border-radius: 10px; padding: 10px 12px; margin-top: 8px; font-size: 14.5px; }

/* ladder */
.ladder { display: grid; gap: 8px; margin-bottom: 14px; }
.lvl { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center; cursor: pointer; border: 2px solid transparent; background: transparent; padding: 6px; border-radius: 14px; text-align: left; width: 100%; }
.lvl:hover { background: var(--surface-2); }
.lvl.is-sel { border-color: var(--navy); background: var(--surface-2); }
.lvl.is-us { border-color: var(--crimson); }
.lvl__n { width: 44px; height: 44px; border-radius: 12px; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.lvl__bar { height: 10px; border-radius: 99px; background: linear-gradient(90deg, var(--sky), var(--blue)); margin-top: 6px; transition: width .4s; }
.lvl__t b { display: block; color: var(--title); font-size: 15px; }
.lvl__t span { font-size: 13.5px; color: var(--muted); }
.lvl__us { font-size: 11px; font-weight: 800; color: var(--accent); letter-spacing: .08em; text-transform: uppercase; margin-left: 8px; }

/* ---------- Pager / sticky mobile bar ---------- */
.mobilebar { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .course-app { --sidebar-w: 292px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .cards--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-grid; }
  /* 120px ≈ Base's sitewide header + this page's own slim toolbar, so the
     off-canvas drawer and its scrim start below both instead of covering them. */
  .sidebar { position: fixed; z-index: 70; left: 0; top: 120px; bottom: 0; width: min(90vw, 360px); transform: translateX(-102%); transition: transform .25s ease; box-shadow: 8px 0 28px rgba(0, 0, 0, .3); height: auto; }
  body.nav-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 120px 0 0 0; background: rgba(5, 15, 25, .55); z-index: 65; opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  .progress-pill__bar { display: none; }
}
@media (max-width: 720px) {
  .grid--2, .grid--3, .cards--2, .cards--3, .cards--4, .compare, .mem { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .match { grid-template-columns: 1fr; }
  .rail { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .stage { font-size: 11px; padding: 8px 2px; }
  .log__item { grid-template-columns: 1fr; }
  .log__tag { justify-self: start; padding: 3px 10px; }
  .panel dl { grid-template-columns: 1fr; }
  .main { padding-top: 22px; padding-bottom: 130px; }
  .widget__hint { margin-left: 0; width: 100%; }
  .modrow { grid-template-columns: 34px 1fr; }
  .modrow > :last-child { grid-column: 2; }
  .pager .btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Print (cheat sheets) ---------- */

/* ==========================================================================
   Documentation-styled components (Track 4 onward)
   Visual language follows the conventions of modern developer documentation:
   titled code blocks, OS tab strips, vertical numbered steps, note banners,
   and faithful terminal / agent-session renderings.
   ========================================================================== */

/* --- shared code surface -------------------------------------------------- */

.dx {
  max-width: 100%;
  --dx-bg: #0D1117;
  --dx-head: #161B22;
  --dx-line: #2A313C;
  --dx-ink: #D6DEE8;
  --dx-dim: #8A97A8;
  margin: 0 0 22px;
  border: 1px solid var(--dx-line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--dx-bg);
  box-shadow: var(--shadow-sm);
}

.dx__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: var(--dx-head);
  border-bottom: 1px solid var(--dx-line);
  font-size: 12.5px;
  color: var(--dx-dim);
}

.dx__title {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  color: #C9D4E2;
  font-weight: 600;
  letter-spacing: .01em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dx__lang {
  margin-left: auto;
  font-size: 11px;
  text-transform: lowercase;
  letter-spacing: .04em;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--dx-line);
  color: var(--dx-dim);
}

/* copy-to-clipboard control in a code block header */
.dx__copy {
  appearance: none;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 7px;
  border: 1px solid var(--dx-line);
  background: rgba(255, 255, 255, .06);
  color: var(--dx-dim);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.dx__copy:first-of-type { margin-left: auto; }
.dx__lang + .dx__copy { margin-left: 8px; }

.dx__copy:hover { background: rgba(255, 255, 255, .13); color: #E6EDF3; border-color: #3A4452; }
.dx__copy:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
.dx__copy[data-done="1"] { color: #5FD88A; border-color: rgba(95, 216, 138, .5); background: rgba(95, 216, 138, .12); }
.dx__copy i { font-style: normal; font-size: 12px; line-height: 1; }

.dx__body {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
  color: var(--dx-ink);
  white-space: pre;
  tab-size: 2;
}

/* terminal window variant: traffic-light dots instead of a filename */
.dx--term .dx__dots { display: flex; gap: 6px; }
.dx--term .dx__dots i {
  width: 11px; height: 11px; border-radius: 50%; display: block;
}
.dx--term .dx__dots i:nth-child(1) { background: #FF5F57; }
.dx--term .dx__dots i:nth-child(2) { background: #FEBC2E; }
.dx--term .dx__dots i:nth-child(3) { background: #28C840; }
.dx--term .dx__title { margin-left: 4px; font-weight: 500; }

/* syntax / role colors inside a code body */
.dx__body .t-cmt  { color: #7D8FA3; }
.dx__body .t-cmd  { color: #E6EDF3; font-weight: 600; }
.dx__body .t-flag { color: #B6D8FF; }
.dx__body .t-str  { color: #A8E0B0; }
.dx__body .t-key  { color: #D2A8FF; }
.dx__body .t-out  { color: #AEBBCB; }
/* prose-safe verdict colors, usable inside tables and paragraphs */
.v-ok  { color: var(--green); font-weight: 600; }
.v-bad { color: var(--accent); font-weight: 600; }
.dx__body .t-ok   { color: #5FD88A; }
.dx__body .t-bad  { color: #FF8086; }
.dx__body .t-warn { color: #F2C55C; }
.dx__body .t-add  { color: #5FD88A; }
.dx__body .t-del  { color: #FF8086; }
.dx__body .t-dim  { color: #6F7E90; }

/* --- Claude Code session rendering --------------------------------------- */

.cc { --cc-accent: #D97757; }

.cc__body {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.75;
  background: #0D1117;
  color: #D6DEE8;
}

.cc__row { display: flex; gap: 10px; white-space: pre-wrap; }
.cc__row + .cc__row { margin-top: 2px; }
.cc__gutter { flex: 0 0 auto; width: 16px; text-align: center; color: #6F7E90; user-select: none; }
.cc__text { flex: 1 1 auto; min-width: 0; }

/* the prompt you type */
.cc__row--user .cc__gutter { color: var(--cc-accent); font-weight: 700; }
.cc__row--user .cc__text { color: #FFFFFF; font-weight: 600; }

/* a line of Claude's prose */
.cc__row--say .cc__gutter { color: var(--cc-accent); }
.cc__row--say .cc__text { color: #D6DEE8; }

/* a tool invocation */
.cc__row--tool .cc__gutter { color: var(--cc-accent); }
.cc__row--tool .cc__text { color: #9ECBFF; font-weight: 600; }

/* the result line hanging under a tool call */
.cc__row--res .cc__gutter { color: #4E5A68; }
.cc__row--res .cc__text { color: #8A97A8; }

.cc__row--ok .cc__text { color: #5FD88A; }
.cc__row--bad .cc__text { color: #FF8086; }
.cc__row--note .cc__text { color: #7D8FA3; font-style: italic; }
.cc__row--blank { height: 8px; }

.cc__badge {
  display: inline-block;
  margin-left: 8px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: rgba(217, 119, 87, .18);
  border: 1px solid rgba(217, 119, 87, .45);
  color: #F0A98C;
  vertical-align: 1px;
}

/* --- tab strip ------------------------------------------------------------ */

.tabs { margin: 0 0 22px; }

.tabs__strip {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.tabs__btn {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 9px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: color .15s, border-color .15s, background .15s;
}

.tabs__btn:hover { color: var(--title); background: var(--surface-2); }

.tabs__btn[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tabs__panel[hidden] { display: none; }
.tabs__panel { min-width: 0; max-width: 100%; }
.tabs__panel > *:last-child { margin-bottom: 0; }

/* --- documentation note banners ------------------------------------------ */

.note {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  margin: 0 0 22px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted);
  background: var(--surface);
  font-size: 15px;
}

.note__icon { font-size: 15px; line-height: 1.5; }
.note__label { font-weight: 700; color: var(--title); margin-right: 6px; }
.note p { margin: 0; }
.note p + p { margin-top: 8px; }
.note > div > *:last-child { margin-bottom: 0; }

.note--note    { border-left-color: var(--blue);  background: color-mix(in srgb, var(--blue) 7%, var(--surface)); }
.note--tip     { border-left-color: var(--green); background: color-mix(in srgb, var(--green) 8%, var(--surface)); }
.note--warning { border-left-color: var(--amber); background: color-mix(in srgb, var(--amber) 13%, var(--surface)); }

/* --- vertical numbered steps --------------------------------------------- */

.dsteps { list-style: none; margin: 0 0 22px; padding: 0; counter-reset: dstep; }

.dsteps > li {
  counter-increment: dstep;
  position: relative;
  padding: 0 0 26px 46px;
}

.dsteps > li::before {
  content: counter(dstep);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* connecting rail between step markers */
.dsteps > li::after {
  content: "";
  position: absolute;
  left: 14.5px;
  top: 34px;
  bottom: 6px;
  width: 1px;
  background: var(--line);
}

.dsteps > li:last-child { padding-bottom: 0; }
.dsteps > li:last-child::after { display: none; }

.dsteps__title {
  margin: 4px 0 10px;
  font-size: 17.5px;
  font-weight: 700;
  color: var(--title);
  letter-spacing: -.01em;
}

.dsteps > li > *:last-child { margin-bottom: 0; }

@media (max-width: 640px) {
  .dsteps > li { padding-left: 38px; }
  .dsteps > li::before { width: 26px; height: 26px; font-size: 13px; }
  .dsteps > li::after { left: 12.5px; top: 30px; }
  .dx__body, .cc__body { font-size: 12px; }
  /* keep the code-block header inside a narrow viewport: drop the language
     chip and the copy button's text label, leaving the icon */
  .dx__lang { display: none; }
  .dx__copy span { display: none; }
  .dx__copy { padding: 4px 8px; }
}

@media print {
  .topbar, .sidebar, .scrim, .readbar, .pager, .noprint, .dx__copy { display: none !important; }
  .shell { display: block; padding: 0; }
  body { background: #fff; color: #000; }
  .main { padding: 0; }
  .card, .quiz { box-shadow: none; break-inside: avoid; }
  .callout--key, .takeaways { background: #fff !important; color: #000 !important; border: 1px solid #000; }
  .callout--key code, .takeaways code { background: var(--surface-2) !important; color: #000 !important; }
}
