/* ============================================================
   MPG Versus — design tokens
   Chart series colours come from the validated dataviz palette
   (slots 1–4, light & dark steps checked against these surfaces).
   ============================================================ */
:root {
  color-scheme: light;
  --bg: #f4f4f1;
  --surface: #ffffff;
  --surface-2: #f3f3ef;
  --surface-3: #eaeae4;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #7b7a74;
  --line: #e4e3dc;
  --line-2: #d0cfc7;
  --brand: #0f766e;
  --brand-2: #0b5c55;
  --brand-soft: #e2f1ee;
  --brand-ink: #ffffff;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --sm: #9c9b94;
  --s1-soft: #e8f0fb;
  --s2-soft: #fdeee6;
  --good: #006300;
  --good-bg: #e3f3e3;
  --bad: #b3261e;
  --grid: #ecebe5;
  --axis: #c3c2b7;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-1: 0 1px 2px rgba(20, 20, 16, .05), 0 0 0 1px rgba(20, 20, 16, .04);
  --shadow-2: 0 12px 32px -12px rgba(20, 20, 16, .18), 0 0 0 1px rgba(20, 20, 16, .05);
  --hero: radial-gradient(1200px 500px at 10% -10%, rgba(15, 118, 110, .16), transparent 60%),
          radial-gradient(900px 480px at 100% 0%, rgba(42, 120, 214, .14), transparent 60%);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0d0d0d; --surface: #1a1a19; --surface-2: #222220; --surface-3: #2c2c2a;
    --ink: #ffffff; --ink-2: #c3c2b7; --muted: #929089; --line: #2c2c2a; --line-2: #3a3a37;
    --brand: #2dd4bf; --brand-2: #5eead4; --brand-soft: #0f2f2b; --brand-ink: #04201c;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --sm: #6f6e68;
    --s1-soft: #16253a; --s2-soft: #34200f;
    --good: #0ca30c; --good-bg: #122812; --bad: #e66767; --grid: #262624; --axis: #383835;
    --shadow-1: 0 0 0 1px rgba(255, 255, 255, .06); --shadow-2: 0 12px 32px -12px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .07);
    --hero: radial-gradient(1200px 500px at 10% -10%, rgba(45, 212, 191, .12), transparent 60%),
            radial-gradient(900px 480px at 100% 0%, rgba(57, 135, 229, .14), transparent 60%);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d; --surface: #1a1a19; --surface-2: #222220; --surface-3: #2c2c2a;
  --ink: #ffffff; --ink-2: #c3c2b7; --muted: #929089; --line: #2c2c2a; --line-2: #3a3a37;
  --brand: #2dd4bf; --brand-2: #5eead4; --brand-soft: #0f2f2b; --brand-ink: #04201c;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --sm: #6f6e68;
  --s1-soft: #16253a; --s2-soft: #34200f;
  --good: #0ca30c; --good-bg: #122812; --bad: #e66767; --grid: #262624; --axis: #383835;
  --shadow-1: 0 0 0 1px rgba(255, 255, 255, .06); --shadow-2: 0 12px 32px -12px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .07);
  --hero: radial-gradient(1200px 500px at 10% -10%, rgba(45, 212, 191, .12), transparent 60%),
          radial-gradient(900px 480px at 100% 0%, rgba(57, 135, 229, .14), transparent 60%);
}

