:root {
  color-scheme: dark;
  --ink: #eef1e9;
  --muted: #8c958b;
  --paper: #0b100f;
  --panel: #111816;
  --line: #29332f;
  --acid: #c8ff3d;
  --cyan: #65dfcf;
  --danger: #ff705e;
  --amber: #ffc857;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  line-height: 1.55;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(200,255,61,.035) 50%, transparent 50.2%),
    radial-gradient(circle at 76% 8%, rgba(101,223,207,.09), transparent 27%);
  background-size: 64px 64px, auto;
}

.scanline {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  opacity: .16;
  background: repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(255,255,255,.018) 4px);
}

.masthead, main, footer { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.masthead {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 13px; color: var(--ink); text-decoration: none; font-weight: 700; }
.brand-mark { padding: 7px 9px; background: var(--acid); color: #10150d; font-size: 12px; letter-spacing: .08em; }
.status { color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.status i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; background: var(--cyan); border-radius: 50%; box-shadow: 0 0 12px var(--cyan); }

.intro { padding: 82px 0 58px; display: grid; grid-template-columns: 1.4fr .6fr; column-gap: 54px; }
.eyebrow { grid-column: 1 / -1; margin: 0 0 20px; color: var(--acid); font-size: 12px; letter-spacing: .15em; }
h1 { margin: 0; font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif; font-size: clamp(58px, 8vw, 112px); font-weight: 900; line-height: .89; letter-spacing: -.025em; text-transform: uppercase; }
h1 em { color: transparent; -webkit-text-stroke: 1.5px var(--acid); font-style: normal; }
.lede { align-self: end; margin: 0 0 9px; max-width: 410px; color: #b7beb6; font-family: system-ui, sans-serif; font-size: 16px; }
.scope-strip { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0; margin-top: 54px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.scope-strip span { flex: 1; min-width: 130px; padding: 13px 18px; color: var(--muted); font-size: 12px; text-align: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.workbench { display: grid; grid-template-columns: minmax(0, 1fr) 270px; border: 1px solid var(--line); background: rgba(17,24,22,.82); }
form { padding: 36px; border-right: 1px solid var(--line); }
.form-head, .result-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 30px; }
.form-head > div, .result-head > div { display: flex; align-items: center; gap: 14px; }
.form-head h2, .result-head h2, .protocol h2 { margin: 0; font-family: system-ui, sans-serif; font-size: 20px; }
.form-head > span { color: var(--muted); font-size: 11px; }
.step { color: var(--acid); font-size: 11px; }
.field { display: block; margin-bottom: 22px; }
.field > span { display: flex; justify-content: space-between; margin-bottom: 8px; color: #b7beb6; font-size: 12px; }
.field b { color: var(--acid); font-size: 9px; font-weight: 400; }
input, textarea {
  display: block;
  width: 100%;
  border: 1px solid #35413d;
  border-radius: 0;
  outline: 0;
  background: #090e0d;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  resize: vertical;
  transition: border-color .18s, box-shadow .18s;
}
input { height: 48px; padding: 0 14px; }
textarea { padding: 14px; }
input:focus, textarea:focus { border-color: var(--acid); box-shadow: inset 3px 0 var(--acid); }
input.invalid, textarea.invalid { border-color: var(--danger); }
textarea::placeholder, input::placeholder { color: #56605c; }
.code-field textarea { line-height: 1.65; tab-size: 2; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field-error { display: block; min-height: 16px; margin-top: 5px; color: var(--danger); font-family: system-ui, sans-serif; font-size: 11px; }
.submit-row { display: flex; align-items: center; gap: 20px; margin-top: 8px; }
button { border-radius: 0; font: inherit; cursor: pointer; }
#submit-button { min-width: 250px; min-height: 54px; padding: 0 20px; border: 1px solid var(--acid); background: var(--acid); color: #11170d; font-weight: 800; text-align: left; }
#submit-button:hover:not(:disabled) { background: transparent; color: var(--acid); }
#submit-button:disabled { cursor: wait; opacity: .75; }
#submit-button b { float: right; font-size: 18px; }
.button-loading { display: none; }
#submit-button.loading .button-idle { display: none; }
#submit-button.loading .button-loading { display: inline; }
.button-loading i { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: currentColor; animation: pulse 1s infinite alternate; }
.submit-row p { margin: 0; color: var(--muted); font-size: 10px; }
@keyframes pulse { to { opacity: .2; transform: scale(.65); } }

.protocol { padding: 36px 26px; background: #0d1311; }
.protocol h2 { margin: 10px 0 32px; }
.protocol ol { margin: 0; padding: 0; list-style: none; }
.protocol li { padding: 18px 0; border-top: 1px solid var(--line); }
.protocol li b, .protocol li span { display: block; }
.protocol li b { color: var(--cyan); font-size: 11px; }
.protocol li span { margin-top: 4px; color: #b7beb6; font-family: system-ui, sans-serif; font-size: 13px; }
.protocol-note { margin-top: 40px; padding: 14px; border-left: 2px solid var(--acid); background: #151d1a; color: var(--muted); font-size: 10px; }

.result-panel, .error-panel { margin-top: 42px; padding: 36px; border: 1px solid var(--line); background: var(--panel); }
.text-button { padding: 7px 0; border: 0; border-bottom: 1px solid var(--acid); background: none; color: var(--acid); font-size: 12px; }
.report-overview { margin: 0 0 26px; padding: 20px; border-left: 3px solid var(--cyan); background: #0c1210; font-family: system-ui, sans-serif; }
.report-stats { display: flex; gap: 1px; margin-bottom: 32px; background: var(--line); border: 1px solid var(--line); }
.report-stats span { flex: 1; padding: 13px; background: var(--paper); color: var(--muted); font-size: 11px; text-align: center; }
.report-stats b { display: block; color: var(--ink); font-size: 24px; }
.finding-section { margin-top: 36px; }
.finding-section > h3 { margin: 0 0 14px; color: var(--ink); font-family: system-ui, sans-serif; font-size: 16px; }
.finding-section > h3 span { margin-left: 8px; color: var(--muted); font: 10px ui-monospace, monospace; }
.finding { display: grid; grid-template-columns: 108px 1fr; border-top: 1px solid var(--line); }
.finding:last-child { border-bottom: 1px solid var(--line); }
.finding-rank { padding: 20px 14px 20px 0; }
.severity, .priority { display: inline-block; padding: 3px 7px; border: 1px solid currentColor; font-size: 9px; }
.severity.critical, .severity.high { color: var(--danger); }
.severity.medium { color: var(--amber); }
.severity.low { color: var(--cyan); }
.priority { display: block; width: max-content; margin-top: 8px; color: var(--muted); }
.finding-body { padding: 20px 0 20px 20px; border-left: 1px solid var(--line); }
.finding-body h4 { margin: 0 0 5px; font-family: system-ui, sans-serif; font-size: 16px; }
.category { color: var(--muted); font-size: 10px; }
.evidence { margin: 16px 0; padding: 12px 14px; background: #080d0c; border-left: 2px solid var(--acid); }
.evidence b { display: block; margin-bottom: 5px; color: var(--acid); font-size: 10px; }
.evidence code { color: #cbd2ca; white-space: pre-wrap; overflow-wrap: anywhere; }
.finding-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; font-family: system-ui, sans-serif; font-size: 13px; }
.finding-notes b { display: block; margin-bottom: 4px; color: var(--muted); font: 10px ui-monospace, monospace; }
.gap { margin-top: 12px; color: var(--amber); font-family: system-ui, sans-serif; font-size: 12px; }
.empty-risk { padding: 16px; border: 1px dashed var(--line); color: var(--muted); font-size: 12px; }
.priority-list { margin: 0; padding: 0; list-style: none; counter-reset: plan; }
.priority-list li { counter-increment: plan; display: flex; gap: 15px; padding: 14px 0; border-top: 1px solid var(--line); font-family: system-ui, sans-serif; }
.priority-list li::before { content: "0" counter(plan); color: var(--acid); font-family: ui-monospace, monospace; }
.raw-report { margin: 0; color: #d3d9d2; font-family: system-ui, sans-serif; white-space: pre-wrap; overflow-wrap: anywhere; }
.error-panel { border-color: rgba(255,112,94,.5); }
.error-code { color: var(--danger); font-size: 10px; }
.error-panel h2 { margin: 9px 0; font-family: system-ui, sans-serif; }
.error-panel p { max-width: 700px; color: #b7beb6; font-family: system-ui, sans-serif; }
#retry-button { margin-top: 8px; padding: 12px 18px; border: 1px solid var(--danger); background: transparent; color: var(--danger); }
#retry-button:hover { background: var(--danger); color: #130705; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 34px 0 50px; color: #66706c; font-size: 10px; }

@media (max-width: 800px) {
  .masthead, main, footer { width: min(100% - 24px, 1180px); }
  .status { display: none; }
  .intro { padding: 54px 0 38px; grid-template-columns: 1fr; }
  .lede { margin-top: 30px; }
  .scope-strip { margin-top: 34px; }
  .workbench { grid-template-columns: 1fr; }
  form { padding: 24px 18px; border-right: 0; }
  .protocol { border-top: 1px solid var(--line); }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .submit-row { align-items: stretch; flex-direction: column; }
  #submit-button { width: 100%; min-width: 0; }
  .result-panel, .error-panel { padding: 24px 18px; }
  .finding { grid-template-columns: 1fr; }
  .finding-rank { padding-bottom: 8px; }
  .finding-body { padding: 8px 0 20px; border-left: 0; }
  .finding-notes { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  h1 { font-size: 52px; }
  .scope-strip span { min-width: 50%; }
  .form-head { align-items: flex-start; }
  .report-stats { flex-wrap: wrap; }
  .report-stats span { flex-basis: calc(50% - 1px); }
  footer { flex-direction: column; }
}

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