body { margin: 0; overflow: hidden; background: #000; touch-action: none; }
canvas { display: block; }
#ui { 
    position: absolute; 
    top: 80px; 
    left: 10px; 
    color: #0f0; 
    font-family: 'Courier New', monospace; 
    font-size: 24px; 
    text-shadow: 0 0 5px #0f0;
    pointer-events: none;
    z-index: 10;
}
#controls-hint {
    position: absolute;
    bottom: 20px;
    width: 100%;
    text-align: center;
    color: rgba(255,255,255,0.5);
    font-family: sans-serif;
    pointer-events: none;
}
#backBtn {
    position: absolute;
    top: 80px;
    right: 10px;
    background: transparent;
    border: 1px solid #0f0;
    color: #0f0;
    padding: 5px 10px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    z-index: 10;
}

.overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}
.hidden { display: none !important; }
.popup {
    background: #111;
    border: 2px solid #0f0;
    padding: 30px;
    color: #0f0;
    font-family: 'Courier New', monospace;
    text-align: center;
    box-shadow: 0 0 20px #0f0;
}
#restartBtn {
    background: transparent;
    border: 1px solid #0f0;
    color: #0f0;
    padding: 10px 20px;
    font-size: 1.2rem;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    margin-top: 10px;
}
#restartBtn:hover {
    background: #0f0;
    color: #000;
}
/* Modal de Instrucciones */
.cup-modal, .draw-modal, .math-modal, .orbit-modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.cup-modal.hidden, .draw-modal.hidden, .math-modal.hidden, .orbit-modal.hidden {
    display: none;
}

.cup-modal-content, .draw-modal-content, .math-modal-content, .orbit-modal-content {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    color: white;
    text-align: center;
    animation: slideIn 0.4s ease;
}

.cup-modal-content h2, .draw-modal-content h1, .math-modal-content h1, .orbit-modal-content h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.game-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 30px;
}

.instructions-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
}

.instructions-section h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #FFD700;
}

.instructions-grid {
    display: grid;
    gap: 15px;
    text-align: left;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.instruction-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.instruction-icon {
    font-size: 1.8rem;
    min-width: 40px;
    text-align: center;
}

.start-btn {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #1e3c72;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.4);
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.6);
}

.start-btn:active {
    transform: translateY(-1px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .cup-modal-content, .draw-modal-content, .math-modal-content, .orbit-modal-content {
        padding: 30px 20px;
        max-width: 90%;
    }

    .cup-modal-content h2, .draw-modal-content h1, .math-modal-content h1, .orbit-modal-content h1 {
        font-size: 2rem;
    }

    .instruction-icon {
        font-size: 1.5rem;
        min-width: 35px;
    }

    .instruction-item {
        font-size: 0.9rem;
    }
}
