/* Corregido: Import de fuentes movido al HTML para mejor performance */
/* Corregido: Eliminado box-sizing duplicado */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Mejorado: Variables CSS para mejor mantenimiento */
:root {
    --primary-gold: #FFD700;
    --primary-orange: #FFA500;
    --primary-green: #2ECC71;
    --primary-blue: #3498DB;
    --primary-red: #E74C3C;
    --primary-purple: #6c5ce7;
    --background-dark: #0f0f0f;
    --background-secondary: #1a1a2e;
    --background-tertiary: #16213e;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow-strong: 0 20px 60px rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 10px 30px rgba(0, 0, 0, 0.2);
    --transition-smooth: all 0.3s ease;
}

/* Mejorado: Scroll behavior suave */
html {
    scroll-behavior: smooth;
}

body {
    background: linear-gradient(135deg, var(--background-dark) 0%, var(--background-secondary) 50%, var(--background-tertiary) 100%);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow-x: hidden; /* Corregido: Evitar scroll horizontal */
    line-height: 1.6;
}

/* Mejorado: Skip link para accesibilidad */
/* .skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-blue);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 6px;
} */

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 215, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(46, 204, 113, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    animation: fadeInUp 1s ease-out;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.main-title {
    font-family: 'Orbitron', monospace;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    background: linear-gradient(45deg, var(--primary-gold), var(--primary-orange), #FF6B35);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
    margin-bottom: 20px;
    letter-spacing: 2px;
    /* Mejorado: Fallback para navegadores sin soporte */
    color: var(--primary-gold);
}

/* Microinteracción: Brillo sutil al pasar el mouse sobre el título */
.main-title:hover {
    filter: brightness(1.2) drop-shadow(0 0 10px var(--primary-gold));
    transition: filter 0.3s;
}

.subtitle {
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: var(--primary-green);
    font-weight: 600;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(46, 204, 113, 0.3);
}

.fun-message {
    background: rgba(255, 193, 7, 0.1);
    border: 2px solid #FFC107;
    border-radius: 15px;
    padding: 15px;
    margin: 20px 0;
    font-size: 1.1rem;
    color: #FFC107;
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.2);
    backdrop-filter: blur(10px);
}

/* Break responsivo para el mensaje divertido */
/* .mobile-break {
    display: none;
}

@media (max-width: 768px) {
    .mobile-break {
        display: block;
    }
} */

/* Sombra y brillo en mensajes destacados */
.leader-message, .fun-message {
    box-shadow: 0 0 30px 0 rgba(255, 215, 0, 0.15), 0 2px 8px 0 rgba(46, 204, 113, 0.10);
    border: 1.5px solid var(--primary-gold);
}

.leader-message {
    background: linear-gradient(45deg, var(--primary-green), #27AE60);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(46, 204, 113, 0.3);
    animation: pulse 2s infinite;
}

.table-container {
    background: rgba(255,255,255,0.10);
    box-shadow: 0 8px 32px 0 rgba(31,38,135,0.37);
    border: 1px solid rgba(255,255,255,0.18);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 30px;
    overflow: hidden;
}

/* Microinteracción: Efecto glassmorphism más notorio en la tabla */
.table-container:hover {
    animation: borderGlow 1.5s linear;
}

/* Mejorado: Wrapper para scroll horizontal en móvil */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.stats-table {
    width: 100%;
    min-width: 600px; /* Mejorado: Ancho mínimo para evitar compresión */
    border-collapse: separate;
    border-spacing: 0;
    font-size: 1rem;
    background: transparent;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow-medium);
}

/* Mejor visibilidad para títulos de columna */
.stats-table th {
    background: linear-gradient(45deg, var(--primary-purple), #a29bfe);
    color: white;
    padding: 18px 15px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: 1px solid var(--glass-border);
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    position: relative;
    white-space: nowrap;
    text-shadow: 0 2px 8px rgba(106, 27, 154, 0.15);
}

.stats-table th:first-child {
    border-top-left-radius: 15px;
}

.stats-table th:last-child {
    border-top-right-radius: 15px;
}

.stats-table td {
    padding: 18px 15px;
    text-align: center;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
    transition: var(--transition-smooth);
    position: relative;
}

.stats-table td:first-child {
    border-left: 1px solid var(--glass-border);
}

.stats-table td:last-child {
    border-right: 1px solid var(--glass-border);
}

.stats-table tbody tr:last-child td {
    border-bottom: 1px solid var(--glass-border);
}

.stats-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 15px;
}

.stats-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 15px;
}

