body.learn-page {
  /* Inherit the house ink + blue radial backdrop (research-notes.css) -- do not flatten it. */
  background-color: var(--bg);
}

/* Match the house heading register + center page content like the hub.
   Headers (hero/track/lesson) center; long body copy stays left for reading. */
body.learn-page h1 { letter-spacing: -0.015em; }
.learn-hero,
.track-header,
.lesson-header { text-align: center; }
.learn-hero .eyebrow, .learn-hero .lead,
.track-header .eyebrow, .track-header .lead,
.lesson-header .summary { text-align: center; }
.learn-hero h1, .track-header h1, .lesson-header h1,
.learn-hero .lead, .track-header .lead, .lesson-header .summary {
  margin-left: auto;
  margin-right: auto;
}
.learn-hero .hero-actions,
.learn-hero .hero-search,
.lesson-meta,
.track-header .mastery-row { justify-content: center; }

/* A cozy, centered reading column for the whole lesson. */
.lesson-view { max-width: 768px; margin: 0 auto; }

.learn-shell {
  max-width: 920px;
}

.learn-top {
  align-items: center;
}

/* Center every item in the right cluster on one line, so the search icon and
   the account control sit on the text links' centerline (not stretched). */
.learn-top .links { align-items: center; }

.learn-top .crumb {
  color: var(--accent);
  text-decoration: none;
}

.learn-top a.crumb:hover {
  color: var(--text-strong);
  text-decoration: underline;
}

.learn-loading,
.empty-state {
  color: var(--text-2);
}

.learn-hero,
.track-header {
  padding: 42px 0 24px;
}

.learn-hero h1,
.track-header h1,
.lesson-header h1 {
  max-width: 760px;
  margin: 6px auto 16px;
  font-size: 48px;
  line-height: 1.04;
}

.eyebrow,
.card-kicker {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lead,
.summary {
  max-width: 760px;
  color: var(--text-2);
  font-size: 19px;
  line-height: 1.55;
}

.hero-actions,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.button,
button.button,
.option-button,
.code-line {
  min-height: 44px;
  border: 1px solid var(--border-accent);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
}

.button:hover,
.option-button:hover,
.code-line:hover {
  border-color: var(--accent);
  background: rgba(42, 149, 234, 0.1);
  color: var(--text-strong);
  text-decoration: none;
}

.button.primary,
button.button.primary {
  border-color: rgba(42, 149, 234, 0.64);
  background: var(--accent);
  color: #14141a;
}

.button.primary:hover {
  background: var(--accent-bright);
  color: #14141a;
}

button:disabled,
.button:disabled,
.option-button:disabled,
.code-line:disabled {
  cursor: not-allowed;
  opacity: 0.78;
}

.learn-section {
  margin: 46px 0 0;
}

.learn-section.tight {
  margin-top: 34px;
}

.learn-section h2,
.completion-panel h2 {
  margin: 0 0 14px;
  padding-top: 0;
  font-size: 30px;
}

.learn-section h3,
.quiz-question h3,
.path-grid h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.18;
}

.level-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  list-style: none;
  margin: 0;
}

.legend-item {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-2);
}

.level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex: none;
  width: 132px;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.level-beginner {
  color: #8bd3a8;
  background: rgba(139, 211, 168, 0.1);
}

.level-intermediate {
  color: #5aabf6;
  background: rgba(90, 171, 246, 0.12);
}

.level-advanced {
  color: #a99bf0;
  background: rgba(169, 155, 240, 0.12);
}

.level-expert {
  color: #d996b2;
  background: rgba(217, 150, 178, 0.1);
}

.track-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

/* Track-card styling lives at the END of this file ("Editorial edge" design):
   an interactive card with an accent left-edge + always-visible state-aware CTA. */

/* Center the resume card content so it does not cluster at the left of a wide card. */
.continue-card { text-align: center; }
.continue-card .continue-meta { justify-content: center; }

.card-meta,
.progress-row,
.deck-status,
.quiz-status,
.question-meta,
.lesson-meta,
.resource-meta,
.lesson-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--text-muted);
  font-size: 13px;
}

.card-meta {
  margin-top: auto;
}

.progress-block {
  width: 100%;
  margin-top: 4px;
}

.progress-row {
  justify-content: space-between;
}

