/* BlindBallot, midterm edition.
   Red, white and blue live in the chrome only: top bar, flag ribbon, hero, star dividers, empty states,
   the lock-in sticker and the print cover. Every decision surface (race cards, ranks, star gauges,
   comparison and sensitivity tables, measure verdicts, export choices, dossiers) is ink on paper.
   Party colours can never be read as an endorsement. See artifacts/redesign/NOTES.md. */

@font-face {
  font-family: "Public Sans";
  src: url("/assets/fonts/public-sans-latin-var.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@property --v { syntax: "<integer>"; inherits: true; initial-value: 0; }
@property --p { syntax: "<percentage>"; inherits: false; initial-value: 0%; }

:root {
  /* chrome (celebration only) */
  --navy: #0A3161; --navy-2: #164785; --navy-ink: #051A36; --crimson: #B31942; --gold: #F2B544;
  /* paper + ink (all decision surfaces) */
  --paper: #FDFBF7; --paper-2: #F5F1E8; --card: #FFFEFB; --ink: #211F1B; --ink-2: #47433C; --muted: #625C52;
  --line: #D9D2C5; --line-2: #B5AD9E; --soft: #F1ECE2; --star-empty: #D3CBBC; --focus: #8A5300;
  --accent: var(--ink); --accent-ink: var(--paper);
  --radius: 14px; --radius-sm: 8px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1); --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --shadow: 0 1px 0 rgba(33, 31, 27, .04), 0 10px 30px -18px rgba(10, 49, 97, .28);
  --navh: 0px;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 1rem; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.55 "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif; font-feature-settings: "tnum" 0; }
body::before { /* paper grain: fixed, non-interactive, never behind moving content */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .5 0 0 0 0 .42 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > :not(dialog) { position: relative; z-index: 1; }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: .18em; text-decoration-color: var(--line-2); }
a:hover { text-decoration-color: currentColor; text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: .6rem 1rem; z-index: 30; border-radius: 0 0 8px 0; }
.skip:focus { left: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3, h4 { text-wrap: balance; letter-spacing: -.012em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.5rem); line-height: 1.08; font-weight: 800; letter-spacing: -.025em; margin: .25rem 0 .75rem; color: var(--ink); }
h2 { font-size: 1.22rem; line-height: 1.25; font-weight: 750; margin: 1.6rem 0 .55rem; }
h3 { font-size: 1.05rem; font-weight: 700; margin: .6rem 0 .4rem; }
p { text-wrap: pretty; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.kicker { margin: 0 0 .35rem; font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--crimson); }
.lede { font-size: 1.05rem; max-width: 60ch; }
.back { margin: 0 0 .25rem; }
.back a { text-decoration: none; font-weight: 600; color: var(--ink-2); }
.back a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- top bar + flag ribbon (chrome) ---------- */
.topbar { background: var(--navy); color: var(--paper); padding: .7rem 1rem calc(.7rem + 6px); display: flex; align-items: center; gap: .5rem 1.25rem; z-index: 20; }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: linear-gradient(var(--crimson) 0 2px, var(--paper) 2px 4px, var(--crimson) 4px 6px); }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--paper); font-weight: 800; letter-spacing: -.01em; font-size: 1.12rem; text-decoration: none; min-height: 44px; }
.brand-mark { width: 26px; height: 26px; flex: none; }
.topbar ul { list-style: none; margin: 0; padding: 0; display: flex; }
.topbar nav a { position: relative; color: #E7ECF4; text-decoration: none; font-weight: 600; font-size: .95rem; display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 .8rem; border-radius: 8px; transition: background-color 160ms ease, color 160ms ease; }
.topbar nav a[aria-current="page"] { color: #fff; }
.topbar nav a[aria-current="page"]::after { content: ""; position: absolute; left: .8rem; right: .8rem; bottom: 2px; height: 3px; border-radius: 2px; background: var(--paper); }
.topbar :focus-visible { outline-color: var(--gold); }
@media (hover: hover) and (pointer: fine) { .topbar nav a:hover { background: rgba(253, 251, 247, .1); color: #fff; } }

/* phone: thumb-reachable bottom tab bar */
@media (max-width: 759px) {
  :root { --navh: calc(60px + env(safe-area-inset-bottom)); }
  .topbar { position: relative; }
  .topbar nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--navy); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -10px 24px -16px rgba(5, 26, 54, .6); }
  .topbar nav::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--crimson); }
  .topbar ul { display: grid; grid-template-columns: repeat(6, 1fr); }
  .topbar nav a { min-height: 60px; padding: 3px 2px 0; font-size: .7rem; letter-spacing: .01em; border-radius: 0; text-align: center; }
  .topbar nav a[aria-current="page"] { background: var(--navy-2); }
  .topbar nav a[aria-current="page"]::after { left: 25%; right: 25%; top: 3px; bottom: auto; height: 3px; background: var(--paper); }
  main { padding-bottom: calc(var(--navh) + 2.5rem) !important; }
}
@media (min-width: 760px) {
  .topbar { position: sticky; top: 0; padding-inline: max(1.25rem, calc((100vw - 1240px) / 2)); min-height: 70px; }
  .topbar nav { margin-left: auto; }
}

