:root {
  --bg: #08121f; --bg2: #0b1d33; --panel: #10233d; --line: #1f3550;
  --ink: #e9edf3; --ink2: #c2ccd8; --muted: #93a2b5;
  --gold: #c9a35b; --gold2: #e2c88f; --blue: #4f86c6;
  --sans: "Inter", "Noto Sans TC", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 70px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); line-height: 1.65; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.zh { color: var(--muted); }
.mono { font-family: var(--mono); }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: rgba(8, 18, 31, .85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 14px; }
.brand em { font-style: normal; color: var(--muted); font-weight: 500; }
.mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(145deg, var(--gold2), var(--gold)); color: #0b1d33; font-weight: 700; font-size: 13px; }
nav { display: flex; gap: 4px; }
nav a { text-decoration: none; color: var(--muted); font-size: 13.5px; padding: 6px 10px; border-radius: 8px; }
nav a:hover { color: var(--ink); }
nav a.gh { color: #0b1d33; background: var(--gold); font-weight: 600; }

/* hero */
.hero { position: relative; overflow: hidden; padding: 88px 0 72px; background:
  radial-gradient(700px 360px at 85% 0%, rgba(201, 163, 91, .18), transparent 70%),
  radial-gradient(600px 400px at 0% 100%, rgba(79, 134, 198, .16), transparent 70%), var(--bg2); }
.hero::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 48px 48px; mask-image: radial-gradient(ellipse 70% 70% at 60% 30%, #000 20%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse 70% 70% at 60% 30%, #000 20%, transparent 75%); }
.hero .wrap { position: relative; z-index: 1; }
.status { display: inline-flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gold2); border: 1px solid rgba(201,163,91,.35); background: rgba(201,163,91,.08); padding: 6px 14px; border-radius: 999px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(201,163,91,.6); } 70% { box-shadow: 0 0 0 10px rgba(201,163,91,0); } 100% { box-shadow: 0 0 0 0 rgba(201,163,91,0); } }
h1 { margin-top: 22px; font-size: clamp(36px, 6vw, 64px); line-height: 1.08; letter-spacing: -.02em; }
.zh-title { margin-top: 6px; font-size: clamp(18px, 2.4vw, 24px); color: var(--gold2); letter-spacing: .1em; }
.lede { margin-top: 22px; max-width: 780px; font-size: 18px; color: var(--ink2); }
.lede.zh { margin-top: 10px; font-size: 16px; color: var(--muted); }
.lede b { color: var(--ink); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.chips span { font-family: var(--mono); font-size: 12px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink2); background: rgba(255,255,255,.03); }
.disclaimer { margin-top: 28px; max-width: 820px; font-size: 13px; color: var(--muted); border-left: 2px solid var(--gold); padding-left: 14px; }

