/* =========================================================================
   Alpha Academy — design system
   Tokens, shell layout, components. Mobile-first. No frameworks.
   ========================================================================= */

/* ---------- Tokens ---------- */
:root {
  --bg: #080C16;
  --surface: #0E1320;
  --surface-2: #121a2a;
  --line: rgba(255, 255, 255, 0.07);
  --line-hover: rgba(255, 255, 255, 0.14);
  --accent: #00E6CF;
  --accent-2: #8C52EB;
  --blue: #3399FF;
  --text: #D5DDE8;
  --text-dim: #8B96AB;
  --text-faint: #667B99;
  --heading: #EDF2F7;
  --green: #30C48D;
  --red: #EC5B65;
  --amber: #F0B44C;

  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --radius: 10px;
  --radius-sm: 6px;

  --topbar-h: 56px;
  --player-h: 64px;
  --sidebar-w: 280px;
  --queue-w: 300px;
  --gutter: 16px;

  --accent-soft: rgba(0, 230, 207, 0.10);
  --accent-line: rgba(0, 230, 207, 0.28);
  --accent-2-soft: rgba(140, 82, 235, 0.12);
  --accent-2-line: rgba(140, 82, 235, 0.32);

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur: 160ms;
  color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* room for the fixed player: via body.has-player (set by app.js) or automatically when the bar is shown */
body.has-player, body:has(.player:not([hidden])) { padding-bottom: var(--player-h); }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--heading);
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.01em;
}
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: rgba(0, 230, 207, 0.28); color: #fff; }

/* ---------- Skip link ---------- */
.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 200;
  background: var(--accent);
  color: #04110F;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 600;
}
.skip:focus { top: 10px; text-decoration: none; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--gutter);
  background: rgba(8, 12, 22, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__menu,
.topbar__search {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.topbar__menu:hover,
.topbar__search:hover { color: var(--heading); border-color: var(--line-hover); background: var(--surface); }
.topbar__search { margin-left: auto; font-size: 20px; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--heading);
  min-width: 0;
}
.brand:hover { text-decoration: none; }
.brand__wolf { width: 32px; height: 32px; object-fit: contain; flex: none; }
.brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.brand__org {
  display: none;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding-left: 10px;
  border-left: 1px solid var(--line-hover);
  white-space: nowrap;
}
.topbar__nav {
  display: none;
  align-items: center;
  gap: 4px;
  margin-left: 18px;
}
.topbar__nav a {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  color: var(--text-dim);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.topbar__nav a:hover { color: var(--heading); background: var(--surface); text-decoration: none; }
.topbar__nav a.is-current, .topbar__nav a[aria-current] { color: var(--accent); }

@media (min-width: 600px) {
  .brand__org { display: inline; }
  .topbar__nav { display: flex; }
}
@media (min-width: 900px) {
  .topbar__menu { display: none; }
}

/* ---------- Layout ---------- */
.layout {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  position: relative;
}
.main {
  min-width: 0;
  padding: 28px var(--gutter) 64px;
  overflow-x: clip; /* absolutely-positioned glows (hero) must never widen the page */
}
@media (min-width: 600px) {
  .main { padding: 36px 28px 72px; }
}
@media (min-width: 900px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .main { padding: 44px 40px 88px; }
}
@media (min-width: 1280px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--queue-w); }
  .main { padding: 48px 48px 96px; }
}

