/* =========================================================================
   Build-A-Politician
   Design system. Three colors, one typeface, flat surfaces, real spacing.
   Every class used anywhere in the site is defined here once.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Palette */
  --red: #b22234;
  --red-dark: #8e1a29;
  --red-soft: #fdf2f3;
  --navy: #233c56;
  --navy-dark: #182a3d;
  --navy-soft: #f2f5f8;
  --white: #ffffff;

  /* Surfaces */
  --bg: var(--white);
  --panel: var(--white);
  --panel-alt: #f7f9fb;
  --line: #e2e8ef;
  --line-strong: #cbd6e0;

  /* Text */
  --text: var(--navy);
  --text-soft: #5d7186;
  --text-faint: #8496a8;

  /* Feedback */
  --good: #2f7a4d;
  --good-soft: #eef7f1;
  --warn: #9a6a10;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  --shadow: 0 1px 2px rgba(35, 60, 86, 0.06), 0 4px 12px rgba(35, 60, 86, 0.06);
  --shadow-lift: 0 2px 4px rgba(35, 60, 86, 0.08), 0 10px 24px rgba(35, 60, 86, 0.10);

  --wrap: 1040px;
}

[data-theme="dark"] {
  --bg: #16222f;
  --panel: #1e2d3d;
  --panel-alt: #24354a;
  --line: #33475e;
  --line-strong: #43596f;
  --text: #eef3f8;
  --text-soft: #a8bbcd;
  --text-faint: #8ba0b5;
  --navy-soft: #24354a;
  --red-soft: #3a2028;
  --good-soft: #1f3a2c;
  --shadow: 0 1px 2px rgba(0,0,0,0.30), 0 4px 12px rgba(0,0,0,0.24);
  --shadow-lift: 0 2px 4px rgba(0,0,0,0.34), 0 10px 24px rgba(0,0,0,0.30);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

img, svg { max-width: 100%; display: block; }
a { color: var(--red); }

h1, h2, h3, h4 {
  margin: 0 0 .5rem;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
}
h1 { font-size: 2rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.0625rem; }
h4 { font-size: .9375rem; }

p { margin: 0 0 1rem; color: var(--text-soft); }
p:last-child { margin-bottom: 0; }

.container { width: min(var(--wrap), calc(100% - 3rem)); margin: 0 auto; }
.narrow { max-width: 660px; }

.lead { font-size: 1.0625rem; color: var(--text-soft); }
.muted { color: var(--text-soft); }
.small { font-size: .875rem; }
.tiny { font-size: .8125rem; color: var(--text-faint); }
.eyebrow {
  font-size: .75rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-faint); margin: 0 0 .5rem;
}

:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--navy); color: #fff; padding: .75rem 1.25rem;
  text-decoration: none; font-weight: 600;
}
.skip-link:focus { left: 0; }

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

/* --------------------------------- Loader -------------------------------- */
.loading-screen {
  position: fixed; inset: 0; z-index: 999;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); transition: opacity .35s ease;
}
.loading-screen--hidden { opacity: 0; pointer-events: none; }
.loading-seal {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--red);
  animation: spin .8s linear infinite;
}
.loading-text { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------- Header -------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.nav-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; height: 58px;
}
.brand {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 600; font-size: .9375rem; color: var(--text);
  text-decoration: none; letter-spacing: -0.01em; white-space: nowrap;
}
.brand-mark { width: 22px; height: 22px; }

.nav-links {
  display: flex; align-items: center; gap: .25rem;
  list-style: none; margin: 0; padding: 0;
}
.nav-links a {
  display: block; padding: .4rem .7rem; border-radius: var(--r-sm);
  font-size: .875rem; font-weight: 500; color: var(--text-soft);
  text-decoration: none; transition: background .15s, color .15s;
}
.nav-links a:hover { background: var(--navy-soft); color: var(--text); }
.nav-links a[aria-current="page"] { color: var(--text); font-weight: 600; }

.nav-tools { display: flex; align-items: center; gap: .35rem; }
.icon-toggle, .theme-pill {
  height: 32px; padding: 0 .65rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel); color: var(--text-soft);
  font-family: var(--font); font-size: .8125rem; font-weight: 500;
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.icon-toggle:hover, .theme-pill:hover { border-color: var(--line-strong); color: var(--text); }
.icon-toggle.is-on { background: var(--navy); border-color: var(--navy); color: #fff; }
.nav-burger {
  display: none; width: 34px; height: 32px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel); color: var(--text); cursor: pointer;
  font-size: 1rem; line-height: 1;
}

