:root {
  --bg: #f4f1ea;
  --bg-surface: #fffdf8;
  --bg-raised: #ebe5d6;
  --text-primary: #1b1a17;
  --text-secondary: #46423a;
  --text-muted: #4e4839;
  --accent: #9a3b1c;
  --accent-strong: #7a2d13;
  --accent-ink: #ffffff;
  --border: #d9d2c2;
  --border-strong: #b5ac96;
  --bar: #c9c0aa;
  --bar-hot: #9a3b1c;
  --bar-mark: #1b1a17;
  --shadow: 0 1px 3px rgba(30, 25, 10, 0.12);
  --focus: #1d5fae;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15140f; --bg-surface: #1e1c16; --bg-raised: #27241c;
    --text-primary: #f1ece0; --text-secondary: #d2cab6; --text-muted: #b1a992;
    --accent: #e9955f; --accent-strong: #f2ad7c; --accent-ink: #15140f;
    --border: #3a362b; --border-strong: #55503f;
    --bar: #4a4536; --bar-hot: #e9955f; --bar-mark: #f1ece0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.45); --focus: #7ab4ff;
  }
}
:root[data-theme="dark"] {
  --bg: #15140f; --bg-surface: #1e1c16; --bg-raised: #27241c;
  --text-primary: #f1ece0; --text-secondary: #d2cab6; --text-muted: #b1a992;
  --accent: #e9955f; --accent-strong: #f2ad7c; --accent-ink: #15140f;
  --border: #3a362b; --border-strong: #55503f;
  --bar: #4a4536; --bar-hot: #e9955f; --bar-mark: #f1ece0;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.45); --focus: #7ab4ff;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body { margin: 0; background: var(--bg); color: var(--text-primary); font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif; line-height: 1.6; }
a { color: var(--accent-strong); }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
section { scroll-margin-top: 3.8rem; }
.sans { font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; }

.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1rem; height: 3.1rem; padding: 0 1rem; background: var(--bg-surface); border-bottom: 1px solid var(--border); }
.topbar .home { font-family: -apple-system, sans-serif; font-size: 0.82rem; color: var(--text-secondary); text-decoration: none; white-space: nowrap; }
.topbar .home:hover { color: var(--accent-strong); }
.topnav { display: flex; gap: 1rem; overflow-x: auto; scrollbar-width: none; white-space: nowrap; font-family: -apple-system, sans-serif; font-size: 0.85rem; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { text-decoration: none; color: var(--text-secondary); padding: 0.3rem 0; }
.topnav a[aria-current="true"], .topnav a:hover { color: var(--accent-strong); border-bottom: 2px solid var(--accent-strong); }
.spacer { flex: 1; }
.chip { font-family: -apple-system, sans-serif; font-size: 0.78rem; text-decoration: none; color: var(--text-secondary); border: 1px solid var(--border-strong); border-radius: 999px; padding: 0.25rem 0.7rem; white-space: nowrap; }
.chip:hover { color: var(--accent-strong); border-color: var(--accent-strong); }
.icon-btn { width: 2rem; height: 2rem; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--bg-surface); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.icon-btn:hover { color: var(--accent-strong); border-color: var(--accent-strong); }
.icon-btn svg[hidden] { display: none; }

main { max-width: 44rem; margin: 0 auto; padding: 0 1.3rem; }
.hero { padding: 3.2rem 0 1rem; }
.kicker { font-family: -apple-system, sans-serif; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 0.6rem; }
h1 { font-size: clamp(2rem, 6vw, 3.1rem); line-height: 1.08; margin: 0 0 0.9rem; letter-spacing: -0.01em; }
.deck { font-size: 1.15rem; color: var(--text-secondary); margin: 0 0 0.6rem; }
.byline { font-family: -apple-system, sans-serif; font-size: 0.8rem; color: var(--text-muted); margin: 0; }
h2 { font-size: 1.55rem; line-height: 1.2; margin: 2.6rem 0 0.8rem; }
h3 { font-size: 1.1rem; margin: 1.6rem 0 0.4rem; }
p { margin: 0 0 1rem; }
.note { font-family: -apple-system, sans-serif; font-size: 0.86rem; color: var(--text-muted); }

/* Search */
.search { position: relative; margin: 0.6rem 0 1.2rem; }
.search label { display: block; font-family: -apple-system, sans-serif; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.35rem; }
.search input { width: 100%; font: inherit; font-size: 1.25rem; padding: 0.7rem 0.9rem; border: 2px solid var(--border-strong); border-radius: 0.6rem; background: var(--bg-surface); color: var(--text-primary); }
.search input::placeholder { color: var(--text-muted); }
.search input:focus { border-color: var(--accent); }
.listbox { position: absolute; left: 0; right: 0; z-index: 25; margin: 0.25rem 0 0; padding: 0.3rem 0; list-style: none; background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: 0.6rem; box-shadow: var(--shadow); max-height: 18rem; overflow-y: auto; }
.listbox[hidden] { display: none; }
.listbox li { padding: 0.5rem 0.9rem; cursor: pointer; display: flex; justify-content: space-between; gap: 1rem; font-size: 1rem; }
.listbox li .c { color: var(--text-muted); font-family: -apple-system, sans-serif; font-size: 0.82rem; white-space: nowrap; }
.listbox li[aria-selected="true"], .listbox li:hover { background: var(--bg-raised); }
.listbox li .v { font-family: -apple-system, sans-serif; font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.status { font-family: -apple-system, sans-serif; font-size: 0.86rem; color: var(--text-muted); min-height: 1.2rem; margin: 0 0 0.8rem; }
.examples { font-family: -apple-system, sans-serif; font-size: 0.86rem; color: var(--text-muted); margin: 0 0 1.2rem; }
.examples button { font: inherit; color: var(--accent-strong); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }

/* Result card */
.card { border: 1px solid var(--border); border-left: 5px solid var(--accent); border-radius: 0.6rem; background: var(--bg-surface); padding: 1.2rem 1.3rem 1rem; box-shadow: var(--shadow); margin: 0 0 1rem; }
.card[hidden] { display: none; }
.card .where { font-family: -apple-system, sans-serif; font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 0.2rem; }
.card .name { font-size: 1.7rem; line-height: 1.1; margin: 0 0 0.6rem; font-weight: bold; }
.card .value { font-size: clamp(3rem, 12vw, 4.6rem); line-height: 1; font-weight: bold; letter-spacing: -0.02em; margin: 0 0 0.3rem; font-variant-numeric: tabular-nums; }
.card .value small { font-size: 45%; font-weight: normal; color: var(--text-secondary); margin-left: 0.15em; }
.card .tier { font-family: -apple-system, sans-serif; font-size: 0.95rem; color: var(--accent-strong); font-weight: 600; margin: 0 0 0.6rem; }
.card .shake { font-family: -apple-system, sans-serif; font-size: 0.9rem; color: var(--text-secondary); margin: -0.3rem 0 0.6rem; }
.card .position { margin: 0 0 0.8rem; }
.card .caveat { font-family: -apple-system, sans-serif; font-size: 0.88rem; color: var(--text-secondary); border-top: 1px dashed var(--border-strong); padding-top: 0.7rem; margin: 0.4rem 0 0.4rem; }
.card details { margin: 0.5rem 0 0; font-family: -apple-system, sans-serif; font-size: 0.9rem; }
.card summary { cursor: pointer; color: var(--accent-strong); }
.card table { border-collapse: collapse; margin: 0.5rem 0 0.3rem; width: 100%; }
.card td, .card th { text-align: left; padding: 0.3rem 0.5rem 0.3rem 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.card th { font-weight: 600; color: var(--text-secondary); }
.card td.num, .card th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card .actions { display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; margin: 0.8rem 0 0; font-family: -apple-system, sans-serif; font-size: 0.88rem; }
.card .actions button, .card .actions a { font: inherit; color: var(--accent-strong); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }

.compare { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 40rem) { .compare.two { grid-template-columns: 1fr 1fr; } .compare.two .card .value { font-size: 3.2rem; } }
.compare-verdict { font-size: 1.1rem; margin: 0 0 1.2rem; }
.compare-verdict[hidden] { display: none; }
.compare-box[hidden] { display: none; }

/* Distribution chart */
.chart { margin: 1rem 0 0.5rem; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--bar); }
.chart .bar.hot { fill: var(--bar-hot); }
.chart .bar.sel { fill: var(--bar-mark); }
.chart text { font-family: -apple-system, sans-serif; font-size: 15px; fill: var(--text-muted); }
.chart .axis { stroke: var(--border-strong); stroke-width: 1; }
.chart .marker { fill: var(--text-primary); font-size: 17px; font-weight: 600; }
.chart-caption { font-family: -apple-system, sans-serif; font-size: 0.86rem; color: var(--text-muted); margin: 0.4rem 0 1rem; }

/* County table */
.tbl { width: 100%; border-collapse: collapse; font-family: -apple-system, sans-serif; font-size: 0.9rem; margin: 0.6rem 0 0.6rem; }
.tbl th, .tbl td { text-align: left; padding: 0.42rem 0.5rem 0.42rem 0; border-bottom: 1px solid var(--border); }
.tbl th { color: var(--text-secondary); font-weight: 600; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl-wrap { overflow-x: auto; }
html.js .tbl tr.more { display: none; }
html.js .tbl.open tr.more { display: table-row; }
.more-btn { font: inherit; font-family: -apple-system, sans-serif; font-size: 0.88rem; color: var(--accent-strong); background: none; border: 1px solid var(--border-strong); border-radius: 999px; padding: 0.35rem 0.9rem; cursor: pointer; margin: 0.2rem 0 1rem; }
html:not(.js) .more-btn { display: none; }

figure { margin: 1.4rem 0; }
figure img { width: 100%; height: auto; display: block; border-radius: 0.4rem; border: 1px solid var(--border); }
figcaption { font-family: -apple-system, sans-serif; font-size: 0.84rem; color: var(--text-muted); margin-top: 0.5rem; line-height: 1.5; }

.formula { font-family: "Menlo", "SFMono-Regular", Consolas, monospace; font-size: 0.9rem; background: var(--bg-raised); border-radius: 0.4rem; padding: 0.6rem 0.8rem; overflow-x: auto; margin: 0.4rem 0 1rem; }
ul, ol { padding-left: 1.3rem; }
li { margin-bottom: 0.4rem; }

footer.site-footer { border-top: 1px solid var(--border); margin-top: 3rem; padding: 1.6rem 0 2.4rem; font-family: -apple-system, sans-serif; font-size: 0.82rem; color: var(--text-muted); }
footer.site-footer a { color: var(--text-muted); }
footer.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-bottom: 0.8rem; }

.rail { position: fixed; right: 1.4rem; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 0.85rem; z-index: 20; }
.rail a { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; }
.rail .dot { width: 6px; height: 6px; border-radius: 999px; background: var(--border-strong); transition: transform 0.15s, background 0.15s; }
.rail a[aria-current="true"] .dot { background: var(--accent-strong); transform: scale(1.45); }
.rail .label { font-family: -apple-system, sans-serif; font-size: 0.76rem; color: var(--text-secondary); opacity: 0; transform: translateX(4px); transition: opacity 0.15s, transform 0.15s; white-space: nowrap; }
.rail a:hover .label, .rail a:focus-visible .label { opacity: 1; transform: translateX(0); }
@media (min-width: 76rem) { .rail { display: flex; } }
@media (max-width: 75.99rem) { .rail { display: none; } }
@media print { .rail, .topbar { display: none; } }
@media (max-width: 30rem) { main { padding: 0 1rem; } .hero { padding-top: 2.2rem; } .card { padding: 1rem 1rem 0.8rem; } }