/* ---------- Scrim (drawer / queue backdrop) ---------- */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(3, 6, 12, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms var(--ease);
}
@media (max-width: 899.98px) {
  body.drawer-open::after { opacity: 1; pointer-events: auto; }
  body.drawer-open { overflow: hidden; }
}
@media (max-width: 1279.98px) {
  body.queue-open::after { opacity: 1; pointer-events: auto; }
  body.queue-open { overflow: hidden; }
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 12px 32px;
}
.sidebar__section { display: flex; flex-direction: column; gap: 1px; }
.sidebar__section-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 6px 10px 8px;
  transition: color var(--dur) var(--ease);
}
.sidebar__section-title:hover { color: var(--heading); text-decoration: none; }
.sidebar__section-title.is-current { color: var(--accent); }
.sidebar__doc {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px 7px 20px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13.5px;
  line-height: 1.35;
  position: relative;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.sidebar__doc::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 50%;
  border: 1px solid var(--line-hover);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.sidebar__doc:hover { color: var(--heading); background: rgba(255, 255, 255, 0.03); text-decoration: none; }
.sidebar__doc.is-current { color: var(--accent); background: var(--accent-soft); }
.sidebar__doc.is-current::before { background: var(--accent); border-color: var(--accent); }
.sidebar__doc.is-done { color: var(--text-faint); }
.sidebar__doc.is-done::before { background: var(--green); border-color: var(--green); }
.sidebar__doc.is-done.is-current { color: var(--accent); }
.sidebar__doc-title { flex: 1 1 auto; min-width: 0; }
.sidebar__doc-meta {
  flex: none;
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.sidebar__gate {
  margin: 0 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-2-line);
  background: var(--accent-2-soft);
  color: #C4A6F5;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar__gate::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 3px var(--accent-2-soft);
  flex: none;
}

/* Sidebar as drawer (<900px) */
@media (max-width: 899.98px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 80;
    width: min(var(--sidebar-w), 86vw);
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(-100%);
    transition: transform 240ms var(--ease);
    box-shadow: none;
  }
  body.drawer-open .sidebar { transform: translateX(0); box-shadow: 24px 0 60px rgba(0, 0, 0, 0.5); }
  .sidebar__nav { padding-top: 20px; }
}
/* Sidebar as sticky rail (≥900px) */
@media (min-width: 900px) {
  .sidebar {
    position: sticky;
    top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
  }
  body.has-player .sidebar, body:has(.player:not([hidden])) .sidebar { height: calc(100vh - var(--topbar-h) - var(--player-h)); }
}

/* ---------- Queue (right rail / off-canvas panel) ---------- */
.queue {
  background: var(--surface);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.queue__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 18px 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.queue__head button {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text-dim);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.queue__head button:hover { color: var(--heading); border-color: var(--line-hover); }
.queue__list {
  list-style: none;
  margin: 0;
  padding: 0 10px 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1 1 auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}
.queue__list:empty::after {
  content: "Nothing queued. Add a lesson with + Queue.";
  display: block;
  padding: 14px 10px;
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.5;
}
.queue__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13.5px;
  line-height: 1.35;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.queue__item:hover { background: rgba(255, 255, 255, 0.03); color: var(--heading); }
.queue__item.is-playing { color: var(--accent); background: var(--accent-soft); }
.queue__item-play {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.queue__item-num {
  flex: none;
  width: 18px;
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--text-faint);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.queue__item.is-playing .queue__item-num { color: var(--accent); }
.queue__item-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue__item-title a { color: inherit; }
.queue__item-meta { flex: none; font-family: var(--font-display); font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.queue__item-remove {
  flex: none;
  width: 24px; height: 24px;
  border-radius: 4px;
  color: var(--text-faint);
  font-size: 16px;
  line-height: 1;
  opacity: 0;
  transition: opacity var(--dur) var(--ease), color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.queue__item:hover .queue__item-remove, .queue__item-remove:focus-visible { opacity: 1; }
.queue__item-remove:hover { color: var(--red); background: rgba(236, 91, 101, 0.1); }

@media (max-width: 1279.98px) {
  .queue {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    width: min(var(--queue-w), 86vw);
    transform: translateX(100%);
    transition: transform 240ms var(--ease);
  }
  body.queue-open .queue { transform: translateX(0); box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5); }
  body.has-player .queue, body:has(.player:not([hidden])) .queue { bottom: var(--player-h); }
}
@media (min-width: 1280px) {
  .queue {
    position: sticky;
    top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    overflow: hidden;
  }
  body.has-player .queue, body:has(.player:not([hidden])) .queue { height: calc(100vh - var(--topbar-h) - var(--player-h)); }
}

/* ---------- Shared text pieces ---------- */
.eyebrow {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 12px;
}
.eyebrow a { color: var(--accent); }
.lede {
  color: var(--text-dim);
  font-size: 17px;
  line-height: 1.6;
  margin: 10px 0 0;
  max-width: 64ch;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-hover);
  background: var(--surface);
  color: var(--heading);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn:hover { text-decoration: none; border-color: rgba(255, 255, 255, 0.26); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #04110F;
}
.btn--primary:hover { background: #1AF0DA; border-color: #1AF0DA; color: #04110F; }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--text-dim); }
.btn--ghost:hover { color: var(--heading); }
.btn--sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn.is-active, .btn[aria-pressed="true"] { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.btn.is-done { border-color: rgba(48, 196, 141, 0.4); color: var(--green); background: rgba(48, 196, 141, 0.08); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: clip;
  overflow-clip-margin: 40px;
  display: grid;
  gap: 6px;
  text-align: center;
  padding: 28px 0 24px;
  justify-items: center;
}
.hero__wolf {
  width: min(220px, 60vw);
  height: auto;
  margin-bottom: 18px;
  position: relative;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.55));
}
.hero::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 520px;
  height: 520px;
  max-width: 120vw;
  transform: translate(-50%, -22%);
  background: radial-gradient(closest-side, rgba(0, 230, 207, 0.12), rgba(0, 230, 207, 0.03) 55%, transparent 72%);
  pointer-events: none;
  z-index: 0;
}
.hero > * { position: relative; z-index: 1; }
.hero__title {
  font-size: clamp(36px, 7vw, 56px);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.hero__lede {
  color: var(--text-dim);
  font-size: clamp(16px, 2vw, 18px);
  line-height: 1.6;
  max-width: 56ch;
  margin: 10px 0 0;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 22px;
}
@media (min-width: 900px) {
  .hero {
    grid-template-columns: auto 1fr;
    text-align: left;
    justify-items: start;
    align-items: center;
    column-gap: 40px;
    padding: 24px 0 32px;
  }
  .hero__wolf { grid-row: 1 / span 5; margin: 0; width: 260px; }
  .hero::before { left: 150px; width: 560px; height: 560px; transform: translate(-50%, -32%); }
  .hero__actions { justify-content: flex-start; }
}

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0 48px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 16px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--accent-line);
  border-top-color: rgba(0, 230, 207, 0.5);
  transition: border-color var(--dur) var(--ease);
}
.stat:hover { border-color: rgba(0, 230, 207, 0.55); }
.stat__num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(26px, 3vw, 32px);
  letter-spacing: -0.02em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}
