/* Agentia — design tokens：近黑 + 钛银金属色，发丝线，方角工程感 */
:root {
  --bg: #0a0a0b;
  --bg-alt: #0f0f11;
  --card: #111113;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #fafafa;
  --muted: #a1a1aa;
  --faint: #71717a;
  --accent: #d9e2ee;
  --steel: #8b98ab;
  --ice: #7aa2f7;
  --ice-dim: rgba(122, 162, 247, 0.10);
  --ice-border: rgba(122, 162, 247, 0.32);
  --accent-dim: rgba(217, 226, 238, 0.09);
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: "Space Grotesk", -apple-system, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  color: var(--ice);
  background: var(--ice-dim);
  padding: 0.1em 0.4em;
  border-radius: 3px;
}

::selection { background: rgba(122, 162, 247, 0.24); }

/* 细颗粒噪点纹理：近黑底上的"纸质/金属"质感 */
.grain {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* 全局发丝竖线（工程图纸感） */
.grid-lines {
  position: fixed;
  inset: 0;
  max-width: 1080px;
  margin: 0 auto;
  pointer-events: none;
  z-index: 0;
}
.grid-lines span {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.035);
}
.grid-lines span:nth-child(1) { left: 0; }
.grid-lines span:nth-child(2) { left: 33.33%; }
.grid-lines span:nth-child(3) { left: 66.66%; }
.grid-lines span:nth-child(4) { right: 0; }

/* nav */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  border-bottom: 1px solid transparent;
  transition: background 0.3s, border-color 0.3s;
}
.nav.scrolled {
  background: rgba(10, 10, 11, 0.82);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
}
.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
}
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }
.nav-cta {
  font-family: var(--mono);
  font-size: 12.5px !important;
  color: var(--text) !important;
  border: 1px solid var(--border-strong);
  padding: 6px 14px;
  border-radius: 4px;
  transition: border-color 0.2s, background 0.2s !important;
}
.nav-cta:hover { border-color: var(--ice); background: var(--ice-dim); }

/* hero */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  padding: 120px 24px 80px;
}
#orchestra {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero-content { position: relative; z-index: 2; max-width: 760px; }
.hero-kicker {
  font-family: var(--mono);
  color: var(--steel);
  font-size: 12px;
  letter-spacing: 0.32em;
  margin-bottom: 26px;
}
.hero h1 {
  font-size: clamp(42px, 7vw, 76px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.hero h1 .line { display: inline-block; }
/* 钛银金属光泽：标题关键词上缓慢流动的银灰渐变 */
.hero h1 .accent {
  background: linear-gradient(
    110deg,
    #f4f7fb 0%,
    #97a5b9 22%,
    #eef2f8 45%,
    #8b98ab 68%,
    #f4f7fb 100%
  );
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: metal-sheen 7s ease-in-out infinite;
}
@keyframes metal-sheen {
  0%, 100% { background-position: 0% 0; }
  50% { background-position: 100% 0; }
}
.hero-sub {
  max-width: 600px;
  margin: 26px auto 0;
  color: var(--muted);
  font-size: 16.5px;
}
.hero-actions {
  margin-top: 40px;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn {
  padding: 13px 30px;
  border-radius: 5px;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.18s, box-shadow 0.25s, border-color 0.2s, background 0.2s;
}
.btn-primary { background: var(--accent); color: #0a0a0b; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 32px rgba(217, 226, 238, 0.22); }
.btn-ghost { border: 1px solid var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); background: var(--accent-dim); }
.hero-install {
  margin: 44px auto 0;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: rgba(17, 17, 19, 0.85);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 13px 18px;
  backdrop-filter: blur(8px);
}
.hero-install .prompt { font-family: var(--mono); color: var(--faint); }
.hero-install code { background: none; padding: 0; color: var(--text); font-size: 13.5px; }
.copy {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 12px;
  font-family: var(--mono);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.copy:hover { color: var(--ice); border-color: var(--ice); }

.hero-stats {
  position: relative;
  z-index: 2;
  margin-top: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--faint);
  letter-spacing: 0.06em;
}
.hero-stats b { color: var(--text); font-weight: 500; margin-right: 4px; }
.hero-stats i {
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--ice);
  opacity: 0.7;
}

.scroll-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  z-index: 2;
}
.scroll-hint span {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 3px;
  height: 7px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--ice);
  animation: scroll-dot 1.8s ease-in-out infinite;
}
@keyframes scroll-dot {
  0%, 100% { transform: translateY(0); opacity: 1; }
  60% { transform: translateY(12px); opacity: 0.15; }
}

