:root {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.5;
}

body {
    margin: 0;
    min-height: 100vh;
    background-color: #000;
    color: white;
    overflow-x: hidden; /* Scroll vertical permitido */
}

.app { min-height: 100vh; display: flex; flex-direction: column; }

/* FONDOS */
.background-gradient {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, #0a0a0a, #1a1a1a, #1a0505); z-index: -2;
}
.background-pattern {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-image: repeating-linear-gradient(45deg, transparent, transparent 35px, rgba(255,255,255,.02) 35px, rgba(255,255,255,.02) 70px); z-index: -1;
}

.app-container {
    max-width: 1600px; margin: 0 auto; padding: 10px 20px;
    width: 100%; display: flex; flex-direction: column;
}

/* HEADER */
.app-header { text-align: center; margin-bottom: 20px; }
.app-title {
    font-size: 2.2rem; font-weight: 900; display: flex; align-items: center;
    justify-content: center; gap: 15px; margin: 0;
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
.live-badge {
    background: #ff0844; padding: 4px 12px; border-radius: 20px;
    font-size: 0.8rem; animation: pulse 2s infinite;
}

/* DASHBOARD LAYOUT (Vertical ahora) */
.dashboard-layout {
    display: flex; flex-direction: column; gap: 30px;
}

/* --- SECCIÓN PARTICIPANTES --- */
.participants-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* TARJETA */
.participant-card {
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px); border-radius: 12px;
    padding: 12px; border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center; transition: transform 0.3s;
    position: relative; --participant-color: #fff;
    display: flex; flex-direction: column;
}
.participant-card:hover {
    transform: translateY(-3px); border-color: var(--participant-color);
    box-shadow: 0 0 15px var(--participant-color);
}
.rank-1 {
    border: 2px solid #ffd700; box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    transform: scale(1.02); z-index: 5;
}

.avatar-section { margin-bottom: 10px; position: relative; }
.avatar-container {
    width: 70px; height: 70px; margin: 0 auto 8px; position: relative;
}
.participant-avatar {
    width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
    border: 3px solid var(--participant-color);
}
.participant-rank {
    position: absolute; top: -5px; left: 50%; transform: translateX(-50%);
    background: #222; padding: 2px 8px; border-radius: 10px;
    font-size: 0.75rem; font-weight: bold; border: 1px solid #444; z-index: 2;
}
.participant-rank.leader {
    background: #ffd700; color: #000; border-color: #ffd700;
}
.participant-name { margin: 0; font-size: 1rem; color: #fff; font-weight: 700; line-height: 1.1;}

.stats-grid {
    display: flex; flex-direction: column; gap: 6px;
    background: rgba(0,0,0,0.3); padding: 8px; border-radius: 8px;
}
.stat-full { display: flex; flex-direction: column; align-items: center; }
.stat-row { display: flex; justify-content: space-between; margin-top: 4px; }
.stat-col { display: flex; flex-direction: column; align-items: center; width: 48%; }
.stat-label { font-size: 0.65rem; color: #888; text-transform: uppercase; letter-spacing: 0.5px; }
.main-score { font-size: 1.3rem; font-weight: 800; color: #ff4444; text-shadow: 0 0 10px rgba(255, 68, 68, 0.4); }
.live-score { font-size: 1rem; font-weight: 700; color: #ff6b6b; }
.count-score { font-size: 1rem; font-weight: 700; color: #fff; }
.advantage-score { font-size: 0.9rem; font-weight: 700; color: #0f0; }
.pulse-ring {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 100%; height: 100%; border: 2px solid var(--participant-color);
    border-radius: 50%; animation: pulse-ring 2s infinite;
}
@keyframes pulse-ring {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

/* --- SECCIÓN TABLA (NUEVO) --- */
.table-section {
    width: 100%;
}

.table-header-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 15px; flex-wrap: wrap; gap: 10px;
}

.table-title {
    font-size: 1.5rem; font-weight: 700; color: #fff; margin: 0;
    display: flex; align-items: center; gap: 10px;
}

.counter-badge {
    background: #ff0844; font-size: 0.9rem; padding: 2px 8px;
    border-radius: 12px; vertical-align: middle;
}

.filter-buttons { display: flex; gap: 10px; }
.filter-btn {
    background: #222; border: 1px solid #444; color: #ccc;
    padding: 8px 15px; border-radius: 6px; cursor: pointer;
    font-weight: 600; display: flex; align-items: center; gap: 6px;
    transition: all 0.2s;
}
.filter-btn:hover { background: #333; color: #fff; }
.filter-btn.active {
    background: linear-gradient(135deg, #ff0844, #cc0033);
    border-color: #ff0844; color: #fff;
}

.table-container {
    background: #111; border-radius: 12px; border: 1px solid #333;
    overflow-x: auto;
}

.superchat-table {
    width: 100%; border-collapse: collapse; min-width: 600px;
}

.superchat-table th {
    text-align: left; padding: 15px; color: #888; font-size: 0.8rem;
    text-transform: uppercase; border-bottom: 1px solid #333;
}

.superchat-table td {
    padding: 12px 15px; border-bottom: 1px solid #222;
    color: #fff; font-size: 0.95rem;
}

.superchat-table tr:last-child td { border-bottom: none; }
.superchat-table tr:hover { background: rgba(255,255,255,0.03); }

/* Celdas específicas */
.user-info { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.user-avatar-circle {
    width: 30px; height: 30px; background: #444; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 0.8rem;
    color: #aaa;
}
.msg-cell { max-width: 300px; color: #ccc; }
.amount-pill {
    background: linear-gradient(90deg, #d946ef, #ec4899);
    padding: 4px 10px; border-radius: 15px; font-weight: 700; font-size: 0.9rem;
}
.target-pill {
    display: inline-block; padding: 4px 10px; border-radius: 6px;
    font-weight: 600; font-size: 0.85rem; color: #000; /* Texto negro para contraste */
    text-shadow: none;
}
.time-cell { color: #666; font-size: 0.85rem; }

/* Paginación */
.pagination {
    display: flex; justify-content: center; gap: 5px; margin-top: 20px;
}
.page-btn {
    background: #222; border: 1px solid #333; color: #ccc;
    padding: 5px 12px; border-radius: 4px; cursor: pointer;
}
.page-btn.active { background: #444; color: #fff; border-color: #555; }

/* LOADING */
.loading-container { text-align: center; padding: 30px; grid-column: 1/-1; }
.loader {
    width: 40px; height: 40px; border: 4px solid #fff3; border-top-color: #ff0844;
    border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 768px) {
    .filter-buttons { width: 100%; overflow-x: auto; padding-bottom: 5px; }
    .filter-btn { white-space: nowrap; }
}