:root {
    --primary-color: #00d4ff;
    --secondary-color: #0099cc;
    --background-color: #000000;
    --surface-color: #0a0a0a;
    --surface-hover: #1a1a1a;
    --text-color: #ffffff;
    --text-muted: #888888;
    --border-color: #333333;
    --success-color: #00ff88;
    --error-color: #ff3366;
    --warning-color: #ffaa00;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    --shadow-hover: 0 8px 40px rgba(0, 0, 0, 0.9);
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.3);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

.container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.header {
    background-color: var(--surface-color);
    padding: 10px 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border-radius: 0;
    border-bottom: 2px solid var(--primary-color);
    position: relative;
}

.header > div {
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}

.language-selector {
    order: 1;
    flex-shrink: 0;
}

.language-selector select {
    background-color: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 6px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.language-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
}

.header h1 {
    text-align: center;
    font-size: 2rem;
    font-weight: 300;
    background: linear-gradient(135deg, var(--primary-color), #00ff88);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInDown 0.8s ease-out;
    margin: 0;
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
    flex-shrink: 0;
    min-width: 200px;
}

.main-content {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 20px;
    margin-bottom: 20px;
    padding: 0 20px;
    height: 100%;
    min-height: 0;
}



/* Temporizador de escritorio */
.desktop-timer {
    margin: 0 0 15px 0;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--surface-color), rgba(0, 212, 255, 0.1));
    border: 1px solid rgba(0, 212, 255, 0.3);
    box-shadow: var(--shadow-glow);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    border-radius: var(--border-radius);
}

.desktop-timer h3 {
    font-size: 0.9rem;
    margin: 0;
    color: var(--primary-color);
    text-align: center;
    white-space: nowrap;
}

/* Contenedor del temporizador móvil - oculto por defecto */
.mobile-timer-container {
    display: none;
    width: 100%;
    padding: 0 10px;
    margin-bottom: 15px;
}

/* Temporizador móvil - dentro de su contenedor */
.mobile-timer {
    display: flex;
    padding: 15px;
    background: linear-gradient(135deg, var(--surface-color), rgba(0, 212, 255, 0.1));
    border: 1px solid rgba(0, 212, 255, 0.3);
    box-shadow: var(--shadow-glow);
    border-radius: var(--border-radius);
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.mobile-timer h3 {
    font-size: 1rem;
    margin: 0;
    color: var(--primary-color);
    text-align: center;
}

/* Estilos comunes para timer */
.timer-display {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 0;
    flex-shrink: 0;
}

.timer-element {
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 6px;
    padding: 5px 8px;
    text-align: center;
    min-width: 50px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.timer-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
    line-height: 1;
}

.timer-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1;
    text-transform: uppercase;
}

/* Contenedor para el leaderboard y su temporizador */
.leaderboard-section {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    gap: 0;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        height: auto;
        padding: 0 10px;
        gap: 15px;
    }
    
    .header {
        padding: 8px 15px;
        margin-bottom: 15px;
    }
    
    .header > div {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .header h1 {
        font-size: 1.5rem;
        min-width: auto;
    }
    
    .container {
        padding: 0;
    }
    
    .leaderboard-section {
        order: 2;
    }
    
    .bingo-container {
        order: 1;
    }
    
    /* Mostrar el temporizador móvil */
    .mobile-timer-container {
        display: block !important;
        order: -1; /* Aparece antes que el resto del contenido */
    }
    
    /* Ocultar temporizador de desktop */
    .desktop-timer {
        display: none !important;
    }
    
    .timer-display {
        gap: 10px;
        align-self: stretch;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .timer-element {
        padding: 6px 8px;
        min-width: 60px;
    }
    
    .timer-value {
        font-size: 1.1rem;
    }
    
    .timer-label {
        font-size: 0.6rem;
    }
    
    .btn {
        padding: 12px 16px;
        font-size: 0.9rem;
        min-height: 44px; /* Touch-friendly size */
    }
    
    .form-control {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 44px;
    }
    
    .bingo-grid {
        grid-template-columns: repeat(3, 1fr); /* Reducir de 5 a 3 columnas para más espacio */
        height: auto;
        min-height: 60vh;
        max-height: none;
        gap: 12px;
        padding: 12px;
    }
    
    .bingo-item {
        padding: 15px 10px;
        font-size: 0.95rem;
        line-height: 1.3;
        min-height: 90px;
        aspect-ratio: auto;
        max-height: none;
        word-break: break-word;
        hyphens: auto;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    
    /* Mejorar la predicción overlay en móviles */
    .prediction-overlay {
        top: 8px;
        right: 8px;
        width: 24px;
        height: 24px;
        font-size: 14px;
    }
}

.card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(0, 212, 255, 0.5);
}

.card h2 {
    margin-bottom: 15px;
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--text-color);
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    flex-shrink: 0;
}

