/* ===== GRPO 公式解剖 · 样式 ===== */

body {
  font-family: 'Noto Sans SC', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* site nav */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid rgba(51, 65, 85, 0.4);
}
.site-nav-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.05em;
}
.site-nav-title i { color: #22d3ee; }
.site-nav-links { display: flex; gap: 0.5rem; }
.site-nav-links a {
  padding: 0.3rem 0.9rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 500;
  color: #94a3b8;
  border: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.site-nav-links a:hover { color: #e2e8f0; }
.site-nav-links a.active {
  color: #67e8f9;
  border-color: rgba(34, 211, 238, 0.35);
  background: rgba(34, 211, 238, 0.08);
}

/* hero glow background */
.hero-glow {
  background:
    radial-gradient(ellipse 60% 50% at 20% 0%, rgba(34, 211, 238, 0.12), transparent),
    radial-gradient(ellipse 50% 40% at 80% 10%, rgba(139, 92, 246, 0.10), transparent);
  pointer-events: none;
}
.hero-glow-ppo {
  background:
    radial-gradient(ellipse 60% 50% at 20% 0%, rgba(167, 139, 250, 0.14), transparent),
    radial-gradient(ellipse 50% 40% at 80% 10%, rgba(251, 113, 133, 0.10), transparent);
  pointer-events: none;
}

/* nav chips */
.nav-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.nav-chip:hover { transform: translateY(-2px); }
.chip-red    { color: #f87171; border-color: rgba(248,113,113,.35); background: rgba(248,113,113,.08); }
.chip-green  { color: #4ade80; border-color: rgba(74,222,128,.35);  background: rgba(74,222,128,.08); }
.chip-blue   { color: #60a5fa; border-color: rgba(96,165,250,.35);  background: rgba(96,165,250,.08); }
.chip-brown  { color: #d6a35c; border-color: rgba(214,163,92,.35);  background: rgba(214,163,92,.08); }
.chip-orange { color: #fb923c; border-color: rgba(251,146,60,.35);  background: rgba(251,146,60,.08); }
.chip-purple { color: #c084fc; border-color: rgba(192,132,252,.35); background: rgba(192,132,252,.08); }
.chip-gold   { color: #fbbf24; border-color: rgba(251,191,36,.35);  background: rgba(251,191,36,.08); }
.chip-plain  { color: #94a3b8; border-color: rgba(148,163,184,.35); background: rgba(148,163,184,.08); }
.chip-violet { color: #a78bfa; border-color: rgba(167,139,250,.35); background: rgba(167,139,250,.08); }
.chip-rose   { color: #fb7185; border-color: rgba(251,113,133,.35); background: rgba(251,113,133,.08); }
.chip-teal   { color: #2dd4bf; border-color: rgba(45,212,191,.35);  background: rgba(45,212,191,.08); }

/* section title */
.section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.section-title i { color: #22d3ee; font-size: 1.1rem; }
.section-title h2 { font-size: 1.35rem; font-weight: 700; color: #fff; }

/* cards */
.card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(51, 65, 85, 0.6);
  border-radius: 0.9rem;
  padding: 1.5rem;
  backdrop-filter: blur(4px);
}

/* formula */
.formula-main { font-size: 1.02rem; overflow-x: auto; }
.formula-main .katex-display { margin: 0.4em 0; }

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: #94a3b8;
  padding: 0.25rem 0;
}
.dot { width: 0.6rem; height: 0.6rem; border-radius: 9999px; flex-shrink: 0; }

/* symbol glossary */
.glossary-item {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  padding: 0.65rem 0;
  border-bottom: 1px dashed rgba(51, 65, 85, 0.45);
}
.glossary-item .sym {
  flex-shrink: 0;
  min-width: 7.5rem;
  padding: 0.3rem 0.55rem;
  border-radius: 0.45rem;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(71, 85, 105, 0.5);
  text-align: center;
  color: #e2e8f0;
  font-size: 0.85rem;
}
.glossary-item p {
  font-size: 0.82rem;
  line-height: 1.75;
  color: #94a3b8;
}
.glossary-item p strong { color: #e2e8f0; }

/* component sections */
.component-section { margin-top: 4rem; scroll-margin-top: 2rem; }

.comp-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  border-left: 3px solid;
  padding-left: 1.1rem;
  margin-bottom: 1.25rem;
}
.comp-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.7rem;
  border: 1px solid;
  font-size: 1.15rem;
  font-weight: 900;
  flex-shrink: 0;
}
.comp-badge-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem; height: 1.5rem;
  border-radius: 0.4rem;
  background: rgba(192,132,252,.15);
  border: 1px solid rgba(192,132,252,.3);
  color: #c084fc;
  font-weight: 700;
  font-size: 0.85rem;
  margin-right: 0.35rem;
}
.comp-title { font-size: 1.3rem; font-weight: 700; color: #fff; line-height: 1.35; }
.comp-sub { margin-top: 0.35rem; font-size: 0.88rem; color: #94a3b8; line-height: 1.65; }
.comp-sub strong { color: #cbd5e1; }

/* variant tables */
.variant-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.variant-table th {
  text-align: left;
  padding: 0.8rem 1.1rem;
  background: rgba(30, 41, 59, 0.8);
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(51,65,85,.6);
  white-space: nowrap;
}
.variant-table td {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid rgba(51, 65, 85, 0.35);
  color: #cbd5e1;
  line-height: 1.7;
  vertical-align: top;
}
.variant-table tr:last-child td { border-bottom: none; }
.variant-table tr:hover td { background: rgba(30, 41, 59, 0.4); }
.hl-row td { background: rgba(34, 211, 238, 0.05); }
.hl-row:hover td { background: rgba(34, 211, 238, 0.09) !important; }

/* algorithm name badges */
.algo {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 0.35rem;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  white-space: nowrap;
}
.algo-hot {
  background: rgba(34, 211, 238, 0.12);
  border-color: rgba(34, 211, 238, 0.4);
  color: #67e8f9;
}

/* insight callouts */
.insight {
  display: flex;
  gap: 0.85rem;
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  background: rgba(34, 211, 238, 0.06);
  border: 1px solid rgba(34, 211, 238, 0.2);
  font-size: 0.88rem;
  line-height: 1.75;
  color: #bae6fd;
}
.insight i { color: #22d3ee; margin-top: 0.25rem; flex-shrink: 0; }
.insight strong { color: #fff; }

/* mini table (clip behavior) */
.mini-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; text-align: center; }
.mini-table th, .mini-table td {
  padding: 0.6rem 0.5rem;
  border: 1px solid rgba(51, 65, 85, 0.5);
}
.mini-table th { background: rgba(30,41,59,.8); color: #94a3b8; }
.mini-table td:first-child { text-align: left; color: #cbd5e1; }
.cell-safe   { background: rgba(74, 222, 128, 0.08); color: #86efac; }
.cell-danger { background: rgba(248, 113, 113, 0.10); color: #fca5a5; font-weight: 700; }

/* clip design philosophy boxes */
.principle-box {
  border-radius: 0.7rem;
  padding: 1rem 1.15rem;
  border: 1px solid;
}
.principle-box h4 {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.principle-box p {
  font-size: 0.82rem;
  line-height: 1.75;
  color: #94a3b8;
}
.principle-box p strong { color: #e2e8f0; }
.principle-conservative {
  border-color: rgba(96, 165, 250, 0.3);
  background: rgba(96, 165, 250, 0.05);
}
.principle-conservative h4 { color: #93c5fd; }
.principle-aggressive {
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.05);
}
.principle-aggressive h4 { color: #fca5a5; }

/* repair routes */
.repair-routes { display: flex; flex-direction: column; gap: 0.5rem; }
.route-row {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.6rem 0.8rem;
  border-radius: 0.55rem;
  background: rgba(30, 41, 59, 0.5);
}
.route-row p { font-size: 0.82rem; line-height: 1.7; color: #94a3b8; }
.route-label {
  flex-shrink: 0;
  padding: 0.2rem 0.6rem;
  border-radius: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid;
  white-space: nowrap;
  margin-top: 0.1rem;
}
.route-patch {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.08);
}
.route-clean {
  color: #67e8f9;
  border-color: rgba(34, 211, 238, 0.4);
  background: rgba(34, 211, 238, 0.08);
}

/* tags */
.tag {
  display: inline-block;
  padding: 0.35rem 0.8rem;
  border-radius: 9999px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  color: #fcd34d;
  font-size: 0.82rem;
}

/* pipeline panorama */
.pipeline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.pipe-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.7rem 1rem 0.55rem;
  min-width: 5.2rem;
  border-radius: 0.7rem;
  border: 1px solid var(--c, #64748b);
  background: color-mix(in srgb, var(--c, #64748b) 8%, transparent);
  color: var(--c, #e2e8f0);
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
}
.pipe-node small {
  font-family: 'Noto Sans SC', sans-serif;
  font-weight: 400;
  font-size: 0.68rem;
  color: #94a3b8;
  margin-top: 0.15rem;
}
.pipe-num {
  position: absolute;
  top: -0.6rem;
  right: -0.4rem;
  width: 1.3rem; height: 1.3rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9999px;
  background: #0f172a;
  border: 1px solid var(--c, #64748b);
  font-size: 0.72rem;
}
.pipe-loss {
  --c: #e2e8f0;
  background: linear-gradient(135deg, rgba(34,211,238,.15), rgba(139,92,246,.15));
  border-color: rgba(34,211,238,.5);
  color: #fff;
  flex-direction: row;
  gap: 0.5rem;
}
.pipe-arrow { color: #475569; font-size: 0.85rem; }

/* algo→knob map */
.algo-map { display: flex; flex-direction: column; gap: 0.55rem; }
.algo-map li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.7rem;
  border-radius: 0.5rem;
  background: rgba(30, 41, 59, 0.5);
}
.knobs { display: flex; gap: 0.35rem; }
.knobs b, .diag-list b {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.45rem;
  border-radius: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid;
}
.k1 { color: #f87171; border-color: rgba(248,113,113,.4); background: rgba(248,113,113,.08); }
.k2 { color: #4ade80; border-color: rgba(74,222,128,.4);  background: rgba(74,222,128,.08); }
.k3 { color: #60a5fa; border-color: rgba(96,165,250,.4);  background: rgba(96,165,250,.08); }
.k4 { color: #d6a35c; border-color: rgba(214,163,92,.4);  background: rgba(214,163,92,.08); }
.k5 { color: #fb923c; border-color: rgba(251,146,60,.4);  background: rgba(251,146,60,.08); }
.k6 { color: #c084fc; border-color: rgba(192,132,252,.4); background: rgba(192,132,252,.08); }
.k7 { color: #fbbf24; border-color: rgba(251,191,36,.4);  background: rgba(251,191,36,.08); }

/* diagnostics list */
.diag-list { display: flex; flex-direction: column; gap: 0.55rem; font-size: 0.85rem; }
.diag-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.7rem;
  border-radius: 0.5rem;
  background: rgba(30, 41, 59, 0.5);
  color: #cbd5e1;
}
.diag-list .symptom {
  color: #fda4af;
  font-weight: 600;
  min-width: 6.5rem;
  flex-shrink: 0;
}
.diag-list i { color: #475569; font-size: 0.7rem; }

/* evolution track (PPO finale) */
.evolution-track {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 0.6rem;
}
.evo-step {
  flex: 1 1 14rem;
  max-width: 18rem;
  padding: 0.9rem 1rem;
  border-radius: 0.7rem;
  border: 1px solid rgba(71, 85, 105, 0.5);
  background: rgba(30, 41, 59, 0.5);
}
.evo-step p {
  font-size: 0.8rem;
  line-height: 1.7;
  color: #94a3b8;
  margin-top: 0.45rem;
}
.evo-step p strong { color: #e2e8f0; }
.evolution-track .pipe-arrow { align-self: center; }

/* conclusion */
.conclusion-card {
  border-color: rgba(34, 211, 238, 0.3);
  background: linear-gradient(135deg, rgba(34,211,238,.06), rgba(139,92,246,.06));
}

/* KaTeX tweaks */
.katex { font-size: 1.05em; }
.variant-table .katex, .comp-sub .katex, .insight .katex { font-size: 0.95em; }

/* responsive */
@media (max-width: 640px) {
  .formula-main { font-size: 0.8rem; }
  .comp-title { font-size: 1.1rem; }
  .pipe-arrow { display: none; }
  .pipeline { gap: 0.6rem; }
  .diag-list .symptom { min-width: auto; }
  .algo-map li { flex-wrap: wrap; gap: 0.35rem; }
}
