* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overscroll-behavior: none;
    touch-action: manipulation;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #e8e8e8 0%, #f5f5f5 50%, #ffffff 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Modal de información */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: linear-gradient(135deg, #2d1b4e 0%, #4a2c6f 100%);
    padding: 30px;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    color: #fff;
    text-align: center;
    border: 3px solid #ffd700;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

.modal-content h2 {
    color: #ffd700;
    margin-bottom: 20px;
    font-size: 28px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.modal-content p {
    margin-bottom: 15px;
    line-height: 1.6;
    font-size: 16px;
}

#startBtn, #restartBtn {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #2d1b4e;
    border: none;
    padding: 15px 40px;
    font-size: 20px;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

#startBtn:hover, #restartBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

#startBtn:active, #restartBtn:active {
    transform: scale(0.95);
}

/* Contenedor del juego */
#gameContainer {
    text-align: center;
}

#scoreBoard {
    background: rgba(255, 255, 255, 0.95);
    color: #2d1b4e;
    padding: 15px;
    border-radius: 10px 10px 0 0;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    justify-content: space-around;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#gameCanvas {
    display: block;
    background: #ffffff;
    border: 20px solid transparent;
    border-image: url('Piedra Quetzalcoatl-02.png') 30 round;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    margin: 0 auto;
    touch-action: none;
}

#gameOver {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #2d1b4e 0%, #4a2c6f 100%);
    padding: 40px;
    border-radius: 20px;
    border: 3px solid #ffd700;
    color: #fff;
    z-index: 100;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

#gameOver h2 {
    color: #ffd700;
    margin-bottom: 20px;
    font-size: 32px;
}

#gameOver p {
    font-size: 24px;
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}

/* Quiz Modal */
#quizModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.quiz-content {
    background: linear-gradient(135deg, #2d1b4e 0%, #4a2c6f 100%);
    padding: 40px;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    color: #fff;
    text-align: center;
    border: 3px solid #ffd700;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

.quiz-content h2 {
    color: #ffd700;
    margin-bottom: 20px;
    font-size: 28px;
}

.quiz-content p {
    font-size: 20px;
    margin-bottom: 30px;
    line-height: 1.6;
}

#quizOptions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.quiz-option {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #2d1b4e;
    border: none;
    padding: 15px 20px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.quiz-option:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

.quiz-option:active {
    transform: scale(0.95);
}

.quiz-option:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.quiz-option.correct {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    border: 3px solid #16a34a;
}

.quiz-option.incorrect {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: 3px solid #991b1b;
}

.quiz-feedback {
    margin-top: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.feedback-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 15px;
}

.correct-text {
    color: #4ade80;
}

.incorrect-text {
    color: #ef4444;
}

.feedback-explanation {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.feedback-continue {
    font-size: 14px;
    color: #ffd700;
    font-style: italic;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.continue-btn {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #2d1b4e;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 10px;
    transition: transform 0.2s;
}

.continue-btn:hover {
    transform: scale(1.05);
}

.continue-btn:active {
    transform: scale(0.95);
}

.restart-quiz-btn {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: #ffffff;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 10px;
    margin-left: 10px;
    transition: transform 0.2s;
}

.restart-quiz-btn:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
}

.restart-quiz-btn:active {
    transform: scale(0.95);
}

/* Controles virtuales */
#virtualControls {
    margin-top: 20px;
    display: none;
}

.control-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 5px 0;
}

.control-btn {
    width: 70px;
    height: 70px;
    font-size: 30px;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border: 3px solid #2d1b4e;
    border-radius: 15px;
    cursor: pointer;
    color: #2d1b4e;
    font-weight: bold;
    transition: all 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.control-btn:active {
    transform: scale(0.9);
    background: linear-gradient(135deg, #ffed4e 0%, #ffd700 100%);
}

/* Responsive */
@media (max-width: 768px) {
    #virtualControls {
        display: block;
    }
    
    .modal-content {
        padding: 20px;
    }
    
    .modal-content h2 {
        font-size: 22px;
    }
    
    .modal-content p {
        font-size: 14px;
    }
    
    #scoreBoard {
        font-size: 16px;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    #gameCanvas {
        max-width: 100vw;
        max-height: 60vh;
    }
    
    .control-btn {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
}
