/* ==========================================================================
   页面骨架：顶栏 / 首屏 / 章节 / 实验台工具栏 / 页脚
   ========================================================================== */

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  backdrop-filter: blur(14px) saturate(1.5);
  border-bottom: 1px solid var(--border);
}
.topbar-in {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
  white-space: nowrap;
  flex: none;
}
.brand:hover {
  text-decoration: none;
}
.brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 3px 10px rgb(84 87 224 / 0.4);
}
.brand-logo svg {
  width: 18px;
  height: 18px;
}
.nav {
  display: flex;
  gap: 2px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}
.nav::-webkit-scrollbar {
  display: none;
}
.nav a {
  padding: 7px 13px;
  border-radius: 999px;
  color: var(--text-2);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}
.nav a:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.nav a.active {
  background: var(--brand-soft);
  color: var(--brand-ink);
}
.topbar-line {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 3px;
  width: var(--p, 0%);
  background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--accent));
  transition: width 0.1s linear;
}
@media (max-width: 760px) {
  .brand-text {
    display: none;
  }
  .nav a {
    padding: 7px 10px;
    font-size: 13.5px;
  }
}
@media (max-width: 520px) {
  .nav-n {
    display: none;
  }
  .nav a {
    padding: 7px 8px;
  }
}
@media (max-width: 400px) {
  .topbar-in {
    gap: 8px;
  }
  .nav a {
    padding: 7px 6px;
  }
}