.leaderboard {
    animation: slideInLeft 0.8s ease-out;
    display: flex;
    flex-direction: column;
    height: 100%;
    flex: 1;
}

.leaderboard-list {
    flex: 1;
    overflow-y: auto;
    max-height: none;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background-color: var(--background-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    width: 98%;
}

.leaderboard-item:hover {
    background-color: var(--surface-hover);
    transform: translateX(5px);
    box-shadow: var(--shadow-glow);
    border-color: rgba(0, 212, 255, 0.5);
}

.leaderboard-item:nth-child(1) {
    border-left: 4px solid #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.leaderboard-item:nth-child(2) {
    border-left: 4px solid #c0c0c0;
    box-shadow: 0 0 15px rgba(192, 192, 192, 0.3);
}

.leaderboard-item:nth-child(3) {
    border-left: 4px solid #cd7f32;
    box-shadow: 0 0 15px rgba(205, 127, 50, 0.3);
}

.leaderboard-rank {
    font-size: 1.2rem;
    font-weight: bold;
    margin-right: 15px;
    min-width: 30px;
    text-align: center;
}

.leaderboard-name {
    flex: 1;
    font-size: 1.1rem;
}

.leaderboard-score {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.bingo-container {
    animation: slideInRight 0.8s ease-out;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 750px;
    margin: 0 auto;
    justify-content: center;
}

.bingo-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 140px));
    gap: 8px;
    flex: 1;
    height: 100%;
    overflow: hidden;
    padding: 8px;
    max-height: calc(100vh - 180px);
    justify-content: center;
    max-width: 750px;
    margin: 0 auto;
}

.bingo-item {
    background: linear-gradient(135deg, var(--surface-color), rgba(0, 212, 255, 0.05));
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.1;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
    height: 100%;
    min-height: 0;
    aspect-ratio: 1;
    word-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    max-height: calc((100vh - 220px) / 5 - 8px);
}

.bingo-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.2), transparent);
    transition: left 0.5s;
}

.bingo-item:hover::before {
    left: 100%;
}

.bingo-item:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-glow);
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--surface-hover), rgba(0, 212, 255, 0.1));
    z-index: 1;
}

.bingo-item.result-true {
    background: linear-gradient(135deg, var(--success-color), rgba(0, 255, 136, 0.3));
    border-color: var(--success-color);
    color: white;
    animation: successPulse 0.6s ease-out;
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.5);
}

.bingo-item.result-false {
    background: linear-gradient(135deg, var(--error-color), rgba(255, 51, 102, 0.3));
    border-color: var(--error-color);
    color: white;
    animation: errorPulse 0.6s ease-out;
    box-shadow: 0 0 25px rgba(255, 51, 102, 0.5);
}

.bingo-item.pending {
    background: linear-gradient(135deg, var(--warning-color), rgba(255, 170, 0, 0.3));
    border-color: var(--warning-color);
    color: white;
    animation: pendingPulse 2s infinite;
    box-shadow: 0 0 25px rgba(255, 170, 0, 0.5);
}

