:root {
  --ink: #111315;
  --paper: #eef1ee;
  --paper-bright: #f8faf7;
  --muted: #737b77;
  --line: #c8cfca;
  --agent: #b8f34a;
  --human: #ff6f61;
  --fallback: #3164f4;
  --warning: #b9382c;
  --header-h: 58px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: "Avenir Next", Avenir, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}
button, textarea, input { font: inherit; letter-spacing: 0; }
button, label, summary, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: var(--header-h);
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr);
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  background: rgba(238, 241, 238, 0.96);
  border-bottom: 1px solid var(--ink);
  backdrop-filter: blur(14px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.brand-mark { width: 18px; height: 18px; background: var(--ink); box-shadow: inset 6px 0 0 var(--agent); }
.runtime, .live-status {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  line-height: 1.3;
  white-space: nowrap;
}
.runtime { color: var(--muted); text-align: center; }
.live-status { justify-self: end; text-align: right; }
.live-status::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; background: var(--agent); border: 1px solid var(--ink); }
.live-status[data-level="error"]::before { background: var(--human); }

main { width: 100%; max-width: 100%; overflow-x: hidden; }
.audit-shell { padding: 28px 28px 34px; min-height: calc(100vh - var(--header-h)); }
.mast, .command-row, .editor-panel, .proof-field { width: min(1180px, 100%); margin-inline: auto; }
.mast { display: flex; justify-content: space-between; align-items: end; gap: 24px; }
.mast-copy { min-width: 0; }
.kicker { margin: 0 0 6px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; font-weight: 700; color: var(--muted); }
h1 {
  max-width: 1120px;
  margin: 0;
  font-size: 54px;
  line-height: 0.94;
  font-weight: 800;
}
.lede { max-width: 690px; margin: 10px 0 0; font-size: 16px; line-height: 1.35; }
.legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; padding-bottom: 4px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; white-space: nowrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 11px; height: 11px; border: 1px solid var(--ink); }
.swatch.human { background: var(--human); }
.swatch.agent { background: var(--agent); }
.swatch.fallback { background: var(--fallback); }

.command-row, .result-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.command-row { margin-top: 18px; }
.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 17px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}
.button:hover { transform: translateY(-2px); }
.button:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid var(--fallback); outline-offset: 2px; }
.button-strong { color: var(--paper-bright); background: var(--ink); }
.button-strong:hover { color: var(--ink); background: var(--agent); }
.button-light { color: var(--ink); background: var(--paper-bright); }
.button-quiet { color: var(--ink); background: transparent; border-color: var(--line); }
.file-button { cursor: pointer; }

.editor-panel { margin-top: 10px; padding: 14px; border: 1px solid var(--ink); background: var(--paper-bright); }
.editor-panel label { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 800; }
.editor-panel textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
}
.editor-panel p { margin: 8px 0 0; color: var(--muted); font-size: 11px; }