.stat--progress .stat__num { font-size: clamp(20px, 2.2vw, 24px); padding-top: 4px; }
.stat__label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
@media (min-width: 600px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; } }

/* ---------- Journey ---------- */
.journey { margin: 0 0 56px; }
.journey__title, .shelf > h2, .section-title {
  font-size: 22px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.journey__title::after, .shelf > h2::after, .section-title::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--line);
}
.journey__path {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* the thin vertical line connecting nodes */
.journey__path::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 20px;
  bottom: 20px;
  width: 1px;
  background: linear-gradient(to bottom, var(--line-hover), var(--line-hover));
  z-index: 0;
}
.journey__node { position: relative; z-index: 1; }
.journey__node > a {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  grid-template-areas:
    "num name"
    "num blurb"
    "num meta"
    "num progress";
  column-gap: 16px;
  row-gap: 4px;
  align-items: start;
  padding: 14px 16px 14px 0;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.journey__node > a:hover { text-decoration: none; background: var(--surface); border-color: var(--line); }
.journey__node > a:hover .journey__num { border-color: var(--accent); color: var(--accent); }
.journey__num {
  grid-area: num;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--line-hover);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.journey__node.is-done .journey__num { border-color: var(--green); color: var(--green); }
.journey__node.is-current .journey__num { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.journey__name {
  grid-area: name;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--heading);
  line-height: 1.3;
  padding-top: 8px;
}
.journey__blurb { grid-area: blurb; color: var(--text-dim); font-size: 14px; line-height: 1.55; max-width: 60ch; }
.journey__meta {
  grid-area: meta;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.journey__progress {
  grid-area: progress;
  display: block;
  height: 3px;
  margin-top: 6px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
  max-width: 320px;
}
.journey__progress::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--p, 0%);
  background: var(--accent);
  border-radius: 2px;
  transition: width 400ms var(--ease);
}
.journey__progress[style*="--p:100%"]::after, .journey__node.is-done .journey__progress::after { background: var(--green); }
.journey__gate {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 0;
}
.journey__gate::before {
  content: "";
  flex: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--accent-2-line);
  background-image: radial-gradient(circle, var(--accent-2) 0 4px, transparent 5px);
  box-shadow: 0 0 0 4px var(--accent-2-soft);
}
.journey__gate-label {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-2-line);
  background: var(--accent-2-soft);
  color: #C4A6F5;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.journey__gate-label a { color: inherit; }

