/* vote.sergeant.com. Phone first, Apple HIG shapes, large type on purpose. */
:root {
  color-scheme: light dark;
  --bg: #f2f2f7;
  --card: #ffffff;
  --text: #000000;
  --text2: #55555b;
  --sep: #d9d9de;
  --fill: #e6e6eb;
  --accent: #0a63d8;
  --dem: #0a63d8;
  --rep: #d0262d;
  --ind: #6d5bc7;
  --ok: #187a35;
  --warn: #a85b00;
  --warnbg: #fff3df;
  --bar: rgba(242, 242, 247, .86);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --text: #ffffff;
    --text2: #aeaeb4;
    --sep: #38383a;
    --fill: #2c2c2e;
    --accent: #5aa9ff;
    --dem: #4f9fff;
    --rep: #ff6a61;
    --ind: #a896ff;
    --ok: #4cd964;
    --warn: #ffb340;
    --warnbg: #3a2a10;
    --bar: rgba(10, 10, 12, .86);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font: -apple-system-body; }
@supports not (font: -apple-system-body) {
  html { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 18px; }
}
@media (min-width: 900px) { html { font-size: 17px; } }
body { margin: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif; line-height: 1.3; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }

/* Frame: bottom tab bar on a phone, fixed sidebar on a big screen. */
.main { min-height: 100vh; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
main { padding: 0 max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); max-width: 1500px; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
  padding: 6px max(4px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
  background: var(--bar); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-top: .5px solid var(--sep);
}
.tabs a { flex: 1; min-height: 50px; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text2); font-size: .72rem; font-weight: 600; }
.tabs a[aria-current="page"] { color: var(--accent); }
.tabs svg { width: 25px; height: 25px; fill: currentColor; }
.side-only { display: none; }

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 230px minmax(0, 1fr); }
  .tabs {
    position: sticky; top: 0; bottom: auto; height: 100vh; flex-direction: column; gap: 2px; padding: 16px 10px;
    border-top: 0; border-right: .5px solid var(--sep); background: var(--card); -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .tabs a { flex: none; flex-direction: row; justify-content: flex-start; gap: 11px; padding: 9px 12px; min-height: 44px; border-radius: 9px; font-size: 1rem; font-weight: 500; color: var(--text); }
  .tabs a svg { width: 22px; height: 22px; color: var(--accent); }
  .tabs a[aria-current="page"] { background: var(--accent); color: #fff; }
  @media (prefers-color-scheme: dark) { .tabs a[aria-current="page"] { color: #00203f; } }
  .tabs a[aria-current="page"] svg { color: inherit; }
  .side-only { display: block; padding: 2px 12px 14px; font-size: 1.25rem; font-weight: 700; }
  .main { padding-bottom: 32px; }
  main { padding: 0 28px 28px; }
}

/* Always-visible freshness strip: when the DATA is from, per source. */
.fresh {
  position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; gap: 2px 14px; align-items: center;
  padding: calc(9px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 9px max(16px, env(safe-area-inset-left));
  background: var(--bar); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-bottom: .5px solid var(--sep);
  font-size: .86rem; color: var(--text2); min-height: 44px;
}
.fresh b { color: var(--text); font-weight: 600; }
.fresh .item { white-space: nowrap; }
.fresh .item.wrap { white-space: normal; }
.fresh .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); margin-right: 6px; }
.fresh .stale .dot { background: var(--warn); }
.fresh .stale b { color: var(--warn); }
.fresh .more { margin-left: auto; color: var(--accent); font-weight: 600; white-space: nowrap; padding: 2px 0; }
@media (min-width: 900px) { .fresh { padding-left: 28px; padding-right: 28px; } }

.title { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; padding: 18px 0 4px; line-height: 1.12; }
.subtitle { color: var(--text2); padding-bottom: 12px; }
h2.sec { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; margin: 26px 0 10px; }
h3.group { font-size: 1.05rem; font-weight: 700; margin: 20px 0 8px; color: var(--text2); }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; color: var(--accent); font-size: 1.05rem; padding-top: 6px; }
.back svg { width: 12px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

.card { background: var(--card); border-radius: 14px; padding: 16px; }
.grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) { .grid.races { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); } }
@media (min-width: 900px) {
  .grid.chambers { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
  .cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; align-items: start; }
}

