body {
    font-family: 'Arial', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-color: #f4f4f9; 
    color: #333;
    overflow: hidden;
}

.game-container {
    background-color: #fff;
    padding: 30px 40px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 90%;
    max-width: 500px;
    position: relative;
}

h1 {
    color: #4a4a86;
    margin-bottom: 15px;
}

/* --- Status & HP Bar --- */
.header-status {
    margin-bottom: 10px;
    font-size: 1.2em;
    color: #ff4500;
    font-weight: bold;
}

.stats-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 0.9em;
}

progress {
    width: 150px;
    height: 15px;
    accent-color: #3cb371;
}

.enemy-hp progress {
    accent-color: #ff6347;
}

/* --- Area Soal & Input --- */
#question-area {
    font-family: 'Times New Roman', serif;
    font-size: 3em;
    font-weight: bold;
    margin: 25px 0;
    color: #007bff;
}

#answer-input {
    padding: 12px;
    font-size: 1.5em;
    width: 80%;
    margin-bottom: 20px;
    border: 2px solid #ccc;
    background-color: #fff;
    color: #333;
    border-radius: 8px;
    text-align: center;
}

/* --- Tombol Aksi --- */
#submit-btn, #start-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1.2em;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 80%;
    margin-top: 10px;
}

#submit-btn:hover, #start-btn:hover {
    background-color: #0056b3;
}

/* --- Tombol Menu Utama --- */
#main-menu-btn {
    background-color: #4a4a86;
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1.2em;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 80%;
    
    display: block; 
    text-decoration: none; 
    text-align: center;
    margin: 15px auto 0 auto;
}

#main-menu-btn:hover {
    background-color: #5c5c9c;
}

/* --- Area Pertarungan (Scene) --- */
.scene {
    height: 120px; 
    width: 100%;
    position: relative;
    margin-bottom: 20px;
    background: linear-gradient(to bottom, #7b68ee, #4169e1);
    border-radius: 8px;
    overflow: hidden;
}

/* =================================================================== */
/* 🧙‍♂️ GAYA PENYIHIR 🧙‍♀️ */
/* =================================================================== */

#player-wizard, #enemy-wizard {
    position: absolute;
    bottom: 0;
    width: 90px;
    height: 120px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: bottom center;
    
    transition: transform 0.3s ease-out, filter 0.2s;
    z-index: 1;
    animation: idle-float 2s ease-in-out infinite alternate;
}

@keyframes idle-float {
    0% { transform: translateY(0); }
    100% { transform: translateY(-5px); }
}

#player-wizard {
    left: 40px; 
    transform-origin: bottom center;
    background-image: url('assets/wizard-player.png'); 
}

#enemy-wizard {
    right: 40px; 
    transform-origin: bottom center;
    background-image: url('assets/wizard-enemy.png'); 
}


/* =================================================================== */
/* 🔥 GAYA BOLA API 🔥 */
/* =================================================================== */

#fireball {
    position: absolute;
    bottom: 55px; /* Disesuaikan lebih tinggi */
    left: 80px; 
    width: 40px; /* ⬅️ UKURAN KECIL */
    height: 40px; /* ⬅️ UKURAN KECIL */
    
    background-image: url('assets/fireball.png'); 
    background-size: contain; 
    background-repeat: no-repeat;
    background-position: center; 

    z-index: 2; 
    opacity: 0; 
    transition: opacity 0.2s ease-out; 
    transform: translateX(0);
}

/* Keyframes untuk Serangan PEMAIN (Kiri ke Kanan) */
@keyframes fireball-player-stage1 {
    0% { transform: translateX(0) scale(0.8); opacity: 0; }
    50% { transform: translateX(75px) scale(1.2); opacity: 1; } 
    100% { transform: translateX(150px) scale(1.2); opacity: 1; }
}

@keyframes fireball-player-stage2 {
    0% { transform: translateX(150px) scale(1.2); opacity: 1; }
    100% { transform: translateX(300px) scale(0.8); opacity: 0; } 
}

/* Keyframes untuk Serangan MUSUH (Kanan ke Kiri) */
@keyframes fireball-enemy-stage1 {
    0% { transform: translateX(300px) scale(0.8); opacity: 0; }
    50% { transform: translateX(225px) scale(1.2); opacity: 1; } 
    100% { transform: translateX(150px) scale(1.2); opacity: 1; }
}

@keyframes fireball-enemy-stage2 {
    0% { transform: translateX(150px) scale(1.2); opacity: 1; }
    100% { transform: translateX(0px) scale(0.8); opacity: 0; } 
}

/* Kelas kontrol JS untuk animasi Keyframes Player */
.fireball-player-start {
    animation: fireball-player-stage1 0.4s ease-out forwards;
    opacity: 1 !important; 
}

.fireball-player-finish {
    animation: fireball-player-stage2 0.4s ease-in forwards;
}

/* Kelas kontrol JS untuk animasi Keyframes Enemy */
.fireball-enemy-start {
    animation: fireball-enemy-stage1 0.4s ease-out forwards;
    opacity: 1 !important; 
}

.fireball-enemy-finish {
    animation: fireball-enemy-stage2 0.4s ease-in forwards;
}

/* Guncangan saat terkena serangan */
.shake {
    animation: shake 0.5s ease-in-out;
    filter: brightness(1.5);
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-10px); }
    100% { transform: translateX(0); }
}

/* Efek Serangan (Attack) - Animasi wizard maju/mundur sedikit saat menyerang */
.attack {
    animation: attack-move 0.3s ease-in-out;
    filter: brightness(1.2) drop-shadow(0 0 5px yellow);
}

@keyframes attack-move {
    0% { transform: translate(0, 0); }
    50% { transform: translate(10px, -10px) scale(1.1); } 
    100% { transform: translate(0, 0); }
}


/* --- Area Pesan --- */
#message {
    font-size: 1.1em;
    margin: 15px 0;
    padding: 10px;
    border-radius: 5px;
    visibility: hidden;
}

.correct {
    background-color: #d4edda;
    color: #155724;
    visibility: visible !important;
}

.incorrect {
    background-color: #f8d7da;
    color: #721c24;
    visibility: visible !important;
}

.hidden {
    display: none !important;
}