/* marquee */
.marquee {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  padding: 14px 0;
  background: var(--bg-alt);
  position: relative;
  z-index: 2;
}
.marquee-track {
  display: flex;
  gap: 56px;
  width: max-content;
  will-change: transform;
}
.marquee-track span {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.14em;
  color: var(--faint);
  white-space: nowrap;
}
.marquee-track span::before { content: "// "; color: var(--ice); }

/* sections */
.section {
  position: relative;
  z-index: 2;
  max-width: 1080px;
  margin: 0 auto;
  padding: 110px 24px;
  border-top: 1px solid var(--border);
}
.section-alt { background: var(--bg-alt); max-width: none; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-alt > * { max-width: 1080px; margin-left: auto; margin-right: auto; }
.sec-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.28em;
  color: var(--steel);
  margin-bottom: 16px;
}
.section h2 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}
.section-sub { color: var(--muted); margin-bottom: 44px; max-width: 560px; }

.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.card, .feature {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 26px 24px;
  transition: border-color 0.25s, transform 0.2s;
}
.card:hover, .feature:hover { border-color: var(--ice-border); transform: translateY(-3px); }
.card-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ice);
  border: 1px solid var(--ice-border);
  border-radius: 3px;
  padding: 3px 10px;
  margin-bottom: 16px;
}
.card h3 { font-size: 16.5px; margin-bottom: 8px; }
.card p, .feature p { color: var(--muted); font-size: 14px; }
.feature h3 {
  font-size: 15.5px;
  margin-bottom: 10px;
  font-family: var(--mono);
  font-weight: 500;
  color: var(--text);
}
.feature h3::before { content: "▸ "; color: var(--ice); }

/* pipeline（how it works） */
.pipeline {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-top: 12px;
}
.pipe-box {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 20px 18px;
  transition: border-color 0.25s;
}
.pipe-box:hover { border-color: var(--ice-border); }
.pipe-box em {
  display: block;
  font-family: var(--mono);
  font-style: normal;
  font-size: 13px;
  color: var(--ice);
  margin-bottom: 10px;
  letter-spacing: 0.08em;
}
.pipe-box span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}
.pipe-arrow {
  align-self: center;
  padding: 0 14px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 15px;
}
@media (max-width: 900px) {
  .pipeline { flex-direction: column; gap: 10px; }
  .pipe-arrow { transform: rotate(90deg); padding: 2px 0; text-align: center; }
}

