/* =============================================
   KI Grundlagen — Stylesheet
   Design: Swiss International Style, Light Editorial
   Fonts: IBM Plex Mono + IBM Plex Sans
   ============================================= */

/* ---- Variables ---- */
:root {
  color-scheme:  light;
  --bg:          #f4efe5;
  --bg-2:        #fffdf8;
  --bg-3:        #efe6d7;
  --bg-4:        #e4d8c3;
  --border:      rgba(53,44,29,0.10);
  --border-md:   rgba(53,44,29,0.18);
  --text:        #17130d;
  --text-muted:  #4d4437;
  --text-dim:    #817768;
  --red:         #bc2b21;
  --red-dim:     rgba(188,43,33,0.08);
  --red-mid:     rgba(188,43,33,0.22);
  --blue:        #2563eb;
  --green:       #15803d;
  --amber:       #b45309;
  --purple:      #7c3aed;
  --font-head:   'IBM Plex Mono', monospace;
  --font-body:   'IBM Plex Sans', sans-serif;
  --sidebar-w:   240px;
  --transition:  200ms ease;
  --shadow:      0 18px 44px rgba(82, 60, 28, 0.08);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  background:
    radial-gradient(circle at top right, rgba(37,99,235,0.05), transparent 28%),
    radial-gradient(circle at left 20%, rgba(188,43,33,0.06), transparent 26%),
    linear-gradient(180deg, #fbf7f0 0%, var(--bg) 100%);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- Progress Bar ---- */
.progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: var(--red);
  width: 0%;
  z-index: 200;
  transition: width 0.4s ease;
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: rgba(255, 252, 245, 0.9);
  border-right: 1px solid var(--border);
  box-shadow: 18px 0 48px rgba(82, 60, 28, 0.05);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  padding-bottom: 16px;
}

.sidebar-brand {
  padding: 24px 20px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.brand-label {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 600;
  color: var(--red);
  display: block;
}

.brand-sub {
  font-family: var(--font-head);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sidebar-timer {
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-dim);
  padding: 6px 20px 12px;
  letter-spacing: 0.1em;
}

.nav-list {
  list-style: none;
  flex: 1;
}

.nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all var(--transition);
}

.nav-item:hover {
  background: var(--bg-3);
}

.nav-item:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: -2px;
}

.nav-item.active {
  border-left-color: var(--red);
  background: var(--red-dim);
}

.nav-num {
  font-family: var(--font-head);
  font-size: 10px;
  color: var(--text-dim);
  width: 18px;
  flex-shrink: 0;
}

.nav-item.active .nav-num {
  color: var(--red);
}

.nav-text {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
}

.nav-item.active .nav-text {
  color: var(--text);
  font-weight: 500;
}

.nav-time {
  font-family: var(--font-head);
  font-size: 10px;
  color: var(--text-dim);
}

.nav-sep {
  height: 1px;
  background: var(--border);
  margin: 6px 20px;
}

.nav-pause {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  opacity: 0.4;
}

.nav-pause .nav-num { font-family: var(--font-head); font-size: 10px; color: var(--text-dim); width: 18px; }
.nav-pause .nav-text { font-size: 12px; color: var(--text-muted); flex: 1; }
.nav-pause .nav-time { font-family: var(--font-head); font-size: 10px; color: var(--text-dim); }

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-head);
}

/* ---- Mobile Toggle ---- */
.menu-toggle {
  display: none;
  position: fixed;
  top: 14px; right: 16px;
  z-index: 150;
  background: rgba(255, 252, 245, 0.95);
  border: 1px solid var(--border-md);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-muted);
  transition: all var(--transition);
}

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}

.app-state {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px;
  font-family: var(--font-head);
  font-size: 14px;
  color: var(--text-dim);
}

.app-state--error {
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  justify-content: flex-start;
  background: rgba(188,43,33,0.05);
  border-left: 4px solid var(--red);
  min-height: auto;
  margin: 72px;
  padding: 24px 28px;
  border-radius: 0 12px 12px 0;
  box-shadow: var(--shadow);
}

