/* ------------------------------------------------------------------
   Incumbents, leading indicators, results, coalitions and alliances.
   Loaded after campaign.css; uses the same tokens.
   ------------------------------------------------------------------ */

/* ---------------------------------------------------------- tabs */

.panel-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-tab {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-2);
  cursor: pointer;
  padding: 11px 14px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.panel-tab:hover { color: var(--muted); }
.panel-tab.is-active { color: var(--cream); border-bottom-color: var(--wheat); }
.panel-tab:focus-visible { outline: 3px solid var(--river); outline-offset: -3px; }

/* ---------------------------------------------------------- leading */

.leading-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--party, var(--navy));
  color: var(--party-ink, #fff);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.leading-party { font-size: 0.82rem; }
.leading-word { opacity: 0.85; }
.target-leading { align-self: flex-start; }

/* ---------------------------------------------------------- seat detail */

.seat-detail { display: flex; flex-direction: column; gap: 20px; }
.seat-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.seat-detail-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.seat-detail-ac { color: var(--muted-2); font-weight: 400; font-size: 1.1rem; }
.seat-detail-district {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

/* the real half */
.incumbent-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  border-left: 4px solid var(--river);
  background: var(--wash-blue);
}
.incumbent-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.incumbent-block { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.incumbent-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}
.incumbent-party { font-size: 1.05rem; font-weight: 700; }
.incumbent-strength { font-size: 1.05rem; font-weight: 700; color: var(--cream); }
.incumbent-note { font-size: 0.8rem; color: var(--muted-2); line-height: 1.5; }
.incumbent-disclaimer { font-style: italic; }

/* the fictional half */
.race-block { display: flex; flex-direction: column; gap: 12px; }
.race-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}
.race-rating { font-weight: 700; font-size: 0.9rem; letter-spacing: 0.04em; }
.race-bars { display: flex; flex-direction: column; gap: 7px; }
.race-row {
  display: grid;
  grid-template-columns: 86px 1fr 54px auto;
  gap: 10px;
  align-items: center;
  font-size: 0.9rem;
}
.race-row.is-you { font-weight: 700; }
.race-name { display: inline-flex; align-items: center; gap: 7px; }
.race-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.race-you {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--river);
}
.race-track { height: 10px; border-radius: 5px; background: var(--paper-3); overflow: hidden; }
.race-fill { display: block; height: 100%; border-radius: 5px; transition: width 0.4s ease; }
.race-value { text-align: right; font-variant-numeric: tabular-nums; }
.race-lead {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--wheat);
}

.projected {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
  background: var(--ink-2);
}
.projected-party {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
}
.projected-note { font-size: 0.84rem; color: var(--muted-2); }

/* ---------------------------------------------------------- result */

.screen-result { padding: 34px 22px 70px; }
.result-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.verdict {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 26px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--ink-2);
  text-align: center;
  align-items: center;
}
.verdict-win { border-color: var(--warn-good); background: rgba(127, 214, 160, 0.07); }
.verdict-lose { border-color: var(--danger); background: rgba(226, 99, 79, 0.06); }
.verdict-hung { border-color: var(--wheat-deep); background: var(--wash-gold); }

/*
 * The campaigns in a government formed by an alliance.
 *
 * Listed rather than merged, and the one at the head of it marked: an
 * alliance forms the government between them and one of them leads it, which
 * are two facts and not one. A list that read as a single winner would be
 * telling three campaigns they had all won.
 */
.verdict-alliance {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.verdict-ally {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 9px;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--party, var(--rule));
  background: var(--paper-2);
}
.verdict-ally.is-lead { border-color: var(--gold); background: var(--wash-gold); }
.verdict-ally-party { font-weight: 700; flex: none; }
.verdict-ally-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--navy-2);
  font-size: 0.8rem;
}
/*
 * Offering an alliance after the count, and answering one.
 *
 * Its own names rather than the coalition talks' `.pair-row`: two blocks can
 * sit on the same screen, and sharing a class made one of them answer for the
 * other whenever anything went looking for a row.
 */