/* sections */
.sec { padding: 88px 0; }
.sec.alt { background: var(--bg2); }
.head { margin-bottom: 32px; }
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
h2 { margin-top: 10px; font-size: clamp(26px, 3.6vw, 38px); line-height: 1.2; letter-spacing: -.01em; }
h2 span { display: block; font-size: .55em; color: var(--muted); font-weight: 500; margin-top: 6px; letter-spacing: .04em; }
.sub { margin-top: 14px; max-width: 840px; color: var(--ink2); font-size: 15.5px; }
.sub.small { font-size: 14px; margin-top: 10px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 24px; }
.panel + .panel { margin-top: 20px; }
.panel.two { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.chart-box svg, .chart-box canvas { display: block; width: 100%; height: auto; }
.side h3 { font-size: 18px; }
.side h3 .zh { display: block; font-size: 14px; font-weight: 500; }
.caption { margin-top: 10px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* controls */
.ctl label { display: block; font-weight: 600; font-size: 14px; }
.ctl label .zh { font-weight: 400; margin-left: 6px; }
input[type=range] { width: 100%; margin: 12px 0 4px; accent-color: var(--gold); }
.row { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); }
.row b { font-family: var(--mono); color: var(--gold2); font-size: 14px; }
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 18px; }
.presets button, .btn { font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 10px; padding: 9px 8px; cursor: pointer; transition: border-color .2s, background .2s, transform .2s; text-decoration: none; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.presets button small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.presets button:hover, .btn:hover { border-color: var(--gold); transform: translateY(-1px); }
.presets button.on { border-color: var(--gold); background: rgba(201,163,91,.14); }
.btn { flex-direction: row; padding: 10px 16px; margin-top: 16px; }
.btn.gold { background: var(--gold); color: #0b1d33; border-color: var(--gold); }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-top: 18px; }
.stats div { background: var(--bg2); padding: 10px 14px; }
.stats small { display: block; font-size: 11.5px; color: var(--muted); }
.stats b { font-family: var(--mono); font-size: 20px; font-weight: 500; }

/* animated bars */
.bars { position: relative; display: flex; align-items: flex-end; gap: 6px; height: 170px; margin-top: 18px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.bars.tall { height: 240px; }
.bar { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; }
.bar i { display: block; width: 100%; border-radius: 6px 6px 0 0; height: 0; transition: height .7s cubic-bezier(.2,.7,.2,1); }
.bar b { position: absolute; left: 0; right: 0; bottom: -20px; text-align: center; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.bar span { position: absolute; left: -6px; right: -6px; text-align: center; font-family: var(--mono); font-size: 10px; color: var(--ink2); transition: bottom .7s cubic-bezier(.2,.7,.2,1); }
.target { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--gold2); z-index: 2; pointer-events: none; transition: bottom .4s; }
.target span { position: absolute; right: 0; top: -18px; font-family: var(--mono); font-size: 11px; color: var(--gold2); }
.rp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.mini { font-size: 13px; font-weight: 600; color: var(--ink2); }
.rp-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.rp-foot p { font-size: 13px; color: var(--gold2); margin-top: 16px; }
.legend { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; font-size: 13px; }
.legend div { display: flex; align-items: center; gap: 10px; }
.legend i { width: 22px; height: 3px; border-radius: 2px; }

/* svg chart */
.ax line { stroke: var(--line); }
.ax text { fill: var(--muted); font: 11px var(--sans); }
.ax .title { fill: var(--muted); font-size: 11.5px; }
.cloud circle { fill: #93a2b5; opacity: 0; transition: opacity .6s; }
.cloud.show circle { opacity: .32; }
.asset text { fill: var(--ink); font: 600 11px var(--sans); }
.fpath { fill: none; stroke: var(--gold2); stroke-width: 3; stroke-linecap: round; }
.curg { transition: transform .55s cubic-bezier(.2,.7,.2,1); }
.cur { fill: var(--gold); stroke: var(--ink); stroke-width: 2; }
.cur-halo { fill: var(--gold); animation: halo 1.8s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes halo { 0% { transform: scale(.6); opacity: .55; } 100% { transform: scale(2.4); opacity: 0; } }
.mk text { fill: var(--gold2); font: 600 10.5px var(--sans); }

/* pipeline */
#pipe { display: block; width: 100%; height: auto; }
#pipe .node rect { fill: #0b1d33; stroke: #2a4566; stroke-width: 1.5; }
#pipe .node.off rect { stroke-dasharray: 5 4; }
#pipe .node.loop > rect { stroke: var(--gold); }
#pipe .op rect { fill: #13304f; stroke: var(--gold); stroke-width: 1.2; animation: opPulse 1.2s ease-in-out infinite; }
#pipe .op:nth-of-type(2) rect { animation-delay: .4s; }
#pipe .op:nth-of-type(3) rect { animation-delay: .8s; }
@keyframes opPulse { 0%, 100% { fill: #13304f; } 50% { fill: #2b4a6e; } }
#pipe text { fill: var(--ink); font: 600 14px var(--sans); text-anchor: middle; }
#pipe text.s { fill: var(--muted); font: 500 11.5px var(--sans); }
#pipe .flow { fill: none; stroke: var(--gold2); stroke-width: 2; stroke-dasharray: 6 6; animation: dash 1s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -12; } }
#pipe .packet { fill: var(--gold2); filter: drop-shadow(0 0 4px rgba(226,200,143,.9)); }
#pipe .packet.b { fill: #6fa8dc; }

/* code */
pre.code { margin: 0; overflow-x: auto; background: #071322; border: 1px solid var(--line); border-radius: 14px; padding: 22px; font: 13.5px/1.7 var(--mono); color: var(--ink2); }
pre .c { color: #6c7f96; } pre .k { color: var(--gold2); } pre .n { color: #8fc1ea; } pre .s { color: #9fd3a8; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

.foot { padding: 36px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.foot p + p { margin-top: 8px; }

@media (max-width: 900px) {
  .panel.two { grid-template-columns: 1fr; }
  nav a:not(.gh) { display: none; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 64px 0 52px; }
  .lede { font-size: 16px; }
  .sec { padding: 64px 0; }
  .panel { padding: 16px; border-radius: 14px; }
  .rp-grid { grid-template-columns: 1fr; gap: 20px; }
  .bars { gap: 4px; }
  .bars.tall { height: 190px; }
  .bar span { font-size: 9px; }
  .brand em { display: none; }
  pre.code { font-size: 12px; padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