/* ---------- 首屏 ---------- */
.hero {
  padding: 54px 0 20px;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: 44px;
  align-items: center;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px 4px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 700;
  font-size: 13px;
}
.eyebrow svg {
  width: 15px;
  height: 15px;
}
.hero h1 {
  font-size: clamp(32px, 4.6vw, 52px);
  line-height: 1.16;
  letter-spacing: -0.03em;
  margin: 16px 0 16px;
  text-wrap: balance;
}
.hero h1 .nb {
  display: inline-block;
}
.grad-text {
  background: linear-gradient(120deg, var(--brand), var(--brand-2) 55%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .lead {
  font-size: 18px;
  line-height: 1.75;
  color: var(--text-2);
  max-width: 34em;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 24px 0 22px;
}
.hero-cta .btn {
  padding: 12px 22px;
  font-size: 15px;
}
.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.stat {
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  min-width: 96px;
}
.stat b {
  display: block;
  font-size: 20px;
  font-family: var(--font-mono);
  color: var(--brand-ink);
  line-height: 1.25;
}
.stat span {
  font-size: 12.5px;
  color: var(--muted);
}
.hero-card {
  padding: 20px 22px 18px;
  position: relative;
  overflow: hidden;
}
.hero-card::before {
  content: '';
  position: absolute;
  inset: -40% -20% auto auto;
  width: 360px;
  height: 360px;
  background: radial-gradient(closest-side, rgb(139 92 246 / 0.18), transparent);
  pointer-events: none;
}
.hero-card h3 {
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hero-card h3 svg {
  width: 18px;
  height: 18px;
  color: var(--brand);
}
.prompt-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 12px 0 14px;
  font-size: 15px;
}
.prompt-line .q {
  font-weight: 800;
  color: var(--brand-ink);
  padding: 1px 12px;
  border-radius: 999px;
  border: 1px dashed var(--brand);
}
.hero-card .btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.hero-card .live-stat {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-size: 13px;
  color: var(--muted);
}
.hero-card .live-stat b {
  color: var(--text);
  font-family: var(--font-mono);
}
@media (max-width: 900px) {
  .hero {
    padding-top: 30px;
  }
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
  }
  .hero .lead {
    font-size: 16.5px;
  }
}
/* 手机：4 张数字卡片排成整齐的 2×2，而不是 3 + 1 */
@media (max-width: 520px) {
  .stat-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stat {
    min-width: 0;
  }
}

/* ---------- 章节 ---------- */
.chapter {
  padding: 64px 0 8px;
  position: relative;
}
.chapter + .chapter {
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.chapter-hd {
  margin-bottom: 26px;
}
.chapter-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--brand-ink);
  background: var(--brand-soft);
  padding: 3px 14px 3px 10px;
  border-radius: 999px;
}
.chapter-kicker.grad {
  color: var(--grad);
  background: var(--grad-soft);
}
.chapter-kicker.accent {
  color: var(--accent);
  background: var(--accent-soft);
}
.chapter-kicker svg {
  width: 15px;
  height: 15px;
}
.chapter h2 {
  font-size: clamp(27px, 3.6vw, 40px);
  margin: 12px 0 10px;
  letter-spacing: -0.02em;
}
.chapter .lead {
  font-size: 17px;
  color: var(--text-2);
  max-width: 48em;
  margin: 0;
}
.subsec {
  margin-top: 54px;
}
.subsec > h3 {
  font-size: 25px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.subsec > h3 .tag {
  font-size: 12.5px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  letter-spacing: 0;
}
.subsec > .intro {
  color: var(--text-2);
  max-width: 50em;
  margin-bottom: 18px;
}

/* ---------- 实验台工具栏 ---------- */
.lab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 26px;
  align-items: flex-end;
  padding: 14px 18px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.lab-bar .group {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.lab-bar .group > .cap {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.lab-bar .group.grow {
  flex: 1 1 260px;
}
.lab-bar .group > .seg {
  justify-self: start;
  max-width: 100%;
}
.seq-builder {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.vocab-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  border-radius: 999px;
  transition: transform 0.12s;
}
.vocab-btn:hover {
  transform: translateY(-2px);
}
.vocab-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

/* ---------- 通用面板 ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 18px 20px;
  min-width: 0;
}
.panel > h4 {
  font-size: 16px;
  margin-bottom: 6px;
}
.panel-hd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 12px;
}
.panel-hd h4 {
  font-size: 16px;
}
.panel-hd .sp {
  margin-left: auto;
}

/* ---------- 页脚 ---------- */
.footer {
  margin-top: 80px;
  padding: 36px 0 60px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}
.footer a {
  color: var(--text-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.footer .row {
  justify-content: space-between;
  align-items: flex-start;
}

/* ---------- 总览：流水线图 ---------- */
.pipe-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}
.pipe {
  position: relative;
  display: flex;
  flex-direction: column-reverse;
  gap: 0;
  padding: 6px 0;
  min-width: 0;
}
.pipe-node {
  appearance: none;
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, background 0.15s;
}
.pipe-node:hover {
  border-color: var(--brand);
  transform: translateX(3px);
}
.pipe-node .shape {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
}
.pipe-node.k-data {
  background: var(--surface-2);
}
.pipe-node.k-attn {
  border-color: color-mix(in srgb, var(--q) 60%, transparent);
}
.pipe-node.k-ffn {
  border-color: color-mix(in srgb, var(--v) 60%, transparent);
}
.pipe-node.k-res {
  border-style: dashed;
  background: transparent;
  padding: 3px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.pipe-node.k-train {
  border-color: color-mix(in srgb, var(--grad) 55%, transparent);
  background: var(--grad-soft);
}
.pipe-node.k-infer {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: var(--accent-soft);
}
.pipe-node.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 28%, transparent), var(--shadow-1);
  background: var(--brand-soft);
  transform: translateX(6px);
}
.pipe-node.k-train.active {
  border-color: var(--grad);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--grad) 25%, transparent);
}
.pipe-node.k-infer.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.pipe-link {
  height: 14px;
  display: grid;
  place-items: center;
  color: var(--border-strong);
  font-size: 0;
}
.pipe-link::before {
  content: '';
  width: 2px;
  height: 100%;
  background: currentColor;
}
.pipe-link.hot {
  color: var(--brand);
}
/* “重复 N 层”的虚线框 */
.pipe-group {
  position: relative;
  display: flex;
  flex-direction: column-reverse;
  margin: 14px 0 8px;
  padding: 20px 12px 12px;
  border: 2px dashed var(--border-strong);
  border-radius: 18px;
  background: color-mix(in srgb, var(--brand-soft) 35%, transparent);
}
.pipe-group-label {
  position: absolute;
  top: -12px;
  left: 16px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  background: var(--bg);
  border-radius: 999px;
  white-space: nowrap;
}
.pipe-node.k-norm {
  background: var(--surface-2);
  border-style: dotted;
}
.pipe-detail {
  position: sticky;
  top: calc(var(--nav-h) + 16px);
  min-height: 280px;
}
.pipe-detail h4 {
  font-size: 21px;
  margin: 6px 0 4px;
}
.pipe-detail .shape-line {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}
.pipe-detail .go {
  margin-top: 10px;
}
@media (max-width: 900px) {
  .pipe-wrap {
    grid-template-columns: minmax(0, 1fr);
  }
  .pipe-detail {
    position: static;
    min-height: 0;
  }
}

/* ---------- 双栏卡片 ---------- */
.duo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.duo > .panel {
  position: relative;
  overflow: hidden;
}
.duo > .panel.train {
  border-top: 4px solid var(--grad);
}
.duo > .panel.infer {
  border-top: 4px solid var(--accent);
}
.duo h4 {
  font-size: 19px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.duo.panel h4 svg,
.duo h4 svg {
  width: 22px;
  height: 22px;
}
.duo > .panel.train h4 svg {
  color: var(--grad);
}
.duo > .panel.infer h4 svg {
  color: var(--accent);
}
.duo ul {
  margin: 8px 0 0;
  padding-left: 1.2em;
}
.duo li {
  margin-bottom: 4px;
}
@media (max-width: 900px) {
  .duo {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- 表格 ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
table.tbl th,
table.tbl td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
table.tbl thead th {
  background: var(--surface-2);
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
}
table.tbl tbody tr:last-child td {
  border-bottom: 0;
}
table.tbl td.num,
table.tbl th.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
table.tbl tbody tr:hover {
  background: var(--surface-2);
}
table.tbl .col-train {
  color: var(--grad);
}
table.tbl .col-infer {
  color: var(--accent);
}
table.tbl th:first-child,
table.tbl td:first-child {
  white-space: nowrap;
  font-weight: 700;
}
