:root {
  color-scheme: dark;
  --bg: #071016;
  --panel: #0d1b24;
  --panel-2: #112631;
  --text: #edf7f7;
  --muted: #9fb3b8;
  --line: #25414a;
  --mint: #65f2c1;
  --cyan: #6bd8ff;
  --amber: #ffd479;
  --danger: #ff8b8b;
  --radius: 20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 90% 0%, rgba(107, 216, 255, 0.11), transparent 28rem),
    radial-gradient(circle at 0% 25%, rgba(101, 242, 193, 0.08), transparent 25rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a { color: var(--cyan); }
a:hover { color: var(--mint); }
.skip-link { position: absolute; left: -999px; top: 1rem; }
.skip-link:focus { left: 1rem; z-index: 20; background: var(--text); color: var(--bg); padding: .75rem 1rem; }

.hero, main, footer { width: min(1120px, calc(100% - 2rem)); margin-inline: auto; }
.hero { padding: 5rem 0 2rem; }
.eyebrow, .step { margin: 0 0 .55rem; color: var(--mint); font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2 { letter-spacing: -.035em; line-height: 1.08; }
h1 { margin: 0; max-width: 850px; font-size: clamp(2.7rem, 8vw, 6rem); }
h2 { margin: 0 0 .75rem; font-size: clamp(1.55rem, 4vw, 2.35rem); }
.lede { max-width: 760px; margin: 1.4rem 0; color: #c9d8da; font-size: clamp(1.05rem, 2.5vw, 1.35rem); }
.truth-strip { max-width: 900px; padding: 1rem 1.15rem; border: 1px solid #4b655d; border-left: 5px solid var(--amber); border-radius: 12px; background: rgba(255, 212, 121, .07); }

main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; padding-bottom: 3rem; }
main > *, .result-card, .table-wrap { min-width: 0; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(17, 38, 49, .92), rgba(11, 25, 33, .96)); padding: clamp(1.1rem, 3vw, 2rem); box-shadow: 0 18px 50px rgba(0, 0, 0, .17); }
.intro-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 2rem; }
.mini-definitions { margin: 0; display: grid; gap: .75rem; }
.mini-definitions div { padding: .8rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(7, 16, 22, .35); }
.mini-definitions dt { color: var(--cyan); font-weight: 800; }
.mini-definitions dd { margin: .15rem 0 0; color: var(--muted); }

.section-heading { display: flex; gap: 1rem; align-items: start; justify-content: space-between; }
fieldset { border: 0; border-top: 1px solid var(--line); margin: 1.4rem 0 0; padding: 1.25rem 0 0; }
legend { padding-right: 1rem; color: var(--amber); font-size: .92rem; font-weight: 800; }
.field-grid { display: grid; gap: 1rem; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
label { display: grid; gap: .35rem; font-weight: 700; }
small { color: var(--muted); font-weight: 400; }
input, select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #38545c;
  border-radius: 10px;
  background: #08161e;
  color: var(--text);
  padding: .72rem .8rem;
  font: inherit;
}
input:focus, select:focus, button:focus, summary:focus, .table-wrap:focus, pre:focus { outline: 3px solid rgba(107, 216, 255, .45); outline-offset: 2px; }
details { margin: 1.3rem 0; border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; }
summary { cursor: pointer; color: var(--cyan); font-weight: 800; }
.details-grid { margin-top: 1rem; }
.evidence-row { margin-top: 1rem; }
.hidden { display: none !important; }

.button { border: 1px solid transparent; border-radius: 999px; min-height: 44px; padding: .65rem 1rem; font: inherit; font-weight: 800; cursor: pointer; }
.button.primary { background: var(--mint); color: #032018; }
.button.ghost { background: transparent; border-color: #42606a; color: var(--text); }
.button.danger { background: transparent; border-color: #70494d; color: var(--danger); }
.button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.actions { display: flex; justify-content: flex-end; margin-top: 1rem; }
.errors { color: #ffd0d0; margin: .8rem 0; }
.errors ul { margin: .4rem 0; }
.empty { color: var(--muted); }

.table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: .8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--cyan); font-size: .84rem; }
td { color: #dce7e8; }
.remove-row { border: 0; background: transparent; color: var(--danger); cursor: pointer; font-weight: 800; }
.tag { display: inline-block; border: 1px solid #4d6b74; border-radius: 999px; padding: .18rem .5rem; color: #c7dbdf; font-size: .75rem; }
.tag.fixture { border-color: #8c7542; color: var(--amber); }

.results-panel { border-color: #345e58; }
.state { display: inline-flex; max-width: 100%; overflow-wrap: anywhere; margin: .2rem 0 1rem; padding: .45rem .7rem; border-radius: 8px; background: rgba(101, 242, 193, .09); color: var(--mint); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.result-card { margin: 1rem 0; padding: 1rem; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 12px; background: rgba(7, 16, 22, .35); }
.result-card h3 { margin: 0 0 .55rem; }
.result-card p { margin: .35rem 0; }
.setup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; margin-top: .8rem; }
.setup-card { border-left: 4px solid var(--cyan); padding: .7rem .8rem; background: rgba(107, 216, 255, .05); }
.warning-list { color: #d7cdb7; }
pre { max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-word; padding: 1rem; border-radius: 10px; background: #041016; color: #c9efdf; }
.sources li { margin-bottom: .65rem; }
.source-note { color: var(--muted); }
footer { padding: 1rem 0 3rem; color: var(--muted); font-size: .9rem; }

@media (max-width: 760px) {
  .hero { padding-top: 3.5rem; }
  .intro-grid, .field-grid.two, .field-grid.three { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .section-heading .button { align-self: start; }
}

@media (prefers-reduced-motion: no-preference) {
  .button { transition: transform .16s ease, filter .16s ease; }
}
