:root {
  --ink: #16191d;
  --muted: #5d6570;
  --line: #e2e6ea;
  --bg: #ffffff;
  --soft: #f6f8fa;
  --accent: #1f5f8b;
  --good: #1a7f4b;
  --bad: #b23b3b;
  --warn: #8a6d1f;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
}
.wrap { width: min(1060px, 92vw); margin: 0 auto; }
a { color: var(--accent); }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 58px; flex-wrap: wrap;
}
.brand {
  font-weight: 700; font-size: 19px; letter-spacing: -.02em;
  text-decoration: none; color: var(--ink);
}
.brand span { color: var(--accent); }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a {
  padding: 6px 11px; border-radius: 7px; text-decoration: none;
  color: var(--muted); font-size: 14.5px; font-weight: 500;
}
.topbar nav a:hover { background: var(--soft); color: var(--ink); }
.topbar nav a.active { background: var(--accent); color: #fff; }

main { padding: 34px 0 60px; }
section { margin-bottom: 42px; }
h1 { font-size: 33px; line-height: 1.2; letter-spacing: -.025em; margin: 0 0 12px; }
h2 { font-size: 23px; letter-spacing: -.015em; margin: 0 0 12px;
     padding-bottom: 7px; border-bottom: 1px solid var(--line); }
h3 { font-size: 17px; margin: 22px 0 8px; }
h4 { font-size: 15px; margin: 0 0 6px; }
p { margin: 0 0 13px; }

.hero { padding: 10px 0 6px; }
.eyebrow {
  text-transform: uppercase; letter-spacing: .09em; font-size: 11.5px;
  font-weight: 700; color: var(--muted); margin-bottom: 10px;
}
.hero h1 { font-size: 38px; max-width: 22ch; }
.lede { font-size: 18px; color: #333a42; max-width: 68ch; }
.cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--line); text-decoration: none; color: var(--ink);
  font-size: 14.5px; font-weight: 600; background: #fff;
}
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }

.cards { display: grid; gap: 14px; grid-template-columns: repeat(3, 1fr); }
.card { background: var(--soft); border: 1px solid var(--line);
        border-radius: var(--radius); padding: 16px; }
.card h3 { margin: 0 0 6px; font-size: 15.5px; }
.card p { margin: 0; font-size: 14.5px; color: #3d444d; }

.cols { display: grid; gap: 22px; grid-template-columns: 1fr 1fr; }
.cols.three { grid-template-columns: repeat(3, 1fr); }
.cols ul { margin: 0; padding-left: 18px; }
.cols li { margin-bottom: 6px; font-size: 14.5px; }

.stats { display: grid; gap: 14px; grid-template-columns: repeat(4, 1fr); }
.stats div {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px; text-align: center;
}
.stats strong { display: block; font-size: 25px; letter-spacing: -.02em; }
.stats span { font-size: 13px; color: var(--muted); }

.tablewrap { overflow-x: auto; margin: 0 0 14px; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); }
th { background: var(--soft); font-weight: 600; white-space: nowrap; }
td code { background: var(--soft); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.tnote { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

.fig { margin: 0 0 24px; }
.fig img {
  width: 100%; height: auto; display: block;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
}
.fig.wide img { padding: 10px; }
.fig figcaption { font-size: 13.5px; color: var(--muted); margin-top: 9px; }

.eq {
  background: var(--soft); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; margin: 0 0 13px;
  font-size: 16px; text-align: center; overflow-x: auto;
}
.callout {
  border-left: 3px solid var(--accent); background: var(--soft);
  padding: 13px 16px; border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 15px; margin: 16px 0 0;
}
.callout.warn { border-left-color: var(--warn); }

.pipeline { display: grid; gap: 12px; grid-template-columns: repeat(4, 1fr);
            margin-bottom: 24px; }
.stage { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stage span {
  display: inline-grid; place-items: center; width: 24px; height: 24px;
  border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 700; margin-bottom: 8px;
}
.stage h3 { margin: 0 0 5px; font-size: 15px; }
.stage p { margin: 0; font-size: 13.5px; color: #3d444d; }
.reasons { font-size: 14.5px; margin: 0 0 16px; padding-left: 18px; }

.controls { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.control { display: flex; flex-direction: column; gap: 5px; }
.control label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em;
  font-weight: 700; color: var(--muted);
}
select {
  font: inherit; font-size: 14.5px; padding: 8px 11px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  min-width: 168px;
}
.anchorbox {
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 15px 17px; margin-bottom: 18px;
  background: #fbfcfd;
}
.anchorbox h3 { margin: 0 0 6px; font-size: 15px; }
.anchorbox .hint { margin: 0 0 13px; font-size: 13.5px; color: var(--muted); }
.anchorrow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.anchor {
  display: flex; align-items: center; gap: 11px;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 12px; background: var(--bg);
}
.anchor .name { font-size: 14px; font-weight: 600; }
.anchor .sub { font-size: 12px; color: var(--muted);
               font-variant-numeric: tabular-nums; }

.qsummary {
  background: var(--soft); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 17px; margin-bottom: 20px;
}
.qsummary .query { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.qsummary .meta { font-size: 13.5px; color: var(--muted); margin-top: 5px; }
.deltapill {
  display: inline-block; margin-top: 9px; font-size: 12.5px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px;
}
.deltapill.good { background: #e7f4ec; color: var(--good); }
.deltapill.bad { background: #fbecec; color: var(--bad); }
.deltapill.flat { background: #eceef0; color: var(--muted); }

.chips { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
  font: inherit; font-size: 13.5px; cursor: pointer;
  padding: 7px 13px; border-radius: 999px; background: #fff;
  border: 1px solid var(--line); color: var(--ink);
  display: inline-flex; align-items: center; gap: 8px;
}
.chip:hover { background: var(--soft); }
.chip span {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.compare { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel > header {
  padding: 11px 15px; background: var(--soft); border-bottom: 1px solid var(--line);
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.panel h3 { margin: 0; font-size: 15.5px; }
.panel .score { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.panel.win > header { background: #eef6f1; }

.row {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 14px; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.rank { font-size: 12px; color: var(--muted); width: 18px; font-variant-numeric: tabular-nums; }
.play {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff; cursor: pointer;
  display: grid; place-items: center; color: var(--accent); font-size: 11px;
  padding: 0; line-height: 1;
}
.play:hover { background: var(--soft); }
.play.playing { background: var(--accent); border-color: var(--accent); color: #fff; }
.play[disabled] { opacity: .35; cursor: not-allowed; }
.info { flex: 1 1 auto; min-width: 0; }
.info .name {
  font-size: 14px; font-weight: 500; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.info .sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pill {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  white-space: nowrap;
}
.pill.good { background: #e7f4ec; color: var(--good); }
.pill.bad { background: #fbecec; color: var(--bad); }

.footer { border-top: 1px solid var(--line); padding: 20px 0; background: var(--soft); }
.footer p { margin: 0; font-size: 13px; color: var(--muted); }

@media (max-width: 860px) {
  .cards, .cols, .cols.three, .stats, .compare, .anchorrow {
    grid-template-columns: 1fr;
  }
  .hero h1 { font-size: 29px; }
  h1 { font-size: 27px; }
}