.progress-track {
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid rgba(42, 149, 234, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.lesson-list,
.resource-list {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
}

.lesson-row,
.resource-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.lesson-row > a {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.lesson-row > a:hover strong,
.resource-title a:hover {
  color: var(--accent-bright);
}

.lesson-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(42, 149, 234, 0.28);
  border-radius: 8px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
}

.lesson-summary {
  display: block;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.45;
}

.completion-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.completion-pill.is-complete {
  border-color: rgba(139, 211, 168, 0.5);
  color: #8bd3a8;
}

.back-link {
  display: inline-flex;
  margin-bottom: 20px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent-bright);
}

.lesson-header {
  padding: 26px 0 16px;
}

.lesson-meta {
  margin-bottom: 12px;
}

.lesson-body {
  max-width: 760px;
}

.lesson-body p + p {
  margin-top: var(--space-flow);
}

.key-points {
  display: grid;
  max-width: 760px;
  gap: 10px;
  margin: 0;
  list-style: none;
}

.key-points li {
  padding: 14px 18px;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: rgba(42, 149, 234, 0.08);
}

.exercise-card,
.quiz-question {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.exercise-card > p:first-child {
  margin-bottom: 14px;
}

.code-pick,
.option-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.code-line {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 0;
  overflow: hidden;
  text-align: left;
}

.line-number {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 44px;
  border-right: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 13px;
}

.code-line code {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px 8px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.option-button {
  width: 100%;
  padding: 12px 14px;
  text-align: left;
}

.is-correct,
.is-answer {
  border-color: rgba(139, 211, 168, 0.78) !important;
  background: rgba(139, 211, 168, 0.12) !important;
}

.is-incorrect {
  border-color: rgba(230, 118, 118, 0.78) !important;
  background: rgba(230, 118, 118, 0.12) !important;
}

.feedback-line {
  margin-top: 12px;
  color: var(--text-2);
  font-size: 15px;
}

.feedback-line.good {
  color: #8bd3a8;
}

.feedback-line.bad {
  color: #e69090;
}

.prompt-repair {
  display: grid;
  gap: 10px;
  margin: 0;
}

.prompt-repair div {
  display: grid;
  gap: 4px;
}

.prompt-repair dt {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.prompt-repair dd {
  margin: 0;
  color: var(--text-2);
}

.trace-list {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.trace-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.12);
}

.trace-card input {
  grid-row: span 7;
  margin-top: 4px;
}

.trace-step {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.trace-card strong {
  color: var(--text-strong);
  font-size: 13px;
}

.trace-card code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.choice-field {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.choice-field legend {
  width: 100%;
  margin-bottom: 2px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.choice-field label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.deck-status,
.quiz-status {
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.flashcard {
  display: grid;
  width: 100%;
  min-height: 220px;
  padding: 20px;
  border: 1px solid rgba(42, 149, 234, 0.36);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text);
  text-align: left;
}

.flashcard:hover {
  border-color: var(--accent);
  background: #25252f;
}

.flashcard-label,
.flashcard-source {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.flashcard-face {
  align-self: center;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.18;
}

.flashcard-source {
  align-self: end;
}

.quiz-list {
  display: grid;
  gap: 12px;
}

.quiz-question h3 {
  margin: 10px 0 12px;
}

.question-meta {
  justify-content: space-between;
}

.resource-item {
  align-items: start;
}

.resource-title a {
  color: var(--text-strong);
  font-weight: 700;
  text-decoration: none;
}

.resource-item p {
  margin-top: 4px;
  color: var(--text-2);
  font-size: 15px;
}

.resource-meta {
  justify-content: flex-end;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 20px 0 34px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.filter-bar label {
  display: grid;
  min-width: 220px;
  gap: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.filter-bar select {
  min-height: 42px;
  border: 1px solid var(--border-accent);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  text-transform: none;
}

.mode-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 12px;
  margin: 12px 0 28px;
}

.mode-tabs a {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.mode-tabs a:hover,
.mode-tabs a.is-active {
  border-color: var(--accent);
  color: var(--text-strong);
  background: rgba(42, 149, 234, 0.1);
}

.mode-tabs span {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
}

.path-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: 760px;
}

.path-grid > div {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.path-grid ul {
  margin: 8px 0 0 18px;
}

.path-grid p {
  margin-top: 8px;
  color: var(--text-2);
}

.completion-panel {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin: 42px 0 32px;
  padding: 18px;
  border: 1px solid rgba(42, 149, 234, 0.28);
  border-radius: 8px;
  background: rgba(42, 149, 234, 0.08);
}

.completion-panel p {
  color: var(--text-2);
}

@media (max-width: 760px) {
  .learn-shell {
    padding: 0 20px;
  }

  /* Mobile top-nav is handled by the shared hamburger in research-notes.css. */

  .learn-hero,
  .track-header {
    padding-top: 28px;
  }

  .learn-hero h1,
  .track-header h1,
  .lesson-header h1 {
    font-size: 38px;
  }

  .lead,
  .summary {
    font-size: 17px;
  }

  .level-legend,
  .path-grid {
    grid-template-columns: 1fr;
  }

  .legend-item {
    grid-template-columns: 1fr;
  }

  .lesson-row,
  .resource-item {
    grid-template-columns: 1fr;
  }

  .lesson-row-meta,
  .resource-meta {
    justify-content: flex-start;
  }

  .completion-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-bar label {
    min-width: 100%;
  }

  .flashcard-face {
    font-size: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .button,
  button.button,
  .option-button,
  .code-line,
  .flashcard {
    transition: none;
  }

  .flashcard-face {
    animation: none;
  }
}

/* Search, prereqs, and flip motion (goal-loop round 1) */
.hero-search {
  display: flex;
  gap: 8px;
  margin: 18px auto 6px;
  max-width: 540px;
}

.hero-search input[type="search"],
.search-field input[type="search"] {
  flex: 1;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 15px;
}

.hero-search input[type="search"]:focus-visible,
.search-field input[type="search"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.search-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.search-field > span {
  color: var(--text-muted);
  font-size: 13px;
}

.search-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--text-muted);
  font-size: 13px;
}

.count-chip {
  display: inline-block;
  min-width: 22px;
  margin-left: 8px;
  padding: 1px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
}

.card-prereq {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.card-prereq-start {
  color: var(--accent);
}

.flashcard-face {
  animation: flashcard-flip 0.32s ease;
}

@keyframes flashcard-flip {
  from {
    opacity: 0;
    transform: rotateX(35deg) translateY(-6px);
  }
  to {
    opacity: 1;
    transform: rotateX(0) translateY(0);
  }
}

@media (max-width: 760px) {
  .hero-search {
    flex-direction: column;
    max-width: 100%;
  }
}

/* Search results + deck completion (goal-loop round 2) */
.search-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.search-row {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.search-row > a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.search-row .search-text {
  display: grid;
  gap: 3px;
}

.search-row > a:hover strong {
  color: var(--accent-bright);
}

.deck-complete {
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 1px solid rgba(139, 211, 168, 0.4);
  border-radius: 12px;
  background: rgba(139, 211, 168, 0.08);
  text-align: center;
}

.deck-complete .card-actions {
  justify-content: center;
}

.source-meta {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
}

@media (max-width: 760px) {
  .search-row > a {
    grid-template-columns: 1fr;
  }
}

/* v2: interactive widgets + diagrams */
.lesson-diagram {
  margin: 22px 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-2);
}
.lesson-diagram svg { width: 100%; height: auto; display: block; }

.metric-lab .metric-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.metric-lab .metric-inputs label { display: grid; gap: 4px; }
.metric-lab .metric-inputs span { font-size: 13px; color: var(--text-muted); }
.metric-lab input[type="number"] {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--mono);
}
.metric-readout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  margin: 14px 0;
}
.metric-readout > div {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.metric-readout dt { color: var(--text-muted); font-size: 13px; margin: 0; }
.metric-readout dd { margin: 0; font-family: var(--mono); color: var(--text-strong); }
.metric-readout .metric-headline { border-color: rgba(42, 149, 234, 0.5); background: rgba(42, 149, 234, 0.08); }
.metric-readout .metric-headline dd { color: var(--accent); }
.metric-task, .sampling-lab .metric-task { margin: 10px 0; color: var(--text-2); }

.sampling-control { display: grid; gap: 6px; margin: 12px 0; }
.sampling-control input[type="range"] { width: 100%; accent-color: var(--accent); }
.sampling-bars { display: grid; gap: 8px; margin: 12px 0; }
.sampling-row { display: grid; grid-template-columns: 90px 1fr 48px; gap: 10px; align-items: center; }
.sampling-label { font-family: var(--mono); font-size: 13px; color: var(--text); }
.sampling-bar { height: 14px; background: rgba(255, 255, 255, 0.06); border-radius: 7px; overflow: hidden; }
.sampling-bar > span { display: block; height: 100%; background: var(--accent); transition: width 0.15s ease; }
.sampling-pct { font-family: var(--mono); font-size: 13px; color: var(--text-2); text-align: right; }

.ordering-list { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 8px; counter-reset: ord; }
.ordering-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}
.ordering-controls { display: inline-flex; gap: 4px; }
.ordering-move { padding: 2px 10px; font-family: var(--mono); min-width: 0; }
.ordering-text { color: var(--text); }

@media (max-width: 760px) {
  .metric-lab .metric-inputs, .metric-readout { grid-template-columns: 1fr; }
  .sampling-row { grid-template-columns: 72px 1fr 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .sampling-bar > span { transition: none; }
}

/* v3: new labs, capstones, nav */
.lab-controls { display: grid; gap: 12px; margin: 14px 0; }
.lab-controls label { display: grid; gap: 5px; }
.lab-controls label span { font-size: 13px; color: var(--text-muted); }
.lab-controls input[type="range"] { width: 100%; accent-color: var(--accent); }
.lab-controls label span strong, .rag-sandbox label span strong { color: var(--text-strong); font-family: var(--mono); }

/* bootstrap lab */
.boot-resamples { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.boot-resamples > span { font-size: 13px; color: var(--text-muted); }
.boot-resamples .button { padding: 4px 12px; min-width: 0; }
.boot-resamples .button.is-active { border-color: var(--accent); background: rgba(42, 149, 234, 0.14); color: var(--accent-bright); }
.boot-readout { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 14px; margin: 14px 0; }
.boot-readout > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; }
.boot-readout dt { color: var(--text-muted); font-size: 12px; margin: 0; }
.boot-readout dd { margin: 0; font-family: var(--mono); color: var(--text-strong); }
.boot-readout .metric-headline { border-color: rgba(42, 149, 234, 0.5); background: rgba(42, 149, 234, 0.08); }
.boot-readout .metric-headline dd { color: var(--accent); }
.histo { display: flex; align-items: flex-end; gap: 2px; height: 90px; margin: 10px 0 4px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: rgba(255, 255, 255, 0.02); }
.histo-bar { flex: 1 1 0; background: var(--accent); opacity: 0.75; border-radius: 2px 2px 0 0; min-height: 2px; }
.histo-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); font-family: var(--mono); margin: 0 4px; }
.histo-axis span:nth-child(2) { font-family: var(--sans, inherit); }

/* roc lab */
.roc-grid { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 18px; align-items: center; margin: 12px 0; }
.roc-plot { width: 100%; height: auto; color: var(--text-muted); border: 1px solid var(--border); border-radius: 8px; background: rgba(255, 255, 255, 0.02); }
.roc-readout { display: grid; gap: 6px; margin: 0; }
.roc-readout > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; }
.roc-readout dt { color: var(--text-muted); font-size: 12px; margin: 0; }
.roc-readout dd { margin: 0; font-family: var(--mono); color: var(--text-strong); }
.roc-readout .metric-headline { border-color: rgba(42, 149, 234, 0.5); background: rgba(42, 149, 234, 0.08); }
.roc-readout .metric-headline dd { color: var(--accent); }

/* rag sandbox */
.rag-query { display: grid; gap: 5px; margin: 12px 0; }
.rag-query span { font-size: 13px; color: var(--text-muted); }
.rag-query input[type="text"] { padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elevated); color: var(--text); font-family: var(--mono); }
.rag-stat { color: var(--text-2); font-size: 13px; margin: 6px 0; }
.rag-chunks { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.rag-chunk { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: rgba(255, 255, 255, 0.02); opacity: 0.7; }
.rag-chunk.is-retrieved { opacity: 1; border-color: rgba(42, 149, 234, 0.5); background: rgba(42, 149, 234, 0.07); }
.rag-chunk-meta { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--text-muted); font-family: var(--mono); margin-bottom: 4px; }
.rag-score { color: var(--text-2); }
.rag-tag { color: var(--accent-bright); border: 1px solid rgba(42, 149, 234, 0.5); border-radius: 999px; padding: 0 8px; }
.rag-chunk-text { display: block; color: var(--text); }

/* context budget */
.budget-bar { display: flex; width: 100%; height: 22px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin: 14px 0 10px; background: rgba(255, 255, 255, 0.03); }
.budget-seg { height: 100%; }
.budget-output { background: #8bd3a8; }
.budget-system { background: #5aabf6; }
.budget-retrieved { background: #67c2bf; }
.budget-history { background: #a99bf0; }
.budget-headroom { background: repeating-linear-gradient(45deg, rgba(255,255,255,0.05), rgba(255,255,255,0.05) 5px, transparent 5px, transparent 10px); }
.budget-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 6px 0; font-size: 12px; color: var(--text-2); }
.budget-key { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); }
.budget-key i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.budget-key em { color: var(--text-muted); font-style: italic; }
.budget-status { margin: 8px 0; font-size: 13px; }
.budget-status.good { color: #8bd3a8; }
.budget-status.bad { color: #e0a08a; }

/* capstone */
.capstone-scenario { padding: 14px 16px; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 6px; background: rgba(255, 255, 255, 0.02); margin: 0 0 14px; color: var(--text-2); }
.capstone-scenario pre, .capstone-scenario code { font-family: var(--mono); font-size: 13px; }
.capstone-progress { display: flex; align-items: center; gap: 6px; margin: 6px 0 12px; }
.capstone-dot { width: 10px; height: 10px; border-radius: 999px; border: 1px solid var(--border-accent); background: transparent; }
.capstone-dot.is-done { background: #8bd3a8; border-color: #8bd3a8; }
.capstone-dot.is-current { border-color: var(--accent); background: var(--accent); }
.capstone-count { margin-left: 8px; font-size: 12px; color: var(--text-muted); font-family: var(--mono); }
.capstone-q { margin: 6px 0 12px; }
.capstone-done { display: grid; gap: 12px; padding: 18px; border: 1px solid rgba(139, 211, 168, 0.4); border-radius: 12px; background: rgba(139, 211, 168, 0.08); }
.capstone-outcome { color: var(--text-2); margin: 0; }

/* continue card */
.continue-card { display: grid; gap: 6px; margin: 0 0 8px; padding: 22px 26px; border: 1px solid rgba(42, 149, 234, 0.4); border-radius: 12px; background: rgba(42, 149, 234, 0.07); text-decoration: none; color: var(--text); transition: border-color 0.15s ease, background 0.15s ease; }
.continue-card:hover { border-color: var(--accent); background: rgba(42, 149, 234, 0.12); }
.continue-label { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); }
.continue-title { font-family: var(--serif); font-size: 20px; color: var(--text-strong); }
.continue-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }

/* lesson index */
.index-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.index-row { border: 1px solid var(--border); border-radius: 8px; background: rgba(255, 255, 255, 0.02); }
.index-row > a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 18px; color: var(--text); text-decoration: none; }
.index-text { display: grid; gap: 3px; }
.index-row > a:hover strong { color: var(--accent-bright); }
.index-meta { display: inline-flex; align-items: center; gap: 8px; }

/* per-track mastery */
.mastery-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.mastery-chip { font-size: 12px; font-family: var(--mono); color: var(--text-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 12px; }
.mastery-chip strong { color: var(--text-strong); }
.mastery-chip.is-mastered { border-color: rgba(139, 211, 168, 0.5); background: rgba(139, 211, 168, 0.1); color: #8bd3a8; }

/* per-claim sources */
.source-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.source-row { display: grid; gap: 3px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 8px; background: rgba(255, 255, 255, 0.02); }
.source-claim { color: var(--text-2); }
.source-cite { font-size: 13px; }
.source-cite a { color: var(--accent); }
.source-date { color: var(--text-muted); font-family: var(--mono); font-size: 12px; margin-left: 6px; }

@media (max-width: 760px) {
  .boot-readout { grid-template-columns: 1fr; }
  .roc-grid { grid-template-columns: 1fr; }
  .index-row > a { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .continue-card { transition: none; }
}


/* Visual polish: trim card padding on small screens so content keeps its width. */
@media (max-width: 760px) {
  .track-card,
  .exercise-card,
  .quiz-question,
  .continue-card { padding: 18px; }
}

/* ---- Flatten content cards: text flows on the page; interactive controls,
   widget readouts, chips, and the capstone scenario keep their framing.
   NOTE: .track-card is intentionally NOT flattened -- it is a real interactive
   card (see the "Editorial edge" block at the end of this file). ---- */
.lesson-row,
.resource-item,
.exercise-card,
.quiz-question,
.continue-card,
.legend-item,
.index-row,
.source-row,
.search-row,
.path-grid > div,
.lesson-diagram,
.key-points li,
.lesson-index {
  border: none;
  background: none;
  box-shadow: none;
}

.lesson-row,
.resource-item,
.search-row { padding: 12px 0; }
.exercise-card,
.quiz-question,
.path-grid > div,
.lesson-diagram { padding: 0; }
.continue-card { padding: 8px 0; }
.legend-item { min-height: 0; padding: 6px 0; }
.index-row > a { padding: 12px 0; }
.source-row { padding: 8px 0; }
.lesson-index { color: var(--accent); }

/* Key points: a clean bulleted list instead of a stack of boxes. */
.key-points { display: block; list-style: disc; padding-left: 22px; }
.key-points li { margin-bottom: 8px; padding: 0; border-radius: 0; }

/* Hover feedback without a card box. The global a:hover underline would draw
   across all three lines, so suppress it on the card and underline only the
   title (the middle line, which is the actual link target). */
.continue-card:hover { background: none; text-decoration: none; }
.continue-card:hover .continue-title {
  color: var(--accent-bright);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* Air between flattened rows and questions. */
.quiz-list { gap: 30px; }
.lesson-list,
.resource-list,
.index-list { gap: 4px; }

/* Flatten the last content boxes: lesson completion panel, deck-complete panel.
   The capstone scenario keeps only a left rule so the reviewed artifact stays set off. */
.completion-panel,
.deck-complete {
  border: none;
  background: none;
  box-shadow: none;
}
.capstone-scenario {
  border: none;
  border-left: 3px solid var(--accent);
  background: none;
}

/* The SPA programmatically focuses <main id="app"> on each route change for
   screen-reader announcements. Safari paints :focus-visible on that programmatic
   focus, drawing an accent outline around the whole content area. Suppress it --
   the focus is for assistive tech, not a visible affordance. Real controls keep
   their own focus rings. */
#app:focus,
#app:focus-visible {
  outline: none;
}

/* Google sign-in control in the nav (hidden until Firebase is configured).
   Reads as part of the nav, not a CTA: signed-in is a quiet identity cluster
   (avatar + first name + text-link sign-out) corralled by a hairline divider;
   signed-out is a light ghost pill. */
.nav-auth { display: inline-flex; align-items: center; }
.nav-auth:empty { display: none; }

/* Hairline divider sets the identity cluster off from the link row. The token
   --border (0.06 white) is too faint against the nav, so a touch stronger. */
.nav-account {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding-left: 24px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #14141a;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.nav-account-name {
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
  max-width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-signout {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.18s ease;
}
.nav-signout:hover { color: var(--accent); }

.nav-signin {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: 1px solid var(--border-accent);
  border-radius: 999px;
  padding: 7px 16px;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.nav-signin:hover {
  color: var(--text-strong);
  border-color: var(--accent);
  background: rgba(42, 149, 234, 0.1);
}

/* In the collapsed mobile menu the auth control is a full-width row at the
   bottom of the dropdown; the divider flips from a left edge to a top rule. */
@media (max-width: 760px) {
  nav.top .links .nav-auth {
    display: flex;
    width: 100%;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }
  nav.top .links .nav-account {
    width: 100%;
    justify-content: center;
    padding: 4px 12px;
    border-left: 0;
  }
  nav.top .links .nav-signin {
    display: block;
    width: 100%;
    text-align: center;
  }
}

/* Nav search: a magnifying-glass toggle that drops a live search panel. */
.nav-search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  padding: 6px;
  color: var(--text-2);
  cursor: pointer;
  border-radius: 8px;
  transition: color 0.18s ease;
}
.nav-search-toggle:hover { color: var(--accent); }
.nav-search-toggle svg { display: block; }
.nav-search-label { display: none; }

.nav-search-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 70;
  width: min(360px, calc(100vw - 32px));
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
}
.nav-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-accent);
  border-radius: 8px;
}
.nav-search-input:focus { outline: none; border-color: var(--accent); }
.nav-search-results { margin-top: 8px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.nav-search-hint { color: var(--text-muted); font-size: 13px; padding: 8px 6px; margin: 0; }
.nav-search-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
}
.nav-search-row:hover { background: rgba(255, 255, 255, 0.05); text-decoration: none; }
.nav-search-row-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-search-row-meta { flex: none; font-size: 12px; color: var(--text-muted); }
.nav-search-all {
  display: block;
  margin-top: 4px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  border-top: 1px solid var(--border);
}
.nav-search-all:hover { color: var(--accent-bright); }

/* Research route (the notes list, rolled into the app). */
.research-byline { color: var(--text-2); font-size: 15px; margin-top: 6px; text-align: center; }
.research-byline a { color: var(--accent); text-decoration: none; }
.research-byline a:hover { text-decoration: underline; }
.research-foot { color: var(--text-2); font-size: 14px; margin-top: 22px; line-height: 1.6; }
.research-foot a { color: var(--accent); text-decoration: none; }
.research-foot a:hover { text-decoration: underline; }
.research-foot code { font-family: var(--mono); font-size: 0.9em; }

.learn-foot { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border); text-align: center; }
.learn-foot a { color: var(--text-muted); font-size: 14px; text-decoration: none; }
.learn-foot a:hover { color: var(--accent); text-decoration: underline; }

/* Notes list inside the research route: left-aligned rows, code link on the
   right -- matching the app's resource/lesson rows, not the centered cards
   the landing styles would otherwise impose. */
#research-list .notes-list { text-align: left; }
#research-list .notes-list ul { display: grid; gap: 10px; list-style: none; margin: 0; padding: 0; }
#research-list .notes-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  text-align: left;
}
#research-list .note-title { text-align: left; }
#research-list .notes-list li:hover { border-color: var(--border-accent); }
#research-list .note-title { color: var(--text-strong); font-weight: 600; text-decoration: none; }
#research-list .note-title:hover { color: var(--accent-bright); text-decoration: none; }
#research-list .note-code {
  flex: none;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
}
#research-list .note-code:hover { color: var(--accent); text-decoration: none; }

@media (max-width: 760px) {
  /* In the collapsed menu the search toggle reads as a labelled row. */
  .nav-search-label { display: inline; }
  nav.top .links .nav-search-toggle {
    width: 100%;
    justify-content: center;
    gap: 10px;
    padding: 11px 12px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-2);
  }
  .nav-search-panel { width: auto; left: 12px; right: 12px; }
}

/* ============================================================
   Track cards, "Editorial edge".
   An interactive card: a quiet ink panel with a house accent
   left-edge (the .capstone-scenario border-left idiom), a bottom-
   pinned progress meter, and an ALWAYS-visible state-aware CTA pill
   (Start track / Continue / Review track). The a.track-card
   selectors (0,1,1) + later source order override the flatten block.
   ============================================================ */
a.track-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 232px;
  padding: 22px 24px 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: none;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

/* House accent left-edge: dim at rest, ignites on hover/focus. */
a.track-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--border-accent);
  transition: background 0.18s ease;
}

a.track-card:hover,
a.track-card:focus,
a.track-card:focus-visible { text-decoration: none; }

a.track-card:hover,
a.track-card:focus-visible {
  border-color: var(--border-accent);
  background: #25252f;
  transform: translateY(-2px);
}
a.track-card:hover::before,
a.track-card:focus-visible::before { background: var(--accent); }

a.track-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.tc-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tc-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  line-height: 1.14;
  color: var(--text-strong);
  text-wrap: balance;
  transition: color 0.18s ease;
}
a.track-card:hover .tc-title,
a.track-card:focus-visible .tc-title { color: var(--accent-bright); }

.tc-blurb {
  margin: 0;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.5;
}
.tc-prereq {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}
.tc-prereq--start { color: var(--accent-soft); }

/* foot: progress + CTA, pinned to the card base, aligned across the row */
.tc-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding-top: 6px;
}