/* steps */
.steps { display: grid; gap: 14px; margin: 40px 0 28px; }
.step {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 24px;
  transition: border-color 0.25s;
}
.step:hover { border-color: var(--ice-border); }
.step-no {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 1px solid var(--ice-border);
  border-radius: 4px;
  color: var(--ice);
  font-family: var(--mono);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step > div:last-child { flex: 1; min-width: 0; }
.step h3 { font-size: 15.5px; margin-bottom: 12px; font-family: var(--mono); font-weight: 500; }
.cmd { color: var(--ice); font-weight: 500; }
pre {
  background: #0c0c0e;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px 18px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.7;
}
pre code { background: none; padding: 0; color: #d4d4d8; }
.cm { color: var(--faint); }

.code-block {
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
}
.code-title {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  align-items: center;
}
.code-title i {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--border-strong);
  margin-right: 7px;
}
.code-title em {
  font-family: var(--mono);
  font-style: normal;
  font-size: 12px;
  color: var(--faint);
  margin-left: 8px;
}
.code-block pre { border: none; border-radius: 0; }
/* Tokyo Night 风格的克制度语法色 */
.kw { color: #bb9af7; }
.str { color: #9ece6a; }
.fn { color: #7aa2f7; }
.dec { color: var(--ice); }

/* footer */
.footer {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--border);
  padding: 44px 24px 52px;
  text-align: center;
  color: var(--faint);
  font-size: 13.5px;
}
.footer-links {
  display: flex;
  gap: 26px;
  justify-content: center;
  margin-bottom: 14px;
  font-family: var(--mono);
  font-size: 12.5px;
}
.footer-links a { color: var(--muted); text-decoration: none; transition: color 0.2s; }
.footer-links a:hover { color: var(--ice); }

/* 动画初始态（GSAP 接管；无 JS 时保持可见） */
[data-intro], [data-reveal], [data-card] { opacity: 1; }
.gsap-on [data-intro], .gsap-on [data-reveal], .gsap-on [data-card] { opacity: 0; }

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .hero-stats { flex-wrap: wrap; gap: 12px; }
  .grid-4, .grid-3 { grid-template-columns: 1fr; }
  .nav-links { gap: 14px; }
  .hero-install { flex-direction: column; gap: 8px; }
  .grid-lines span:nth-child(2), .grid-lines span:nth-child(3) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ================= Playground ================= */
.pg-head {
  position: relative;
  z-index: 2;
  max-width: 1280px;
  margin: 0 auto;
  padding: 140px 24px 36px;
}
.pg-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ice);
  border: 1px solid var(--ice-border);
  background: var(--ice-dim);
  border-radius: 3px;
  padding: 4px 12px;
  margin-bottom: 18px;
}
.pg-badge i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ice);
  animation: pg-blink 1.6s ease-in-out infinite;
}
@keyframes pg-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.pg-head h1 {
  font-size: clamp(30px, 4.5vw, 46px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.pg-head p { color: var(--muted); max-width: 640px; font-size: 15px; }

.pg-layout {
  position: relative;
  z-index: 2;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 90px;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr) 330px;
  gap: 14px;
  align-items: start;
}
.pg-col-label {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.22em;
  color: var(--steel);
  margin-bottom: 12px;
}

/* 左侧：场景卡片 + 操作 */
.pg-scenario {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 16px 16px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  color: var(--text);
  font-family: var(--sans);
  transition: border-color 0.2s, transform 0.15s;
}
.pg-scenario:hover { border-color: var(--ice-border); }
.pg-scenario.active { border-color: var(--ice); background: rgba(122, 162, 247, 0.05); }
.pg-scenario h3 { font-size: 14.5px; margin-bottom: 4px; }
.pg-scenario p { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.pg-scenario .pg-sc-kind {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ice);
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 8px;
}
.pg-layout.locked .pg-scenario { pointer-events: none; opacity: 0.55; }

.pg-actions { display: flex; gap: 10px; margin-top: 14px; }
.pg-btn {
  flex: 1;
  padding: 11px 0;
  border-radius: 5px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, opacity 0.2s;
}
.pg-btn-run { background: var(--accent); color: #0a0a0b; border: 1px solid var(--accent); }
.pg-btn-run:hover:not(:disabled) { box-shadow: 0 6px 22px rgba(217, 226, 238, 0.18); }
.pg-btn-replay {
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.pg-btn-replay:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-dim); }
.pg-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* 中间：单元菜单 + 终端面板 */
.pg-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.pg-chip {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 3px;
  padding: 5px 11px;
  transition: color 0.25s, border-color 0.25s, background 0.25s, box-shadow 0.25s;
}
.pg-chip::before { content: "▸ "; color: var(--faint); }
.pg-chip.on {
  color: var(--ice);
  border-color: var(--ice);
  background: var(--ice-dim);
  box-shadow: 0 0 14px rgba(122, 162, 247, 0.22);
}
.pg-chip.on::before { color: var(--ice); }

.pg-term {
  background: #0c0c0e;
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
}
.pg-term-bar {
  display: flex;
  align-items: center;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
}
.pg-term-bar i {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--border-strong);
  margin-right: 7px;
}
.pg-term-bar em {
  font-family: var(--mono);
  font-style: normal;
  font-size: 12px;
  color: var(--faint);
  margin-left: 8px;
}
.pg-term-body {
  height: 560px;
  overflow-y: auto;
  padding: 18px;
  font-family: var(--mono);
  font-size: 12.8px;
  line-height: 1.75;
}
.pg-term-empty { color: var(--faint); }
.pg-term-empty::before { content: "$ "; color: var(--ice); }