.ally-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--rule);
  background: var(--paper-2);
}
.ally-row.is-offer { border-color: var(--gold); background: var(--wash-gold); }
.ally-who {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ally-actions { display: flex; gap: 6px; flex: none; align-items: center; }

/*
 * What a proposal is asking for, under the name of whoever is asking.
 *
 * Quieter than the name and on its own line, because the leading party is
 * comparing two or three of these and the difference between them is the
 * term rather than the sender.
 */
.ally-terms {
  font-size: 0.78rem;
  color: var(--muted);
}
.ally-terms-pick {
  font: inherit;
  font-size: 0.78rem;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--ink-2);
  color: var(--cream);
  min-height: 34px;
  max-width: 12rem;
}
.ally-terms-pick:focus-visible { outline: 3px solid var(--river); outline-offset: 2px; }
.ally-note { margin-top: 0; }

/* On a phone the row stacks rather than squeezing the select to nothing. */
@media (max-width: 560px) {
  .ally-row { flex-wrap: wrap; }
  .ally-actions { width: 100%; }
  .ally-terms-pick { flex: 1 1 auto; max-width: none; }
}

.verdict-ally-seats {
  flex: none;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.verdict-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.verdict-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4.5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.verdict-office { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.verdict-name { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; }
.verdict-party { font-weight: 700; }
.verdict-congrats { margin: 6px 0 0; font-size: 0.95rem; color: var(--muted); }

.result-block { display: flex; flex-direction: column; gap: 12px; }
.result-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
}
.result-rows { display: flex; flex-direction: column; gap: 7px; }
.result-row {
  display: grid;
  grid-template-columns: 66px 1fr 2fr 42px auto;
  gap: 10px;
  align-items: center;
  font-size: 0.9rem;
}
.result-row.is-out { opacity: 0.5; }
.result-party { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; }
.result-candidate {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-track { height: 12px; border-radius: 6px; background: var(--paper-3); overflow: hidden; }
.result-fill { display: block; height: 100%; border-radius: 6px; }
.result-seats {
  text-align: right;
  font-family: var(--font-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.result-out {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--danger);
  letter-spacing: 0.08em;
}
.result-totals {
  display: flex;
  gap: 22px;
  padding-top: 11px;
  border-top: 1px solid var(--line-soft);
  font-size: 0.9rem;
  color: var(--muted);
}
.result-totals strong { color: var(--cream); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------- coalition */

.coalition-block,
.alliance-block { display: flex; flex-direction: column; gap: 14px; }
.coalition-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--ink-2);
  text-align: left;
  width: 100%;
}
.summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}
.summary-value { font-weight: 700; text-align: right; }

.pair-list { display: flex; flex-direction: column; gap: 7px; }
.pair-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
  font: inherit;
  cursor: pointer;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
  background: var(--ink-2);
  color: var(--cream);
}
.pair-row:hover { border-color: var(--wheat-deep); }
.pair-row.is-selected { border-color: var(--wheat); background: var(--wash-gold); }
.pair-seats {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--wheat);
  white-space: nowrap;
}

.terms-form { display: flex; flex-direction: column; gap: 16px; }
.term-group { display: flex; flex-direction: column; gap: 7px; }
.term-options { display: flex; flex-wrap: wrap; gap: 7px; }
.term-option {
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--ink-2);
  color: var(--muted);
}
.term-option:hover { color: var(--cream); border-color: var(--wheat-deep); }
.term-option.is-selected {
  border-color: var(--wheat);
  background: var(--wash-gold-2);
  color: var(--cream);
  font-weight: 700;
}
.coalition-actions { display: flex; flex-direction: column; gap: 9px; }

/*
 * The oversight styles used to sit here.
 *
 * Reporting a rival has been taken out of the game, and the screen it was
 * drawn on went with it: .oversight, .rival-row, .finding-row and the rest
 * had nothing left to style. What the findings themselves look like is in
 * Investigation.php, and nothing triggers those either.
 */

/* ---------------------------------------------------------- responsive */

@media (max-width: 720px) {
  .incumbent-row { grid-template-columns: 1fr 1fr; }
  .race-row { grid-template-columns: 74px 1fr 48px; }
  .race-lead { display: none; }
  .result-row {
    grid-template-columns: 60px 1fr 40px;
    grid-template-areas: 'party candidate seats' 'track track track';
  }
  .result-party { grid-area: party; }
  .result-candidate { grid-area: candidate; }
  .result-track { grid-area: track; }
  .result-seats { grid-area: seats; }
  .result-out { display: none; }
  .rival-row { grid-template-columns: 1fr; gap: 10px; }
  .rival-status { align-items: flex-start; }
  .rival-done { max-width: none; text-align: left; }
  .screen-result { padding: 24px 16px 56px; }
  .summary-row { flex-direction: column; gap: 2px; }
  .summary-value { text-align: left; }
}
