/* ============================================================================
   Your Ballot — the unified, address-driven entry point.

   One inline, guided flow: set your address → see every contest on YOUR real
   ballot → for each seat, weigh the candidates (Promise %, top stances, funding
   at a glance) → save picks to your team. This file styles that single section
   (#your-ballot). It deliberately reuses the app's existing tokens — navy field,
   amber "team" accent, Bebas/Barlow type — so it reads as native, not bolted on.

   Nonpartisan by construction: candidates are ordered by their track-record
   score, party is shown only as a neutral tag, and no party is ever ranked,
   colored-as-good, or hidden.

   Mobile-first: base rules target phones; the one media query at the bottom
   widens the candidate grid on larger screens. Touch targets stay >=44px.
   ========================================================================== */

#your-ballot {
  position: relative;
  padding: 3rem 1rem 3.5rem;
  background:
    radial-gradient(1200px 400px at 50% -10%, rgba(245, 200, 66, 0.06), transparent 60%),
    linear-gradient(180deg, rgba(8, 12, 26, 0.96) 0%, rgba(12, 20, 44, 0.92) 100%);
  border-top: 1px solid rgba(245, 200, 66, 0.14);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  scroll-margin-top: 84px;
}
.yb-wrap { max-width: 62rem; margin: 0 auto; }

/* When the flow is targeted from a handoff (set location, onboarding), a soft
   ring draws the eye without a modal interrupting anything. */
#your-ballot.yb-flash { animation: ybFlash 2.4s ease-out 1; }
@keyframes ybFlash {
  0%   { box-shadow: inset 0 0 0 9999px rgba(245, 200, 66, 0.0); }
  15%  { box-shadow: inset 0 0 0 9999px rgba(245, 200, 66, 0.07); }
  100% { box-shadow: inset 0 0 0 9999px rgba(245, 200, 66, 0.0); }
}
@media (prefers-reduced-motion: reduce) {
  #your-ballot.yb-flash { animation: none; }
  .yb-cand.yb-just-picked { animation: none; }
}

