/* =====================================================
   RULETA MATEMÁTICA - ESTILOS CSS
   Estética de Casino Las Vegas con efectos neón
   ===================================================== */

/* Reset y configuración base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a0a2e 50%, #0a0a1a 100%);
    color: #ffffff;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Fondo con efectos de luces animadas */
.background-lights {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 0, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(255, 215, 0, 0.1) 0%, transparent 50%);
    animation: lights-pulse 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes lights-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

/* Contenedor principal */
.game-container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* =====================================================
   PANEL SUPERIOR - CRÉDITOS Y RONDA
   ===================================================== */

.top-panel {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 20px;
}

.credits-display,
.round-display {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #00ffff;
    border-radius: 10px;
    padding: 15px 30px;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5),
                inset 0 0 20px rgba(0, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.neon-text {
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff,
                 0 0 20px #00ffff,
                 0 0 30px #00ffff;
    font-weight: bold;
    font-size: 1.2em;
    letter-spacing: 2px;
}

.credits-value,
.round-value {
    color: #ffd700;
    font-size: 1.8em;
    font-weight: bold;
    text-shadow: 0 0 10px #ffd700,
                 0 0 20px #ffd700;
}

/* =====================================================
   PANEL DEL PROBLEMA
   ===================================================== */

.problem-panel {
    background: rgba(0, 0, 0, 0.8);
    border: 3px solid #ff00ff;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 0 30px rgba(255, 0, 255, 0.6),
                inset 0 0 30px rgba(255, 0, 255, 0.1);
}

.problem-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.problem-header h2 {
    font-size: 1.5em;
}

.timer-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 0, 0, 0.2);
    padding: 10px 20px;
    border-radius: 10px;
    border: 2px solid #ff0000;
}

.timer-label {
    color: #ff6666;
    font-weight: bold;
}

.timer {
    color: #ff0000;
    font-size: 2em;
    font-weight: bold;
    text-shadow: 0 0 10px #ff0000,
                 0 0 20px #ff0000;
    min-width: 50px;
    text-align: center;
}

.problem-text {
    color: #ffffff;
    font-size: 1.3em;
    line-height: 1.6;
    text-align: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

/* =====================================================
   CONTENEDOR DE RULETA + PAÑO
   ===================================================== */

.roulette-betting-container {
    display: flex;
    flex-direction: row; /* Ruleta a la izquierda, paño a la derecha */
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 15px;
    justify-content: center;
}

/* =====================================================
   CONTENEDOR DE RULETA 3D
   ===================================================== */

.roulette-container {
    flex: 0 0 45%; /* Ocupa 45% del ancho */
    max-width: 600px;
    text-align: center;
}

.roulette-3d {
    width: 100%;
    height: 450px;
    background: rgba(0, 0, 0, 0.5);
    border: 3px solid #ffd700;
    border-radius: 15px;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.5),
                inset 0 0 40px rgba(255, 215, 0, 0.1);
    margin-bottom: 10px;
}

.roulette-label {
    color: #ffd700;
    font-size: 1.2em;
    font-weight: bold;
    text-shadow: 0 0 10px #ffd700;
    letter-spacing: 3px;
}

/* =====================================================
   MESA DE APUESTAS (PAÑO VERDE)
   ===================================================== */

.betting-table {
    background: linear-gradient(135deg, #0a5c0a 0%, #0d8b0d 50%, #0a5c0a 100%);
    border: 5px solid #ffd700;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.4),
                inset 0 0 50px rgba(0, 0, 0, 0.3);
    flex: 0 0 50%; /* Ocupa 50% del ancho */
    max-width: 650px;
}

.table-header {
    text-align: center;
    color: #ffd700;
    font-size: 1.5em;
    font-weight: bold;
    text-shadow: 0 0 15px #ffd700;
    margin-bottom: 20px;
    letter-spacing: 3px;
}

/* Grid de números */
.betting-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 8px;
    margin-bottom: 25px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.number-cell {
    background: rgba(139, 0, 0, 0.8);
    border: 3px solid #ffd700;
    border-radius: 10px;
    padding: 20px 10px;
    text-align: center;
    font-size: 1.5em;
    font-weight: bold;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.number-cell.zero {
    background: rgba(0, 100, 0, 0.8);
    grid-column: span 2;
}

.number-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.8);
    border-color: #00ffff;
}

.number-cell.selected {
    background: rgba(255, 215, 0, 0.9) !important;
    border-color: #ff00ff;
    box-shadow: 0 0 30px rgba(255, 0, 255, 0.8);
    animation: pulse-selected 1s ease-in-out infinite;
}

@keyframes pulse-selected {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.number-cell.correct-answer {
    background: rgba(0, 255, 0, 0.9) !important;
    border-color: #00ff00;
    animation: flash-correct 1s ease-in-out 3;
}

@keyframes flash-correct {
    0%, 100% { box-shadow: 0 0 30px rgba(0, 255, 0, 0.8); }
    50% { box-shadow: 0 0 60px rgba(0, 255, 0, 1); }
}

/* =====================================================
   ÁREA DE FICHAS
   ===================================================== */

.chips-area {
    text-align: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    border: 2px solid #ffd700;
}

.chips-label {
    color: #ffd700;
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 1.1em;
    text-shadow: 0 0 10px #ffd700;
}

.chip {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, #ff0000 0%, #8b0000 70%);
    border: 5px solid #ffd700;
    border-radius: 50%;
    margin: 0 auto;
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6),
                inset 0 0 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease;
    position: relative;
}

