:root {
  --brand: #381d92; --brand-dark: #2a1570; --ink: #111827; --ink-2: #4b5563; --ink-3: #6b7280;
  --line: #e5e7eb; --surface: #ffffff; --page: #f8f7fc; --tint: #faf9fe;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300;
  --s7: #6250d6; --s8: #e34948; --other: #9a9994;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--page); line-height: 1.55; font-size: 16px; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 1.25rem; }

.site-header { position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,0.97);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.site-logo { display: flex; align-items: center; gap: 0.75rem; color: var(--ink); font-weight: 700; }
.site-logo:hover { text-decoration: none; }
.site-logo img { height: 36px; width: auto; }
.tool-name { font-size: 1.05rem; letter-spacing: -0.01em; padding-left: 0.75rem; border-left: 1px solid var(--line); }
.site-nav { display: flex; gap: 2rem; align-items: center; }
.site-nav a { font-size: 0.9rem; font-weight: 500; color: var(--ink-2); }
.site-nav a:hover, .site-nav a.active { color: var(--brand); text-decoration: none; }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 0.5rem; }
.nav-toggle svg { width: 24px; height: 24px; stroke: #111; }

.intro { background: #0f0a1e; color: #fff; padding: 2.5rem 0 2rem; }
.intro h1 { margin: 0 0 0.5rem; font-size: 2rem; letter-spacing: -0.02em; }
.intro p { margin: 0 0 1.25rem; max-width: 46rem; color: rgba(255,255,255,0.82); }
.search { display: flex; gap: 0.5rem; max-width: 40rem; }
.search input { flex: 1; min-width: 0; padding: 0.7rem 0.9rem; border-radius: 8px; border: 1px solid transparent; font-size: 1rem; }
.search button { padding: 0.7rem 1.1rem; border-radius: 8px; border: 0; background: #fff; color: var(--brand);
  font-weight: 600; font-size: 0.95rem; cursor: pointer; white-space: nowrap; }
.search button:hover { background: #ece8fb; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin-top: 1.5rem; }
.tile { background: rgba(255,255,255,0.08); border-radius: 10px; padding: 0.8rem 1rem; }
.tile b { display: block; font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; }
.tile span { font-size: 0.82rem; color: rgba(255,255,255,0.7); }
.tiles--inline { margin: 0 0 1.25rem; }
.tiles--inline .tile { background: var(--tint); border: 1px solid var(--line); }
.tiles--inline .tile span { color: var(--ink-3); }

.tabs { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 72px; z-index: 90; }
.tabs .container { display: flex; gap: 0.25rem; overflow-x: auto; }
.tabs a { padding: 0.9rem 0.85rem; font-size: 0.92rem; font-weight: 500; color: var(--ink-2);
  border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--brand); text-decoration: none; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }

main { padding-top: 1.5rem; padding-bottom: 3rem; min-height: 50vh; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.4rem 1.5rem; margin-bottom: 1.25rem; }
.panel-head { display: flex; justify-content: space-between; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: 0.75rem; }
.panel-head > div:first-child { flex: 1 1 26rem; }
h2 { font-size: 1.2rem; margin: 0 0 0.3rem; letter-spacing: -0.01em; }
h3 { font-size: 1rem; margin: 1.5rem 0 0.4rem; }
.help { margin: 0; color: var(--ink-2); font-size: 0.92rem; max-width: 44rem; }
.note { margin: 1rem 0 0; padding: 0.75rem 1rem; background: var(--tint); border-left: 3px solid var(--brand);
  border-radius: 4px; color: var(--ink-2); font-size: 0.9rem; }
.controls { display: flex; gap: 1rem; flex-wrap: wrap; }
.controls label { font-size: 0.8rem; color: var(--ink-3); display: flex; flex-direction: column; gap: 0.25rem; }
select { font-size: 0.9rem; padding: 0.4rem 0.5rem; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; color: var(--ink); max-width: 100%; }
.chart-box { position: relative; height: 340px; }
.chart-box.tall { height: 420px; }
.chart-box.short { height: 240px; }
.table-view { margin-top: 0.75rem; font-size: 0.88rem; }
.table-view summary { cursor: pointer; color: var(--brand); font-weight: 500; }
.scroll { overflow: auto; max-height: 420px; border: 1px solid var(--line); border-radius: 8px; margin-top: 0.5rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.86rem; }
th, td { padding: 0.45rem 0.7rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { position: sticky; top: 0; background: #f3f4f6; font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.muted td { color: var(--ink-3); }

.result { display: block; padding: 0.7rem 0.25rem; border-bottom: 1px solid var(--line); color: var(--ink); }
.result:hover { background: var(--tint); text-decoration: none; }
.result b { color: var(--brand); margin-right: 0.5rem; }
.result small { display: block; color: var(--ink-3); }
.trial-head h2 { font-size: 1.3rem; }
.badges { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0 1rem; }
.badge { font-size: 0.78rem; padding: 0.2rem 0.6rem; border-radius: 999px; background: #ece8fb; color: var(--brand-dark); font-weight: 500; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.75rem; margin: 0.75rem 0 0.5rem; }
.fact { border: 1px solid var(--line); border-radius: 10px; padding: 0.75rem 0.9rem; background: var(--tint); }
.fact b { display: block; font-size: 1.3rem; }
.fact span { font-size: 0.82rem; color: var(--ink-2); }
.fact small { display: block; color: var(--ink-3); font-size: 0.78rem; margin-top: 0.15rem; }
.toggle { font-size: 0.86rem; color: var(--ink-2); display: inline-flex; gap: 0.4rem; align-items: center; margin: 0.25rem 0 0.5rem; }
.old { color: var(--ink-3); text-decoration: line-through; }
.error { color: #b42318; }
.prose { max-width: 50rem; }
.prose li { margin-bottom: 0.45rem; }

.site-footer { background: #0f0a1e; color: rgba(255,255,255,0.6); padding: 2.5rem 0; font-size: 0.85rem; }
.site-footer .container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { color: rgba(255,255,255,0.6); }
.footer-links a:hover { color: #fff; }

@media (max-width: 760px) {
  .site-nav { display: none; position: absolute; top: 72px; left: 0; right: 0; background: #fff; flex-direction: column;
    gap: 0; border-bottom: 1px solid var(--line); }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 0.9rem 1.25rem; width: 100%; }
  .nav-toggle { display: block; }
  .intro h1 { font-size: 1.6rem; }
  .panel { padding: 1.1rem 1rem; }
  .chart-box, .chart-box.tall { height: 320px; }
  .search { flex-direction: column; }
}