/* Tracks A/B/C side by side */
.journey__tracks {
  list-style: none;
  margin: 0;
  padding: 0 0 0 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  position: relative;
  z-index: 1;
}
.journey__tracks .journey__node > a,
.journey__node--track > a {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "num" "name" "blurb" "meta" "progress";
  padding: 16px;
  background: var(--surface);
  border-color: var(--line);
  height: 100%;
}
.journey__tracks .journey__node > a:hover,
.journey__node--track > a:hover { border-color: var(--line-hover); }
.journey__tracks .journey__num, .journey__node--track .journey__num { width: 32px; height: 32px; font-size: 12px; margin-bottom: 8px; }
.journey__tracks .journey__name, .journey__node--track .journey__name { padding-top: 0; font-size: 16px; }
.journey__tracks-label {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 4px 0 -2px;
}
@media (max-width: 599.98px) {
  .journey__tracks { padding-left: 0; }
}
@media (min-width: 900px) {
  .journey__tracks { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
}

/* ---------- Cards ---------- */
.shelf { margin: 0 0 56px; }
.cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.card:hover { text-decoration: none; border-color: var(--line-hover); background: var(--surface-2); }
.card:hover .card__title { color: var(--accent); }
.card__title { font-family: var(--font-display); font-weight: 600; font-size: 15.5px; color: var(--heading); line-height: 1.3; transition: color var(--dur) var(--ease); }
.card__sub { color: var(--text-dim); font-size: 13.5px; line-height: 1.5; }
.card__meta { font-family: var(--font-display); font-size: 11.5px; color: var(--text-faint); letter-spacing: 0.04em; margin-top: auto; padding-top: 6px; }
@media (min-width: 600px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } }

/* ---------- Section page ---------- */
.section-head { margin-bottom: 28px; max-width: 76ch; }
.section-head h1 { font-size: clamp(28px, 4vw, 38px); font-weight: 700; letter-spacing: -0.02em; }
.section-head .lesson__actions { margin-top: 20px; }