/* Seat tallies */
.chamber h2 { font-size: 1.5rem; font-weight: 700; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.chamber h2 small { font-size: .95rem; font-weight: 500; color: var(--text2); text-align: right; }
.tallies { display: grid; gap: 14px; padding-top: 12px; }
.tally { min-width: 0; }
.tally-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding-bottom: 5px; }
.tally-head { font-size: 1.05rem; font-weight: 600; }
.tally-nums { display: flex; gap: 14px; align-items: baseline; }
.tally-sub { font-size: .88rem; color: var(--text2); padding-top: 5px; }
.big { font-size: 1.6rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; display: inline-block; min-width: 2.1em; text-align: right; }
.big small { font-size: .85rem; font-weight: 600; margin-left: 2px; }
.d { color: var(--dem); } .r { color: var(--rep); } .i { color: var(--ind); }
.bar { position: relative; display: flex; height: 10px; border-radius: 5px; background: var(--fill); }
.bar i { display: block; height: 100%; }
.bar i:first-child { border-radius: 5px 0 0 5px; }
.bar .spacer { flex: 1; }
.bar i.fr { border-radius: 0 5px 5px 0; }
.bar .fd { background: var(--dem); } .bar .fi { background: var(--ind); } .bar .fr { background: var(--rep); }
.bar .tick { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); }
.note { font-size: .95rem; color: var(--text2); padding-top: 8px; }

/* A race, line by line */
.race { display: block; }
.race-head { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; font-weight: 700; padding-bottom: 8px; }
.race-head .name { flex: 1; min-width: 0; }
.chev { width: 8px; height: 14px; flex: none; fill: none; stroke: var(--text2); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .7; }
.tag { flex: none; font-size: .78rem; font-weight: 700; padding: 2px 7px; border-radius: 6px; color: #fff; background: var(--warn); }
@media (prefers-color-scheme: dark) { .tag { color: #000; } }
.cand { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; padding: 4px 0; font-size: 1.05rem; }
.badge { width: 24px; height: 24px; border-radius: 6px; color: #fff; display: flex; align-items: center; justify-content: center; font-size: .82rem; font-weight: 700; }
@media (prefers-color-scheme: dark) { .badge { color: #000; } }
.badge.bd { background: var(--dem); } .badge.br { background: var(--rep); } .badge.bi { background: var(--ind); }
.cand .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cand.won .who { font-weight: 700; }
.cand .pc { font-weight: 600; font-variant-numeric: tabular-nums; }
.cand .check { color: var(--ok); font-weight: 700; margin-left: 4px; }
.cand .votes { grid-column: 2 / 4; color: var(--text2); font-size: .92rem; }
.cand .track { grid-column: 2 / 4; height: 6px; background: var(--fill); border-radius: 3px; overflow: hidden; }
.cand .track i { display: block; height: 100%; }
.status { font-size: .95rem; padding-top: 8px; color: var(--text2); }
.status b { color: var(--text); font-weight: 600; }
.status.partial b { color: var(--warn); }
.status.done b { color: var(--ok); }
.status.split b { color: var(--warn); }

/* Inset grouped lists: feed, states, sources */
.list { background: var(--card); border-radius: 14px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 11px 14px 11px 16px; border-top: .5px solid var(--sep); }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .sub { color: var(--text2); font-size: .92rem; padding-top: 2px; }
.row .when { color: var(--text2); font-size: .9rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row .strong { font-weight: 600; }
.grid.states { gap: 0 16px; }
@media (min-width: 900px) { .list.states-list { columns: 2; column-gap: 0; } .list.states-list .row { break-inside: avoid; } }

/* Search and segmented control */
.tools { display: grid; gap: 10px; padding-bottom: 14px; }
@media (min-width: 900px) { .tools { grid-template-columns: minmax(220px, 340px) minmax(320px, 560px); justify-content: start; } }
.search { width: 100%; height: 44px; border: 0; border-radius: 10px; padding: 0 14px; background: var(--fill); color: var(--text); font: inherit; font-size: 1.05rem; }
.search::placeholder { color: var(--text2); opacity: 1; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 2px; border-radius: 10px; background: var(--fill); min-height: 44px; }
.seg button { border: 0; background: none; color: var(--text); font: inherit; font-size: .95rem; font-weight: 500; border-radius: 8px; cursor: pointer; padding: 4px 2px; line-height: 1.15; }
.seg button[aria-pressed="true"] { background: var(--card); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.seg .ct { display: block; font-size: .8rem; color: var(--text2); font-weight: 500; }
.empty { padding: 28px 8px; text-align: center; color: var(--text2); }
.loading { padding: 40px 0; color: var(--text2); text-align: center; }
.alert { background: var(--warnbg); color: var(--text); border-radius: 12px; padding: 12px 14px; margin-top: 14px; font-size: .98rem; }
.alert b { color: var(--warn); }
.link { color: var(--accent); font-weight: 600; }
.more-link { display: block; padding: 12px 16px; color: var(--accent); font-weight: 600; border-top: .5px solid var(--sep); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.facts div span { display: block; color: var(--text2); font-size: .92rem; }
.facts div b { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.foot { color: var(--text2); font-size: .92rem; padding: 26px 0 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
@media (hover: hover) { a.card:hover, a.row:hover { background: var(--fill); } }
