/* =========================================================
   同一张图，两种走法 — OSPF × RIP
   Design tokens
   ========================================================= */
:root {
  --paper: #f3f0e8;
  --paper-2: #fbfaf6;
  --paper-3: #ece8dd;
  --ink: #111418;
  --ink-2: #2a3039;
  --muted: #626974;
  --muted-2: #8a8f97;
  --line: #d9d4c6;
  --line-strong: #bbb4a3;
  --blue: #1b4dff;
  --blue-soft: #e3e9ff;
  --blue-glow: #5b8cff;
  --orange: #e24e1b;
  --orange-ink: #b23a12;
  --orange-soft: #ffe9de;
  --dark: #0c1015;
  --dark-2: #10161e;
  --dark-3: #151d27;
  --dark-line: rgba(255, 255, 255, 0.09);
  --dark-text: #e9eff5;
  --dark-muted: #8e99a8;
  --mint: #79e0b6;
  --yellow: #f2c14e;
  --green: #1f8a5b;
  --red: #c2412f;
  --sans: "Segoe UI Variable Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "SF Mono", "JetBrains Mono", "Consolas", "Liberation Mono", "Microsoft YaHei", "PingFang SC", monospace;
  --max: 1320px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  font-feature-settings: "kern" 1;
  overflow-x: hidden;
}

::selection { background: var(--blue); color: #fff; }

h1, h2, h3, h4, p, dl, dd, figure, blockquote { margin: 0; }
ul, ol { margin: 0; padding: 0; }
button { font: inherit; color: inherit; }
a { color: inherit; }
img, svg { max-width: 100%; }

.mono { font-family: var(--mono); letter-spacing: -0.01em; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: fixed;
  top: -60px; left: 16px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

/* =========================================================
   Progress + header
   ========================================================= */
.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 120;
  background: transparent;
  pointer-events: none;
}
.progress span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue), #7c9bff);
}

.site-head {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 76px;
  padding: 0 40px;
  border-bottom: 1px solid transparent;
  transition: background 0.35s, border-color 0.35s, height 0.35s;
}
.site-head.is-scrolled {
  height: 64px;
  background: rgba(243, 240, 232, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex: 0 0 auto;
}
.brand-mark { width: 30px; height: 30px; color: var(--ink); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--mono); font-size: 14px; letter-spacing: -0.02em; font-weight: 600; }
.brand-text small { font-size: 9px; letter-spacing: 0.18em; color: var(--muted); text-transform: uppercase; }
.nav {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-left: auto;
}
.nav a {
  position: relative;
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  padding: 4px 0;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: 0;
  height: 1px;
  background: var(--blue);
  transition: right 0.3s var(--ease);
}
.nav a:hover::after,
.nav a.is-current::after { right: 0; }
.head-cta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.25s, color 0.25s;
}
.head-cta:hover { background: var(--ink); color: var(--paper); }

