/* --- Root Variables & Dasar --- */
:root {
    --primary-red: #b71c1c;
    --dark-bg: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --progress-bg: #444;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 15px;
    border: 1px solid #333;
    max-width: 550px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* --- Area Ruang Naga --- */
.sprite-container { 
    width: 400px;
    height: 300px;   
    margin: 20px auto; 
    overflow: hidden; 
    border: 3px solid var(--primary-red); 
    border-radius: 12px; 
    background: url('images/ruang_naga.jpg') no-repeat center;
    background-size: cover;
    position: relative; 
}

/* Base Sprite Sheet */
.sprite-sheet {
    display: block;
    position: absolute;
    bottom: 30px;   
    left: 50%;      
    transform: translateX(-50%);
    background-repeat: no-repeat;
}

/* --- KONFIGURASI SPESIFIK NAGA --- */
/* --- 1. ULAT NAGA (4x4) --- */
.pet-ulat {
    width: 100px; height: 68px; 
    background-image: url('images/ulat_naga_senang.png');
    background-size: 400px 272px; /* Lebar: 100*4, Tinggi: 68*4 */
    animation: playX-4 0.8s steps(4) infinite, playY-4 3.2s steps(4) infinite;
}
/* ulat_naga_makan.png (1152x724) -> Rasio 1.59 */
.pet-ulat.eating-mode {
    background-image: url('images/ulat_naga_makan.png') !important;
    width: 100px; height: 63px; 
    background-size: 400px 252px; 
}

/* --- 2. BAYI NAGA (4x4) --- */
.pet-bayi {
    width: 150px; height: 155px; 
    background-image: url('images/anak_naga_senang.png');
    background-size: 600px 620px; /* Lebar: 150*4, Tinggi: 155*4 */
    animation: playX-4 0.8s steps(4) infinite, playY-4 3.2s steps(4) infinite;
}
/* anak_naga_makan.png (1888x1280) -> Rasio 1.47 */
.pet-bayi.eating-mode {
    background-image: url('images/anak_naga_makan.png') !important;
    /* Lebar: 150px * 1.5 = 225px */
    width: 225px; 
    /* Tinggi: 102px * 1.5 = 153px */
    height: 153px;  
    /* Background-size: 600px * 1.5 = 900px (Lebar), 408px * 1.5 = 612px (Tinggi) */
    background-size: 900px 612px; 
}

/* --- 3. NAGA REMAJA (4x4) --- */
/* --- 3. NAGA REMAJA (4x4, Sekarang 400px) --- */
.pet-remaja {
    width: 400px; 
    height: 218px; /* Proporsi 2x lipat dari sebelumnya */
    background-image: url('images/naga_remaja_senang.png');
    /* background-size harus 4x lipat dari width/height tampilan */
    background-size: 1600px 872px; 
    animation: playX-4 0.8s steps(4) infinite, playY-4 3.2s steps(4) infinite;
}

/* Naga Remaja Makan (2x lipat) */
.pet-remaja.eating-mode {
    background-image: url('images/naga_remaja_makan.png') !important;
    width: 400px; 
    height: 257px; /* Proporsi 2x lipat dari 128.5px */
    background-size: 1600px 1028px; 
}

/* --- 4. NAGA KHATULISTIWA (6x6, Sekarang 500px) --- */
.pet-khatulistiwa {
    width: 500px; 
    height: 296px; /* Proporsi 2x dari 148px */
    background-image: url('images/naga_khatulistiwa_senang.png');
    /* background-size harus 6x lipat dari lebar tampilan (500 * 6) */
    background-size: 3000px 1776px; 
    animation: playX-6 1.2s steps(6) infinite, playY-6 7.2s steps(6) infinite;
}

/* --- 5. NAGA HITAM (6x6, Sekarang 500px) --- */
.pet-hitam {
    width: 500px; 
    height: 342px; /* Proporsi 2x dari 171px */
    background-image: url('images/naga_hitam_senang.png');
    background-size: 3000px 2052px; 
    animation: playX-6 1.2s steps(6) infinite, playY-6 7.2s steps(6) infinite;
}

/* --- 6. NAGA GARUDA (6x6, Sekarang 500px) --- */
.pet-garuda {
    width: 500px; 
    height: 322px; /* Proporsi 2x dari 161px */
    background-image: url('images/naga_garuda_senang.png');
    background-size: 3000px 1932px; 
    animation: playX-6 1.2s steps(6) infinite, playY-6 7.2s steps(6) infinite;
}

/* --- KEYFRAMES ANIMASI --- */

/* Untuk Grid 4x4 */
@keyframes playX-4 {
    from { background-position-x: 0%; }
    to { background-position-x: 133.33%; } /* Rumus: (Kolom / (Kolom-1)) * 100 */
}
@keyframes playY-4 {
    from { background-position-y: 0%; }
    to { background-position-y: 133.33%; }
}

/* Untuk Grid 6x6 */
@keyframes playX-6 {
    from { background-position-x: 0%; }
    to { background-position-x: 120%; } /* Rumus: (6 / 5) * 100 */
}
@keyframes playY-6 {
    from { background-position-y: 0%; }
    to { background-position-y: 120%; }
}

/* --- UI Komponen (Progress, Food Grid, Quiz) --- */
.status-box { 
    background: #252525; padding: 15px; border-radius: 10px; 
    margin: 15px 0; text-align: left; border-left: 4px solid var(--primary-red); 
}

.progress-bar { 
    width: 100%; background: var(--progress-bg); height: 15px; 
    border-radius: 8px; overflow: hidden; margin-top: 8px; border: 1px solid #555;
}

.progress-fill { 
    height: 100%; background: linear-gradient(90deg, #f57c00, #ff5252); 
    transition: width 0.5s ease-in-out; 
}

.food-grid { 
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 15px; 
}

.food-item {
    background: #2a2a2a; border: 1px solid #444; padding: 15px;
    border-radius: 12px; display: flex; flex-direction: column; align-items: center;
}

.btn-feed-active {
    background: #2e7d32; color: white; border: none; padding: 8px;
    width: 100%; border-radius: 6px; font-weight: bold; cursor: pointer;
}

/* --- Quiz Overlay --- */
/* --- UI Kuis Profesional --- */
#quiz-overlay {
    display: none; 
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9); 
    backdrop-filter: blur(15px); /* Efek blur yang lebih kuat */
    z-index: 1000; 
    align-items: center; 
    justify-content: center;
}