main { max-width: 1240px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }
main:focus, main:focus-visible { outline: none; }
@media (min-width: 760px) { main { padding: 2rem 1.5rem 5rem; } }

/* ---------- star divider (chrome) ---------- */
.star-rule { display: flex; align-items: center; gap: .9rem; margin: 1.25rem 0; }
.star-rule::before, .star-rule::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.star-rule span { width: 166px; height: 10px; flex: none; background: var(--navy);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12.77 10'%3E%3Cpath d='M5 0l1.18 3.62H10L6.91 5.86 8.09 9.5 5 7.25 1.91 9.5l1.18-3.64L0 3.62h3.82z'/%3E%3C/svg%3E") 0 0 / 12.77px 10px repeat-x;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12.77 10'%3E%3Cpath d='M5 0l1.18 3.62H10L6.91 5.86 8.09 9.5 5 7.25 1.91 9.5l1.18-3.64L0 3.62h3.82z'/%3E%3C/svg%3E") 0 0 / 12.77px 10px repeat-x; }
.section-rule { margin: 2.25rem 0 1.25rem; }

/* ---------- ballot-box art (chrome) ---------- */
.bbox { display: block; width: 100%; height: auto; overflow: visible; }
.bbox .paper { transform: translateY(18px); }
.bbox.drop .paper { animation: drop-in 900ms var(--ease-out) 150ms both; }
@keyframes drop-in { from { transform: translateY(-34px); opacity: 0; } 30% { opacity: 1; } to { transform: translateY(18px); } }

/* ---------- landing hero (first run, no profile yet) ---------- */
.hero { display: grid; grid-template-columns: 1fr 112px; gap: 1rem; align-items: end; padding: .5rem 0 0; }
.hero-line { margin: .1rem 0 .7rem; font-size: clamp(2.1rem, 1.4rem + 3.6vw, 4rem); line-height: 1.02; font-weight: 850; letter-spacing: -.035em; color: var(--navy); text-wrap: balance; }
.hero-line .hl { color: var(--crimson); }
.hero-sub { margin: 0; font-size: 1.05rem; color: var(--ink-2); max-width: 46ch; }
.hero-art { margin: 0; align-self: center; }
.hero-rule { margin: 1.5rem 0 1.75rem; }
@media (min-width: 760px) {
  .hero { grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr); gap: 3rem; padding-top: 1rem; }
  .hero-art { max-width: 320px; justify-self: end; width: 100%; }
}

/* ---------- where (empty state: no address yet) ---------- */
.where-layout { display: grid; gap: 1.5rem; }
.where-art { margin: 0; max-width: 150px; order: -1; }
@media (min-width: 900px) { .where-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 4rem; align-items: start; } .where-art { order: 0; max-width: 300px; margin-top: 2.5rem; } .where-copy { max-width: 680px; } }