.doclist {
  list-style: none;
  margin: 0 0 48px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.doclist__item {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.doclist__link {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  grid-template-areas: "num body" "num meta";
  column-gap: 14px;
  row-gap: 4px;
  align-items: start;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.doclist__link:hover { text-decoration: none; border-color: var(--line-hover); background: var(--surface-2); }
.doclist__link:hover .doclist__title { color: var(--accent); }
.doclist__num {
  grid-area: num;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-faint);
  padding-top: 2px;
  font-variant-numeric: tabular-nums;
}
.doclist__item.is-done .doclist__num { color: var(--green); }
.doclist__item.is-done .doclist__num::after { content: " ✓"; }
.doclist__body { grid-area: body; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.doclist__title { font-family: var(--font-display); font-weight: 600; font-size: 15.5px; color: var(--heading); line-height: 1.3; transition: color var(--dur) var(--ease); }
.doclist__sub { color: var(--text-dim); font-size: 13.5px; line-height: 1.5; }
.doclist__meta { grid-area: meta; font-family: var(--font-display); font-size: 12px; color: var(--text-faint); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.doclist__queue {
  flex: none;
  width: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.doclist__queue:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.doclist__queue.is-queued { color: var(--accent); border-color: var(--accent-line); }
@media (min-width: 600px) {
  .doclist__link { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "num body meta"; padding: 16px 18px; }
  .doclist__meta { padding-top: 3px; white-space: nowrap; }
}

/* ---------- Lesson ---------- */
.lesson { max-width: 76ch; }
.lesson__head { margin-bottom: 26px; }
.lesson__title { font-size: clamp(28px, 4.2vw, 38px); font-weight: 700; letter-spacing: -0.02em; margin: 0 0 10px; }
.lesson__subtitle { color: var(--text-dim); font-size: 17px; line-height: 1.6; margin: 0; max-width: 64ch; }
.lesson__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

/* TOC */
.toc {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 36px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  position: relative;
}
.toc::before {
  content: "In this lesson";
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.toc a {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.4;
  padding: 4px 0 4px 14px;
  position: relative;
  transition: color var(--dur) var(--ease);
}
.toc a::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 6px; height: 1px;
  background: var(--line-hover);
}
.toc a:hover { color: var(--accent); text-decoration: none; }
.toc a.is-current { color: var(--accent); }
.toc a.is-current::before { background: var(--accent); }

/* ---------- Prose ---------- */
.prose {
  font-size: 16px;
  line-height: 1.65;
  max-width: 72ch;
  color: var(--text);
}
.prose > :first-child { margin-top: 0; }
.prose h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 44px 0 14px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.prose > h2:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.prose h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--blue);
  margin: 28px 0 8px;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.prose h4 { font-size: 15px; margin: 22px 0 6px; color: var(--heading); }
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 26px; }
.prose li { margin: 0 0 6px; padding-left: 4px; }
.prose li::marker { color: var(--text-faint); font-family: var(--font-display); font-size: 0.95em; }
.prose ul li::marker { color: var(--accent); }
.prose li > ul, .prose li > ol { margin: 6px 0 0; }
.prose strong { color: var(--heading); font-weight: 600; }
.prose em { color: var(--text); }
.prose mark {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.05em 0.25em;
  border-radius: 4px;
  font-weight: 500;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.prose code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  color: var(--heading);
}
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.prose blockquote {
  margin: 0 0 18px;
  padding: 4px 0 4px 18px;
  border-left: 2px solid var(--line-hover);
  color: var(--text-dim);
}
.prose a { text-decoration: underline; text-decoration-color: rgba(0, 230, 207, 0.35); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose img { border-radius: var(--radius); border: 1px solid var(--line); margin: 8px 0 20px; }
.prose figure { margin: 0 0 20px; }
.prose figcaption { color: var(--text-faint); font-size: 13px; margin-top: 8px; }

/* Tables */
.table-wrap {
  margin: 8px 0 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}
.table-wrap table, .prose table {
  width: 100%;
  min-width: 480px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14.5px;
  line-height: 1.5;
}
.prose table:not(.table-wrap table) { margin: 8px 0 24px; }
.prose thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--heading);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-hover);
  white-space: nowrap;
}
.prose tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--text);
}
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
.prose td:first-child, .prose th:first-child { padding-left: 16px; }
.prose td:last-child, .prose th:last-child { padding-right: 16px; }
.prose tbody td mark { white-space: nowrap; }

/* ---------- Callouts ---------- */
.callout {
  --c: var(--accent);
  --c-line: rgba(0, 230, 207, 0.25);
  --c-soft: rgba(0, 230, 207, 0.05);
  display: block;
  margin: 22px 0 24px;
  padding: 14px 18px 14px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--c-line);
  position: relative;
  overflow: hidden;
}
.callout::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--c);
  opacity: 0.85;
}
.callout__label {
  display: block;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c);
  margin-bottom: 6px;
}
.callout p { margin: 0; }
.callout p + p { margin-top: 10px; }
.callout ul, .callout ol { margin-bottom: 0; }
.callout--note, .callout--tip { --c: var(--accent); --c-line: rgba(0, 230, 207, 0.25); }
.callout--rule { --c: var(--accent-2); --c-line: rgba(140, 82, 235, 0.32); }
.callout--risk { --c: var(--red); --c-line: rgba(236, 91, 101, 0.3); }
.callout--setup { --c: var(--blue); --c-line: rgba(51, 153, 255, 0.3); }
.callout--rule .callout__label { color: #B38AF3; }

/* ---------- Check Yourself ---------- */
.check {
  margin: 44px 0 0;
  padding: 22px 22px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.prose .check h2 { border-top: 0; padding-top: 0; margin: 0 0 14px; font-size: 20px; }
.check ol { margin-bottom: 12px; }
.check ol li::marker { color: var(--accent); font-weight: 600; }
.check__answers { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; }
.check__answers summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--accent);
  padding: 6px 0;
  user-select: none;
}
.check__answers summary::-webkit-details-marker { display: none; }
.check__answers summary::before {
  content: "";
  width: 7px; height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--dur) var(--ease);
  margin-left: 2px;
}
.check__answers[open] summary::before { transform: rotate(45deg); }
.check__answers summary:hover { text-decoration: underline; text-underline-offset: 3px; }
.check__answers > :not(summary) { margin-top: 12px; }
.check__answers p:last-child { margin-bottom: 0; }