.quiz-card { 
    background: #ffffff; 
    color: #1a202c; 
    padding: 40px; 
    border-radius: 30px; 
    width: 95%; 
    max-width: 480px; 
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
}

#quiz-progress {
    font-size: 0.85rem;
    font-weight: 800;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 20px;
    display: block;
}

/* Area Pola Clue */
#clues-area {
    background: #f7fafc; 
    padding: 20px; 
    border-radius: 20px; 
    margin-bottom: 25px; 
    border: 2px solid #edf2f7;
}

.clue-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 10px 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: #2d3748;
}

.clue-row span {
    background: #ebf8ff;
    padding: 5px 12px;
    border-radius: 8px;
    color: #3182ce;
}

/* Area Pertanyaan Utama */
.question-display {
    background: #2d3748;
    color: white;
    padding: 25px;
    border-radius: 24px;
    margin: 25px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.emoji-q { font-size: 2.5rem; }
.arrow-q { font-size: 1.5rem; color: #a0aec0; }
#q-answer { 
    font-size: 2.2rem; 
    font-weight: 800; 
    color: #63b3ed;
    min-width: 60px;
    border-bottom: 4px dashed #4a5568;
}

/* Grid Tombol Jawaban */
.options-grid {
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 16px; 
}

.btn-option { 
    background: #fff;
    border: 2px solid #e2e8f0;
    padding: 18px 10px; 
    border-radius: 18px; 
    cursor: pointer; 
    font-weight: 700; 
    font-size: 1.1rem;
    color: #4a5568;
    transition: all 0.2s ease;
}

.btn-option:hover { 
    border-color: #4299e1;
    background: #ebf8ff;
    color: #2b6cb0;
    transform: translateY(-2px);
}

.btn-option:active {
    transform: scale(0.95);
}

/* Penjelasan & Feedback */
.explanation { 
    display: none; 
    margin-top: 20px; 
    padding: 18px; 
    border-radius: 18px; 
    font-size: 1rem; 
    font-weight: 600;
    animation: slideIn 0.3s ease-out;
}

.explanation.correct { background: #f0fff4; color: #276749; border: 1px solid #68d391; }
.explanation.wrong { background: #fff5f5; color: #9b2c2c; border: 1px solid #feb2b2; }

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Container untuk tombol agar berada di tengah atau bawah card */
.evolution-nav {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px dashed #444;
}

/* Tombol Utama */
.btn-menu-evo {
    display: inline-block;
    background: linear-gradient(135deg, #b71c1c, #d32f2f);
    color: white;
    text-decoration: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 1px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(183, 28, 28, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

/* Efek saat Hover (Kursor di atas tombol) */
.btn-menu-evo:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(183, 28, 28, 0.6);
    background: linear-gradient(135deg, #d32f2f, #f44336);
}

/* Animasi Panah Bergetar */
.btn-menu-evo .arrow {
    display: inline-block;
    margin-left: 10px;
    transition: transform 0.3s ease;
}

.btn-menu-evo:hover .arrow {
    transform: translateX(5px);
}

/* Efek saat tombol ditekan */
.btn-menu-evo:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(183, 28, 28, 0.4);
}

.btn-next {
    display: block;
    width: 100%;
    margin-top: 20px;
    padding: 15px;
    background: #2d3748;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: background 0.2s;
}

.btn-next:hover {
    background: #1a202c;
}