.stats-table tr {
    transition: var(--transition-smooth);
}

/* Hover animado en filas de la tabla */
.stats-table tbody tr {
    cursor: pointer;
    transition: background 0.3s, transform 0.2s, box-shadow 0.2s;
}
.stats-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.01) translateY(-4px);
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.08);
}

.stats-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.leader-row {
    font-weight: bold;
    position: relative;
}

.leader-row .position::before {
    content: '👑 ';
    font-size: 1.2rem;
    margin-right: 5px;
    animation: bounce 2s infinite;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
    display: inline-block;
}

.position {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--primary-gold);
}

.player-name {
    font-weight: 600;
    color: var(--text-primary);
}

.leader-name {
    color: var(--primary-gold);
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.wins {
    color: var(--primary-green);
    font-weight: bold;
}

.losses {
    color: var(--primary-red);
}

.percentage {
    color: var(--primary-blue);
    font-weight: 600;
}

.titles {
    color: #F39C12;
    font-weight: bold;
}

.emoji-decoration {
    font-size: 2rem;
    margin: 0 10px;
    animation: rotate 3s linear infinite;
}

/* Mejorado: Estados de carga y error */
.loading-message,
.error-message {
    text-align: center;
    padding: 40px;
    background: var(--glass-bg);
    border-radius: 15px;
    margin-top: 20px;
    border: 1px solid var(--glass-border);
}

.error-message {
    border-color: var(--primary-red);
    color: var(--primary-red);
}

.retry-btn {
    margin-top: 15px;
    padding: 10px 20px;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition-smooth);
}

/* Botones: microinteracción de rebote */
.retry-btn:active {
    transform: scale(0.96);
    background: var(--primary-green);
}

.retry-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

/* Pelotas flotantes */
.floating-balls {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.ball {
    position: absolute;
    font-size: 2rem;
    opacity: 0.6;
    animation: float 6s ease-in-out infinite;
    will-change: transform;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

/* Footer */
.footer {
    margin-top: 40px;
    text-align: center;
    padding: 25px 20px;
    background: var(--glass-bg);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-medium);
    animation: fadeInUp 1.2s 0.5s both;
}

.footer-content {
    max-width: 500px;
    margin: 0 auto;
}

.footer-content p {
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.footer-content p:first-child {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary-gold);
    margin-bottom: 12px;
}

.social-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 15px;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.3rem;
    transition: var(--transition-smooth);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.social-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.social-btn:hover::before {
    transform: translateX(100%);
}

.social-btn:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.social-btn.whatsapp:hover {
    background: linear-gradient(45deg, #25d366, #128c7e);
    border-color: #25d366;
}

.social-btn.instagram:hover {
    background: linear-gradient(45deg, #e1306c, #f56040, #fcaf45);
    border-color: #e1306c;
}

.social-btn.twitter:hover {
    background: linear-gradient(45deg, #1da1f2, #0d95e8);
    border-color: #1da1f2;
}

/* Animaciones */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 10px 30px rgba(46, 204, 113, 0.3);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 15px 40px rgba(46, 204, 113, 0.5);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) translateX(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-20px) translateX(10px) rotate(5deg);
    }
    50% {
        transform: translateY(-40px) translateX(-10px) rotate(-5deg);
    }
    75% {
        transform: translateY(-20px) translateX(5px) rotate(3deg);
    }
}

/* Responsive Design */
/* Tablets y pantallas medianas */
@media (max-width: 1024px) {
    .container {
        max-width: 95%;
    }
    
    .main-title {
        font-size: clamp(1.8rem, 4vw, 2.5rem);
    }
    
    .stats-table {
        min-width: 700px;
    }
}

/* Tablets pequeñas y móviles grandes */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 0;
    }
    
    .header {
        margin-bottom: 20px;
    }
    
    .main-title {
        font-size: 2rem;
        letter-spacing: 1px;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .fun-message {
        font-size: 1rem;
        padding: 12px;
    }
    
    .leader-message {
        font-size: 1rem;
        padding: 12px;
    }
    
    .table-container {
        padding: 15px;
        border-radius: 15px;
        box-shadow: 0 2px 8px 0 rgba(31,38,135,0.15);
        backdrop-filter: blur(4px);
    }
    
    .stats-table {
        min-width: 500px;
        font-size: 0.85rem;
    }
    
    .stats-table th {
        padding: 12px 8px;
        font-size: 0.8rem;
    }
    
    .stats-table td {
        padding: 12px 8px;
    }
    
    .emoji-decoration {
        font-size: 1.5rem;
        margin: 0 5px;
    }
    
    .ball {
        font-size: 1.5rem;
    }
    
    .footer {
        margin-top: 30px;
        padding: 20px 15px;
        box-shadow: 0 2px 8px 0 rgba(31,38,135,0.10);
        animation: none;
    }
    
    .social-buttons {
        gap: 10px;
        margin-top: 12px;
    }
    
    .social-btn {
        width: 38px;
        height: 38px;
        font-size: 1.2rem;
    }
    
    .main-title:hover {
        filter: none;
    }
    
    .stats-table tbody tr:hover {
        box-shadow: none;
        transform: scale(1) translateY(-2px);
    }
}