/* ---------- Pager ---------- */
.pager {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin: 44px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.pager a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--heading);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.35;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.pager a::before {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.pager__prev::before { content: "Previous"; }
.pager__next::before { content: "Next"; }
.pager__next { text-align: right; align-items: flex-end; }
.pager a:hover { text-decoration: none; border-color: var(--line-hover); background: var(--surface-2); color: var(--accent); }
.pager a:only-child.pager__next { grid-column: 2; }
@media (min-width: 600px) { .pager { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Downloads ---------- */
.book {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  grid-template-areas: "wolf title" "wolf sub" "wolf size";
  column-gap: 18px;
  row-gap: 2px;
  align-items: center;
  align-content: center;
  grid-auto-rows: min-content;
  padding: 20px;
  margin: 0 0 36px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--accent-line);
  color: var(--text);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: border-color var(--dur) var(--ease);
}
.book::before {
  content: "";
  position: absolute;
  left: -40px; top: 50%;
  width: 240px; height: 240px;
  transform: translateY(-50%);
  background: radial-gradient(closest-side, rgba(0, 230, 207, 0.1), transparent 70%);
  pointer-events: none;
}
.book:hover { text-decoration: none; border-color: rgba(0, 230, 207, 0.6); }
.book:hover .book__title { color: var(--accent); }
.book__wolf { grid-area: wolf; width: 72px; height: 72px; object-fit: contain; position: relative; }
.book__title { grid-area: title; font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--heading); line-height: 1.3; transition: color var(--dur) var(--ease); }
.book__sub { grid-area: sub; color: var(--text-dim); font-size: 14px; }
.book__size { grid-area: size; font-family: var(--font-display); font-size: 12px; color: var(--text-faint); letter-spacing: 0.04em; margin-top: 4px; }
@media (min-width: 600px) {
  .book { grid-template-columns: 88px minmax(0, 1fr) auto; grid-template-areas: "wolf title size" "wolf sub size"; padding: 22px 24px; }
  .book__wolf { width: 88px; height: 88px; }
  .book__size { margin: 0; align-self: center; padding: 6px 10px; border: 1px solid var(--line-hover); border-radius: var(--radius-sm); }
}
.dl-section { margin: 0 0 30px; max-width: 76ch; }
.dl-section h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.dl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.dl-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 14.5px;
}
.dl-list li:last-child { border-bottom: 0; }
.dl-list a { color: var(--text); flex: 1 1 auto; min-width: 0; transition: color var(--dur) var(--ease); }
.dl-list a:hover { color: var(--accent); text-decoration: none; }
.dl-list span { flex: none; font-family: var(--font-display); font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

/* ---------- Glossary ---------- */
.glossary { max-width: 76ch; }
.glossary__controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 18px;
  position: sticky;
  top: var(--topbar-h);
  z-index: 5;
  background: var(--bg);
  padding: 12px 0;
  margin-top: -12px;
}
.glossary__search {
  width: 100%;
  min-height: 44px;
  padding: 0 14px 0 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-hover);
  background: var(--surface);
  color: var(--heading);
  font-size: 15px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238B96AB' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='M20 20l-3.5-3.5'/></svg>");
  background-repeat: no-repeat;
  background-position: 13px center;
  transition: border-color var(--dur) var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
