/* RESET & BASE */
* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; -webkit-tap-highlight-color: transparent; }

body {
    background: #050505;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    font-family: 'Segoe UI', Arial, sans-serif;
}

/* FRAME HP */
#game-frame {
    width: 100%;
    height: 100%;
    max-width: 480px; /* Lebar HP Maksimal */
    position: relative;
    background: #1a1a1a;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    overflow: hidden;
}

/* BACKGROUND (Fallback CSS jika gambar gagal) */
#game-frame::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: url('../assets/images/background.jpeg') no-repeat center center/cover;
    opacity: 0.6; /* Gelapkan agar target terlihat jelas */
    z-index: 0;
}

canvas {
    position: relative;
    z-index: 1; /* Layer paling bawah (setelah background) */
    width: 100%;
    height: 100%;
    display: block;
}

/* UI LAYER */
#ui-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10;
    pointer-events: none; /* KRUSIAL: Agar UI container tidak memblokir sentuhan */
}

/* SCREENS (Menu, HUD, Game Over) */
.screen {
    width: 100%; height: 100%;
    position: absolute;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    
    /* PERBAIKAN UTAMA DI SINI */
    pointer-events: none; /* Defaultnya tembus pandang */
}

/* Hanya elemen interaktif yang bisa disentuh */
.screen button, .screen .btn-group {
    pointer-events: auto; /* Tombol harus bisa diklik */
}

.hidden { display: none !important; }
.active { display: flex !important; }

/* TYPOGRAPHY */
h1 { color: white; font-size: 3.5rem; text-align: center; text-shadow: 0 0 20px #ff0055; line-height: 0.9; margin-bottom: 10px; }
h1 span { color: #ff0055; font-size: 4.5rem; }
.subtitle { color: #ddd; margin-bottom: 40px; letter-spacing: 3px; font-size: 1rem; opacity: 0.8; }

/* BUTTONS */
button {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.5);
    color: white;
    padding: 15px 40px;
    margin: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 50px;
    backdrop-filter: blur(10px);
    transition: transform 0.1s, background 0.3s;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
button:active { background: #ff0055; border-color: #ff0055; transform: scale(0.95); }

/* HUD SPECIFIC */
#game-hud {
    justify-content: flex-start; /* HUD di atas */
    padding-top: 30px;
}

.hud-top { 
    width: 85%; 
    background: rgba(0,0,0,0.5); 
    padding: 15px; 
    border-radius: 20px; 
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.1);
}

.score { color: white; font-size: 1.8rem; font-weight: 800; text-align: center; margin-bottom: 10px; letter-spacing: 2px; }
.timer-bar { width: 100%; height: 12px; background: rgba(255,255,255,0.2); border-radius: 6px; overflow: hidden; }
#timer-fill { width: 100%; height: 100%; background: #00ff88; transition: width 0.1s linear, background 0.3s; }

/* GAME OVER SCORE */
#final-score { color: #00ff88; font-size: 3rem; font-weight: bold; display: block; margin: 20px 0; }

/* ... (CSS SEBELUMNYA TETAP SAMA, TAMBAHKAN INI DI BAWAH) ... */

/* BUTTON LEVEL STYLING */
.diff-select { margin-bottom: 15px; text-align: center; }
.label { color: #aaa; font-size: 0.9rem; margin-bottom: 5px; letter-spacing: 2px; }

.btn-group { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.btn-lvl { padding: 10px 20px; font-size: 1rem; border-radius: 20px; min-width: 90px; }

/* WARNA LEVEL */
.easy { border-color: #00ff88; color: #00ff88; }
.easy:active { background: #00ff88; color: black; }

.hard { border-color: #ffaa00; color: #ffaa00; }
.hard:active { background: #ffaa00; color: black; }

.adv { border-color: #ff0055; color: #ff0055; }
.adv:active { background: #ff0055; color: white; }

.btn-info { margin-top: 20px; font-size: 0.9rem; padding: 10px 20px; border: none; background: transparent; text-decoration: underline; opacity: 0.7; }

/* --- MODAL STYLE (PROFESSIONAL LOOK) --- */
.modal {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9); /* Lebih gelap biar fokus */
    z-index: 100;
    display: flex; justify-content: center; align-items: center;
    pointer-events: auto;
    backdrop-filter: blur(8px); /* Blur lebih kuat */
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: #1a1a1a; 
    width: 90%; 
    max-width: 500px; /* Batasi lebar di layar besar */
    max-height: 80%; /* Agar tidak mentok atas bawah */
    border-radius: 15px; 
    border: 1px solid #333;
    display: flex; flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
    color: #e0e0e0;
}

/* HEADER YANG LEBIH TEGAS */
.modal-header {
    padding: 20px; 
    background: linear-gradient(to bottom, #252525, #1a1a1a);
    border-bottom: 1px solid #333;
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h2 { margin: 0; font-size: 1.5rem; color: #fff; letter-spacing: 1px; }

.close { 
    font-size: 2rem; cursor: pointer; color: #ff0055; transition: 0.2s; line-height: 0.8;
}
.close:hover { color: #fff; transform: scale(1.1); }

/* BODY DENGAN SCROLLING YANG NYAMAN */
.modal-body { 
    padding: 0; /* Padding dipindah ke tab content */
    overflow-y: auto; /* SCROLLING AKTIF DISINI */
    background: #111;
    flex: 1; /* Isi sisa ruang */
}

/* CUSTOM SCROLLBAR (Wajib untuk kesan Pro) */
.modal-body::-webkit-scrollbar { width: 8px; }
.modal-body::-webkit-scrollbar-track { background: #111; }
.modal-body::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
.modal-body::-webkit-scrollbar-thumb:hover { background: #555; }

/* TABS NAVIGATION */
.tabs { 
    display: flex; 
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    position: sticky; top: 0; /* Tab tetap di atas saat scroll */
    z-index: 5;
}

.tab-link {
    flex: 1; 
    background: transparent; border: none; 
    padding: 15px 0;
    color: #666; 
    font-weight: bold; font-size: 0.9rem; text-transform: uppercase;
    cursor: pointer; 
    border-bottom: 3px solid transparent;
    transition: 0.3s;
}

.tab-link:hover { color: #fff; background: rgba(255,255,255,0.05); }

.tab-link.active { 
    color: #00ff88; 
    border-bottom: 3px solid #00ff88; 
    background: linear-gradient(to top, rgba(0,255,136,0.1), transparent);
}

/* CONTENT TYPOGRAPHY (Agar enak dibaca) */
.tab-content { 
    display: none; 
    padding: 25px; /* Jarak teks ke pinggir */
    font-size: 0.95rem; 
    line-height: 1.8; /* SPASI ANTAR BARIS (PENTING) */
    color: #ccc;
    text-align: left;
    animation: slideUp 0.3s ease;
}

.tab-content.active { display: block; }

.tab-content h3 { 
    color: #fff; 
    margin-top: 0; margin-bottom: 15px; 
    font-size: 1.2rem; 
    border-bottom: 1px solid #333; padding-bottom: 10px;
}

.tab-content p { margin-bottom: 15px; } /* Jarak antar paragraf */

.tab-content ul { 
    margin-bottom: 15px; padding-left: 20px; 
    background: rgba(255,255,255,0.03); 
    padding: 15px 15px 15px 35px; border-radius: 8px;
}
.tab-content li { margin-bottom: 8px; }

/* ANIMASI HALUS */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }