:root {
  --e-bg: #fbfaff;
  --e-white: #fff;
  --e-purple: #5148e6;
  --e-purple-2: #5c55e7;
  --e-purple-pale: #d6d4ff;
  --e-purple-wash: rgba(81, 72, 230, 0.06);
  --e-ink: #201b4f;
  --e-muted-ink: #57517f;
  --e-border: 1px solid var(--e-purple);
  --e-border-muted: 1px solid rgba(81, 72, 230, 0.68);
  --e-rule: 1px solid rgba(81, 72, 230, 0.22);
  --e-content: 940px;
  --e-measure: 640px;
  --e-mono: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --e-serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, "Times New Roman", serif;
  --e-dead: #8a86a8;
}

* { box-sizing: border-box; }
html { background: var(--e-bg); color: var(--e-ink); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--e-serif);
  font-size: 19px;
  line-height: 1.5;
  padding-inline: 16px;
  padding-block: 0 80px;
}
a { color: inherit; }
::selection { background: var(--e-purple-pale); }

.wrap { max-width: var(--e-content); margin: 0 auto; }

/* nav */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 26px 0 22px;
  font-family: var(--e-mono); font-size: 14px;
}
.wordmark { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--e-purple); font-weight: 600; font-size: 20px; letter-spacing: -0.02em; }
.wordmark svg { width: 26px; height: 26px; display: block; }
.nav-links { display: flex; gap: 22px; }
.nav-links a { color: var(--e-purple); text-decoration: none; }
.nav-links a:hover { text-decoration: underline; }

/* panels */
.panel { border: var(--e-border-muted); background: var(--e-white); padding: 40px; }
.panel + .panel { border-top: 0; }
.panel.tight { padding: 22px 40px; }
.panel.flush { padding: 0; }
.panel.purple { background: var(--e-purple); color: var(--e-white); border-color: var(--e-purple); }
.panel.wash { background: var(--e-bg); }
.split { display: grid; grid-template-columns: 1fr 1fr; }
.split > div { padding: 32px 40px; }
.split > div + div { border-left: var(--e-border-muted); }
.split.inset { margin: -40px; }
@media (max-width: 720px) {
  .panel, .panel.tight { padding: 24px 20px; }
  .split { grid-template-columns: 1fr; }
  .split.inset { margin: -24px -20px; }
  .split > div { padding: 24px 20px; }
  .split > div + div { border-left: 0; border-top: var(--e-border-muted); }
  .nav { flex-direction: column; align-items: flex-start; gap: 10px; padding: 18px 0 16px; }
  .nav-links { gap: 16px; font-size: 13px; }
  body { font-size: 18px; }
  table.t { min-width: 560px; font-size: 15px; }
  table.t th, table.t td { padding-right: 12px; }
  .tscroll { margin: 0 -20px; padding: 0 20px; }
  .detail { font-size: 15px; }
}

/* type */
h1 { font-family: var(--e-serif); font-weight: 500; font-size: clamp(38px, 6vw, 58px); line-height: 1.05; margin: 0 0 22px; letter-spacing: -0.01em; }
h1 .accent { color: var(--e-purple); }
h2 { font-family: var(--e-serif); font-weight: 500; font-size: clamp(26px, 3.6vw, 34px); line-height: 1.15; margin: 0 0 14px; }
h3 { font-family: var(--e-serif); font-weight: 600; font-size: 22px; line-height: 1.2; margin: 0 0 10px; }
p { margin: 0 0 1em; max-width: var(--e-measure); }
p.lede { font-size: 22px; line-height: 1.45; }
.mono { font-family: var(--e-mono); }
.label { font-family: var(--e-mono); font-size: 13px; color: var(--e-purple); font-weight: 600; letter-spacing: 0.01em; text-transform: none; }
.meta { font-family: var(--e-mono); font-size: 12px; color: var(--e-muted-ink); }
.caption { font-family: var(--e-mono); font-size: 13px; color: var(--e-muted-ink); }
.rule { border: 0; border-top: var(--e-rule); margin: 22px 0; }
hr.strong { border: 0; border-top: var(--e-border-muted); margin: 0; }
.muted { color: var(--e-muted-ink); }
small { font-family: var(--e-mono); font-size: 12px; }