.chip:hover {
    transform: scale(1.1);
}

.chip.dragging {
    opacity: 0.7;
    transform: scale(1.2);
    z-index: 1000;
}

.chip.used {
    opacity: 0.3;
    cursor: not-allowed;
    filter: grayscale(1);
}

.chip-value {
    color: #ffffff;
    font-size: 1.5em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.chip-status {
    margin-top: 10px;
    color: #00ffff;
    font-size: 0.9em;
    min-height: 20px;
}

/* =====================================================
   PANEL DE MENSAJES
   ===================================================== */

.message-panel {
    background: rgba(0, 0, 0, 0.9);
    border: 3px solid #00ffff;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 0 40px rgba(0, 255, 255, 0.6);
    margin-bottom: 20px;
}

.message-panel.hidden {
    display: none;
}

.message-text {
    font-size: 1.5em;
    margin-bottom: 20px;
    line-height: 1.6;
}

.message-text.success {
    color: #00ff00;
    text-shadow: 0 0 15px #00ff00;
}

.message-text.failure {
    color: #ff6666;
    text-shadow: 0 0 15px #ff6666;
}

/* =====================================================
   BOTONES
   ===================================================== */

.next-round-btn,
.start-btn {
    background: linear-gradient(135deg, #ff00ff 0%, #8b008b 100%);
    border: 3px solid #00ffff;
    border-radius: 10px;
    padding: 15px 40px;
    color: #ffffff;
    font-size: 1.3em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.next-round-btn:hover,
.start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(255, 0, 255, 1);
    background: linear-gradient(135deg, #ff33ff 0%, #a000a0 100%);
}

.next-round-btn.hidden {
    display: none;
}

/* =====================================================
   PANEL DE INICIO
   ===================================================== */

.start-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.start-panel.hidden {
    display: none;
}

.game-title {
    font-size: 3em;
    color: #ffd700;
    text-shadow: 0 0 20px #ffd700,
                 0 0 40px #ffd700;
    margin-bottom: 30px;
    animation: title-glow 2s ease-in-out infinite;
}

@keyframes title-glow {
    0%, 100% { text-shadow: 0 0 20px #ffd700, 0 0 40px #ffd700; }
    50% { text-shadow: 0 0 30px #ffd700, 0 0 60px #ffd700, 0 0 80px #ffd700; }
}

.game-instructions {
    font-size: 1.2em;
    color: #ffffff;
    text-align: center;
    max-width: 600px;
    margin-bottom: 40px;
    line-height: 1.8;
}

/* =====================================================
   RESPONSIVE - MÓVIL
   ===================================================== */

@media (max-width: 1024px) {
    .roulette-betting-container {
        flex-direction: column; /* En tablets y móviles, vuelve a vertical */
        align-items: center;
        gap: 20px;
    }
    
    .roulette-container,
    .betting-table {
        flex: 1 1 auto;
        width: 100%;
        max-width: 800px;
    }
}

@media (max-width: 768px) {
    .game-container {
        padding: 10px;
    }
    
    .roulette-betting-container {
        gap: 15px;
    }
    
    .top-panel {
        flex-direction: column;
        gap: 10px;
    }
    
    .problem-header {
        flex-direction: column;
    }
    
    .problem-text {
        font-size: 1.1em;
    }
    
    .roulette-3d {
        height: 300px;
    }
    
    .betting-table {
        padding: 15px;
    }
    
    .betting-grid {
        grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
        gap: 5px;
    }
    
    .number-cell {
        padding: 15px 5px;
        font-size: 1.2em;
    }
    
    .chip {
        width: 60px;
        height: 60px;
    }
    
    .chip-value {
        font-size: 1.2em;
    }
    
    .game-title {
        font-size: 2em;
    }
    
    .game-instructions {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .roulette-3d {
        height: 250px;
    }
    
    .betting-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 3px;
    }
    
    .number-cell {
        padding: 10px 3px;
        font-size: 1em;
    }
    
    .neon-text {
        font-size: 1em;
    }
    
    .credits-value,
    .round-value {
        font-size: 1.4em;
    }
}

/* =====================================================
   ORIENTACIÓN HORIZONTAL (MÓVIL)
   ===================================================== */

@media (max-height: 500px) and (orientation: landscape) {
    .roulette-betting-container {
        flex-direction: row !important; /* En horizontal, mantener lado a lado */
        align-items: flex-start;
        gap: 20px;
    }
    
    .roulette-container {
        flex: 1;
        max-width: 50%;
    }
    
    .betting-table {
        flex: 1;
        max-width: 50%;
    }
    
    .roulette-3d {
        height: 250px;
    }
    
    .problem-panel {
        padding: 15px;
    }
}