/* SPDX-License-Identifier: Apache-2.0 */

/* ---------------------------------------------------------------------
   Colour system. Light is the default; dark applies automatically via
   prefers-color-scheme, and can be forced either way with the theme
   toggle button (app.js sets html[data-theme]). Semantic colours
   (match / mismatch / hybrid) are always paired with an icon + text
   label in the markup -- never colour alone.
   --------------------------------------------------------------------- */
:root {
  --bg: #f6f7f9;
  --bg-elevated: #ffffff;
  --bg-sunken: #eceef1;
  --text: #1a1d21;
  --text-muted: #4b5157;
  --border: #d7dbe0;
  --accent: #0b5fff;
  --accent-2: #6e40c9;
  --focus-ring: #0b5fff;

  --match-bg: #e5f6ec;
  --match-fg: #0a6b36;
  --match-border: #3f9d68;

  --mismatch-bg: #fdecec;
  --mismatch-fg: #a3241c;
  --mismatch-border: #d1554b;

  --hybrid-bg: #fff3df;
  --hybrid-fg: #7a4c00;
  --hybrid-border: #c98a1f;

  --line-on: #0b5fff;
  --line-off: #b3541f;
  --grid-line: #d7dbe0;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a;
    --bg-elevated: #1c2026;
    --bg-sunken: #101216;
    --text: #edf0f2;
    --text-muted: #a9b0b8;
    --border: #2d323a;
    --accent: #7aa8ff;
    --accent-2: #c6a6ff;
    --focus-ring: #7aa8ff;

    --match-bg: #123321;
    --match-fg: #6fdb9a;
    --match-border: #3f9d68;

    --mismatch-bg: #391918;
    --mismatch-fg: #ff9c93;
    --mismatch-border: #d1554b;

    --hybrid-bg: #362405;
    --hybrid-fg: #ffcf7a;
    --hybrid-border: #c98a1f;

    --line-on: #7aa8ff;
    --line-off: #ffb066;
    --grid-line: #2d323a;

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #14161a;
  --bg-elevated: #1c2026;
  --bg-sunken: #101216;
  --text: #edf0f2;
  --text-muted: #a9b0b8;
  --border: #2d323a;
  --accent: #7aa8ff;
  --accent-2: #c6a6ff;
  --focus-ring: #7aa8ff;

  --match-bg: #123321;
  --match-fg: #6fdb9a;
  --match-border: #3f9d68;

  --mismatch-bg: #391918;
  --mismatch-fg: #ff9c93;
  --mismatch-border: #d1554b;

  --hybrid-bg: #362405;
  --hybrid-fg: #ffcf7a;
  --hybrid-border: #c98a1f;

  --line-on: #7aa8ff;
  --line-off: #ffb066;
  --grid-line: #2d323a;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--bg-sunken);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

a {
  color: var(--accent);
}
a:hover, a:focus {
  text-decoration-thickness: 2px;
}

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.6em 1em;
  z-index: 10;
}
.skip-link:focus {
  left: 0.5em;
  top: 0.5em;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ------------------------------- Header ------------------------------- */

.hero {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg));
  padding: 2rem 1.25rem 1.75rem;
}

.hero-inner {
  max-width: 68rem;
  margin: 0 auto;
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  justify-content: space-between;
}

.brand-mark {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand-tagline {
  font-weight: 500;
  font-size: 0.82em;
  color: var(--text-muted);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 0.6rem;
}

.hero h1 {
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.4rem);
  line-height: 1.15;
  margin: 0 0 0.75rem;
  max-width: 34ch;
}

.hero-sub {
  max-width: 62ch;
  color: var(--text-muted);
  font-size: 1.02rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.65rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
}

.button:hover,
.button:focus {
  border-color: var(--accent);
}

.button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.theme-toggle {
  flex: 0 0 auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}
.theme-toggle:hover {
  border-color: var(--accent);
}

.noscript-banner {
  background: var(--hybrid-bg);
  color: var(--hybrid-fg);
  border-bottom: 1px solid var(--hybrid-border);
  padding: 0.75rem 1.25rem;
  font-size: 0.92rem;
}
.noscript-banner a { color: inherit; }