.tp-block { margin-bottom: 14px; }
.tp-head {
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--steel);
  margin-bottom: 6px;
}
.tp-think { color: var(--muted); font-style: italic; }
.tp-think::before { content: "◌ "; color: var(--ice); font-style: normal; }
.tp-llm {
  border-left: 2px solid var(--ice-border);
  padding-left: 14px;
}
.tp-llm .tp-stream { color: #d4d4d8; white-space: pre-wrap; }
.tp-nested { margin-left: 16px; }
.tp-note {
  color: var(--faint);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  padding: 6px 0;
  margin-bottom: 14px;
}
.tp-tool, .tp-result {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.tp-tool .tp-head, .tp-result .tp-head {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 6px 12px;
  margin-bottom: 0;
}
.tp-tool .tp-head::before { content: "⚙ "; color: var(--ice); }
.tp-result .tp-head::before { content: "✓ "; color: #9ece6a; }
.tp-tool pre {
  border: none;
  border-radius: 0;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--ice);
  background: none;
}
.tp-result .tp-body { padding: 10px 14px; color: var(--muted); }
.tp-final {
  border: 1px solid var(--ice-border);
  background: rgba(122, 162, 247, 0.05);
  border-radius: 4px;
  padding: 12px 14px;
}
.tp-final .tp-head { color: var(--ice); }
.tp-final .tp-stream { color: #e4e4e7; white-space: pre-wrap; }
.tp-caret::after {
  content: "▊";
  color: var(--ice);
  animation: pg-blink 0.9s steps(1) infinite;
}

/* 右侧：trace 树 + usage */
.pg-trace {
  background: #0c0c0e;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 16px;
  font-family: var(--mono);
  font-size: 12px;
  min-height: 240px;
}
.tr-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  white-space: nowrap;
}
.tr-pre { color: var(--faint); white-space: pre; }
.tr-dot { color: var(--ice); }
.tr-row.running .tr-dot { animation: pg-blink 0.9s steps(1) infinite; }
.tr-name { color: #d4d4d8; overflow: hidden; text-overflow: ellipsis; }
.tr-row[data-kind="run"] .tr-name { color: var(--text); font-weight: 500; }
.tr-row[data-kind="llm.turn"] .tr-name { color: var(--ice); }
.tr-meta { margin-left: auto; color: var(--faint); font-size: 11px; padding-left: 10px; }
.tr-empty { color: var(--faint); }

.pg-usage {
  margin-top: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 12px;
}
.pg-usage .u-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  color: var(--muted);
}
.pg-usage .u-row b { color: var(--text); font-weight: 500; }
.pg-usage .u-cost { color: var(--ice); }
.pg-usage .u-note {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.6;
}

@media (max-width: 1080px) {
  .pg-layout { grid-template-columns: 1fr; }
  .pg-term-body { height: 440px; }
}

/* Playground：模式切换 + BYOK */
.pg-mode {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 18px;
}
.pg-mode-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 8px 18px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.pg-mode-btn + .pg-mode-btn { border-left: 1px solid var(--border-strong); }
.pg-mode-btn:hover { color: var(--text); }
.pg-mode-btn.active {
  color: var(--ice);
  background: var(--ice-dim);
}
.pg-head .pg-badge { margin-bottom: 18px; }
.pg-head .pg-mode + .pg-badge { display: inline-flex; margin-left: 14px; }

.pg-byok {
  position: relative;
  z-index: 2;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 26px;
}
.pg-byok-note {
  border: 1px solid var(--ice-border);
  background: var(--ice-dim);
  border-radius: 5px;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 12px;
}
.pg-byok-note strong { color: var(--text); font-weight: 600; }
.pg-byok-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.pg-byok-field { flex: 1; min-width: 240px; }
.pg-byok-field span {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--steel);
  margin-bottom: 6px;
}
.pg-byok-field input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pg-byok-field input:focus { border-color: var(--ice); box-shadow: 0 0 0 3px var(--ice-dim); }
.pg-byok-model { flex: 0 1 320px; min-width: 220px; }
.pg-byok-clear { flex: 0 0 auto; padding: 10px 22px; }
.pg-byok-pulse .pg-byok-note { animation: pg-byok-pulse 0.8s ease-in-out 2; }
@keyframes pg-byok-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(122, 162, 247, 0); }
  50% { box-shadow: 0 0 22px rgba(122, 162, 247, 0.35); }
}