.glossary__search::placeholder { color: var(--text-faint); }
.glossary__search:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.glossary__search::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.glossary__row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.glossary__toggle {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  gap: 2px;
}
.glossary__toggle button, .glossary__toggle label {
  padding: 6px 12px;
  border-radius: 4px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.glossary__toggle button:hover { color: var(--heading); }
.glossary__toggle button.is-active, .glossary__toggle button[aria-pressed="true"], .glossary__toggle input:checked + label {
  color: #04110F;
  background: var(--accent);
}
.glossary__toggle input { position: absolute; opacity: 0; pointer-events: none; }
.glossary__count { font-family: var(--font-display); font-size: 12.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.glossary__letters {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.glossary__letters a, .glossary__letters button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 4px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-dim);
  border: 1px solid transparent;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.glossary__letters a:hover, .glossary__letters button:hover { color: var(--heading); border-color: var(--line-hover); text-decoration: none; }
.glossary__letters .is-active { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.glossary__letters .is-empty, .glossary__letters [aria-disabled="true"] { color: rgba(102, 123, 153, 0.4); pointer-events: none; }
.glossary__list { list-style: none; margin: 0; padding: 0; }
.glossary__letter {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--accent);
  margin: 28px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: calc(var(--topbar-h) + 140px);
}
.glossary__list > .glossary__letter:first-child { margin-top: 8px; }
.term {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: calc(var(--topbar-h) + 140px);
}
.term:last-child { border-bottom: 0; }
.term__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--heading);
  margin: 0 0 4px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.term__name mark, .term__def mark { background: var(--accent-soft); color: var(--accent); padding: 0 0.2em; border-radius: 3px; }
.term__tag {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
}
.term__def { color: var(--text); font-size: 15px; line-height: 1.6; margin: 0; }
.term__def p { margin: 0; }
.term__def p + p { margin-top: 8px; }
.term__def strong { color: var(--heading); }
.glossary__empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-dim);
  border: 1px dashed var(--line-hover);
  border-radius: var(--radius);
  font-size: 15px;
}
.glossary__empty strong { color: var(--heading); font-family: var(--font-display); }
@media (min-width: 600px) {
  .glossary__letters a, .glossary__letters button { min-width: 26px; }
}

/* ---------- Player ---------- */
.player {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 90;
  height: var(--player-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 var(--gutter);
  background: var(--surface);
  border-top: 1px solid var(--line-hover);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.player__btn {
  flex: none;
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.player__btn:hover { color: var(--heading); background: rgba(255, 255, 255, 0.05); }
.player__play {
  width: 40px; height: 40px;
  background: var(--accent);
  color: #04110F;
  font-size: 14px;
}
.player__play:hover { background: #1AF0DA; color: #04110F; }
.player__meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 0 6px;
}
.player__title {
  color: var(--heading);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.player__title:hover { color: var(--accent); text-decoration: none; }
.player__time {
  font-family: var(--font-display);
  font-size: 11.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.player__seek {
  flex: 0 1 360px;
  min-width: 80px;
  height: 20px;
  margin: 0 6px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  --fill: 0%;
}
.player__seek::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--fill), rgba(255, 255, 255, 0.1) var(--fill));
}
.player__seek::-moz-range-track { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); }
.player__seek::-moz-range-progress { height: 3px; border-radius: 2px; background: var(--accent); }
.player__seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px; height: 12px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent);
  transition: transform var(--dur) var(--ease);
}
.player__seek::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent);
}
.player__seek:hover::-webkit-slider-thumb { transform: scale(1.2); }
.player__seek:focus-visible { outline: none; }
.player__seek:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent); }
.player__rate {
  flex: none;
  min-height: 30px;
  padding: 0 24px 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12.5px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238B96AB' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.player__rate:hover { border-color: var(--line-hover); color: var(--heading); }
.player__rate option { background: var(--surface); color: var(--text); }
@media (max-width: 599.98px) {
  .player { gap: 4px; }
  .player__seek { display: none; }
  .player__rate { display: none; }
  .player__time { font-size: 11px; }
}
@media (min-width: 600px) and (max-width: 899.98px) {
  .player__seek { flex: 1 1 120px; }
  .player__meta { flex: 1 1 160px; }
}

/* ---------- Search modal ---------- */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh var(--gutter) 24px;
  background: rgba(3, 6, 12, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms var(--ease);
}
.search-modal.is-open { display: flex !important; opacity: 1; pointer-events: auto; }
.search-modal__box {
  width: 100%;
  max-width: 640px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line-hover);
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  transform: translateY(-8px);
  transition: transform 180ms var(--ease);
}
.search-modal.is-open .search-modal__box { transform: translateY(0); }
.search-modal__input {
  width: 100%;
  min-height: 56px;
  padding: 0 18px 0 48px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--heading);
  font-size: 17px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2300E6CF' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='M20 20l-3.5-3.5'/></svg>");
  background-repeat: no-repeat;
  background-position: 17px center;
  -webkit-appearance: none;
  appearance: none;
}
.search-modal__input:focus { outline: none; }
.search-modal__input::placeholder { color: var(--text-faint); }
.search-modal__input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-modal__results {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  flex: 1 1 auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}
.search-modal__results:empty { padding: 0; }
.search-result { margin: 0; }
.search-result a, .search-result > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "title meta" "sub meta";
  column-gap: 14px;
  row-gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  transition: background var(--dur) var(--ease);
}
.search-result a:hover, .search-result.is-active a, .search-result[aria-selected="true"] a { background: var(--surface-2); text-decoration: none; }
.search-result.is-active .search-result__title, .search-result a:hover .search-result__title { color: var(--accent); }
.search-result__title { grid-area: title; font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--heading); line-height: 1.3; }
.search-result__sub { grid-area: sub; color: var(--text-dim); font-size: 13px; line-height: 1.45; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.search-result__meta { grid-area: meta; align-self: center; font-family: var(--font-display); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); white-space: nowrap; }
.search-result mark { background: var(--accent-soft); color: var(--accent); padding: 0 0.05em; border-radius: 3px; }
.search-modal__empty, .search-modal__hint {
  padding: 22px 18px;
  text-align: center;
  color: var(--text-faint);
  font-size: 14px;
}
.search-modal__hint kbd {
  font-family: var(--font-display);
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--line-hover);
  border-radius: 4px;
  color: var(--text-dim);
  background: var(--bg);
}

