/* Live results: "Election Night" stage */
:root {
  --neon: #4fc3ff;
  --neon-glow: rgba(79, 195, 255, 0.55);
  --velvet: #c8102e;
  --velvet-dark: #7a0819;
  --stage-night: #0b1226;
  --lime: #8be04e;
  --pink: #ff5fa2;
}

.live-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--red); margin-right: 4px; vertical-align: 1px; animation: livePulse 1.4s ease-in-out infinite; }
@keyframes livePulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(200, 16, 46, 0.6); } 50% { box-shadow: 0 0 0 6px rgba(200, 16, 46, 0); } }

.results { display: grid; grid-template-columns: 275px minmax(0, 1fr) 270px; gap: 1rem; align-items: stretch; }

/* ---------- Side panels ---------- */
.res-panel {
  background: linear-gradient(180deg, #1d2f5e 0%, #14213d 100%); color: var(--paper);
  border: 3px solid var(--ink); border-radius: 12px; padding: 1rem; box-shadow: var(--shadow-lg);
  position: relative; overflow: hidden;
}
.res-panel::before { content: ''; position: absolute; inset: 0 0 auto; height: 6px; background: repeating-linear-gradient(90deg, var(--red) 0 18px, var(--paper) 18px 30px); }
.res-title { font-size: 1.3rem; color: var(--gold); margin: 0.3rem 0 0.8rem; }
#res-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.res-row {
  width: 100%; display: grid; grid-template-columns: 1.1rem 30px minmax(0, 1fr) auto; gap: 0.45rem; align-items: center;
  padding: 0.45rem 0.5rem; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04); color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: background var(--fast), border-color var(--fast);
}
.res-row:hover { background: rgba(255, 255, 255, 0.1); }
.res-row[aria-pressed='true'] { border-color: var(--gold); background: rgba(212, 160, 23, 0.16); }
.res-rank { font-family: var(--font-display); color: var(--gold); text-align: center; }
.res-avatar { --suit: var(--navy); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--suit); border: 2px solid var(--paper); font-size: 1.05rem; }
.res-avatar-lg { width: 64px; height: 64px; font-size: 2rem; border-width: 3px; box-shadow: 0 0 0 3px var(--ink), 0 0 18px var(--neon-glow); flex-shrink: 0; }
.res-main { min-width: 0; display: grid; gap: 4px; }
.res-name { font-weight: 800; font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.res-fill { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, var(--red), var(--gold)); transition: width 600ms var(--ease); }
.res-share { font-family: var(--font-display); font-size: 0.85rem; color: var(--neon); }

/* ---------- Stage ---------- */
.stage {
  position: relative; min-height: 540px; overflow: hidden; isolation: isolate;
  border: 3px solid var(--ink); border-radius: 16px; box-shadow: var(--shadow-lg);
  background:
    radial-gradient(ellipse 60% 45% at 50% 32%, rgba(79, 195, 255, 0.22), transparent 70%),
    radial-gradient(ellipse at 50% 20%, #2a3f7a 0%, #14213d 55%, var(--stage-night) 100%);
}
.curtain {
  position: absolute; z-index: 1; top: 0; bottom: 16%; width: 15%;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.35), transparent 30%, rgba(0, 0, 0, 0.25) 60%, transparent 85%),
    repeating-linear-gradient(90deg, var(--velvet-dark) 0 6px, var(--velvet) 6px 20px, #a30d26 20px 28px);
  box-shadow: inset 0 -30px 40px rgba(0, 0, 0, 0.45);
}
.curtain-left { left: 0; border-bottom-right-radius: 100% 35%; }
.curtain-right { right: 0; border-bottom-left-radius: 100% 35%; transform: scaleX(-1); }
.valance {
  position: absolute; z-index: 4; inset: 0 0 auto; height: 44px;
  background:
    radial-gradient(ellipse 50% 100% at 50% 0, var(--velvet) 96%, transparent 100%) 0 14px / 64px 30px repeat-x,
    linear-gradient(var(--velvet-dark), var(--velvet)) 0 0 / 100% 16px no-repeat;
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.4));
}
.valance::after { content: ''; position: absolute; left: 0; right: 0; top: 14px; height: 3px; background: var(--gold); }