.tp-error {
  border: 1px solid rgba(247, 118, 142, 0.4);
  background: rgba(247, 118, 142, 0.06);
  border-radius: 4px;
  padding: 12px 14px;
}
.tp-error .tp-head { color: #f7768e; }
.tp-error .tp-body { color: var(--muted); white-space: pre-wrap; }
.tp-retry {
  margin-top: 10px;
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 4px;
  padding: 6px 18px;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.tp-retry:hover { border-color: var(--ice); background: var(--ice-dim); }

/* ================= Docs ================= */
.docs-layout {
  position: relative;
  z-index: 2;
  max-width: 1080px;
  margin: 0 auto;
  padding: 128px 24px 90px;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}
.docs-nav {
  position: sticky;
  top: 96px;
  border-left: 1px solid var(--border);
}
.docs-nav a {
  display: block;
  padding: 5px 0 5px 16px;
  margin-left: -1px;
  border-left: 1px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s, border-color 0.2s;
}
.docs-nav a:hover { color: var(--text); }
.docs-nav a.active { color: var(--ice); border-left-color: var(--ice); }
.docs-nav .dn-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--steel);
  padding: 0 0 10px 16px;
}
.docs-content section { margin-bottom: 72px; scroll-margin-top: 90px; }
.docs-content h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.docs-content h3 { font-size: 16px; margin: 28px 0 10px; font-family: var(--mono); font-weight: 500; }
.docs-content h3::before { content: "▸ "; color: var(--ice); }
.docs-content p { color: var(--muted); font-size: 14.5px; margin-bottom: 14px; }
.docs-content ul { color: var(--muted); font-size: 14.5px; margin: 0 0 14px 20px; }
.docs-content li { margin-bottom: 6px; }
.docs-content .code-block { margin: 16px 0 20px; }
.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin: 16px 0 20px;
}
.doc-table th, .doc-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.doc-table th {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--steel);
  font-weight: 500;
}
.doc-table td { color: var(--muted); }
.doc-table td:first-child { font-family: var(--mono); font-size: 12.5px; color: var(--text); white-space: nowrap; }
.doc-planned {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ice);
  border: 1px solid var(--ice-border);
  border-radius: 3px;
  padding: 1px 7px;
  margin-left: 8px;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-nav {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    border-left: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
  }
  .docs-nav a { padding: 4px 0; border-left: none; }
  .docs-nav .dn-title { width: 100%; padding-left: 0; }
}
