:root {
  color-scheme: light;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --panel: #ffffff;
  --paper: #f3f6fa;
  --accent: #0d6b62;
  --accent-strong: #065f46;
  --accent-soft: #ecfdf5;
  --accent-muted: #a7f3d0;
  --amber: #b45309;
  --red: #c2410c;
  --blue: #2563eb;
  --green: #15803d;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px clamp(16px, 3vw, 36px) 10px;
}

.header-brand {
  min-width: 0;
}

.app-header h1 {
  margin: 4px 0 0;
  font-size: 30px;
  line-height: 1.08;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  color: var(--accent-strong, var(--accent));
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.chapter-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  text-decoration: none;
  font-weight: 700;
}

.lesson-primer,
.comparison-intro {
  margin: 0 clamp(16px, 3vw, 36px) 18px;
}

.lesson-primer {
  display: grid;
  gap: 18px;
}

.lesson-heading {
  max-width: 980px;
}

.lesson-heading h2,
.comparison-intro h2 {
  margin: 4px 0 0;
  font-size: 26px;
  line-height: 1.18;
  letter-spacing: 0;
}

.lesson-heading p:not(.eyebrow),
.comparison-intro p:not(.eyebrow) {
  margin: 10px 0 0;
  max-width: 900px;
  color: var(--muted);
  line-height: 1.7;
}

.lesson-heading.compact {
  margin-top: 4px;
}

.learning-goals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.goal-card {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.goal-card span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.goal-card strong {
  font-size: 19px;
  line-height: 1.2;
}

.goal-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.foundation-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 16px;
  align-items: stretch;
}

.foundation-copy,
.tiny-graph,
.trace-guide {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.foundation-copy,
.trace-guide {
  padding: 18px;
}

.foundation-copy h3,
.trace-guide h3 {
  margin: 4px 0 0;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: 0;
}

.foundation-copy p:not(.eyebrow),
.trace-guide p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.tiny-graph {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 18px;
  background: #f8fafc;
}

.graph-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.graph-row.lower {
  justify-content: flex-start;
  padding-left: 50px;
}

.graph-node {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 2px solid #94a3b8;
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
}

.graph-node.start-node {
  border-color: var(--accent);
  background: #ccfbf1;
}

.graph-node.goal-node {
  border-color: var(--blue);
  background: #dbeafe;
}

.graph-row i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 22px;
  border-top: 2px solid #94a3b8;
  background: transparent;
  color: #475569;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.tiny-graph p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.foundation-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.foundation-steps article {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.step-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 28px;
  border-radius: 999px;
  background: #e7f5f2;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.foundation-steps h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: 0;
}

.foundation-steps p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.trace-guide {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(320px, 1.15fr);
  gap: 16px;
  align-items: start;
}

.trace-guide ol {
  margin: 0;
  padding-left: 22px;
  color: var(--ink);
  line-height: 1.7;
}

.trace-guide li + li {
  margin-top: 6px;
}

.vocabulary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.vocab-item,
.lesson-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.vocab-item {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.vocab-item strong {
  font-size: 15px;
}

.vocab-item span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.algorithm-lessons {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.lesson-card {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  box-shadow: 0 10px 28px rgba(31, 41, 51, 0.08);
}

.lesson-card-top {
  display: grid;
  gap: 10px;
}

.lesson-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 28px;
  border-radius: 999px;
  background: #e7f5f2;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.lesson-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

.lesson-card p {
  margin: 0;
  color: var(--ink);
  line-height: 1.65;
  font-size: 14px;
}

.lesson-note {
  color: var(--muted) !important;
}

.mini-example {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 10px;
  border: 1px solid #cde7e2;
  border-radius: 8px;
  background: #f0fdfa;
  color: #134e4a;
  font-size: 13px;
  font-weight: 900;
}

.mini-example span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #a7d7ce;
}

.mini-example b {
  color: var(--accent-strong);
  font-size: 12px;
}

.worked-example-map {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(320px, 1.2fr);
  gap: 12px;
  align-items: stretch;
}

.worked-example-map > div {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.worked-example-map h3 {
  margin: 4px 0 0;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

.worked-example-map p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
}

.worked-graph-line {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  align-items: center;
  gap: 8px;
  background: #f8fafc !important;
}

.worked-graph-line span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 2px solid #94a3b8;
  border-radius: 999px;
  background: #ffffff;
  font-weight: 900;
}

.worked-graph-line .worked-start {
  border-color: var(--accent);
  background: #ccfbf1;
}

.worked-graph-line .worked-goal {
  border-color: var(--blue);
  background: #dbeafe;
}

.worked-graph-line b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  min-height: 24px;
  border-top: 2px solid #94a3b8;
  color: #475569;
  font-size: 12px;
}