.tc-progress { display: flex; flex-direction: column; gap: 6px; }
.tc-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.tc-pct { font-family: var(--mono); color: var(--text-2); }

.tc-bar {
  display: block;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}
.tc-bar-fill {
  display: block;
  height: 100%;
  width: var(--pct, 0%);
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.4s ease;
}

/* the always-visible CTA: a text link inside a soft accent pill */
.tc-cta {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 15px;
  border: 1px solid var(--border-accent);
  border-radius: 999px;
  background: rgba(42, 149, 234, 0.08);
  color: var(--accent-soft);
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.tc-cta::after {
  content: "";
  width: 13px;
  height: 13px;
  flex: none;
  background: currentColor;
  -webkit-mask: var(--tc-chevron) center / contain no-repeat;
          mask: var(--tc-chevron) center / contain no-repeat;
  transition: transform 0.18s ease;
}
a.track-card {
  --tc-chevron: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M5.5 3l5 5-5 5" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
}
a.track-card:hover .tc-cta,
a.track-card:focus-visible .tc-cta {
  border-color: var(--accent);
  background: rgba(42, 149, 234, 0.16);
  color: var(--text-strong);
}
a.track-card:hover .tc-cta::after { transform: translateX(3px); }

/* state: NEW (0%), pure invitation: drop the meter, louder CTA. */
a.track-card[data-state="new"] .tc-progress { display: none; }
a.track-card[data-state="new"] .tc-cta {
  border-color: rgba(42, 149, 234, 0.55);
  background: rgba(42, 149, 234, 0.14);
  color: var(--accent-bright);
}

/* state: DONE (100%), calm completion in the house green. */
a.track-card[data-state="done"]::before { background: rgba(139, 211, 168, 0.55); }
a.track-card[data-state="done"]:hover::before,
a.track-card[data-state="done"]:focus-visible::before { background: #8bd3a8; }
a.track-card[data-state="done"] .tc-bar-fill { background: #8bd3a8; }
a.track-card[data-state="done"] .tc-pct { color: #8bd3a8; }
a.track-card[data-state="done"] .tc-cta {
  border-color: rgba(139, 211, 168, 0.45);
  background: rgba(139, 211, 168, 0.10);
  color: #8bd3a8;
  --tc-chevron: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M3 8.5l3.5 3.5L13 4.5" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
}
a.track-card[data-state="done"]:hover .tc-cta,
a.track-card[data-state="done"]:focus-visible .tc-cta {
  border-color: #8bd3a8;
  background: rgba(139, 211, 168, 0.18);
  color: #a6e0bd;
}
a.track-card[data-state="done"]:hover .tc-cta::after { transform: none; }

@media (max-width: 760px) {
  a.track-card { min-height: 0; padding: 18px 18px 16px; }
  .tc-title { font-size: 23px; }
}
@media (max-width: 480px) {
  .tc-cta { align-self: stretch; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  a.track-card,
  a.track-card::before,
  a.track-card .tc-title,
  a.track-card .tc-cta,
  a.track-card .tc-cta::after,
  a.track-card .tc-bar-fill { transition: none; }
  a.track-card:hover,
  a.track-card:focus-visible { transform: none; }
  a.track-card:hover .tc-cta::after { transform: none; }
}

/* --- v4 explorable labs --- */
.lab-caveat { font-size: 0.82rem; color: var(--text-muted); font-style: italic; margin-top: 0.75rem; line-height: 1.5; }
.tokenizer-lab .tok-input { width: 100%; box-sizing: border-box; font-family: var(--mono); font-size: 0.95rem; padding: 0.6rem 0.7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); resize: vertical; }
.tok-modes { display: flex; gap: 0.4rem; margin: 0.7rem 0; }
.tok-mode { font: inherit; font-size: 0.85rem; padding: 0.3rem 0.85rem; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text-muted); cursor: pointer; text-transform: capitalize; }
.tok-mode.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tok-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 0.5rem 0; min-height: 2rem; }
.tok-chip { font-family: var(--mono); font-size: 0.85rem; padding: 2px 6px; border-radius: 5px; white-space: pre; color: var(--text-strong); }
.tok-chip.tc0 { background: rgba(42,149,234,0.16); } .tok-chip.tc1 { background: rgba(122,154,106,0.18); } .tok-chip.tc2 { background: rgba(181,128,58,0.18); }
.tok-chip.tc3 { background: rgba(160,106,181,0.18); } .tok-chip.tc4 { background: rgba(217,119,119,0.18); } .tok-chip.tc5 { background: rgba(91,179,179,0.18); }
.tok-empty { color: var(--text-muted); font-style: italic; }
.tok-stats { display: flex; gap: 1.4rem; flex-wrap: wrap; margin: 0.6rem 0 0.4rem; }
.tok-stats div { display: flex; flex-direction: column; }
.tok-stats dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.tok-stats dd { font-family: var(--mono); font-size: 1.1rem; color: var(--text-strong); margin: 0; }
.tok-bar { height: 6px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; }
.tok-bar span { display: block; height: 100%; background: var(--accent); transition: width 0.15s; }

/* attention lab */
.attn-examples { margin-bottom: 0.7rem; }
.attn-ex { font: inherit; font-size: 0.82rem; padding: 0.25rem 0.7rem; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text-muted); cursor: pointer; margin-right: 0.35rem; }
.attn-ex.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.attn-sentence { display: flex; flex-wrap: wrap; gap: 6px; margin: 0.6rem 0; font-size: 1.05rem; }
.attn-tok { font: inherit; font-size: 1rem; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; color: var(--text-strong); cursor: pointer; }
.attn-tok.query { outline: 2px solid var(--accent); font-weight: 600; }
.attn-hint { font-size: 0.85rem; color: var(--text-muted); margin: 0.3rem 0 0.6rem; }
.attn-bars { display: flex; flex-direction: column; gap: 3px; }
.attn-bar-row { display: grid; grid-template-columns: 5.5rem 1fr 2.5rem; align-items: center; gap: 0.5rem; font-size: 0.8rem; }
.attn-bar-lab { font-family: var(--mono); color: var(--text-muted); text-align: right; }
.attn-bar { height: 8px; background: var(--bg-elevated); border-radius: 4px; overflow: hidden; }
.attn-bar span { display: block; height: 100%; background: var(--accent); }
.attn-bar-val { font-family: var(--mono); color: var(--text-muted); }

/* injection lab */
.inj-task { background: var(--bg-elevated); border-radius: 8px; padding: 0.5rem 0.7rem; margin: 0.6rem 0; font-size: 0.9rem; }
.inj-field { margin: 0.6rem 0; }
.inj-label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 0.4rem; }
.inj-pick { font: inherit; font-size: 0.8rem; padding: 0.25rem 0.7rem; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text-muted); cursor: pointer; margin: 0 0.35rem 0.35rem 0; }
.inj-pick.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.inj-content { font-family: var(--mono); font-size: 0.82rem; background: var(--bg); border: 1px dashed var(--border); border-radius: 6px; padding: 0.5rem 0.6rem; white-space: pre-wrap; color: var(--text); margin-top: 0.4rem; }
.inj-guard { display: flex; align-items: flex-start; gap: 0.5rem; font-size: 0.86rem; color: var(--text); margin: 0.7rem 0; cursor: pointer; }
.inj-out { margin: 0.7rem 0 0; padding: 0.6rem 0.7rem; border-radius: 8px; font-size: 0.9rem; line-height: 1.5; }
.inj-out.safe { background: rgba(122,154,106,0.15); border: 1px solid rgba(122,154,106,0.45); }
.inj-out.breach { background: rgba(217,119,119,0.13); border: 1px solid rgba(217,119,119,0.45); }