/* -------------------------------- Buttons -------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .625rem 1.125rem; border: 1px solid transparent; border-radius: var(--r-sm);
  background: var(--red); color: #fff;
  font-family: var(--font); font-size: .9375rem; font-weight: 600; line-height: 1.2;
  text-decoration: none; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { background: var(--red-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.secondary { background: var(--panel); border-color: var(--line-strong); color: var(--text); }
.btn.secondary:hover { background: var(--navy-soft); border-color: var(--line-strong); }
.btn.navy { background: var(--navy); }
.btn.navy:hover { background: var(--navy-dark); }
.btn.ghost { background: transparent; color: var(--text-soft); padding: .5rem .75rem; }
.btn.ghost:hover { background: var(--navy-soft); color: var(--text); }
.btn.large { padding: .8125rem 1.75rem; font-size: 1rem; }
.btn.small { padding: .4375rem .8125rem; font-size: .8125rem; }
.btn.block { width: 100%; }

/* legacy alias kept so nothing breaks if a page still uses it */
.btn.gold { background: var(--red); }
.btn.gold:hover { background: var(--red-dark); }

.button-row { display: flex; flex-wrap: wrap; gap: .5rem; }

/* --------------------------------- Cards --------------------------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.card-pad { padding: 1.5rem; }
.card-hover { transition: border-color .15s ease, box-shadow .15s ease; }
.card-hover:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }

.section { padding: 3.5rem 0; }
.section-tight { padding: 2.25rem 0; }
.stack > * + * { margin-top: 1rem; }
.mt-1 { margin-top: .75rem; } .mt-2 { margin-top: 1.5rem; } .mt-3 { margin-top: 2.5rem; }
.mb-1 { margin-bottom: .75rem; } .mb-2 { margin-bottom: 1.5rem; } .mb-3 { margin-bottom: 2.5rem; }
.text-center { text-align: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.divider { height: 1px; background: var(--line); border: 0; margin: 2rem 0; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------------------------------- Home --------------------------------- */
.hero { padding: 4.5rem 0 3rem; }
.hero-inner { display: grid; grid-template-columns: 1fr 300px; gap: 3.5rem; align-items: center; }
.hero h1 { font-size: 2.5rem; letter-spacing: -0.03em; margin-bottom: .75rem; }
.hero p { font-size: 1.0625rem; max-width: 38ch; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.75rem; }
.hero-art { width: 100%; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; counter-reset: step; }
.step { padding: 1.5rem; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--navy); color: #fff;
  font-size: .8125rem; font-weight: 600; margin-bottom: .75rem;
}
.step h3 { margin-bottom: .25rem; }
.step p { font-size: .9375rem; margin: 0; }

