:root {
  --ink: #16221c;
  --muted: #607067;
  --line: #d8e2da;
  --paper: #f4f7f3;
  --white: #ffffff;
  --forest: #123c2d;
  --forest-2: #1b5941;
  --mint: #b9f3d3;
  --blue: #245cdb;
  --blue-soft: #e9efff;
  --red: #b42318;
  --red-soft: #fff0ee;
  --amber: #a85000;
  --amber-soft: #fff4df;
  --good: #13704a;
  --shadow: 0 16px 44px rgba(21, 40, 30, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}
button, select { font: inherit; }
a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 10px clamp(16px, 3vw, 44px);
  color: white;
  background: rgba(12, 39, 29, .96);
  border-bottom: 1px solid rgba(255,255,255,.13);
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 850; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  color: var(--forest);
  background: var(--mint);
  font-weight: 950;
}
.brand small { display: block; color: #b8d7ca; font-size: 11px; font-weight: 650; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { padding: 8px 10px; color: #dcebe4; font-size: 13px; font-weight: 700; }
.nav .github-link { border: 1px solid rgba(255,255,255,.22); border-radius: 7px; }

.intro {
  padding: 48px clamp(20px, 5vw, 72px) 34px;
  color: white;
  background: var(--forest);
}
.intro-inner { width: min(1180px, 100%); margin: 0 auto; }
.kicker { margin: 0 0 12px; color: var(--mint); font-size: 12px; font-weight: 850; text-transform: uppercase; }
h1 { max-width: 1050px; margin: 0; font-size: clamp(38px, 5.4vw, 68px); line-height: 1.03; }
.intro-copy { max-width: 820px; margin: 18px 0 0; color: #d9eee4; font-size: clamp(16px, 2vw, 20px); line-height: 1.55; }
.signal-row { display: flex; flex-wrap: wrap; gap: 18px 28px; margin-top: 28px; }
.signal { display: flex; gap: 9px; align-items: baseline; color: #c9dfd5; font-size: 13px; }
.signal strong { color: white; font-size: 22px; }

.workspace-band { padding: 24px clamp(16px, 3vw, 44px) 64px; background: linear-gradient(var(--forest) 92px, var(--paper) 92px); }
.workspace {
  width: min(1280px, 100%);
  margin: 0 auto;
  overflow: hidden;
  background: var(--white);
  border: 1px solid rgba(18, 60, 45, .18);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.workspace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}
.workspace-title { display: flex; align-items: center; gap: 10px; font-weight: 850; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #2dc87e; box-shadow: 0 0 0 5px #e5f8ef; }
.workspace-meta { color: var(--muted); font-size: 12px; }
.workspace-grid { display: grid; grid-template-columns: 270px minmax(0, 1fr) 310px; min-height: 650px; }
.rail, .inspector { padding: 18px; background: #fbfdfb; }
.rail { border-right: 1px solid var(--line); }
.inspector { border-left: 1px solid var(--line); }
.label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 850; text-transform: uppercase; }
.field { margin-bottom: 18px; }
select {
  width: 100%;
  min-height: 42px;
  padding: 8px 34px 8px 10px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.agent-options { display: grid; gap: 8px; }
.agent-option {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 9px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  cursor: pointer;
}
.agent-option.active { border-color: var(--blue); background: var(--blue-soft); }
.agent-radio { width: 10px; height: 10px; border: 2px solid #87958d; border-radius: 50%; }
.agent-option.active .agent-radio { border: 3px solid var(--blue); }
.agent-option strong { display: block; font-size: 13px; line-height: 1.3; }
.agent-option small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.badge { padding: 3px 7px; border-radius: 999px; color: var(--good); background: #e8f6ef; font-size: 10px; font-weight: 850; }
.badge.risk { color: var(--red); background: var(--red-soft); }
.run-button, .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 850;
  cursor: pointer;
}
.run-button { width: 100%; color: white; background: var(--blue); }
.run-button:hover { background: #194bc0; }
.run-button:disabled { opacity: .65; cursor: wait; }
.secondary-button { color: var(--ink); background: white; border-color: var(--line); }
.shortcut { margin-top: 8px; text-align: center; color: var(--muted); font-size: 11px; }
.case-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 4px 7px; border-radius: 4px; color: #315347; background: #e9f1ed; font-size: 10px; font-weight: 750; overflow-wrap: anywhere; }
.skill-chip {
  display: block;
  margin: 2px 0 18px;
  padding: 11px;
  border: 1px solid #b9d8ca;
  border-radius: 6px;
  background: #eef8f3;
}
.skill-chip span { display: block; color: var(--good); font-size: 9px; font-weight: 900; text-transform: uppercase; }
.skill-chip strong { display: block; margin-top: 5px; font-size: 12px; }
.skill-chip small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.skill-chip:hover { border-color: var(--good); background: #e5f5ed; }

.stage { min-width: 0; padding: 22px; }
.case-head { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.case-head h2 { margin: 3px 0 6px; font-size: 24px; line-height: 1.2; }
.case-id { color: var(--blue); font-size: 11px; font-weight: 850; text-transform: uppercase; }
.amount { flex: 0 0 auto; text-align: right; }
.amount strong { display: block; font-size: 24px; }
.amount span { color: var(--muted); font-size: 11px; }
.pipeline { display: grid; grid-template-columns: repeat(4, 1fr); margin: 22px 0; }
.pipe-step { position: relative; padding-top: 22px; color: var(--muted); font-size: 11px; font-weight: 750; }
.pipe-step::before { content: ""; position: absolute; top: 6px; left: 0; width: 100%; height: 2px; background: var(--line); }
.pipe-step::after { content: ""; position: absolute; top: 1px; left: 0; width: 12px; height: 12px; border-radius: 50%; background: #cbd5ce; }
.pipe-step.active, .pipe-step.done { color: var(--blue); }
.pipe-step.active::after, .pipe-step.done::after { background: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
.pipe-step.done::before { background: var(--blue); }
.section-label { margin: 0 0 10px; font-size: 12px; }
.evidence-list { display: grid; gap: 8px; }
.evidence-item { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: start; padding: 11px 0; border-top: 1px solid var(--line); }
.evidence-item:first-child { border-top: 0; }
.evidence-id { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 5px; color: var(--blue); background: var(--blue-soft); font-size: 11px; font-weight: 900; }
.evidence-item strong { display: block; margin-bottom: 4px; font-size: 12px; }
.evidence-item p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.evidence-state { color: var(--muted); font-size: 10px; font-weight: 850; }
.evidence-state.flagged { color: var(--red); }
.console {
  min-height: 116px;
  margin-top: 18px;
  padding: 13px;
  color: #cce9dc;
  background: #101c16;
  border-radius: 6px;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
}
.console-line { opacity: 0; transform: translateY(3px); animation: reveal .25s forwards; }
@keyframes reveal { to { opacity: 1; transform: none; } }

.score-block { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.score-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.score-value { font-size: 44px; font-weight: 900; line-height: 1; }
.score-value small { color: var(--muted); font-size: 14px; }
.verdict { padding: 6px 8px; border-radius: 5px; color: var(--amber); background: var(--amber-soft); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.verdict.fail { color: var(--red); background: var(--red-soft); }
.score-bar { height: 6px; margin-top: 12px; overflow: hidden; background: #e7ece8; border-radius: 999px; }
.score-bar div { width: 0; height: 100%; background: var(--good); transition: width .7s ease; }
.score-bar div.fail { background: var(--red); }
.metric-list { margin: 16px 0; }
.metric { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.metric span { color: var(--muted); }
.finding-list { display: grid; gap: 8px; margin-top: 14px; }
.finding { padding: 9px 10px; border-left: 3px solid var(--good); background: #eef8f3; font-size: 11px; line-height: 1.45; }
.finding.danger { border-left-color: var(--red); background: var(--red-soft); }
.inspector-actions { display: grid; gap: 8px; margin-top: 16px; }
.inspector-actions a { width: 100%; }

.band { padding: 72px clamp(20px, 5vw, 72px); border-top: 1px solid var(--line); }
.band.white { background: white; }
.inner { width: min(1120px, 100%); margin: 0 auto; }
.section-head { display: flex; justify-content: space-between; gap: 28px; align-items: end; margin-bottom: 28px; }
.section-head h2 { max-width: 720px; margin: 0; font-size: clamp(28px, 4vw, 46px); line-height: 1.08; }
.section-head p { max-width: 520px; margin: 0; color: var(--muted); line-height: 1.6; }
.proof-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.proof { min-height: 210px; padding: 22px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.proof:first-child { grid-row: span 2; }
.proof-number { color: var(--blue); font-size: 12px; font-weight: 900; }
.proof h3 { margin: 28px 0 8px; font-size: 20px; }
.proof p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.proof ul { padding-left: 18px; color: var(--muted); font-size: 14px; line-height: 1.75; }
.arena-meta {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1.25fr;
  gap: 1px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  background: var(--line);
}
.arena-meta > div { min-width: 0; padding: 16px; background: #fbfdfb; }
.arena-meta strong, .arena-meta code { display: block; overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.arena-table-wrap { overflow-x: auto; border: 1px solid var(--line); }
.arena-table { width: 100%; min-width: 780px; border-collapse: collapse; background: white; }
.arena-table th, .arena-table td { padding: 14px; border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; }
.arena-table th { color: var(--muted); background: #f7faf7; font-size: 10px; text-transform: uppercase; }
.arena-table tr:last-child td { border-bottom: 0; }
.profile-name strong { display: block; font-size: 13px; }
.profile-name small { color: var(--muted); }
.run-type { display: inline-block; padding: 4px 7px; border-radius: 4px; color: #315347; background: #e9f1ed; font-size: 10px; font-weight: 800; }
.run-type.external { color: #244fb2; background: var(--blue-soft); }
.arena-command { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 14px; padding: 13px 15px; color: #d8eee4; background: #101c16; border-radius: 6px; }
.arena-command code { overflow-wrap: anywhere; font-size: 12px; }
.arena-command a { flex: 0 0 auto; color: var(--mint); font-size: 12px; font-weight: 800; }
.trace-workbench { display: grid; grid-template-columns: 220px minmax(0, 1fr) 230px; min-height: 560px; border: 1px solid var(--line); background: white; }
.trace-controls, .trace-score { padding: 18px; background: #fbfdfb; }
.trace-controls { display: flex; flex-direction: column; gap: 8px; border-right: 1px solid var(--line); }
.trace-controls .run-button { margin-top: auto; }
.trace-agent { display: block; width: 100%; padding: 11px; text-align: left; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: white; cursor: pointer; }
.trace-agent.active { border-color: var(--blue); background: var(--blue-soft); }
.trace-agent strong, .trace-agent small { display: block; }
.trace-agent strong { font-size: 12px; }
.trace-agent small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.trace-stage { min-width: 0; padding: 20px; }
.trace-head { display: flex; justify-content: space-between; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.trace-head h3 { margin: 4px 0 0; font-size: 20px; }
.trace-timeline { margin-top: 8px; }
.trace-event { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); opacity: 1; transition: opacity .2s, transform .2s; }
.trace-event.hidden { opacity: .15; transform: translateY(4px); }
.trace-index { color: var(--blue); font: 800 11px/1.5 ui-monospace, Consolas, monospace; }
.trace-event strong { display: block; font-size: 12px; }
.trace-event small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.4; overflow-wrap: anywhere; }
.trace-kind { align-self: start; padding: 3px 6px; color: #315347; background: #e9f1ed; border-radius: 4px; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.trace-event.blocked strong, .trace-event.blocked .trace-kind { color: var(--red); }
.trace-event.blocked .trace-kind { background: var(--red-soft); }
.trace-score { border-left: 1px solid var(--line); }
.trace-score > strong { display: block; margin: 6px 0 10px; font-size: 48px; line-height: 1; }
.trace-score .secondary-button { width: 100%; margin-top: 16px; }
.review-workbench { display: grid; grid-template-columns: 240px minmax(0, 1fr) 210px; border: 1px solid var(--line); background: white; }
.review-context, .review-form, .review-actions { min-width: 0; padding: 20px; }
.review-context { border-right: 1px solid var(--line); background: #fbfdfb; }
.review-context > strong { display: block; margin: 8px 0; font-size: 17px; line-height: 1.3; }
.review-recommendation { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--line); }
.review-recommendation span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.review-recommendation strong { display: block; margin-top: 6px; color: var(--amber); text-transform: uppercase; }
.review-form { display: grid; gap: 18px; }
.review-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.segmented button { min-height: 40px; border: 0; border-right: 1px solid var(--line); color: var(--muted); background: white; cursor: pointer; font-size: 12px; font-weight: 800; }
.segmented button:last-child { border-right: 0; }
.segmented button.active { color: white; background: var(--forest-2); }
.review-findings { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.review-check { display: flex; align-items: flex-start; gap: 8px; padding: 9px; background: #f5f8f5; font-size: 11px; line-height: 1.4; }
.review-check input { margin-top: 2px; accent-color: var(--good); }
textarea { width: 100%; resize: vertical; padding: 11px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 6px; font: 13px/1.5 inherit; }
textarea:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }
.review-actions { display: flex; flex-direction: column; gap: 9px; border-left: 1px solid var(--line); background: #fbfdfb; }
.review-actions > div { margin-bottom: auto; }
.review-actions strong, .review-actions small { display: block; }
.review-actions small { margin-top: 4px; color: var(--muted); }
.text-button { min-height: 34px; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 11px; text-decoration: underline; }
.architecture { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.arch-step { position: relative; min-height: 180px; padding: 22px; background: white; }
.arch-step:not(:last-child)::after { content: "→"; position: absolute; right: -11px; top: 50%; z-index: 2; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--blue); background: var(--blue-soft); font-weight: 900; }
.arch-step strong { display: block; margin: 42px 0 8px; }
.arch-step p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.video-shell { max-width: 1180px; border: 1px solid var(--line); background: var(--forest); }
.video-shell video { display: block; width: 100%; aspect-ratio: 16 / 9; background: var(--forest); }
.video-meta { display: flex; justify-content: space-between; gap: 16px; max-width: 1180px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.video-meta a { color: var(--blue); font-weight: 800; }
.portfolio-note { display: grid; grid-template-columns: 1fr 1fr; gap: 42px; }
.portfolio-note h2 { margin: 0; font-size: clamp(28px, 4vw, 48px); }
.portfolio-note p { margin: 0 0 14px; color: var(--muted); line-height: 1.7; }
.link-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
footer { padding: 26px clamp(20px, 5vw, 72px); color: #cbe1d7; background: #0c271d; }
footer .inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
footer a { color: white; font-weight: 800; }

@media (max-width: 1050px) {
  .workspace-grid { grid-template-columns: 230px minmax(0, 1fr); }
  .inspector { grid-column: 1 / -1; border-top: 1px solid var(--line); border-left: 0; }
  .inspector { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  .review-workbench { grid-template-columns: 220px minmax(0, 1fr); }
  .trace-workbench { grid-template-columns: 200px minmax(0, 1fr); }
  .trace-score { grid-column: 1 / -1; border-top: 1px solid var(--line); border-left: 0; }
  .review-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto auto auto; align-items: end; border-top: 1px solid var(--line); border-left: 0; }
}
@media (max-width: 760px) {
  .nav a:not(.github-link) { display: none; }
  .intro { padding-top: 36px; }
  .workspace-band { padding-left: 10px; padding-right: 10px; }
  .workspace-grid { display: block; }
  .rail { border-right: 0; border-bottom: 1px solid var(--line); }
  .agent-options { grid-template-columns: 1fr 1fr; }
  .case-head { flex-direction: column; }
  .amount { text-align: left; }
  .pipeline { grid-template-columns: repeat(2, 1fr); row-gap: 16px; }
  .inspector { display: block; }
  .section-head, .portfolio-note { display: block; }
  .section-head p { margin-top: 14px; }
  .proof-grid, .architecture { grid-template-columns: 1fr; }
  .arena-meta, .review-workbench, .trace-workbench { grid-template-columns: 1fr; }
  .arena-meta strong, .arena-meta code { white-space: normal; overflow-wrap: anywhere; }
  .review-context { border-right: 0; border-bottom: 1px solid var(--line); }
  .review-actions { display: grid; grid-template-columns: 1fr; border-left: 0; }
  .review-findings { grid-template-columns: 1fr; }
  .trace-controls { border-right: 0; border-bottom: 1px solid var(--line); }
  .trace-controls .run-button { margin-top: 8px; }
  .trace-score { border-left: 0; }
  .proof:first-child { grid-row: auto; }
  .arch-step:not(:last-child)::after { content: "↓"; right: 50%; top: auto; bottom: -11px; }
  .video-meta { flex-direction: column; }
}
@media (max-width: 460px) {
  h1 { font-size: 36px; }
  .signal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .workspace-head { align-items: flex-start; flex-direction: column; }
  .agent-options { grid-template-columns: 1fr; }
  .stage { padding: 16px; }
  .evidence-item { grid-template-columns: 32px 1fr; }
  .evidence-state { grid-column: 2; }
}
