:root {
  --red: #CA241B; --red-soft: #FBE9E7; --ink: #1D1D1F; --mute: #6E6E73; --faint: #A1A1A6;
  --line: #E3E3E8; --card: #F5F5F7; --bg: #FCFCFC; --night: #0B0B0D; --green: #1B8A4B;
  --font: "Helvetica Neue", Inter, "Segoe UI", Arial, sans-serif; --ease: cubic-bezier(.2,.8,.2,1);
  --zd: #8E8E93; --zu: #C7A15A; --za: #CA241B;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; border: 0; }
.red { color: var(--red); }

/* connection banner */
body.offline::before { content: "Reconnecting…"; position: fixed; top: 0; left: 0; right: 0; background: var(--ink); color: #fff; text-align: center; padding: 8px; font-size: 14px; z-index: 99; }

/* live dot */
.live { position: relative; width: 12px; height: 12px; display: inline-block; }
.live i { position: absolute; inset: 0; background: var(--red); border-radius: 50%; }
.live::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--red); animation: ring 2s ease-out infinite; }
@keyframes ring { from { transform: scale(.6); opacity: .9; } to { transform: scale(2.6); opacity: 0; } }
@keyframes up { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.up { animation: up .6s var(--ease) both; animation-delay: var(--d, 0s); }

/* ---- results ---- */
.rbars { display: grid; gap: 12px; }
.rrow { display: grid; grid-template-columns: 34px minmax(80px, 150px) 1fr 52px 34px; align-items: center; gap: 12px; font-size: 1.05em; }
.rrow .rl { color: var(--red); font-weight: 700; }
.rrow .rt { font-weight: 600; }
.track { height: 30px; background: var(--card); border-radius: 10px; overflow: hidden; }
.track i { display: block; height: 100%; background: var(--red); border-radius: 10px; transition: width .9s var(--ease); }
.rrow .rp { text-align: right; font-variant-numeric: tabular-nums; }
.rrow .rc { color: var(--faint); font-style: normal; font-size: .85em; text-align: right; }
.rrow.mine .rt::after { content: " · you"; color: var(--red); font-weight: 500; }
.rrow.choice { grid-template-columns: minmax(140px, 240px) 1fr 52px 40px; }
.rrow.choice .rt small { display: block; font-weight: 500; color: var(--mute); font-size: .75em; }
.rrow .ahead { display: none; font-style: normal; }
.rrow.lead .ahead { display: inline; color: var(--red); font-weight: 700; }
.rrow.lead .track i { background: var(--red); }

.hist { display: grid; grid-template-columns: repeat(9, 1fr); gap: 10px; align-items: end; height: var(--hh, 200px); }
.hcol { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.hcol .hbar { width: 100%; flex: 1; display: flex; align-items: flex-end; background: var(--card); border-radius: 10px; overflow: hidden; }
.hcol .hbar i { display: block; width: 100%; border-radius: 10px; transition: height .9s var(--ease); background: var(--zd); }
.hcol.zu .hbar i { background: var(--zu); } .hcol.za .hbar i { background: var(--za); }
.hcol em { font-style: normal; font-size: .85em; color: var(--mute); font-variant-numeric: tabular-nums; min-height: 1.2em; }
.hcol b { font-size: 1em; color: var(--mute); }
.hcol.mine b { color: #fff; background: var(--red); border-radius: 50%; width: 1.7em; height: 1.7em; display: grid; place-items: center; }
.zones { display: grid; grid-template-columns: 3fr 3fr 3fr; text-align: center; font-size: .8em; color: var(--mute); margin-top: 6px; }
.zones .za { color: var(--red); font-weight: 700; }
.sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.chip { background: var(--card); border-radius: 14px; padding: 12px 14px; }
.chip b { display: block; font-size: 1.9em; letter-spacing: -.02em; }
.chip span { font-size: .8em; color: var(--mute); }
.chip.za { background: var(--red-soft); } .chip.za b { color: var(--red); }

/* ---- panel chips (shared by phone, projector, admin) ---- */
.pchips { display: flex; flex-wrap: wrap; gap: .5em; }
.pchip { display: inline-flex; align-items: center; gap: .55em; padding: .45em .8em; border-radius: 2em; background: var(--card); color: var(--faint); font-size: 1em; border: 2px solid transparent; transition: background .25s, color .25s, border-color .25s, transform .3s var(--ease); max-width: 100%; }
.pchip .pn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pchip .pr { font-style: normal; font-size: .72em; letter-spacing: .08em; text-transform: uppercase; color: var(--red); font-weight: 700; }
.pchip .pv { font-variant-numeric: tabular-nums; min-width: 1.4em; text-align: center; }
.pchip.here { color: var(--ink); background: #fff; border-color: var(--line); }
.pchip.voted { color: var(--green); background: #E3F4E7; border-color: #BFE3C8; }
.pchip.has { color: #fff; transform: scale(1.02); }
.pchip.has.zd { background: var(--zd); } .pchip.has.zu { background: var(--zu); } .pchip.has.za { background: var(--za); } .pchip.has.zc { background: var(--ink); }
.pchip.has .pv { background: rgba(255,255,255,.2); border-radius: 1em; padding: 0 .5em; font-weight: 700; }
.pchip.has .pr { color: #fff; opacity: .78; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