.band { background: var(--navy-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* --------------------------------- Forms --------------------------------- */
label { display: block; font-size: .875rem; font-weight: 500; color: var(--text); margin-bottom: .375rem; }
input[type="text"], input[type="number"], select, textarea {
  width: 100%; padding: .625rem .75rem;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--panel); color: var(--text);
  font-family: var(--font); font-size: .9375rem; line-height: 1.5;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(35, 60, 86, .12);
}
textarea { resize: vertical; min-height: 96px; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235d7186' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .75rem center; background-size: 12px;
  padding-right: 2rem;
}
.field { margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.input-row { display: flex; gap: .5rem; }
.input-row input { flex: 1; }

/* ---------------------------- Candidate creator -------------------------- */
.creator-layout { display: grid; grid-template-columns: 1fr 320px; gap: 2.5rem; align-items: start; }

.step-card { padding: 1.5rem; margin-bottom: 1rem; position: relative; scroll-margin-top: 80px; }
.step-card > .step-label {
  display: flex; align-items: baseline; gap: .625rem; margin-bottom: 1rem;
}
.step-label .num {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--navy-soft); border: 1px solid var(--line-strong);
  color: var(--text-soft); font-size: .75rem; font-weight: 600;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.step-card.is-complete .step-label .num {
  background: var(--good); border-color: var(--good); color: #fff;
}
.step-label h2 { font-size: 1.0625rem; margin: 0; }
.step-label .hint { font-size: .8125rem; color: var(--text-faint); margin-left: auto; }

/* Tile pickers */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.tiles.dense { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.tiles.scroll { max-height: 244px; overflow-y: auto; padding-right: .35rem; }
.tiles.scroll::-webkit-scrollbar { width: 6px; }
.tiles.scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }

.tile {
  text-align: left; cursor: pointer;
  padding: .625rem .75rem; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font-family: var(--font); font-size: .875rem; font-weight: 500; line-height: 1.35;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.tile:hover { border-color: var(--navy); }
.tile .tile-name { display: block; }
.tile .tile-blurb { display: block; font-size: .75rem; font-weight: 400; color: var(--text-faint); margin-top: .1875rem; }
.tile[aria-checked="true"] {
  background: var(--navy); border-color: var(--navy); color: #fff;
}
.tile[aria-checked="true"] .tile-blurb { color: rgba(255,255,255,.72); }

/* Age */
.age-value { font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.age-note { font-size: .875rem; color: var(--text-soft); margin: .375rem 0 1rem; }
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 99px; background: var(--line-strong);
  padding: 0; border: 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: var(--red); border: 3px solid var(--panel); cursor: pointer;
  box-shadow: 0 1px 4px rgba(35,60,86,.28);
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--red); border: 3px solid var(--panel); cursor: pointer;
}
.range-ends { display: flex; justify-content: space-between; font-size: .75rem; color: var(--text-faint); margin-top: .375rem; }

/* About box */
.prompt-list { display: flex; flex-wrap: wrap; gap: .375rem; margin-bottom: .75rem; }
.prompt-chip {
  padding: .3125rem .6875rem; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--text-soft);
  font-family: var(--font); font-size: .8125rem; font-weight: 500;
  transition: border-color .12s ease, color .12s ease;
}
.prompt-chip:hover { border-color: var(--navy); color: var(--text); }
.prompt-chip.used { border-color: var(--good); color: var(--good); }

#aboutInput { min-height: 168px; }

.meter-row { display: flex; align-items: center; gap: .75rem; margin-top: .75rem; }
.dots { display: flex; gap: .25rem; }
.dots i { width: 22px; height: 4px; border-radius: 99px; background: var(--line-strong); display: block; transition: background .2s ease; }
.dots i.filled { background: var(--red); }
.meter-note { font-size: .8125rem; color: var(--text-faint); }
.meter-note.good { color: var(--good); }
.meter-note.warn { color: var(--warn); }

/* Swatches */
.swatches { display: flex; gap: .5rem; flex-wrap: wrap; }
.color-swatch {
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
  padding: 0;
}
.color-swatch.selected { border-color: var(--navy); }

/* Rail */
.rail { position: sticky; top: 78px; display: flex; flex-direction: column; gap: 1rem; }
.progress-card { padding: 1.125rem 1.25rem; }
.progress-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: .625rem; }
.progress-top span:first-child { font-size: .875rem; font-weight: 600; }
.progress-pct { font-size: .875rem; font-weight: 600; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.bar { height: 5px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: var(--red); border-radius: 99px; transition: width .35s ease; }
.checklist { list-style: none; margin: .875rem 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .25rem .75rem; }
.checklist li { font-size: .8125rem; color: var(--text-faint); display: flex; align-items: center; gap: .375rem; }
.checklist li::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  border: 1px solid var(--line-strong); flex: none;
}
.checklist li.done { color: var(--text-soft); }
.checklist li.done::before { background: var(--good); border-color: var(--good); }

/* --------------------------- Candidate card ------------------------------ */
.candidate-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
}
/* Brief nudge when a choice changes the card, so a click feels answered. */
.candidate-card.pop { animation: pop .28s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.012); } 100% { transform: scale(1); } }
.candidate-card-banner { height: 6px; }
.candidate-card-body { padding: 1.25rem; }
.candidate-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; margin-bottom: .75rem;
  font-size: .9375rem; font-weight: 600; color: #fff;
}
.candidate-name { font-size: 1.125rem; margin: 0 0 .125rem; }
.candidate-party { font-size: .8125rem; color: var(--text-faint); }
.candidate-slogan { font-size: .9375rem; color: var(--text); margin: .625rem 0 0; }
.candidate-meta {
  display: grid; grid-template-columns: auto 1fr; gap: .3125rem .875rem;
  margin: 1rem 0 0; font-size: .8125rem;
}
.candidate-meta dt { color: var(--text-faint); }
.candidate-meta dd { margin: 0; color: var(--text); }
.candidate-about {
  font-size: .8125rem; line-height: 1.6; color: var(--text-soft);
  margin: 1rem 0 0; padding-top: .875rem; border-top: 1px solid var(--line);
}
.pill {
  display: inline-block; padding: .1875rem .5rem; border-radius: 99px;
  background: var(--navy-soft); border: 1px solid var(--line);
  font-size: .75rem; font-weight: 500; color: var(--text-soft);
}

