:root {
  --navy: #082b57;
  --blue: #0865ed;
  --ink: #102a49;
  --muted: #61758f;
  --line: #cddceb;
  --soft: #f5f9fe;
  --ok: #0b8a5b;
  --bad: #c83f4b;
  --cyan: #20a8b8;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: #edf4fa; color: var(--ink); font: 14px/1.55 "Segoe UI", "Microsoft YaHei", sans-serif; }
button, textarea, input { font: inherit; }

.topbar { min-height: 68px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 22px; padding: 0 28px; background: var(--navy); color: #fff; }
.topbar a { color: inherit; text-decoration: none; }
.brand { display: grid; align-content: center; justify-self: start; min-height: 44px; }
.brand strong { font-size: 15px; }
.brand span { font-size: 12px; opacity: .68; }
.topbar nav { display: flex; align-items: stretch; height: 68px; }
.topbar nav > * { display: flex; align-items: center; justify-content: center; min-width: 62px; border-bottom: 3px solid transparent; color: #fff; font-size: 12px; }
.topbar nav strong { border-color: #57a4ff; }
.topbar nav span { opacity: .42; }
.safe { display: grid; justify-self: end; text-align: right; font-size: 12px; }
.safe span { color: #a9d4ff; }
.safe a { display: flex; align-items: center; justify-content: flex-end; min-height: 44px; }

main { max-width: 1420px; margin: auto; padding: 24px; }
.hero, .story, .report-handoff, .rehearsal, .summary, .optional-zone, .boundary { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 5px 18px rgba(29, 67, 110, .045); }

.hero { display: grid; grid-template-columns: 1.55fr .65fr; overflow: hidden; }
.hero > div { padding: 34px 36px; }
.hero h1 { max-width: 900px; margin: 0; font-size: 35px; line-height: 1.16; letter-spacing: -.025em; }
.hero p { max-width: 850px; margin: 12px 0 20px; color: var(--muted); font-size: 15px; }
.hero a, .stage > .observe-step > button, .defense > button, .rail > button, .summary button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border: 1px solid var(--blue); border-radius: 7px; background: var(--blue); padding: 8px 16px; color: #fff; text-decoration: none; font-size: 12px; font-weight: 800; cursor: pointer; }
.hero aside { display: flex; flex-direction: column; justify-content: center; padding: 28px; background: linear-gradient(135deg, #0a376d, #0865ed); color: #fff; }
.hero aside span, .hero aside small { font-size: 12px; opacity: .78; }
.hero aside strong { margin: 7px 0; font-size: 20px; }

.story { margin-top: 14px; padding: 20px 24px; }
.story > header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.story small, .report-handoff small, .rail small, .stage header small, .defense header small, .summary header small { color: var(--blue); font-size: 12px; font-weight: 800; }
.story h2, .report-handoff h2, .rail h2, .stage h2, .defense h2, .summary h2 { margin: 3px 0; font-size: 20px; }
.story > header > strong { color: var(--bad); font-size: 12px; }
.story ol { display: grid; grid-template-columns: repeat(7, 1fr); margin: 16px 0 12px; padding: 0; list-style: none; }
.story li { position: relative; display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 8px; min-height: 58px; border-block: 1px solid var(--line); padding: 8px; }
.story li:first-child { border-left: 1px solid var(--line); border-radius: 7px 0 0 7px; }
.story li:last-child { border-right: 1px solid var(--line); border-radius: 0 7px 7px 0; }
.story li:not(:last-child)::after { content: ""; position: absolute; right: -4px; z-index: 1; width: 8px; height: 8px; border-top: 2px solid #81a8d5; border-right: 2px solid #81a8d5; transform: rotate(45deg); background: #fff; }
.story li b { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #e7f1ff; color: var(--blue); font-size: 12px; }
.story li span { font-weight: 800; }
.story footer { border-top: 1px solid var(--line); padding-top: 11px; color: var(--muted); }

.report-handoff { margin-top: 14px; padding: 24px; }
.report-handoff > header { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: end; }
.report-handoff header p { margin: 7px 0 0; color: var(--muted); }
.report-handoff label { display: block; border: 1px dashed #8daac8; border-radius: 7px; padding: 12px; font-size: 12px; font-weight: 700; }
.report-handoff input { display: block; width: 100%; min-height: 44px; margin-top: 7px; font-size: 12px; }
.handoff-chain { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 9px; margin-top: 18px; }
.handoff-chain article { display: grid; gap: 5px; min-height: 96px; border: 1px solid var(--line); border-top: 3px solid var(--cyan); padding: 13px; }
.handoff-chain span, .handoff-chain code { font-size: 12px; line-height: 1.45; }
.handoff-chain span { color: var(--muted); }
.handoff-chain code { color: var(--blue); overflow-wrap: anywhere; }
.handoff-chain > i { color: var(--blue); font-style: normal; font-weight: 800; }
#report-status { min-height: 44px; margin: 8px 0 0; padding: 10px 0; color: var(--muted); font-size: 12px; }
#report-status.pass { border-left: 3px solid var(--ok); background: #eaf8f3; padding: 10px; color: #28644f; }
#report-status.fail { border-left: 3px solid var(--bad); background: #fff0f1; padding: 10px; color: #8e3531; }
.report-handoff details { border-top: 1px solid var(--line); }
details summary { display: flex; align-items: center; gap: 8px; min-height: 44px; color: #31577f; font-size: 12px; font-weight: 700; cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "+"; display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid #a9bfd8; border-radius: 50%; color: var(--blue); }
details[open] summary::before { content: "−"; }
.report-memory { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding-bottom: 12px; }
.report-memory article { border-left: 3px solid var(--blue); background: var(--soft); padding: 12px; }
.report-memory b, .report-memory p { font-size: 12px; }
.report-memory p { margin: 6px 0 0; color: var(--muted); }
.repair-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--blue); font-size: 12px; font-weight: 700; text-decoration: none; }

.rehearsal { display: none; grid-template-columns: 260px 1fr; margin-top: 14px; overflow: hidden; }
.report-ready .hero, .report-ready .story, .report-ready .report-handoff { display: none; }
.report-ready .rehearsal { display: grid; }
.rail { background: var(--navy); padding: 24px; color: #fff; }
.rail small { color: #7fd6de; }
.rail h2 { color: #fff; }
.rail header strong { display: block; margin: 7px 0 16px; color: #b9cae0; font-size: 12px; }
.rail nav { display: grid; gap: 5px; }
.rail nav button { min-height: 48px; border: 1px solid #3a5a7d; border-radius: 6px; background: transparent; padding: 8px 10px; color: #bfd0e4; text-align: left; font-size: 12px; font-weight: 700; cursor: pointer; }
.rail nav button.active { border-color: #68b2ff; background: #173b65; color: #fff; }
.rail nav button.done { border-color: #2f9f7b; color: #83e0bc; }
.rail nav button:disabled { cursor: not-allowed; opacity: .4; }
.rail nav button b { display: inline-block; width: 27px; color: #7fd6de; }
.rail > button { width: 100%; margin-top: 10px; }
.rail > #change-report { border-color: #7090b3; background: #14385d; }
.rail button:disabled, .stage button:disabled, .defense button:disabled { cursor: not-allowed; opacity: .4; }
.rail p { color: #b9cae0; font-size: 12px; }
.workbench { min-width: 0; }
.stage { padding: 24px; background: #f8fbff; }
.stage > header { display: flex; justify-content: space-between; gap: 20px; }
.stage > header p { margin: 6px 0 14px; color: var(--muted); }
.stage > header span { white-space: nowrap; color: var(--blue); font-size: 12px; font-weight: 800; }
.report-cue { margin-bottom: 14px; border-left: 4px solid var(--blue); background: #edf4ff; padding: 12px 14px; }
.report-cue b, .report-cue p { font-size: 12px; }
.report-cue p { margin: 5px 0 0; color: var(--muted); }
.prediction, .defense fieldset { margin: 0; border: 1px solid var(--line); border-radius: 7px; background: #fff; padding: 12px; }
.prediction legend, .defense legend { padding: 0 5px; font-size: 12px; font-weight: 800; }
#prediction-options { display: grid; }
.prediction label, .defense fieldset label { display: flex; align-items: center; gap: 9px; min-height: 44px; border-top: 1px solid #e5edf6; padding: 8px 3px; color: var(--muted); font-size: 12px; cursor: pointer; }
.prediction label:first-child, .defense fieldset label:first-of-type { border-top: 0; }
.prediction label:has(input:checked), .defense fieldset label:has(input:checked) { color: var(--ink); font-weight: 700; }
.prediction input, .defense fieldset input { flex: 0 0 auto; width: 17px; height: 17px; margin: 0; accent-color: var(--blue); }
#lock-prediction { width: 100%; min-height: 44px; margin-top: 8px; border: 1px solid var(--blue); border-radius: 6px; background: #fff; color: var(--blue); font-size: 12px; font-weight: 800; cursor: pointer; }
.observe-step { display: none; }
.prediction-locked .prediction { display: none; }
.prediction-locked .observe-step { display: block; }
.visual { display: flex; align-items: center; justify-content: center; min-height: 275px; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: #fff; padding: 20px; }
.flow { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(78px, 1fr) 22px) minmax(78px, 1fr); align-items: center; gap: 5px; }
.node { min-height: 88px; border: 1px solid #c7d7e8; border-top: 4px solid var(--blue); background: #fff; padding: 13px 8px; text-align: center; }
.node b, .node span { display: block; font-size: 12px; }
.node span { margin-top: 6px; color: var(--muted); }
.node.stop { border-top-color: var(--bad); background: #fff1f2; }
.arrow { color: #6a8aaa; text-align: center; font-weight: 800; }
.trace { width: 100%; display: grid; gap: 5px; }
.trace div { display: grid; grid-template-columns: 72px 1fr auto; align-items: center; border-bottom: 1px solid var(--line); padding: 9px; }
.trace time, .trace span, .trace b { font-size: 12px; }
.trace time { color: var(--blue); font-family: Consolas, monospace; font-weight: 700; }
.trace b { color: var(--ok); }
.trace .bad b { color: var(--bad); }
.curve { width: 100%; height: 230px; }
.curve polyline { fill: none; stroke-width: 3; }
.curve text { fill: #60748e; font: 12px "Microsoft YaHei UI"; }
.cue { margin: 12px 0; border-left: 4px solid var(--cyan); background: #eaf7f8; padding: 12px 14px; }
.cue strong, .cue p { font-size: 12px; }
.cue p { margin: 5px 0 0; color: #49677d; }
.stage > .observe-step > button { width: 100%; }

.defense { display: none; padding: 24px; border-top: 1px solid var(--line); background: #fff; }
.scene-ready .stage { display: block; padding-bottom: 0; }
.scene-ready .stage > header, .scene-ready .stage > .report-cue, .scene-ready .stage > .prediction, .scene-ready .stage .cue, .scene-ready .stage .observe-step > button { display: none; }
.scene-ready .defense { display: grid; gap: 12px; }
.defense > label { display: block; border: 1px solid var(--line); border-radius: 7px; background: #fff; padding: 13px; }
.defense > label span b, .defense > label span small { display: block; }
.defense > label span small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.defense textarea { width: 100%; min-height: 110px; margin-top: 9px; border: 1px solid #afc4dc; border-radius: 6px; padding: 10px; font-size: 14px; line-height: 1.6; resize: vertical; }
.defense output { display: block; color: var(--muted); text-align: right; font-size: 12px; }
.defense > button { width: 100%; }
.defense > p { min-height: 44px; margin: 0; padding: 10px 0; color: var(--muted); font-size: 12px; }
.defense > p.pass { border-left: 3px solid var(--ok); background: #eaf8f3; padding: 10px; color: #28644f; }
.defense > p.fail { border-left: 3px solid var(--bad); background: #fff0f1; padding: 10px; color: #8e3531; }

.summary { display: none; margin-top: 14px; padding: 24px; }
.rehearsal-complete .hero, .rehearsal-complete .story, .rehearsal-complete .report-handoff, .rehearsal-complete .rehearsal { display: none; }
.rehearsal-complete .summary { display: block; }
.summary > header { display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.summary > header strong { color: var(--blue); }
.summary ol { margin: 20px 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.summary li { display: grid; grid-template-columns: 72px 190px 1fr; gap: 16px; border-bottom: 1px solid var(--line); padding: 13px 0; font-size: 12px; }
.summary li time { color: var(--blue); font-weight: 800; }
.summary li span { color: var(--muted); overflow-wrap: anywhere; }
.summary li span em, .summary li span code { display: block; margin-top: 5px; font-size: 12px; font-style: normal; }
.summary li span code { color: #7890aa; }
.summary aside { display: grid; grid-template-columns: auto repeat(4, 1fr); gap: 12px; background: var(--navy); padding: 18px; color: #fff; }
.summary aside span { border-left: 1px solid #3d5877; padding-left: 12px; color: #c4d3e5; font-size: 12px; }
.summary footer { display: flex; align-items: center; gap: 12px; margin-top: 15px; }
.summary footer p { margin-right: auto; color: var(--muted); font-size: 12px; }
.summary footer a { display: flex; align-items: center; min-height: 44px; color: var(--blue); font-size: 12px; font-weight: 800; text-decoration: none; }

.optional-zone { margin-top: 14px; padding: 0 24px; }
.optional-zone p { max-width: 1000px; margin: 0 0 18px; color: var(--muted); }
.report-ready .optional-zone, .rehearsal-complete .optional-zone { display: none; }
.boundary { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 14px; background: var(--navy); padding: 20px 24px; color: #fff; }
.boundary div { display: grid; gap: 4px; }
.boundary span { color: #b9cae0; }
.boundary b { color: #9fc7ff; font-size: 12px; text-align: right; }

.project-compass *, body .project-transfer * { font-size: 12.5px !important; }
.project-compass a, body .project-transfer button, body .project-transfer label { min-height: 44px; }
button:focus-visible, a:focus-visible, summary:focus-visible, label:focus-within, textarea:focus-visible, input:focus-visible { outline: 3px solid rgba(8, 101, 237, .25); outline-offset: 2px; }

@media (max-width: 1000px) {
  .topbar { grid-template-columns: 1fr auto; }
  .topbar nav { display: none; }
  .story ol { grid-template-columns: repeat(4, 1fr); }
  .story li { border: 1px solid var(--line); }
  .story li:first-child, .story li:last-child { border-radius: 0; }
  .story li::after { display: none; }
}

@media (max-width: 700px) {
  main { padding: 12px; }
  .topbar { min-height: 60px; padding: 0 14px; }
  .safe span { display: none; }
  .hero { grid-template-columns: 1fr; }
  .hero > div, .hero aside, .story, .report-handoff, .stage, .defense, .summary, .boundary { padding: 17px; }
  .hero h1 { font-size: 27px; }
  .hero aside { min-height: 112px; }
  .story > header { display: block; }
  .story > header > strong { display: block; margin-top: 6px; }
  .story ol { grid-template-columns: repeat(2, 1fr); }
  .report-handoff > header { grid-template-columns: 1fr; }
  .handoff-chain { grid-template-columns: 1fr; }
  .handoff-chain > i { transform: rotate(90deg); text-align: center; }
  .report-memory { grid-template-columns: 1fr; }
  .report-ready .rehearsal { display: block; }
  .rail nav { grid-template-columns: 1fr 1fr; }
  .flow { grid-template-columns: 1fr; }
  .arrow { transform: rotate(90deg); }
  .trace div { grid-template-columns: 62px 1fr; }
  .trace b { grid-column: 2; }
  .summary > header { display: block; }
  .summary li { grid-template-columns: 55px 1fr; }
  .summary li span { grid-column: 1/-1; }
  .summary aside { grid-template-columns: 1fr; }
  .summary aside span { border-top: 1px solid #3d5877; border-left: 0; padding: 8px 0 0; }
  .summary footer, .boundary { align-items: stretch; flex-direction: column; }
  .boundary b { text-align: left; }
  .optional-zone { padding: 0 17px; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
