:root {
    color-scheme: dark;
    --primary: #068fff;
    --deep-blue: #134fa3;
    --panel-alpha: .88;
    --panel-bg: rgb(8 29 52 / var(--panel-alpha));
    --overlay-text: #f3f8ff;
    --overlay-muted: #c1d3e6;
    --bar-color: #068fff;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; background: transparent !important; }
html, body, .overlay-root { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar, .overlay-root::-webkit-scrollbar { display: none; width: 0; height: 0; }
body {
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--overlay-text);
}
.overlay-background {
    position: fixed;
    z-index: 0;
    inset: 0;
    background: transparent;
    pointer-events: none;
}
body[data-background="chroma"] .overlay-background { background: var(--custom-background, #00ff00); }
body[data-background="solid"] .overlay-background { background: var(--custom-background, #00ff00); }
body[data-background="transparent"] {
    --panel-alpha: .3;
    --panel-bg: rgb(8 29 52 / .3);
}
body[data-background="transparent"] .overlay-summary,
body[data-background="transparent"] .results-panel {
    box-shadow: 0 10px 28px #020b1620, inset 0 1px #ffffff18;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
body[data-background="transparent"] .result-row { background: #081d3426; }
.overlay-root { position: relative; z-index: 1; min-height: 100vh; background: transparent !important; }
.overlay-stage {
    position: relative;
    width: min(100% - 48px, 1320px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 64px 0 clamp(22px, 4vw, 48px);
    background: transparent !important;
}
.overlay-clock {
    position: absolute;
    z-index: 2;
    top: 14px;
    right: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: #fff;
    background: transparent !important;
    box-shadow: none;
    font-size: clamp(13px, 1.8vw, 18px);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    letter-spacing: .06em;
    text-shadow: 0 1px 5px #0008;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.live-status, .results-heading, .overlay-footer, .candidate-line, .result-meta {
    display: flex;
    align-items: center;
}
.results-heading, .overlay-footer { justify-content: space-between; gap: 20px; }
.summary-label, .overlay-footer { color: var(--overlay-muted); font-size: 10px; font-weight: 700; letter-spacing: .13em; }
.live-status, .footer-live { display: inline-flex; gap: 9px; align-items: center; color: #e6f4ff; font-size: 11px; font-weight: 700; letter-spacing: .1em; }
.live-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #4be39a; box-shadow: 0 0 0 4px #4be39a24; }
.live-separator { width: 1px; height: 14px; background: #ffffff55; }
.overlay-summary {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    margin: 0 0 18px;
    padding: clamp(22px, 4vw, 38px);
    border: 1px solid #ffffff38;
    border-radius: 26px;
    background: var(--panel-bg);
    box-shadow: 0 16px 45px #020b1640, inset 0 1px #ffffff18;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.overlay-summary h1 { max-width: 760px; margin: 11px 0 0; font-size: clamp(26px, 4.5vw, 50px); font-weight: 850; letter-spacing: -.05em; line-height: 1.08; text-shadow: 0 2px 12px #0005; }
.total-box { display: grid; min-width: 205px; gap: 6px; padding: 16px 20px; border: 1px solid #ffffff36; border-radius: 19px; background: #ffffff10; }
.total-box strong { font-size: clamp(38px, 5vw, 60px); font-variant-numeric: tabular-nums; letter-spacing: -.05em; line-height: 1; text-shadow: 0 2px 12px #0005; }
.total-caption { color: var(--overlay-muted); font-size: 12px; }
.total-participation { color: #fff; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.results-panel {
    padding: clamp(18px, 3vw, 30px);
    border: 1px solid #ffffff38;
    border-radius: 24px;
    background: var(--panel-bg);
    box-shadow: 0 16px 45px #020b1640, inset 0 1px #ffffff18;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.results-heading { margin-bottom: 20px; }
.results-heading h2 { margin: 6px 0 0; font-size: clamp(20px, 3vw, 29px); letter-spacing: -.035em; }
.updated-at { color: var(--overlay-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.candidate-results { display: grid; gap: 14px; }
.result-row { min-width: 0; padding: 15px 18px; border: 1px solid #ffffff25; border-radius: 17px; background: #ffffff0b; }
.candidate-line { gap: 12px; }
.candidate-number { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border: 1px solid #ffffff54; border-radius: 50%; color: #fff; background: #068fff45; font-size: 12px; font-weight: 850; }
.candidate-name { flex: 1; min-width: 0; overflow: hidden; font-size: clamp(16px, 2.2vw, 22px); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 5px #0006; }
.candidate-percent { min-width: 68px; color: #fff; font-size: clamp(21px, 3vw, 32px); font-variant-numeric: tabular-nums; font-weight: 800; letter-spacing: -.04em; text-align: right; text-shadow: 0 1px 6px #0006; }
.progress-track { position: relative; height: 32px; overflow: hidden; margin: 13px 0 0; border: 1px solid #ffffff48; border-radius: 999px; background: #ffffff2e; }
.progress-fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--bar-color);
    box-shadow: 0 0 20px color-mix(in srgb, var(--bar-color) 60%, transparent);
    transition: width .85s cubic-bezier(.2,.75,.2,1);
}
.progress-percent-label, .bar-vote-label {
    position: absolute;
    z-index: 1;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    font-weight: 850;
    text-shadow: 0 1px 3px #00101e, 0 0 7px #00101e;
    white-space: nowrap;
}
.progress-percent-label { left: 12px; }
.bar-vote-label { right: 12px; }
.candidate-results[data-graph-type="horizontal"] .candidate-percent { display: none; }
.candidate-results[data-graph-type="horizontal"] .result-meta { display: none; }
.candidate-results[data-label-mode="name"] .candidate-number,
.candidate-results[data-label-mode="number"] .candidate-name { display: none; }
.candidate-results[data-graph-type="vertical"] { display: none; }
.candidate-results[data-graph-type="distribution"] { display: none; }
.vertical-chart-wrap { display: none; height: clamp(280px, 42vh, 500px); }
.vertical-chart-wrap canvas { width: 100% !important; height: 100% !important; }
body[data-graph-type="vertical"] .vertical-chart-wrap { display: block; }
.distribution-chart { display: none; }
body[data-graph-type="distribution"] .distribution-chart { display: block; }
.distribution-track {
    display: flex;
    width: 100%;
    min-height: clamp(44px, 6vw, 62px);
    overflow: hidden;
    border: 1px solid #ffffff85;
    border-radius: 7px;
    background: #ffffff24;
    box-shadow: 0 5px 16px #020b1633;
}
.distribution-segment {
    display: grid;
    min-width: 0;
    flex: 0 0 auto;
    place-items: center;
    overflow: hidden;
    border-right: 1px solid #ffffff9c;
    color: #fff;
    text-align: center;
    text-shadow: 0 1px 3px #000b;
    transition: width .85s cubic-bezier(.2,.75,.2,1);
}
.distribution-segment:last-child { border-right: 0; }
.distribution-segment-label { padding: 0 4px; font-size: clamp(10px, 1.25vw, 17px); font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.distribution-legend { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 16px; }
.distribution-legend-item { display: flex; min-width: min(100%, 210px); flex: 1 1 190px; align-items: center; gap: 9px; color: #fff; font-size: 13px; }
.distribution-legend-swatch { width: 12px; height: 12px; flex: 0 0 12px; border-radius: 3px; background: var(--segment-color); }
.distribution-legend-label { min-width: 0; flex: 1; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.distribution-legend-value { color: var(--overlay-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.candidate-results[data-graph-type="cards"] { grid-template-columns: minmax(0, 1fr); gap: 15px; }
.candidate-results[data-graph-type="cards"] .result-row {
    display: flex;
    min-height: 222px;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(17px, 2.5vw, 26px);
    border-color: #ffffff40;
    background: #ffffff12;
}
.candidate-results[data-graph-type="cards"] .candidate-line { flex-wrap: wrap; }
.candidate-results[data-graph-type="cards"] .candidate-name { flex-basis: calc(100% - 55px); }
.candidate-results[data-graph-type="cards"] .candidate-percent { min-width: 100%; margin-top: 9px; font-size: clamp(46px, 6vw, 70px); line-height: 1; text-align: left; }
.candidate-results[data-graph-type="cards"] .progress-track { height: 14px; margin-top: 18px; }
.candidate-results[data-graph-type="cards"] .progress-percent-label,
.candidate-results[data-graph-type="cards"] .bar-vote-label { display: none; }
.candidate-results[data-graph-type="cards"] .result-meta { justify-content: space-between; gap: 10px; margin-top: 14px; color: var(--overlay-muted); }
.candidate-results[data-graph-type="cards"] .vote-count { color: #fff; font-size: clamp(17px, 2vw, 22px); font-weight: 850; }
.candidate-results[data-graph-type="cards"] .share-label { text-align: right; }
.overlay-footer { padding: 18px 4px 0; font-size: 9px; }
.footer-live { font-size: 9px; }
.empty-state { padding: 30px 12px; color: var(--overlay-muted); text-align: center; }
.locked-page { display: grid; min-height: 100vh; place-items: center; padding: 20px; }
.locked-card { width: min(100%, 620px); padding: clamp(24px, 5vw, 48px); border: 1px solid #ffffff40; border-radius: 26px; background: rgb(8 29 52 / .9); box-shadow: 0 25px 80px #020b166b; backdrop-filter: blur(18px); }
.locked-card h1 { margin: 15px 0 10px; font-size: clamp(30px, 5vw, 52px); letter-spacing: -.05em; }
.locked-card p { color: #d7edff; }
.live-status { color: #d7edff; font-size: 11px; font-weight: 800; letter-spacing: .1em; }
#overlayCountdown { color: #fff; font-size: clamp(22px, 4vw, 36px); font-weight: 850; font-variant-numeric: tabular-nums; }

@media (max-width: 650px) {
    .overlay-stage { width: calc(100% - 20px); padding: 58px 0 18px; }
    .overlay-clock { top: 14px; right: 0; }
    .overlay-summary { align-items: stretch; flex-direction: column; gap: 19px; margin-top: 22px; padding: 21px 17px; }
    .total-box { min-width: 0; grid-template-columns: 1fr auto; align-items: center; }
    .total-box .summary-label { grid-column: 1; }
    .total-box strong { grid-column: 2; grid-row: 1 / span 2; }
    .results-panel { padding: 15px 11px; }
    .results-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
    .result-row { padding: 12px 10px; }
    .candidate-line { gap: 8px; }
    .candidate-number { width: 32px; height: 32px; flex-basis: 32px; }
    .candidate-percent { min-width: 55px; }
    .progress-track { height: 27px; }
    .progress-percent-label, .bar-vote-label { font-size: 11px; }
    .candidate-results[data-graph-type="cards"] { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .candidate-results[data-graph-type="cards"] .result-row { min-height: 185px; padding: 14px 11px; }
    .candidate-results[data-graph-type="cards"] .candidate-percent { font-size: clamp(32px, 8vw, 48px); }
    .overlay-footer { align-items: flex-start; flex-direction: column; gap: 8px; }
}
@media (min-width: 651px) and (max-width: 1099.98px) {
    .candidate-results[data-graph-type="cards"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
    .candidate-results[data-graph-type="cards"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
    .progress-fill { transition-duration: .01ms; }
}
