:root {
  --ink: #171914;
  --paper: #f3f0e7;
  --paper-deep: #e7e1d3;
  --blue: #2449d8;
  --blue-dark: #17309a;
  --red: #d94b3e;
  --green: #217a55;
  --amber: #a86915;
  --line: rgba(23, 25, 20, 0.16);
  --muted: #686b62;
  --shadow: 0 18px 60px rgba(35, 34, 28, 0.11);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(36, 73, 216, 0.045) 1px, transparent 1px),
    var(--paper);
  background-size: 100% 32px;
  font-family: "Manrope", system-ui, sans-serif;
}

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: .7rem 1rem;
  color: white;
  background: var(--blue);
}
.skip-link:focus { top: 1rem; }

.topbar {
  min-height: 70px;
  padding: 0 clamp(1rem, 4vw, 4rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(243, 240, 231, .9);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  color: white;
  background: var(--blue);
  font: 500 .68rem "DM Mono", monospace;
  letter-spacing: .08em;
}

.runtime {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--muted);
  font: 500 .72rem "DM Mono", monospace;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.pulse { width: .55rem; height: .55rem; border-radius: 50%; background: var(--amber); }
.runtime.ready .pulse { background: var(--green); box-shadow: 0 0 0 4px rgba(33,122,85,.12); }
.runtime.error .pulse { background: var(--red); }

main { width: min(1480px, 100%); margin: 0 auto; padding: clamp(2.5rem, 7vw, 7rem) clamp(1rem, 4vw, 4rem) 5rem; }

.hero { max-width: 970px; margin-bottom: clamp(3rem, 6vw, 6rem); }
.eyebrow, .kicker { margin: 0 0 1rem; color: var(--blue); font: 500 .72rem "DM Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 1.4rem; font: 600 clamp(3.1rem, 7vw, 7.2rem)/.91 "Newsreader", serif; letter-spacing: -.045em; max-width: 950px; }
.intro { max-width: 760px; color: #4e5049; font-size: clamp(1rem, 1.7vw, 1.22rem); line-height: 1.7; }

.method { display: flex; align-items: center; gap: .9rem; margin-top: 2.2rem; color: var(--muted); font: 500 .7rem "DM Mono", monospace; text-transform: uppercase; letter-spacing: .08em; }
.method span { display: flex; gap: .45rem; align-items: center; white-space: nowrap; }
.method b { color: var(--blue); font-weight: 500; }
.method i { width: 2.5rem; height: 1px; background: var(--line); }

.workspace-grid { display: grid; grid-template-columns: minmax(320px, .78fr) minmax(0, 1.22fr); gap: clamp(1rem, 2.5vw, 2.5rem); align-items: start; }
.brief-panel, .result-panel { border: 1px solid var(--line); background: rgba(249, 247, 241, .9); box-shadow: var(--shadow); }
.brief-panel { padding: clamp(1.25rem, 3vw, 2.3rem); position: sticky; top: 1.5rem; }
.result-panel { min-height: 680px; padding: clamp(1.25rem, 3.5vw, 3rem); }

.panel-heading, .result-header, .section-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.panel-heading { margin-bottom: 2rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--line); }
.panel-heading h2, .result-header h2 { margin: 0; font: 600 clamp(1.8rem, 3vw, 2.7rem)/1.05 "Newsreader", serif; }
.kicker { margin-bottom: .45rem; }

.text-button { border: 0; padding: .2rem 0; color: var(--blue); background: transparent; font-weight: 700; border-bottom: 1px solid currentColor; }
label { display: grid; gap: .55rem; margin-bottom: 1.15rem; font-size: .77rem; font-weight: 700; letter-spacing: .025em; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 0; padding: .85rem .9rem; color: var(--ink); background: #fffdf8; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(36,73,216,.11); }
textarea { min-height: 190px; line-height: 1.55; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.field-note { justify-self: end; color: var(--muted); font: 400 .67rem "DM Mono", monospace; }
.form-error { margin: 0 0 1rem; padding: .8rem; color: #811c15; background: #fbe2de; border-left: 3px solid var(--red); font-size: .82rem; line-height: 1.5; }

.primary-button { width: 100%; min-height: 3.3rem; border: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 1.1rem; color: white; background: var(--blue); font-weight: 700; }
.primary-button:hover { background: var(--blue-dark); }
.primary-button:disabled { cursor: wait; opacity: .65; }
.primary-button svg { width: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; }
.privacy-note { margin: .8rem 0 0; color: var(--muted); font-size: .68rem; line-height: 1.5; }

.empty-state, .loading-state { min-height: 610px; display: flex; flex-direction: column; justify-content: center; max-width: 560px; }
.empty-state h2, .loading-state h2 { font: 600 clamp(2.2rem, 5vw, 4.2rem)/.98 "Newsreader", serif; margin-bottom: 1rem; }
.empty-state > p:last-child { color: var(--muted); line-height: 1.7; max-width: 470px; }
.empty-glyph { display: flex; align-items: flex-end; gap: 8px; width: 100px; height: 90px; margin-bottom: 2rem; border-bottom: 1px solid var(--line); }
.empty-glyph span { width: 22px; background: var(--blue); }
.empty-glyph span:nth-child(1) { height: 34%; opacity: .35; }
.empty-glyph span:nth-child(2) { height: 66%; opacity: .65; }
.empty-glyph span:nth-child(3) { height: 100%; }

.progress-list { list-style: none; padding: 0; margin: 2rem 0 0; counter-reset: progress; }
.progress-list li { counter-increment: progress; padding: .9rem 0; color: var(--muted); border-bottom: 1px solid var(--line); font: 500 .76rem "DM Mono", monospace; text-transform: uppercase; letter-spacing: .06em; }
.progress-list li::before { content: "0" counter(progress); display: inline-block; width: 2.5rem; color: var(--muted); }
.progress-list li.active { color: var(--blue); }
.progress-list li.complete { color: var(--green); }
.progress-list li.complete::before { content: "✓"; color: var(--green); }

.result-header { padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.audit-badge { flex: 0 0 auto; padding: .45rem .7rem; color: var(--green); border: 1px solid currentColor; font: 500 .67rem "DM Mono", monospace; text-transform: uppercase; }
.audit-badge.fail { color: var(--amber); }
.result-summary { padding: 2rem 0; font: 500 clamp(1.15rem, 2vw, 1.5rem)/1.55 "Newsreader", serif; border-bottom: 1px solid var(--line); }
.section-heading { align-items: baseline; margin: 2.2rem 0 1rem; }
.section-heading h3, .result-columns h3 { margin: 0; font-size: .75rem; text-transform: uppercase; letter-spacing: .09em; }
.section-heading span { color: var(--muted); font: 400 .7rem "DM Mono", monospace; }

.claims { display: grid; gap: .75rem; }
.claim { border: 1px solid var(--line); background: #fffdf8; }
.script-line { border-top: 3px solid var(--ink); padding-top: 1rem; margin-bottom: 1.5rem; min-width: 0; }
.script-line h4 { margin: 0 0 .7rem; font: 500 .8rem "DM Mono", monospace; text-transform: uppercase; }
.original-line { margin: 0 0 1rem; padding: 1rem; background: var(--paper-deep); font: 500 1.35rem/1.5 "Newsreader", serif; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-note { font-size: .78rem; line-height: 1.6; color: var(--muted); }
.proposed-wording { margin: 1rem 0 0; padding: .8rem; border-left: 3px solid var(--blue); font-size: .85rem; line-height: 1.6; }
.citation-warning { margin: .7rem 0 0; color: #8c3025; font-size: .75rem; line-height: 1.5; }
.claim, .source, .run-metadata { overflow-wrap: anywhere; }
.result-header { flex-wrap: wrap; }
.export-actions { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; margin-top: 1rem; font-size: .78rem; }
.checkbox-label { display: flex; align-items: flex-start; margin: 1.1rem 0 .3rem; line-height: 1.5; }
.checkbox-label input { width: auto; flex: 0 0 auto; margin-top: .15rem; }
#follow-up-changes { padding-left: 1.2rem; font-size: .8rem; line-height: 1.7; }
#follow-up-changes li { margin-bottom: .8rem; }
.claim-top { display: grid; grid-template-columns: 105px 1fr; gap: 1rem; padding: 1rem; }
.status { align-self: start; padding: .35rem .45rem; text-align: center; color: var(--green); border: 1px solid currentColor; font: 500 .64rem "DM Mono", monospace; text-transform: uppercase; }
.status.contested { color: var(--amber); }
.status.unverified { color: var(--red); }
.claim-text { margin: 0; font-weight: 650; line-height: 1.5; }
.claim-use { margin: .65rem 0 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.claim-evidence { padding: .85rem 1rem .9rem 116px; background: var(--paper); border-top: 1px solid var(--line); }
.claim-evidence p { margin: .35rem 0; color: #50534b; font-size: .75rem; line-height: 1.55; }
.claim-evidence a { color: var(--blue); font-family: "DM Mono", monospace; font-weight: 500; }
.source:target { outline: 2px solid var(--blue); outline-offset: 4px; }

.result-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; padding: 2.2rem 0; border-bottom: 1px solid var(--line); }
.result-columns ul { margin: 1rem 0 0; padding-left: 1.1rem; }
.result-columns li { margin-bottom: .65rem; color: #50534b; font-size: .8rem; line-height: 1.55; }

.sources { list-style: none; counter-reset: source; padding: 0; margin: 0; }
.source { counter-increment: source; display: grid; grid-template-columns: 42px 1fr auto; gap: .8rem; align-items: center; padding: .9rem 0; border-top: 1px solid var(--line); }
.source::before { content: "S" counter(source); color: var(--blue); font: 500 .68rem "DM Mono", monospace; }
.source a { font-weight: 650; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.source time { color: var(--muted); font: 400 .65rem "DM Mono", monospace; }
.run-metadata { margin-top: 2rem; padding: 1rem; color: var(--muted); background: var(--paper-deep); font: 400 .65rem/1.6 "DM Mono", monospace; }

.site-footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1.4rem clamp(1rem, 4vw, 4rem); color: var(--muted); border-top: 1px solid var(--line); font: 400 .64rem "DM Mono", monospace; }

@media (max-width: 900px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .brief-panel { position: static; }
  .method { overflow-x: auto; padding-bottom: .4rem; }
  .result-panel { min-height: 560px; }
}

@media (max-width: 560px) {
  .runtime { display: none; }
  .field-row, .result-columns { grid-template-columns: 1fr; gap: 0; }
  .claim-top { grid-template-columns: 1fr; }
  .status { justify-self: start; }
  .claim-evidence { padding-left: 1rem; }
  .source { grid-template-columns: 36px 1fr; }
  .source time { grid-column: 2; }
  .site-footer { flex-direction: column; }
}

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