/* =========================================
   VARIABLES & BASE
   ========================================= */
:root {
    /* --- Colores Base --- */
    --primary: #004d40;
    --primary-dark: #00332a;
    --accent: #ffca28;
    --danger: #e74c3c;
    --success: #2ecc71;
    --warning: #f1c40f;
    
    /* --- Modo Claro --- */
    --bg-body: #f4f7f6;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --bg-input: #f0f2f5;
    
    --text-main: #2c3e50;
    --text-muted: #666666;
    --text-inverse: #ffffff;
    --text-highlight: #000000;
    
    --border-color: #e0e0e0;
    --shadow-soft: 0 2px 8px rgba(0,0,0,0.08);
    
    --bg-qualified: #e8f5e9;
    --bg-finished: #fcfcfc;
    
    --container-width: 1200px;
}

/* --- MODO OSCURO --- */
[data-theme="dark"] {
    --primary: #4db6ac;
    --primary-dark: #80cbc4;
    --accent: #ffd54f;
    
    --bg-body: #121212;
    --bg-card: #1e1e1e;
    --bg-header: #1e1e1e;
    --bg-input: #2d2d2d;
    
    --text-main: #e0e0e0;
    --text-muted: #b0b0b0;
    --text-inverse: #121212;
    --text-highlight: #ffffff;
    
    --border-color: #333333;
    --shadow-soft: 0 4px 12px rgba(0,0,0,0.5);
    
    --bg-qualified: rgba(46, 204, 113, 0.15);
    --bg-finished: #252525;
    
    --success: #00e676;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
    font-family: 'Roboto', sans-serif; 
    background: var(--bg-body); 
    color: var(--text-main); 
    padding-bottom: 60px; 
    line-height: 1.5; 
    transition: background 0.3s, color 0.3s; 
}
.hidden { display: none !important; }

/* =========================================
   1. NAVBAR PREMIUM (USUARIO)
   ========================================= */
.main-header {
    background: var(--bg-header);
    width: 100%;
    border-bottom: 1px solid var(--border-color);
    padding: 10px 15px;
}

/* --- LAYOUT MÓVIL (GRID 3 COLUMNAS) --- */
.header-content {
    display: grid;
    /* Fila 1: Logo | Torneo | Switch */
    grid-template-columns: auto 1fr auto; 
    grid-template-rows: auto auto; 
    align-items: center;
    gap: 12px;
    max-width: 1400px;
    margin: 0 auto;
}

/* 1. LOGO */
.brand-section {
    grid-column: 1 / 2; grid-row: 1 / 2;
    display: flex; align-items: center;
}
.logo-img { height: 38px; width: auto; object-fit: contain; transition: filter 0.3s; }
[data-theme="dark"] .logo-img { filter: invert(1) brightness(2); }
.app-title { display: none; } /* Solo logo en móvil */

/* 2. CONTROLES (Display contents para grid) */
.controls-section { display: contents; }

/* 2a. TORNEO (Centro Arriba) */
.tournament-text-wrapper {
    grid-column: 2 / 3; grid-row: 1 / 2;
    display: flex; justify-content: center; align-items: center;
    width: 100%;
    border: none; padding: 0;
}
/* Espacio para que la flecha no toque el texto */
.select-container-minimal {
    width: 100%;
    text-align: center;
    position: relative;
    max-width: 200px; /* Evita que empuje demasiado en pantallas muy chicas */
}
.select-container-minimal .select-selected {
    padding-right: 25px; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    justify-content: center; /* Centrar texto en móvil */
}
.label-torneo { display: none; } 

/* 2b. INPUTS (Abajo Ancho Completo) */
.pill-input-wrapper {
    grid-column: 1 / -1; 
    grid-row: 2 / 3;
    width: 100%; height: 42px;
    background: var(--bg-input); border-radius: 50px;
    display: flex; align-items: center; padding: 0 15px;
    border: 1px solid transparent;
}
[data-theme="dark"] .pill-input-wrapper { background: rgba(255,255,255,0.08); }