/* --------------------------------- Tabs ---------------------------------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; }
.tab-btn {
  padding: .625rem .875rem; border: 0; background: none; cursor: pointer;
  font-family: var(--font); font-size: .875rem; font-weight: 500; color: var(--text-soft);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--text); font-weight: 600; border-bottom-color: var(--red); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ------------------------------- Opponents ------------------------------- */
.opponent-card {
  padding: 1.125rem; text-align: left; cursor: pointer; width: 100%;
  font-family: var(--font); color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.opponent-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.opponent-card.selected { border-color: var(--navy); box-shadow: 0 0 0 2px rgba(35,60,86,.14); }
.opponent-card h4 { margin: 0 0 .125rem; font-size: .9375rem; }
.opponent-card .candidate-party { display: block; margin-bottom: .5rem; }
.opponent-card p { font-size: .8125rem; margin: 0; }
.search-bar { margin-bottom: 1.25rem; max-width: 380px; }

/* ------------------------------- Simulator ------------------------------- */
.matchup { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1.25rem; align-items: center; }
.vs {
  font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint);
}

.run-panel { padding: 2rem 1.5rem; text-align: center; }
.run-panel h2 { margin-bottom: .25rem; }

.thinking { display: none; padding: 3rem 1rem; text-align: center; }
.thinking.active { display: block; }
.thinking-dots { display: inline-flex; gap: .375rem; margin-bottom: 1rem; }
.thinking-dots i {
  width: 8px; height: 8px; border-radius: 50%; background: var(--red); display: block;
  animation: bounce 1.2s ease-in-out infinite;
}
.thinking-dots i:nth-child(2) { animation-delay: .15s; }
.thinking-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,60%,100% { opacity: .28; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-5px); } }
.thinking-text { font-size: .9375rem; color: var(--text-soft); margin: 0; }

.result-block { display: none; }
.result-block.active { display: block; }

/* ------------------------------- Results --------------------------------- */
.results-layout { display: grid; grid-template-columns: 290px 1fr; gap: 2rem; align-items: start; }
.results-layout > .candidate-card { position: sticky; top: 78px; }

.verdict {
  padding: 2rem 1.5rem; text-align: center;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--navy-soft);
}
.verdict .outcome { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.025em; margin: 0 0 .375rem; }
.verdict .score { font-size: .9375rem; color: var(--text-soft); margin: 0; font-variant-numeric: tabular-nums; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.metric { padding: 1.125rem 1.25rem; }
.metric .value { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric .label { font-size: .8125rem; color: var(--text-faint); margin-top: .1875rem; }

.split { height: 26px; border-radius: var(--r-sm); overflow: hidden; display: flex; background: var(--line); }
.split > span {
  display: flex; align-items: center; justify-content: center; width: 0;
  font-size: .8125rem; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden;
  font-variant-numeric: tabular-nums;
  transition: width .6s cubic-bezier(.3,.9,.35,1);
}
.seg-a { background: var(--navy); }
.seg-b { background: var(--red); }
.seg-c { background: var(--line-strong); color: var(--text) !important; }
.legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: .625rem; font-size: .8125rem; color: var(--text-soft); }
.legend span { display: inline-flex; align-items: center; gap: .375rem; }
.legend i { width: 9px; height: 9px; border-radius: 2px; flex: none; }

.groups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.group-row { margin-bottom: .875rem; }
.group-row:last-child { margin-bottom: 0; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; font-size: .875rem; margin-bottom: .25rem; }
.group-head b { font-weight: 600; font-variant-numeric: tabular-nums; }
.group-track { height: 6px; border-radius: 99px; background: var(--line); position: relative; overflow: hidden; }
.group-track > span { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--navy); transition: width .6s ease; }
.group-track.high > span { background: var(--good); }
.group-track.low > span { background: var(--red); }
.group-note { font-size: .8125rem; color: var(--text-faint); margin: .3125rem 0 0; line-height: 1.5; }