/* =========================================================
   Hero
   ========================================================= */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 132px 40px 88px;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(17, 20, 24, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 20, 24, 0.045) 1px, transparent 1px);
  background-size: 78px 78px;
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 78% 42%, #000 20%, transparent 72%);
  mask-image: radial-gradient(ellipse 70% 80% at 78% 42%, #000 20%, transparent 72%);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  width: 720px; height: 720px;
  right: -180px; top: -120px;
  background: radial-gradient(circle, rgba(27, 77, 255, 0.10), transparent 62%);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: clamp(44px, 5vw, 88px);
  align-items: center;
}
.eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--ink-2);
  text-transform: uppercase;
}
.eyebrow-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 4px rgba(226, 78, 27, 0.12);
}
.eyebrow-en { color: var(--muted-2); letter-spacing: 0.12em; }
.hero h1 {
  margin-top: 26px;
  font-size: clamp(56px, 7.4vw, 112px);
  line-height: 0.98;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.hero h1 .accent {
  color: var(--blue);
  position: relative;
  display: inline-block;
}
.hero h1 .accent::after {
  content: "";
  position: absolute;
  left: 1%;
  right: 3%;
  bottom: 0.02em;
  height: 4px;
  background: var(--blue);
  opacity: 0.3;
  border-radius: 2px;
}
.hero-sub {
  margin-top: 30px;
  max-width: 47ch;
  font-size: clamp(15.5px, 1.25vw, 17.5px);
  line-height: 1.85;
  color: var(--ink-2);
}
.hero-sub strong { color: var(--ink); font-weight: 650; }
.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 38px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-radius: 3px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.25s;
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--blue); transform: translateY(-2px); }
.btn-arrow { transition: transform 0.25s var(--ease); }
.btn-primary:hover .btn-arrow { transform: translateX(4px); }
.btn-quiet { border: 1px solid var(--line-strong); color: var(--ink); }
.btn-quiet:hover { border-color: var(--ink); background: rgba(255, 255, 255, 0.4); }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, auto);
  justify-content: start;
  gap: 0;
  margin-top: 54px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.hero-stats > div {
  padding: 0 26px;
  border-left: 1px solid var(--line);
}
.hero-stats > div:first-child { padding-left: 0; border-left: 0; }
.hero-stats dt {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
}
.hero-stats dd {
  margin-top: 2px;
  font-size: 27px;
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.hero-stats dd span {
  margin-left: 3px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.hero-visual { position: relative; }
.device {
  background: #0b0f14;
  border: 1px solid #1c2530;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 50px 90px -45px rgba(17, 20, 24, 0.62), 0 0 0 1px rgba(255, 255, 255, 0.4) inset;
}
.device-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--dark-line);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  color: var(--dark-muted);
}
.device-live { display: inline-flex; align-items: center; gap: 7px; color: var(--mint); }
.device-live i {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 3px rgba(121, 224, 182, 0.14);
  animation: blink 2.4s ease-in-out infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.device-canvas {
  position: relative;
  padding: 6px 4px 0;
  background-color: #0b0f14;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
}
.device-canvas svg { display: block; width: 100%; height: auto; }
#heroGraph .node { cursor: default; }
#heroGraph .node-label { font-size: 17px; }
#heroGraph .node-body { stroke-width: 1.8; }
.device-foot {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 11px 16px 13px;
  border-top: 1px solid var(--dark-line);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  color: var(--dark-muted);
}
.lg { display: inline-flex; align-items: center; gap: 7px; }
.lg i { width: 14px; height: 2px; border-radius: 2px; }
.lg-ospf i { background: var(--blue-glow); box-shadow: 0 0 8px rgba(91, 140, 255, 0.7); }
.lg-rip i { background: repeating-linear-gradient(90deg, #ff7a45 0 4px, transparent 4px 7px); }
.device-note { margin-left: auto; color: #c8d2df; }
.hero-caption {
  margin-top: 16px;
  font-size: 12px;
  line-height: 1.75;
  color: var(--muted);
  max-width: 46ch;
}
.hero-scroll {
  position: absolute;
  left: 40px;
  bottom: 26px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--muted-2);
}
.hero-scroll span {
  display: block;
  width: 44px; height: 1px;
  background: var(--line-strong);
  position: relative;
  overflow: hidden;
}
.hero-scroll span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--blue);
  transform: translateX(-100%);
  animation: scrollLine 2.6s ease-in-out infinite;
}
@keyframes scrollLine {
  0% { transform: translateX(-100%); }
  55%, 100% { transform: translateX(100%); }
}

/* Hero entrance */
.hero-copy > * { animation: rise 0.9s var(--ease) both; }
.hero-copy > *:nth-child(2) { animation-delay: 0.06s; }
.hero-copy > *:nth-child(3) { animation-delay: 0.12s; }
.hero-copy > *:nth-child(4) { animation-delay: 0.18s; }
.hero-copy > *:nth-child(5) { animation-delay: 0.26s; }
.hero-visual { animation: rise 1.1s 0.2s var(--ease) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}

/* =========================================================
   Shared section structure
   ========================================================= */
.section {
  padding: 112px 40px;
}
.section > * {
  max-width: var(--max);
  margin-left: auto;
  margin-right: auto;
}
.section-alt {
  background: linear-gradient(180deg, #eeeade 0%, var(--paper) 100%);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.sec-head {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 30px;
  padding-top: 26px;
  border-top: 1px solid var(--line-strong);
  margin-bottom: 60px;
}
.sec-num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--blue);
  padding-top: 6px;
}
.kicker {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.sec-head h2 {
  margin-top: 14px;
  font-size: clamp(36px, 4.4vw, 64px);
  line-height: 1.06;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.lede {
  margin-top: 20px;
  max-width: 64ch;
  font-size: clamp(15.5px, 1.3vw, 18px);
  line-height: 1.85;
  color: var(--ink-2);
}
.lede .mono { font-size: 0.94em; color: var(--ink); }
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.tag-blue { color: var(--blue); border-color: rgba(27, 77, 255, 0.35); background: var(--blue-soft); }
.tag-orange { color: var(--orange-ink); border-color: rgba(226, 78, 27, 0.3); background: var(--orange-soft); }
.tag-ink { color: var(--paper); background: var(--ink); border-color: var(--ink); }

/* Reveal */
[data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: var(--d, 0s);
}
[data-reveal].in { opacity: 1; transform: none; }

/* =========================================================
   01 Graph
   ========================================================= */
.concept-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.concept {
  background: var(--paper-2);
  padding: 32px 30px 30px;
  transition: background 0.3s;
}
.concept:hover { background: #fff; }
.concept-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
}
.concept-mark {
  font-family: var(--mono);
  font-size: 26px;
  color: var(--line-strong);
  line-height: 1;
}
.concept h3 { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.concept p {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.85;
  color: var(--ink-2);
}
.concept p strong { color: var(--ink); }
.concept-math {
  font-family: var(--sans);
  font-size: 12.5px !important;
  color: var(--muted) !important;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.concept-math .katex { font-size: 1.04em; }
.formula-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 28px;
  background: var(--ink);
  color: var(--dark-text);
  border-radius: 6px;
  overflow: hidden;
}
.formula-cell {
  padding: 26px 28px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}
.formula-cell:first-child { border-left: 0; }
.formula-label {
  display: block;
  font-family: var(--sans);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: #93a0b0;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.formula {
  display: flex;
  align-items: center;
  min-height: 64px;
  font-size: clamp(14px, 1.35vw, 16px);
  line-height: 1.7;
  color: #f2f5f9;
  overflow-x: auto;
  padding-bottom: 2px;
}
.formula .katex { font-size: 1.12em; }
.formula-sub {
  display: block;
  margin-top: 8px;
  font-family: var(--sans);
  font-size: 10.5px;
  color: #93a0b0;
}
.formula-note {
  grid-column: 1 / -1;
  padding: 16px 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: #9aa5b4;
  background: rgba(255, 255, 255, 0.02);
}
.formula-note em { color: var(--blue-glow); font-style: normal; }
.relation-note {
  display: flex;
  align-items: flex-start;
  gap: 22px;
  margin-top: 28px;
  padding: 24px 28px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: 0 4px 4px 0;
}
.relation-note .tag { margin-top: 3px; flex: 0 0 auto; }
.relation-note p { font-size: 14px; line-height: 1.85; color: var(--ink-2); max-width: 80ch; }
.relation-note strong { color: var(--ink); }

/* =========================================================
   02 Algorithms
   ========================================================= */
.algo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}
.algo-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 34px 34px 30px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.algo-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.algo-head h3 {
  font-size: clamp(26px, 2.6vw, 36px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  order: -1;
}
.algo-sub { font-family: var(--mono); font-size: 10px; font-weight: 400; letter-spacing: 0.1em; color: var(--muted); }
.algo-badge {
  display: inline-flex;
  padding: 3px 9px;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.badge-ospf { background: var(--blue); color: #fff; }
.badge-rip { background: #b83b12; color: #fff; }
.algo-desc { margin-top: 18px; font-size: 14.5px; line-height: 1.85; color: var(--ink-2); }
.code {
  margin: 24px 0 0;
  padding: 22px 22px;
  background: #0e141b;
  border-radius: 4px;
  overflow-x: auto;
  border: 1px solid #1e2833;
  max-width: 100%;
}
.code code {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.9;
  color: #cfd9e6;
  white-space: pre;
}
.equation {
  margin-top: 24px;
  padding: 22px 24px;
  background: var(--blue-soft);
  border-left: 3px solid var(--blue);
  border-radius: 0 4px 4px 0;
  font-size: 15px;
  color: var(--ink);
  overflow-x: auto;
}
/* 公式较长时仍可横向滑动，但不显示原生滚动条 */
.formula,
.math-line,
.connect-math,
.equation {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.formula::-webkit-scrollbar,
.math-line::-webkit-scrollbar,
.connect-math::-webkit-scrollbar,
.equation::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.math-line {
  font-size: 16px;
  line-height: 1.5;
  overflow-x: auto;
  padding: 2px 0 4px;
}
.math-line .katex { font-size: 1.03em; }
.math { font-size: 0.98em; }
.equation p { margin-top: 10px; font-family: var(--sans); font-size: 12.5px; line-height: 1.7; color: var(--ink-2); }
.algo-points {
  list-style: none;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 11px;
}
.algo-points li {
  position: relative;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--ink-2);
}
.algo-points li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.72em;
  width: 6px; height: 6px;
  border: 1px solid var(--blue);
  transform: rotate(45deg);
}
.algo-points strong { color: var(--ink); }
.algo-extra { margin-top: auto; padding-top: 26px; }
.algo-extra-label {
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.algo-extra p:last-child {
  padding: 14px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 4px;
  background: var(--paper);
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--ink-2);
}
.insight {
  display: flex;
  align-items: flex-start;
  gap: 22px;
  margin-top: 40px;
  padding: 30px 12px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}
.insight-mark {
  font-family: var(--mono);
  font-size: 26px;
  line-height: 1;
  color: var(--blue);
  flex: 0 0 auto;
  margin-top: 2px;
}
.insight p { font-size: clamp(15px, 1.4vw, 18px); line-height: 1.8; color: var(--ink-2); max-width: 92ch; }
.insight strong { color: var(--ink); }

/* =========================================================
   03 OSPF
   ========================================================= */
.ospf-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 48px;
  align-items: start;
}
.flow { list-style: none; }
.flow li {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 18px;
  padding-bottom: 34px;
}
.flow li:last-child { padding-bottom: 0; }
.flow li::before {
  content: "";
  position: absolute;
  left: 28px;
  top: 44px;
  bottom: 6px;
  width: 1px;
  background: var(--line);
}
.flow li:last-child::before { display: none; }
.flow-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--blue);
  background: var(--paper);
  position: relative;
  z-index: 1;
}
.flow h3 { margin-top: 12px; font-size: 19px; font-weight: 650; letter-spacing: -0.01em; }
.flow p { margin-top: 9px; font-size: 14px; line-height: 1.85; color: var(--ink-2); max-width: 60ch; }
.fact-card {
  background: var(--ink);
  color: var(--dark-text);
  border-radius: 6px;
  padding: 30px 30px 26px;
  position: sticky;
  top: 100px;
}
.fact-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  color: var(--blue-glow);
  text-transform: uppercase;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.fact-list { display: grid; gap: 0; }
.fact-list > div {
  padding: 15px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.fact-list > div:last-child { border-bottom: 0; padding-bottom: 0; }
.fact-list dt {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: #7f8a99;
  text-transform: uppercase;
}
.fact-list dd { margin: 5px 0 0; font-size: 13px; line-height: 1.7; color: #d7dfe9; }
.fact-list dd .mono { color: #f2f5f9; font-size: 11px; }
.callout {
  margin-top: 54px;
  padding: 44px 48px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  position: relative;
}
.callout::before {
  content: "“";
  position: absolute;
  top: 6px; left: 28px;
  font-family: Georgia, serif;
  font-size: 90px;
  line-height: 1;
  color: var(--line);
}
.callout-kicker {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--muted);
}
.callout-text {
  position: relative;
  margin-top: 14px;
  font-size: clamp(22px, 2.5vw, 34px);
  line-height: 1.5;
  font-weight: 650;
  letter-spacing: -0.015em;
  max-width: 24em;
}
.callout-sub { margin-top: 18px; font-size: 14px; line-height: 1.85; color: var(--ink-2); max-width: 72ch; }
.jump-link {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  margin-top: 30px;
  padding: 4px 0 7px;
  border-bottom: 1px solid var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: gap 0.25s var(--ease), color 0.25s;
}
.jump-link:hover { gap: 26px; color: var(--blue); border-color: var(--blue); }
.jump-arrow { font-family: var(--mono); }

/* =========================================================
   04 RIP
   ========================================================= */
.rip-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}
.equation-dark {
  background: var(--ink);
  color: var(--dark-text);
  border-left: 3px solid var(--orange);
  margin-top: 0;
  font-size: 16px;
}
.equation-dark .mono { color: #fff; }
.equation-dark p { color: #9aa5b4; }
.plain-list {
  list-style: none;
  margin-top: 28px;
  display: grid;
  gap: 14px;
}
.plain-list li {
  position: relative;
  padding-left: 22px;
  font-size: 14px;
  line-height: 1.85;
  color: var(--ink-2);
}
.plain-list li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--orange);
  font-family: var(--mono);
}
.plain-list strong { color: var(--ink); }
.remedy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 28px;
  border: 1px solid var(--line);
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.remedy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  background: var(--paper-2);
  font-size: 13px;
  font-weight: 600;
}
.remedy small { font-size: 11px; font-weight: 400; color: var(--muted); }
.count-demo {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 26px 28px 24px;
}
.count-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.count-title { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.count-sub { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em; color: var(--muted); }
.count-meter { margin: 24px 0 18px; }
.meter-track {
  position: relative;
  height: 9px;
  background: #e2ddd0;
  border-radius: 6px;
  overflow: visible;
}
.meter-fill {
  position: absolute;
  inset: 0 6% 0 0;
  border-radius: 6px;
  background: linear-gradient(90deg, #f5a623, var(--orange) 60%, var(--red));
}
.meter-fill::after {
  content: "";
  position: absolute;
  right: -1px; top: -4px;
  width: 2px; height: 17px;
  background: var(--red);
  border-radius: 2px;
}
.meter-inf {
  position: absolute;
  right: -6px;
  top: -30px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--red);
  white-space: nowrap;
}
.meter-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
}
.count-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.count-table th {
  padding: 7px 8px;
  text-align: left;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line-strong);
  font-weight: 500;
}
.count-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
}
.count-table tr:last-child td { border-bottom: 0; }
.count-table td:first-child { font-family: var(--mono); font-size: 10.5px; color: var(--muted); width: 22%; }
.count-ellipsis td { color: var(--muted-2) !important; }
.count-end td { font-weight: 650; color: var(--red) !important; background: rgba(194, 65, 47, 0.05); }
.count-note { margin-top: 14px; font-size: 12px; line-height: 1.75; color: var(--muted); }

