:root {
    --bg-dark: #0f172a;
    --bg-panel: rgba(30, 41, 59, 0.7);
    --border-glass: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #facc15;
    --live-red: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at 50% -20%, #1e293b, #0f172a);
    color: var(--text-main);
    min-height: 100vh;
}

/* Nav */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5%;
    border-bottom: 1px solid var(--border-glass);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--accent);
}

.nav-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.back-btn {
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 6px 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    border: 1px solid var(--border-glass);
    transition: all 0.2s;
}

.back-btn:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-2px);
}

.fb-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #1877F2;
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 20px;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(24, 119, 242, 0.3);
}

.fb-btn:hover {
    transform: translateY(-2px);
    background-color: #166fe5;
    box-shadow: 0 6px 15px rgba(24, 119, 242, 0.5);
}

.live-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    background: rgba(239, 68, 68, 0.1);
    color: var(--live-red);
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.live-badge .dot {
    width: 8px;
    height: 8px;
    background-color: var(--live-red);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

/* Container */
.container {
    max-width: 900px;
    margin: 30px auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Glass Panels */
.glass-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 24px;
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* HUB: Partidos del Día Grid */
.hub-header h2 {
    font-size: 1.5rem;
    color: var(--accent);
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 10px;
}

.matches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.match-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 15px;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.2s;
    cursor: pointer;
}

.match-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 5px 15px rgba(250, 204, 21, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.card-status.live {
    color: var(--live-red);
    font-weight: bold;
}

.card-teams {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex: 1;
}

.card-team img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.card-team span {
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

.card-score {
    font-size: 1.5rem;
    font-weight: 800;
    padding: 0 10px;
}

/* HUB: Grupos Grid */
.groups-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.group-table {
    background: var(--bg-panel);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 15px;
    overflow-x: auto;
}

.group-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--text-main);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th {
    text-align: center;
    padding: 8px 5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-glass);
    font-weight: 600;
}

th.team-col { text-align: left; }

td {
    text-align: center;
    padding: 8px 5px;
    border-bottom: 1px solid rgba(255,255,255,0.02);
}

td.team-col {
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

td.team-col img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.pts {
    font-weight: 800;
    color: var(--accent);
}

/* Scoreboard */
.scoreboard {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: center;
}

.team {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.team img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.5));
}

.team h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.match-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.clock {
    font-size: 1.1rem;
    color: var(--accent);
    font-weight: 600;
}

.score {
    font-size: 3.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 15px;
    line-height: 1;
}

.divider {
    color: var(--text-muted);
    font-weight: 400;
}

.status {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Stats & Timeline (mismas reglas de antes) */
.stats-container h3, .timeline-section h3 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: var(--accent);
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.stat-row span:nth-child(2) {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.timeline {
    position: relative;
    padding-left: 20px;
    border-left: 2px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.event {
    position: relative;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.2s;
}

.event:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.06);
}

.event::before {
    content: '';
    position: absolute;
    left: -27px;
    top: 20px;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent);
}

