:root {
  --bg: #0d1220; --panel: #151c30; --panel2: #1b2440; --line: #26304f;
  --text: #e6ebf5; --muted: #8b96b3; --accent: #3b9dff; --green: #2ecc8f;
  --red: #ff5c72; --gold: #f5b041;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.65 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 20px; }

.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 24px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar .logo { font-weight: 700; font-size: 17px; letter-spacing: .5px; }
.topbar .logo span { color: var(--accent); }
.badge-demo {
  background: var(--gold); color: #1a1a1a; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 4px;
}
.topbar nav { margin-left: auto; display: flex; gap: 18px; font-size: 13px; }
.topbar nav a { color: var(--muted); }
.topbar nav a.on, .topbar nav a:hover { color: var(--text); }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px; margin-bottom: 16px;
}
.card h3 { font-size: 14px; color: var(--muted); font-weight: 600; margin-bottom: 12px;
  text-transform: uppercase; letter-spacing: .8px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

.kpi { text-align: left; }
.kpi .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pos { color: var(--green); } .neg { color: var(--red); }

button, .btn {
  background: var(--accent); border: 0; color: #fff; padding: 9px 18px;
  border-radius: 7px; font-size: 14px; cursor: pointer; font-weight: 600;
}
button:disabled { opacity: .45; cursor: default; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn-sm { padding: 4px 12px; font-size: 12px; }

select, input[type=number], input[type=text] {
  background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  padding: 8px 10px; border-radius: 6px; font-size: 14px; width: 100%;
}
label { font-size: 12px; color: var(--muted); display: block; margin: 10px 0 4px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; padding: 7px 8px;
  border-bottom: 1px solid var(--line); }
td { padding: 7px 8px; border-bottom: 1px solid rgba(38,48,79,.5);
  font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs .tab {
  padding: 8px 16px; border-radius: 8px; background: var(--panel);
  border: 1px solid var(--line); cursor: pointer; font-size: 13px; color: var(--muted);
}
.tabs .tab.on { background: var(--accent); color: #fff; border-color: var(--accent); }

.alert-item { border-left: 3px solid var(--gold); padding: 10px 12px;
  background: var(--panel2); border-radius: 6px; margin-bottom: 10px; }
.alert-item.high { border-left-color: var(--red); }
.alert-item .t { font-weight: 600; }
.alert-item .d { color: var(--muted); font-size: 12px; }

.sev { font-size: 11px; padding: 1px 7px; border-radius: 4px; font-weight: 700; }
.sev.high { background: rgba(255,92,114,.18); color: var(--red); }
.sev.medium { background: rgba(245,176,65,.18); color: var(--gold); }

.stream-box {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
  padding: 16px 18px; white-space: pre-wrap; font-size: 13.5px; min-height: 80px;
  max-height: 560px; overflow-y: auto;
}
.stream-box h1, .stream-box h2 { margin: 10px 0 6px; }
.cursor { display: inline-block; width: 8px; height: 15px; background: var(--accent);
  animation: blink 1s infinite; vertical-align: text-bottom; }
@keyframes blink { 50% { opacity: 0; } }

.steps { list-style: none; }
.steps li { padding: 7px 0; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.steps li .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; }
.steps li.running { color: var(--text); }
.steps li.running .dot { background: var(--accent); animation: blink 1s infinite; }
.steps li.done { color: var(--green); }
.steps li.done .dot { background: var(--green); }

.chip { font-size: 12px; padding: 3px 10px; border-radius: 20px; font-weight: 600; }
.chip.pending { background: rgba(245,176,65,.15); color: var(--gold); }
.chip.ok { background: rgba(46,204,143,.15); color: var(--green); }

.footer { color: var(--muted); font-size: 12px; text-align: center; padding: 26px 0; }
canvas { width: 100%; }

.hero { text-align: center; padding: 60px 20px 40px; }
.hero h1 { font-size: 34px; }
.hero h1 span { color: var(--accent); }
.hero p { color: var(--muted); max-width: 640px; margin: 14px auto 0; }
.module-card { transition: transform .15s, border-color .15s; display: block; color: var(--text); }
.module-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.module-card .icon { font-size: 26px; }
.module-card h2 { font-size: 17px; margin: 10px 0 6px; }
.module-card p { color: var(--muted); font-size: 13px; }
.module-card .en { color: var(--accent); font-size: 12px; letter-spacing: 1px; }

@media print {
  body { background: #fff; color: #111; }
  .topbar, .no-print, .footer { display: none !important; }
  .card, .stream-box { background: #fff; border-color: #ccc; color: #111; }
}

/* ===== Markdown 渲染 ===== */
.md-h { font-weight: 700; color: var(--text); margin: 14px 0 6px; padding-left: 9px;
  border-left: 3px solid var(--accent); font-size: 14px; }
.md-p { margin: 4px 0; line-height: 1.75; }
.md-gap { height: 8px; }
.md-ul { margin: 4px 0 4px 18px; } .md-ul li { margin: 3px 0; line-height: 1.7; }
.src-tag { display: inline-block; font-size: 11px; font-family: ui-monospace, monospace;
  color: var(--accent); background: rgba(59,157,255,.12); border: 1px solid rgba(59,157,255,.35);
  border-radius: 5px; padding: 0 5px; margin: 0 2px; vertical-align: 1px;
  text-shadow: 0 0 8px rgba(59,157,255,.6); }

/* ===== 多智能体流水线 ===== */
.agent-flow { display: flex; flex-direction: column; }
.agent-node { display: flex; gap: 10px; align-items: center; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel2);
  transition: all .3s; position: relative; overflow: hidden; }
.agent-node.pending { opacity: .5; }
.agent-node.running { border-color: var(--accent); opacity: 1;
  box-shadow: 0 0 14px rgba(59,157,255,.35), inset 0 0 22px rgba(59,157,255,.07);
  animation: nodePulse 1.6s ease-in-out infinite; }
.agent-node.running::after { content: ''; position: absolute; top: 0; left: -60%;
  width: 45%; height: 100%; background: linear-gradient(105deg, transparent, rgba(59,157,255,.14), transparent);
  animation: scan 1.8s linear infinite; }
.agent-node.ok { border-color: rgba(46,204,143,.5); opacity: 1; }
@keyframes nodePulse { 0%,100% { box-shadow: 0 0 8px rgba(59,157,255,.25); }
  50% { box-shadow: 0 0 20px rgba(59,157,255,.55); } }
@keyframes scan { to { left: 110%; } }
.agent-ic { font-size: 17px; width: 26px; text-align: center; flex: none; }
.agent-bd { flex: 1; min-width: 0; }
.agent-nm { font-size: 12.5px; font-weight: 600; color: var(--text); }
.agent-note { font-size: 11px; color: var(--muted); margin-top: 1px; }
.agent-note b { color: var(--accent); }
.agent-st { font-size: 11px; flex: none; display: flex; gap: 6px; align-items: center; }
.agent-t { color: var(--muted); font-family: ui-monospace, monospace; }
.agent-ck { color: var(--green); font-weight: 700; text-shadow: 0 0 8px rgba(46,204,143,.7); }
.agent-link { height: 16px; width: 2px; margin-left: 22px; background: var(--line); position: relative; }
.agent-link.lit { background: rgba(46,204,143,.45); }
.agent-link.flow { background: rgba(59,157,255,.25); overflow: hidden; }
.agent-link.flow i { position: absolute; left: 0; top: -6px; width: 2px; height: 6px;
  background: var(--accent); box-shadow: 0 0 6px var(--accent);
  animation: drip .8s linear infinite; }
@keyframes drip { to { top: 16px; } }
.spin-ring { width: 12px; height: 12px; border: 2px solid rgba(59,157,255,.25);
  border-top-color: var(--accent); border-radius: 50%; display: inline-block;
  animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.md-hr { height: 1px; background: linear-gradient(90deg, transparent, var(--line), transparent); margin: 12px 0; }

/* ===== 科技感 · 全局氛围 ===== */
body::before {  /* 网格 + 顶部光晕 */
  content: ''; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(ellipse 90% 55% at 50% -12%, rgba(59,157,255,.12), transparent 62%),
    linear-gradient(rgba(59,157,255,.030) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,157,255,.030) 1px, transparent 1px);
  background-size: 100% 100%, 44px 44px, 44px 44px;
}
.aurora { position: fixed; z-index: -1; pointer-events: none;
  width: 55vw; height: 55vw; border-radius: 50%; filter: blur(110px); opacity: .5;
  background: radial-gradient(circle, rgba(59,157,255,.14), rgba(46,204,143,.05) 55%, transparent 70%);
  top: -20vw; right: -12vw; animation: auroraDrift 26s ease-in-out infinite alternate; }
@keyframes auroraDrift {
  0%   { transform: translate(0,0) scale(1); }
  100% { transform: translate(-16vw, 14vh) scale(1.18); } }

.topbar { position: sticky; }
.topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent 5%, rgba(59,157,255,.55), transparent 95%); }
.sys-live { display: flex; align-items: center; gap: 7px; font-size: 12px;
  color: var(--muted); font-family: ui-monospace, SFMono-Regular, monospace; }
.led { width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 9px var(--green); animation: ledPulse 2.2s ease-in-out infinite; }
@keyframes ledPulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.card { position: relative; transition: border-color .25s, box-shadow .25s; }
.card:hover { border-color: rgba(59,157,255,.35); box-shadow: 0 0 22px rgba(59,157,255,.06); }

.kpi .v { animation: kpiIn .45s cubic-bezier(.2,.8,.3,1) both; }
.kpi .v.pos { text-shadow: 0 0 16px rgba(46,204,143,.35); }
.kpi .v.neg { text-shadow: 0 0 16px rgba(255,92,114,.30); }
@keyframes kpiIn { from { opacity: 0; transform: translateY(8px); } }

.alert-item { animation: alertIn .35s cubic-bezier(.2,.8,.3,1) both; }
@keyframes alertIn { from { opacity: 0; transform: translateX(-12px); } }

.module-card::before, .module-card::after { /* 科幻边角 */
  content: ''; position: absolute; width: 15px; height: 15px;
  border: 1px solid transparent; transition: border-color .25s; }
.module-card::before { top: 7px; left: 7px; border-right: 0; border-bottom: 0; }
.module-card::after  { bottom: 7px; right: 7px; border-left: 0; border-top: 0; }
.module-card:hover::before, .module-card:hover::after { border-color: rgba(59,157,255,.8); }
.module-card { position: relative; }

.hero { position: relative; overflow: hidden; }
#neural-bg { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; }
.hero > *:not(#neural-bg) { position: relative; z-index: 1; }
.hero h1 span { text-shadow: 0 0 28px rgba(59,157,255,.55); }

@media (prefers-reduced-motion: reduce) {
  .aurora, .agent-node.running::after { animation: none !important; }
}
@media print {
  body::before, body::after, .aurora, #neural-bg { display: none !important; }
}

/* ===== 流水线横向模式(右侧顶部布局) ===== */
.agent-flow.h { flex-direction: row; align-items: stretch; }
.agent-flow.h .agent-node { flex: 1 1 0; min-width: 0; flex-direction: column;
  text-align: center; gap: 4px; padding: 12px 8px; justify-content: flex-start; }
.agent-flow.h .agent-ic { width: auto; font-size: 20px; }
.agent-flow.h .agent-bd { width: 100%; }
.agent-flow.h .agent-nm { font-size: 12px; }
.agent-flow.h .agent-note { font-size: 10.5px; line-height: 1.5;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.agent-flow.h .agent-st { justify-content: center; min-height: 16px; }
.agent-flow.h .agent-link { width: 24px; height: 2px; margin: 0; flex: none; align-self: center; }
.agent-flow.h .agent-link.flow i { width: 6px; height: 2px; top: 0; left: -6px;
  animation: driph .8s linear infinite; }
@keyframes driph { to { left: 24px; } }
@media (max-width: 900px) {
  .agent-flow.h { flex-direction: column; }
  .agent-flow.h .agent-node { flex-direction: row; text-align: left; }
  .agent-flow.h .agent-link { width: 2px; height: 16px; margin-left: 22px; align-self: flex-start; }
}