.app-state--error strong {
  color: var(--red);
}

.app-state--error p,
.app-state--error code {
  color: var(--text-muted);
}

.section {
  display: none;
  min-height: 100vh;
  padding: 72px 72px 132px;
  animation: fadeIn 0.25s ease;
}

.section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section-inner {
  width: 100%;
  max-width: none;
}

/* ---- Section Header ---- */
.section-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.section-tag {
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--red);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-duration {
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-3);
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.section-title {
  font-family: var(--font-head);
  font-size: 42px;
  font-weight: 600;
  line-height: 1.15;
  margin-bottom: 20px;
  color: var(--text);
}

.section-title em {
  font-style: normal;
  color: var(--red);
}

.section-lead {
  font-size: 17px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 36px;
  max-width: 860px;
}

.subsection-title {
  font-family: var(--font-head);
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 36px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ---- Cards ---- */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 26px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card--accent {
  border-color: var(--red-mid);
  background: linear-gradient(180deg, rgba(188,43,33,0.05), rgba(188,43,33,0.02)), var(--bg-2);
}

.card--highlight {
  background: linear-gradient(180deg, rgba(255,255,255,0.35), rgba(255,255,255,0.08)), var(--bg-3);
  border-color: var(--border-md);
}

.card--interactive {
  border-color: var(--border-md);
  background: var(--bg-2);
}

.card-label {
  font-family: var(--font-head);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

/* ---- Callout ---- */
.callout {
  border-left: 3px solid var(--red);
  padding: 14px 20px;
  background: linear-gradient(90deg, rgba(188,43,33,0.10), rgba(188,43,33,0.04));
  border-radius: 0 6px 6px 0;
  margin: 28px 0;
}

.callout-label {
  font-family: var(--font-head);
  font-size: 10px;
  color: var(--red);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}

.callout p {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
}

.callout strong {
  color: var(--text);
  font-weight: 600;
}

/* ---- Grids ---- */
.split-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.three-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.four-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

/* ---- Check Lists ---- */
.check-list {
  list-style: none;
  font-size: 13px;
  line-height: 2;
  color: var(--text-muted);
}

.check-list li::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  font-size: 10px;
  text-align: center;
  line-height: 16px;
}

.check-list--yes li::before {
  content: '✓';
  background: rgba(34,197,94,0.15);
  color: var(--green);
}

.check-list--no li::before {
  content: '→';
  background: rgba(208,2,27,0.1);
  color: var(--text-dim);
}

/* ---- Timeline Strip (intro) ---- */
.timeline-strip {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 20px 0;
  overflow-x: auto;
  margin-top: 20px;
}

.tl-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.tl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-4);
  border: 2px solid var(--border-md);
}

.tl-item--active .tl-dot {
  background: var(--red);
  border-color: var(--red);
}

.tl-label {
  font-family: var(--font-head);
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  white-space: nowrap;
}

.tl-time {
  font-family: var(--font-head);
  font-size: 9px;
  color: var(--text-dim);
  opacity: 0.6;
}

.tl-line {
  flex: 1;
  height: 1px;
  background: var(--border-md);
  min-width: 16px;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.tl-pause {
  font-family: var(--font-head);
  font-size: 9px;
  color: var(--red);
  background: var(--red-dim);
  padding: 3px 8px;
  border-radius: 3px;
  margin: 0 8px;
  margin-bottom: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---- ML Landscape ---- */
.card--paradigm {
  cursor: default;
  transition: border-color var(--transition);
}

.card--paradigm:hover {
  border-color: var(--border-md);
}

.paradigm-icon {
  font-size: 24px;
  margin-bottom: 10px;
  color: var(--text-dim);
}

.card--paradigm h3 {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

.card--paradigm p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

.example-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.example-tag {
  font-family: var(--font-head);
  font-size: 10px;
  background: var(--bg-4);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 6px;
  color: var(--text-dim);
}

.hybrid-formula {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 16px 0;
}

.hf-item {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  padding: 10px 16px;
  background: var(--bg-4);
  border-radius: 6px;
  border: 1px solid var(--border);
  line-height: 1.6;
}

.hf-item small {
  display: block;
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-head);
}

.hf-op {
  font-family: var(--font-head);
  font-size: 20px;
  color: var(--text-dim);
}

.hf-result {
  text-align: center;
  font-family: var(--font-head);
  font-size: 13px;
  color: var(--red);
  padding: 10px 16px;
  background: var(--red-dim);
  border-radius: 6px;
  border: 1px solid var(--red-mid);
  line-height: 1.8;
}

/* History Timeline */
.history-timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.ht-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ht-year {
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-dim);
}

.ht-bar {
  width: 3px;
  height: 40px;
  background: var(--bg-4);
  border-radius: 2px;
  flex-shrink: 0;
}

.ht-bar--active { background: var(--border-md); }
.ht-bar--red    { background: var(--red); }

.ht-name {
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text);
  line-height: 1.4;
}