.prediction-overlay {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.prediction-si {
    background-color: var(--success-color);
    color: white;
}

.prediction-no {
    background-color: var(--error-color);
    color: white;
}

.prediction-no-aplica {
    background-color: var(--warning-color);
    color: white;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: var(--border-radius);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.2);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--surface-hover);
}

.btn-success {
    background-color: var(--success-color);
}

.btn-danger {
    background-color: var(--error-color);
}

.btn-warning {
    background-color: var(--warning-color);
}

.alert {
    padding: 16px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border-left: 4px solid;
    animation: slideInDown 0.5s ease-out;
}

.alert-success {
    background-color: rgba(16, 124, 16, 0.1);
    border-left-color: var(--success-color);
    color: var(--success-color);
}

.alert-error {
    background-color: rgba(209, 52, 56, 0.1);
    border-left-color: var(--error-color);
    color: var(--error-color);
}

.alert-warning {
    background-color: rgba(255, 140, 0, 0.1);
    border-left-color: var(--warning-color);
    color: var(--warning-color);
}

.alert-info {
    background-color: rgba(0, 120, 212, 0.1);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--surface-color);
    margin: 2% auto;
    padding: 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 1000px;
    max-height: 95vh;
    box-shadow: var(--shadow-hover);
    animation: modalSlideIn 0.3s ease-out;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.close {
    color: var(--text-muted);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.close:hover {
    color: var(--text-color);
}

.modal-title {
    margin: 0 0 20px 0;
    padding-right: 40px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    max-height: calc(95vh - 150px);
    padding-right: 5px;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--background-color);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

.phase-indicator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 20px 20px 20px;
    padding: 15px 20px;
    background: linear-gradient(135deg, var(--surface-color), rgba(0, 212, 255, 0.05));
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.phase-step {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    position: relative;
    font-size: 0.9rem;
}

.phase-step.active {
    background: linear-gradient(135deg, var(--primary-color), rgba(0, 212, 255, 0.8));
    color: white;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
}

.phase-step.completed {
    background: linear-gradient(135deg, var(--success-color), rgba(0, 255, 136, 0.8));
    color: white;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
}

.phase-step::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid var(--primary-color);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.phase-step:last-child::after {
    display: none;
}

/* Animaciones */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes successPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 25px rgba(0, 255, 136, 0.5);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 35px rgba(0, 255, 136, 0.8);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 25px rgba(0, 255, 136, 0.5);
    }
}

@keyframes errorPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 25px rgba(255, 51, 102, 0.5);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 35px rgba(255, 51, 102, 0.8);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 25px rgba(255, 51, 102, 0.5);
    }
}

