/* ===== RESET ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    user-select: none;
}

/* ===== FONDO ===== */
body {
    background: radial-gradient(ellipse at 25% 50%, #0d1117 0%, #000 40%, #0a0a0a 70%, #000 100%);
    color: white;
}

/* ===== GRID DIGITAL ===== */
.grid-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

/* ===== PARTICLES ===== */
#particles {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* ===== CONTAINER ===== */
.container {
    position: relative;
    z-index: 2;
    width: 100vw; height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 8px 15px;
}

/* ===== HEADER ===== */
.header {
    text-align: center;
    flex-shrink: 0;
    padding: 4px 0;
}
.live-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ff0040, #dc2626);
    color: white;
    padding: 3px 16px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 2px;
    animation: pulse-badge 1.5s infinite;
    margin-bottom: 2px;
}
@keyframes pulse-badge {
    0%, 100% { box-shadow: 0 0 10px #ff0040; }
    50% { box-shadow: 0 0 25px #ff0040, 0 0 50px #ff004066; }
}
.title {
    font-size: clamp(1.5rem, 4vw, 3rem);
    font-weight: 900;
    background: linear-gradient(135deg, #ff6b35, #ff0040, #8b5cf6, #2563eb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 3px;
    line-height: 1.1;
}
.subtitle {
    font-size: clamp(0.5rem, 1vw, 0.75rem);
    color: #666;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ===== PANEL PRINCIPAL ===== */
.panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 0;
    padding: 2px 0;
}

/* ===== CARD CANDIDATO ===== */
.card-candidato {
    background: rgba(255,255,255,0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 12px 16px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.3s;
    width: 100%;
}
.left .card-candidato { border-color: rgba(220,38,38,0.15); }
.right .card-candidato { border-color: rgba(37,99,235,0.15); }
.left .card-candidato:hover { border-color: rgba(220,38,38,0.4); box-shadow: 0 0 30px rgba(220,38,38,0.1); }
.right .card-candidato:hover { border-color: rgba(37,99,235,0.4); box-shadow: 0 0 30px rgba(37,99,235,0.1); }

/* ===== CANDIDATO ===== */
.candidato {
    flex: 1;
    max-width: 36%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ===== FOTO ===== */
.foto-wrapper {
    position: relative;
    width: min(20vw, 200px);
    aspect-ratio: 3/4;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 4px;
}
.foto-glow {
    position: absolute;
    inset: 0;
    border-radius: 12px;
    z-index: 0;
}
.left .foto-glow { background: linear-gradient(135deg, rgba(220,38,38,0.3), transparent 60%); }
.right .foto-glow { background: linear-gradient(225deg, rgba(37,99,235,0.3), transparent 60%); }
.foto {
    width: 100%; height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 1;
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    transition: all 0.5s;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.party-badge {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    padding: 2px 10px;
    border-radius: 8px;
    font-size: 0.5rem;
    font-weight: 700;
    letter-spacing: 1px;
    white-space: nowrap;
    opacity: 0.9;
}
.party-badge.rojo { background: rgba(220,38,38,0.85); }
.party-badge.azul { background: rgba(37,99,235,0.85); }

.nombre {
    font-size: clamp(0.8rem, 1.6vw, 1.3rem);
    font-weight: 800;
    letter-spacing: 1px;
    text-align: center;
    line-height: 1.1;
}
.left .nombre { color: #fca5a5; }
.right .nombre { color: #93c5fd; }

/* ===== STATS ===== */
.stats {
    display: flex;
    align-items: center;
    gap: 10px;
}
.votos-contador { display: flex; }
.numero {
    font-size: clamp(1.5rem, 3.5vw, 2.8rem);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    transition: all 0.2s;
}
.left .numero { color: white; text-shadow: 0 0 20px rgba(220,38,38,0.4); }
.right .numero { color: white; text-shadow: 0 0 20px rgba(37,99,235,0.4); }
.porcentaje {
    font-size: clamp(1rem, 2vw, 1.6rem);
    font-weight: 800;
}
.left .porcentaje { color: #f87171; }
.right .porcentaje { color: #60a5fa; }

/* ===== BARRA ===== */
.barra-track {
    width: 85%;
    max-width: 250px;
    height: 8px;
    background: rgba(255,255,255,0.08);
    border-radius: 10px;
    overflow: hidden;
}
.barra-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    width: 0%;
    position: relative;
}
.barra-fill.rojo {
    background: linear-gradient(90deg, #dc2626, #f87171);
    box-shadow: 0 0 15px rgba(220,38,38,0.5);
}
.barra-fill.azul {
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    box-shadow: 0 0 15px rgba(37,99,235,0.5);
}

/* ===== BOTÓN VOTO ===== */
.btn-voto {
    width: 80%;
    max-width: 200px;
    padding: 6px 0;
    border: none;
    border-radius: 10px;
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    font-weight: 800;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    margin-top: 4px;
}
.btn-voto.rojo {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    box-shadow: 0 3px 15px rgba(220,38,38,0.3);
}
.btn-voto.azul {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    box-shadow: 0 3px 15px rgba(37,99,235,0.3);
}
.btn-voto:active { transform: scale(0.95); }
.btn-voto.rojo:hover { box-shadow: 0 3px 25px rgba(220,38,38,0.6); }
.btn-voto.azul:hover { box-shadow: 0 3px 25px rgba(37,99,235,0.6); }
.btn-voto::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 30%, rgba(255,255,255,0.15) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.5s;
}
.btn-voto:hover::after { transform: translateX(100%); }

/* ===== VS ===== */
.vs-container {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    width: 90px;
    height: 90px;
}
.vs-circle {
    width: 70px;
    height: 70px;
    background: radial-gradient(circle at 30% 30%, #1e1b4b, #0f0a1a);
    border: 3px solid rgba(139,92,246,0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    animation: vs-pulse 2s infinite;
}
.vs-text {
    font-size: 1.5rem;
    font-weight: 900;
    color: #c4b5fd;
    text-shadow: 0 0 20px rgba(139,92,246,0.6);
    letter-spacing: 3px;
}
@keyframes vs-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(139,92,246,0.3); }
    50% { transform: scale(1.05); box-shadow: 0 0 40px rgba(139,92,246,0.5); }
}
.vs-ring-outer {
    position: absolute;
    width: 88px; height: 88px;
    border: 2px solid transparent;
    border-top: 2px solid rgba(139,92,246,0.4);
    border-right: 2px solid rgba(139,92,246,0.4);
    border-radius: 50%;
    animation: spin-ring 4s linear infinite;
    z-index: 1;
}
.vs-ring-inner {
    position: absolute;
    width: 55px; height: 55px;
    border: 1px solid transparent;
    border-bottom: 1px solid rgba(139,92,246,0.3);
    border-left: 1px solid rgba(139,92,246,0.3);
    border-radius: 50%;
    animation: spin-ring 3s linear infinite reverse;
    z-index: 1;
}
@keyframes spin-ring { to { transform: rotate(360deg); } }

/* ===== PANEL DE CONTROL ===== */
.control-panel {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 4px 0;
}
.total-votos {
    font-size: clamp(0.6rem, 0.9vw, 0.8rem);
    color: #666;
    background: rgba(255,255,255,0.03);
    padding: 4px 14px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.06);
}
.numero-total { color: #aaa; font-weight: 700; }
.tiktok-msg {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 4px 18px;
    border-radius: 20px;
    font-size: clamp(0.55rem, 0.85vw, 0.7rem);
    color: #999;
}
.tiktok-msg strong { color: white; font-size: 1.1em; }
.rapid-fire {
    display: flex;
    gap: 4px;
}
.btn-rapido {
    padding: 4px 12px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    color: #888;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-rapido:hover { background: rgba(255,255,255,0.1); color: white; }
.btn-rapido:active { transform: scale(0.9); }

/* ===== PARTICULA DE VOTO ===== */
.voto-particle {
    position: fixed;
    font-size: 1.2rem;
    font-weight: 900;
    pointer-events: none;
    z-index: 100;
    animation: float-up 1.2s ease-out forwards;
}
@keyframes float-up {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-80px) scale(0.5); }
}

/* ===== FLASH OVERLAY ===== */
.flash-vote {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    animation: flash-out 0.6s ease-out forwards;
}
@keyframes flash-out {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .panel { gap: 4px; }
    .candidato { max-width: 40%; }
    .foto-wrapper { width: min(28vw, 130px); }
    .vs-container { width: 60px; height: 60px; }
    .vs-circle { width: 48px; height: 48px; }
    .vs-text { font-size: 1rem; }
    .vs-ring-outer { width: 58px; height: 58px; }
    .vs-ring-inner { width: 38px; height: 38px; }
    .barra-track { width: 90%; height: 6px; }
    .card-candidato { padding: 8px 10px; }
    .control-panel { gap: 8px; flex-wrap: wrap; }
    .btn-voto { padding: 5px 0; }
}
@media (max-width: 480px) {
    .container { padding: 4px 6px; }
    .foto-wrapper { width: min(35vw, 100px); }
    .party-badge { font-size: 0.4rem; padding: 1px 6px; }
    .nombre { font-size: 0.65rem; }
    .numero { font-size: 1rem; }
    .porcentaje { font-size: 0.8rem; }
    .live-badge { font-size: 0.5rem; }
    .btn-voto { font-size: 0.6rem; max-width: 130px; }
}