/* -------------------------------- Main -------------------------------- */

main {
  max-width: 68rem;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
}

.panel {
  margin-top: 2.5rem;
}

.panel h2 {
  font-size: 1.35rem;
  margin-bottom: 0.4rem;
}

.panel-intro {
  color: var(--text-muted);
  max-width: 74ch;
  margin-top: 0.3rem;
  margin-bottom: 1.1rem;
}

/* ----------------------------- Headline band ----------------------------- */
/* The hero results band: the one number a judge should see without
   scrolling. Semantic colours (good/bad/neutral bars) are always paired
   with an icon + text note in the markup, matching the rest of this page's
   accessibility rule -- never colour alone. */

.headline-band {
  margin-top: 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: 12px;
  padding: 1.4rem 1.4rem 1.6rem;
}

.headline-band h2 {
  margin-top: 0;
}

.headline-empty {
  color: var(--text-muted);
  font-style: italic;
}

.headline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.headline-card {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.15rem;
}

.headline-eyebrow {
  margin: 0 0 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.headline-value {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 1.05rem + 1vw, 1.85rem);
  font-weight: 800;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.headline-card-proof {
  border-color: var(--match-border);
}

.headline-card-rollback {
  border-color: var(--mismatch-border);
}

.headline-card-proof .headline-value { color: var(--match-fg); }
.headline-card-rollback .headline-value { color: var(--mismatch-fg); }

.headline-detail {
  margin: 0 0 0.3rem;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.headline-note {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.headline-boundary {
  margin-top: 1.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}

.headline-boundary h3 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}

.headline-boundary p {
  color: var(--text-muted);
  max-width: 74ch;
  margin: 0;
  font-size: 0.94rem;
}

.headline-bars {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  align-items: start;
}

.headline-bar-group {
  display: grid;
  gap: 0.55rem;
}

.headline-bar-group-title {
  margin: 0 0 0.1rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.headline-bar-row {
  display: grid;
  grid-template-columns: minmax(9rem, 13rem) 1fr;
  grid-template-areas: "label label" "track value";
  gap: 0.15rem 0.7rem;
  align-items: center;
}

.headline-bar-label {
  grid-area: label;
  font-size: 0.84rem;
  color: var(--text);
}

.headline-bar-track {
  grid-area: track;
  display: block;
  height: 0.65rem;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.headline-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.headline-bar-neutral .headline-bar-fill { background: var(--text-muted); }
.headline-bar-good .headline-bar-fill { background: var(--match-fg); }
.headline-bar-bad .headline-bar-fill { background: var(--mismatch-fg); }

.headline-bar-value {
  grid-area: value;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text-muted);
}

.headline-bar-good .headline-bar-value { color: var(--match-fg); font-weight: 600; }
.headline-bar-bad .headline-bar-value { color: var(--mismatch-fg); font-weight: 600; }

.headline-bar-icon {
  display: inline-block;
  width: 1.1em;
  text-align: center;
}

.headline-honesty {
  margin-top: 1.2rem;
  background: var(--hybrid-bg);
  border: 1px solid var(--hybrid-border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
}

.headline-honesty p {
  margin: 0;
  color: var(--hybrid-fg);
  font-size: 0.9rem;
  max-width: 78ch;
}

.headline-honesty-icon {
  display: inline-block;
}

@media (max-width: 34rem) {
  .headline-bar-row {
    grid-template-columns: 1fr;
    grid-template-areas: "label" "track" "value";
  }
}

/* ---------------------------- Summary strip ---------------------------- */

.summary-strip {
  margin-top: 0.5rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.85rem;
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.stat-mismatch .stat-value { color: var(--mismatch-fg); }
.stat-hybrid .stat-value { color: var(--hybrid-fg); }
.stat-match .stat-value { color: var(--match-fg); }

.headline-sentence {
  margin-top: 1rem;
  font-size: 1.02rem;
  max-width: 74ch;
}

/* --------------------------------- Table -------------------------------- */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  -webkit-overflow-scrolling: touch;
}

table#hero-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 46rem;
  font-size: 0.92rem;
}

table#hero-table th,
table#hero-table td {
  text-align: left;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table#hero-table thead th {
  background: var(--bg-sunken);
  position: sticky;
  top: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

table#hero-table tbody tr:last-child td {
  border-bottom: none;
}

table#hero-table tbody tr.row-mismatch { background: color-mix(in srgb, var(--mismatch-bg) 55%, transparent); }
table#hero-table tbody tr.row-hybrid { background: color-mix(in srgb, var(--hybrid-bg) 55%, transparent); }
table#hero-table tbody tr.row-match { background: color-mix(in srgb, var(--match-bg) 35%, transparent); }

.loading-row td,
.table-empty {
  color: var(--text-muted);
  font-style: italic;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.2em 0.6em;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.82rem;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-match {
  background: var(--match-bg);
  color: var(--match-fg);
  border-color: var(--match-border);
}
.badge-mismatch {
  background: var(--mismatch-bg);
  color: var(--mismatch-fg);
  border-color: var(--mismatch-border);
}
.badge-hybrid {
  background: var(--hybrid-bg);
  color: var(--hybrid-fg);
  border-color: var(--hybrid-border);
}
.badge-unknown {
  background: var(--bg-sunken);
  color: var(--text-muted);
  border-color: var(--border);
}

/* -------------------------------- Charts -------------------------------- */

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: 1.1rem;
  align-items: start;
}

.chart-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem 1.2rem;
}

.chart-card h3 {
  margin: 0 0 0.1rem;
  font-size: 1.02rem;
}

.chart-card .chart-subtitle {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0 0 0.6rem;
}

.chart-card svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0.2rem;
}