.ht-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ---- Tokenizer ---- */
.token-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.preset-btn {
  font-family: var(--font-head);
  font-size: 11px;
  padding: 5px 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.preset-btn:hover,
.preset-btn.active {
  background: var(--red-dim);
  border-color: var(--red-mid);
  color: var(--text);
}

.token-input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border-md);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-head);
  font-size: 14px;
  padding: 12px;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition);
}

.token-input:focus {
  border-color: var(--red-mid);
}

.token-display {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 12px 0;
  min-height: 36px;
}

.token-chip {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 9px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  animation: tokenPop 0.15s ease;
}

@keyframes tokenPop {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.tc-0 { background: rgba(59,130,246,0.13); color: #1d4ed8; }
.tc-1 { background: rgba(34,197,94,0.14); color: #15803d; }
.tc-2 { background: rgba(245,158,11,0.14); color: #b45309; }
.tc-3 { background: rgba(168,85,247,0.14); color: #7c3aed; }
.tc-4 { background: rgba(239,68,68,0.12); color: #b91c1c; }
.tc-5 { background: rgba(20,184,166,0.14); color: #0f766e; }

.space-mark {
  opacity: 0.3;
  font-size: 10px;
}

.token-stats {
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  gap: 20px;
}

.token-stats span { color: var(--text-muted); }

/* Insights Grid */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.insight-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  position: relative;
}

.insight-num {
  font-family: var(--font-head);
  font-size: 32px;
  font-weight: 600;
  color: #d8ceb9;
  position: absolute;
  top: 12px;
  right: 16px;
}

.insight-card h3 {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

.insight-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

.insight-demo {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0;
}

.token-mini {
  font-family: var(--font-head);
  font-size: 12px;
  padding: 4px 7px;
  border-radius: 3px;
}

.tok-a { background: rgba(59,130,246,0.15); color: #1d4ed8; }
.tok-b { background: rgba(34,197,94,0.15); color: #15803d; }
.tok-c { background: rgba(245,158,11,0.15); color: #b45309; }
.tok-d { background: rgba(188,43,33,0.12); color: #b91c1c; }

.arrow-mini { color: var(--text-dim); font-size: 16px; }

.insight-consequence {
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--red);
  margin-top: 8px;
}

.lang-comparison {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
}

.lang-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-name {
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-muted);
  width: 50px;
  flex-shrink: 0;
}

.lang-bar {
  background: rgba(59,130,246,0.2);
  border: 1px solid rgba(59,130,246,0.3);
  color: #1d4ed8;
  font-family: var(--font-head);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 3px;
  white-space: nowrap;
}

.cost-demo {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.cost-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.cost-val {
  font-family: var(--font-head);
  color: var(--text);
}

/* Example Panels */
.example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.example-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.example-card--accent {
  border-color: var(--red-mid);
  background: linear-gradient(180deg, rgba(188,43,33,0.05), rgba(188,43,33,0.015)), var(--bg-2);
}

.example-num {
  position: absolute;
  top: 12px;
  right: 16px;
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 600;
  color: #d8ceb9;
}

.example-card h3 {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

.example-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

.example-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.example-line {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.example-key {
  font-family: var(--font-head);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.example-line strong {
  color: var(--text);
  font-weight: 500;
}

.example-foot {
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--red);
  line-height: 1.6;
  margin-top: 12px;
}

/* Choice Explorer */
.interactive-intro {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 14px;
  max-width: 780px;
}

.choice-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.choice-btn {
  font-family: var(--font-head);
  font-size: 11px;
  padding: 7px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.choice-btn:hover,
.choice-btn.active {
  background: var(--red-dim);
  border-color: var(--red-mid);
  color: var(--text);
}

.choice-output {
  background: linear-gradient(180deg, rgba(255,255,255,0.35), rgba(255,255,255,0.08)), var(--bg-3);
  border: 1px solid var(--border-md);
  border-radius: 12px;
  padding: 18px 20px;
}

.choice-eyebrow {
  font-family: var(--font-head);
  font-size: 10px;
  color: var(--red);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.choice-output h3 {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

.choice-output p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 12px;
}

.choice-foot {
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-top: 12px;
}

/* Flashcards */
.flashcard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.flashcard {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  min-height: 180px;
  cursor: pointer;
  perspective: 1200px;
}

.flashcard-inner {
  position: relative;
  display: block;
  width: 100%;
  min-height: 180px;
  transform-style: preserve-3d;
  transition: transform 260ms ease;
}

.flashcard.is-revealed .flashcard-inner {
  transform: rotateY(180deg);
}

.flashcard-side {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  padding: 18px;
  border-radius: 12px;
  backface-visibility: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.7;
}

.flashcard-front {
  background: var(--bg-2);
  color: var(--text);
  font-family: var(--font-head);
}

.flashcard-back {
  background: linear-gradient(180deg, rgba(188,43,33,0.08), rgba(188,43,33,0.03)), var(--bg-2);
  color: var(--text-muted);
  transform: rotateY(180deg);
}

.ctx-empty {
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-dim);
  padding: 4px 0;
}

/* ---- Embeddings ---- */
#embeddingCanvas {
  width: 100%;
  height: 380px;
  border-radius: 6px;
  background: var(--bg-3);
  cursor: crosshair;
}

.canvas-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.legend-item {
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-item::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c);
  display: inline-block;
}

.arithmetic-demo .card-label { margin-bottom: 20px; }

.arithmetic-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 20px 0;
}

.arith-term {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 6px;
}

.arith-pos    { background: rgba(59,130,246,0.15); color: #1d4ed8; }
.arith-neg    { background: rgba(239,68,68,0.12); color: #b91c1c; }
.arith-result { background: var(--red-dim); color: var(--red); border: 1px solid var(--red-mid); }
.arith-op     { font-family: var(--font-head); font-size: 22px; color: var(--text-dim); }

.arithmetic-note {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 16px;
}

.more-examples {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.more-ex-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 12px;
  background: var(--bg-4);
  border-radius: 4px;
}

.more-ex-result {
  font-family: var(--font-head);
  color: #166534;
  font-size: 12px;
}

/* Use Cases */
.use-cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.use-case-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  transition: border-color var(--transition);
}

.use-case-card:hover { border-color: var(--border-md); }

.uc-handson {
  border-color: var(--red-mid);
  background: var(--red-dim);
}

.uc-icon {
  font-size: 20px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.use-case-card h3 {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.use-case-card p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.uc-handson h3 { color: var(--red); }
.uc-handson p  { color: var(--text-dim); }

/* ---- Temperature ---- */
.temp-scenario-selector {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.scenario-btn {
  font-family: var(--font-head);
  font-size: 11px;
  padding: 6px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.scenario-btn.active,
.scenario-btn:hover {
  background: var(--red-dim);
  border-color: var(--red-mid);
  color: var(--text);
}

.temp-context {
  font-family: var(--font-head);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-3);
  border: 1px solid var(--border-md);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.temp-controls { margin-bottom: 16px; }

.temp-presets {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.temp-preset {
  font-family: var(--font-head);
  font-size: 12px;
  text-align: center;
  padding: 8px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1.4;
}

.temp-preset small { font-size: 10px; color: var(--text-dim); }

.temp-preset:hover,
.temp-preset.active {
  background: var(--red-dim);
  border-color: var(--red-mid);
  color: var(--text);
}

.temp-preset.active small { color: var(--red); }

.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider-label {
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-dim);
  width: 90px;
  flex-shrink: 0;
}

.slider-row input[type=range] {
  flex: 1;
  accent-color: var(--red);
  cursor: pointer;
}

.slider-val {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  color: var(--red);
  min-width: 36px;
  text-align: right;
}

/* Probability Chart */
.prob-chart { display: flex; flex-direction: column; gap: 6px; }

.pb-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pb-word {
  font-family: var(--font-head);
  font-size: 12px;
  color: var(--text-muted);
  width: 100px;
  text-align: right;
  flex-shrink: 0;
}

.pb-track {
  flex: 1;
  height: 22px;
  background: var(--bg-3);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.pb-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--red);
  transition: width 0.35s ease;
}

.pb-pct {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-muted);
}

/* Temp Cards */
.temp-card h3 {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin: 10px 0 8px;
}

.temp-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

.temp-card--active {
  border-color: var(--red-mid);
}

.temp-badge {
  font-family: var(--font-head);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  display: inline-block;
}

.temp-badge--low  { background: rgba(34,197,94,0.15);  color: var(--green); }
.temp-badge--mid  { background: var(--red-dim);          color: var(--red);   }
.temp-badge--high { background: rgba(239,68,68,0.12);   color: #b91c1c;      }

.temp-usecase {
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-dim);
  line-height: 2;
  background: var(--bg-3);
  padding: 10px 12px;
  border-radius: 4px;
}

/* Param Explainer */
.param-explainer {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.param-item {
  padding: 12px;
  background: var(--bg-4);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.param-name {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.param-aka {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 400;
}

.param-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.sampling-lab {
  margin-top: 20px;
}

.sampling-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 18px;
  margin-bottom: 18px;
}

.sampling-sliders {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sampling-effort {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.sampling-effort-label {
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.sampling-effort-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.effort-preset {
  font-family: var(--font-head);
  font-size: 12px;
  text-align: center;
  padding: 8px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1.35;
}

.effort-preset small {
  display: block;
  font-size: 10px;
  color: var(--text-dim);
}

.effort-preset:hover,
.effort-preset.active {
  background: var(--red-dim);
  border-color: var(--red-mid);
  color: var(--text);
}

.effort-preset.active small {
  color: var(--red);
}

.sampling-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.sampling-metric {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sampling-metric-label {
  font-family: var(--font-head);
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sampling-metric strong {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.sampling-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.sampling-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  transition: opacity var(--transition);
}

.sampling-row.is-muted {
  opacity: 0.52;
}

.sampling-token {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sampling-rank,
.sampling-cum {
  font-family: var(--font-head);
  font-size: 10px;
  color: var(--text-dim);
}

.sampling-word {
  font-family: var(--font-head);
  font-size: 12px;
  color: var(--text);
}

.sampling-track {
  position: relative;
  height: 24px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
}

.sampling-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(188,43,33,0.85), rgba(188,43,33,0.55));
  transition: width 0.35s ease, opacity var(--transition);
}

.sampling-fill--muted {
  background: linear-gradient(90deg, rgba(143,129,102,0.40), rgba(143,129,102,0.20));
}

.sampling-meta {
  position: absolute;
  inset: 0 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-family: var(--font-head);
  font-size: 10px;
  color: var(--text-muted);
  text-align: right;
}

.sampling-effort-card {
  background: linear-gradient(180deg, rgba(188,43,33,0.06), rgba(188,43,33,0.02)), var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 14px;
}

.sampling-effort-eyebrow {
  font-family: var(--font-head);
  font-size: 10px;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.sampling-effort-card h3 {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

.sampling-effort-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 10px;
}

.sampling-effort-impact {
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-dim);
}

.sampling-note {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sampling-note p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ---- Hallucinations ---- */
.hallucination-mechanic {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  padding: 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-wrap: wrap;
}

.mech-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 180px;
}

.mech-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--red-dim);
  color: var(--red);
  font-family: var(--font-head);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mech-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.mech-arrow {
  font-size: 20px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.hallucination-examples {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.hall-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.hall-type {
  font-family: var(--font-head);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.hall-card--factual .hall-type    { color: #b91c1c; }
.hall-card--citation .hall-type   { color: #b91c1c; }
.hall-card--temporal .hall-type   { color: #b45309; }
.hall-card--confident .hall-type  { color: #b91c1c; }

.hall-prompt {
  font-family: var(--font-head);
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-3);
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.hall-prompt::before { content: '▶ '; color: var(--text-dim); }

.hall-response {
  font-size: 13px;
  line-height: 1.6;
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.hall-response em { font-style: italic; }

.hall-response--bad {
  background: rgba(239,68,68,0.07);
  border: 1px solid rgba(239,68,68,0.16);
  color: #991b1b;
}

.hall-response--caution {
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.16);
  color: #92400e;
}

.hall-note {
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* Mitigation Grid */
.mitigation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.mitigation-item {
  padding: 12px;
  background: var(--bg-3);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.mit-icon {
  font-size: 18px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.mitigation-item h3 {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.mitigation-item p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---- Context Window ---- */
.context-visualizer {
  margin-bottom: 14px;
}

.ctx-fill-bar {
  width: 100%;
  height: 32px;
  background: var(--bg-3);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
  margin-bottom: 6px;
}

.ctx-segment {
  position: absolute;
  top: 0;
  height: 100%;
  transition: all 0.4s ease;
  display: flex;
  align-items: center;
  padding-left: 8px;
  font-family: var(--font-head);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
}

.ctx-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-dim);
}

.context-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.ctx-btn {
  font-family: var(--font-head);
  font-size: 11px;
  text-align: center;
  padding: 8px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1.4;
}

.ctx-btn small { font-size: 10px; color: var(--text-dim); display: block; }

.ctx-btn:hover {
  background: var(--red-dim);
  border-color: var(--red-mid);
  color: var(--text);
}

.ctx-btn--reset {
  background: transparent;
  color: var(--text-dim);
}

.ctx-content-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 20px;
}

.ctx-list-item {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  animation: fadeIn 0.2s ease;
}

.ctx-list-tok { color: var(--red); }

/* Models Comparison */
.models-comparison {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 20px;
}

.model-bars { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }

.model-bar-item { display: flex; align-items: center; gap: 12px; }

.model-bar-name {
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-muted);
  width: 110px;
  flex-shrink: 0;
  text-align: right;
}

.model-bar-track {
  flex: 1;
  height: 22px;
  background: var(--bg-3);
  border-radius: 3px;
  overflow: hidden;
}

.model-bar-fill {
  height: 100%;
  background: var(--border-md);
  border-radius: 3px;
  display: flex;
  align-items: center;
  padding-left: 8px;
  transition: width 0.6s ease;
}

.model-bar-fill--accent { background: var(--blue); opacity: 0.7; }
.model-bar-fill--red    { background: var(--red); }

.model-bar-label {
  font-family: var(--font-head);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.context-reference {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-family: var(--font-head);
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 10px;
}

/* Context Items */
.ctx-item {
  padding: 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-3);
}

.ctx-item-icon { font-size: 20px; margin-bottom: 8px; }

.ctx-item h3 {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 4px;
}

.ctx-item p { font-size: 11px; color: var(--text-muted); line-height: 1.4; }

.ctx-item--system      h3 { color: var(--blue); }
.ctx-item--conversation h3 { color: var(--green); }
.ctx-item--documents   h3 { color: var(--amber); }
.ctx-item--none {
  border-color: rgba(239,68,68,0.2);
  background: rgba(239,68,68,0.06);
}
.ctx-item--none h3 { color: #b91c1c; }

/* ---- Training ---- */
.phases-timeline {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.phase-card {
  flex: 1;
  min-width: 200px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-2);
}

.phase-card--pretraining { border-top: 3px solid var(--amber); }
.phase-card--finetuning  { border-top: 3px solid var(--blue); }
.phase-card--inference   { border-top: 3px solid var(--red); }

.phase-num {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 600;
  color: var(--bg-4);
  margin-bottom: 6px;
}

.phase-card h3 {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 14px;
}

.phase-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.phase-stat {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.phase-stat span  { color: var(--text-dim); }
.phase-stat strong { color: var(--text); font-weight: 500; }

.phase-card p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.phase-card strong { color: var(--text); }

.phase-arrow {
  font-size: 24px;
  color: var(--text-dim);
  padding: 40px 8px 0;
  flex-shrink: 0;
}

/* Inference Diagram */
.inference-diagram {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  flex-wrap: wrap;
}

.inf-box {
  flex: 1;
  min-width: 140px;
  padding: 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-4);
}

.inf-box--in  { border-color: rgba(59,130,246,0.3); }
.inf-box--out { border-color: rgba(34,197,94,0.3); }

.inf-label {
  font-family: var(--font-head);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.inf-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inf-item {
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-muted);
  padding: 3px 0;
}

.inf-arrow {
  font-size: 24px;
  color: var(--red);
  flex-shrink: 0;
}

.inf-model {
  padding: 20px 24px;
  background: var(--red-dim);
  border: 1px solid var(--red-mid);
  border-radius: 8px;
  text-align: center;
  flex-shrink: 0;
}

.inf-model-label {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 600;
  color: var(--red);
}

.inf-model-weights {
  font-family: var(--font-head);
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Comparison Table */
.comparison-table {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.ct-header, .ct-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 10px 14px;
  font-size: 13px;
}

.ct-header {
  background: var(--bg-3);
  border-bottom: 1px solid var(--border-md);
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-dim);
}

.ct-row {
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.ct-row:last-child { border-bottom: none; }
.ct-row:hover { background: var(--bg-3); }

.ct-yes  { color: var(--green); }
.ct-no   { color: #b91c1c; }
.ct-mid  { color: var(--amber); }

/* ---- Models ---- */
.param-sizes {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  padding: 20px 0 14px;
  justify-content: center;
}

.ps-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ps-bar-wrap {
  display: flex;
  align-items: flex-end;
  height: 200px;
}

.ps-bar {
  width: 60px;
  border-radius: 4px 4px 0 0;
  background: var(--border-md);
  transition: height 0.5s ease;
}

.ps-bar--xs { background: var(--green); opacity: 0.5; }
.ps-bar--sm { background: var(--blue); opacity: 0.6; }
.ps-bar--md { background: var(--amber); opacity: 0.7; }
.ps-bar--lg { background: var(--red); opacity: 0.8; }

.ps-name {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}

.ps-desc {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

.ps-models {
  font-family: var(--font-head);
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.6;
}

.ps-note {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 8px;
  font-family: var(--font-head);
}

/* Model Lists */
.model-list { display: flex; flex-direction: column; gap: 6px; }

.model-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-3);
  border-radius: 4px;
  border: 1px solid var(--border);
}

.model-name {
  font-family: var(--font-head);
  font-size: 12px;
  color: var(--text);
  flex: 1;
}

.model-maker {
  font-size: 11px;
  color: var(--text-dim);
}

.model-badge {
  font-family: var(--font-head);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-local { background: rgba(34,197,94,0.15); color: var(--green); }
.badge-api   { background: rgba(59,130,246,0.15); color: #1d4ed8; }

/* Multimodal */
.multimodal-diagram {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  flex-wrap: wrap;
  justify-content: center;
}

.mm-inputs, .mm-outputs {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mm-input, .mm-output {
  font-family: var(--font-head);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 3px;
  background: var(--bg-4);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-align: center;
}

.mm-input  { border-color: rgba(59,130,246,0.3); color: #1d4ed8; }
.mm-output { border-color: rgba(34,197,94,0.3); color: #15803d; }

.mm-arrow {
  font-size: 28px;
  color: var(--red);
  flex-shrink: 0;
}

.mm-model {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  color: var(--red);
  text-align: center;
  padding: 20px 24px;
  background: var(--red-dim);
  border: 1px solid var(--red-mid);
  border-radius: 8px;
  line-height: 1.5;
}

.mm-model small {
  display: block;
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 400;
}

.multimodal-diagram + p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 14px;
}

/* ---- Wrap-up / Summary ---- */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition);
}

.summary-card:hover { border-color: var(--border-md); }

.summary-num {
  font-family: var(--font-head);
  font-size: 48px;
  font-weight: 600;
  color: #d8ceb9;
  position: absolute;
  bottom: 8px;
  right: 12px;
  line-height: 1;
}

.summary-card h3 {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 500;
  color: var(--red);
  margin-bottom: 8px;
}

.summary-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.next-session p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.next-session strong { color: var(--text); }

.next-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.next-topic {
  font-family: var(--font-head);
  font-size: 11px;
  padding: 5px 12px;
  background: var(--bg-4);
  border: 1px solid var(--border-md);
  border-radius: 4px;
  color: var(--text-muted);
}

.final-quote {
  font-family: var(--font-head);
  font-size: 14px;
  color: var(--text-muted);
  line-height: 2;
  text-align: center;
  padding: 40px 20px;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}

/* ---- Section Navigation ---- */
.section-nav {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 64px;
  background: rgba(244, 239, 229, 0.92);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(14px);
  z-index: 50;
}

.section-nav-btn {
  font-family: var(--font-head);
  font-size: 12px;
  padding: 8px 18px;
  background: var(--bg-3);
  border: 1px solid var(--border-md);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.section-nav-btn:hover { background: var(--bg-4); color: var(--text); }

.section-nav-btn--next {
  background: var(--red-dim);
  border-color: var(--red-mid);
  color: var(--red);
}

.section-nav-btn--next:hover {
  background: var(--red);
  color: #fff;
}

.section-nav-indicator {
  font-family: var(--font-head);
  font-size: 11px;
  color: var(--text-dim);
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: flex; }
  .main-content { margin-left: 0; }
  .section { padding: 50px 24px 100px; }
  .section-nav { left: 0; padding: 12px 24px; }
  .three-grid   { grid-template-columns: 1fr; }
  .split-grid   { grid-template-columns: 1fr; }
  .four-grid    { grid-template-columns: 1fr 1fr; }
  .insights-grid { grid-template-columns: 1fr; }
  .example-grid { grid-template-columns: 1fr; }
  .use-cases-grid { grid-template-columns: 1fr 1fr; }
  .summary-grid   { grid-template-columns: 1fr 1fr; }
  .flashcard-grid { grid-template-columns: 1fr 1fr; }
  .phases-timeline { flex-direction: column; }
  .phase-arrow { transform: rotate(90deg); padding: 0 8px; align-self: center; }
  .history-timeline { grid-template-columns: repeat(3, 1fr); }
  .mitigation-grid { grid-template-columns: 1fr 1fr; }
  .section-title { font-size: 26px; }
  .sampling-controls { grid-template-columns: 1fr; }
  .sampling-summary { grid-template-columns: 1fr 1fr; }
  .sampling-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .four-grid    { grid-template-columns: 1fr; }
  .use-cases-grid { grid-template-columns: 1fr; }
  .summary-grid   { grid-template-columns: 1fr; }
  .flashcard-grid { grid-template-columns: 1fr; }
  .history-timeline { grid-template-columns: repeat(2, 1fr); }
  .temp-presets { flex-wrap: wrap; }
  .hallucination-mechanic { flex-direction: column; }
  .arithmetic-display { gap: 8px; }
  .arith-term { font-size: 14px; padding: 7px 12px; }
  .param-sizes { gap: 10px; }
  .ps-bar { width: 44px; }
  .sampling-summary { grid-template-columns: 1fr; }
  .sampling-meta { justify-content: flex-start; padding-left: 8px; }
}