/* ---------- Footer ---------- */
.footer {
  flex: none;
  border-top: 1px solid var(--line);
  padding: 22px var(--gutter);
  text-align: center;
}
.footer__legal {
  margin: 0;
  color: var(--text-faint);
  font-size: 13px;
  letter-spacing: 0.01em;
  line-height: 1.6;
}

/* ---------- Misc utilities ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-hover);
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.chip--accent { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.chip--gate { color: #C4A6F5; border-color: var(--accent-2-line); background: var(--accent-2-soft); }
.chip--done { color: var(--green); border-color: rgba(48, 196, 141, 0.4); background: rgba(48, 196, 141, 0.08); }
.empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-dim);
  border: 1px dashed var(--line-hover);
  border-radius: var(--radius);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ---------- Print ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #f3f4f6; --line: #d1d5db; --line-hover: #9ca3af; --text: #111; --text-dim: #444; --text-faint: #666; --heading: #000; --accent: #047a70; --blue: #1d4ed8; --accent-2: #5b21b6; }
  body { background: #fff; color: #111; padding-bottom: 0 !important; display: block; font-size: 11pt; }
  .skip, .topbar, .sidebar, .queue, .player, .search-modal, .lesson__actions, .toc, .pager, .doclist__queue, .hero::before, body::after { display: none !important; }
  .layout { display: block; max-width: none; }
  .main { padding: 0; }
  .lesson, .prose { max-width: none; }
  .prose { font-size: 11pt; line-height: 1.5; }
  .prose h2 { border-top-color: #d1d5db; page-break-after: avoid; }
  .prose h3 { page-break-after: avoid; }
  .prose mark { background: #e6fffb; color: #047a70; }
  .callout, .check, .table-wrap { border-color: #9ca3af; page-break-inside: avoid; background: #fff; }
  .callout::before { background: #9ca3af; }
  .check__answers { display: block; }
  .check__answers summary { display: none; }
  .check__answers > :not(summary) { display: block; }
  .table-wrap { overflow: visible; max-height: none; }
  .prose thead th { position: static; background: #f3f4f6; color: #000; }
  .prose a { color: #111; text-decoration: none; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; color: #666; }
  .footer { border-top: 1px solid #d1d5db; padding: 12pt 0 0; }
  .footer__legal { color: #666; }
}