/* buttons */
.btn {
  font-family: var(--e-mono); font-size: 15px; font-weight: 600;
  background: var(--e-purple); color: var(--e-white);
  border: 1px solid var(--e-purple); border-radius: 0;
  padding: 14px 22px; cursor: pointer; text-decoration: none; display: inline-block;
  box-shadow: 4px 4px 0 var(--e-ink);
  transition: transform 80ms ease, box-shadow 80ms ease;
}
.btn:hover { background: var(--e-purple-2); }
.btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--e-ink); }
.btn[disabled] { opacity: 0.55; cursor: default; box-shadow: none; transform: none; }
.btn.ghost { background: var(--e-white); color: var(--e-purple); box-shadow: none; }
.btn.ghost:hover { background: var(--e-purple-wash); }
.btn.small { padding: 9px 14px; font-size: 13px; box-shadow: 3px 3px 0 var(--e-ink); }

/* tabs */
.tabs { display: flex; gap: 0; border-bottom: var(--e-border-muted); margin: 0 -40px 26px; padding: 0 40px; }
@media (max-width: 720px) { .tabs { margin: 0 -20px 20px; padding: 0 20px; } }
.tab { font-family: var(--e-mono); font-size: 14px; color: var(--e-purple); background: none; border: 0; padding: 12px 18px 12px 0; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab[aria-selected="true"] { border-bottom-color: var(--e-purple); font-weight: 700; }

/* inputs */
textarea, input[type="url"] {
  width: 100%; font-family: var(--e-serif); font-size: 18px; line-height: 1.5;
  color: var(--e-ink); background: var(--e-bg);
  border: var(--e-border-muted); border-radius: 0; padding: 16px 18px;
}
textarea { min-height: 260px; resize: vertical; }
textarea:focus, input:focus { outline: 2px solid var(--e-purple); outline-offset: -1px; background: var(--e-white); }
::placeholder { color: var(--e-muted-ink); opacity: 0.8; }
.input-row { display: flex; gap: 12px; align-items: stretch; }
.input-row input { flex: 1; }
@media (max-width: 720px) { .input-row { flex-direction: column; } }
.actions { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.sample-links { font-family: var(--e-mono); font-size: 13px; color: var(--e-muted-ink); }
.sample-links a { color: var(--e-purple); }

/* results */
.headline { font-family: var(--e-serif); font-weight: 500; font-size: clamp(30px, 4.6vw, 46px); line-height: 1.1; margin: 0 0 12px; }
.headline .n { color: var(--e-purple); }
.statbar { display: flex; gap: 28px; flex-wrap: wrap; font-family: var(--e-mono); font-size: 13px; color: var(--e-muted-ink); }
.statbar b { color: var(--e-ink); font-weight: 600; }
.legend { display: flex; gap: 22px; flex-wrap: wrap; font-family: var(--e-mono); font-size: 12px; color: var(--e-muted-ink); margin-top: 10px; }
.legend span::before { content: ""; display: inline-block; width: 14px; height: 10px; margin-right: 7px; vertical-align: middle; }
.legend .l-clean::before { background: var(--e-purple-pale); border-bottom: 2px solid var(--e-purple); }
.legend .l-needs::before { border-bottom: 2px dashed var(--e-purple); }
.legend .l-dead::before { background: transparent; border-bottom: 2px solid var(--e-dead); opacity: .8; }

.doc { font-size: 19px; line-height: 1.65; max-width: 720px; }
.doc h2.dh, .doc h3.dh, .doc h4.dh { font-family: var(--e-serif); font-weight: 500; margin: 1.4em 0 0.5em; }
.doc h2.dh { font-size: 30px; } .doc h3.dh { font-size: 24px; } .doc h4.dh { font-size: 20px; }
.doc p.dp { margin: 0 0 1em; max-width: none; }
.doc li.dl { margin: 0 0 0.4em; }
.doc ul.dul { padding-left: 22px; margin: 0 0 1em; }
.doc blockquote.dq { margin: 0 0 1em; padding-left: 16px; border-left: 3px solid var(--e-purple-pale); }
.doc .dtr { font-family: var(--e-mono); font-size: 14px; padding: 6px 0; border-bottom: var(--e-rule); }
.s { cursor: pointer; border-radius: 0; padding: 1px 0; transition: background 100ms; }
.s.clean { background: var(--e-purple-pale); box-shadow: inset 0 -2px 0 var(--e-purple); }
.s.needs { box-shadow: inset 0 -2px 0 transparent; border-bottom: 2px dashed var(--e-purple); }
.s.dead { color: var(--e-dead); border-bottom: 2px solid rgba(138, 134, 168, 0.5); }
.s:hover, .s.active { outline: 2px solid var(--e-purple); outline-offset: 1px; }

/* detail card */
.detail { position: sticky; top: 16px; font-size: 16px; }
.detail .quote { font-family: var(--e-serif); font-size: 18px; line-height: 1.45; margin: 8px 0 14px; padding-left: 14px; border-left: 3px solid var(--e-purple); }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 8px 0; border-top: var(--e-rule); font-size: 15px; }
.checklist li:first-child { border-top: 0; }
.checklist .st { font-family: var(--e-mono); font-size: 13px; font-weight: 700; }
.st.pass { color: var(--e-purple); } .st.soft { color: var(--e-muted-ink); } .st.fail { color: var(--e-ink); } .st.info { color: var(--e-muted-ink); }
.checklist b { font-weight: 600; }
.checklist .d { color: var(--e-muted-ink); font-size: 14px; }
.fix { margin-top: 12px; padding: 12px 14px; background: var(--e-bg); border: var(--e-border-muted); font-size: 15px; }
.fix .label { display: block; margin-bottom: 4px; }
.verdict-pill { display: inline-block; font-family: var(--e-mono); font-size: 12px; font-weight: 700; padding: 3px 8px; border: 1px solid currentColor; }
.verdict-pill.clean { color: var(--e-purple); } .verdict-pill.needs { color: var(--e-ink); } .verdict-pill.dead { color: var(--e-dead); }
.results-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; }
.results-grid > div:first-child { padding: 32px 40px; }
.results-grid > div:last-child { border-left: var(--e-border-muted); padding: 24px; background: var(--e-bg); }
@media (max-width: 880px) {
  .results-grid { grid-template-columns: 1fr; }
  .results-grid > div:last-child { border-left: 0; border-top: var(--e-border-muted); }
  .detail { position: static; }
  .results-grid > div:first-child { padding: 24px 20px; }
}