.points { list-style: none; margin: 0; padding: 0; }
.points li { padding: .75rem 0; border-bottom: 1px solid var(--line); }
.points li:first-child { padding-top: 0; }
.points li:last-child { padding-bottom: 0; border-bottom: 0; }
.points b { display: block; font-size: .9375rem; font-weight: 600; margin-bottom: .1875rem; }
.points p { font-size: .8125rem; margin: 0; line-height: 1.55; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: grid; grid-template-columns: 52px 1fr; gap: .875rem;
  padding: .875rem 0; border-bottom: 1px solid var(--line);
}
.timeline li:first-child { padding-top: 0; }
.timeline li:last-child { padding-bottom: 0; border-bottom: 0; }
.swing {
  align-self: start; text-align: center; padding: .1875rem 0; border-radius: var(--r-sm);
  font-size: .8125rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.swing.up { background: var(--good-soft); color: var(--good); }
.swing.down { background: var(--red-soft); color: var(--red); }
.swing.flat { background: var(--navy-soft); color: var(--text-faint); }
.timeline b { display: block; font-size: .9375rem; font-weight: 600; margin-bottom: .1875rem; }
.timeline p { font-size: .8125rem; margin: 0; line-height: 1.55; }
.timeline .who { font-size: .75rem; color: var(--text-faint); margin-top: .25rem; display: block; }

/* Collapsible detail */
details.more { margin-top: .75rem; }
details.more > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: .3125rem;
  font-size: .8125rem; font-weight: 500; color: var(--red);
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "+"; font-weight: 600; }
details.more[open] > summary::after { content: "\2212"; }
details.more > summary:hover { text-decoration: underline; }
details.more .more-body { margin-top: .625rem; }

.notice {
  padding: .75rem 1rem; border-radius: var(--r-sm);
  background: var(--navy-soft); border: 1px solid var(--line);
  font-size: .875rem; color: var(--text-soft); margin-bottom: 1.5rem;
}
.tag {
  display: inline-block; padding: .1875rem .5rem; border-radius: 99px;
  background: var(--navy-soft); border: 1px solid var(--line);
  font-size: .75rem; color: var(--text-faint);
}
.footnote {
  font-size: .8125rem; color: var(--text-faint); text-align: center;
  border-top: 1px solid var(--line); padding-top: 1.25rem; margin-top: 2.5rem;
}

/* Empty states */
.empty { padding: 2.5rem 1.5rem; text-align: center; }
.empty h2 { font-size: 1.125rem; }
.empty p { margin-bottom: 1.25rem; }

.form-msg { font-size: .875rem; font-weight: 500; margin: .875rem 0 0; }
.form-msg.error { color: var(--red); }
.form-msg.ok { color: var(--good); }

/* Confetti kept minimal */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.confetti-piece {
  position: absolute; top: -10px; width: 7px; height: 11px; border-radius: 1px;
  animation-name: fall; animation-timing-function: ease-in; animation-fill-mode: forwards;
}
@keyframes fall {
  0% { transform: translate(0,0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--drift), 105vh) rotate(var(--rot)); opacity: 0; }
}

/* --------------------------------- Footer -------------------------------- */
.site-footer {
  border-top: 1px solid var(--line); margin-top: 4rem;
  padding: 1.75rem 0; background: var(--panel);
}
.footer-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.footer-links { display: flex; gap: 1.125rem; list-style: none; margin: 0; padding: 0; }
.footer-links a { font-size: .8125rem; color: var(--text-soft); text-decoration: none; }
.footer-links a:hover { color: var(--text); text-decoration: underline; }
.footer-note { font-size: .8125rem; color: var(--text-faint); }

/* ------------------------------- Responsive ------------------------------ */
@media (max-width: 940px) {
  .creator-layout, .results-layout { grid-template-columns: 1fr; }
  .rail, .results-layout > .candidate-card { position: static; }
  .hero-inner { grid-template-columns: 1fr; gap: 2rem; }
  .hero-art { max-width: 260px; }
  .metrics, .groups, .steps, .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .matchup { grid-template-columns: 1fr; justify-items: stretch; }
  .vs { text-align: center; }
}

@media (max-width: 680px) {
  .container { width: calc(100% - 2rem); }
  h1 { font-size: 1.625rem; }
  .hero { padding: 2.5rem 0 2rem; }
  .hero h1 { font-size: 2rem; }
  .section { padding: 2.5rem 0; }
  .nav-links {
    position: absolute; top: 58px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--panel); border-bottom: 1px solid var(--line);
    padding: .5rem 1rem 1rem; display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .625rem .5rem; }
  .nav-burger { display: block; }
  .metrics, .groups, .steps, .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
  .checklist { grid-template-columns: 1fr; }
  .card-pad, .step-card, .run-panel { padding: 1.25rem; }
}

/* --------------------------------- Print --------------------------------- */
@media print {
  .site-header, .site-footer, .button-row, .nav-tools, .skip-link,
  .loading-screen, .confetti-layer, .run-panel, .thinking { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .candidate-card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
  details.more { display: block; }
  details.more > summary { display: none; }
  details.more .more-body { display: block !important; }
}