/* ── Section header ─────────────────────────────────────────────────────── */
.yb-head { text-align: center; margin-bottom: 1.75rem; }
.yb-eyebrow {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase;
  font-size: 0.72rem; color: #f5c842;
}
.yb-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  letter-spacing: 0.04em; line-height: 1; color: #fff; margin: 0.3rem 0 0.5rem;
}
.yb-title em { color: #f5c842; font-style: normal; }
.yb-lead {
  font-family: 'Barlow', sans-serif; color: #b9c6de;
  font-size: 0.98rem; line-height: 1.5; max-width: 34rem; margin: 0 auto;
}

/* ── Empty state: inline address prompt (replaces the old pop-ups) ───────── */
.yb-setloc {
  margin: 0 auto; max-width: 30rem; text-align: center;
  background: linear-gradient(160deg, rgba(20, 30, 58, 0.75), rgba(12, 18, 38, 0.6));
  border: 1px solid rgba(245, 200, 66, 0.28);
  border-radius: 1rem; padding: 1.75rem 1.4rem;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}
.yb-setloc-ico { font-size: 2.4rem; line-height: 1; }
.yb-setloc-t {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  font-size: 1.25rem; color: #fff; margin: 0.5rem 0 0.35rem;
}
.yb-setloc-s { font-family: 'Barlow', sans-serif; color: #aebbd4; font-size: 0.92rem; line-height: 1.5; }
.yb-btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 48px; margin-top: 1.1rem; padding: 0 1.5rem; width: 100%;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase; font-size: 1rem;
  color: #0a0f1e; cursor: pointer; border: none; border-radius: 0.7rem;
  background: linear-gradient(135deg, #fad96a, #e6b800);
  box-shadow: 0 0 18px rgba(245, 200, 66, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.yb-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 0 26px rgba(245, 200, 66, 0.55); }
.yb-setloc-note {
  display: block; margin-top: 0.9rem; font-family: 'Barlow', sans-serif;
  font-size: 0.76rem; color: #7f8db0; line-height: 1.45;
}

/* ── Located state: location bar + progress ─────────────────────────────── */
.yb-locbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.9rem;
  justify-content: space-between; margin: 0 auto 1.1rem; max-width: 46rem;
  background: rgba(15, 23, 46, 0.6); border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.8rem; padding: 0.7rem 0.95rem;
}
.yb-loc-here { font-family: 'Barlow', sans-serif; font-size: 0.92rem; color: #dbe4f5; }
.yb-loc-here b { color: #fff; }
.yb-loc-change {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 0.78rem;
  letter-spacing: 0.05em; text-transform: uppercase; color: #f5c842;
  background: rgba(245, 200, 66, 0.1); border: 1px solid rgba(245, 200, 66, 0.35);
  border-radius: 0.55rem; padding: 0.45rem 0.8rem; min-height: 38px; cursor: pointer;
  transition: background 0.15s ease;
}
.yb-loc-change:hover { background: rgba(245, 200, 66, 0.2); }

.yb-progress { max-width: 46rem; margin: 0 auto 1.9rem; }
.yb-progress-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.4rem 0.75rem;
  flex-wrap: wrap;
  font-family: 'Barlow Condensed', sans-serif; margin-bottom: 0.4rem;
}
.yb-progress-lbl { font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; font-size: 0.82rem; color: #cdd8ef; }
.yb-progress-lbl b { color: #f5c842; }
.yb-progress-hint { font-family: 'Barlow', sans-serif; font-size: 0.8rem; color: #8b99b8; }
.yb-progress-track { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.yb-progress-fill {
  height: 100%; border-radius: 999px; width: 0%;
  background: linear-gradient(90deg, #e6b800, #4ade80);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
/* Every race decided — a calm, earned finish, not confetti. */
.yb-progress.yb-complete .yb-progress-hint { color: #4ade80; font-weight: 600; }
.yb-progress.yb-complete .yb-progress-fill { box-shadow: 0 0 12px rgba(74, 222, 128, 0.5); }

/* ── Contest block ──────────────────────────────────────────────────────── */
.yb-contest {
  background: rgba(12, 19, 40, 0.55); border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 0.95rem; padding: 1.1rem 1rem 1.15rem; margin-bottom: 1.1rem;
  transition: border-color 0.2s ease;
}
.yb-contest.yb-decided { border-color: rgba(74, 222, 128, 0.4); }
.yb-contest-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.85rem; }
.yb-contest-ico {
  width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; border-radius: 0.6rem; background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.yb-contest-meta { min-width: 0; flex: 1; }
.yb-contest-name {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; font-size: 1.02rem; color: #fff; line-height: 1.15;
}
.yb-contest-status { font-family: 'Barlow', sans-serif; font-size: 0.8rem; margin-top: 0.1rem; }
.yb-status-open { color: #8b99b8; }
.yb-status-done { color: #4ade80; }
.yb-status-done b { color: #a7f3c8; }

.yb-cands { display: grid; grid-template-columns: 1fr; gap: 0.7rem; }

/* ── Candidate card ─────────────────────────────────────────────────────── */
.yb-cand {
  position: relative; display: flex; flex-direction: column; gap: 0.65rem;
  background: linear-gradient(160deg, rgba(18, 27, 52, 0.7), rgba(11, 17, 36, 0.6));
  border: 1px solid rgba(255, 255, 255, 0.09); border-radius: 0.8rem; padding: 0.85rem;
  transition: border-color 0.2s ease, transform 0.15s ease;
}
.yb-cand.yb-picked {
  border-color: rgba(74, 222, 128, 0.6);
  background: linear-gradient(160deg, rgba(20, 44, 32, 0.6), rgba(11, 24, 20, 0.55));
}
/* One-shot confirmation the instant a pick lands (added via JS, then removed). */
.yb-cand.yb-just-picked { animation: ybPick 0.7s ease-out 1; }
@keyframes ybPick {
  0%   { transform: scale(1); box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.0); }
  30%  { transform: scale(1.015); box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.28); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.0); }
}
.yb-cand-top { display: flex; align-items: flex-start; gap: 0.7rem; }
.yb-cand-photo {
  width: 52px; height: 52px; flex: none; border-radius: 50%; object-fit: cover;
  background: #1a2540 center/cover no-repeat; border: 1.5px solid rgba(255, 255, 255, 0.14);
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: #7f8db0;
}
.yb-cand-id { min-width: 0; flex: 1; }
.yb-cand-name {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 1.08rem;
  color: #fff; line-height: 1.1; letter-spacing: 0.01em; cursor: pointer;
  background: none; border: none; padding: 0; text-align: left;
}
.yb-cand-name:hover { color: #f5c842; text-decoration: underline; }
.yb-cand-office { font-family: 'Barlow', sans-serif; font-size: 0.8rem; color: #9fb0d0; margin-top: 0.12rem; }
.yb-cand-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-top: 0.3rem; }

/* Promise % pill — the track-record score, the primary sort key. */
.yb-score {
  display: inline-flex; align-items: baseline; gap: 0.28rem; flex: none;
  font-family: 'Barlow Condensed', sans-serif; padding: 0.28rem 0.55rem;
  border-radius: 0.5rem; border: 1px solid; line-height: 1;
}
.yb-score b { font-size: 1.05rem; font-weight: 800; }
.yb-score span { font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; opacity: 0.85; }
.yb-score.yb-noscore { color: #9fb4d4; border-color: rgba(159, 180, 212, 0.4); }
.yb-score.yb-noscore b { font-size: 0.82rem; }

.yb-stances { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.yb-glance { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }

.yb-cand-actions { display: flex; gap: 0.5rem; margin-top: 0.15rem; }
.yb-pick {
  flex: 1; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; font-size: 0.86rem; cursor: pointer; border-radius: 0.6rem;
  color: #fbbf24; background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.5); transition: transform 0.12s ease, background 0.15s ease;
}
.yb-pick:hover { transform: translateY(-1px); background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(245, 158, 11, 0.14)); }
.yb-cand.yb-picked .yb-pick {
  color: #4ade80; background: linear-gradient(135deg, rgba(74, 222, 128, 0.22), rgba(74, 222, 128, 0.1));
  border-color: rgba(74, 222, 128, 0.55);
}
.yb-details {
  min-height: 44px; padding: 0 0.85rem; display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; font-size: 0.82rem; cursor: pointer; border-radius: 0.6rem;
  color: #9fb4d4; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.12);
  transition: background 0.15s ease, color 0.15s ease;
}
.yb-details:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.yb-morebtn {
  width: 100%; min-height: 42px; margin-top: 0.15rem; cursor: pointer;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; font-size: 0.8rem; color: #cdd8ef;
  background: rgba(255, 255, 255, 0.04); border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 0.6rem; transition: background 0.15s ease;
}
.yb-morebtn:hover { background: rgba(255, 255, 255, 0.09); }

/* ── "Compare full race" — stages the whole seat into the side-by-side tool ─
      A calm, full-width blue bar between the contest head and its candidate
      cards. Blue (not the gold "pick" accent) so it reads as a research action,
      not a commitment. Sits above the fold on every contest, and the large tap
      target keeps it thumb-friendly on phones. */
.yb-compare-race {
  width: 100%; min-height: 48px; margin-bottom: 0.85rem; cursor: pointer;
  display: flex; align-items: center; gap: 0.6rem; text-align: left;
  padding: 0.6rem 0.8rem; border-radius: 0.7rem;
  color: #bfdbfe; background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(96, 165, 250, 0.32);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.yb-compare-race:hover {
  background: rgba(59, 130, 246, 0.18); border-color: rgba(96, 165, 250, 0.6);
  transform: translateY(-1px);
}
.yb-compare-race:active { transform: translateY(0); }
.yb-compare-ico { flex: none; font-size: 1.15rem; line-height: 1; }
.yb-compare-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.yb-compare-title {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; font-size: 0.86rem; color: #e0ecff; line-height: 1.15;
}
.yb-compare-sub { font-family: 'Barlow', sans-serif; font-size: 0.72rem; color: #9fb4d4; line-height: 1.3; }
.yb-compare-go { flex: none; font-size: 1.3rem; line-height: 1; color: #93c5fd; }

.yb-contest-empty {
  font-family: 'Barlow', sans-serif; font-size: 0.86rem; color: #8b99b8;
  padding: 0.5rem 0.2rem; line-height: 1.5;
}
.yb-contest-empty a { color: #f5c842; }

/* ── Footer: reassurance + bridge to the broader library ────────────────── */
.yb-foot {
  max-width: 46rem; margin: 1.6rem auto 0; text-align: center;
  font-family: 'Barlow', sans-serif; color: #9fb0d0; font-size: 0.9rem; line-height: 1.55;
}
.yb-foot-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; margin-top: 0.9rem; }
.yb-foot-btn {
  min-height: 44px; padding: 0 1.1rem; display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; font-size: 0.84rem; cursor: pointer; border-radius: 0.6rem;
  text-decoration: none; transition: transform 0.12s ease;
}
.yb-foot-btn:hover { transform: translateY(-1px); }
.yb-foot-btn.is-team {
  color: #0a0f1e; background: linear-gradient(135deg, #fad96a, #e6b800);
  box-shadow: 0 0 14px rgba(245, 200, 66, 0.35);
}
.yb-foot-btn.is-ghost { color: #cdd8ef; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.14); }
.yb-synced { display: inline-flex; align-items: center; gap: 0.35rem; color: #4ade80; font-size: 0.82rem; }

.yb-loading { text-align: center; color: #8b99b8; font-family: 'Barlow', sans-serif; padding: 1.5rem 0; }

/* ── Wider screens: two-up candidate grid, roomier padding ──────────────── */
@media (min-width: 720px) {
  #your-ballot { padding: 4rem 1.5rem 4.5rem; }
  .yb-cands { grid-template-columns: 1fr 1fr; }
  .yb-contest-empty { grid-column: 1 / -1; }
  .yb-morebtn { grid-column: 1 / -1; }
}

/* ── Small phones: tighten side padding and let the location bar breathe so
      the "Change location" control never crowds the address text. ─────────── */
@media (max-width: 400px) {
  #your-ballot { padding: 2.4rem 0.8rem 3rem; }
  .yb-title { font-size: 2.1rem; }
  .yb-locbar { flex-direction: column; align-items: flex-start; gap: 0.55rem; }
  .yb-loc-change { width: 100%; text-align: center; }
  .yb-cand { padding: 0.75rem; }
}


/* Dual alignment readout (Your Match + Say-vs-Do) on candidate cards */
.yb-cand-align { margin-top: 0.4rem; }