/* ============================================================ base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body { margin: 0; overflow-x: clip; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.022em; font-weight: 750; }
h1 { font-size: clamp(1.9rem, 4.6vw, 3rem); margin: .15em 0 .4em; }
h2 { font-size: clamp(1.2rem, 2.4vw, 1.45rem); margin: 0 0 .85rem; }
h3 { font-size: 1.02rem; margin: 0 0 .5rem; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
small, .small { font-size: .875rem; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.fine { color: var(--muted); font-size: .8rem; margin: .75rem 0 0; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-bottom: 64px; }
main > * + *, article > * + * { margin-top: 28px; }
.narrow { max-width: 760px; }
.center { margin-left: auto; margin-right: auto; }
.num, .tnum { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ============================================================ header */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; gap: 14px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.logo { display: inline-flex; align-items: center; gap: 4px; font-weight: 850; font-size: 1.15rem; color: var(--ink); letter-spacing: -.02em; text-decoration: none !important; }
.logo-mark { background: linear-gradient(135deg, var(--brand), #2a78d6); color: #fff; padding: 2px 8px; border-radius: 9px; }
.logo-vs { color: var(--s2); font-style: italic; }
.main-nav { display: flex; gap: 2px; }
.main-nav a { color: var(--ink-2); padding: 7px 11px; border-radius: 10px; font-weight: 550; font-size: .95rem; }
.main-nav a:hover, .main-nav a[aria-current] { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.header-tools { order: 3; display: flex; align-items: center; gap: 8px; }
.header-row .header-search { order: 2; flex: 1 1 160px; max-width: 340px; margin-left: auto; }
.seg-toggle { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-toggle button { border: 0; background: none; color: var(--ink-2); font: 600 .78rem var(--font); padding: 6px 8px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.seg-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-dark { display: none; }
:root[data-theme="dark"] .theme-dark { display: block; } :root[data-theme="dark"] .theme-light { display: none; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .theme-dark { display: block; } :root:where(:not([data-theme="light"])) .theme-light { display: none; } }
@media (max-width: 980px) {
  .header-tools { margin-left: auto; }
  .header-row .header-search { order: 5; flex: 1 1 100%; max-width: none; margin-left: 0; }
}
@media (max-width: 640px) {
  .main-nav { order: 4; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .main-nav a { padding: 6px 9px; font-size: .9rem; }
  .seg-toggle button { padding: 6px 6px; font-size: .72rem; }
}
.crumbs { font-size: .84rem; color: var(--muted); padding-top: 18px; }
.crumbs a { color: var(--muted); }
.crumbs span[aria-hidden] { margin: 0 4px; opacity: .6; }

/* ============================================================ primitives */
.card { background: var(--surface); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-1); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.card-head a { font-size: .9rem; font-weight: 600; }
@media (max-width: 600px) { .card { padding: 18px 16px; border-radius: 16px; } }
.eyebrow { text-transform: uppercase; letter-spacing: .09em; font-size: .72rem; font-weight: 750; color: var(--muted); margin: 0; }
.eyebrow a { color: inherit; }
.lede { font-size: 1.1rem; color: var(--ink-2); max-width: 780px; margin: 0; line-height: 1.65; }
.page-head { padding-top: 10px; }
.section-h { margin: 8px 0 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 12px; padding: 12px 22px; font: 700 1rem var(--font); cursor: pointer; text-decoration: none !important; transition: transform .12s, filter .12s; }
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); font-weight: 600; padding: 9px 14px; font-size: .92rem; }
.btn-ghost svg { width: 16px; height: 16px; }
.btn-ghost[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-2); }
.btn-link { background: none; border: 0; color: var(--brand); font: 600 .875rem var(--font); cursor: pointer; padding: 6px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.side-a { color: var(--s1); }
.side-b { color: var(--s2); }
.vs-word { font-style: italic; font-weight: 800; color: var(--muted); }
.good { color: var(--good); }
.bad { color: var(--bad); }

.badge { display: inline-block; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; vertical-align: middle; letter-spacing: .01em; }
.badge-ev { background: #dff0ff; color: #0b5394; }
.badge-phev { background: #ece6ff; color: #5a2fb8; }
.badge-hybrid { background: #e2f5ea; color: #13673a; }
.badge-mild { background: #eef3dd; color: #4d6414; }
.badge-diesel { background: #f4ece2; color: #7a4b16; }
.badge-ffv, .badge-bifuel { background: #fbf1d8; color: #7c5a05; }
.badge-cng { background: #def2f1; color: #0f5d5d; }
.badge-fcv { background: #e5ebff; color: #2941a3; }
:root[data-theme="dark"] .badge-ev, :root[data-theme="dark"] .badge-phev, :root[data-theme="dark"] .badge-hybrid, :root[data-theme="dark"] .badge-mild,
:root[data-theme="dark"] .badge-diesel, :root[data-theme="dark"] .badge-ffv, :root[data-theme="dark"] .badge-bifuel, :root[data-theme="dark"] .badge-cng, :root[data-theme="dark"] .badge-fcv { background: var(--surface-3); color: var(--ink-2); }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .badge:not(.badge-gas) { background: var(--surface-3); color: var(--ink-2); }
}

/* forms */
input[type="search"], input[type="number"], input[type="text"], select {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 12px; padding: 10px 12px; min-height: 44px; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.field { display: flex; flex-direction: column; gap: 5px; font-size: .82rem; color: var(--ink-2); font-weight: 600; }
.field small { font-weight: 400; color: var(--muted); }
.shake { animation: shake .35s; border-color: var(--bad) !important; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* picker (model search) */
.picker { position: relative; flex: 1; min-width: 0; }
.picker-row { display: flex; gap: 6px; }
.picker-row input { flex: 1; min-width: 0; }
.picker-year { width: auto; flex: 0 0 auto; min-width: 90px; }
.picker-list { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; text-align: left;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-2); max-height: 380px; overflow: auto; }
.picker-list li { padding: 9px 11px; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; }
.picker-list li small { color: var(--muted); }
.picker-list li.active, .picker-list li:hover { background: var(--surface-2); }
.kbd { font: 600 .7rem var(--font); color: var(--muted); border: 1px solid var(--line-2); border-radius: 6px; padding: 1px 6px; }

/* ============================================================ hero */
.hero { position: relative; padding: 56px 0 12px; text-align: center; }
.hero::before { content: ""; position: absolute; inset: -40px -50vw 0; background: var(--hero); z-index: -1; pointer-events: none; }
.hero .lede { margin: 0 auto; }
.hero h1 { font-size: clamp(2.1rem, 6vw, 3.6rem); letter-spacing: -.035em; }
.grad { background: linear-gradient(100deg, var(--brand), var(--s1)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-compare { display: flex; align-items: center; gap: 12px; max-width: 900px; margin: 28px auto 0; background: var(--surface); padding: 12px; border-radius: 20px; box-shadow: var(--shadow-2); }
.hero-compare .picker input, .hero-compare .picker-year, .hero-compare .btn { min-height: 52px; }
.hero-compare .picker input { font-size: 1.02rem; border-color: transparent; background: var(--surface-2); }
.hero-compare .picker-year { background: var(--surface-2); border-color: transparent; }
@media (max-width: 760px) { .hero-compare { flex-direction: column; align-items: stretch; } .hero-compare .vs-word { text-align: center; } }
.hero-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 30px; padding: 0; list-style: none; color: var(--muted); margin: 26px 0 0; font-size: .95rem; }
.hero-stats strong { color: var(--ink); font-size: 1.2rem; font-weight: 750; }

/* garage (my car + recently viewed, filled by app.js) */
.garage { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; margin-top: 18px; font-size: .9rem; }
.garage .chip-list a { background: var(--surface); }
.garage-label { color: var(--muted); font-weight: 600; }

/* personal banner: "vs your car" */
.mycar-banner > span { flex: 1; min-width: 0; }
.mycar-banner { display: flex; gap: 12px; align-items: center; background: linear-gradient(90deg, var(--brand-soft), transparent); border-radius: var(--radius-sm); padding: 12px 16px; font-weight: 550; }
.mycar-banner svg { width: 20px; height: 20px; color: var(--brand); flex: none; }
.mycar-banner a { font-weight: 700; }

/* ============================================================ grids & cards */
.grid-2 { display: grid; gap: 20px; grid-template-columns: 1fr 1fr; }
.grid-3-2 { display: grid; gap: 20px; grid-template-columns: 3fr 2fr; }
@media (max-width: 880px) { .grid-2, .grid-3-2 { grid-template-columns: 1fr; } }
.pop-grid, .tile-grid, .rival-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pop, .tile, .rival { display: flex; flex-direction: column; gap: 5px; background: var(--surface); border-radius: 16px; padding: 16px 18px; color: var(--ink); box-shadow: var(--shadow-1); transition: box-shadow .15s, transform .15s; min-width: 0; }
.pop:hover, .tile:hover, .rival:hover { text-decoration: none; box-shadow: var(--shadow-2); transform: translateY(-2px); }
.pop-seg, .tile span, .rival-meta { font-size: .8rem; color: var(--muted); }
.pop-names { font-weight: 750; line-height: 1.3; letter-spacing: -.01em; }
.pop-names em { color: var(--muted); font-weight: 600; font-style: italic; }
.pop-meta { font-size: .85rem; color: var(--ink-2); }
.pop-bar { display: flex; gap: 3px; height: 6px; margin-top: 6px; }
.pop-bar i { display: block; border-radius: 3px; }
.pop-bar .a { background: var(--s1); } .pop-bar .b { background: var(--s2); }
.tile strong { font-size: 1.02rem; letter-spacing: -.01em; }
.tile .tile-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 6px; }
.tile .tile-icon svg { width: 20px; height: 20px; }
.top1 { font-weight: 650; color: var(--brand) !important; }
.rival-name { font-weight: 700; }
.rival-delta { font-size: .82rem; font-weight: 650; }
.rank-list { margin: 0; padding: 0; list-style: none; counter-reset: r; }
.rank-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); counter-increment: r; }
.rank-list li::before { content: counter(r); width: 26px; height: 26px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: var(--ink-2); flex: none; }
.rank-list .rank-v { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.more { display: inline-block; margin-top: 12px; font-weight: 650; font-size: .92rem; }
.link-list { margin: 0; padding: 0; list-style: none; }
.link-list li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.link-list li:last-child { border: 0; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.chip-list a, .chip-list button { display: inline-block; padding: 7px 13px; background: var(--surface); border-radius: 999px; color: var(--ink); font: 550 .88rem var(--font); box-shadow: var(--shadow-1); border: 0; cursor: pointer; }
.chip-list a:hover { box-shadow: var(--shadow-2); text-decoration: none; }
.chip-list small { color: var(--muted); margin-left: 4px; }
.chip-list a[aria-current] { background: var(--ink); color: var(--surface); }
.years-chips a { font-variant-numeric: tabular-nums; padding: 6px 11px; }
.two-col { display: grid; gap: 20px; grid-template-columns: 1fr 1fr; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }
.related { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.related a { display: block; padding: 14px 16px; background: var(--surface-2); border-radius: 14px; color: var(--ink); font-weight: 650; }
.related a small { display: block; color: var(--muted); font-weight: 500; }
.related a:hover { background: var(--surface-3); text-decoration: none; }

/* stat tiles */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--surface); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 3px; box-shadow: var(--shadow-1); min-width: 0; }
.stat-k { font-size: .76rem; font-weight: 650; color: var(--muted); }
.stat-v { font-size: clamp(1.35rem, 3vw, 1.85rem); font-weight: 780; letter-spacing: -.02em; line-height: 1.2; }
.stat-v small { font-size: .9rem; font-weight: 600; color: var(--muted); }
.stat-s { font-size: .8rem; color: var(--muted); }
.stat-accent { background: linear-gradient(160deg, var(--brand-soft), var(--surface) 70%); }

/* year navigation */
.year-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.year-nav a { padding: 6px 12px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-1); color: var(--ink); font-size: .88rem; font-weight: 600; }
.year-nav a:hover { text-decoration: none; box-shadow: var(--shadow-2); }

/* ============================================================ calculator */
.prices { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: end; }
.calc-out { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin-top: 18px; }
.calc-out:empty { display: none; }
@media (max-width: 600px) { .calc-out { grid-template-columns: 1fr; } }
.sum { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 14px; }
.sum.side-a { background: var(--s1-soft); } .sum.side-b { background: var(--s2-soft); }
.sum strong, .sum span { color: var(--ink); }
.sum span { font-size: .92rem; font-variant-numeric: tabular-nums; }
.big-out { font-size: clamp(2rem, 6vw, 2.8rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.out-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 16px; }
.out-grid div { background: var(--surface-2); border-radius: 14px; padding: 14px; }
.out-grid b { display: block; font-size: 1.35rem; letter-spacing: -.02em; }
.out-grid span { font-size: .8rem; color: var(--muted); }

/* ============================================================ vs */
.vs-hero { padding-top: 10px; }
.vs-hero h1 { font-size: clamp(1.7rem, 4.6vw, 2.8rem); }
.duel { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .duel { grid-template-columns: 1fr; } }
.duel-card { position: relative; background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-1); display: flex; flex-direction: column; gap: 9px; overflow: hidden; }
.duel-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; }
.duel-card.side-a::before { background: var(--s1); }
.duel-card.side-b::before { background: var(--s2); }
.duel-card.is-winner { box-shadow: 0 0 0 2px var(--good), var(--shadow-2); }
.duel-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.duel-name { font-weight: 780; font-size: 1.12rem; color: var(--ink); letter-spacing: -.01em; }
.duel-cost { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.duel-cost span { font-size: clamp(2.2rem, 6vw, 3rem); font-weight: 820; letter-spacing: -.035em; }
.duel-cost small { color: var(--muted); }
.bar { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 100%; border-radius: 99px; transition: width .35s ease; }
.side-a .bar span { background: var(--s1); } .side-b .bar span { background: var(--s2); }
.duel-eff { font-weight: 700; color: var(--ink-2); }
.cfg-single { margin: 0; font-size: .85rem; }
.winner-flag { display: none; position: absolute; top: 14px; right: 16px; background: var(--good); color: #fff; font-size: .72rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; }
.duel-card.is-winner .winner-flag { display: inline-flex; gap: 4px; }
.duel-card.is-winner .duel-top .badge { visibility: hidden; }
.verdict { font-size: 1.12rem; font-weight: 550; background: var(--surface); box-shadow: var(--shadow-1); border-radius: var(--radius-sm); padding: 16px 20px; margin-bottom: 0; }
.verdict::before { content: "⚡"; margin-right: 8px; }

/* butterfly comparison table */
.duel-table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.duel-table th, .duel-table td { padding: 11px 8px; border-bottom: 1px solid var(--line); }
.duel-table thead th { font-size: .9rem; font-weight: 750; padding-bottom: 12px; }
.duel-table thead th:first-child { text-align: right; } .duel-table thead th:last-child { text-align: left; }
.duel-table th[scope="row"] { font-size: .8rem; font-weight: 650; color: var(--muted); text-align: center; width: 24%; line-height: 1.3; }
.duel-table td { width: 38%; }
.duel-table td.ca { text-align: right; } .duel-table td.cb { text-align: left; }
.dv { font-weight: 650; }
.db { display: block; height: 8px; margin-top: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.db i { display: block; height: 100%; border-radius: 99px; transition: width .35s ease; }
.ca .db i { background: var(--s1); margin-left: auto; } .cb .db i { background: var(--s2); }
td.win .dv { color: var(--good); }
td.win .dv::after { content: " ✓"; }
.ca.win .dv::after { content: ""; } .ca.win .dv::before { content: "✓ "; }
@media (max-width: 600px) { .duel-table th[scope="row"] { font-size: .72rem; width: 28%; } .duel-table td { font-size: .9rem; } }

/* ============================================================ tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
table.data { width: 100%; border-collapse: collapse; }
.data th, .data td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data td.num, .data th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.data thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; font-weight: 700; }
.data tbody tr { transition: background .1s; }
.data tbody tr:hover { background: var(--surface-2); }
.data tr.hl { background: var(--s1-soft); }
.sortable th[data-sort] { cursor: pointer; user-select: none; }
.sortable th[aria-sort="ascending"]::after { content: " ▲"; }
.sortable th[aria-sort="descending"]::after { content: " ▼"; }
.table-filter { margin-bottom: 14px; max-width: 360px; }
@media (max-width: 600px) { .data th, .data td { padding: 9px 8px; } }
.specs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 28px; margin: 0; }
.specs div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 9px 0; }
.specs dt { color: var(--muted); font-size: .92rem; }
.specs dd { margin: 0; font-weight: 650; text-align: right; }
.fa-table td:first-child { font-weight: 650; }

/* ============================================================ bars (rankings, leaderboards) */
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.hbar { display: grid; grid-template-columns: minmax(120px, 34%) 1fr auto; gap: 12px; align-items: center; padding: 6px 8px; border-radius: 10px; }
.hbar:hover { background: var(--surface-2); }
.hbar .hb-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .92rem; }
.hbar .hb-name small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.hbar .hb-rank { display: inline-block; min-width: 34px; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .8rem; font-weight: 700; }
.hb-track { position: relative; height: 12px; }
.hb-track i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--s1); border-radius: 0 4px 4px 0; }
.hbar .hb-val { font-weight: 700; font-variant-numeric: tabular-nums; font-size: .9rem; min-width: 64px; text-align: right; }
.hbar.hl { background: var(--s1-soft); }
.hbar.hl .hb-name { color: var(--ink); }
.hbars.emph .hbar:not(.hl) .hb-track i { background: var(--sm); }
.hbar.gap { grid-template-columns: 1fr; color: var(--muted); padding: 0 8px; font-size: .8rem; letter-spacing: .2em; }
.hb-median { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink-2); border-radius: 1px; }
.board-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: 10px; }
.board-legend i { display: inline-block; width: 14px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
@media (max-width: 600px) {
  .hbar { grid-template-columns: 1fr auto; grid-template-areas: "name name" "track val"; gap: 4px 10px; padding: 8px; }
  .hbar .hb-name { grid-area: name; white-space: normal; }
  .hbar .hb-track { grid-area: track; }
  .hbar .hb-val { grid-area: val; min-width: 0; }
  .hbar.gap { grid-template-areas: none; }
}

/* histogram (stacked columns) */
.cols { display: flex; align-items: flex-end; gap: 2px; height: 200px; padding: 0 0 0 34px; position: relative; border-bottom: 1px solid var(--axis); }
.cols .col { flex: 1; display: flex; flex-direction: column-reverse; gap: 2px; height: 100%; justify-content: flex-start; cursor: default; }
.cols .col i { display: block; width: 100%; max-width: 24px; margin: 0 auto; }
.cols .col .g { background: var(--s1); }
.cols .col .h { background: var(--s2); border-radius: 4px 4px 0 0; }
.cols .col .g:last-child { border-radius: 4px 4px 0 0; }
.cols .col:hover i { filter: brightness(1.12); }
.cols-y { position: absolute; left: 0; top: 0; bottom: 0; width: 30px; }
.cols-y span { position: absolute; right: 4px; transform: translateY(50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cols-y span::after { content: ""; position: absolute; left: 34px; width: 3000px; max-width: calc(100vw); border-top: 1px solid var(--grid); top: 50%; z-index: -1; }
.cols-x { display: flex; gap: 2px; padding-left: 34px; margin-top: 6px; }
.cols-x span { flex: 1; font-size: 11px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }

/* ============================================================ charts (app.js) */
.chart-card .chart { position: relative; width: 100%; min-height: 120px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis line { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart text { fill: var(--muted); font: 500 11.5px var(--font); font-variant-numeric: tabular-nums; }
.chart text.end-label { fill: var(--ink-2); font-weight: 650; font-size: 12px; }
.chart .ln { fill: none; stroke-width: 2px; stroke-linejoin: round; stroke-linecap: round; }
.chart .band { opacity: .12; }
.chart .dot { stroke: var(--surface); stroke-width: 2px; }
.chart .xh { stroke: var(--ink-2); stroke-width: 1; opacity: .5; }
.chart .hl-line { stroke: var(--s1); stroke-width: 1; opacity: .35; }
.chart .area { stroke: var(--surface); stroke-width: 2px; }
.c1 { stroke: var(--s1); } .f1 { fill: var(--s1); }
.c2 { stroke: var(--s2); } .f2 { fill: var(--s2); }
.c3 { stroke: var(--s3); } .f3 { fill: var(--s3); }
.c4 { stroke: var(--s4); } .f4 { fill: var(--s4); }
.cm { stroke: var(--sm); } .fm { fill: var(--sm); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 0 0 12px; padding: 0; font-size: .84rem; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.legend .k-line { width: 16px; height: 0; border-top-width: 2px; border-top-style: solid; border-radius: 1px; }
.legend .k-rect { width: 12px; height: 12px; border-radius: 3px; }
.legend .k-band { width: 16px; height: 10px; border-radius: 2px; opacity: .25; }
.k1 { border-color: var(--s1); background: var(--s1); } .k2 { border-color: var(--s2); background: var(--s2); }
.k3 { border-color: var(--s3); background: var(--s3); } .k4 { border-color: var(--s4); background: var(--s4); }
.km { border-color: var(--sm); background: var(--sm); }
.legend .k-line { background: none !important; }
.tview { margin-top: 10px; font-size: .88rem; }
.tview summary { cursor: pointer; color: var(--brand); font-weight: 600; width: max-content; }
.tview .table-scroll { max-height: 320px; overflow: auto; margin-top: 8px; }
.tview table td, .tview table th { padding: 6px 10px; }
.chart-note { font-size: .8rem; color: var(--muted); margin-top: 8px; }

/* tooltip */
.tt { position: fixed; z-index: 100; pointer-events: none; background: var(--surface); color: var(--ink); border-radius: 12px; box-shadow: var(--shadow-2); padding: 10px 12px; font-size: .82rem; min-width: 150px; max-width: 280px; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; }
.tt.on { opacity: 1; transform: none; }
.tt-t { font-weight: 700; color: var(--ink-2); margin-bottom: 4px; font-size: .78rem; }
.tt-r { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.tt-r b { font-weight: 750; color: var(--ink); font-variant-numeric: tabular-nums; }
.tt-r span { color: var(--muted); margin-left: auto; padding-left: 10px; text-align: right; }
.tt-k { width: 12px; height: 0; border-top-width: 2px; border-top-style: solid; flex: none; background: none !important; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--surface); padding: 10px 18px; border-radius: 12px; font-weight: 600; font-size: .9rem; opacity: 0; transition: opacity .2s, transform .2s; z-index: 120; pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================ prose & faq */
.prose { max-width: 780px; }
.prose p, .prose li { color: var(--ink-2); font-size: 1.04rem; }
.prose h2 { margin-top: 1.6em; }
.prose strong { color: var(--ink); }
.callout { background: var(--brand-soft); border-radius: var(--radius-sm); padding: 16px 20px; color: var(--ink); }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--muted); font-weight: 500; font-size: 1.2rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq p { margin: 10px 0 0; color: var(--ink-2); }

/* ============================================================ footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding: 44px 0 24px; margin-top: 24px; }
.footer-grid { display: grid; gap: 28px; grid-template-columns: 1.4fr repeat(4, 1fr); }
@media (max-width: 960px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }
.footer-grid a:not(.logo) { display: block; padding: 4px 0; color: var(--ink-2); font-size: .9rem; }
.footer-grid a:not(.logo):hover { color: var(--ink); }
.footer-h { font-size: .74rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 0 0 10px; font-weight: 750; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