.event.goal::before { background: #22c55e; box-shadow: 0 0 10px #22c55e; }
.event.yellow::before { background: #eab308; box-shadow: 0 0 10px #eab308; }
.event.red::before { background: #ef4444; box-shadow: 0 0 10px #ef4444; }
.event.sub::before { background: #3b82f6; box-shadow: 0 0 10px #3b82f6; }

.event-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.event-min {
    font-weight: 800;
    color: var(--accent);
}

.event-type {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    background: rgba(0,0,0,0.3);
    padding: 2px 8px;
    border-radius: 4px;
}

.event-text {
    font-size: 1rem;
    line-height: 1.4;
}

.loader {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
}

/* ==========================================
   BRACKET / LLAVES
   ========================================== */
.bracket-container {
    display: flex;
    flex-direction: row;
    gap: 20px;
    overflow-x: auto;
    padding: 20px 0;
    align-items: center;
}

.bracket-col {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    min-width: 200px;
    gap: 15px;
}

.bracket-col h3 {
    text-align: center;
    color: var(--accent);
    margin-bottom: 20px;
}

.bracket-match {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.bracket-team {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.bracket-team img {
    width: 20px;
    height: 20px;
    margin-right: 8px;
}

.bracket-team .team-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bracket-team .team-score {
    font-weight: bold;
    color: var(--text-main);
}

.bracket-team.winner .team-name, .bracket-team.winner .team-score {
    color: var(--accent);
}

@media (max-width: 600px) {
    .team h2 { font-size: 1rem; }
    .team img { width: 60px; height: 60px; }
    .score { font-size: 2.5rem; }
    .groups-container { grid-template-columns: 1fr; }
    
    .top-nav {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }
    .nav-controls {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        width: 100%;
        padding-bottom: 5px; /* Para el scrollbar */
        -webkit-overflow-scrolling: touch;
    }
    /* Ocultar barra de scroll para que se vea más limpio pero siga scrolleando */
    .nav-controls::-webkit-scrollbar {
        display: none;
    }
    .nav-controls {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
}

/* Modal Estilos */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--bg-dark);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    padding: 20px;
}

.modal-close {
    position: absolute;
    top: 15px; right: 15px;
    background: none; border: none;
    color: var(--text-muted);
    font-size: 1.5rem; cursor: pointer;
}

.modal-close:hover { color: white; }

.modal-header {
    display: flex; flex-direction: column; align-items: center;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 15px; margin-bottom: 15px;
}

.modal-header img { width: 80px; height: 80px; margin-bottom: 10px; }

.player-row {
    display: flex; justify-content: space-between;
    padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.05);
}

.player-name { font-weight: 600; }
.player-pos { color: var(--accent); font-size: 0.8rem; }

/* ============================ */
/* WIN PREDICTOR BAR */
/* ============================ */
.win-predictor-wrap {
    width: 100%;
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.win-predictor-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.win-predictor-bar {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    display: flex;
    overflow: hidden;
}

.predictor-home { background: #3b82f6; transition: flex-basis 1s ease; }
.predictor-draw { background: #64748b; transition: flex-basis 1s ease; }
.predictor-away { background: #ef4444; transition: flex-basis 1s ease; }

/* ============================ */
/* TABLAS DE GRUPOS */
/* ============================ */
.standings-table {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 15px;
    width: 100%;
}

.standings-table h3 {
    color: var(--accent);
    margin-bottom: 10px;
    text-align: center;
    font-size: 1.2rem;
}

.standings-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
/* ====== H2H (CARA A CARA) ====== */
.h2h-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.h2h-match {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
}
.h2h-date {
    color: var(--text-muted);
    font-size: 0.8rem;
    flex: 1;
}
.h2h-teams {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 2;
    justify-content: center;
    font-weight: 600;
}
.h2h-score {
    background: var(--bg-dark);
    padding: 4px 10px;
    border-radius: 6px;
    color: var(--accent);
    font-weight: bold;
    letter-spacing: 1px;
}
.h2h-comp {
    color: var(--text-muted);
    font-size: 0.8rem;
    flex: 1;
    text-align: right;
}

/* ====== NARRACIÓN (COMMENTARY) ====== */
.commentary-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}
.commentary-list::-webkit-scrollbar {
    width: 6px;
}
.commentary-list::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 4px;
}
.commentary-item {
    display: flex;
    gap: 15px;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid var(--border-glass);
    transition: border-color 0.3s;
}
.commentary-item.goal {
    border-left-color: var(--accent);
    background: rgba(255, 215, 0, 0.05);
}
.commentary-item.card {
    border-left-color: #ef4444;
}
.commentary-time {
    font-weight: bold;
    color: var(--accent);
    min-width: 45px;
}
.commentary-text {
    color: var(--text-main);
    font-size: 0.95rem;
    line-height: 1.4;
}
/* ====== ALINEACIONES (ROSTERS) ====== */
.rosters-split {
    display: flex;
    gap: 20px;
    margin-top: 15px;
}
.roster-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.roster-title {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 5px;
    text-transform: uppercase;
    text-align: center;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 5px;
}
.player-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
}
.player-row.sub {
    opacity: 0.7;
}
.player-number {
    font-weight: bold;
    color: var(--text-muted);
    min-width: 20px;
}
.player-name {
    flex: 1;
}
.player-events {
    display: flex;
    gap: 4px;
}
.event-icon {
    font-size: 0.8rem;
}

/* ====== WIN PREDICTOR ====== */
.predictor-bar-container {
    width: 100%;
    height: 8px;
    background: var(--bg-dark);
    border-radius: 4px;
    display: flex;
    overflow: hidden;
    margin-top: 10px;
}
.predictor-bar {
    height: 100%;
    transition: width 1s ease-in-out;
}
.predictor-home { background: #3b82f6; }
.predictor-tie { background: #9ca3af; }
.predictor-away { background: #ef4444; }
.predictor-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* ====== TOAST NOTIFICATIONS ====== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10000;
}
.toast {
    background: rgba(20, 25, 45, 0.95);
    border: 1px solid var(--accent);
    color: var(--text-main);
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 15px;
    animation: slideInRight 0.3s ease-out forwards;
}
.toast.fade-out {
    animation: fadeOutRight 0.5s ease-in forwards;
}
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ====== NOTICIAS DESTACADAS ====== */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 0 10px;
}

.news-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    border-color: var(--accent);
}

.news-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 2px solid var(--accent);
}

.news-content {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.news-headline {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 10px;
    line-height: 1.4;
}

.news-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 15px;
    flex: 1;
}

.news-meta {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
}

/* ====== FOOTER LEGAL ====== */
.site-footer {
    background: #0f172a;
    border-top: 1px solid var(--border-glass);
    padding: 40px 20px;
    margin-top: 60px;
    text-align: center;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

.footer-logo span {
    color: var(--accent);
}

.footer-disclaimer {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-copyright {
    font-size: 0.8rem;
    color: #475569;
    margin-top: 10px;
}
.standings-table th {
    color: var(--text-muted);
    font-weight: 400;
    text-align: center;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.standings-table th.team-col { text-align: left; }

.standings-table td {
    padding: 8px 0;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.standings-table td.team-col {
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
}

.standings-table td img {
    width: 20px;
    height: 20px;
}

/* Resaltar zona de clasificación (top 2) */
.standings-table tr.top-seed td {
    color: var(--accent);
    font-weight: 600;
}

/* ============================ */
/* SCORE TICKER */
/* ============================ */
.ticker-wrap {
    width: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    border-bottom: 1px solid var(--border-glass);
    padding: 8px 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.ticker {
    display: flex;
    white-space: nowrap;
    animation: ticker 40s linear infinite;
}

.ticker:hover {
    animation-play-state: paused;
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    padding: 0 30px;
    font-weight: 600;
    font-size: 0.9rem;
    border-right: 1px solid rgba(255,255,255,0.1);
}

.ticker-item img {
    width: 18px;
    height: 18px;
    margin: 0 6px;
}

.ticker-live {
    color: var(--live-red);
    margin-left: 8px;
    font-weight: 800;
}

@keyframes ticker {
    0% { transform: translateX(100vw); }
    100% { transform: translateX(-100%); }
}

/* ====== LAYOUT 3 COLUMNAS (FASE 5) ====== */
.hub-3col {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.hub-center {
    flex: 1;
    min-width: 0; /* Evita desbordamiento en flex */
}
.desktop-sidebar {
    display: none; /* Por defecto oculto en móviles */
}

/* Ranking Widget */
#power-ranking-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.pr-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    font-size: 0.9rem;
}
.pr-rank {
    font-weight: bold;
    color: var(--accent);
    width: 20px;
}
.pr-team {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}
.pr-team img {
    width: 20px;
    height: 20px;
}
.pr-pts {
    font-weight: bold;
}

/* Media Queries para Escritorio */
@media (min-width: 1024px) {
    .container {
        max-width: 1400px;
    }
    .hub-3col {
        flex-direction: row;
        align-items: flex-start;
    }
    .desktop-sidebar {
        display: block;
        flex: 0 0 250px; /* Ancho fijo para las barras laterales */
        position: sticky;
        top: 20px;
    }
}