/* 3. SWITCH (Derecha Arriba) */
.settings-section {
    grid-column: 3 / 4; grid-row: 1 / 2;
    display: flex; justify-content: flex-end;
}
.theme-switch-wrapper { position: static; display: flex; align-items: center; }
.theme-switch { position: relative; display: inline-block; width: 54px; height: 28px; }
.theme-switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #e0e0e0;
    transition: .4s;
    border-radius: 34px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 6px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.slider:before {
    position: absolute; content: "";
    height: 20px; width: 20px; left: 4px; bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.icon-sun { font-size: 12px; opacity: 0; transition: 0.3s; }
.icon-moon { font-size: 12px; color: #f1c40f; opacity: 1; }
input:checked + .slider { background-color: #4a4a4a; }
input:checked + .slider:before { transform: translateX(26px); background-color: #2c3e50; }
input:checked + .slider .icon-sun { opacity: 1; }
input:checked + .slider .icon-moon { opacity: 0; }

/* Elementos internos Inputs */
.pill-icon { width: 18px; height: 18px; fill: none; stroke: var(--text-muted); stroke-width: 2; flex-shrink: 0; }
.input-mode-container { width: 100%; height: 100%; display: flex; align-items: center; gap: 10px; }
.header-input { width: 100%; height: 100%; background: transparent; border: none; outline: none; color: var(--text-main); font-weight: 500; }

/* --- LAYOUT PC (DESKTOP) --- */
@media (min-width: 900px) {
    .header-content {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        height: 70px;
        padding: 0 10px;
    }

    .brand-section { width: auto; margin-right: 20px; }
    .app-title { display: block; font-size: 1.2rem; font-weight: 800; color: var(--text-main); margin-left: 10px; white-space: nowrap; }

    .controls-section {
        display: flex; flex: 1; align-items: center;
        justify-content: space-between; /* Separa Torneo de Categoría */
        margin: 0 20px;
    }

    /* FIX 1: Espacio generoso para el Torneo en PC */
    .tournament-text-wrapper {
        width: auto;
        min-width: 250px; /* Asegura espacio mínimo */
        justify-content: flex-start;
        border-right: 1px solid var(--border-color);
        padding-right: 25px; margin-right: 0;
        height: 30px;
        grid-column: auto; grid-row: auto; 
    }
    .label-torneo { display: inline-block; font-size: 0.8rem; font-weight: bold; color: var(--text-muted); text-transform: uppercase; margin-right: 10px; }
    
    .select-container-minimal { 
        width: auto; text-align: left; max-width: none; flex: 1;
    }
    .select-container-minimal .select-selected {
        padding-right: 15px;
        justify-content: flex-start;
    }

    .pill-input-wrapper { max-width: 350px; margin-left: auto; grid-column: auto; grid-row: auto; }
    
    .settings-section { width: auto; margin-left: 20px; grid-column: auto; grid-row: auto; }
}

/* =========================================
   2. NAVBAR ADMIN (CORREGIDO Y ORDENADO)
   ========================================= */
.admin-header-layout {
    display: grid;
    gap: 15px;
    width: 100%;
    align-items: center;
    /* Grid MÓVIL: Logo e Interruptor alineados arriba */
    grid-template-columns: auto 1fr auto; 
    grid-template-areas: 
        "logo . switch" /* Logo Izq, Espacio, Switch Der */
        "search search search"
        "tourney tourney actions";
}

/* Áreas Grid Admin Móvil */
.admin-header-layout .brand-section { grid-area: logo; display: flex; align-items: center; }
.admin-header-layout .settings-section { grid-area: switch; justify-self: end; }
.admin-search-wrapper { grid-area: search; width: 100%; height: 40px; background: var(--bg-input); border-radius: 50px; display: flex; align-items: center; padding: 0 15px; gap: 10px; }
.admin-search-wrapper input { border: none; background: transparent; outline: none; color: var(--text-main); width: 100%; }

/* Contenedor Torneo y Botones */
.admin-controls-bottom { grid-area: tourney; display: flex; align-items: center; }
.admin-actions-bar { grid-area: actions; display: flex; justify-content: flex-end; gap: 8px; }

/* Botones Admin Móvil (Iconos) */
.btn-modern { width: 36px; height: 36px; padding: 0; border-radius: 8px; border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-main); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.btn-modern span.desktop-text { display: none; }
.btn-modern.primary { background: var(--primary); color: white; border: none; }
.btn-modern.danger { background: rgba(198, 40, 40, 0.1); color: var(--danger); border-color: var(--danger); }

/* --- PC ADMIN (Layout Lineal) --- */
@media (min-width: 900px) {
    .admin-header-layout {
        display: flex; flex-direction: row; align-items: center; height: 70px; padding: 0 20px;
    }
    
    .admin-header-layout .brand-section { width: auto; margin-right: 30px; }
    
    .admin-search-wrapper { width: 300px; margin-right: 20px; }
    
    .admin-controls-bottom { display: contents; } 
    .admin-header-layout .tournament-text-wrapper { 
        width: auto; margin-right: auto; /* Empuja el resto a la derecha */
        border-right: 1px solid var(--border-color); padding-right: 20px; 
    }
    
    .admin-actions-bar { width: auto; gap: 12px; margin-right: 20px; }
    
    /* FIX 2: Switch al final en PC */
    .admin-header-layout .settings-section { 
        width: auto; 
        margin-left: 0; /* Reset */
    }

    .btn-modern { width: auto; height: 36px; padding: 0 15px; font-weight: 700; font-size: 0.85rem; gap: 8px; }
    .btn-modern span.desktop-text { display: inline; }
}

/* =========================================
   3. CONTROLES DE PARTIDO ADMIN (UX EXPERTO V2)
   ========================================= */
/* Contenedor Principal */
.admin-controls-row-wrapper {
    display: flex;
    flex-wrap: wrap; /* Permite que baje si no entra */
    gap: 10px;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    background: var(--bg-input); 
    padding: 8px;
    border-radius: 12px; /* Más redondeado */
    border: 1px solid var(--border-color);
}
[data-theme="dark"] .admin-controls-row-wrapper { background: rgba(255,255,255,0.03); }

/* Grupo 1: Scores (Inputs) */
.admin-score-group {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
}
.input-score-admin { 
    background: var(--bg-card); 
    color: var(--text-main); 
    border: 1px solid var(--border-color); 
    width: 34px; height: 34px; 
    text-align: center; border-radius: 6px; 
    font-weight: bold; font-size: 1rem;
    outline: none; 
    padding: 0; /* Reset padding navegador */
}
.input-score-admin:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(var(--primary), 0.2); }
.input-sep { color: var(--text-muted); opacity: 0.5; font-size: 1.2rem; margin: 0 1px; }

/* Contenedor de Acciones (Botones) */
.mobile-actions-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Grupo 2: Estados (Botones Toggle) */
.admin-status-group { display: flex; gap: 5px; }

.status-toggle { 
    padding: 0 10px; height: 34px; 
    border-radius: 6px; 
    font-size: 0.7rem; 
    cursor: pointer; 
    background: var(--bg-card); 
    color: var(--text-muted); 
    border: 1px solid var(--border-color); 
    font-weight: 800; 
    text-transform: uppercase; 
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; 
    white-space: nowrap;
}
.status-toggle:hover { background: var(--bg-body); color: var(--text-main); }
.status-toggle.active-live { background: var(--success); color: white; border-color: var(--success); }
.status-toggle.active-next { background: var(--warning); color: #5d4e00; border-color: var(--warning); }

/* Grupo 3: Herramientas (Guardar/Config) */
.admin-tools-group { display: flex; gap: 8px; }

.btn-tool { 
    width: 36px; height: 36px; 
    border-radius: 8px; cursor: pointer; 
    display: flex; align-items: center; justify-content: center; 
    font-size: 1.2rem; transition: all 0.2s; border: none; 
    flex-shrink: 0; /* Evita que se aplasten */
}
.btn-tool.settings { background: transparent; border: 1px solid var(--border-color); color: var(--text-muted); }
.btn-tool.save { background: var(--primary); color: white; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.btn-tool.save:active { transform: scale(0.95); }

/* --- RESPONSIVE CONTROLES (SOLUCIÓN MÓVIL) --- */
@media (max-width: 800px) {
    
    /* 1. ROMPER LA GRILLA (Hacer que baje el bloque) */
    .schedule-row.admin-row {
        display: flex;       /* Cambiamos Grid por Flex */
        flex-direction: column; /* Apilamos verticalmente */
        align-items: flex-start;
        height: auto;
        padding-bottom: 15px;
        gap: 0; /* Quitamos gap del grid */
    }

    /* 2. Ocultar número en móvil para ganar limpieza (Opcional) */
    .schedule-row.admin-row .sched-number {
        display: none;
    }

    /* 3. Ajustar Info del Partido (Arriba) */
    .schedule-row.admin-row .sched-match-info {
        width: 100%;
        margin-bottom: 10px; /* Separación con los controles */
        padding-right: 0;
        border-bottom: none; /* Quitamos líneas internas */
    }
    
    /* 4. CONTENEDOR DE CONTROLES (Abajo - Ancho Completo) */
    .admin-controls-row-wrapper {
        width: 100%; /* Ocupa todo el ancho */
        margin-top: 0;
        flex-direction: column; /* Apilar Inputs y Botones */
        gap: 10px;
        padding: 12px;
        background: var(--bg-input); /* Resaltar área de trabajo */
    }
    
    /* Fila 1: Scores (Inputs grandes) */
    .admin-score-group { 
        width: 100%; 
        justify-content: space-between; 
    }
    /* Inputs táctiles grandes */
    .input-score-admin { 
        width: 100%; /* Se reparten el espacio */
        max-width: 50px; 
        height: 45px; 
        font-size: 1.2rem; 
    }

    /* Fila 2: Acciones (Botones) */
    .mobile-actions-row {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 5px;
    }
    
    /* Botones de estado (Izquierda) */
    .admin-status-group { 
        flex: 1; 
        display: flex; 
        gap: 5px; 
    }
    .status-toggle {
        flex: 1; 
        height: 45px; /* Altura dedo */
        font-size: 0.8rem;
    }

    /* Botones de Herramienta (Derecha - Guardar) */
    .admin-tools-group {
        display: flex;
        gap: 10px;
        margin-left: 10px;
    }
    .btn-tool { 
        width: 48px; height: 48px; /* Botones grandes */
        border-radius: 8px;
        font-size: 1.5rem;
    }
    /* Destacar Guardar */
    .btn-tool.save {
        background: var(--primary);
        color: white;
        box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    }
}
/* =========================================
   4. RESTO DE COMPONENTES (GENERICO)
   ========================================= */
.sticky-nav { position: sticky; top: 0; z-index: 999; background: var(--bg-header); display: flex; justify-content: space-around; box-shadow: 0 4px 10px rgba(0,0,0,0.05); padding: 0 10px; border-bottom: 1px solid var(--border-color); }
.nav-tab { flex: 1; padding: 12px; background: transparent; border: none; font-size: 0.85rem; font-weight: 700; color: var(--text-muted); cursor: pointer; text-transform: uppercase; border-bottom: 3px solid transparent; transition: all 0.2s; }
.nav-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.archived-banner { background: #34495e; color: #fff; text-align: center; padding: 10px; font-size: 0.8rem; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; }

/* --- LOADER: PELOTA DE TENIS REALISTA 3D --- */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    margin-top: 20px;
    padding-top: 50px;
}

.tennis-ball {
    width: 55px;
    height: 55px;
    background-color: #D2E042; 
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    z-index: 2;
    
    /* 3D: Sombra interna y brillo */
    box-shadow: 
        inset -10px -10px 20px rgba(0,0,0,0.2), /* Sombra abajo-derecha */
        inset 5px 5px 15px rgba(255,255,255,0.5), /* Brillo arriba-izquierda */
        0 0 2px rgba(0,0,0,0.3); /* Borde externo sutil */

    animation: bounce-gravity 0.5s infinite alternate cubic-bezier(0.6, 0.05, 1, 0.5);
}

/* Las Líneas Blancas (Costuras) */
.tennis-ball::before, 
.tennis-ball::after {
    content: "";
    position: absolute;
    width: 90%;  /* Hacemos los círculos grandes */
    height: 90%;
    background: transparent;
    border: 3px solid white; /* Línea sólida y nítida */
    border-radius: 50%;
    /*left: 5%; /* Centrado horizontalmente (100% - 90% = 10% / 2 = 5%) */
}

/* Curva SUPERIOR (U invertida) */
.tennis-ball::before {
    top: -65%; /* La empujamos hacia arriba para que solo se vea el arco de abajo */
}

/* Curva INFERIOR (U normal) */
.tennis-ball::after {
    bottom: -65%; /* La empujamos hacia abajo para que solo se vea el arco de arriba */
}

.loader-container::after {
    content: "";
    width: 45px;
    height: 8px;
    background: rgba(0,0,0,0.25);
    border-radius: 50%;
    margin-top: -5px;
    z-index: 1;
    filter: blur(3px);
    animation: shadow-gravity 0.5s infinite alternate cubic-bezier(0.6, 0.05, 1, 0.5);
}

.loader-container p {
    margin-top: 25px;
    font-weight: bold;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: blink 1.5s infinite;
}

@keyframes bounce-gravity {
    0% { transform: translateY(-70px) scaleY(1) rotate(0deg); }
    100% { transform: translateY(0) scaleY(0.7) scaleX(1.2) rotate(25deg); }
}

@keyframes shadow-gravity {
    0% { transform: scale(0.3); opacity: 0.1; }
    100% { transform: scale(1.3); opacity: 0.5; }
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.placeholder-badge { background: var(--bg-input); color: var(--text-muted); padding: 2px 6px; border-radius: 4px; font-size: 0.85em; font-weight: 600; text-transform: uppercase; border: 1px dashed var(--text-muted); display: inline-block; margin-bottom: 2px; }

#app-container { max-width: var(--container-width); margin: 1rem auto; padding: 0 1rem; min-height: 60vh; }

.match-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 4px; margin-bottom: 1rem; padding: 0.8rem; position: relative; box-shadow: 0 1px 3px rgba(0,0,0,0.05); border-left: 5px solid #ccc; overflow: hidden; color: var(--text-main); }
.match-card.estado-jugando { border-left-color: var(--success); }
.match-card.estado-proximo { border-left-color: var(--warning); }
.match-card.estado-finalizado { border-left-color: var(--danger); }

/* Golden Ticket */
.match-card.champion-card { background: linear-gradient(135deg, #e6c55d 0%, #d4af37 50%, #b8860b 100%); border: 2px solid #8a6e05; color: #3e2723 !important; box-shadow: 0 4px 15px rgba(212, 175, 55, 0.5); overflow: hidden; }
.match-card.champion-card::after { content: ""; position: absolute; top: 0; left: -150%; width: 100%; height: 100%; background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0) 100%); animation: shine 4s infinite; transform: skewX(-25deg); pointer-events: none; }
@keyframes shine { 100% { left: 150%; } }
.match-card.champion-card .match-label, .match-card.champion-card .player-row, .match-card.champion-card .winner-text, .match-card.champion-card .col-score, .match-card.champion-card .col-score b, .match-card.champion-card .date-large, .match-card.champion-card .time-small { color: #3e2723 !important; text-shadow: none !important; border-color: rgba(62, 39, 35, 0.2) !important; }
.match-card.champion-card .text-champion { background: #3e2723; color: #ffd700; border: 1px solid #5d4037; padding: 4px 12px; border-radius: 20px; font-size: 0.85rem; letter-spacing: 2px; margin-bottom: 8px; display: inline-flex; align-items: center; justify-content: center; }

.match-label { font-size: 0.7rem; color: var(--text-muted); font-weight: bold; text-transform: uppercase; margin-bottom: 8px; display: block; border-bottom: 1px solid var(--border-color); padding-bottom: 3px; }
.date-large { font-size: 0.95rem; font-weight: bold; color: var(--primary); line-height: 1.2; display: block; }
.time-small { font-size: 0.9rem; color: var(--text-muted); font-weight: normal; display: block; margin-top: 2px; }
.winner-text { font-weight: 900; color: var(--text-highlight) !important; }
.player-row { margin-bottom: 4px; font-size: 0.95rem; color: var(--text-main); }
.col-score { text-align: right; font-weight: normal; color: var(--text-main); font-size: 1.1rem; border-top: 1px solid var(--border-color); padding-top: 5px; margin-top: 8px; min-height: 25px; }
.col-score b { color: var(--text-highlight) !important; }
.badge-in-card { font-size: 0.8rem; font-weight: 900; text-transform: uppercase; display: inline-flex; align-items: center; }
.text-jugando { color: var(--success); }
.text-proximo { color: #f39c12; }
.text-finalizado { color: var(--danger); font-weight: 900; text-transform: uppercase; font-size: 0.75rem; }
.live-indicator { width: 8px; height: 8px; background: var(--success); border-radius: 50%; display: inline-block; margin-right: 5px; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }
.doubles-container { display: flex; flex-direction: column; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 6px; }
.doubles-partner { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-main); }
.winner-text .doubles-partner { color: var(--text-highlight) !important; font-weight: 900; }

.category-section { margin-bottom: 3rem; border-top: none; padding-top: 2rem; }
.category-title { background-color: #333; color: #fff; padding: 0.5rem 1rem; border-radius: 4px; margin-bottom: 1.5rem; font-size: 1.2rem; text-transform: uppercase; letter-spacing: 1px; text-align: center; }
.bracket-container { width: 100%; margin-top: 1rem; border-top: 1px dashed var(--border-color); padding-top: 1rem; }
.bracket-desktop-headers { display: none; }
@media (min-width: 769px) {
    .bracket-desktop-headers { display: flex; justify-content: space-around; gap: 2rem; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--border-color); }
    .bracket-header-item { flex: 1; min-width: 250px; max-width: 350px; text-align: center; font-weight: bold; text-transform: uppercase; color: var(--primary); letter-spacing: 1px; }
    .bracket-wrapper { display: flex; align-items: stretch; justify-content: space-around; gap: 2rem; overflow-x: auto; overflow-y: hidden; min-height: 400px; }
    .bracket-round { flex: 1; min-width: 250px; max-width: 350px; display: flex; flex-direction: column; justify-content: space-around; gap: 1.5rem; }
    .bracket-round h3 { display: none; }
    .slider-controls { display: none; }
}
@media (max-width: 768px) {
    .bracket-wrapper { position: relative; overflow: hidden; min-height: 300px; }
    .bracket-round { display: none; width: 100%; animation: slideIn 0.3s ease-out; }
    .bracket-round.active { display: block; }
    .bracket-round h3 { display: none; }
    @keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
    .slider-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding: 5px 10px; border-radius: 50px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); border: 1px solid var(--border-color); background: var(--bg-card);}
    .nav-btn { background: var(--bg-card); border: 1px solid var(--border-color); color: var(--primary); width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
    .round-title-mobile { font-weight: 900; text-transform: uppercase; color: var(--primary); letter-spacing: 1px; }
}

.stage-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; width: 100%; margin-bottom: 1.5rem; }
@media (min-width: 769px) { .stage-grid { grid-template-columns: repeat(2, 1fr); align-items: start; } }

.zona-card { background: var(--bg-card); border-radius: 8px; padding: 1rem; box-shadow: 0 2px 8px rgba(0,0,0,0.1); width: 100%; border: 1px solid var(--border-color); color: var(--text-main); }
.zona-header-interactive { display: flex; justify-content: space-between; align-items: center; cursor: pointer; padding-bottom: 0.5rem; margin-bottom: 0.5rem; border-bottom: 2px solid var(--primary); color: var(--text-main); }
.zona-card.finished-zone-card { background-color: var(--bg-finished); border-color: var(--border-color); opacity: 0.9; }
.zona-card.finished-zone-card .zona-header-interactive { border-bottom-color: var(--border-color); color: var(--text-muted); }
.zona-card.finished-zone-card .player-name { color: var(--text-muted); }
.zona-card.finished-zone-card .qualified-row { background: transparent; border-left-color: var(--text-muted); }
.zone-status-label { font-size: 0.7rem; background: #7f8c8d; color: white; padding: 2px 6px; border-radius: 4px; margin-left: 10px; }
.finished-zones-divider { grid-column: 1 / -1; text-align: center; margin: 20px 0 10px 0; position: relative; color: #999; font-size: 0.8rem; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; }
.finished-zones-divider::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; border-top: 2px dashed var(--border-color); z-index: -1; }
.finished-zones-divider span { background: var(--bg-body); padding: 0 15px; position: relative; z-index: 1;}
.icon-arrow { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.3s ease; }
.toggle-icon { transform: rotate(0deg); } .toggle-icon.open { transform: rotate(180deg); }
.hidden-content { display: none; }

.standings-wrapper { overflow-x: auto; margin-bottom: 1rem; border-bottom: none; }
.standings-summary { width: 100%; font-size: 0.85rem; border-collapse: collapse; margin-bottom: 1rem; color: var(--text-main); }
.standings-summary th { background: var(--bg-input); padding: 6px; text-align: center; color: var(--text-muted); }
.standings-summary td { padding: 8px; text-align: center; border-bottom: 1px solid var(--border-color); }
.player-name { text-align: left !important; font-weight: 500; color: var(--text-main); }
.qualified-row { background-color: var(--bg-qualified); border-left: 3px solid var(--success); color: var(--text-main); }
.matches-list-title { font-size: 0.8rem; font-weight: bold; color: #999; margin-bottom: 5px; text-transform: uppercase; }
.matches-table { width: 100%; border-collapse: collapse; border-top: 1px solid var(--border-color)}
.matches-table td { padding: 0.8rem 0.5rem; border-bottom: 1px solid var(--border-color); }
.match-row-zone { border-left: 5px solid transparent; transition: background 0.2s; background-color: var(--bg-card); color: var(--text-main); }
.match-row-zone.status-jugando { border-left-color: var(--success) !important; background-color: var(--bg-card); }
.match-row-zone.status-finalizado { border-left-color: var(--danger) !important; }
.match-row-zone.status-proximo { border-left-color: var(--warning) !important; background-color: var(--bg-card); }
.match-row-zone.status-programado { border-left-color: var(--border-color) !important; }

/* AGENDA */
.day-header { background: var(--bg-card); color: var(--primary); padding: 15px 20px; margin-top: 30px; border-radius: 8px 8px 0 0; font-size: 1.2rem; font-weight: 900; text-transform: uppercase; border-bottom: 3px solid var(--primary); display: flex; justify-content: space-between; align-items: center; box-shadow: var(--shadow-soft); }
.day-header.day-hidden { background: var(--bg-input) !important; color: var(--text-muted) !important; border-color: var(--border-color) !important; opacity: 0.8; }
.schedule-list { background: var(--bg-card); border-radius: 0 0 8px 8px; box-shadow: var(--shadow-soft); overflow: hidden; margin-bottom: 20px; }
.time-block-header { background: var(--bg-input); color: var(--text-muted); padding: 8px 20px; font-weight: bold; font-size: 0.9rem; border-bottom: 1px solid var(--border-color); }
.schedule-row { display: grid; grid-template-columns: 40px 1fr auto; padding: 15px 20px; border-bottom: 1px solid var(--border-color); align-items: center; gap: 15px; border-left: 5px solid transparent; background: var(--bg-card); color: var(--text-main); }
.row-jugando { border-left-color: var(--success); background-color: rgba(46, 204, 113, 0.1); }
.row-finalizado { border-left-color: var(--danger); }
.row-proximo { border-left-color: var(--warning); background-color: rgba(241, 196, 15, 0.1); }
.row-programado { border-left-color: var(--border-color); }
.sched-number { font-weight: bold; color: var(--text-muted); font-size: 1.1rem; text-align: center; }
.sched-category { font-size: 0.7rem; font-weight: bold; color: var(--text-muted); text-transform: uppercase; }
.sched-players { font-size: 1rem; font-weight: 500; color: var(--text-main); }
.sched-result { text-align: right; min-width: 100px; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; }
.badge { padding: 4px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: bold; color: white; display: inline-block; }
.badge-live { background: var(--success); animation: pulse 1.5s infinite; }
.badge-next { background: var(--warning); color: #5d4e00; }
.badge-wo { background: var(--text-highlight); color: var(--bg-body); padding: 3px 6px; font-size: 0.7rem; font-weight: 900; border-radius: 3px; }

.login-container { height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--primary); }
.login-box { background: white; padding: 2rem; border-radius: 8px; width: 90%; max-width: 400px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); text-align: center; display: flex; flex-direction: column; gap: 10px; }
.login-box input { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; }
.btn-main { background: var(--primary); color: white; border: none; padding: 10px; border-radius: 4px; font-weight: bold; cursor: pointer; transition: 0.2s; }
.score-retiro-label { display: block; font-size: 0.7rem; color: #999; font-weight: bold; text-transform: uppercase; margin-top: 4px; line-height: 1; }

.vs-divider { color: var(--text-muted); font-size: 0.85em; font-weight: 400; margin: 0 4px; opacity: 0.8; }
.text-champion { display: inline-block; background: transparent; border: 1px solid var(--accent); color: var(--accent); padding: 2px 8px; border-radius: 4px; font-weight: 900; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 1px; margin-bottom: 5px; }
[data-theme="dark"] .text-champion { color: #ffd700; }
.date-placeholder { color: var(--text-muted) !important; font-size: 0.85rem; }

.icon-eye { 
    background: transparent !important; 
    border: none !important; 
    box-shadow: none !important; 
    cursor: pointer; 
    display: flex; align-items: center; justify-content: center; 
    padding: 8px; /* Área de toque cómoda */
    border-radius: 50%; 
    transition: background 0.2s, transform 0.2s; 
    margin-left: 10px;
    /*-webkit-appearance: none; /* Elimina estilos iOS */
}
.icon-eye:hover { background-color: rgba(0,0,0,0.05) !important; }
.icon-eye:active { transform: scale(0.9); }

.icon-eye.eye-visible { color: var(--primary); }
.icon-eye.eye-hidden { color: #999; opacity: 0.7; }

/* Ajuste oscuro para el hover */
[data-theme="dark"] .icon-eye:hover { background-color: rgba(255,255,255,0.1) !important; }

/* Custom Select */
.custom-select-container { position: relative; width: 100%; height: 100%; }
.custom-select-container select { display: none; }
.select-selected { width: 100%; height: 100%; display: flex; align-items: center; cursor: pointer; user-select: none; font-size: 0.95rem; font-weight: 700; color: var(--text-main); }
.select-selected:after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg); position: absolute; right: 0; transition: transform 0.3s; }
.select-selected.select-arrow-active:after { transform: rotate(225deg); margin-top: 4px; }
.select-items { position: absolute; background-color: var(--bg-card); top: 115%; left: 0; right: 0; z-index: 9999; border-radius: 12px; border: 1px solid var(--border-color); box-shadow: 0 10px 25px rgba(0,0,0,0.15); overflow: hidden; max-height: 300px; overflow-y: auto; opacity: 0; transform: translateY(-10px); visibility: hidden; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
.select-items.select-show { opacity: 1; transform: translateY(0); visibility: visible; }
.select-items div { padding: 12px 15px; cursor: pointer; border-bottom: 1px solid var(--border-color); transition: background 0.2s; font-size: 0.9rem; color: var(--text-main); }
.select-items div:last-child { border-bottom: none; }
.select-items div:hover, .same-as-selected { background-color: rgba(0, 0, 0, 0.05); color: var(--primary); font-weight: bold; }
[data-theme="dark"] .select-items div:hover, [data-theme="dark"] .same-as-selected { background-color: rgba(255, 255, 255, 0.1); }
[data-theme="dark"] .select-items { box-shadow: 0 10px 30px rgba(0,0,0,0.5); }

/* Toasts */
.toast-container { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { background: var(--bg-card); color: var(--text-main); padding: 12px 25px; border-radius: 50px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); border: 1px solid var(--border-color); font-size: 0.9rem; font-weight: 600; display: flex; align-items: center; gap: 10px; opacity: 0; transform: translateY(20px) scale(0.9); transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast.success { border-left: 5px solid var(--success); }
.toast.error { border-left: 5px solid var(--danger); }

/* Settings Panel Admin */
.settings-panel { width: 100%; margin-top: 10px; padding: 12px; background: var(--bg-input); border: 1px dashed var(--border-color); border-radius: 6px; display: flex; flex-wrap: wrap; gap: 15px; align-items: center; grid-column: 1 / -1; }
.input-date-admin { padding: 6px; border: 1px solid var(--border-color); border-radius: 4px; font-size: 0.9rem; background: var(--bg-card); color: var(--text-main); }
.btn-active-toggle { padding: 6px 12px; border-radius: 4px; border: none; font-weight: bold; cursor: pointer; font-size: 0.8rem; }
.btn-active-toggle.status-active { background-color: #ccc; color: #555; cursor: default; }
[data-theme="dark"] .btn-active-toggle.status-active { background-color: var(--bg-input); color: var(--text-muted); border: 1px solid var(--border-color); }
.btn-active-toggle.status-inactive { background-color: #2ecc71; color: white; }
[data-theme="dark"] .btn-active-toggle.status-inactive { background-color: var(--success); color: #000; }
.day-header.day-hidden-admin { opacity: 0.8; background: #f0f0f0; border-color: #ccc; color: #777; }
.day-header.day-hidden-admin .hidden-label { font-size: 0.7rem; color: #555; font-weight: bold; margin-left: 10px; }
[data-theme="dark"] .day-header.day-hidden-admin { background-color: rgba(255, 255, 255, 0.05) !important; border-color: var(--border-color) !important; color: var(--text-muted) !important; }
[data-theme="dark"] .day-header.day-hidden-admin .hidden-label { color: var(--danger); opacity: 0.8; }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 2000; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(3px); }
.modal-card { background: white; padding: 25px; border-radius: 12px; width: 85%; max-width: 320px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.btn-cancel, .btn-confirm { padding: 10px 20px; border-radius: 6px; border: none; font-weight: bold; cursor: pointer; flex: 1; }
.btn-cancel { background: #f0f0f0; color: #555; }
.btn-confirm { background: var(--primary); color: white; }


/* =========================================
   LOGO SVG DINÁMICO (TAMAÑO Y COLORES CORREGIDOS)
   ========================================= */

/* 1. TAMAÑO Y POSICIÓN */
.logo-svg {
    height: 90px; 
    width: auto;
    max-width: 100%;
    display: block;
    transition: all 0.3s ease;
    transform: translateY(10px);
}

/* 2. CLASES DE COLOR (Vinculadas a tus variables) */

/* Clase para la parte principal (Cuerpo del tenista / Triángulo) */
.logo-base {
    fill: var(--text-main); 
    transition: fill 0.3s ease;
}

/* Clase para el detalle (Raqueta / Pelota) */
.logo-brand {
    fill: var(--primary); 
    transition: fill 0.3s ease;
}


/* --- AJUSTE RESPONSIVE (MÓVIL) --- */
@media (max-width: 900px) {
    .logo-svg {
        height: 70px; /* Un poco más pequeño en móvil para no saturar */
    }
}

/* =========================================
   FOOTER (Pie de página)
   ========================================= */
.main-footer {
    text-align: center;         /* Asegura centrado de texto básico */
    padding: 20px;
    margin-top: 40px;
    font-size: 0.9rem;
    color: var(--text-muted);
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    
    /* Flexbox para centrado perfecto vertical y horizontal */
    display: flex;
    justify-content: center;    /* Centra horizontalmente */
    align-items: center;        /* Centra verticalmente */
    width: 100%;                /* Ocupa todo el ancho */
}

/* Ajuste para que el texto dentro no tenga márgenes extraños */
.main-footer p {
    margin: 0;
}

/* --- FIX: PRE-CARGA DE SELECTORES (Evita el salto feo) --- */

/* 1. Estiliza el select nativo para que parezca una píldora inmediatamente */
.select-container-minimal select,
.input-mode-container select {
    appearance: none;        /* Quita la flecha fea del navegador */
    -webkit-appearance: none;
    background-color: transparent;
    border: none;
    font-family: 'Roboto', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    width: 100%;
    padding: 0 10px;
    outline: none;
}

/* 2. Asegura que los contenedores tengan forma de píldora desde el segundo 0 */
.select-container-minimal,
.input-mode-container {
    background: var(--bg-input);
    border-radius: 50px; /* Forma de píldora inmediata */
    display: flex;
    align-items: center;
    height: 40px; /* Altura fija para evitar saltos */
    padding: 0 15px;
    border: 1px solid transparent; /* Reserva espacio para borde */
}

/* Ajuste específico para el contenedor del Torneo (que no tiene fondo en PC) */
@media (min-width: 900px) {
    .select-container-minimal {
        background: transparent;
        border-radius: 0;
        padding: 0;
    }
}

/* =========================================
                     NAVBAR 
   ========================================= */

/* Ajuste global para evitar scroll horizontal fantasma */
html, body {
    overflow-x: hidden;
    width: 100%;
}

/* El contenedor del menú */
.navbar-pro {
    position: fixed; top: 0; left: 0; width: 100%; height: 80px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px); z-index: 2000;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 8%; /* Espacio a los costados */
    border-bottom: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    box-sizing: border-box;
}
[data-theme="dark"] .navbar-pro { background: rgba(20, 20, 20, 0.98); border-bottom: 1px solid rgba(255,255,255,0.05); }

/* --- LOGO Y TEXTO (IZQUIERDA) --- */
.nav-brand {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none; color: var(--text-main);
    flex-shrink: 0; /* Evita que se aplaste */
}

/* EL LOGO GRANDE QUE PEDISTE */
.nav-logo-svg {
    height: 65px; /* Tamaño grande */
    width: auto;
    display: block;
}

/* EL TEXTO BONITO */
.nav-brand-text {
    display: flex; flex-direction: column; line-height: 1;
    font-family: 'Roboto', sans-serif; 
}
.nav-brand-text small {
    font-size: 0.7rem; font-weight: 700; letter-spacing: 1px;
    color: #f1c40f; text-transform: uppercase; margin-bottom: 3px;
    display: block; /* Asegura que se vea siempre */
}
.nav-brand-text span {
    font-size: 1.4rem; font-weight: 900; color: var(--primary);
    text-transform: uppercase; letter-spacing: 0.5px;
}
[data-theme="dark"] .nav-brand-text small { color: var(--accent); }

/* --- SECCIÓN DERECHA (MENÚ) --- */
.nav-right { display: flex; align-items: center; gap: 20px; }

/* Grupo de links de PC */
.nav-desktop-group { display: flex; align-items: center; gap: 25px; }

.nav-link-item {
    text-decoration: none; color: var(--text-muted); 
    font-weight: 700; font-size: 0.9rem; text-transform: uppercase;
    transition: 0.2s;
}
.nav-link-item:hover { color: var(--primary); }

/* Botón "Ver Cuadros" Destacado */
.nav-link-highlight {
    color: var(--primary) !important;
    font-weight: 900; font-size: 1rem;
    display: flex; align-items: center; gap: 8px;
    text-decoration: none;
}
[data-theme="dark"] .nav-link-highlight { color: var(--accent) !important; }

/* Icono Tema y Hamburguesa */
.theme-icon-btn, .hamburger-btn {
    background: none; border: none; cursor: pointer; padding: 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 1.5rem; transition: 0.3s;
}
.hamburger-btn { display: none; font-size: 2rem; } /* Oculto en PC */

/* --- RESPONSIVE (MÓVIL) --- */
@media (max-width: 900px) {
    .navbar-pro { height: 70px; padding: 0 15px; } /* Un poco más compacto */
    
    .nav-logo-svg { height: 50px; } /* Ajuste leve para que entre */
    
    /* MANTENER EL TEXTO VISIBLE, SOLO AJUSTAR TAMAÑO */
    .nav-brand-text small { font-size: 0.55rem; letter-spacing: 0.5px; }
    .nav-brand-text span { font-size: 1.1rem; }

    /* Ocultar menú PC y mostrar hamburguesa */
    .nav-desktop-group { display: none; }
    .hamburger-btn { display: block; }
}

/* --- OVERLAY MÓVIL --- */
.mobile-menu-overlay {
    position: fixed; top: 70px; left: 0; width: 100%; height: calc(100vh - 70px);
    background: var(--bg-body); z-index: 1900;
    padding: 30px; display: flex; flex-direction: column; gap: 20px;
    transform: translateX(100%); transition: transform 0.3s;
}
.mobile-menu-overlay.active { transform: translateX(0); }

.mobile-link {
    font-size: 1.4rem;        /* Texto grande */
    font-weight: 700;         /* Negrita */
    text-decoration: none !important; /* Quita el subrayado */
    color: var(--text-main) !important; /* ¡ESTO QUITA EL MORADO! */
    
    /* Diseño de lista */
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-link.highlight {
    color: var(--primary) !important;
    border-bottom: 2px solid var(--primary);
}

/* --- 2. FRANJA TORNEO (Texto simple debajo del logo) --- */
.tournament-strip {
    position: fixed; top: 70px; left: 0; width: 100%; height: 30px;
    background: var(--bg-body);
    display: flex; align-items: center; justify-content: center; gap: 8px;
    z-index: 2900;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.tournament-strip label {
    font-size: 0.7rem; font-weight: 900; letter-spacing: 1px; color: var(--text-muted);
}
.simple-select-wrapper { position: relative; display: flex; align-items: center; gap: 4px; }
.simple-select-wrapper select {
    border: none; background: transparent; font-size: 0.8rem; font-weight: 700; color: var(--primary);
    cursor: pointer; appearance: none; padding-right: 15px;
}
.simple-arrow { font-size: 0.6rem; color: var(--primary); pointer-events: none; }

/* --- 3. TABS (Nivel 3) --- */
.sticky-nav {
    top: 100px; /* 70 (Header) + 30 (Torneo) */
    height: 45px;
    /* El resto de tus estilos sticky-nav se mantienen */
}

/* --- 4. BARRA DE CATEGORÍA (Nivel 4 - LLAMATIVA) --- */
.filter-strip {
    position: fixed; top: 145px; /* 100 + 45 (Tabs) */
    left: 0; width: 100%; height: 50px;
    background: var(--bg-body); 
    z-index: 2800;
    padding: 5px 10px;
    box-sizing: border-box;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

/* El bloque verde llamativo */
.category-block-selector {
    width: 100%; height: 100%;
    background: var(--primary); /* SÓLIDO */
    border-radius: 8px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 15px;
    color: white; /* Texto blanco para contraste */
    position: relative;
    transition: transform 0.1s;
}
.category-block-selector:active { transform: scale(0.98); }


/* Elementos visuales dentro del bloque */
.cat-icon { font-size: 1.2rem; }
.cat-arrow { font-size: 0.8rem; color: rgba(255,255,255,0.8); }

/* Input de búsqueda (Programación) */
.search-block-selector { width: 100%; height: 100%; }
.search-block-selector input {
    width: 100%; height: 100%;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0 15px;
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 1rem;
}

/* ESPACIO SUPERIOR PARA QUE EL CONTENIDO NO SE ESCONDA */
body { padding-top: 200px !important; }

/* 1. RESET GENERAL (Importante para quitar márgenes gigantes) */
html, body {
    overflow-x: hidden;
    width: 100%;
    margin: 0; padding: 0;
    /* QUITAMOS el padding-top gigante, ahora el flujo es natural */
    padding-top: 0 !important; 
    background-color: var(--bg-body);
}

/* 2. CONTENEDOR HEADER (Navbar) */
/* Usamos Flex-Wrap: En móvil permite que los controles bajen, en PC se quedan en línea */
.navbar-app {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap; /* CLAVE: Permite múltiples líneas en móvil */
    align-items: center;
    padding: 10px 15px;
    width: 100%;
    position: relative; /* NO STICKY */
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* 3. SECCIONES DEL HEADER */

/* IZQUIERDA: Logo + Texto */
.nav-app-left {
    display: flex; align-items: center; gap: 10px;
    order: 1;
    flex: 1; /* Ocupa espacio disponible */
    min-width: 50%; /* Asegura espacio en móvil */
}
.app-logo { height: 50px; width: auto; }
.app-brand-text { display: flex; flex-direction: column; line-height: 1; }
.app-brand-text small { font-size: 0.65rem; font-weight: 700; color: #f1c40f; text-transform: uppercase; }
.app-brand-text span { font-size: 1.1rem; font-weight: 900; color: var(--primary); text-transform: uppercase; }

/* DERECHA: Switch */
.nav-app-right {
    order: 2;
    display: flex; justify-content: flex-end; align-items: center;
    flex: 1;
    min-width: 20%;
}

/* CENTRO: Controles (Torneo + Categoría) */
.nav-app-center {
    order: 3;
    display: flex;
    width: 100%; /* Por defecto en móvil ocupa todo el ancho (nueva línea) */
    flex-direction: column; /* Uno debajo del otro en móvil */
    gap: 10px; /* Separación entre torneo y categoría */
    margin-top: 10px; /* Separación del logo */
    padding-bottom: 5px;
}

/* 4. ESTILOS DE LOS CONTROLES */

/* Selector de Torneo (Texto simple + Select limpio) */
.control-tournament {
    display: flex; align-items: center; justify-content: flex-start; /* Pegado a la izq en móvil pero con margen */
    gap: 10px;
    padding-left: 5px; /* Margen para no estar pegado a la pared */
}
.label-torneo { font-size: 0.75rem; font-weight: 900; color: var(--text-muted); letter-spacing: 1px; }
.select-torneo-clean {
    border: none; background: transparent; 
    font-size: 0.9rem; font-weight: 700; color: var(--primary);
    text-transform: uppercase; outline: none; cursor: pointer;
}

/* Selector de Categoría (Botón Sólido) */
.control-category {
    width: 100%;
}
.btn-category-solid {
    width: 100%;
    background: var(--primary); /* Color sólido */
    color: white;
    border: none;
    border-radius: 8px;
    height: 45px; /* Altura cómoda */
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 15px;
    font-weight: 700; font-size: 1rem;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); /* Sombra para resaltar */
}
.btn-category-solid select {
    position: absolute; top:0; left:0; width:100%; height:100%;
    opacity: 0; cursor: pointer;
}
.cat-icon-text { display: flex; align-items: center; gap: 8px; }

/* Buscador (Programación) - Mismo estilo que categoría */
.search-container-app { width: 100%; }
.input-search-app {
    width: 100%; height: 45px;
    border: 1px solid var(--border-color); border-radius: 8px;
    padding: 0 15px; background: var(--bg-input); color: var(--text-main);
    font-size: 1rem;
}

/* 5. TABS DE NAVEGACIÓN (Debajo del todo) */
.app-tabs {
    display: flex; width: 100%;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}
.app-tab {
    flex: 1; padding: 15px;
    background: transparent; border: none;
    font-weight: 700; color: var(--text-muted);
    font-size: 0.9rem; cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: 0.2s;
}
.app-tab.active { color: var(--primary); border-bottom-color: var(--primary); background: rgba(0,0,0,0.02); }


/* =========================================
   MEDIA QUERY: VERSIÓN PC (>= 900px)
   ========================================= */
@media (min-width: 900px) {
    .navbar-app {
        flex-wrap: nowrap; /* Todo en una línea */
        height: 80px;
        padding: 0 30px;
    }

    /* Izquierda y Derecha mantienen su tamaño pero no crecen de más */
    .nav-app-left, .nav-app-right {
        flex: 0 0 auto; /* No estirar */
        min-width: auto;
    }
    
    /* CENTRO: Ahora se pone en fila horizontal y al medio */
    .nav-app-center {
        flex-direction: row; /* Horizontal */
        margin-top: 0; /* Quitar margen móvil */
        padding-bottom: 0;
        width: auto;
        flex: 1; /* Ocupar espacio central */
        justify-content: center; /* Centrar elementos */
        align-items: center;
        gap: 30px; /* Separación elegante */
    }

    /* Ajustes específicos de controles en PC */
    .control-category { width: 250px; } /* Ancho fijo para categoría */
    .btn-category-solid { 
        background: var(--bg-input); /* En PC más sutil */
        color: var(--text-main); 
        border: 1px solid var(--border-color);
        box-shadow: none;
    }
    .input-search-app { background: var(--bg-card); }
}

/* Modo Oscuro Ajustes */
[data-theme="dark"] .app-brand-text small { color: var(--accent); }
[data-theme="dark"] .btn-category-solid { border: 1px solid rgba(255,255,255,0.1); }

/* PUNTO 2: Label de Torneo visible */
.label-torneo {
    display: inline-block !important; /* Asegurar que se muestre */
    color: var(--text-muted) !important; /* Color gris visible */
    font-size: 0.7rem;
    font-weight: 900;
    margin-right: 5px;
}

/* PUNTO 4: Texto del Selector de Categoría (Blanco sobre fondo de color) */
.btn-category-solid select {
    opacity: 1 !important; /* HACERLO VISIBLE */
    position: relative; /* Quitar absolute para que ocupe su lugar */
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    
    /* Color de texto */
    color: white !important; 
    font-weight: 700;
    font-size: 1rem;
    
    /* Matar estilo nativo */
    -webkit-appearance: none;
    appearance: none;
    z-index: 10;
}

/* Color de las opciones al desplegar (Para que no sean blancas sobre blanco) */
.btn-category-solid select option {
    background-color: var(--bg-card);
    color: var(--text-main);
}

/* =========================================
   NUEVO SISTEMA DE CONTROLES (ALINEACIÓN PERFECTA)
   ========================================= */

/* Ajuste del cuerpo (Header 70 + Torneo 40 + Tabs 45 + Cat 60 = 215px aprox) */
body { padding-top: 220px !important; }

/* Contenedor principal de los controles fijos */
.controls-stack {
    position: fixed;
    top: 70px; /* Debajo del navbar */
    left: 0; width: 100%;
    z-index: 2900;
    background: var(--bg-body); /* Fondo para tapar el scroll */
}

/* --- CLASE BASE PARA AMBAS BARRAS (.control-box) --- */
/* Esto garantiza que midan lo mismo */
.control-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;          /* Altura idéntica */
    padding: 0 15px;       /* Relleno interno idéntico */
    margin: 5px 15px;      /* Márgenes externos idénticos (alineación vertical) */
    border-radius: 8px;    /* Bordes iguales */
    position: relative;
    box-sizing: border-box;
}

/* ESTILO 1: TORNEO (Invisible / Ghost) */
.ghost-style {
    background: transparent;
    border: 1px solid transparent; /* Reserva el espacio del borde */
}
.ghost-style .control-label { color: var(--text-muted); }
.ghost-style .control-select { color: var(--primary); }
.ghost-style .control-arrow { color: var(--primary); }

/* ESTILO 2: CATEGORÍA (Sólido / Verde) */
.solid-style {
    background: var(--primary);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    border: 1px solid var(--primary); /* Borde del mismo color */
}
.solid-style .control-label { color: rgba(255,255,255,0.85); }
.solid-style .control-select { color: #ffffff !important; } /* Texto blanco forzado */
.solid-style .control-arrow { color: #ffffff; }

/* --- ELEMENTOS INTERNOS --- */

/* Texto: "TORNEO:" o "CATEGORÍA:" */
.control-label {
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
    margin-right: 10px;
    flex-shrink: 0; /* Que no se aplaste */
}

/* Icono pelota + Label */
.label-with-icon { display: flex; align-items: center; gap: 8px; }
.cat-icon { font-size: 1.1rem; }

/* EL SELECTOR (La clave del éxito) */
.control-select {
    flex: 1; /* Ocupa todo el espacio central */
    text-align: right; /* Alinea el valor a la derecha (cerca de la flecha) */
    text-align-last: right; /* Soporte extra navegadores */
    
    background: transparent;
    border: none;
    outline: none;
    font-weight: 800;
    font-size: 0.95rem;
    text-transform: uppercase;
    
    /* Matar estilos nativos */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    
    cursor: pointer;
    z-index: 2; /* Por encima de todo para el click */
}

/* --- SOLUCIÓN COLOR BLANCO (Hack iOS) --- */
/* Esto fuerza al navegador a pintar el texto blanco sí o sí */
.solid-style .control-select {
    color: white !important;
    -webkit-text-fill-color: white !important; 
    opacity: 1 !important; 
}
/* Opciones del dropdown (negras para leerse sobre fondo blanco del sistema) */
.control-select option {
    background-color: #fff;
    color: #000;
}

/* LA FLECHA */
.control-arrow {
    font-size: 0.7rem;
    margin-left: 8px;
    pointer-events: none; /* El click pasa al select */
    display: flex; align-items: center; /* Centrar tu SVG si lo pegas */
}

/* BUSCADOR (Ajuste para que coincida con margenes) */
.search-box-app {
    margin: 5px 15px;
    height: 40px;
}
.search-box-app input {
    width: 100%; height: 100%;
    border-radius: 8px; border: 1px solid var(--border-color);
    padding: 0 15px; background: var(--bg-card); color: var(--text-main);
}

/* Ajuste Tabs */
.sticky-nav {
    position: relative; /* Ya no fixed, está dentro del stack */
    top: 0; 
    margin-bottom: 5px;
    background: var(--bg-body);
}


/* =========================================
   SOLUCIÓN FINAL (LAYOUT Y COLORES)
   ========================================= */

/* 1. QUITAR STICKY Y RESETEAR SCROLL */
body { padding-top: 0 !important; }
.navbar-pro, .sticky-nav { position: relative !important; top: auto !important; }

/* 2. FORZAR LETRA BLANCA EN CATEGORÍA (Atacando al JS) */
#cat-container .select-selected { 
    color: #ffffff !important; 
    -webkit-text-fill-color: #ffffff !important; /* Truco indispensable para móviles */
    font-weight: 900; 
}
#cat-container .select-selected:after { 
    border-color: #ffffff !important; /* Flecha de JS en blanco */
}
#cat-container .select-items div {
    color: var(--text-main) !important; /* Opciones normales al abrir el menú */
}

/* 3. ESTRUCTURA FLEXBOX (Móvil vs PC) */
.navbar-pro {
    display: flex;
    flex-wrap: wrap; /* En móvil permite que el centro baje */
    align-items: center;
    justify-content: space-between;
}
.nav-brand { order: 1; }
.nav-right { order: 2; }

/* Móvil: Los controles bajan y se apilan */
.nav-center-controls {
    order: 3;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

/* PC: Los controles suben y se ponen en la misma línea */
@media (min-width: 900px) {
    .navbar-pro { flex-wrap: nowrap; padding: 0 20px; }
    
    .nav-center-controls {
        order: 2; /* Sube al medio del Logo y el Switch */
        width: auto;
        flex: 1;
        flex-direction: row; /* Una cosa al lado de la otra */
        justify-content: center;
        margin-top: 0;
        gap: 20px;
    }
    
    /* Para que en PC no ocupen el 100% de la pantalla */
    .filter-strip-wrapper { width: 300px; }
    .ghost-style { width: auto; }
}

/* Estilos extra para mantener la estética de las cajas */
.control-box { display: flex; align-items: center; justify-content: space-between; padding: 10px 15px; border-radius: 8px; }
.solid-style { background: var(--primary); }
.ghost-style .control-label { color: var(--text-muted); font-size: 0.75rem; margin-right: 10px; }
.solid-style .control-label { color: rgba(255,255,255,0.7); font-size: 0.75rem; margin-right: 10px; }

/* =========================================
   PARCHE: ARREGLO DE FLOTANTES Y ESPACIOS
   ========================================= */

/* 1. MÓVIL: Dejar que el header crezca naturalmente para empujar los Tabs hacia abajo */
.navbar-pro {
    height: auto !important; 
    min-height: 80px;
    padding-bottom: 15px !important; /* Espacio extra antes de los Tabs */
}

/* 2. MÓVIL: Matar cualquier "fixed" o "absolute" de tu código viejo */
#filter-strip, .filter-strip-wrapper {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Reducir el espacio gigante entre Torneo y Categoría en móvil */
.nav-center-controls {
    gap: 10px !important; 
}

/* 3. FIX PC: Aumentar la separación entre Torneo y Categoría */
@media (min-width: 900px) {
    .navbar-pro {
        height: 80px !important; /* En PC sí debe ser fijo */
        padding-bottom: 0 !important;
    }
    
    .nav-center-controls {
        gap: 150px !important; /* <--- Aumenta este número si los quieres aún más separados */
    }
}

/* =========================================
   AJUSTES FINOS (ESPACIO MÓVIL Y ANCHO PC)
   ========================================= */

/* 1. Reducir el espacio entre el logo y los selectores en Móvil */
.nav-center-controls {
    margin-top: 0 !important; /* Antes estaba en 15px, lo dejamos en 0 */
}

/* 2. Darle más ancho al selector de Torneo en PC para que quepa el texto */
@media (min-width: 900px) {
    .ghost-style {
        min-width: 280px !important; /* Obliga a que tenga al menos este ancho */
        white-space: nowrap; /* Evita que el texto se parta en dos renglones */
    }
}

/* =========================================
   MEJORA DEL BUSCADOR DE JUGADORES
   ========================================= */

/* Ajuste del contenedor para que encaje perfecto en Móvil y PC */
#search-container.search-box-app {
    height: 45px;
    margin: 5px 15px; /* Margen en móvil */
}

/* Estilo llamativo para el input */
#search-player {
    width: 100%;
    height: 100%;
    border: 2px solid var(--primary); /* Borde más grueso y verde/color principal */
    border-radius: 8px;
    padding: 0 15px 0 15px;
    background: var(--bg-card); /* Fondo sólido */
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 600;
    outline: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08); /* Sombra para despegarlo del fondo */
    transition: all 0.3s ease; /* Transición suave */
}

/* Efecto cuando el usuario toca/hace clic para escribir */
#search-player:focus {
    border-color: var(--accent); /* Cambia al color amarillo/acento */
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

/* Asegurar que en PC tenga el mismo tamaño que el selector de categoría */
@media (min-width: 900px) {
    #search-container.search-box-app {
        margin: 0;
        width: 300px; /* Ancho fijo para PC */
    }
}

/* FIX: Mantener la letra negra en jugadores de dobles dentro de la tarjeta dorada */
.match-card.champion-card .doubles-partner {
    color: #3e2723 !important;
}

/* Ocultar switch del navbar en móvil (se ve en el menú hamburguesa) */
@media (max-width: 900px) {
    .hide-switch-mobile {
        display: none !important;
    }
}

/* =========================================
   HERO SECTION (INDEX)
   ========================================= */
.hero-section {
    position: relative;
    width: 100%;
    height: 70vh; /* Altura en PC */
    min-height: 450px;
    background-image: var(--bg-desktop); /* El JS pondrá la imagen aquí */
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-top: 80px; /* Para que no lo tape el navbar en PC */
}

.hero-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); /* Sombra para que las letras blancas se lean siempre */
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    color: white; /* Texto blanco siempre en el hero */
    padding: 0 20px;
    max-width: 800px;
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 10px;
    text-transform: uppercase;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
    color: rgba(255,255,255,0.9);
}

.hero-buttons {
    display: flex; justify-content: center; gap: 15px; flex-wrap: wrap;
}

.hero-buttons a {
    padding: 12px 30px; border-radius: 50px;
    font-weight: 700; text-decoration: none; text-transform: uppercase;
    transition: all 0.3s; font-size: 0.9rem;
}

.hero-buttons .btn-main { background: var(--primary); color: white; box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
.hero-buttons .btn-main:hover { transform: scale(1.05); }

.hero-buttons .btn-secondary { background: transparent; color: white; border: 2px solid white; }
.hero-buttons .btn-secondary:hover { background: white; color: var(--text-main); }

/* Adaptación para Celulares */
@media (max-width: 900px) {
    .hero-section {
        height: 60vh;
        margin-top: 70px; /* Navbar de celular es más bajo */
        background-image: var(--bg-mobile) !important; /* El JS pondrá la imagen de móvil aquí */
    }
    .hero-content h1 { font-size: 2.2rem; }
    .hero-content p { font-size: 1rem; }
}

.hero-section {
    margin-top: 0 !important;
}

/* =========================================
   SECCIÓN RANKING (CARRUSEL SWIPE NATIVO)
   ========================================= */

.ranking-section {
    padding: 40px 0; /* Quitamos el padding lateral general para que el carrusel toque los bordes en móvil */
    background: var(--bg-body);
}

.section-title {
    text-align: center; font-size: 2.2rem; font-weight: 900;
    margin-bottom: 30px; color: var(--text-main);
    text-transform: uppercase; letter-spacing: 2px;
    position: relative;
    display: block; /* Asegura el centrado */
}
.section-title::after {
    content: ''; display: block; width: 40px; height: 4px; 
    background: var(--primary); margin: 10px auto 0; border-radius: 2px;
}
/* Pestañas de Género */
.gender-tabs { 
    display: flex; justify-content: center; gap: 40px; margin-bottom: 35px; 
}
.gender-tab {
    background: transparent; border: none; color: var(--text-muted);
    padding: 5px 0; font-weight: 900; cursor: pointer;
    transition: all 0.3s ease; font-size: 1.1rem; letter-spacing: 1px;
    position: relative; outline: none;
}
.gender-tab:hover { color: var(--text-main); }
.gender-tab.active { color: var(--primary); }
.gender-tab::after {
    content: ''; position: absolute; bottom: -2px; left: 0; 
    width: 100%; height: 3px; background: var(--primary);
    transform: scaleX(0); transition: transform 0.3s ease;
    border-radius: 2px;
}
.gender-tab.active::after {
    transform: scaleX(1);
}

/* Contenedor del Carrusel Nativo */
.carousel-wrapper {
    position: relative; 
    max-width: 1300px; /* Aumentado para aprovechar pantallas grandes */
    margin: 0 auto; 
    padding: 0 40px; /* Reducido para que las flechas no roben tanto espacio */
}

.carousel-track-container {
    overflow-x: auto; /* Activa el scroll horizontal */
    scroll-snap-type: x mandatory; /* Hace el efecto "imán" al hacer swipe */
    scrollbar-width: none; /* Oculta la barra en Firefox */
    -ms-overflow-style: none; /* Oculta la barra en IE */
    padding: 20px 5px; /* Sombra de las tarjetas */
    scroll-behavior: smooth; /* Movimiento suave al tocar las flechas en PC */
}

/* Oculta la barra de scroll en Chrome/Safari/Edge */
.carousel-track-container::-webkit-scrollbar { display: none; }

.carousel-track {
    display: flex; 
    gap: 50px; /* Más espacio entre tarjetas */
}

.carousel-track::after {
    content: ''; padding-right: 10px;
}

/* Botones del Carrusel (Solo PC) */
.carousel-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: transparent; color: var(--text-muted); 
    border: none; box-shadow: none;
    width: 40px; height: 50px; font-size: 2.5rem; font-weight: 300;
    cursor: pointer; z-index: 10; 
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s ease; opacity: 0.4; /* Medio invisibles por defecto */
}
.carousel-btn:hover { 
    color: var(--primary); 
    transform: translateY(-50%) scale(1.1); 
    opacity: 1; /* Se iluminan al pasar el mouse */
    background: transparent;
}
.prev-btn { left: -10px; }
.next-btn { right: -10px; }

.swipe-indicator {
    position: absolute; top: 50%; right: 20px; transform: translateY(-50%);
    background: rgba(0, 77, 64, 0.85); color: white;
    padding: 8px 16px; border-radius: 20px; font-size: 0.85rem; font-weight: bold;
    pointer-events: none; z-index: 20;
    opacity: 0; visibility: hidden; transition: opacity 0.3s;
    animation: pulseSwipe 1.5s infinite;
}
.swipe-indicator.active { opacity: 1; visibility: visible; }
@keyframes pulseSwipe {
    0% { transform: translate(0, -50%); }
    50% { transform: translate(-10px, -50%); }
    100% { transform: translate(0, -50%); }
}

/* Tarjeta de Categoría */
.category-card {
    scroll-snap-align: center;
    /* Al aumentar el hueco a 50px, recalculamos el ancho exacto para 3 tarjetas */
    flex: 0 0 calc(33.333% - 34px); 
    background: var(--bg-card); border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); overflow: hidden;
    border: 1px solid rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex; flex-direction: column;
}
.category-card:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0,0,0,0.12); }

.cat-card-header {
    background: transparent; /* Sin fondo de color pesado */
    color: var(--text-main); text-align: center;
    padding: 25px 15px 5px 15px; font-size: 1.5rem; font-weight: 900; 
    letter-spacing: 1px; border-bottom: none;
}
.cat-card-header::after {
    content: ''; display: block; width: 30px; height: 3px;
    background: var(--accent); margin: 8px auto 0 auto; border-radius: 2px;
}
.cat-card-body { padding: 10px 20px 20px 20px; flex: 1; }

/* Lista Top 10 */
.top10-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 5px; border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem; transition: background 0.2s;
}
.top10-row:hover { background: var(--bg-input); border-radius: 6px; }
.top10-row:last-child { border-bottom: none; }
.top10-pos { font-weight: 900; width: 30px; color: var(--text-muted); }
.top10-name { flex: 1; font-weight: 700; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top10-pts { font-weight: 900; color: var(--primary); font-size: 1.05rem; }

/* Podio */
.top10-row:nth-child(1) .top10-pos { color: #f1c40f; font-size: 1.2rem; text-shadow: 0 0 5px rgba(241, 196, 15, 0.3); }
.top10-row:nth-child(2) .top10-pos { color: #bdc3c7; font-size: 1.1rem; }
.top10-row:nth-child(3) .top10-pos { color: #cd7f32; font-size: 1rem; }

/* =========================================
   MÓVIL: MAGIA DEL SCROLL TÁCTIL
   ========================================= */
@media (max-width: 900px) {
    .carousel-wrapper { padding: 0; }
    .carousel-btn { display: none; }
    .carousel-track-container { padding: 20px 15px; }
    .category-card { 
        flex: 0 0 100%; /* Ocupa el ancho total exacto */
    }
    .section-title { font-size: 1.8rem; }
}

/* =========================================
   SECCIÓN EXTRA (ESTILO TARJETA FLOTANTE)
   ========================================= */
.extra-section {
    /* Espacio vertical por fuera de la tarjeta */
    padding: 50px 20px;
    background: var(--bg-body); /* Fondo transparente para que respire */
}

.extra-container {
    /* Esta es ahora la "tarjeta" */
    max-width: 900px;
    margin: 0 auto; /* Centrado horizontal */
    
    background: var(--bg-card); /* Usamos el color de tarjeta de tu tema */
    padding: 50px; /* Espacio interno generoso */
    border-radius: 24px; /* Bordes bien redondeados y modernos */
    
    /* Sombra y borde para darle efecto 3D sutil */
    box-shadow: 0 15px 35px rgba(0,0,0,0.08);
    border: 1px solid var(--border-color);
    
    text-align: center;
    display: flex; flex-direction: column; align-items: center;
    
    /* Animación suave de entrada cuando aparece */
    animation: slideUpFade 0.7s cubic-bezier(0.25, 1, 0.5, 1);
}

.extra-container .btn-main {
    text-decoration: none; /* ¡Esto quita la línea horrible! */
    padding: 15px 40px;    /* Lo hace más grande y clickeable */
    border-radius: 50px;   /* Forma de píldora elegante */
    font-size: 1.1rem;
    text-transform: uppercase;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15); /* Sombra 3D */
    display: inline-block; /* Necesario para que respete los márgenes */
    transition: all 0.3s ease;
}

.extra-container .btn-main:hover {
    transform: translateY(-3px); /* Se levanta un poquito al pasar el mouse */
    box-shadow: 0 12px 25px rgba(0,0,0,0.2);
}

/* Título dentro de la tarjeta */
.extra-title {
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-main);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
}
/* Pequeña línea decorativa debajo del título */
.extra-title::after {
    content: ''; display: block; width: 50px; height: 4px; 
    background: var(--primary); margin: 15px auto 0; border-radius: 2px;
}

/* Descripción dentro de la tarjeta */
.extra-desc {
    font-size: 1.15rem;
    color: var(--text-muted);
    margin-bottom: 35px;
    line-height: 1.8;
    max-width: 85%; /* Evita que el texto sea demasiado ancho para leer */
}

/* Animación de entrada */
@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   AJUSTES MÓVILES PARA LA TARJETA
   ========================================= */
@media (max-width: 768px) {
    .extra-section { padding: 30px 15px; }
    .extra-container {
        padding: 30px 20px;
        border-radius: 16px;
    }
    .extra-title { font-size: 1.6rem; }
    .extra-desc { font-size: 1rem; max-width: 100%; }
}
/* =========================================
   AUMENTAR TAMAÑO BOTONES PORTADA (SOLO PC)
   ========================================= */
@media (min-width: 900px) {
    .hero-buttons a {
        padding: 16px 40px; /* Más altos y más anchos */
        font-size: 1.1rem;  /* Letra más grande */
        border-radius: 50px;
    }
}

/* =========================================
   SECCIÓN CAMPEONES (TARJETAS PREMIUM RECTAS)
   ========================================= */
.champions-section {
    padding: 60px 20px;
    background: var(--bg-body); 
}

.champions-grid {
    display: grid;
    gap: 40px; /* Más espacio entre tarjetas */
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 10px;
    /* Comportamiento móvil y tablet: 1 o 2 columnas según el ancho */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* =========================================
   FORZAR 3 COLUMNAS EN PC
   ========================================= */
@media (min-width: 900px) {
    .champions-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* La Tarjeta del Campeón */
.polaroid {
    background: var(--bg-card); /* ¡Compatible con Modo Oscuro! */
    padding: 15px 15px 25px 15px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
    border-radius: 16px; /* Bordes modernos y redondeados */
    border: 1px solid var(--border-color); /* Borde sutil para modo oscuro */
    display: flex;
    flex-direction: column;
    align-items: center;
    
    /* Variables de animación (entra recta desde abajo) */
    transform: translateY(40px);
    opacity: 0;
    
    animation: fadeInUpCard 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Efecto al pasar el mouse por la tarjeta */
.polaroid:hover {
    /* Flota hacia arriba de manera elegante */
    transform: translateY(-8px) scale(1.02) !important;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    z-index: 10;
}

.polaroid-img-container {
    width: 100%;
    aspect-ratio: 1 / 1; 
    overflow: hidden;
    background: var(--bg-input); /* Fondo gris neutro/oscuro antes de que cargue la foto */
    border-radius: 8px; /* Redondeamos las esquinas de la foto */
}

.polaroid-img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    transition: transform 0.5s ease; /* Transición suave para el zoom */
}

/* Zoom a la foto al hacer hover en la tarjeta */
.polaroid:hover .polaroid-img {
    transform: scale(1.08); 
}

.polaroid-caption {
    margin-top: 18px;
    text-align: center;
    width: 100%;
}

.polaroid-name {
    /* Tipografía seria, gruesa y deportiva */
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--text-main); /* Cambia perfecto en modo oscuro */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.polaroid-cat {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 6px;
}

/* Animación de entrada inicial */
@keyframes fadeInUpCard {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}