.worked-graph-line small {
  flex-basis: 100%;
  height: 0;
}

.worked-graph-overview {
  display: grid;
  gap: 8px;
  background: #f8fafc !important;
}

.worked-graph-overview p {
  margin: 0;
}

.worked-examples {
  display: grid;
  gap: 14px;
}

.worked-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(31, 41, 51, 0.08);
}

.worked-card-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.worked-card h3 {
  margin: 0;
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: 0;
}

.worked-card p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.worked-visual {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.run-summary {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
  align-items: stretch;
}

.run-graph {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.worked-graph-svg {
  display: block;
  width: 100%;
  min-height: 180px;
}

.worked-graph-svg marker path {
  fill: #64748b;
}

.graph-edge {
  stroke: #94a3b8;
  stroke-width: 3;
  stroke-linecap: round;
}

.graph-edge.is-visited {
  stroke: #64748b;
  stroke-dasharray: 5 5;
}

.graph-edge.in-final,
.graph-edge-best {
  stroke: var(--green);
  stroke-width: 4;
  stroke-dasharray: 0;
}

.graph-weight {
  font-size: 11px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: central;
  fill: #64748b;
  pointer-events: none;
}

.graph-weight.in-final,
.graph-weight-best {
  fill: var(--green);
}

.graph-node circle {
  fill: #ffffff;
  stroke: #94a3b8;
  stroke-width: 3;
}

.graph-node text {
  dominant-baseline: middle;
  fill: var(--ink);
  font-size: 18px;
  font-weight: 900;
  text-anchor: middle;
}

.graph-node.is-final circle {
  fill: #dcfce7;
  stroke: var(--green);
}

.graph-node.is-visited circle {
  fill: #e2e8f0;
  stroke: #64748b;
}

.graph-node.is-frontier circle {
  fill: #dbeafe;
  stroke: var(--blue);
}

.graph-node.is-current circle {
  fill: #ffedd5;
  stroke: #f97316;
  stroke-width: 5;
}

.graph-node.is-start circle {
  stroke: var(--accent);
}

.graph-node.is-goal circle {
  stroke: var(--blue);
}

.graph-node.is-current circle {
  fill: #ffedd5;
  stroke: #f97316;
  stroke-width: 5;
}

.run-graph-title,
.step-strip-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.run-graph-title strong,
.step-strip-title strong {
  color: var(--ink);
  font-size: 14px;
}

.run-path-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.run-node {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 2px solid #94a3b8;
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
}

.run-node.start {
  border-color: var(--accent);
  background: #ccfbf1;
}

.run-node.goal {
  border-color: var(--blue);
  background: #dbeafe;
}

.run-node.in-path {
  border-color: var(--green);
  background: #dcfce7;
}

.run-edge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 24px;
  border-top: 2px solid #94a3b8;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}

.run-edge.in-path {
  border-color: var(--green);
  color: var(--green);
}

.run-live-panel {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.worked-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.worked-controls button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

.worked-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.worked-controls strong {
  color: var(--ink);
  font-size: 13px;
}

.current-choice,
.worked-structure-panel {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.current-choice {
  border-color: #fed7aa;
  background: #fff7ed;
}

.current-choice span,
.structure-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.current-choice strong {
  display: block;
  margin-top: 4px;
  color: #9a3412;
  font-size: 28px;
  line-height: 1;
}

.current-choice p,
.worked-structure-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.structure-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.structure-title strong {
  color: var(--ink);
  font-size: 14px;
}

.structure-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.structure-items.stack {
  max-width: 210px;
  flex-direction: column;
}

.structure-items.queue,
.structure-items.priority {
  align-items: stretch;
}

.structure-item {
  min-width: 70px;
  min-height: 48px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.structure-item.is-next {
  border-color: #f97316;
  background: #ffedd5;
}

.structure-item em {
  color: #9a3412;
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
}

.structure-item strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.structure-item small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}

.structure-empty {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.path-result {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
  border: 1px solid #cde7e2;
  border-radius: 8px;
  background: #f0fdfa;
}

.path-result strong {
  color: #134e4a;
  font-size: 16px;
}

.path-result span {
  color: #134e4a;
  font-size: 13px;
  font-weight: 900;
}

.path-result p {
  margin: 0;
  color: #315f5a;
}

.step-strip {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.example-steps {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(210px, 250px);
  gap: 10px;
  margin-top: 10px;
  overflow-x: auto;
  padding: 2px 2px 10px;
}

.example-step {
  min-width: 0;
  display: grid;
  gap: 8px;
  text-align: left;
  font: inherit;
  cursor: pointer;
  padding: 12px;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  background: #f8fafc;
}

.example-step.is-active {
  border-color: #f97316;
  background: #fff7ed;
  box-shadow: inset 0 0 0 2px rgba(249, 115, 22, 0.18);
}

.example-step.is-goal {
  border-color: var(--green);
  background: #f0fdf4;
}

.example-step.is-goal.is-active {
  border-color: #f97316;
  background: #fff7ed;
}

.example-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.example-current {
  display: grid;
  gap: 4px;
}

.example-current strong {
  font-size: 23px;
  line-height: 1;
}

.example-field {
  display: grid;
  gap: 4px;
}

.example-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.example-field code {
  display: block;
  padding: 6px 8px;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
}

.example-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.comparison-card {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(31, 41, 51, 0.08);
}

.comparison-card h3 {
  margin: 4px 0 0;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
}

.comparison-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.comparison-card tr.is-low-cost td {
  background: #f0fdfa;
  color: #134e4a;
  font-weight: 900;
}

.comparison-table .comparison-row {
  cursor: pointer;
  transition: background 0.15s ease;
}

.comparison-table .comparison-row:hover td,
.comparison-table .comparison-row:focus-visible td {
  background: #eff6ff;
}

.comparison-table .comparison-row:focus-visible {
  outline: none;
}

.chapter-algo-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 16px;
  padding: 6px;
  border-radius: 10px;
  background: #f1f5f9;
  border: 1px solid var(--line);
}

.chapter-algo-tab {
  flex: 1 1 auto;
  min-width: 96px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.chapter-algo-tab:hover {
  color: var(--ink);
  background: #ffffff;
}

.chapter-algo-tab.is-active {
  color: var(--accent-strong);
  background: #ffffff;
  border-color: #99f6e4;
  box-shadow: 0 4px 12px rgba(31, 41, 51, 0.08);
}

.chapter-algo-panel {
  margin-top: 8px;
}

.onboarding {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  place-items: center;
  padding: 20px;
}

.onboarding:not([hidden]) {
  display: grid;
}

.onboarding-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.onboarding-card {
  position: relative;
  width: min(480px, 100%);
  padding: 24px;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
}

.onboarding-card h2 {
  margin: 8px 0 16px;
  font-size: 22px;
}

.onboarding-steps {
  margin: 0 0 20px;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
}

.onboarding-steps strong {
  color: var(--ink);
}

.onboarding-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.onboarding-mobile-tip {
  display: none;
}

@media (max-width: 680px) {
  .onboarding:not([hidden]) {
    display: block;
    padding: 0;
    place-items: unset;
  }

  .onboarding-backdrop {
    display: none;
  }

  .onboarding-card {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 14px 16px;
    border-radius: 0;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
  }

  .onboarding-card .eyebrow {
    margin-bottom: 4px;
  }

  .onboarding-card h2 {
    margin: 0 0 8px;
    font-size: 18px;
  }

  .onboarding-steps {
    display: none;
  }

  .onboarding-mobile-tip {
    display: block;
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--muted);
    line-height: 1.55;
  }

  .onboarding-actions {
    justify-content: stretch;
    gap: 8px;
  }

  .onboarding-actions .primary-button,
  .onboarding-actions .ghost-button {
    flex: 1;
    min-height: 40px;
  }
}

.table-wrap {
  width: 100%;
  margin-top: 12px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.run-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  background: #ffffff;
  font-size: 13px;
}

.run-table th,
.run-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.55;
}

.run-table th {
  background: #f1f5f9;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.run-table tr:last-child td {
  border-bottom: 0;
}

.run-table td:first-child,
.run-table td:nth-child(2) {
  font-weight: 900;
  white-space: nowrap;
}

.comparison-intro {
  padding-top: 8px;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 18px;
  padding: 0 clamp(16px, 3vw, 36px) 28px;
}

.visual-workspace,
.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.visual-workspace {
  min-width: 0;
  padding: 18px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.tab {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.tab[aria-selected="true"] {
  border-color: var(--accent);
  background: #e7f5f2;
  color: var(--accent-strong);
}

.tab.is-active {
  border-color: var(--accent);
  background: #e7f5f2;
  color: var(--accent-strong);
}

.copy-teach {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.copy-teach span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.map-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.map-toolbar h2,
.panel h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
}

.map-toolbar p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.step-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  min-height: 44px;
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
  font-weight: 900;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-chip {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(31, 41, 51, 0.2);
  border-radius: 4px;
}

.legend-chip.start {
  background: #0f766e;
}

.legend-chip.goal {
  background: #2563eb;
}

.legend-chip.plain {
  background: #f8fafc;
}

.legend-chip.grass {
  background: #bbf7d0;
}

.legend-chip.mountain {
  background: #fed7aa;
}

.legend-chip.wall {
  background: #334155;
}

.grid-frame {
  display: flex;
  justify-content: center;
  padding: 16px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.06), transparent 45%),
    #edf2f7;
}

.grid {
  width: min(100%, 640px);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  overflow: hidden;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.cell .node-label {
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.cell .cost-label {
  position: absolute;
  right: 6px;
  bottom: 5px;
  color: rgba(31, 41, 51, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.cell .score-label {
  position: absolute;
  left: 5px;
  top: 5px;
  color: rgba(31, 41, 51, 0.68);
  font-size: 10px;
  font-weight: 800;
}

.cell.plain {
  background: #f8fafc;
}

.cell.grass {
  background: #bbf7d0;
}

.cell.mountain {
  background: #fed7aa;
}

.cell.wall {
  border-color: #334155;
  background: repeating-linear-gradient(
    135deg,
    #334155 0,
    #334155 8px,
    #475569 8px,
    #475569 16px
  );
  color: #f8fafc;
}

.cell.start {
  border-color: #0f766e;
  background: #ccfbf1;
}

.cell.goal {
  border-color: #2563eb;
  background: #dbeafe;
}

.cell.visited {
  box-shadow: inset 0 0 0 999px rgba(37, 99, 235, 0.14);
}

.cell.frontier {
  border-color: var(--amber);
  box-shadow: inset 0 0 0 999px rgba(251, 191, 36, 0.2);
}

.cell.path {
  border-color: var(--green);
  box-shadow: inset 0 0 0 999px rgba(34, 197, 94, 0.26);
}

.cell.current {
  z-index: 2;
  border-color: var(--red);
  box-shadow:
    0 0 0 3px rgba(194, 65, 12, 0.22),
    inset 0 0 0 999px rgba(254, 226, 226, 0.55);
  transform: translateY(-2px);
}

.playback {
  display: grid;
  grid-template-columns: 44px minmax(130px, 160px) 44px minmax(82px, 100px) 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}

.icon-button,
.primary-button,
.ghost-button {
  min-height: 42px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.icon-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #f9fafb;
  color: var(--ink);
}

.range-label {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.inspector {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.panel {
  padding: 16px;
}

.panel-header {
  display: grid;
  gap: 4px;
}

.panel-header.inline {
  grid-template-columns: 1fr auto;
  align-items: start;
}

.step-copy {
  margin: 12px 0 0;
  color: var(--ink);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0 0;
}

.metrics div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.metrics dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metrics dd {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 900;
}

.structure-panel {
  display: grid;
  gap: 14px;
}

.processing-lane {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.processing-card {
  min-width: 0;
  min-height: 104px;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff7ed;
}

.processing-card.next-card {
  background: #f0fdfa;
}

.lane-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.processing-card strong {
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.processing-card span:last-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.flow-arrow {
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  font-size: 24px;
  font-weight: 900;
}

.frontier-structure {
  min-width: 0;
  min-height: 118px;
  padding: 12px;
  border: 1px dashed #a7b4c5;
  border-radius: 8px;
  background: #f8fafc;
}

.frontier-empty {
  display: grid;
  place-items: center;
  min-height: 92px;
  color: var(--muted);
  font-weight: 900;
}

.stack-visual {
  display: grid;
  justify-items: stretch;
  gap: 0;
}

.stack-bracket {
  display: grid;
  gap: 6px;
  max-width: 260px;
  margin: 0 auto;
}

.stack-labels,
.queue-labels {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.stack-item,
.queue-item,
.priority-item {
  min-width: 0;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
}

.stack-item {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 0;
  border-bottom: 0;
}

.stack-item:first-of-type {
  border-radius: 8px 8px 0 0;
}

.stack-item:last-of-type {
  border-bottom: 1px solid #cbd5e1;
  border-radius: 0 0 8px 8px;
}

.stack-item.is-next,
.queue-item.is-next,
.priority-item.is-next {
  border-color: var(--red);
  background: #fff7ed;
  box-shadow: 0 0 0 2px rgba(194, 65, 12, 0.16);
}

.structure-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 24px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 11px;
}

.structure-node {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.structure-score {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.queue-track {
  display: grid;
  gap: 8px;
}

.queue-items {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
}

.queue-item {
  flex: 0 0 112px;
  min-height: 70px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
  padding: 8px;
  border-radius: 8px;
}

.priority-list {
  display: grid;
  gap: 8px;
}

.priority-item {
  display: grid;
  grid-template-columns: 42px minmax(64px, 0.7fr) minmax(120px, 1.3fr);
  gap: 8px;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 8px;
}

.state-panel {
  display: grid;
  gap: 14px;
}

.state-column h3 {
  margin: 0 0 8px;
  font-size: 15px;
  letter-spacing: 0;
}

.state-column,
.pill-list,
.parent-list {
  min-width: 0;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 32px;
}

.pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #065f46;
  font-size: 12px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill.current {
  background: #ffedd5;
  color: #9a3412;
}

.pill.muted,
.empty-state {
  background: #f1f5f9;
  color: var(--muted);
}

.pill-list.compact .pill {
  min-height: 24px;
  padding-inline: 8px;
}

.parent-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.parent-edge {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.strategy-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e7f5f2;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

pre {
  width: 100%;
  min-width: 0;
  margin: 12px 0 0;
  max-height: 280px;
  overflow: auto;
  border-radius: 8px;
  background: #111827;
  color: #e5e7eb;
}

code {
  display: block;
  padding: 14px;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre;
}

.prompt-text {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #cde7e2;
  border-radius: 8px;
  background: #f0fdfa;
  color: #134e4a;
  line-height: 1.7;
  font-size: 14px;
  overflow-wrap: anywhere;
}

@media (max-width: 1040px) {
  .learning-goals,
  .foundation-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .foundation-block,
  .worked-example-map,
  .run-summary,
  .trace-guide {
    grid-template-columns: 1fr;
  }

  .vocabulary,
  .algorithm-lessons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .visual-workspace {
    order: 1;
  }

  .inspector {
    order: 2;
  }
}

@media (max-width: 680px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .chapter-link {
    width: 100%;
  }

  .vocabulary,
  .learning-goals,
  .foundation-steps,
  .algorithm-lessons {
    grid-template-columns: 1fr;
  }

  .visual-workspace,
  .panel {
    padding: 12px;
  }

  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-toolbar {
    flex-direction: column;
  }

  .step-counter {
    width: 100%;
  }

  .grid {
    gap: 4px;
  }

  .cell {
    border-radius: 6px;
  }

  .cell .node-label {
    font-size: 12px;
  }

  .cell .cost-label {
    right: 4px;
    bottom: 3px;
    font-size: 10px;
  }

  .cell .score-label {
    display: none;
  }

  .playback {
    grid-template-columns: 44px 1fr 44px;
  }

  .ghost-button,
  .range-label {
    grid-column: 1 / -1;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .processing-lane {
    grid-template-columns: 1fr;
  }

  .flow-arrow {
    transform: rotate(90deg);
  }

  .priority-item {
    grid-template-columns: 38px minmax(54px, 0.6fr) minmax(100px, 1.4fr);
  }

  .parent-list {
    grid-template-columns: 1fr;
  }
}

/* ========== Chapter 5 layout ========== */

.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
}

.section-nav-sticky {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0;
  padding: 10px clamp(16px, 3vw, 36px);
  background: rgba(245, 247, 250, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

@media (max-width: 899px) {
  .section-nav-sticky {
    flex-wrap: wrap;
    overflow-x: visible;
    row-gap: 8px;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
  }
}

.section-link {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.section-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.section-link.is-active {
  border-color: var(--accent);
  background: #ecfdf5;
  color: var(--accent-strong);
}

[id] {
  scroll-margin-top: 96px;
}

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

.hero-cta {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
}

.lab-cta {
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid #99f6e4;
  border-radius: 8px;
  background: #f0fdfa;
  color: var(--accent-strong);
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.lab-cta:hover {
  background: #ccfbf1;
}

.campus-legend-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 0 4px;
  font-size: 12px;
  color: var(--muted);
}

.worked-result-badge {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
  font-size: 13px;
}

.worked-result-badge.is-optimal {
  border-color: #86efac;
  background: #f0fdf4;
}

.worked-result-badge strong {
  font-size: 14px;
}

.worked-result-badge em {
  color: var(--muted);
  font-style: normal;
}

.frontier-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.frontier-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-size: 12px;
}

.frontier-chip.is-next {
  background: #fff7ed;
  border-color: #fdba74;
  font-weight: 700;
}

.frontier-chip em {
  font-style: normal;
  font-size: 10px;
  color: var(--amber);
  font-weight: 800;
}

.frontier-chip-empty {
  margin: 8px 0;
  font-size: 13px;
  color: var(--muted);
}

.worked-range {
  flex: 1;
  min-width: 140px;
}

.worked-step-row {
  cursor: pointer;
}

.worked-step-row:hover {
  background: #f8fafc;
}

.tech-details {
  margin: 10px 0;
  font-size: 14px;
}

.tech-details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}

.comparison-hint {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}

.node-metric {
  text-anchor: middle;
  font-size: 10px;
  font-weight: 700;
  fill: var(--accent-strong);
  dominant-baseline: central;
}

.lab-hint {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.minimax-lab-controls {
  margin-top: 12px;
}

main {
  padding-bottom: 48px;
}

/* Section layout & hero typography: commercial.css */

.story-quote {
  margin: 0;
  padding: 16px;
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: #f8fafc;
  color: var(--muted);
  font-style: italic;
}

.story-quote cite {
  display: block;
  margin-top: 8px;
  font-style: normal;
  font-size: 13px;
  color: var(--accent);
}

/* Section header typography: commercial.css */

.dual-track-block {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
  gap: 16px;
  margin-top: 16px;
}

.dual-track-block.repr-block {
  grid-template-columns: 1fr;
}

.mainline {
  min-width: 0;
}

.advanced-path {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 0 14px 14px;
  background: #fafbfc;
}

.advanced-path summary {
  cursor: pointer;
  padding: 12px 0;
  font-weight: 800;
  color: var(--accent-strong);
  list-style-position: inside;
}

.skip-hint {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.advanced-body {
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
}

.algo-steps {
  margin: 0 0 12px;
  padding-left: 20px;
}

.algo-steps li {
  margin-bottom: 6px;
}

.repr-table {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.repr-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}

.repr-row.header {
  background: #f1f5f9;
  font-weight: 800;
  border-top: none;
}

.knowledge-card {
  margin-top: 16px;
  padding: 14px;
  border-radius: 8px;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
}

.knowledge-card p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.algo-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.algo-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.algo-header h3 {
  margin: 0;
  font-size: 20px;
}

.tagline {
  margin: 4px 0 0;
  color: var(--accent);
  font-weight: 600;
}

.insight-callout {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-size: 14px;
  line-height: 1.6;
}

.insight-callout.warn {
  background: #fff7ed;
  border-color: #fed7aa;
}

.formula-box {
  margin: 12px 0;
  padding: 12px;
  text-align: center;
  font-weight: 800;
  border-radius: 8px;
  background: #111827;
  color: #f9fafb;
}

.preview-map {
  margin: 12px 0;
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
}

.preview-map .campus-svg {
  width: 100%;
  height: auto;
  display: block;
}

.narrative-lead {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
}

.step-narrative {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  font-size: 14px;
  line-height: 1.6;
}

.worked-controls-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.worked-controls-inline button {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  cursor: pointer;
  font-weight: 700;
}

.worked-controls-inline button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.worked-map-slot {
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
}

.campus-svg {
  width: 100%;
  height: auto;
  display: block;
  max-width: 100%;
}

.campus-frame {
  margin: 12px 0;
}

.campus-map-lab,
.campus-map-static {
  width: 100%;
}

.campus-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 12px 0;
  font-size: 13px;
}

.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.legend-dot.visited { background: var(--red); }
.legend-dot.frontier { background: transparent; border: 2px solid var(--blue); }
.legend-dot.current { background: var(--amber); }
.legend-dot.path { background: var(--green); }

.graph-node .node-id {
  font-size: 12px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: central;
}

.graph-node .node-name {
  font-size: 11px;
  fill: var(--muted);
  font-weight: 600;
}

.graph-edge.in-path {
  stroke: var(--green);
  stroke-width: 2.5;
}

.chess-story p {
  margin: 0 0 8px;
  line-height: 1.65;
  color: var(--muted);
}

.minimax-tree-host {
  margin: 16px 0;
  border-radius: 8px;
  background: #f8fafc;
  overflow: auto;
}

.game-tree-svg {
  width: 100%;
  min-width: 0;
  height: auto;
  display: block;
}

.tree-edge {
  stroke: #94a3b8;
  stroke-width: 2;
}

.tree-edge.is-pruned {
  stroke: #e2e8f0;
  stroke-dasharray: 4 4;
}

.tree-node rect {
  fill: #fff;
  stroke: #cbd5e1;
  stroke-width: 2;
}

.tree-node text {
  text-anchor: middle;
  dominant-baseline: central;
  font-size: 11px;
  font-weight: 700;
}

.tree-node.max rect { fill: #eff6ff; }
.tree-node.min rect { fill: #fef3c7; }
.tree-node.is-highlighted rect { stroke: var(--accent); stroke-width: 3; }
.tree-node.is-chosen rect { fill: #d1fae5; stroke: var(--green); }
.tree-node.is-pruned { opacity: 0.35; }

.comparison-ladder {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.comparison-ladder article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
}

.comparison-ladder h4 {
  margin: 0 0 8px;
  color: var(--accent);
}

.comparison-ladder p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.mirror-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.mirror-cards blockquote {
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  background: #f1f5f9;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.mirror-cards cite {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--accent);
  font-style: normal;
}

.mirror-closing {
  text-align: center;
  font-size: 18px;
  margin: 20px 0 0;
}

.app-footer {
  padding: 20px clamp(16px, 3vw, 36px);
  text-align: center;
}

.app-footer a {
  color: var(--accent);
  font-weight: 700;
}

.pseudo-compact {
  margin: 0;
  max-height: 200px;
  overflow: auto;
  font-size: 12px;
}

.run-table tr.is-active {
  background: #ecfdf5;
}

.run-table.compact {
  font-size: 13px;
}

.selection-reason {
  margin: 10px 0;
  font-size: 14px;
}

@media (max-width: 900px) {
  .hero-section,
  .dual-track-block,
  .comparison-ladder,
  .mirror-cards {
    grid-template-columns: 1fr;
  }

  .section-nav-sticky {
    overflow-x: visible;
    flex-wrap: wrap;
    padding-bottom: 8px;
  }

  .section-link {
    flex: 0 0 auto;
  }
}