/* ---------- surfaces ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin: .9rem 0; box-shadow: var(--shadow); }
.card > h2:first-child, .card > h3:first-child { margin-top: .1rem; }
.notice { border: 1px solid var(--line); border-left: 4px solid var(--ink-2); background: var(--paper-2); padding: .75rem .95rem; border-radius: var(--radius-sm); margin: .9rem 0; }
.notice h2 { margin-top: .1rem; font-size: 1.05rem; }
blockquote { margin: .6rem 0; padding: .6rem .85rem; border-left: 3px solid var(--ink-2); background: var(--paper-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
mark { background: #F6E6B8; color: var(--ink); padding: 0 .1rem; border-radius: 2px; }

/* ---------- buttons ---------- */
.btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; border: 2px solid var(--navy); background: var(--navy); color: var(--paper); padding: .6rem 1.25rem; border-radius: 999px; font: inherit; font-weight: 700; letter-spacing: .005em; cursor: pointer; min-height: 48px; text-decoration: none; white-space: nowrap; transition: transform 140ms var(--ease-out), background-color 160ms ease, box-shadow 160ms ease; box-shadow: 0 6px 16px -10px rgba(10, 49, 97, .9); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.secondary { background: var(--card); color: var(--navy); box-shadow: none; }
.btn.link { background: none; border: none; box-shadow: none; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: .18em; padding: .25rem .2rem; min-height: 32px; font-weight: 600; border-radius: 4px; }
.btn.link:active { transform: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) { background: var(--navy-2); border-color: var(--navy-2); }
  .btn.secondary:hover:not(:disabled) { background: #EEF2F8; }
  .btn.link:hover { background: none; text-decoration-color: currentColor; }
}
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; margin: .75rem 0 .25rem; }
.tag { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 6px; padding: .05rem .45rem; font-size: .78rem; font-weight: 600; color: var(--ink-2); background: var(--paper); line-height: 1.5; }
.tag.solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- forms ---------- */
fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin: .9rem 0; padding: .9rem 1.05rem 1rem; box-shadow: var(--shadow); min-width: 0; }
legend { font-weight: 750; padding: 0 .35rem; }
label { cursor: pointer; }
.opts { display: flex; flex-wrap: wrap; gap: .45rem; margin: .5rem 0; }
.opts.stack { flex-direction: column; }
.opts label { display: inline-flex; gap: .5rem; align-items: center; min-height: 44px; }
.seg { padding: 0 .95rem 0 .75rem; border: 1.5px solid var(--line-2); border-radius: 999px; background: var(--paper); font-weight: 650; transition: background-color 140ms ease, border-color 140ms ease; }
.seg:has(input:checked) { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.seg:has(input:checked) input { accent-color: var(--paper); }
.seg:has(:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice, .check { display: flex !important; gap: .65rem; align-items: flex-start !important; padding: .55rem .75rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); line-height: 1.4; }
.choice input, .check input { margin-top: .12rem; flex: none; }
.choice:has(input:checked), .check:has(input:checked) { border-color: var(--ink); background: var(--card); box-shadow: inset 0 0 0 1px var(--ink); }
.rule .check { border: 0; background: none; padding: 0; box-shadow: none !important; font-weight: 600; }
.rule:has(.check input:checked) { border-color: var(--ink); }
input[type=radio], input[type=checkbox] { width: 1.2rem; height: 1.2rem; accent-color: var(--ink); }
input[type=range] { width: 100%; accent-color: var(--ink); min-height: 36px; }
input[type=text], input[type=number], select { font: inherit; padding: .6rem .75rem; border: 1.5px solid #8C8476; border-radius: var(--radius-sm); min-height: 48px; background: #fff; color: var(--ink); max-width: 100%; transition: border-color 140ms ease, box-shadow 140ms ease; }
input[type=text]:focus, input[type=number]:focus, select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(33, 31, 27, .12); }
input::placeholder { color: #736C61; }
select:disabled { background: var(--paper-2); color: var(--ink); opacity: 1; border-style: dashed; }
.field { display: grid; gap: .3rem; margin: .65rem 0; }
.field > label { font-weight: 650; }
details > summary { cursor: pointer; min-height: 40px; padding: .35rem 0; font-weight: 650; }
details.card > summary { margin: -.2rem 0; }

/* ---------- profile builder ---------- */
.page-head p { max-width: 68ch; }
.qform { counter-reset: answered; }
.qform input[type=radio][value="1"]:checked, .qform input[type=radio][value="-1"]:checked { counter-increment: answered; }
.qgrid { display: grid; gap: .8rem; }
@media (min-width: 900px) { .qgrid { grid-template-columns: 1fr 1fr; gap: 1rem; } .qgrid fieldset { margin: 0; } }
.q { display: flex; flex-direction: column; margin: 0; transition: border-color 160ms ease; }
.q:has(input[value="1"]:checked), .q:has(input[value="-1"]:checked) { border-color: var(--line-2); }
.q legend { display: flex; gap: .35rem; align-items: baseline; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-2); }
.qn { font-variant-numeric: tabular-nums; color: var(--muted); }
.q-text { margin: .1rem 0 .4rem; font-size: 1.04rem; font-weight: 550; line-height: 1.42; }
.intensity { margin-top: auto; padding-top: .35rem; }
.intensity > label { font-weight: 550; font-size: .9rem; color: var(--ink-2); }
.intensity output { display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; border-radius: 6px; background: var(--ink); color: var(--paper); font-weight: 750; font-variant-numeric: tabular-nums; margin: 0 .15rem; }
.form-foot { position: sticky; bottom: calc(var(--navh) + .6rem); z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.25rem; padding: .6rem .6rem .6rem 1.1rem; background: rgba(255, 254, 251, .96); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 16px 34px -20px rgba(5, 26, 54, .55); }
.progress::after { content: counter(answered) " of " attr(data-total) " answered"; font-weight: 650; font-size: .9rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- ballot / match view ---------- */
.countdown { display: inline-block; margin: .1rem 0 .4rem; padding: .1rem .55rem; border-radius: 6px; background: var(--navy); color: var(--paper); font-size: .8rem; font-weight: 700; letter-spacing: .02em; }
.masthead > p.small { max-width: 70ch; }
.masthead .star-rule { margin-bottom: .5rem; }
@media (min-width: 1100px) {
  .ballot-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 3rem; align-items: start; }
  .masthead { position: sticky; top: 100px; }
  .masthead h1 { font-size: 2.6rem; }
  .masthead .star-rule { justify-content: flex-start; }
  .masthead .star-rule::before { display: none; }
  .sheet > .race:first-child, .sheet > .notice:first-child { margin-top: 0; }
}

.race { position: relative; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); margin: 1.1rem 0; box-shadow: var(--shadow); overflow: hidden; }
.race > header { padding: .95rem 1.1rem .8rem; border-bottom: 1px dashed var(--line-2); background: linear-gradient(var(--paper-2), var(--card)); }
.race > header h2 { margin: 0; font-size: 1.15rem; line-height: 1.25; }
.race > header h2 a { text-decoration: none; }
.race > header h2 a:hover { text-decoration: underline; }
.race > header p { margin: .2rem 0 0; }
.race > header details { margin-top: .35rem; }
.race > header details .small { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .2rem .8rem .6rem; }
.cands { list-style: none; margin: 0; padding: 0; }
.cand { padding: 1rem 1.1rem; border-top: 1px solid var(--soft); }
.cand:first-child { border-top: 0; }
.cand-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .75rem; align-items: start; }
.rank { display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 1.5px solid var(--ink); font-weight: 800; font-size: .95rem; font-variant-numeric: tabular-nums; color: var(--ink); background: var(--card); }
.cand:first-child .rank:not(.verdict) { background: var(--ink); color: var(--paper); }
.rank.verdict { border-radius: 8px; width: auto; min-width: 2.6rem; padding: 0 .4rem; font-size: .78rem; letter-spacing: .04em; }
.cand-name { font-weight: 750; font-size: 1.05rem; line-height: 1.3; text-decoration: none; }
a.cand-name:hover { text-decoration: underline; }
.cand-head .small.muted { margin-top: .1rem; }
.cand > .row { margin-top: .55rem; }
.cand > .row.small { gap: .35rem; }
.cols { display: grid; grid-template-columns: 1fr; gap: .25rem 1.5rem; margin-top: .75rem; }
@media (min-width: 640px) { .cols { grid-template-columns: 1fr 1fr; } }
.cols h4 { margin: .25rem 0 .2rem; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.cols ul { margin: 0; padding-left: 1rem; }
.cols li { margin: .3rem 0; font-size: .94rem; line-height: 1.45; }
.cols li::marker { color: var(--line-2); }
.ev { font-size: .84rem; }
.excluded { background: repeating-linear-gradient(-45deg, var(--paper-2) 0 10px, var(--card) 10px 20px); }
.excluded .rank { border-style: dashed; color: var(--muted); }
.diff li { margin: .35rem 0; }

/* alignment gauge: five monochrome stars + number. Ink only, never party colours. */
.gauge { display: grid; justify-items: end; gap: .15rem; min-width: 96px; }
.gauge .num { font-weight: 850; font-size: 1.5rem; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; position: relative; }
.gauge.na .num { font-size: 1rem; color: var(--muted); font-weight: 700; }
.stars { --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 18'%3E%3Cpath d='M9 .6l2.3 5.2 5.6.5-4.3 3.7 1.3 5.5L9 12.6l-4.9 2.9 1.3-5.5L1.1 6.3l5.6-.5z'/%3E%3C/svg%3E");
  width: 96px; height: 17px; background: linear-gradient(90deg, var(--ink) var(--p), var(--star-empty) var(--p));
  -webkit-mask: var(--star) 0 0 / 20% 100% repeat-x; mask: var(--star) 0 0 / 20% 100% repeat-x; }
.stars.thin { background: linear-gradient(90deg, transparent var(--p), var(--star-empty) var(--p)), repeating-linear-gradient(45deg, var(--ink) 0 2px, #8A8274 2px 4px); }
.intro .stars { animation: star-fill 1100ms var(--ease-out) 120ms both; }
.intro .num.has-v .n { color: transparent; }
.intro .num.has-v { counter-reset: v var(--v); animation: count-up 1100ms var(--ease-out) 120ms both; }
.intro .num.has-v::after { content: counter(v); position: absolute; right: 0; top: 0; }
@keyframes star-fill { from { --p: 0%; } }
@keyframes count-up { from { --v: 0; } }

/* ---------- tables (compare, sensitivity, why-not, funding) ---------- */
.table-wrap { overflow-x: auto; margin: .5rem 0; border-radius: var(--radius-sm); }
.table-wrap:not([tabindex]) { overflow: visible; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; background: var(--card); }
th, td { border-bottom: 1px solid var(--line); padding: .6rem .6rem; text-align: left; vertical-align: top; }
thead th { background: var(--paper-2); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); border-bottom: 1.5px solid var(--ink); }
tbody th { background: none; font-weight: 700; }
tbody tr:last-child > * { border-bottom: 0; }
table.compare { min-width: 560px; }
table.compare tbody th { position: sticky; left: 0; background: var(--card); box-shadow: 1px 0 0 var(--line); min-width: 9rem; }
table.sens { min-width: 520px; }
tr[data-status] td:nth-child(2) strong { display: inline-block; padding: .05rem .5rem; border-radius: 6px; border: 1.5px solid var(--ink); font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; }
tr[data-status="robust"] td:nth-child(2) strong { background: var(--ink); color: var(--paper); }
tr[data-status="fragile"] td:nth-child(2) strong { background: repeating-linear-gradient(-45deg, var(--card) 0 4px, var(--soft) 4px 8px); }

/* ---------- dossier ---------- */
.dossier > h2 { padding-top: 1rem; border-top: 1px solid var(--line); }
.dossier ul { padding-left: 1.1rem; }
.dossier li { margin: .45rem 0; }
.score-card .row { gap: 1rem 1.25rem; }
.score-card .gauge { justify-items: start; }
@media (min-width: 1000px) { .dossier, .race-detail { max-width: 860px; } }

/* ---------- dialog ---------- */
dialog { border: 1px solid var(--line); border-radius: 18px; padding: 0; width: min(640px, 94vw); max-height: 88vh; background: var(--card); color: var(--ink); box-shadow: 0 30px 80px -30px rgba(5, 26, 54, .65); }
dialog::backdrop { background: rgba(5, 26, 54, .5); }
dialog[open] { opacity: 1; transform: none; transition: opacity 200ms var(--ease-out), transform 240ms var(--ease-drawer), overlay 200ms allow-discrete, display 200ms allow-discrete; }
@starting-style { dialog[open] { opacity: 0; transform: translateY(14px) scale(.98); } }
.dlg { padding: 1.15rem 1.25rem 1.25rem; }
.dlg > h2 { margin-top: 0; padding-right: 1rem; }
.dlg form[method=dialog] { margin-top: 1rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem .9rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 759px) {
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 20px 20px 0 0; max-height: 86vh; }
  .dlg { padding-bottom: calc(1.25rem + env(safe-area-inset-bottom)); }
}

/* ---------- empty / loading / error ---------- */
.empty { display: grid; grid-template-columns: 96px 1fr; gap: 1rem 1.25rem; align-items: center; padding: 1.25rem; margin: 1rem 0; border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: var(--card); }
.empty p { margin: 0; font-weight: 650; font-size: 1.05rem; }
.empty .bbox .paper { transform: translateY(40px); }
.loading { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-weight: 600; padding: 2.5rem 0; }
.loading::before { content: ""; width: 14px; height: 14px; border-radius: 3px; background: var(--navy); box-shadow: 22px 0 0 var(--paper), 44px 0 0 var(--crimson); outline: 1px solid var(--line); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
main > p[role=alert] { padding: 1rem 1.1rem; border: 1px solid var(--line); border-left: 4px solid var(--ink); background: var(--card); border-radius: var(--radius-sm); font-weight: 650; }

/* ---------- export: paper ballot + lock-in sticker ---------- */
.paper-ballot { position: relative; padding-top: 1.25rem; background: var(--card); background-image: linear-gradient(var(--card), var(--card)), repeating-linear-gradient(90deg, var(--line-2) 0 6px, transparent 6px 12px); background-size: 100% 100%, 100% 1px; background-repeat: no-repeat; }
.paper-ballot .field { grid-template-columns: 1fr; padding: .35rem 0; border-bottom: 1px dotted var(--line); margin: 0; }
.paper-ballot .field:last-of-type { border-bottom: 0; }
@media (min-width: 760px) { .paper-ballot .field { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 1rem; } }
.paper-ballot h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-2); margin: 1.25rem 0 .25rem; }
.paper-ballot h2:first-of-type { margin-top: .2rem; }
.seal { float: right; width: 116px; margin: -.25rem -.25rem .5rem 1rem; position: relative; }
.seal .bbox .paper { transform: translateY(84px); }
.seal.just-locked .bbox .paper { animation: slide-in 700ms var(--ease-drawer) 120ms both; }
@keyframes slide-in { from { transform: translateY(-6px); } to { transform: translateY(84px); } }
.sticker { position: absolute; left: 50%; top: 58%; width: 112px; height: 70px; display: grid; place-content: center; text-align: center; border-radius: 50%; background: var(--card); border: 2px solid var(--navy); box-shadow: 0 0 0 3px var(--card), 0 8px 18px -8px rgba(5, 26, 54, .6); transform: translate(-50%, -50%) rotate(-8deg); }
.sticker-stars { display: block; height: 7px; width: 54px; margin: 0 auto 2px; background: var(--crimson);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10.8 7'%3E%3Cpath d='M3.5 0l.83 2.53H7L4.84 4.1l.82 2.55-2.16-1.57-2.16 1.57.82-2.55L0 2.53h2.67z'/%3E%3C/svg%3E") 0 0 / 10.8px 7px repeat-x;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10.8 7'%3E%3Cpath d='M3.5 0l.83 2.53H7L4.84 4.1l.82 2.55-2.16-1.57-2.16 1.57.82-2.55L0 2.53h2.67z'/%3E%3C/svg%3E") 0 0 / 10.8px 7px repeat-x; }
.sticker-main { display: block; font-weight: 900; font-size: .95rem; letter-spacing: .06em; text-transform: uppercase; color: var(--navy); line-height: 1.05; }
.sticker-sub { display: block; font-size: .6rem; font-weight: 700; color: var(--crimson); letter-spacing: .04em; }
.just-locked .sticker { animation: stick 420ms var(--ease-out) 640ms both; }
@keyframes stick { from { opacity: 0; transform: translate(-50%, -50%) rotate(-16deg) scale(.9); } }
.is-locked .toolbar { clear: both; }
#share-out a:not(.btn) { overflow-wrap: anywhere; }

/* ---------- alerts ---------- */
article.card h2 { margin-top: .1rem; }

/* ---------- printable share page + PDF cover ---------- */
.print { background: var(--card); font-size: 10.5pt; line-height: 1.38; }
.cover { margin: 0 0 12pt; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.cover-flag { display: flex; height: 30px; }
.cover-canton { width: 34%; background-color: var(--navy);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='15' viewBox='0 0 18 15'%3E%3Cpath d='M9 3.5l.94 2.03 2.22.24-1.65 1.5.46 2.19L9 8.33 7.03 9.46l.46-2.19-1.65-1.5 2.22-.24z' fill='%23FDFBF7'/%3E%3C/svg%3E");
  background-size: 18px 15px; }
.cover-stripes { flex: 1; background: repeating-linear-gradient(var(--crimson) 0 4.29px, var(--paper) 4.29px 8.57px); }
.cover-main { display: grid; grid-template-columns: minmax(0, 1fr) 1.15in; gap: 16pt; align-items: center; padding: 12pt 14pt 10pt; }
.cover .kicker { font-size: 7.5pt; margin-bottom: 2pt; }
.print h1 { font-size: 17pt; line-height: 1.15; margin: 0 0 5pt; color: var(--navy); letter-spacing: -.02em; }
.print .cover p.small { margin: 3pt 0; font-size: 8.5pt; color: var(--ink-2); }
.cover-box { width: 1.15in; }
.cover-box .paper { transform: translateY(26px); }
.print h2 { font-size: 12.5pt; margin: 12pt 0 5pt; padding-bottom: 2pt; border-bottom: 1.5px solid var(--ink); letter-spacing: -.005em; }
.print .pick { break-inside: avoid; margin: 0 0 7pt; padding-left: 8pt; border-left: 2px solid var(--line); }
.print .cite { font-size: 8pt; }
.print ol.refs { font-size: 8pt; padding-left: 1.6em; }
.print ol.refs li { break-inside: avoid; overflow-wrap: anywhere; margin-bottom: 2pt; }
body.printing main { max-width: 900px; }
@media (max-width: 600px) { .cover-main { grid-template-columns: 1fr 72px; } .cover-box { width: 72px; } }

@media print {
  @page { size: letter; margin: 0.45in; }
  .topbar, .skip, .no-print, #live { display: none !important; }
  html, body { background: #fff; }
  body::before { display: none; }
  main { max-width: none; padding: 0 !important; }
  a { color: #000; }
  .cover { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .btn:active:not(:disabled) { transform: none; }
  dialog[open] { transition: opacity 160ms ease; }
  @starting-style { dialog[open] { opacity: 0; transform: none; } }
}
