body {
    margin: 0;
    padding: 0;
    background-color: #222;
    font-family: 'Arial', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    color: white;
}

.game-title {
    width: 100%;             /* Memastikan judul mengambil lebar penuh */
    text-align: center;      /* Memaksa teks ke tengah */
    font-size: 2rem;         /* Ukuran sedikit diperkecil agar pas di HP */
    color: #3498db;
    text-shadow: 2px 2px 0px #fff;
    margin-top: 10px;
    margin-bottom: 20px;
    display: block;          /* Memastikan dia bertindak sebagai blok */
}

#game-container {
    position: relative;
    width: 95vmin; 
    height: 95vmin; /* Samakan agar kotak sempurna 1:1 */
    max-width: 800px; 
    max-height: 800px;
    margin: auto; /* Memastikan di tengah layar */
    background: #000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    touch-action: none;
    border: 2px solid #444; /* Opsional: garis tepi agar jelas batasnya */
}

#gameCanvas {
    display: block;
    width: 100%;  /* Ukuran tampilan di layar */
    height: 100%; /* background-color: #000; */
   
}

#ui-menu {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 150, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}
#ui-menu {
    position: absolute;
    width: 100%;
    height: 100%; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7); /* Agar teks lebih jelas */
	overflow: hidden; /* Penting agar zoom tidak keluar batas */
}

/* Lapisan khusus Background */
#ui-menu::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    
    /* Pasang gambar di sini */
    background-image: linear-gradient(rgba(0, 0, 100, 0.6), rgba(0, 0, 100, 0.6)), 
                      url('assets/doraemon_bg.png');
    background-size: cover;
    background-position: center;
    
    /* Pasang animasi di sini */
    animation: slowZoom 15s infinite alternate ease-in-out;
    z-index: -1; /* Letakkan di belakang tulisan */
}

canvas {
    display: block;
}

#game-stats {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.5);
    padding: 10px;
    border-radius: 5px;
    pointer-events: none;
}

#current-question {
    font-size: 24px;
    font-weight: bold;
    color: #ffff00;
    margin-top: 10px;
}


/* Container Utama Form */
.level-select {
    display: flex;
    gap: 10px; /* Jarak antar kolom */
    width: 90%;
    max-width: 300px; /* Memampatkan lebar form */
    margin: 5px auto;
}

.setting-item {
    flex: 1; /* Membuat dua kolom sama lebar */
    text-align: left;
}

/* Memperkecil Input dan Select */
input#player-name, 
.setting-item select {
    width: 100%;
    padding: 8px; /* Lebih tipis */
    font-size: 14px;
    border-radius: 5px;
    border: 1px solid #ccc;
    box-sizing: border-box; /* Agar padding tidak merusak lebar */
}

input#player-name {
    max-width: 300px;
    margin-bottom: 5px;
}

label {
    font-size: 12px;
    display: block;
    margin-bottom: 3px;
    color: #eee;
}

/* Overlay untuk Leaderboard */
#leaderboard-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9); /* Sedikit lebih gelap agar fokus */
    display: none; /* Default sembunyi */
    justify-content: center;
    align-items: center;
    z-index: 100; /* HARUS yang paling tinggi */
}

#leaderboard-content {
    background: white;
    color: #333;
    padding: 20px;
    border-radius: 15px;
    width: 85%;
    max-width: 400px; /* Agar proporsional di PC/HP */
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

/* Pastikan tombol tutup terlihat jelas */
#close-lb-btn {
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

#leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

#leaderboard-table th, #leaderboard-table td {
    border-bottom: 1px solid #ddd;
    padding: 10px;
	text-align: center;
}

#start-btn {
    background: #2ecc71;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

@keyframes slowZoom {
    0% { transform: scale(1); }
    100% { transform: scale(1.15); }
}

.character-selection {
    margin-top: 5px;    /* Ubah dari 15px menjadi 5px agar naik ke atas */
    margin-bottom: 10px;
    text-align: center;
}

