:root {
    --bg: #f8fafc; --card: #ffffff; --text: #1e293b; --primary: #10b981;
    --border: #cbd5e1; --accent: #f1f5f9;
}
.dark-mode {
    --bg: #0f172a; --card: #1e293b; --text: #f1f5f9; --border: #475569; --accent: #334155;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); transition: 0.3s; }

.app-container { max-width: 500px; margin: 0 auto; min-height: 100vh; padding: 20px; display: flex; flex-direction: column; }

.game-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.header-left { display: flex; gap: 10px; }
.btn-icon { background: var(--card); border: 1px solid var(--border); padding: 10px; border-radius: 12px; cursor: pointer; color: var(--text); }

.progress-section { margin-bottom: 30px; text-align: center; }
.bar-bg { background: var(--border); height: 8px; border-radius: 10px; overflow: hidden; margin-bottom: 5px; }
.bar-fill { background: var(--primary); height: 100%; width: 0%; transition: 0.5s; }

.question-card { background: var(--card); padding: 20px; border-radius: 20px; border: 1px solid var(--border); text-align: center; margin-bottom: 30px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); }
.question-card p { font-size: 1.1rem; font-weight: 500; line-height: 1.5; }

.letters-container, .answer-container { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; min-height: 50px; margin-bottom: 20px; }

/* Menargetkan huruf di dalam kotak pilihan */
.letters-container div, .letters-container button,
.answer-container div, .answer-container button {
    color: var(--text) !important;
}

.letter-tile { 
    width: 45px; height: 45px; background: var(--card); border: 2px solid var(--border); 
    display: flex; align-items: center; justify-content: center; border-radius: 12px;
    font-weight: bold; cursor: pointer; user-select: none; transition: 0.2s;
}
.letter-tile:active { transform: scale(0.9); }
.letter-tile.used { opacity: 0.3; pointer-events: none; }

.slot { 
    width: 45px; height: 45px; border-bottom: 3px solid var(--primary); 
    display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 1.2rem;
}

.game-controls { display: grid; grid-template-columns: 1fr 2fr; gap: 15px; margin-top: auto; }
.btn-primary { background: var(--primary); color: white; border: none; padding: 15px; border-radius: 15px; font-weight: bold; cursor: pointer; }
.btn-secondary { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 15px; cursor: pointer; }

/* Modal & Overlay (Sama dengan TTS sebelumnya) */
.overlay, .modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 100; align-items: center; justify-content: center; padding: 20px; }
.overlay.active, .modal-overlay[style*="flex"] { display: flex; }
.overlay-content { background: var(--card); width: 100%; max-width: 350px; border-radius: 25px; padding: 25px; }
.level-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 15px; }
.btn-lvl { aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); cursor: pointer; font-size: 0.8rem; }
.btn-lvl.done { background: var(--primary); color: white; border: none; }

.modal-card { background: var(--card); padding: 30px; border-radius: 30px; text-align: center; width: 100%; max-width: 350px; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.btn-continue { background: var(--primary); color: white; padding: 15px; border-radius: 15px; border: none; font-weight: bold; cursor: pointer; width: 100%; }
.btn-menu { background: var(--bg); border: 1px solid var(--border); padding: 15px; border-radius: 15px; cursor: pointer; width: 100%; color: var(--text) }


/* Container Overlay dengan Blur Premium */
.overlay {
    display: none; 
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4); 
    backdrop-filter: blur(10px); /* Efek kaca */
    z-index: 1000;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

/* Kartu Level (Glassmorphism) */
.overlay-content {
    background: rgba(255, 255, 255, 0.85);
    width: 85%;
    max-width: 350px;
    padding: 25px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    text-align: center;
}

/* Dark Mode Adjustment */
.dark-mode .overlay-content {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.overlay-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary); /* Mengikuti warna tema utama */
    margin: 0;
}

.dark-mode .overlay-header h3 {
    color: #059669; /* Biru terang untuk dark mode */
}

/* Grid Tombol Level */
.level-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    padding: 5px;
}

/* Tombol Angka (Default/Locked) */
.lvl-btn {
    aspect-ratio: 1/1;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.dark-mode .lvl-btn {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.2);
}

/* Tombol Level Aktif (Warna Tema Darsa Media) */
.lvl-btn.active {
    background: linear-gradient(135deg, #10b981, #059669); /* Gradasi Biru-Ungu */
    color: white;
    box-shadow: 0 4px 10px #0596686a;
}

/* Highlight Level yang Sedang Dimainkan */
.lvl-btn.current {
    background: linear-gradient(135deg, #10b981, #059669); /* Gradasi Hijau Sukses */
    color: white;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

.lvl-btn:disabled {
    cursor: not-allowed;
}

.lvl-btn.active:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* Tombol Close Level */
#btn-close-levels {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text);
    cursor: pointer;
    opacity: 0.5;
}

#btn-close-levels:hover {
    opacity: 1;
    color: #ef4444;
}