/* =========================================================
   05 Lab (dark)
   ========================================================= */
.lab-section { padding-bottom: 96px; }
.lab {
  background: #0b0f14;
  border: 1px solid #05080b;
  border-radius: 10px;
  overflow: hidden;
  color: var(--dark-text);
  box-shadow: 0 50px 100px -60px rgba(11, 15, 20, 0.65);
}
.lab-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 18px;
  min-height: 58px;
  border-bottom: 1px solid var(--dark-line);
  background: #0d1218;
  flex-wrap: wrap;
}
.lab-tabs { display: flex; align-items: stretch; gap: 2px; }
.lab-tab {
  position: relative;
  padding: 19px 16px 17px;
  border: 0;
  background: transparent;
  color: #8e99a8;
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}
.lab-tab:hover { color: #dfe6ef; background: rgba(255, 255, 255, 0.03); }
.lab-tab.is-active { color: #fff; }
.lab-tab.is-active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 0;
  height: 2px;
  background: var(--blue-glow);
}
.lab-live {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #aeb9c7;
}
.led {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 3px rgba(121, 224, 182, 0.13), 0 0 10px rgba(121, 224, 182, 0.6);
}
.lab-config {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 18px;
  border-bottom: 1px solid var(--dark-line);
  background: #0a0e13;
  font-size: 11px;
  color: var(--dark-muted);
}
.config-field { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }
.config-field select {
  appearance: none;
  -webkit-appearance: none;
  background: #131a22 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='6'%3E%3Cpath d='M0 0l4.5 6L9 0z' fill='%238e99a8'/%3E%3C/svg%3E") no-repeat right 9px center;
  border: 1px solid #2a3542;
  border-radius: 3px;
  color: #e9eff5;
  font-family: var(--mono);
  font-size: 11px;
  padding: 6px 26px 6px 10px;
  cursor: pointer;
}
.config-arrow { color: #4d5a6a; font-family: var(--mono); }
.config-meta { margin-left: auto; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.06em; color: #93a0b0; }
.mini-btn {
  border: 1px solid #2f3b49;
  background: transparent;
  color: #c8d2df;
  border-radius: 3px;
  padding: 6px 11px;
  font-size: 11px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.mini-btn:hover { border-color: #5b8cff; color: #fff; background: rgba(91, 140, 255, 0.08); }
.mini-btn-light { border-color: var(--line-strong); color: var(--ink-2); }
.mini-btn-light:hover { border-color: var(--ink); color: var(--ink); background: transparent; }

.lab-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 9px 18px;
  border-bottom: 1px solid var(--dark-line);
  background: #0d1218;
}
.tools-label {
  margin-right: 3px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #93a0b0;
}
.tool-btn {
  border: 1px solid #2f3b49;
  background: #131a22;
  color: #c8d2df;
  border-radius: 3px;
  padding: 6px 10px;
  font-size: 11px;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.tool-btn:hover:not(:disabled) { border-color: #5b8cff; color: #fff; }
.tool-btn.is-active {
  background: var(--blue-glow);
  border-color: var(--blue-glow);
  color: #081022;
  font-weight: 650;
}
.tool-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.tool-undo { margin-left: 2px; }
.tool-hint {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: #93a0b0;
}
.lab[data-tool="add-node"] .canvas-scroll svg { cursor: crosshair; }
.lab[data-tool="add-edge"] .node { cursor: pointer; }
.lab[data-tool="delete"] .node { cursor: crosshair; }
.lab[data-tool="delete"] .edge-hit { cursor: crosshair; }

.lab-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 384px;
}
.canvas-pane {
  position: relative;
  min-width: 0;
  padding-bottom: 42px;
  background-color: #0b0f14;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.038) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.038) 1px, transparent 1px);
  background-size: 46px 46px;
  border-right: 1px solid var(--dark-line);
}
.canvas-scroll { width: 100%; }
.canvas-scroll > svg { display: block; width: 100%; height: auto; touch-action: none; user-select: none; }
.canvas-legend {
  position: absolute;
  left: 16px; bottom: 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 7px 11px;
  background: rgba(9, 13, 18, 0.82);
  border: 1px solid var(--dark-line);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: #a7b2c0;
  backdrop-filter: blur(4px);
}
.canvas-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.sw { display: inline-block; width: 16px; height: 2px; border-radius: 2px; }
.sw-ospf { background: var(--blue-glow); box-shadow: 0 0 7px rgba(91, 140, 255, 0.6); }
.sw-rip { background: repeating-linear-gradient(90deg, #ff7a45 0 4px, transparent 4px 7px); }
.canvas-hint { color: #93a0b0; }
.canvas-legend > span.canvas-scroll-tip { display: none; color: #ff9b78; }

.edge-editor {
  position: absolute;
  right: 16px; bottom: 52px;
  width: 232px;
  background: #0e141b;
  border: 1px solid #2c3745;
  border-radius: 4px;
  padding: 10px 11px;
  box-shadow: 0 16px 32px -12px rgba(0, 0, 0, 0.7);
}
.edge-editor[hidden] { display: none; }
.ee-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #c8d2df;
  padding-bottom: 8px;
  border-bottom: 1px solid #222c37;
}
.ee-head button {
  border: 0; background: none; color: #93a0b0; font-size: 16px;
  line-height: 1; cursor: pointer; padding: 0 2px;
}
.ee-head button:hover { color: #fff; }
.ee-row { display: flex; align-items: center; gap: 6px; margin-top: 9px; }
.ee-label { font-size: 10px; color: #93a0b0; margin-right: auto; font-family: var(--mono); letter-spacing: 0.08em; }
.ee-row button {
  width: 24px; height: 24px;
  border: 1px solid #2f3b49;
  background: #151d27;
  color: #dfe6ef;
  border-radius: 3px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.ee-row button:hover { border-color: #5b8cff; }
.ee-row output {
  min-width: 22px;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  color: #fff;
}
.ee-toggle { width: auto !important; padding: 0 9px; font-size: 10px !important; color: #ff9b78 !important; border-color: #4a3028 !important; }
.ee-toggle:hover { background: rgba(255, 122, 69, 0.1) !important; }
.ee-toggle.is-restore { color: var(--mint) !important; border-color: rgba(121, 224, 182, 0.3) !important; }

.canvas-toast {
  position: absolute;
  left: 50%; bottom: 56px;
  transform: translate(-50%, 8px);
  padding: 7px 13px;
  background: rgba(17, 24, 32, 0.94);
  border: 1px solid #33404f;
  border-radius: 3px;
  font-size: 11px;
  color: #dbe4ee;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
}
.canvas-toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* SVG graph */
.graph svg text { user-select: none; }
.edge-line { stroke: #2c3744; stroke-width: 2; fill: none; pointer-events: none; }
.edge-line.is-disabled { stroke: #5a3030; stroke-width: 1.6; stroke-dasharray: 4 6; opacity: 0.65; }
.edge-line.is-selected { stroke: var(--yellow); stroke-width: 2.6; }
.edge-hit { stroke: transparent; stroke-width: 20; fill: none; cursor: pointer; outline: none; }
.edge-hit:hover + .edge-line { stroke: #4a5a6e; }
.edge-hit:focus-visible + .edge-line { stroke: #ffffff; stroke-width: 2.6; }
.node:focus-visible { outline: none; }
.node:focus-visible .node-body { stroke: #ffffff; stroke-width: 3; }
.edge-weight-bg { fill: #0b1016; stroke: #2c3744; stroke-width: 1; }
.edge-weight-text {
  fill: #93a0b0;
  font-family: var(--mono);
  font-size: 10.5px;
  text-anchor: middle;
  dominant-baseline: central;
}
.edge-weight-bg.is-selected { stroke: var(--yellow); }
.edge-weight-text.is-selected { fill: var(--yellow); }

.node { cursor: grab; }
.node.is-dragging { cursor: grabbing; }
.node-body {
  fill: #141d27;
  stroke: #3a4a5c;
  stroke-width: 1.6;
  transition: fill 0.25s, stroke 0.25s;
}
.node:hover .node-body { stroke: #6d7d92; }
.node-label {
  fill: #eaf0f6;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}
.node-caption {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  fill: #9aa5b4;
  text-anchor: middle;
  pointer-events: none;
}
.node.is-source .node-body { stroke: var(--blue-glow); stroke-width: 2.5; }
.node.is-target .node-body { stroke: #ff7a45; stroke-width: 2.5; }
.node.is-visited .node-body { fill: #152a52; stroke: var(--blue-glow); }
.node.is-current .node-body { stroke: #ffffff; stroke-width: 2.5; fill: #1c335e; }
.node.is-changed .node-body { stroke: var(--yellow); stroke-width: 2.5; }
.node.is-pending .node-body { stroke: var(--yellow); stroke-width: 3; stroke-dasharray: 5 3; }
.node.is-source .node-caption { fill: var(--blue-glow); }
.node.is-target .node-caption { fill: #ff9b78; }

.badge-bg { fill: #0b1118; stroke: #33404f; stroke-width: 1; }
.badge-text {
  fill: #c8d2df;
  font-family: var(--mono);
  font-size: 10px;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}
.badge-text.is-inf { fill: #93a0b0; }
.badge-bg.is-settled { stroke: var(--blue-glow); }

.path-ospf {
  fill: none;
  stroke: var(--blue-glow);
  stroke-width: 6.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 7px rgba(91, 140, 255, 0.45));
  pointer-events: none;
}
.path-rip {
  fill: none;
  stroke: #ff7a45;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 10 8;
  filter: drop-shadow(0 0 6px rgba(255, 122, 69, 0.4));
  pointer-events: none;
}
.tree-edge {
  fill: none;
  stroke: #5b8cff;
  stroke-width: 1.4;
  opacity: 0.55;
  stroke-dasharray: 3 4;
  pointer-events: none;
}
.tree-edge.is-rip { stroke: #ff9b78; opacity: 0.8; }
.relax-edge {
  fill: none;
  stroke: var(--yellow);
  stroke-width: 3;
  stroke-dasharray: 5 4;
  pointer-events: none;
}
.packet-ospf { fill: #dbe6ff; filter: drop-shadow(0 0 5px rgba(91, 140, 255, 0.9)); }
.packet-rip { fill: #ffe0d2; filter: drop-shadow(0 0 5px rgba(255, 122, 69, 0.9)); }
.arrow-rip { fill: #ff9b78; }

/* Side panels */
.lab-side { background: #0e141b; padding: 24px 22px 20px; min-height: 440px; }
.side-panel[hidden] { display: none; }
.panel-kicker {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  color: var(--blue-glow);
  text-transform: uppercase;
}
.side-panel h3 { margin-top: 10px; font-size: 21px; font-weight: 650; letter-spacing: -0.01em; color: #fff; }
.panel-desc { margin-top: 9px; font-size: 12px; line-height: 1.75; color: #8e99a8; }
.route-card {
  margin-top: 16px;
  padding: 13px 15px 12px;
  border: 1px solid var(--dark-line);
  border-left: 2px solid var(--blue-glow);
  border-radius: 0 4px 4px 0;
  background: rgba(255, 255, 255, 0.025);
}
.route-rip { border-left-color: #ff7a45; margin-top: 10px; }
.route-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.route-head > span:first-child { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; color: #c8d2df; }
.route-metric { font-family: var(--mono); font-size: 10px; color: #8e99a8; }
.route-path {
  margin-top: 9px;
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.5;
  color: #fff;
  letter-spacing: 0.02em;
  word-break: break-word;
}
.route-sub { margin-top: 4px; font-size: 10.5px; color: #93a0b0; }
.route-note { margin-top: 16px; font-size: 11.5px; line-height: 1.8; color: #9aa5b4; }
.panel-tip {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--dark-line);
}
.tip-mark {
  flex: 0 0 auto;
  width: 16px; height: 16px;
  border: 1px solid #3b4858;
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 9px;
  line-height: 14px;
  text-align: center;
  color: #8e99a8;
  margin-top: 2px;
}
.panel-tip p { font-size: 10.5px; line-height: 1.7; color: #93a0b0; }

.step-message {
  margin-top: 14px;
  min-height: 74px;
  padding: 11px 12px;
  background: #0a0f15;
  border: 1px solid #222c37;
  border-left: 2px solid var(--yellow);
  border-radius: 0 3px 3px 0;
  font-size: 11.5px;
  line-height: 1.7;
  color: #c8d2df;
}
.table-wrap { margin-top: 12px; overflow-x: auto; }
.dv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.dv-table th {
  padding: 6px 6px;
  text-align: left;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #93a0b0;
  border-bottom: 1px solid #2a3542;
  font-weight: 500;
  white-space: nowrap;
}
.dv-table td {
  padding: 6px 6px;
  border-bottom: 1px solid #1b232d;
  color: #c8d2df;
  font-family: var(--mono);
  font-size: 10.5px;
  white-space: nowrap;
}
.dv-table tbody tr:last-child td { border-bottom: 0; }
.dv-table tr.is-active td { background: rgba(242, 193, 78, 0.09); color: #fff; }
.dv-table tr.is-settled td:first-child { color: var(--blue-glow); }
.dv-table td.is-changed { color: #ffb196; background: rgba(255, 122, 69, 0.1); }
.dv-table td.st-state { font-size: 8.5px; letter-spacing: 0.06em; color: #93a0b0; text-transform: uppercase; }
.dv-table td.st-state.is-settled { color: var(--blue-glow); }
.dv-table td.st-state.is-changed { color: #ffb196; }

.round-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 15px;
  padding: 8px 0;
  border-top: 1px solid #222c37;
  border-bottom: 1px solid #222c37;
}
.round-head > span:first-child { font-family: var(--mono); font-size: 11px; color: #fff; }
.round-change { font-family: var(--mono); font-size: 9px; color: #ff9b78; }

.transport {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
}
.t-btn {
  width: 30px; height: 30px;
  border: 1px solid #2f3b49;
  background: #131a22;
  color: #cfd9e6;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  transition: border-color 0.2s, color 0.2s, opacity 0.2s;
}
.t-btn:hover:not(:disabled) { border-color: var(--blue-glow); color: #fff; }
.t-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.t-play {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 13px;
  border: 1px solid var(--blue-glow);
  background: rgba(91, 140, 255, 0.14);
  color: #dfe8ff;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  transition: background 0.2s;
}
.t-play:hover { background: rgba(91, 140, 255, 0.26); }
.t-play.is-playing { background: var(--blue-glow); color: #081022; border-color: var(--blue-glow); }
.t-icon { font-size: 9px; }
.t-count { margin-left: auto; font-family: var(--mono); font-size: 9.5px; color: #93a0b0; white-space: nowrap; }
.panel-foot { margin-top: 12px; font-size: 9.5px; line-height: 1.65; color: #93a0b0; }

.lab-caption {
  display: flex;
  gap: 10px;
  margin-top: 18px !important;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted);
  max-width: 92ch;
}
.lab-caption-mark { color: var(--orange); font-family: var(--mono); }

/* =========================================================
   06 Compare
   ========================================================= */
.table-scroll {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-x: auto;
  background: var(--paper-2);
}
.compare-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  font-size: 13.5px;
}
.compare-table th,
.compare-table td {
  padding: 16px 22px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.compare-table thead th {
  position: sticky;
  top: 0;
  background: var(--paper-2);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--line-strong);
  z-index: 1;
}
.compare-table thead th.col-ospf { color: var(--blue); }
.compare-table thead th.col-rip { color: var(--orange-ink); }
.compare-table tbody th {
  width: 20%;
  font-weight: 600;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.015);
}
.compare-table tbody td:first-of-type { color: var(--ink-2); }
.compare-table tbody tr:last-child th,
.compare-table tbody tr:last-child td { border-bottom: 0; }
.compare-table tbody tr:hover td { background: rgba(255, 255, 255, 0.6); }

.verdict {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  margin-top: 32px;
}
.verdict-item {
  display: flex;
  gap: 18px;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper-2);
}
.verdict-num { font-family: var(--mono); font-size: 10px; color: var(--blue); padding-top: 4px; }
.verdict-item p { font-size: 13.5px; line-height: 1.85; color: var(--ink-2); }
.verdict-item strong { color: var(--ink); }

/* =========================================================
   07 Connections (dark)
   ========================================================= */
.section-dark {
  background: var(--dark);
  color: var(--dark-text);
  border-top: 1px solid #000;
}
.section-dark .sec-head { border-top-color: rgba(255, 255, 255, 0.18); }
.section-dark .sec-num { color: var(--blue-glow); }
.section-dark .kicker { color: #7f8a99; }
.section-dark .lede { color: #b3bdc9; }
.section-dark .lede .mono { color: #fff; }
.connect-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 6px;
  overflow: hidden;
}
.connect-card {
  position: relative;
  background: #0d1218;
  padding: 30px 28px 28px;
  transition: background 0.3s;
}
.connect-card:hover { background: #111821; }
.connect-idx {
  font-family: var(--mono);
  font-size: 11px;
  color: #4d5a6a;
  letter-spacing: 0.1em;
}
.connect-card h3 { margin-top: 16px; font-size: 20px; font-weight: 650; color: #fff; }
.connect-math {
  margin-top: 10px;
  font-size: 13.5px;
  color: var(--blue-glow);
  overflow-x: auto;
  padding-bottom: 2px;
}
.connect-math .katex { font-size: 1.02em; }
.connect-card p:not(.connect-math):not(.connect-tag) {
  margin-top: 14px;
  font-size: 12.5px;
  line-height: 1.85;
  color: #a9b4c1;
}
.connect-card p strong { color: #e9eff5; }
.connect-card p .mono { color: #dfe6ef; }
.connect-tag {
  margin-top: 20px !important;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--mono);
  font-size: 8.5px !important;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #93a0b0 !important;
}
.connect-quote {
  margin: 64px auto 0 !important;
  padding: 36px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  max-width: 900px;
  text-align: center;
}
.connect-quote p {
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 1.65;
  font-weight: 500;
  color: #e9eff5;
  letter-spacing: -0.01em;
}
.connect-quote cite {
  display: block;
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  font-style: normal;
  color: #93a0b0;
}

/* =========================================================
   08 Quiz
   ========================================================= */
.quiz { max-width: 980px; }
.quiz-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}
.q {
  padding: 30px 0 28px;
  border-bottom: 1px solid var(--line);
}
.q-index { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; color: var(--blue); }
.q h3 { margin-top: 8px; font-size: clamp(18px, 1.9vw, 24px); font-weight: 650; letter-spacing: -0.01em; }
.q-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.q-opt {
  text-align: left;
  padding: 13px 16px;
  border: 1px solid var(--line-strong);
  background: var(--paper-2);
  border-radius: 3px;
  font-size: 13.5px;
  line-height: 1.5;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.q-opt:hover:not(:disabled) { border-color: var(--ink); background: #fff; }
.q-opt:disabled { cursor: default; }
.q-opt.is-correct { border-color: var(--green); background: #e8f5ee; color: #145c3c; font-weight: 600; }
.q-opt.is-wrong { border-color: var(--red); background: #fbeae6; color: var(--red); animation: shake 0.4s; }
.q-opt.is-faded { opacity: 0.45; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.q-feedback {
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--ink-2);
  min-height: 0;
}
.q-feedback:empty { display: none; }
.q-feedback.is-right { padding: 12px 16px; background: #e8f5ee; border-left: 3px solid var(--green); color: #145c3c; }
.q-feedback.is-wrong { padding: 12px 16px; background: #fbeae6; border-left: 3px solid var(--red); color: #8f2f1f; }
.q.is-solved .q-index { color: var(--green); }

/* =========================================================
   Footer
   ========================================================= */
.site-foot {
  background: #0b0f14;
  color: #c8d2df;
  padding: 64px 40px 24px;
}
.foot-main {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.7fr);
  gap: 48px;
  padding-bottom: 48px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.foot-mark { font-size: 22px; color: #fff; letter-spacing: -0.02em; }
.foot-brand p { margin-top: 16px; font-size: 12.5px; line-height: 1.85; color: #8e99a8; }
.foot-label {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.2em;
  color: #8a94a3;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.foot-refs p:not(.foot-label) { font-size: 11.5px; line-height: 2; color: #8e99a8; }
.foot-refs em { color: #c8d2df; }
.foot-nav { display: flex; flex-direction: column; gap: 6px; }
.foot-nav a { font-size: 12px; color: #8e99a8; text-decoration: none; width: fit-content; }
.foot-nav a:hover { color: #fff; }
.foot-bottom {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: #8a94a3;
  text-transform: uppercase;
}
.foot-bottom a { color: #8e99a8; text-decoration: none; }
.foot-bottom a:hover { color: #fff; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1180px) {
  .hero-inner { grid-template-columns: 1fr; gap: 56px; }
  .hero { padding-top: 120px; }
  .hero-visual { max-width: 760px; }
  .hero h1 { max-width: 12em; }
  .nav { gap: 20px; }
  .lab-main { grid-template-columns: minmax(0, 1fr) 348px; }
}
@media (max-width: 1020px) {
  .nav { display: none; }
  .head-cta { margin-left: auto; }
  .ospf-layout, .rip-layout { grid-template-columns: 1fr; gap: 40px; }
  .fact-card { position: static; }
  .algo-grid { grid-template-columns: 1fr; }
  .formula-band { grid-template-columns: 1fr; }
  .formula-cell { border-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.1); }
  .formula-cell:first-child { border-top: 0; }
  .connect-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lab-main { grid-template-columns: 1fr; }
  .canvas-pane { border-right: 0; border-bottom: 1px solid var(--dark-line); }
  .lab-side { min-height: 0; }
  .side-panel { max-width: 560px; }
}
@media (max-width: 820px) {
  .canvas-scroll {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .canvas-scroll > svg {
    width: 720px;
    max-width: none;
    touch-action: pan-x;
  }
  .canvas-scroll .node { touch-action: none; }
  .canvas-scroll .edge-weight-text { font-size: 12px; }
  .canvas-scroll .badge-text { font-size: 11px; }
  .canvas-scroll .node-caption { font-size: 11px; }
  .canvas-legend > span.canvas-hint { display: none; }
  .canvas-legend > span.canvas-scroll-tip { display: inline-flex; }
  .tool-hint { width: 100%; margin-left: 0; }
  .math-line { font-size: 14px; }
  .section { padding: 84px 24px; }
  .site-head { padding: 0 24px; }
  .hero { padding: 112px 24px 72px; }
  .hero-scroll { left: 24px; }
  .sec-head { grid-template-columns: 1fr; gap: 12px; margin-bottom: 42px; }
  .sec-num { padding-top: 0; }
  .concept-grid { grid-template-columns: 1fr; }
  .verdict { grid-template-columns: 1fr; }
  .quiz .q-options { grid-template-columns: 1fr; }
  .foot-main { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
  .hero-stats > div { padding: 0 18px; }
  .hero-stats dd { font-size: 23px; }
  .hero-caption { max-width: none; }
  .callout { padding: 34px 26px 30px; }
  .callout::before { left: 10px; }
  .count-demo { padding: 22px 20px; }
  .lab-config .config-meta { margin-left: 0; }
}
@media (max-width: 620px) {
  .hero h1 { font-size: clamp(44px, 13vw, 68px); }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 20px; }
  .hero-stats > div { border-left: 0; padding: 0; }
  .hero-stats > div:nth-child(even) { border-left: 1px solid var(--line); padding-left: 18px; }
  .connect-grid { grid-template-columns: 1fr; }
  .foot-main { grid-template-columns: 1fr; gap: 32px; }
  .foot-bottom { flex-direction: column; align-items: flex-start; }
  .lab-tabs { overflow-x: auto; width: 100%; }
  .lab-tab { padding: 17px 12px 15px; }
  .lab-live { display: none; }
  .lab-tools { gap: 5px; }
  .tools-label { display: none; }
  .tool-btn { padding: 6px 8px; }
  .lab-side { padding: 20px 16px; }
  .canvas-legend { left: 10px; right: 10px; bottom: 10px; gap: 10px; }
  .canvas-hint { display: none; }
  .edge-editor { width: 210px; }
  .algo-card { padding: 28px 22px 24px; }
  .formula-cell { padding: 22px 20px; }
  .verdict-item { padding: 22px; }
  .site-foot { padding: 48px 24px 20px; }
  .eyebrow { font-size: 9px; }
  .eyebrow-en { display: none; }
  .brand-text small { display: none; }
}

/* =========================================================
   Motion / print
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}
@media print {
  .site-head, .hero-scroll, .lab, .progress, .jump-link { display: none; }
  .hero { min-height: 0; }
  body { background: #fff; }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}
