﻿:root {
  color-scheme: light;
  --bg: #f6f9fc;
  --bg-soft: #edf6fb;
  --surface: rgba(255,255,255,.88);
  --surface-strong: #ffffff;
  --ink: #102033;
  --muted: #5c7088;
  --line: rgba(42, 74, 108, .16);
  --blue: #1769ff;
  --cyan: #10b8d8;
  --green: #20b982;
  --amber: #f6a82d;
  --rose: #e65f8b;
  --violet: #7357e8;
  --shadow: 0 22px 60px rgba(31, 65, 102, .13);
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07111d;
  --bg-soft: #0b1b2c;
  --surface: rgba(13, 29, 47, .86);
  --surface-strong: #102033;
  --ink: #edf6ff;
  --muted: #a9bdd1;
  --line: rgba(174, 207, 246, .18);
  --shadow: 0 22px 70px rgba(0, 0, 0, .34);
}
* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(115deg, rgba(16,184,216,.18), transparent 34%),
    linear-gradient(245deg, rgba(115,87,232,.14), transparent 42%),
    linear-gradient(28deg, rgba(246,168,45,.12), transparent 48%),
    var(--bg);
  font-family: var(--sans);
  line-height: 1.72;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(120deg, transparent 0 26%, rgba(255,255,255,.56) 26% 27.3%, transparent 27.3% 100%),
    linear-gradient(58deg, transparent 0 61%, rgba(23,105,255,.09) 61% 62.5%, transparent 62.5% 100%);
  background-size: 540px 540px, 480px 480px;
  opacity: .58;
  animation: nh4Grid 32s linear infinite;
  z-index: -1;
}
:root[data-theme="dark"] body::before { opacity: .2; }
@keyframes nh4Grid { to { background-position: 540px 540px, -480px 480px; } }
a { color: inherit; }
.site-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.site-shell, .hero-content, .doc-content, .doc-panel, .panel, .metric-panel, .code-wrap, .feature-table { min-width: 0; max-width: 100%; }
.site-nav {
  position: sticky;
  top: 0;
  z-index: 60;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-strong) 86%, transparent);
  backdrop-filter: blur(18px);
}
.nav-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 860; color: var(--ink); }
.brand img { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; box-shadow: 0 12px 30px rgba(23,105,255,.20); }
.nav-links { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.nav-links a, .nav-links button, .btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  font: inherit;
  font-weight: 780;
  cursor: pointer;
}
.nav-links a:hover, .nav-links button:hover, .btn:hover { background: rgba(23,105,255,.10); border-color: rgba(23,105,255,.22); color: var(--blue); }
.btn.primary { color: #fff; background: linear-gradient(135deg, var(--blue), var(--cyan)); border: 0; box-shadow: 0 16px 34px rgba(23,105,255,.24); }
.btn.soft { background: var(--surface); border-color: var(--line); }
.flow-hero { min-height: 630px; display: flex; align-items: center; position: relative; overflow: hidden; }
.flow-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(100deg, color-mix(in srgb, var(--bg) 96%, transparent) 0 36%, color-mix(in srgb, var(--bg) 62%, transparent) 58%, color-mix(in srgb, var(--bg) 88%, transparent) 100%),
    url("/nianhua-logo.jpg?v=20260531-theme-v4") right 8% center / min(41vw, 520px) auto no-repeat;
  z-index: -1;
}
.flow-hero::after {
  content: "";
  position: absolute;
  inset: 12% -12% 8% -12%;
  background:
    linear-gradient(106deg, transparent 0 18%, rgba(16,184,216,.26) 18% 27%, transparent 27% 100%),
    linear-gradient(72deg, transparent 0 42%, rgba(115,87,232,.22) 42% 53%, transparent 53% 100%),
    linear-gradient(130deg, transparent 0 60%, rgba(246,168,45,.22) 60% 69%, transparent 69% 100%);
  background-size: 145% 145%;
  animation: nh4Flow 18s ease-in-out infinite alternate;
  z-index: -1;
}
@keyframes nh4Flow {
  from { transform: translate3d(-4%, -2%, 0) skewY(-2deg); background-position: 0 42%; }
  to { transform: translate3d(4%, 5%, 0) skewY(1deg); background-position: 100% 58%; }
}
.hero-content { padding: 110px 0 92px; max-width: 860px; }
.eyebrow, .chip, .endpoint, .status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid rgba(23,105,255,.20);
  color: color-mix(in srgb, var(--blue) 72%, var(--ink));
  font-weight: 850;
}
.eyebrow { min-height: 34px; padding: 6px 12px; }
.chip { min-height: 32px; padding: 5px 11px; color: var(--muted); }
.endpoint { padding: 2px 8px; font-family: var(--mono); font-size: .94em; }
.status-pill { gap: 8px; padding: 6px 10px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(32,185,130,.14); }
h1, h2, h3 { letter-spacing: 0; color: var(--ink); }
h1, h2, h3, p, th, td { overflow-wrap: anywhere; }
h1 { margin: 20px 0 18px; font-size: clamp(46px, 7vw, 86px); line-height: 1.03; }
h2 { margin: 0 0 14px; font-size: clamp(30px, 4vw, 48px); line-height: 1.12; }
h3 { margin: 0 0 10px; font-size: 22px; line-height: 1.25; }
p { margin: 0; color: var(--muted); }
.lead { font-size: 19px; max-width: 800px; }
.actions, .chips { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.section { padding: 78px 0; }
.section.tint { background: color-mix(in srgb, var(--bg-soft) 72%, transparent); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section-head p { max-width: 660px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel, .doc-panel, .metric-panel {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.metric-panel b { display: block; color: var(--blue); font-size: 32px; line-height: 1.1; margin-bottom: 8px; }
.route-map { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 20px; align-items: stretch; }
.route-list { display: grid; gap: 10px; }
.route-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: color-mix(in srgb, var(--surface) 72%, transparent); }
.route-item span:first-child { font-weight: 820; }
.route-item small { color: var(--muted); font-family: var(--mono); }
.terminal { min-height: 100%; background: #101d2c; color: #eaf7ff; border-radius: 8px; padding: 18px; overflow: hidden; font-family: var(--mono); font-size: 14px; line-height: 1.65; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.terminal .line { display: block; white-space: pre-wrap; }
.terminal .ok { color: #7ff0bf; }
.terminal .accent { color: #74d7ff; }
.docs-main { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; align-items: start; }
.toc { position: sticky; top: 94px; display: grid; gap: 8px; }
.toc a { padding: 8px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 700; }
.toc a:hover { color: var(--blue); background: rgba(23,105,255,.10); }
.doc-content { display: grid; gap: 18px; }
.doc-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.search-box { width: min(100%, 420px); min-height: 42px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-strong); color: var(--ink); padding: 9px 12px; font: inherit; }
.code-wrap { position: relative; margin-top: 14px; }
.code {
  display: block;
  overflow: auto;
  max-width: 100%;
  padding: 18px;
  border-radius: 8px;
  background: #101d2c;
  color: #eaf7ff;
  font: 14px/1.7 var(--mono);
}
.copy-btn { position: absolute; top: 10px; right: 10px; border: 1px solid rgba(255,255,255,.22); color: #fff; background: rgba(255,255,255,.10); border-radius: 8px; min-height: 32px; padding: 4px 10px; font-weight: 760; cursor: pointer; }
.feature-table { width: 100%; border-collapse: collapse; overflow: hidden; border-radius: 8px; border: 1px solid var(--line); }
.feature-table th, .feature-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.feature-table th { background: color-mix(in srgb, var(--bg-soft) 70%, transparent); color: var(--ink); }
.feature-table tr:last-child td { border-bottom: 0; }
.legal-text h2 { margin-top: 28px; }
.legal-text h2:first-child { margin-top: 0; }
.footer { border-top: 1px solid var(--line); padding: 24px 0; color: var(--muted); background: color-mix(in srgb, var(--surface-strong) 76%, transparent); }
.footer a { color: var(--ink); }
@media (max-width: 920px) {
  .nav-inner { align-items: flex-start; flex-direction: column; padding: 14px 0; gap: 12px; }
  .nav-links { justify-content: flex-start; }
  .route-map, .docs-main, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .toc { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow-hero::before { background: linear-gradient(100deg, color-mix(in srgb, var(--bg) 94%, transparent), color-mix(in srgb, var(--bg) 74%, transparent)), url("/nianhua-logo.jpg?v=20260531-theme-v4") right -90px top 78px/360px auto no-repeat; }
}
@media (max-width: 560px) {
  .site-shell { width: min(1180px, calc(100% - 28px)); }
  .flow-hero { min-height: auto; }
  .hero-content { padding: 76px 0 62px; }
  .flow-hero::before { background: linear-gradient(100deg, color-mix(in srgb, var(--bg) 94%, transparent), color-mix(in srgb, var(--bg) 76%, transparent)), url("/nianhua-logo.jpg?v=20260531-theme-v4") center top 84px/300px auto no-repeat; }
  .btn { width: 100%; }
  h1 { font-size: 42px; }
  .lead { font-size: 16px; }
  .panel, .doc-panel, .metric-panel { padding: 18px; }
  .code { padding: 14px; font-size: 12px; }
  .toc { grid-template-columns: 1fr; }
  .section-head { display: block; }
}