@keyframes pendingPulse {
    0% {
        opacity: 0.7;
        box-shadow: 0 0 25px rgba(255, 170, 0, 0.5);
    }
    50% {
        opacity: 1;
        box-shadow: 0 0 35px rgba(255, 170, 0, 0.8);
    }
    100% {
        opacity: 0.7;
        box-shadow: 0 0 25px rgba(255, 170, 0, 0.5);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive design mejorado */
@media (max-width: 480px) {
    /* Dispositivos muy pequeños */
    .header {
        padding: 8px 10px;
        margin-bottom: 10px;
    }
    
    .header > div {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .header h1 {
        font-size: 1.3rem;
        margin-bottom: 5px;
    }
    
    .main-content {
        padding: 0 5px;
        gap: 10px;
    }
    
    .card {
        margin: 0 5px 10px 5px;
        padding: 15px 10px;
    }
    
    .bingo-grid {
        grid-template-columns: repeat(2, 1fr); /* Solo 2 columnas para máximo espacio horizontal */
        gap: 12px;
        padding: 10px;
        max-width: 100%;
    }
    
    .bingo-item {
        font-size: 0.85rem;
        padding: 15px 10px;
        min-height: 85px;
        line-height: 1.3;
    }
    
    /* Ajustes para el temporizador móvil en pantallas muy pequeñas */
    .mobile-timer-container {
        display: block !important;
        padding: 0 5px;
        margin-bottom: 10px;
        order: -1; /* Asegurar que aparezca antes que la cartilla */
    }
    
    .mobile-timer {
        padding: 12px;
    }
    
    .mobile-timer h3 {
        font-size: 0.9rem;
    }
    
    .timer-element {
        min-width: 50px;
        padding: 8px 6px;
    }
    
    .timer-value {
        font-size: 1.2rem;
    }
    
    .timer-label {
        font-size: 0.7rem;
    }
    
    .phase-indicator {
        margin: 0 5px 10px 5px;
        padding: 8px 10px;
        flex-direction: column;
        gap: 8px;
    }
    
    .phase-step {
        padding: 8px 10px;
        font-size: 0.8rem;
    }
    
    .leaderboard-item {
        padding: 10px 8px;
        font-size: 0.85rem;
    }
    
    .btn {
        padding: 10px 12px;
        font-size: 0.85rem;
        min-height: 40px;
    }
    
    .form-control {
        padding: 10px;
        font-size: 16px;
        min-height: 40px;
    }
    
    .timer-element {
        min-width: 40px;
        padding: 4px 6px;
    }
    
    .timer-value {
        font-size: 1rem;
    }
    
    .timer-label {
        font-size: 0.55rem;
    }
}

@media (max-width: 768px) {
    /* Tablets y móviles */
    .modal-content {
        margin: 1% auto;
        padding: 20px;
        width: 95%;
        max-height: 90vh;
    }
    
    .modal-body {
        max-height: calc(90vh - 120px);
    }
    
    .modal-title {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    
    /* Mejoras en el header para móviles */
    .header > div {
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    
    .header > div > div {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
        align-items: center;
    }
    
    /* Mejora de botones en móvil */
    .btn {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }
    
    .timer-display {
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }
    
    /* Mejora de la navegación */
    .language-selector {
        position: static !important;
        margin: 10px auto;
        text-align: center;
        width: fit-content;
    }
}

@media (min-width: 1441px) {
    .bingo-item {
        font-size: 1rem;
        padding: 8px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    /* Tabletas - usar 4 columnas para aprovechar mejor el espacio */
    .main-content {
        grid-template-columns: 1fr 2fr;
        gap: 15px;
    }
    
    .bingo-item {
        font-size: 0.85rem;
        padding: 6px;
    }
    
    .bingo-grid {
        grid-template-columns: repeat(4, minmax(90px, 110px));
        max-width: 650px;
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        height: auto;
        padding: 0 10px;
        gap: 15px;
    }
    
    .header {
        padding: 8px 15px;
        margin-bottom: 15px;
    }
    
    .header > div {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        align-items: center;
        justify-content: center;
    }
    
    .language-selector {
        order: 0;
        margin-bottom: 5px;
    }
    
    .language-selector select {
        padding: 8px 12px;
        font-size: 0.9rem;
        min-width: 120px;
    }
    
    .header h1 {
        font-size: 1.5rem;
        min-width: auto;
        order: 1;
    }
    
    .header > div > div {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
        align-items: center;
        order: 2;
        width: 100%;
    }
    
    .header > div > span {
        order: 0;
        width: 100%;
        margin-bottom: 10px;
        font-size: 0.9rem;
    }
    
    .container {
        padding: 0;
    }
    
    .leaderboard-section {
        order: 2;
    }
    
    .bingo-container {
        order: 1;
    }
    
    .timer-display {
        gap: 10px;
        align-self: stretch;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .timer-element {
        padding: 6px 8px;
        min-width: 60px;
    }
    
    .timer-value {
        font-size: 1.1rem;
    }
    
    .timer-label {
        font-size: 0.6rem;
    }
    
    .btn {
        padding: 12px 16px;
        font-size: 0.9rem;
        min-height: 44px; /* Touch-friendly size */
        flex: 1;
        min-width: 80px;
        max-width: 140px;
    }
    
    .form-control {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 44px;
    }
    
    .bingo-grid {
        height: auto;
        min-height: 70vh;
        max-height: none;
        gap: 8px;
        padding: 8px;
        grid-template-columns: repeat(5, 1fr);
        max-width: 100%;
        width: 100%;
        aspect-ratio: 1;
    }
    
    .bingo-item {
        font-size: 0.7rem;
        padding: 6px;
        line-height: 1.2;
        min-height: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        hyphens: auto;
        word-break: break-word;
        aspect-ratio: 1;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 15px;
        max-height: 90vh;
    }
    
    .modal-title {
        font-size: 1.2rem;
        padding-right: 30px;
    }
    
    .modal-body {
        max-height: calc(90vh - 100px);
    }
    
    .phase-indicator {
        flex-direction: column;
        gap: 10px;
        margin: 0 10px 15px 10px;
        padding: 10px 15px;
    }
    
    .phase-step {
        width: 100%;
        padding: 12px;
        font-size: 0.9rem;
    }
    
    .phase-step::after {
        display: none;
    }
    
    .leaderboard-item {
        padding: 15px 12px;
        font-size: 0.9rem;
        width: 100%;
    }
    
    .leaderboard-rank {
        min-width: 35px;
        font-size: 1rem;
    }
    
    .leaderboard-name {
        font-size: 0.9rem;
        flex: 1;
    }
    
    .leaderboard-score {
        font-size: 1rem;
    }
    
    .card {
        margin: 0 10px 15px 10px;
        padding: 20px 15px;
    }
    
    .card h2 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    
    /* Language selector adjustments */
    .language-selector {
        position: static !important;
        margin: 10px auto;
        text-align: center;
        width: fit-content;
        order: 3;
    }
    
    /* Form improvements */
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group label {
        margin-bottom: 8px;
        font-size: 0.9rem;
    }
    
    /* Alert improvements */
    .alert {
        margin: 0 10px 15px 10px;
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    /* Mejoras específicas para touch */
    .bingo-item:hover {
        transform: scale(1.05);
    }
    
    .btn:active {
        transform: scale(0.98);
    }
    
    /* Optimización de tap targets */
    .leaderboard-item {
        min-height: 48px;
    }
    
    .prediction-overlay {
        width: 24px;
        height: 24px;
        top: 3px;
        right: 3px;
        font-size: 11px;
    }
}

/* Tablets (hasta 1024px) */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr 2fr;
        gap: 15px;
    }
    
    .bingo-item {
        font-size: 0.8rem;
        padding: 5px;
    }
    
    .bingo-grid {
        grid-template-columns: repeat(5, minmax(90px, 110px));
        max-width: 580px;
    }
}

/* Pantallas grandes (1440px y más) */
@media (min-width: 1440px) {
    .bingo-item {
        font-size: 1rem;
        padding: 8px;
    }
}

/* Dispositivos muy pequeños (hasta 480px) */
@media (max-width: 480px) {
    .header {
        padding: 8px 10px;
        margin-bottom: 10px;
    }
    
    .header > div {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .header h1 {
        font-size: 1.3rem;
        margin-bottom: 5px;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        padding: 0 5px;
        gap: 10px;
    }
    
    .card {
        margin: 0 5px 10px 5px;
        padding: 15px 10px;
    }
    
    .bingo-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 4px;
        padding: 5px;
        max-width: 100%;
        height: auto;
        min-height: 60vh;
    }
    
    .bingo-item {
        font-size: 0.6rem;
        padding: 4px;
        min-height: 50px;
        line-height: 1.1;
        aspect-ratio: 1;
    }
    
    .phase-indicator {
        margin: 0 5px 10px 5px;
        padding: 8px 10px;
        flex-direction: column;
        gap: 8px;
    }
    
    .phase-step {
        padding: 8px 10px;
        font-size: 0.8rem;
        width: 100%;
    }
    
    .phase-step::after {
        display: none;
    }
    
    .leaderboard-item {
        padding: 10px 8px;
        font-size: 0.85rem;
    }
    
    .leaderboard-rank {
        min-width: 30px;
        font-size: 0.9rem;
    }
    
    .leaderboard-name {
        font-size: 0.8rem;
    }
    
    .leaderboard-score {
        font-size: 0.9rem;
    }
    
    .btn {
        padding: 10px 12px;
        font-size: 0.85rem;
        min-height: 40px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }
    
    .form-control {
        padding: 10px;
        font-size: 16px;
        min-height: 40px;
    }
    
    .timer-element {
        min-width: 40px;
        padding: 4px 6px;
    }
    
    .timer-value {
        font-size: 1rem;
    }
    
    .timer-label {
        font-size: 0.55rem;
    }
    
    .timer-display {
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }
    
    /* Language selector para móviles pequeños */
    .language-selector {
        position: static !important;
        margin: 5px auto;
        text-align: center;
        width: fit-content;
    }
}

/* Estilos adicionales para tema OLED */
.timer-display {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 0;
    flex-shrink: 0;
}

.timer-element {
    text-align: center;
    background: linear-gradient(135deg, var(--surface-color), rgba(0, 212, 255, 0.1));
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: var(--border-radius);
    padding: 4px 8px;
    min-width: 45px;
}

.timer-value {
    display: block;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
    line-height: 1.2;
}

.timer-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    line-height: 1;
}

.timer-info {
    text-align: center;
    margin-top: 10px;
    color: var(--text-muted);
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), var(--success-color));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
}

/* Efectos de glow mejorados */
.glow-effect {
    position: relative;
}

.glow-effect::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    border-radius: inherit;
    filter: blur(10px);
    opacity: 0.5;
    z-index: -1;
}

/* Mejoras en botones - estilos ya definidos arriba */

/* Texto con efecto glow */
.text-glow {
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

/* Optimizaciones específicas para dispositivos táctiles */
.touch-device .bingo-item {
    transition: all 0.2s ease;
}

.touch-device .bingo-item.touch-active {
    transform: scale(0.95);
    background: linear-gradient(135deg, var(--primary-color), rgba(0, 212, 255, 0.2));
    border-color: var(--primary-color);
}

.touch-device .btn:active {
    transform: scale(0.95);
}

.touch-device .leaderboard-item:active {
    background-color: var(--surface-hover);
    transform: scale(0.98);
}

/* Mejoras para scroll en móviles */
@media (max-width: 768px) {
    body {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
    }
    
    .leaderboard-list {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
    }
    
    .modal-body {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
    }
}

/* Mejoras de accesibilidad móvil */
@media (max-width: 768px) {
    /* Áreas de toque más grandes */
    .btn, .form-control, .leaderboard-item, .bingo-item {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Espaciado mejorado entre elementos interactivos */
    .btn + .btn {
        margin-left: 8px;
    }
    
    /* Feedback visual mejorado */
    .btn:focus {
        outline: 2px solid var(--primary-color);
        outline-offset: 2px;
    }
    
    .form-control:focus {
        outline: 2px solid var(--primary-color);
        outline-offset: 1px;
    }
}

/* Orientación horizontal en móviles */
@media (max-width: 768px) and (orientation: landscape) {
    .main-content {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .bingo-grid {
        min-height: 50vh;
        max-height: 60vh;
    }
    
    .header h1 {
        font-size: 1.2rem;
    }
    
    .phase-indicator {
        flex-direction: row;
        gap: 5px;
        padding: 8px 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .phase-step {
        flex: 1;
        min-width: 80px;
        padding: 8px;
        font-size: 0.8rem;
    }
}