/* embedding lab */
.emb-svg { width: 100%; max-width: 460px; height: auto; display: block; margin: 0.5rem auto; background: var(--bg-elevated); border-radius: 8px; }
.emb-pt { cursor: pointer; }
.emb-label { fill: var(--text); font-size: 10px; font-family: var(--sans); }
.emb-near { font-size: 0.9rem; color: var(--text); margin: 0.4rem 0; }
.emb-note { font-size: 0.85rem; color: var(--text-muted); margin: 0.3rem 0; }

/* --- Labs section --- */
.labs-hero { margin: 0 0 1.6rem; text-align: center; }
.labs-hero h1 { margin: 0 0 0.4rem; }
.labs-index .dek, .lab-detail .dek { color: var(--text-muted); max-width: 46rem; margin-left: auto; margin-right: auto; }
.lab-cat { margin: 1.8rem 0; }
.lab-cat h2 { font-size: 1.05rem; letter-spacing: 0.01em; margin: 0 0 0.8rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--border); }
.lab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; }
.lab-card { display: flex; flex-direction: column; gap: 0.4rem; padding: 1.05rem 1.1rem 1.15rem; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-card); text-decoration: none; color: var(--text); transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease; }
.lab-card:hover { transform: translateY(-3px); border-color: var(--border-accent); box-shadow: 0 10px 30px -18px rgba(0,0,0,0.5); }
.lab-card-kind { align-self: flex-start; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--accent); border: 1px solid var(--border-accent); border-radius: 999px; padding: 2px 9px; }
.lab-card h3 { margin: 0.3rem 0 0; font-size: 1.06rem; line-height: 1.25; }
.lab-card p { margin: 0; font-size: 0.88rem; color: var(--text-muted); line-height: 1.5; flex: 1; }
.lab-card-go { font-size: 0.84rem; color: var(--accent); font-weight: 600; margin-top: 0.4rem; }
@media (prefers-reduced-motion: reduce) { .lab-card { transition: none; } .lab-card:hover { transform: none; } }
.lab-detail { max-width: 50rem; }
.lab-detail .crumb { font-size: 0.82rem; color: var(--text-muted); margin: 0 0 0.6rem; }
.lab-detail .crumb a { color: var(--accent); text-decoration: none; }
.lab-concept { color: var(--text); line-height: 1.6; margin: 0.6rem 0 1.2rem; }
.lab-mount { margin: 1rem 0; }
.lab-source { font-size: 0.85rem; color: var(--text-muted); margin-top: 1.4rem; }
.lab-source a { color: var(--accent); }