.character-selection p {
    margin-top: 0;      /* Menghilangkan jarak atas tulisan */
    margin-bottom: 5px; /* Mempersempit jarak antara tulisan dan gambar ikon */
    font-size: 14px;    /* Opsional: memperkecil sedikit ukuran teks agar ringkas */
}

.char-options {
    display: flex;
    gap: 5px;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px;
    border-radius: 5px;
}

.char-icon {
    width: 40px;
    height: 40px;
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 50%;
    transition: transform 0.2s, border-color 0.2s;
    background: white; /* Opsional: agar ikon lebih terlihat jika BG gelap */
}

.char-icon:hover {
    transform: scale(1.1);
}

.char-icon.active {
    border-color: #ffca28; /* Warna kuning emas untuk karakter yang dipilih */
    box-shadow: 0 0 10px #ffca28;
}

@media screen and (max-width: 480px) {
    .game-title {
        font-size: 1.5rem;
    }
}

/* Styling Umum untuk Semua Tombol Menu */
#ui-menu button, 
#ui-selection button {
    width: 90%;             /* Lebar hampir memenuhi container */
    max-width: 300px;       /* Tapi dibatasi agar tidak terlalu panjang di PC */
    padding: 8px 10px;     /* Diperbesar: atas-bawah 15px, kiri-kanan 20px */
    font-size: 14px;        /* Ukuran teks diperbesar */
    font-weight: bold;
    border: none;
    border-radius: 10px;    /* Sudut lebih tumpul agar modern */
    cursor: pointer;
    margin: 7px 0;         /* MEMBERI JARAK antar tombol (atas & bawah) */
    transition: transform 0.2s, background 0.2s;
    display: block;
}

/* Tombol Utama (Mulai) */
#start-btn {
    background-color: #2ecc71; /* Hijau segar */
    color: white;
    box-shadow: 0 4px 0 #27ae60; /* Efek 3D tombol */
}

#start-btn:active, #go-to-selection:active {
    transform: translateY(3px); /* Efek tertekan */
    box-shadow: 0 1px 0 #27ae60;
}

/* Tombol Sekunder (Leaderboard / Kembali) */
.secondary-btn, #show-lb-btn {
    background-color: #3498db; /* Biru */
    color: white;
    box-shadow: 0 4px 0 #2980b9;
}

.secondary-btn:active, #show-lb-btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #2980b9;
}

#ui-gameover {
    background: rgba(0, 0, 0, 0.9);
    text-align: center;
}

.result-box {
    background: white;
    color: #333;
    padding: 10px 15px;
    border-radius: 15px;
    width: 75%;
    max-width: 280px;
    margin-bottom: 10px;
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.4);
}

#res-score {
    font-size: 2rem;
    margin: 5px 0;
    color: #2ecc71;
}

#res-category {
    background: #f1c40f;
	font-size: 0.9rem;
    display: inline-block;
    padding: 3px 12px;
    border-radius: 50px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

#res-message {
    font-size: 13px;        /* Perkecil ukuran pesan motivasi */
    margin: 5px 0;
}

/* Gabungkan pengaturan untuk semua layar menu */
#ui-menu, #ui-gameover, #ui-selection {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 30; /* Pastikan lebih tinggi dari canvas dan stats */
    box-sizing: border-box;
}

/* Khusus Game Over agar latar belakangnya gelap transparan */
#ui-gameover {
    background: rgba(0, 0, 0, 0.85);
    color: white;
}

/* Pastikan tombol di dalam gameover juga rapi */
#ui-gameover button {
    width: 75%;
    max-width: 250px;
    padding: 10px;
    font-size: 14px;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    margin: 5px 0;
    cursor: pointer;
}

#over-title {
    font-size: 1.5rem;      /* Perkecil tulisan "GAME OVER" */
    margin-bottom: 10px;
}

#restart-btn {
    background-color: #2ecc71;
    color: white;
    box-shadow: 0 4px 0 #27ae60;
}

#back-to-home {
    background-color: #3498db;
    color: white;
    box-shadow: 0 4px 0 #2980b9;
}