/* lists of sentences */
.slist { list-style: none; margin: 0; padding: 0; }
.slist li { padding: 14px 0; border-top: var(--e-rule); }
.slist li:first-child { border-top: 0; padding-top: 0; }
.slist .q { font-size: 18px; line-height: 1.45; margin: 0 0 6px; cursor: pointer; }
.slist .why { font-family: var(--e-mono); font-size: 12.5px; color: var(--e-muted-ink); line-height: 1.5; }
.slist .why b { color: var(--e-purple); font-weight: 600; }

/* tables */
table.t { width: 100%; border-collapse: collapse; font-size: 16px; }
table.t th { font-family: var(--e-mono); font-size: 13px; font-weight: 700; color: var(--e-purple); text-align: left; padding: 10px 16px 10px 0; border-bottom: var(--e-border-muted); vertical-align: bottom; }
table.t td { padding: 12px 16px 12px 0; border-bottom: var(--e-rule); vertical-align: top; }
table.t td.st { font-family: var(--e-mono); font-size: 13px; font-weight: 700; white-space: nowrap; }
table.t td .d { color: var(--e-muted-ink); font-size: 14.5px; display: block; margin-top: 2px; }
.tscroll { overflow-x: auto; }

/* AI section */
.ai-note { font-family: var(--e-mono); font-size: 12.5px; color: var(--e-muted-ink); max-width: 560px; line-height: 1.55; }
.panel.purple .ai-note, .panel.purple .meta, .panel.purple .caption { color: rgba(255,255,255,0.78); }
.panel.purple .btn { background: var(--e-white); color: var(--e-purple); box-shadow: 4px 4px 0 var(--e-ink); border-color: var(--e-white); }
.panel.purple .btn:hover { background: #f1f0ff; }
.panel.purple h2 { color: var(--e-white); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -2px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.blind .subj { font-family: var(--e-mono); font-size: 13px; }
.blind .rw { font-size: 16px; }
.blind td.yes { color: var(--e-purple); } .blind td.partly { color: var(--e-ink); } .blind td.no { color: var(--e-dead); }
.err { font-family: var(--e-mono); font-size: 13px; color: #a3213c; margin-top: 12px; }

/* share */
.share canvas { width: 100%; max-width: 600px; height: auto; border: var(--e-border-muted); display: block; margin-bottom: 16px; }

/* work log while the model reads */
.worklog { list-style: none; margin: 0; padding: 0; max-width: 720px; }
.worklog li { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: baseline; padding: 10px 0; border-top: var(--e-rule); font-family: var(--e-mono); font-size: 13.5px; color: var(--e-muted-ink); }
.worklog li:first-child { border-top: 0; padding-top: 0; }
.worklog li .g { color: var(--e-purple-pale); font-weight: 700; }
.worklog li.done { color: var(--e-ink); }
.worklog li.done .g { color: var(--e-purple); }
.worklog li.active { color: var(--e-ink); }
.worklog li.active .g::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--e-purple); animation: blink 1.2s ease-in-out infinite; }
.worklog li .d { color: var(--e-purple); font-variant-numeric: tabular-nums; }
.worklog li .d:empty { display: none; }
.reveal > section, .reveal > details { animation: arrive 420ms ease-out both; }
@media (prefers-reduced-motion: reduce) { .worklog li.active .g::before { animation: none; } .reveal > section, .reveal > details { animation: none; } }

/* result cards */
.cards { list-style: none; margin: 0; padding: 0; counter-reset: card; }
.cards li { padding: 18px 0 18px 44px; border-top: var(--e-rule); position: relative; }
.cards li:first-child { border-top: 0; padding-top: 0; }
.cards li::before { counter-increment: card; content: counter(card, decimal-leading-zero); position: absolute; left: 0; top: 20px; font-family: var(--e-mono); font-size: 12px; color: var(--e-purple); font-weight: 700; }
.cards li:first-child::before { top: 2px; }
.cards li.empty { padding-left: 0; }
.cards li.empty::before { content: none; }
.cards .q { font-size: 20px; line-height: 1.45; margin: 0 0 8px; max-width: 760px; }
.cards .q.was { color: var(--e-muted-ink); }
.cards .why { font-family: var(--e-mono); font-size: 12.5px; color: var(--e-muted-ink); line-height: 1.6; margin: 0; }
.cards .why b { color: var(--e-purple); font-weight: 600; }
.cards .why .dot { margin: 0 6px; }
.tag { display: inline-block; font-family: var(--e-mono); font-size: 11px; font-weight: 700; padding: 2px 7px; border: 1px solid var(--e-purple-pale); color: var(--e-muted-ink); margin-left: 6px; vertical-align: 1px; }
.tag.ok { color: var(--e-purple); border-color: var(--e-purple); }
.tag.warn { color: var(--e-ink); border-color: var(--e-ink); }
.rewrite { margin-top: 12px; padding: 14px 16px; background: var(--e-bg); border: var(--e-border-muted); display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; align-items: start; max-width: 760px; }
.rewrite .label { grid-column: 1 / -1; }
.rewrite p { margin: 0; font-size: 18px; line-height: 1.45; }
.rewrite .btn { grid-column: 2; grid-row: 2; align-self: start; }
@media (max-width: 720px) { .rewrite { grid-template-columns: 1fr; } .rewrite .btn { grid-column: 1; grid-row: auto; justify-self: start; } .cards li { padding-left: 34px; } }
.owns { list-style: none; margin: 0; padding: 0; }
.owns li { font-size: 19px; padding: 10px 0 10px 26px; border-top: var(--e-rule); position: relative; }
.owns li:first-child { border-top: 0; padding-top: 0; }
.owns li::before { content: "?"; position: absolute; left: 0; top: 12px; font-family: var(--e-mono); font-weight: 700; color: var(--e-purple); }
.owns li:first-child::before { top: 2px; }

/* details */
details.panel { padding: 0; }
details.panel summary { list-style: none; cursor: pointer; padding: 22px 40px; display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
details.panel summary::-webkit-details-marker { display: none; }
details.panel summary::before { content: "+"; font-family: var(--e-mono); color: var(--e-purple); font-weight: 700; }
details.panel[open] summary::before { content: "–"; }
details.panel .details-body { padding: 0 40px 40px; border-top: var(--e-rule); }
details.panel .details-body > .caption { padding-top: 22px; }
.results-grid.inner { margin-top: 18px; border: var(--e-border-muted); }
@media (max-width: 720px) { details.panel summary { padding: 18px 20px; } details.panel .details-body { padding: 0 20px 24px; } }

/* the stage: the only thing on screen while the model reads */
.stage { min-height: min(78vh, 720px); display: flex; flex-direction: column; justify-content: center; }
.stage-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 28px; }
.stage-clock, #stage-clock { font-variant-numeric: tabular-nums; }
.stage-line { font-family: var(--e-serif); font-weight: 500; font-size: clamp(30px, 4.8vw, 48px); line-height: 1.1; margin: 0 0 12px; max-width: 820px; min-height: 1.1em; }
.stage-line .n { color: var(--e-purple); font-variant-numeric: tabular-nums; }
.stage-line.swap { animation: lineswap 360ms ease-out both; }
@keyframes lineswap { from { opacity: .35; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.stage-sub { font-family: var(--e-mono); font-size: 13px; color: var(--e-muted-ink); margin: 0 0 30px; min-height: 1.6em; }
.stage-sub .n { color: var(--e-purple); font-weight: 600; font-variant-numeric: tabular-nums; }
.stage-track { height: 3px; background: var(--e-purple-pale); position: relative; overflow: hidden; margin-bottom: 36px; }
.stage-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 2%; background: var(--e-purple); transition: width 900ms cubic-bezier(.2,.7,.3,1); }
.stage-fill::after { content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 60px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { transform: translateX(-60px); } to { transform: translateX(60px); } }
.stage-feed { border-top: var(--e-rule); padding-top: 22px; }
.feed-sentence { font-family: var(--e-serif); font-size: 21px; line-height: 1.45; margin: 10px 0 8px; max-width: 760px; min-height: 2.9em; color: var(--e-ink); }
.feed-sentence.tick { animation: feedin 420ms ease-out both; }
@keyframes feedin { from { opacity: .35; transform: translateX(6px); } to { opacity: 1; transform: none; } }
.feed-sentence .ok { box-shadow: inset 0 -2px 0 var(--e-purple); background: var(--e-purple-pale); }
.feed-sentence .no { color: var(--e-dead); }
@media (prefers-reduced-motion: reduce) { .stage-fill::after, .stage-line.swap, .feed-sentence.tick { animation: none; } }
@media (max-width: 720px) { .stage { min-height: 70vh; } .feed-sentence { font-size: 18px; } }

/* stream bar along the bottom (unused now, kept for reference) */
#streambar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: 34px; background: var(--e-white); border-top: var(--e-border-muted); padding-bottom: env(safe-area-inset-bottom, 0px); }
#streambar .track { position: absolute; left: 0; right: 0; top: -1px; height: 3px; background: var(--e-purple-pale); overflow: hidden; }
#streambar .fill { position: absolute; top: 0; bottom: 0; left: 0; width: 28%; background: var(--e-purple); }
#streambar.live .fill { animation: slide 1.6s cubic-bezier(.4,.1,.4,1) infinite; }
#streambar.done .fill { width: 100%; animation: none; transition: width 300ms ease; }
@keyframes slide { 0% { left: -30%; } 100% { left: 100%; } }
#streambar .lbl { position: absolute; right: 16px; top: 9px; font-family: var(--e-mono); font-size: 12px; color: var(--e-muted-ink); }
#streambar.live .lbl::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--e-purple); margin-right: 8px; vertical-align: 0; animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }
#streambar.done .lbl { color: var(--e-purple); }

/* cards arriving */
.cards li.in, .owns li.in { animation: arrive 320ms ease-out both; }
@keyframes arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cards li.in, .owns li.in, #streambar.live .fill, #streambar.live .lbl::before { animation: none; } }

/* footer */
.foot { font-family: var(--e-mono); font-size: 12.5px; color: var(--e-muted-ink); line-height: 1.7; padding: 26px 0 0; }
.foot a { color: var(--e-purple); }

/* methodology page */
.rules h3 { margin-top: 30px; }
.rules .src { font-family: var(--e-mono); font-size: 12.5px; color: var(--e-muted-ink); }
.rules .src a { color: var(--e-purple); }
.rules table.t td:first-child { font-family: var(--e-mono); font-size: 13px; white-space: nowrap; }

.hidden { display: none !important; }
.sr { position: absolute; left: -9999px; }