.screen {
  position: absolute; z-index: 1; top: 13%; left: 50%; transform: translateX(-50%);
  width: min(54%, 440px); aspect-ratio: 16 / 8.5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem; text-align: center;
  background: radial-gradient(ellipse at 50% 40%, #ffffff, #f0e6cc);
  border: 4px solid #fff; border-radius: 22px;
  box-shadow: 0 0 0 4px var(--neon), 0 0 34px 8px var(--neon-glow), inset 0 0 30px rgba(20, 33, 61, 0.18);
  animation: screenGlow 3s ease-in-out infinite;
}
@keyframes screenGlow { 50% { box-shadow: 0 0 0 4px var(--neon), 0 0 48px 14px var(--neon-glow), inset 0 0 30px rgba(20, 33, 61, 0.18); } }
.screen-live { font-weight: 800; font-size: clamp(0.6rem, 1.2vw, 0.8rem); letter-spacing: 0.14em; text-transform: uppercase; color: #fff; background: var(--red); padding: 0.1rem 0.6rem; border-radius: 99px; animation: blink 1.4s steps(2, start) infinite; }
@keyframes blink { 50% { opacity: 0.55; } }
.screen-logo { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.6rem, 4.4vw, 3.3rem); line-height: 1; color: var(--red); text-shadow: 3px 3px 0 var(--navy), 5px 5px 0 rgba(20, 33, 61, 0.25); letter-spacing: 0.02em; }
.screen-sub { font-family: var(--font-display); font-size: clamp(0.8rem, 1.8vw, 1.3rem); color: var(--navy); text-transform: uppercase; letter-spacing: 0.12em; }
.screen-count { font-family: var(--font-type); font-size: clamp(0.62rem, 1.1vw, 0.8rem); color: var(--muted); }

.stage-floor {
  position: absolute; z-index: 0; inset: auto 0 0; height: 24%;
  background: linear-gradient(180deg, #1c2d63 0%, var(--stage-night) 100%);
  border-top: 2px solid var(--neon);
  box-shadow: 0 -12px 40px rgba(79, 195, 255, 0.3);
}
.stage-floor::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 60px, rgba(79, 195, 255, 0.08) 60px 62px); }

/* ---------- Podiums & figures ---------- */
.podiums {
  position: absolute; z-index: 3; inset: auto 0 5% 0;
  display: grid; grid-template-columns: 1fr 1.2fr 1fr; align-items: end; gap: 3%; padding: 0 13%;
}
.podium-slot { position: relative; display: flex; flex-direction: column; align-items: center; background: none; border: 0; padding: 0; color: var(--paper); font: inherit; cursor: pointer; min-width: 0; }
.slot-1::before {
  content: ''; position: absolute; z-index: -1; bottom: 30%; left: 50%; width: 260%; height: 520px; transform: translateX(-50%);
  clip-path: polygon(44% 0, 56% 0, 82% 100%, 18% 100%);
  background: linear-gradient(180deg, rgba(255, 248, 210, 0.05), rgba(255, 248, 210, 0.3) 60%, rgba(255, 248, 210, 0.08));
  pointer-events: none;
}
.figure { --suit: var(--navy); position: relative; display: flex; flex-direction: column; align-items: center; font-size: clamp(40px, 5vw, 66px); animation: bob 2.6s ease-in-out infinite; transition: transform 250ms var(--ease); }
.slot-1 .figure { font-size: clamp(52px, 6.6vw, 86px); animation-delay: -0.8s; }
.slot-3 .figure { animation-delay: -1.6s; }
.podium-slot:hover .figure, .podium-slot[aria-pressed='true'] .figure { transform: translateY(-6px) scale(1.05); }
.fig-head { position: relative; z-index: 2; line-height: 1; filter: drop-shadow(0 5px 0 rgba(0, 0, 0, 0.35)); }
.fig-emoji { display: block; font-size: 1em; }
.fig-face { width: 1.1em; height: 1.1em; border-radius: 50%; object-fit: cover; border: 3px solid var(--paper); }
.fig-body {
  position: relative; width: 0.92em; height: 0.72em; margin-top: -0.14em;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.18), transparent 35%, transparent 65%, rgba(0, 0, 0, 0.18)), var(--suit);
  border: 3px solid var(--ink); border-radius: 0.36em 0.36em 0.1em 0.1em;
}
.fig-body::before { content: ''; position: absolute; top: -1px; left: 50%; transform: translateX(-50%); width: 0.34em; height: 0.42em; background: #fff; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.fig-tie { position: absolute; z-index: 1; top: 0.03em; left: 50%; transform: translateX(-50%); width: 0.11em; height: 0.36em; background: var(--red); clip-path: polygon(30% 0, 70% 0, 100% 25%, 65% 100%, 35% 100%, 0 25%); }
.fig-crown { position: absolute; z-index: 3; top: -0.42em; left: 50%; transform: translateX(-50%) rotate(-10deg); font-size: 0.5em; filter: drop-shadow(2px 2px 0 var(--ink)); }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }

