:root {
  --ink: #11130f;
  --paper: #e8e2d2;
  --paper-deep: #d8d0bc;
  --line: rgba(17, 19, 15, .22);
  --acid: #d8ff35;
  --orange: #ff6b35;
  --red: #df3c32;
  --blue: #2f67d9;
  --muted: #716f65;
  --display: "Bahnschrift Condensed", "DIN Condensed", "Microsoft YaHei", sans-serif;
  --body: "Microsoft YaHei", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(17,19,15,.045) 50%, transparent 50.2%) 0 0/72px 72px,
    linear-gradient(rgba(17,19,15,.045) 1px, transparent 1px) 0 0/100% 72px,
    var(--paper);
  font-family: var(--body);
  min-height: 100vh;
}

button, select, textarea { font: inherit; }
button {
  border: 1px solid var(--ink);
  background: transparent;
  color: inherit;
  padding: .7rem 1rem;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, color .18s ease;
}
button:hover { background: var(--ink); color: var(--acid); transform: translateY(-2px); }
button:disabled { opacity: .35; cursor: not-allowed; transform: none; }
button.primary { background: var(--acid); color: var(--ink); font-weight: 800; }
button.primary:hover { background: var(--ink); color: var(--acid); }

.grain {
  position: fixed; inset: 0; z-index: 20; pointer-events: none; opacity: .12;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
}