.proof-field { margin-top: 12px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); background: var(--paper-bright); }
.proof-topline { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.proof-product { margin: 0 0 2px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; font-weight: 800; color: var(--muted); }
.proof-topline h2 { margin: 0; font-size: 20px; line-height: 1.1; }
.proof-state { max-width: 560px; margin: 0; font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; text-align: right; color: var(--muted); }
.proof-state.error { color: var(--warning); font-weight: 800; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: dense;
  border-bottom: 1px solid var(--ink);
}
.metric-cell { min-width: 0; padding: 11px 13px 9px; border-right: 1px solid var(--line); }
.metric-cell:last-child { border-right: 0; }
.metric-cell span, .metric-cell small { display: block; }
.metric-cell span { font-size: 10px; font-weight: 800; text-transform: uppercase; }
.metric-cell strong { display: block; margin: 2px 0 1px; font-size: 27px; line-height: 1; }
.metric-cell small { min-height: 14px; overflow: hidden; color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; white-space: nowrap; text-overflow: ellipsis; }
.metric-accent { background: var(--agent); }
.metric-accent span, .metric-accent strong, .metric-accent small { color: var(--ink); }

.timeline-panel { position: relative; min-height: 214px; overflow: hidden; background: #e4e8e4; }
.timeline-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; color: var(--muted); font-size: 12px; text-align: center; }
.timeline-empty[hidden] { display: none !important; }
#timeline { width: 100%; height: 214px; display: block; }
#timeline text { fill: var(--ink); font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; }
#timeline .domain, #timeline .tick line { stroke: #9ba39e; }
#timeline .event-bar { stroke: var(--ink); stroke-width: 0.7; }
#timeline .lane-guide { stroke: #c3cac5; stroke-width: 1; }
.evidence-line, .interpretation { margin: 0; padding: 8px 14px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; line-height: 1.4; }
.evidence-line { border-top: 1px solid var(--line); font-weight: 700; }
.interpretation { color: var(--muted); border-top: 1px solid var(--line); }
.result-actions { min-height: 60px; padding: 8px 14px; border-top: 1px solid var(--ink); }
#export-status { margin-left: auto; color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; }

.method-section { width: min(1180px, calc(100% - 56px)); margin: 0 auto; padding: 150px 0 180px; display: grid; grid-template-columns: 0.72fr 1.28fr; gap: 76px; }
.method-head { align-self: start; }
.method-head h2 { max-width: 430px; margin: 0; font-size: 45px; line-height: 1; }
.method-head > p:last-child { max-width: 380px; font-size: 16px; line-height: 1.5; }
.method-stack { display: grid; gap: 90px; padding-top: 20px; }
.method-step { position: sticky; top: 92px; min-height: 250px; padding: 26px; border: 1px solid var(--ink); border-radius: 6px; background: var(--paper-bright); box-shadow: 0 12px 0 var(--ink); }
.method-step:nth-child(2) { background: #e5edff; }
.method-step:nth-child(3) { background: #f9d8d2; }
.method-step > span { font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; }
.method-step h3 { margin: 42px 0 10px; font-size: 29px; }
.method-step p { max-width: 560px; font-size: 16px; line-height: 1.5; }
.method-step code { display: block; margin-top: 24px; font-size: 11px; white-space: normal; }

.accordion-row { width: min(1180px, calc(100% - 56px)); margin: 0 auto 150px; display: flex; min-height: 220px; border: 1px solid var(--ink); }
.accordion-row details { flex: 1 1 0; min-width: 0; padding: 22px; border-right: 1px solid var(--ink); transition: flex 500ms ease, background 300ms ease; }
.accordion-row details:last-child { border-right: 0; }
.accordion-row details[open] { flex: 2 1 0; background: var(--agent); }
.accordion-row summary { cursor: pointer; font-size: 20px; font-weight: 800; }
.accordion-row p { max-width: 480px; line-height: 1.55; }

footer { min-height: 180px; display: grid; grid-template-columns: 1fr auto auto; align-items: end; gap: 30px; padding: 38px 28px; color: var(--paper-bright); background: var(--ink); }
footer span, footer a { color: #b9c0bc; font-size: 12px; }
footer a { color: var(--agent); }

@media (max-width: 720px) {
  :root { --header-h: 64px; }
  .site-header { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 34px 22px; gap: 0 10px; padding: 3px 14px 5px; }
  .brand { grid-column: 1; grid-row: 1; font-size: 10px; }
  .live-status { grid-column: 2; grid-row: 1; max-width: 145px; overflow: hidden; text-overflow: ellipsis; font-size: 9px; }
  .runtime { grid-column: 1 / -1; grid-row: 2; justify-self: start; text-align: left; font-size: 8px; }
  .audit-shell { padding: 17px 14px 24px; }
  .mast { display: block; }
  h1 { font-size: 38px; line-height: 0.98; }
  .lede { margin-top: 7px; font-size: 13px; }
  .legend { justify-content: flex-start; margin-top: 9px; padding: 0; }
  .command-row { margin-top: 11px; display: grid; grid-template-columns: 1fr 1fr; }
  .button { width: 100%; padding-inline: 10px; }
  .proof-field { margin-top: 10px; }
  .proof-topline { align-items: start; padding: 8px 10px; }
  .proof-topline h2 { font-size: 16px; }
  .proof-state { max-width: 155px; font-size: 8px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-cell { padding: 8px 9px 7px; border-bottom: 1px solid var(--line); }
  .metric-cell:nth-child(2) { border-right: 0; }
  .metric-cell:nth-child(n+3) { border-bottom: 0; }
  .metric-cell strong { font-size: 22px; }
  .metric-cell span { font-size: 8px; }
  .metric-cell small { font-size: 8px; }
  .timeline-panel, #timeline { min-height: 196px; height: 196px; }
  .evidence-line, .interpretation { padding: 6px 10px; font-size: 8px; }
  .result-actions { display: grid; grid-template-columns: 1fr 1fr; padding: 8px 10px; }
  #reset-button { grid-column: 1; }
  #export-status { grid-column: 1 / -1; margin: 0; }
  .method-section { width: calc(100% - 28px); padding: 110px 0 130px; display: block; }
  .method-head h2 { font-size: 36px; }
  .method-stack { margin-top: 60px; gap: 70px; }
  .method-step { top: 76px; min-height: 230px; }
  .accordion-row { width: calc(100% - 28px); margin-bottom: 100px; display: block; }
  .accordion-row details { border-right: 0; border-bottom: 1px solid var(--ink); }
  .accordion-row details:last-child { border-bottom: 0; }
  footer { min-height: 220px; grid-template-columns: 1fr; align-content: end; align-items: start; gap: 10px; padding: 28px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