.plinth {
  --h: 56px; position: relative; width: 100%; min-height: var(--h); margin-top: 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 0.4rem 0.3rem;
  background: linear-gradient(180deg, #3a7cf0 0%, #1d3f9e 100%);
  border: 3px solid var(--ink); border-radius: 50% 50% 8px 8px / 16px 16px 8px 8px;
  box-shadow: 0 0 22px rgba(79, 195, 255, 0.45), inset 0 6px 0 rgba(255, 255, 255, 0.25);
}
.slot-1 .plinth { --h: 104px; background: linear-gradient(180deg, #5fd0ff 0%, #2a6fe0 45%, #1d3f9e 100%); box-shadow: 0 0 34px rgba(79, 195, 255, 0.75), inset 0 8px 0 rgba(255, 255, 255, 0.35); }
.slot-2 .plinth { --h: 74px; }
.podium-slot[aria-pressed='true'] .plinth { outline: 3px solid var(--gold); outline-offset: 2px; }
.plinth-rank { font-family: var(--font-display); font-size: 1.3rem; line-height: 1; color: #fff; text-shadow: 2px 2px 0 var(--ink); }
.slot-1 .plinth-rank { font-size: 1.8rem; color: var(--gold); }
.plinth-name { max-width: 100%; font-family: var(--font-display); font-size: clamp(0.62rem, 1.1vw, 0.85rem); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--paper); color: var(--ink); padding: 0.05rem 0.45rem; border-radius: 3px; }
.plinth-share { font-family: var(--font-display); font-size: 0.95rem; color: #fff; }

/* ---------- Stat panel ---------- */
.detail-head { display: flex; gap: 0.8rem; align-items: center; margin: 0.4rem 0 1rem; }
.detail-rank { margin: 0; font-family: var(--font-type); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold); }
.detail-name { margin: 0.1rem 0; font-size: 1.45rem; color: #fff; overflow-wrap: anywhere; }
.detail-party { margin: 0; font-size: 0.75rem; opacity: 0.75; }
.stat-row { --tone: var(--neon); display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 0.6rem; align-items: center; padding: 0.4rem 0; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
.tone-cyan { --tone: var(--neon); }
.tone-lime { --tone: var(--lime); }
.tone-gold { --tone: var(--gold); }
.tone-pink { --tone: var(--pink); }
.stat-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; border: 2px solid var(--tone); background: rgba(0, 0, 0, 0.25); box-shadow: 0 0 10px color-mix(in srgb, var(--tone) 45%, transparent); font-size: 1.1rem; }
.stat-label { display: grid; gap: 5px; font-size: 0.8rem; font-weight: 600; }
.stat-meter { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.stat-meter span { display: block; height: 100%; background: var(--tone); border-radius: 3px; }
.stat-value { font-family: var(--font-display); font-weight: 400; font-size: 1.15rem; color: var(--tone); }
.detail-actions { display: flex; gap: 0.6rem; margin-top: 1rem; }
.detail-actions .btn { flex: 1; padding: 0.7rem 0.5rem; font-size: 0.8rem; box-shadow: 3px 3px 0 #000; }

/* ---------- Celebration ---------- */
.confetti { position: absolute; z-index: 5; inset: 0; pointer-events: none; overflow: hidden; }
.confetti span { position: absolute; top: -16px; width: 8px; height: 14px; border-radius: 2px; animation: confettiFall 2.4s linear forwards; }
@keyframes confettiFall { to { transform: translateY(620px) rotate(760deg); opacity: 0.2; } }
.new-leader {
  position: absolute; z-index: 6; top: 44%; left: 50%; transform: translate(-50%, -50%) rotate(-4deg);
  display: flex; flex-direction: column; align-items: center; padding: 0.5rem 1.4rem;
  background: var(--gold); color: var(--ink); border: 4px solid var(--ink); border-radius: 10px; box-shadow: var(--shadow-lg);
  animation: leaderPop 3.2s var(--ease) forwards;
}
.new-leader span { font-family: var(--font-type); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.8rem; }
.new-leader strong { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.4rem, 3vw, 2.2rem); text-transform: uppercase; }
@keyframes leaderPop { 0% { opacity: 0; scale: 0.4; } 12% { opacity: 1; scale: 1.08; } 20%, 85% { scale: 1; opacity: 1; } 100% { opacity: 0; } }

/* Compact stage on the home page */
.stage-mini { min-height: 500px; max-width: 920px; margin: 0 auto; }
.stage-mini .screen { top: 11%; width: min(42%, 340px); aspect-ratio: 16 / 7.5; }
.stage-mini .podiums { padding: 0 18%; }
.section-head h2 .live-dot { width: 12px; height: 12px; vertical-align: 6px; }

.res-controls { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.2rem; }
.toggle { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 800; cursor: pointer; }
.toggle input { width: 20px; height: 20px; accent-color: var(--red); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .results { grid-template-columns: minmax(0, 1fr) 260px; }
  .stage { grid-column: 1 / -1; order: -1; }
}
@media (max-width: 760px) {
  .results { grid-template-columns: 1fr; }
  .stage { min-height: 400px; }
  .curtain { width: 12%; }
  .screen { width: 68%; top: 12%; border-radius: 16px; }
  .podiums { padding: 0 7%; gap: 2%; }
  .slot-1 .plinth { --h: 84px; }
  .slot-2 .plinth { --h: 62px; }
  .plinth { --h: 48px; }
  .stage-mini { min-height: 380px; }
  .stage-mini .screen { width: 66%; }
  .stage-mini .podiums { padding: 0 7%; }
  .res-detail { order: 0; }
  .res-list { order: 1; }
}
@media (max-width: 420px) {
  .stage { min-height: 360px; }
  .figure { font-size: 38px; }
  .slot-1 .figure { font-size: 50px; }
  .plinth-rank { font-size: 1rem; }
  .slot-1 .plinth-rank { font-size: 1.35rem; }
  .plinth-share { font-size: 0.8rem; }
}

/* ---------- Audit desk (lawyer mascot) ---------- */
.audit-desk {
  margin-top: 1.4rem; display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 1.4rem; align-items: center;
  background: linear-gradient(135deg, #fffaf0 0%, #f3e6c4 100%);
  border: 3px solid var(--ink); border-radius: 14px; padding: 1.2rem 1.4rem; box-shadow: var(--shadow-lg);
  position: relative; overflow: hidden;
}
.audit-desk::after { content: '⚖️'; position: absolute; right: -10px; bottom: -24px; font-size: 7rem; opacity: 0.08; pointer-events: none; }
.lawyer { position: relative; }
.lawyer .character { width: 100%; height: auto; filter: drop-shadow(3px 5px 0 rgba(20, 33, 61, 0.35)); }
.briefcase { position: absolute; right: -6px; bottom: 14px; font-size: 2.2rem; transform: rotate(-8deg); filter: drop-shadow(2px 2px 0 var(--ink)); }
.audit-body .kicker { margin-bottom: 0.2rem; }
.audit-title { margin: 0 0 0.5rem; font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.1rem); color: var(--navy); }
.speech { position: relative; margin: 0 0 0.8rem; padding: 0.7rem 0.9rem; background: #fff; border: 2px solid var(--ink); border-radius: 12px; font-family: var(--font-type); font-size: 0.95rem; box-shadow: 3px 3px 0 var(--ink); }
.speech::before { content: ''; position: absolute; left: -11px; top: 18px; border: 9px solid transparent; border-right-color: var(--ink); border-left: 0; }
.formula { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.7rem; }
.formula-chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.75rem; background: var(--navy); color: var(--paper); border-radius: 99px; font-weight: 800; font-size: 0.82rem; }
.audit-status { margin: 0 0 0.3rem; font-weight: 700; font-size: 0.9rem; }
.audit-status.is-ok { color: #2e7d4f; }
.audit-status.is-late { color: var(--red); }
.audit-status.is-demo { color: #9a6b00; }
.num-cell { font-family: var(--font-display); font-size: 1.05rem; }
.unpinned { color: var(--red); font-weight: 700; font-size: 0.8rem; }
@media (max-width: 640px) {
  .audit-desk { grid-template-columns: 90px minmax(0, 1fr); gap: 0.9rem; padding: 1rem; }
  .speech { font-size: 0.85rem; }
  .briefcase { font-size: 1.5rem; }
}

/* ---------- Winners' podium: stepped 1-2-3 blocks ---------- */
.podiums { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 0 15%; bottom: 4%; }
.stage-mini .podiums { padding: 0 20%; }
.podium-slot .figure { margin-bottom: 12px; } /* feet land on the block's top face */
.plinth {
  --h: 92px; --trim: #d08a4a; --face-top: #3f7fe8; --face-bottom: #1d3f9e;
  position: relative; width: 100%; min-height: var(--h); margin-top: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px;
  padding: 0.55rem 0.3rem 0.4rem;
  background: linear-gradient(180deg, var(--face-top) 0%, var(--face-bottom) 100%);
  border: 3px solid var(--ink); border-radius: 0;
  box-shadow: inset 0 -12px 0 rgba(0, 0, 0, 0.2), inset 6px 0 0 rgba(255, 255, 255, 0.12), 0 0 26px rgba(79, 195, 255, 0.35);
}
/* top face of each step */
.plinth::before {
  content: ''; position: absolute; left: -3px; right: -3px; top: -16px; height: 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--trim) 70%, #fff), var(--trim));
  clip-path: polygon(7% 0, 93% 0, 100% 100%, 0 100%);
}
.podium-slot + .podium-slot .plinth { margin-left: -3px; width: calc(100% + 3px); } /* blocks share edges */
.slot-1 .plinth { --h: 150px; --trim: #e8b923; --face-top: #5fc4ff; --face-bottom: #2253c9; z-index: 1; box-shadow: inset 0 -12px 0 rgba(0, 0, 0, 0.2), inset 6px 0 0 rgba(255, 255, 255, 0.18), 0 0 40px rgba(232, 185, 35, 0.45); }
.slot-2 .plinth { --h: 118px; --trim: #cfd8e3; }
.slot-3 .plinth { --h: 92px; --trim: #d08a4a; }
.podium-slot[aria-pressed='true'] .plinth { outline: 3px solid var(--gold); outline-offset: -8px; }
.plinth-rank { font-family: var(--font-display); font-size: clamp(2rem, 3.6vw, 3.2rem); line-height: 0.9; color: var(--trim); text-shadow: 3px 3px 0 var(--ink); }
.slot-1 .plinth-rank { font-size: clamp(2.6rem, 4.8vw, 4.2rem); color: var(--trim); }
.plinth-name { font-size: clamp(0.58rem, 0.9vw, 0.78rem); max-width: 94%; }
.plinth-share { font-size: 0.9rem; text-shadow: 1px 1px 0 var(--ink); }
.stage-floor { height: 20%; }

@media (max-width: 760px) {
  .podiums, .stage-mini .podiums { padding: 0 6%; }
  .slot-1 .plinth { --h: 118px; }
  .slot-2 .plinth { --h: 90px; }
  .slot-3 .plinth { --h: 70px; }
  .plinth { padding: 0.4rem 0.2rem 0.3rem; }
  .plinth-rank { font-size: 1.9rem; }
  .slot-1 .plinth-rank { font-size: 2.5rem; }
  .plinth-share { font-size: 0.75rem; }
}
@media (max-width: 420px) {
  .plinth-name { font-size: 0.55rem; padding: 0 0.25rem; }
}
/* Room for the tallest step + character under the screen */
.stage:not(.stage-mini) { min-height: 640px; }
.stage:not(.stage-mini) .screen { top: 11%; width: min(44%, 380px); }
.stage-mini { min-height: 560px; }
@media (max-width: 760px) {
  .stage:not(.stage-mini) { min-height: 500px; }
  .stage-mini { min-height: 460px; }
  .stage .screen, .stage:not(.stage-mini) .screen { width: 58%; top: 11%; }
}
.stage-mini { min-height: 600px; }
.stage-mini .screen { top: 9%; width: min(38%, 320px); }
@media (max-width: 760px) {
  .stage-mini { min-height: 480px; }
  .stage-mini .screen { width: 58%; top: 10%; }
}
