:root {
  color-scheme: dark;
  --ink: #f5f4ec;
  --muted: #aeb8bf;
  --paper: #0b1217;
  --panel: #111b22;
  --panel-strong: #17242d;
  --line: #30404a;
  --cyan: #6fe7dc;
  --cyan-dark: #053d3b;
  --amber: #ffc760;
  --red: #ff8c8c;
  --green: #87e8a5;
  --focus: #ffffff;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    linear-gradient(rgba(111, 231, 220, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(111, 231, 220, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
}

a { color: var(--cyan); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 0.14em; }

button, textarea { font: inherit; }

button, a { min-height: 24px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.9rem;
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

.site-header, main, footer {
  width: min(1180px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  min-width: 2.4rem;
  min-height: 2.4rem;
  place-items: center;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--green);
  font-size: 0.86rem;
}

.privacy-badge span { font-size: 0.7rem; }

main { padding-block: clamp(2.5rem, 7vw, 6rem); }

.hero { max-width: 860px; margin-bottom: clamp(2.5rem, 6vw, 5rem); }

.eyebrow, .step {
  margin: 0 0 0.6rem;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h1, h2, h3 { line-height: 1.12; text-wrap: balance; }

h1 {
  max-width: 800px;
  margin: 0;
  font-size: clamp(2.35rem, 7vw, 5.8rem);
  letter-spacing: -0.055em;
}

.lede {
  max-width: 760px;
  margin: 1.4rem 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.3rem);
}

.analyzer-shell, .results {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  box-shadow: 12px 12px 0 rgba(111, 231, 220, 0.07);
}

.analyzer-shell { padding: clamp(1rem, 3vw, 2rem); }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.section-heading h2 { margin: 0; font-size: clamp(1.5rem, 3vw, 2.25rem); }

.example-actions, .report-actions, .form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.input-grid, .projection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.field { min-width: 0; }

.field-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

label { font-weight: 750; }

.character-count, .field-help, .scope-note, .privacy-note, .result-panel > p {
  color: var(--muted);
  font-size: 0.86rem;
}

.character-count { font-family: var(--mono); font-size: 0.72rem; }

.field-help { min-height: 2.7em; margin: 0.35rem 0 0.6rem; }

textarea {
  display: block;
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #091015;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 1rem;
}

textarea:focus { border-color: var(--cyan); }

.form-actions {
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  margin-top: 1.25rem;
}

.privacy-note { margin: 0 0 0 auto; }
.scope-note { margin: 1rem 0 0; }

.button {
  min-height: 2.75rem;
  border: 1px solid transparent;
  border-radius: 0;
  padding: 0.62rem 0.95rem;
  cursor: pointer;
  font-weight: 720;
}

.button-primary { background: var(--cyan); color: #041111; }
.button-primary:hover { background: #9bfff5; }
.button-secondary { border-color: var(--line); background: var(--panel-strong); color: var(--ink); }
.button-secondary:hover, .button-quiet:hover { border-color: var(--cyan); }
.button-quiet { min-height: 2.35rem; border-color: var(--line); background: transparent; color: var(--muted); font-size: 0.83rem; }

.results { margin-top: 2rem; padding: clamp(1rem, 3vw, 2rem); }
.results[hidden] { display: none; }
.results-heading { align-items: center; }

.verdict {
  border: 1px solid var(--line);
  border-left-width: 6px;
  padding: 1.25rem;
  background: #091015;
}

.verdict[data-verdict="hidden-payload"] { border-left-color: var(--red); }
.verdict[data-verdict="review-gap"] { border-left-color: var(--amber); }
.verdict[data-verdict="caution"] { border-left-color: var(--amber); }
.verdict[data-verdict="faithful"] { border-left-color: var(--green); }
.verdict-label { margin: 0; font-size: clamp(1.35rem, 3vw, 2rem); font-weight: 800; }
.verdict-detail { max-width: 760px; margin: 0.35rem 0 0; color: var(--muted); }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 1rem 0;
  border: solid var(--line);
  border-width: 1px 0 0 1px;
}

.metrics div { padding: 1rem; border: solid var(--line); border-width: 0 1px 1px 0; }
.metrics dt { color: var(--muted); font-size: 0.78rem; }
.metrics dd { margin: 0.2rem 0 0; font-family: var(--mono); font-size: 1.65rem; font-weight: 700; }

.result-panel {
  min-width: 0;
  margin-top: 1rem;
  border: 1px solid var(--line);
  padding: 1rem;
  background: #0d161c;
}

.result-panel[hidden] { display: none; }
.result-panel h3 { margin: 0; font-size: 1.08rem; }
.result-panel > p { margin: 0.35rem 0 1rem; }

.decoded-list { margin: 0; padding-left: 1.4rem; }
.decoded-list code { color: var(--amber); overflow-wrap: anywhere; }

.table-scroll { overflow-x: auto; }
.table-scroll:focus { outline-offset: 0; }

table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
caption { padding-bottom: 0.65rem; color: var(--muted); text-align: left; }
th, td { padding: 0.65rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--cyan); font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; }
td { font-family: var(--mono); overflow-wrap: anywhere; }

.severity-critical { color: var(--red); }
.severity-warning { color: var(--amber); }
.severity-notice { color: var(--cyan); }

pre {
  max-height: 24rem;
  overflow: auto;
  margin: 0;
  padding: 1rem;
  background: #060b0f;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.83rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.5rem 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

footer p { margin: 0; }
footer nav { display: flex; flex-wrap: wrap; gap: 1rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 760px) {
  .input-grid, .projection-grid { grid-template-columns: 1fr; }
  .section-heading, .site-header, footer { align-items: flex-start; flex-direction: column; }
  .field-help { min-height: auto; }
  .privacy-note { width: 100%; margin-left: 0; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 420px) {
  .site-header, main, footer { width: min(100% - 1rem, 1180px); }
  .metrics { grid-template-columns: 1fr; }
  .button { width: 100%; }
  .example-actions, .report-actions, .form-actions { width: 100%; }
}

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

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --ink: #10171b;
    --muted: #4e5d64;
    --paper: #f3f1e8;
    --panel: #fffef8;
    --panel-strong: #e8eee9;
    --line: #68777d;
    --cyan: #006d68;
    --cyan-dark: #d3f4ee;
    --amber: #8b5400;
    --red: #9d2424;
    --green: #116b31;
    --focus: #0b4fff;
  }
  body { background-color: var(--paper); }
  textarea, .verdict, .result-panel { background: #fff; }
  pre { background: #eef2ee; }
  .button-primary { color: #fff; }
  .button-primary:hover { background: #005752; }
}