.chart-legend .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}

.legend-swatch {
  width: 1.4em;
  height: 0;
  border-top-width: 3px;
  border-top-style: solid;
  display: inline-block;
}
.legend-swatch.on { border-color: var(--line-on); border-top-style: solid; }
.legend-swatch.off { border-color: var(--line-off); border-top-style: dashed; }

.chart-caption {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0.7rem;
}

.chart-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
.chart-table th, .chart-table td {
  text-align: right;
  padding: 0.3rem 0.4rem;
  border-bottom: 1px solid var(--border);
}
.chart-table th:first-child, .chart-table td:first-child {
  text-align: left;
}

.loading-note {
  color: var(--text-muted);
  font-style: italic;
}

.chart-empty {
  color: var(--text-muted);
  font-style: italic;
  grid-column: 1 / -1;
}

.crossover-extra {
  margin-top: 1.3rem;
}
.crossover-extra h3 {
  font-size: 1rem;
}
.crossover-extra ul {
  margin: 0.3rem 0 0;
  padding-left: 1.2rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ------------------------------- Figures -------------------------------- */

.figures-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
}
.figures-grid figure {
  margin: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem;
}
.figures-grid img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
  background: var(--bg-sunken);
}
.figures-grid figcaption {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  word-break: break-word;
}

/* ------------------------------ Methodology ------------------------------ */

.method-list {
  display: grid;
  gap: 0.9rem;
  margin: 0;
}
.method-list dt {
  font-weight: 700;
}
.method-list dd {
  margin: 0.15rem 0 0;
  color: var(--text-muted);
  max-width: 72ch;
}

/* -------------------------------- Footer -------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 1.5rem 1.25rem 2.5rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.site-footer > p {
  max-width: 68rem;
  margin: 0.3rem auto;
}
.footer-meta {
  font-size: 0.8rem;
}

@media (max-width: 40rem) {
  .hero-inner {
    flex-direction: column;
  }
  .theme-toggle {
    align-self: flex-start;
  }
}

/* --------------------------- Judge demo layer --------------------------- */
/* The static Space is intentionally a narrative layer over the repository's
   evidence. These styles keep the first screen fast to scan, while preserving
   the existing light/dark and semantic colour system above. */