/* gradient-descent lab */
.gd-svg { width: 100%; max-width: 460px; height: auto; display: block; margin: 0.4rem auto; background: var(--bg-elevated); border-radius: 8px; }
.gd-controls { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin: 0.6rem 0; }
.gd-lr { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.82rem; color: var(--text-muted); flex: 1; min-width: 12rem; }
.gd-lr strong { color: var(--text-strong); font-family: var(--mono); }
.gd-lr input[type=range] { width: 100%; accent-color: var(--accent); }
.gd-buttons { display: flex; gap: 0.4rem; }
.gd-lab .button { font: inherit; font-size: 0.85rem; padding: 0.35rem 0.9rem; border: 1px solid var(--border); border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; }
.gd-lab .button.ghost { background: transparent; color: var(--text-muted); }
.gd-stats { display: flex; gap: 1.3rem; flex-wrap: wrap; margin: 0.5rem 0 0; }
.gd-stats div { display: flex; flex-direction: column; }
.gd-stats dt { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.gd-stats dd { font-family: var(--mono); font-size: 1.05rem; color: var(--text-strong); margin: 0; }
.gd-stats .gd-converged { color: #5a8a5a; } .gd-stats .gd-diverged { color: #c46b6b; } .gd-stats .gd-descending { color: var(--accent); }

/* neural-net lab */
.nn-svg { width: 100%; max-width: 460px; height: auto; display: block; margin: 0.4rem auto; background: var(--bg-elevated); border-radius: 8px; }
.nn-val { font-family: var(--mono); font-size: 9px; fill: var(--text-strong); }
.nn-controls { display: flex; gap: 1.2rem; flex-wrap: wrap; margin: 0.5rem 0; }
.nn-controls label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.82rem; color: var(--text-muted); flex: 1; min-width: 11rem; }
.nn-controls strong { color: var(--text-strong); font-family: var(--mono); }
.nn-controls input[type=range] { width: 100%; accent-color: var(--accent); }
.nn-out { font-size: 0.95rem; color: var(--text); }
.nn-out strong { font-family: var(--mono); color: var(--accent); }

/* Centered primary nav: float the link group to the nav centerline on desktop,
   leaving the wordmark on the left and the search + account cluster on the right.
   On mobile the wrapper dissolves so the links fall into the hamburger dropdown. */
.learn-top .nav-center { display: flex; gap: 26px; align-items: center; }
@media (min-width: 761px) {
  .learn-top .nav-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); white-space: nowrap; }
}
@media (max-width: 760px) {
  .learn-top .nav-center { display: contents; }
}
.emb-pt { outline: none; }
.emb-pt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