.topbar {
  height: 82px;
  border-bottom: 2px solid var(--ink);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4vw; position: sticky; top: 0; z-index: 15;
  background: rgba(232,226,210,.94); backdrop-filter: blur(14px);
}
.brand { color: inherit; text-decoration: none; display: flex; gap: 12px; align-items: center; }
.brand-mark {
  width: 46px; height: 46px; display: grid; place-items: center;
  background: var(--ink); color: var(--acid); font: 800 15px var(--display);
  transform: rotate(-3deg);
}
.brand b { display: block; font: 800 19px var(--display); letter-spacing: .08em; }
.brand small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.system-state { display: flex; align-items: center; gap: 9px; font: 700 12px var(--display); letter-spacing: .08em; }
.system-state i { width: 8px; height: 8px; border-radius: 50%; background: #4aaa4f; box-shadow: 0 0 0 5px rgba(74,170,79,.14); }
.system-state time { margin-left: 14px; font-size: 16px; }

main { width: min(1480px, 92vw); margin: 0 auto; padding-bottom: 72px; }
.hero {
  min-height: 560px; display: grid; grid-template-columns: 1.15fr .85fr;
  gap: 8vw; align-items: center; border-bottom: 2px solid var(--ink); position: relative;
}
.hero::after {
  content: "01"; position: absolute; right: 0; bottom: -14px;
  background: var(--paper); padding-left: 12px; font: 800 18px var(--display);
}
.eyebrow, .panel-title p, .dialog-head p {
  font: 800 11px var(--display); letter-spacing: .18em; margin: 0 0 12px; text-transform: uppercase;
}
h1 {
  font: 800 clamp(46px, 5.45vw, 88px)/.92 var(--display);
  letter-spacing: -.055em; margin: 0; text-transform: uppercase;
}
h1 em { color: var(--orange); font-style: normal; -webkit-text-stroke: 1px var(--ink); }
h1 b { color: var(--ink); font-weight: 800; }
.title-line { display: flex; align-items: baseline; gap: .18em; min-height: 1em; white-space: nowrap; flex-wrap: nowrap; }
.title-line em, .title-line b { white-space: nowrap; flex: 0 0 auto; }
.title-line.judgement-line { gap: .26em; }
.project-title { text-transform:none; letter-spacing:0; line-height:1; }
.project-title span { display:block; }
.project-title .project-brand { font-size:clamp(56px, 6.4vw, 104px); letter-spacing:-.055em; }
.project-title .project-en { margin-top:10px; color:var(--orange); font-size:clamp(25px, 2.6vw, 42px); letter-spacing:-.025em; text-transform:uppercase; }
.project-title .project-cn { margin-top:13px; max-width:760px; font:800 clamp(24px, 2.35vw, 38px)/1.18 var(--display); letter-spacing:-.035em; }
.lede { max-width: 660px; color: #48483f; line-height: 1.8; margin: 30px 0 0; font-size: 15px; }
.control-rack { background: var(--ink); color: var(--paper); padding: 28px; box-shadow: 14px 14px 0 var(--orange); transform: rotate(1deg); }
.rack-head { display: flex; justify-content: space-between; font: 700 12px var(--display); letter-spacing: .09em; }
.progress-track { height: 10px; background: #35382f; margin: 25px 0; overflow: hidden; }
.progress-track i { display: block; width: 0; height: 100%; background: var(--acid); transition: width .45s ease; }
.rack-actions { display: grid; grid-template-columns: 1.45fr 1.25fr 1fr 1fr; gap: 8px; }
.rack-actions button { border-color: #75796c; color: var(--paper); }
.rack-actions .primary { color: var(--ink); border-color: var(--acid); display: flex; justify-content: space-between; }
.rack-actions .snapshot-btn { color: var(--ink); background: var(--orange); border-color: var(--orange); font-weight: 800; }
kbd { font: 700 10px var(--display); border: 1px solid currentColor; padding: 2px 5px; }
.rack-status { margin: 18px 0 0; color: #9ba08f; font-size: 12px; }

.metric-strip { display: grid; grid-template-columns: repeat(5, 1fr); border: 2px solid var(--ink); border-top: 0; }
.metric-strip article { padding: 22px; border-right: 1px solid var(--ink); min-width: 0; }
.metric-strip article:last-child { border-right: 0; }
.metric-strip span, .metric-strip small { display: block; font-size: 11px; color: var(--muted); }
.metric-strip strong { display: block; font: 800 46px var(--display); letter-spacing: -.04em; margin: 6px 0 2px; }
.metric-strip .alert-metric { background: var(--orange); }
.metric-strip .alert-metric span, .metric-strip .alert-metric small { color: var(--ink); }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; margin-top: 58px; }
.panel { border: 1.5px solid var(--ink); background: rgba(232,226,210,.78); }
.panel-title { min-height: 82px; padding: 17px 20px; border-bottom: 1px solid var(--ink); display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.panel-title h2, .dialog-head h2 { font: 800 24px var(--display); margin: 0; text-transform: uppercase; letter-spacing: -.015em; }
.panel-title p, .dialog-head p { color: var(--orange); margin-bottom: 4px; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 10px; }
.legend span::before { content: ""; width: 7px; height: 7px; display: inline-block; margin-right: 4px; }
.legend .normal::before { background: #4aaa4f; }
.legend .mild::before { background: #c7a729; }
.legend .moderate::before { background: var(--orange); }
.legend .severe::before { background: var(--red); }

.worker-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.worker-card {
  min-height: 157px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 18px; text-align: left; position: relative; overflow: hidden; background: transparent;
}
.worker-card.state-working { background: linear-gradient(135deg, rgba(255,107,53,.10), transparent 48%), var(--paper); }
.worker-card.state-working::before, .worker-card.state-available::before { content:""; position:absolute; inset:0 auto auto 0; width:100%; height:4px; background:#ff6b35; }
.worker-card.state-available { background: linear-gradient(135deg, rgba(47,103,217,.10), transparent 48%), var(--paper); }
.worker-card.state-available::before { background:#2f67d9; }
.state-chip { font:700 10px var(--display); letter-spacing:.08em; color:#2f67d9; }
.state-working .state-chip { color:#ff6b35; }
.worker-card:hover, .worker-card.active { color: var(--paper); background: var(--ink); transform: none; }
.worker-card::after { content: ""; position: absolute; top: 0; right: 0; width: 9px; height: 100%; background: var(--status-color, #4aaa4f); }
.worker-card .id { font: 700 10px var(--display); letter-spacing: .12em; color: var(--muted); }
.worker-card:hover .id, .worker-card.active .id { color: #a8ab9e; }
.worker-card h3 { font: 800 25px var(--display); margin: 9px 0 16px; }
.worker-meta { display: flex; justify-content: space-between; font-size: 11px; }
.worker-meta b { color: var(--status-color); text-transform: uppercase; }
.live-signals { display:grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap:5px; margin-top:12px; }
.live-signals span { border:1px solid var(--line); background:rgba(255,255,255,.44); padding:5px 4px; font:700 9px var(--display); color:#34362e; text-align:center; }
.worker-card:hover .live-signals span, .worker-card.active .live-signals span { border-color:#4c5145; background:#20231d; color:#ece8d6; }
.runtime-note { display:block; margin-top:10px; color:var(--muted); font-size:10px; line-height:1.45; }
.worker-card:hover .runtime-note, .worker-card.active .runtime-note { color:#a8ab9e; }
.calibration-tag { display: inline-block; font-size: 9px; padding: 2px 5px; background: var(--acid); color: var(--ink); margin-top: 12px; }
.report-panel { margin-top: 18px; }
.report-trigger-actions { display:flex; gap:8px; flex-wrap:wrap; }
.config-panel { margin-top:18px; }
.llm-config { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; padding:14px; }
.llm-runtime { grid-column:1/-1; padding:10px 12px; border-left:4px solid var(--orange); background:#f7f5ed; font-size:12px; }
.llm-tier { text-align:left; min-height:110px; display:flex; flex-direction:column; gap:8px; border-color:var(--line); background:#f7f5ed; }
.llm-tier b { font:800 16px var(--display); }
.llm-tier span { font:700 11px var(--display); color:var(--blue); }
.llm-tier small { color:var(--muted); }
.llm-tier.active { background:var(--ink); color:var(--paper); box-shadow:inset 0 4px 0 var(--acid); }
.llm-tier.active span { color:var(--acid); }
.report-list { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:12px; padding:14px; }
.report-card { border:1px solid var(--line); padding:14px; background:#f7f5ed; }
.report-card h3 { margin:0 0 8px; font-size:15px; }
.report-card p { margin:0 0 12px; color:var(--muted); font-size:12px; line-height:1.5; }
.report-actions { display:flex; gap:6px; flex-wrap:wrap; }
.report-actions a { text-decoration:none; border:1px solid var(--line); padding:6px 8px; color:var(--ink); font:700 10px var(--display); }
.report-actions a.primary-link { background:var(--ink); color:var(--paper); }

.signal-panel { min-height: 420px; }
.icon-btn { padding: 7px 9px; font-size: 11px; }
.empty-state { height: 335px; display: grid; place-content: center; text-align: center; color: var(--muted); line-height: 1.7; }
.pulse-ring { width: 74px; height: 74px; border: 1px solid var(--muted); border-radius: 50%; margin: 0 auto 18px; position: relative; }
.pulse-ring::before, .pulse-ring::after { content: ""; position: absolute; border: 1px solid var(--orange); border-radius: 50%; inset: 12px; animation: pulse 2s infinite; }
.pulse-ring::after { inset: 25px; animation-delay: .4s; }
.hidden { display: none !important; }
.worker-detail { padding: 22px; }
.signal-score { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.signal-score div { border: 1px solid var(--line); padding: 12px 8px; }
.signal-score span { display: block; font-size: 9px; color: var(--muted); }
.signal-score strong { display: block; font: 700 17px var(--display); margin-top: 6px; text-transform: uppercase; }
.mini-signals { margin-top: 24px; }
.mini-signal { margin: 13px 0; }
.mini-signal header { display: flex; justify-content: space-between; font: 700 10px var(--display); }
.mini-signal .bar { height: 7px; background: var(--paper-deep); margin-top: 6px; }
.mini-signal .bar i { display: block; height: 100%; background: var(--blue); }
.live-detail { border:1px solid var(--line); padding:12px; margin-bottom:16px; background:#f7f2df; }
.live-detail header { display:flex; justify-content:space-between; font:800 10px var(--display); letter-spacing:.08em; margin-bottom:10px; }
.live-detail header b { color:var(--blue); }
.live-detail-grid { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:7px; }
.live-detail-grid span { background:#fffaf0; border:1px solid var(--line); padding:8px 7px; color:var(--muted); font-size:10px; }
.live-detail-grid b { display:block; color:var(--ink); font:800 15px var(--display); margin-top:4px; }
.scenario-note { border-top: 1px solid var(--line); padding-top: 18px; font-size: 11px; color: var(--muted); line-height: 1.6; }
.trace-visual { margin-top: 20px; border: 1px solid var(--line); padding: 14px; background:#f7f5ed; }
.trace-visual header { display:flex; justify-content:space-between; gap:10px; font:700 11px var(--display); }
.trace-visual header b { color:var(--muted); font-weight:400; }
.timeline-svg { width:100%; height:auto; margin-top:8px; font:10px var(--body); }
.evidence-grid { margin-top:18px; }
.evidence-grid h3 { font:800 15px var(--display); margin:0 0 10px; }
.evidence-card { border-left:4px solid var(--orange); background:#f7f5ed; padding:12px; margin:8px 0; }
.evidence-card b { font:800 12px var(--display); }
.evidence-card p { margin:6px 0; line-height:1.55; font-size:12px; }
.evidence-card small { color:var(--muted); font-size:10px; }
.report-page { width:min(900px,92vw); padding:48px 0; }
.report-view { border:2px solid var(--ink); background:rgba(232,226,210,.9); padding:32px; box-shadow:14px 14px 0 var(--orange); }
.report-view header { border-bottom:1px solid var(--ink); padding-bottom:18px; }
.report-view header p { color:var(--orange); font:800 11px var(--display); letter-spacing:.16em; }
.report-view h1 { font-size:clamp(38px,6vw,70px); margin:12px 0; }
.report-status { border:1px solid var(--ink); padding:4px 8px; font:700 10px var(--display); }
.report-lede { font-size:16px; line-height:1.8; margin:24px 0; }
.report-view section { border-top:1px solid var(--line); padding-top:20px; margin-top:24px; }
.report-view section h2 { font:800 21px var(--display); }
.basic-grid { display:grid; grid-template-columns:1fr 1fr; gap:4px 24px; }
.basic-grid p { margin:6px 0; }
.report-table { width:100%; border-collapse:collapse; font-size:12px; }
.report-table th, .report-table td { border:1px solid var(--line); padding:10px; text-align:left; }
.report-table th { background:var(--paper-deep); }
.report-table-wrap { overflow-x:auto; }
.group-metric-table { min-width:900px; }
.group-metric-table td small { display:block; margin-top:4px; color:var(--muted); white-space:nowrap; }
.report-view footer { display:flex; gap:10px; margin-top:30px; }
.report-view footer a { padding:10px 14px; border:1px solid var(--ink); color:var(--ink); text-decoration:none; }
.report-view footer .primary-link { color:var(--paper); background:var(--ink); }

.lower-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(310px, .5fr); gap: 18px; margin-top: 18px; }
.table-wrap { overflow: auto; max-height: 480px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; padding: 12px 16px; font: 700 10px var(--display); letter-spacing: .07em; color: var(--muted); border-bottom: 1px solid var(--line); }
td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
td strong { font-family: var(--display); }
.level-pill { display: inline-block; padding: 3px 7px; color: white; font: 700 10px var(--display); text-transform: uppercase; background: var(--status-color); }
.evidence-cell { max-width: 350px; color: #4f5048; line-height: 1.55; }
.trace-link { border: 0; padding: 0; text-decoration: underline; font: 700 10px var(--display); }
.trace-link:hover { background: transparent; color: var(--orange); transform: none; }

.review-list { max-height: 395px; overflow: auto; }
.review-card { padding: 17px 19px; border-bottom: 1px solid var(--line); }
.review-card header { display: flex; justify-content: space-between; gap: 12px; }
.review-card h3 { font: 700 17px var(--display); margin: 0; }
.review-card p { color: var(--muted); font-size: 11px; line-height: 1.6; }
.review-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.review-actions button { padding: 7px; font-size: 10px; }
.wide-action { width: calc(100% - 36px); margin: 18px; }
.audit-card { background: rgba(216,255,53,.13); }
.audit-card .review-actions { grid-template-columns: 1fr 1fr; }

.evaluation-panel, .human-safety-panel { margin-top: 18px; }
.evaluation-note { color: var(--muted); font-size: 10px; text-align: right; }
.evaluation-grid { display: grid; grid-template-columns: repeat(4, minmax(120px, .65fr)) 2fr; }
.evaluation-grid > article { padding: 24px; border-right: 1px solid var(--line); }
.evaluation-grid > article span { display: block; color: var(--muted); font-size: 10px; }
.evaluation-grid > article strong { display: block; font: 800 34px var(--display); margin-top: 10px; }
.confusion-matrix { padding: 18px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.matrix-cell { min-height: 34px; display: grid; place-items: center; background: rgba(17,19,15,.08); font: 700 10px var(--display); }
.matrix-cell.head { background: transparent; color: var(--muted); font-size: 8px; }
.matrix-cell.diag { background: var(--acid); }
.safety-compare { display:grid; grid-template-columns:1fr 70px 1fr; align-items:stretch; }
.safety-compare article { padding:30px; min-height:170px; }
.safety-compare article span { font:800 10px var(--display); letter-spacing:.14em; color:var(--muted); }
.safety-compare article h3 { margin:12px 0; font:800 28px var(--display); }
.safety-compare article p { margin:0; max-width:520px; color:var(--muted); line-height:1.75; }
.scene-safety { background:rgba(17,19,15,.05); }
.human-safety { background:rgba(216,255,53,.16); }
.human-safety h3 { color:#245a29; }
.compare-plus { display:grid; place-items:center; border-left:1px solid var(--line); border-right:1px solid var(--line); font:800 36px var(--display); color:var(--orange); }
.agent-bridge { grid-column:1/-1; display:flex; justify-content:center; align-items:center; gap:18px; padding:18px; border-top:1px solid var(--line); background:var(--ink); color:var(--paper); }
.agent-bridge b { font:800 12px var(--display); letter-spacing:.05em; }
.agent-bridge i { color:var(--acid); font-style:normal; }
.hero-agent-flow { grid-column:auto; justify-content:flex-start; width:max-content; max-width:100%; margin:0 0 24px; padding:13px 16px; flex-wrap:wrap; gap:12px; }

dialog { width: min(980px, 92vw); max-height: 88vh; padding: 0; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); box-shadow: 18px 18px 0 rgba(17,19,15,.8); }
dialog::backdrop { background: rgba(17,19,15,.72); backdrop-filter: blur(4px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--ink); }
.dialog-head button { border: 0; font-size: 24px; padding: 4px 9px; }
.trace-content { padding: 24px; overflow: auto; }
.dispatch-decisions { display: flex; gap: 7px; flex-wrap: wrap; margin: -8px 0 22px; }
.dispatch-decisions button { font-size: 10px; }
.trace-chain { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; margin-bottom: 28px; }
.trace-node { border-top: 5px solid var(--orange); padding-top: 10px; position: relative; }
.trace-node:not(:last-child)::after { content: "→"; position: absolute; right: -18px; top: 28px; font: 700 20px var(--display); }
.trace-node span { color: var(--muted); font-size: 9px; }
.trace-node strong { display: block; font: 700 15px var(--display); margin: 7px 0; }
.trace-node p { font-size: 11px; line-height: 1.5; }
.json-block { background: var(--ink); color: #ced7b2; padding: 18px; overflow: auto; font: 11px/1.55 Consolas, monospace; }
.compact-dialog { width: min(540px, 92vw); }
.compact-dialog form > label { display: block; margin: 20px; font-size: 12px; }
.compact-dialog select, .compact-dialog textarea { width: 100%; display: block; margin-top: 8px; padding: 11px; border: 1px solid var(--ink); background: transparent; }
.compact-dialog input[type="range"] { width: 100%; accent-color: var(--orange); margin: 18px 0 8px; }
.compact-dialog output { display: block; font: 800 22px var(--display); }
.compact-dialog textarea { min-height: 100px; resize: vertical; }
.compact-dialog form > .primary { margin: 0 20px 20px; width: calc(100% - 40px); }

#toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 40; max-width: 390px;
  background: var(--ink); color: var(--paper); padding: 13px 18px; font-size: 12px;
  transform: translateY(120px); opacity: 0; transition: .28s ease;
}
#toast.show { transform: translateY(0); opacity: 1; }

.reveal { animation: reveal .65s cubic-bezier(.2,.8,.2,1) both; }
.delay-1 { animation-delay: .08s; }
.delay-2 { animation-delay: .16s; }
.delay-3 { animation-delay: .24s; }
@keyframes reveal { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%,100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.3); } }

@media (max-width: 1050px) {
  .hero { grid-template-columns: 1fr; padding: 70px 0; }
  .workspace, .lower-grid { grid-template-columns: 1fr; }
  .worker-grid { grid-template-columns: repeat(3, 1fr); }
  .metric-strip { grid-template-columns: repeat(3, 1fr); }
  .metric-strip article { border-bottom: 1px solid var(--ink); }
}
@media (max-width: 680px) {
  main { width: 94vw; }
  .topbar { padding: 0 3vw; }
  .system-state span { display: none; }
  h1 { font-size: 55px; }
  .rack-actions { grid-template-columns: 1fr; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .worker-grid { grid-template-columns: repeat(2, 1fr); }
  .legend { display: none; }
  .trace-chain { grid-template-columns: 1fr; }
  .evaluation-grid, .safety-compare { grid-template-columns: 1fr; }
  .confusion-matrix { grid-column: 1 / -1; }
  .compare-plus { min-height:52px; border:0; border-top:1px solid var(--line); border-bottom:1px solid var(--line); }
  .agent-bridge { flex-wrap:wrap; gap:10px; }
  .trace-node:not(:last-child)::after { content: "↓"; right: auto; left: 10px; top: auto; bottom: -23px; }
  .llm-config { grid-template-columns:1fr 1fr; }
}