.hero-space {
  position: relative;
  overflow: hidden;
  padding-top: clamp(2.4rem, 6vw, 5.5rem);
  padding-bottom: clamp(2.2rem, 5vw, 4.5rem);
  background:
    radial-gradient(circle at 86% 18%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 28rem),
    linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg) 68%);
}

.hero-space::after {
  content: "";
  position: absolute;
  right: -8rem;
  bottom: -10rem;
  width: 30rem;
  height: 30rem;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 50%;
  box-shadow:
    0 0 0 2.4rem color-mix(in srgb, var(--accent) 7%, transparent),
    0 0 0 5.2rem color-mix(in srgb, var(--accent) 4%, transparent);
  pointer-events: none;
}

.hero-space .hero-inner {
  position: relative;
  z-index: 1;
}

.hero-text {
  max-width: 54rem;
}

.hero h1 {
  font-size: clamp(2rem, 1.3rem + 3.5vw, 4.25rem);
  letter-spacing: -0.045em;
  max-width: 15ch;
}

.hero-sub {
  font-size: clamp(1rem, 0.92rem + 0.35vw, 1.2rem);
  line-height: 1.65;
  max-width: 60ch;
}

.hero-proof-note {
  margin: 1.15rem 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.hero-proof-note span {
  color: var(--match-fg);
  margin-right: 0.35rem;
}

.hero-actions .button {
  box-shadow: 0 0.35rem 1.2rem color-mix(in srgb, var(--text) 8%, transparent);
}

.hero-actions .button-primary {
  box-shadow: 0 0.5rem 1.6rem color-mix(in srgb, var(--accent) 28%, transparent);
}

.judge-strip {
  max-width: 68rem;
  margin: 1.15rem auto 0;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.judge-strip > div {
  display: grid;
  gap: 0.1rem;
  padding: 0.85rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 0.35rem 1.2rem color-mix(in srgb, var(--text) 4%, transparent);
}

.judge-strip strong {
  font-size: 0.84rem;
  letter-spacing: 0.03em;
}

.judge-strip span {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.section-kicker {
  margin-bottom: 0.5rem;
  color: var(--accent);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.walkthrough,
.evidence-band,
.method-band,
.rollback-band,
.next-step {
  padding: clamp(1.2rem, 2.4vw, 2rem);
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-elevated);
  box-shadow: 0 0.7rem 2rem color-mix(in srgb, var(--text) 5%, transparent);
}

.walkthrough {
  margin-top: 2.1rem;
}

.walkthrough h2,
.evidence-band h2,
.method-band h2,
.rollback-band h2,
.next-step h2 {
  margin-top: 0;
  font-size: clamp(1.35rem, 1.05rem + 1vw, 2rem);
  letter-spacing: -0.025em;
}

.walkthrough-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1.25rem;
}

.story-card {
  min-height: 12rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: 11px;
  background: var(--bg);
}

.story-liar { border-top-color: var(--mismatch-border); }
.story-honest { border-top-color: var(--match-border); }
.story-ci { border-top-color: var(--accent); }

.story-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.story-number {
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
  font-weight: 800;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  padding: 0.15rem 0.48rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.status-bad { color: var(--mismatch-fg); background: var(--mismatch-bg); }
.status-good { color: var(--match-fg); background: var(--match-bg); }
.status-blue { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--bg-elevated)); }

.story-card h3 {
  margin: 1rem 0 0.35rem;
  font-size: 1.12rem;
}

.story-card p {
  margin: 0 0 0.9rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.story-card code {
  display: inline-block;
  color: var(--text-muted);
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

.terminal-card {
  margin-top: 1rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #101216;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
  padding: 0 0.8rem;
  border-bottom: 1px solid #2d323a;
  color: #a9b0b8;
  font: 0.7rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.terminal-bar span {
  width: 0.52rem;
  height: 0.52rem;
  border-radius: 50%;
  background: #ff6b63;
}

.terminal-bar span:nth-child(2) { background: #ffc857; }
.terminal-bar span:nth-child(3) { background: #66d17a; }
.terminal-bar b {
  margin-left: 0.35rem;
  font-weight: 600;
}

.terminal-card pre,
.code-block {
  margin: 0;
  overflow-x: auto;
  font: 0.82rem/1.75 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.terminal-card pre {
  padding: 1rem 1.05rem 1.15rem;
  color: #edf0f2;
}

.prompt { color: #7aa8ff; }
.dim { color: #8a939e; }
.bad { color: #ff9c93; }
.good { color: #6fdb9a; }
.blue { color: #7aa8ff; }

.small-note {
  margin: 0.85rem 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.data-error {
  margin: 1.25rem 0 -0.75rem;
  padding: 0.8rem 1rem;
  color: var(--hybrid-fg);
  background: var(--hybrid-bg);
  border: 1px solid var(--hybrid-border);
  border-radius: 10px;
  font-size: 0.86rem;
}

.evidence-band {
  margin-top: 1.25rem;
  border-top: 4px solid var(--accent);
}

.evidence-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(17rem, 0.85fr);
  gap: 1.3rem;
  align-items: stretch;
}

.evidence-copy {
  color: var(--text-muted);
  max-width: 68ch;
}

.evidence-copy p:first-child {
  margin-top: 0;
}

.boundary-note {
  padding: 0.85rem 1rem;
  color: var(--hybrid-fg);
  background: var(--hybrid-bg);
  border: 1px solid var(--hybrid-border);
  border-radius: 10px;
  font-size: 0.88rem;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
  font-size: 0.84rem;
  font-weight: 700;
}

.metric-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 11rem;
  padding: 1.2rem;
  border: 1px solid var(--match-border);
  border-radius: 12px;
  background: var(--match-bg);
}

.metric-label,
.rollback-label {
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.metric-value {
  margin: 0.25rem 0;
  color: var(--match-fg);
  font-size: clamp(2rem, 1.5rem + 2vw, 3.25rem);
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric-detail {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.metric-bar {
  height: 0.65rem;
  margin-top: 1rem;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--match-fg) 45%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--match-bg) 75%, var(--bg));
}

.metric-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--match-fg);
  transition: width 500ms ease;
}

.method-band {
  margin-top: 1.25rem;
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1.15rem;
}

.method-grid article {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg);
}

.method-grid article h3 {
  margin: 0.65rem 0 0.25rem;
}

.method-grid article p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.87rem;
}

.layer-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 1.7rem;
  border-radius: 6px;
  color: #fff;
  background: var(--accent);
  font: 800 0.78rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.method-critical {
  border-color: var(--accent) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.product-grid > div {
  display: grid;
  gap: 0.15rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: var(--bg-sunken);
}

.product-grid strong {
  font-size: 0.82rem;
}

.product-grid span {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.rollback-band {
  margin-top: 1.25rem;
  border-top: 4px solid var(--mismatch-border);
}

.rollback-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1.1rem;
}

.rollback-card {
  display: grid;
  align-content: center;
  min-height: 8.5rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg);
}

.rollback-card strong {
  margin: 0.25rem 0;
  font-size: clamp(1.5rem, 1.2rem + 1.3vw, 2.35rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.rollback-card > span:last-child {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.rollback-fail {
  border-color: var(--mismatch-border);
  background: var(--mismatch-bg);
}

.rollback-fail strong,
.ratio-negative {
  color: var(--mismatch-fg);
}

.receipt-link {
  font-weight: 700;
}

.next-step {
  margin-top: 1.25rem;
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-sunken));
}

.next-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.next-grid h3 {
  margin-top: 0;
}

.next-grid p {
  color: var(--text-muted);
}

.code-block {
  padding: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.data-freshness {
  margin: 1.1rem 0 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 52rem) {
  .walkthrough-grid,
  .method-grid {
    grid-template-columns: 1fr;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 42rem) {
  .judge-strip,
  .evidence-grid,
  .rollback-grid,
  .next-grid {
    grid-template-columns: 1fr;
  }

  .judge-strip {
    margin-top: 0.75rem;
  }

  main {
    padding-top: 1rem;
  }

  .hero-space {
    padding-top: 2rem;
  }
}

@media (max-width: 28rem) {
  .product-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .metric-bar span {
    transition: none;
  }
}
