body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #f7f7f7;
    color: #222;
    padding: 10px;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}
.box {
    width: 1200px;
    max-width: 100%;
    background: #fff;
    border-radius: 18px;
    margin: 0 auto;
    box-shadow: 0 6px 32px #0001;
    padding: 44px 28px 32px 28px;
    position: relative;
    z-index: 1;
    border: 2px solid #ffffff;
    transition: border-color 0.5s, box-shadow 0.6s;
}
.box.flash {
    border-color: #4cc266 !important;
    box-shadow: 0 0 0 6px #a8f2b36e, 0 6px 32px #0001;
    transition: border-color 0.22s, box-shadow 0.3s;
}
.theme-switch {
    position: absolute;
    top: 20px;
    right: 24px;
    cursor: pointer;
    z-index: 5;
    background: rgba(220,220,220,0.33);
    padding: 3px 10px;
    border-radius: 14px;
    font-size: 1.3rem;
    transition: background 0.2s;
    box-shadow: 0 1px 6px #00000016;
    user-select: none;
}
.theme-switch:hover {
    background: #ffe169bb;
}
.theme-switch .theme-icon {
    font-size: 1.35em;
    vertical-align: middle;
}
.toast {
    display: none;
    position: fixed;
    top: 42px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: #212b41;
    color: #fff;
    padding: 16px 34px;
    font-size: 1.22rem;
    border-radius: 14px;
    box-shadow: 0 2px 22px #0002;
    font-weight: 600;
    letter-spacing: 1px;
    opacity: 0;
    pointer-events: none;
    animation: none;
}
.toast.show {
    display: block;
    animation: fadein 0.2s, fadeout 0.7s 1.8s;
    opacity: 1;
}
@keyframes fadein {
    from { opacity: 0; transform: translateX(-50%) translateY(-16px);}
    to   { opacity: 1; transform: translateX(-50%) translateY(0);}
}
@keyframes fadeout {
    to   { opacity: 0; }
}
.live-indicator {
    display: flex;
    align-items: center;
    position: absolute;
    top: 18px;
    left: 24px;
    z-index: 2;
    font-size: 1.14rem;
    user-select: none;
}
.live-indicator .dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ea2525;
    margin-right: 8px;
    animation: blink 1s infinite;
    box-shadow: 0 0 10px #ea2525b9;
}
@keyframes blink {
    0%, 100% { opacity: 1;}
    50% { opacity: 0.35;}
}
.live-indicator .live-text {
    font-weight: 700;
    color: #ea2525;
    letter-spacing: 1px;
}
h1 {
    font-size: 2.7rem;
    margin-bottom: 28px;
    text-align: center;
    letter-spacing: 1px;
}
.meta {
    text-align: center;
    margin: 22px 0 15px 0;
    font-size: 1.26rem;
    color: #3b4252;
}
.percent {
    font-size: 1.44rem;
    font-weight: bold;
    color: #2557a7;
}
.update {
    text-align: center;
    color: #888;
    margin-top: 20px;
    font-size: 1.18rem;
}
.winner-big-label {
    font-size: 2.1rem;
    text-align: center;
    font-weight: 900;
    color: #FFD700;
    margin: 16px 0 16px 0;
    letter-spacing: 0.8px;
    text-shadow: 0 1px 8px #fff9, 0 2px 24px #ffd70033;
    line-height: 1.23;
}
.candidates {
    margin: 24px 0 8px 0 !important;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 22px;
}
.candidate {
    flex: 1 1 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    background: #f0f5ff;
    border-radius: 16px;
    padding: 16px 18px 16px 10px;
    box-shadow: 0 1px 8px #0000000b;
    position: relative;
    min-height: 96px;
    transition: background 0.4s, box-shadow 0.3s;
}
.candidate img {
    width: 58px;
    height: 58px;
    object-fit: cover;
    border-radius: 50%;
    margin-right: 18px;
    border: 3px solid #fff;
    box-shadow: 0 0 8px #aaa2;
    background: #f0f5ff;
    transition: border 0.4s, box-shadow 0.4s;
}
.candidate .details {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
}
.candidate .name {
    font-size: 1.32rem;
    font-weight: 600;
    margin-bottom: 7px;
    color: #202328;
}
.bar-bg {
    width: 100%;
    height: 28px;
    border-radius: 12px;
    background: #ececec;
    margin-top: 2px;
    overflow: hidden;
}
.bar {
    height: 100%;
    transition: width 0.4s;
}
.bar-leading {
    background: linear-gradient(90deg, #32c36b 60%, #21a151 100%);
}
.bar-losing {
    background: linear-gradient(90deg, #ed4738 70%, #bf2e23 100%);
}
.candidate .score {
    font-size: 1.66rem;
    font-weight: bold;
    margin-left: 18px;
    min-width: 64px;
    text-align: right;
    color: #112;
}
.candidate .winner-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    background: #FFF6CC;
    color: #FFD700;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.39rem;
    font-weight: 700;
    box-shadow: 0 0 0 3px #ffd70033, 0 1px 4px #ffd70030;
    border: 2px solid #FFF6CC;
}
.candidate.winner {
    background: linear-gradient(90deg, #fffbe5 80%, #FFF6CC 100%);
    box-shadow: 0 0 0 4px #FFD70040, 0 1px 8px #ffd70024;
}
.candidate.winner img {
    border: 3px solid #FFD700 !important;
    box-shadow: 0 0 12px #FFD70066;
    background: #fffbe5;
}
.diff-under {
    text-align: center;
    margin: 16px 0 8px 0;
    font-size: 1.19rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: #d68b00;
    text-shadow: 0 1px 6px #fff7, 0 1px 14px #fae10522;
}
.loader {
    text-align: center;
    padding: 52px 0;
    color: #aaa;
    font-size: 1.32rem;
}
button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 18px;
    font-size: 1.2rem;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: background 0.3s, transform 0.3s;
}
@media (max-width: 900px) {
    h1 { margin-top: 40px;}
    .box { padding: 10px 2vw; }
    .winner-big-label { font-size: 1.32rem; }
    .candidates { flex-direction: column; gap: 20px; }
    .candidate { padding: 15px 8px 15px 6px; }
    .candidate img { width: 48px; height: 48px; margin-right: 10px; }
    .candidate .score { font-size: 1.28rem; margin-left: 8px; min-width: 44px; }
    .candidate .name { font-size: 1.08rem; }
    .bar-bg { height: 20px; }
    .candidate .winner-badge { width: 26px; height: 26px; font-size: 1.1rem; }
    .theme-switch { top: 8px; right: 8px; }
}

/* ---- DARK MODE ---- */
body.dark {
    background: #181A21;
    color: #e8e8e8;
}
body.dark .box {
    background: #232733;
    color: #e8e8e8;
    border-color: #232733;
    box-shadow: 0 6px 36px #0005;
}
body.dark .box.flash {
    border-color: #4cc266 !important;
    box-shadow: 0 0 0 6px #36a84b54, 0 6px 36px #0005;
}
body.dark h1,
body.dark .meta,
body.dark .update,
body.dark .percent {
    color: #e8e8e8 !important;
}
body.dark .live-indicator .dot {
    background: #ff4848;
    box-shadow: 0 0 12px #ff4848c9;
}
body.dark .live-indicator .live-text {
    color: #ff4848;
}
body.dark .candidates {
    background: none;
}
body.dark .candidate {
    background: #2f333f;
    box-shadow: 0 1px 8px #00000033;
}
body.dark .candidate img {
    border-color: #232733;
    background: #232733;
}
body.dark .bar-bg {
    background: #242b38;
}
body.dark .bar-leading {
    background: linear-gradient(90deg, #43d67b 60%, #249b4f 100%);
}
body.dark .bar-losing {
    background: linear-gradient(90deg, #e96d61 70%, #b6221c 100%);
}
body.dark .candidate .score {
    color: #fafafc;
}
body.dark .winner-big-label {
    color: #FFD700;
    text-shadow: 0 1px 8px #23273399, 0 2px 24px #ffd70033;
}
body.dark .candidate .winner-badge {
    background: #29241c;
    color: #FFD700;
    border: 2px solid #FFD700;
}
body.dark .candidate.winner img {
    border-color: #FFD700 !important;
    box-shadow: 0 0 12px #FFD70099;
    background: #29241c;
}
body.dark .candidate.winner {
    background: linear-gradient(90deg, #2f333f 80%, #302a16 100%);
    box-shadow: 0 0 0 4px #FFD70044, 0 1px 8px #ffd70018;
}
body.dark .diff-under {
    color: #e0c140;
    text-shadow: 0 1px 6px #232733, 0 1px 14px #ffd70033;
}
body.dark .toast {
    background: #232733;
    color: #ffd700;
    box-shadow: 0 2px 22px #0009;
}
body.dark .loader {
    color: #aaa;
}
body.dark .candidate .name {
    color: #fafafc !important;
}