/* Móviles pequeños */
@media (max-width: 480px) {
    .main-title {
        font-size: 1.8rem;
    }
    
    .emoji-decoration {
        display: none; /* Ocultar emojis decorativos en móviles muy pequeños */
    }
    
    .fun-message {
        font-size: 0.9rem;
        padding: 10px;
        line-height: 1.4;
    }
    
    .leader-message {
        font-size: 0.9rem;
        padding: 10px;
    }
    
    .table-container {
        padding: 10px;
        border-radius: 10px;
    }
    
    .stats-table {
        min-width: 400px; /* Reducir ancho mínimo */
        font-size: 0.75rem;
    }
    
    .stats-table th {
        padding: 8px 4px;
        font-size: 0.7rem;
        letter-spacing: 1px;
    }
    
    .stats-table td {
        padding: 8px 4px;
    }
    
    /* Ocultar columnas menos importantes en móviles muy pequeños */
    .stats-table th:nth-child(3), /* Juegos jugados */
    .stats-table td:nth-child(3) {
        display: none;
    }
    
    .leader-row .position::before {
        font-size: 0.9rem;
    }
    
    .social-btn {
        width: 35px;
        height: 35px;
        font-size: 1.1rem;
    }
    
    .table-container {
        box-shadow: none;
        backdrop-filter: blur(2px);
    }
    
    .footer {
        box-shadow: none;
        margin-top: 25px;
        padding: 18px 12px;
    }
}

/* Móviles muy pequeños */
@media (max-width: 360px) {
    .main-title {
        font-size: 1.6rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .stats-table {
        min-width: 350px;
        font-size: 0.7rem;
    }
    
    .stats-table th {
        padding: 6px 3px;
        font-size: 0.65rem;
    }
    
    .stats-table td {
        padding: 6px 3px;
    }
    
    /* Ocultar más columnas en pantallas muy pequeñas */
    .stats-table th:nth-child(6), /* Diferencia */
    .stats-table td:nth-child(6) {
        display: none;
    }
    
    .social-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .floating-balls {
        display: none;
    }
}

/* Modo de alto contraste */
@media (prefers-contrast: high) {
    :root {
        --glass-bg: rgba(255, 255, 255, 0.1);
        --glass-border: rgba(255, 255, 255, 0.3);
        --text-secondary: rgba(255, 255, 255, 0.9);
    }
    
    .stats-table th {
        background: linear-gradient(45deg, #333, #555);
        border-color: #666;
    }
    
    .stats-table td {
        border-color: #444;
    }
}

/* Impresión */
@media print {
    body {
        background: white;
        color: black;
        font-size: 12pt;
    }
    
    .floating-balls,
    .emoji-decoration,
    .footer {
        display: none;
    }
    
    .table-container {
        background: white;
        border: 1px solid #000;
        box-shadow: none;
    }
    
    .stats-table th {
        background: #f0f0f0;
        color: black;
    }
    
    .stats-table td {
        background: white;
        border: 1px solid #000;
    }
}

/* Animación de brillo en el borde de la tabla */
@keyframes borderGlow {
    0% {
        box-shadow: 0 0 0px var(--primary-gold);
    }
    50% {
        box-shadow: 0 0 16px var(--primary-gold);
    }
    100% {
        box-shadow: 0 0 0px var(--primary-gold);
    }
}