:root {
    --bg: #f8fafc; --card: #ffffff; --text: #1e293b; --primary: #10b981;
    --border: #cbd5e1; --cell: #ffffff;
}
.dark-mode {
    --bg: #0f172a; --card: #1e293b; --text: #f1f5f9; --border: #475569; --cell: #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: 600px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; padding: 15px; }

/* Header */
.game-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.btn-icon { background: var(--card); border: 1px solid var(--border); padding: 10px; border-radius: 12px; cursor: pointer; color: var(--text); }

/* Progress */
.progress-section { margin-bottom: 20px; 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; }

/* Grid TTS (Responsive) */
.grid-scroll { width: 100%; overflow-x: auto; padding: 10px 0; display: flex; justify-content: center; }
.tts-grid { 
    display: grid; 
    grid-template-columns: repeat(10, 35px); 
    grid-template-rows: repeat(10, 35px); 
    gap: 2px; background: var(--border); border: 2px solid var(--border);
}
@media (max-width: 400px) {
    .tts-grid { grid-template-columns: repeat(10, 8.5vmin); grid-template-rows: repeat(10, 8.5vmin); }
}

.cell { width: 100%; height: 100%; background: var(--cell); position: relative; }
.cell.black { background: #000; }
.cell input { 
    width: 100%; height: 100%; border: none; text-align: center; font-weight: bold; 
    text-transform: uppercase; background: transparent; color: var(--text); font-size: 14px;
}
.cell-num { position: absolute; top: 1px; left: 1px; font-size: 8px; color: var(--primary); font-weight: bold; }

/* Clues */
.clues-container { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 20px; }
.clue-box { background: var(--card); padding: 12px; border-radius: 12px; border: 1px solid var(--border); }
.clue-box h3 { font-size: 0.9rem; margin-bottom: 8px; color: var(--primary); }
.clue-box ul { list-style: none; font-size: 0.8rem; }

/* Overlay Menu */
.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;
}
.overlay.active { display: flex; }
.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 .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 */
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    padding: 5px;
}

/* Tombol Angka (Default/Locked) */
.btn-lvl {
    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 .btn-lvl {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.2);
}

.btn-lvl.active {
    background: linear-gradient(135deg, #10b981, #059669); /* Gradasi Biru-Ungu */
    color: white;
    box-shadow: 0 4px 10px #0596686a;
}

.btn-lvl.done { background: var(--primary); color: white; border: none; }

.btn-check { width: 100%; background: var(--primary); color: white; border: none; padding: 15px; border-radius: 12px; font-weight: bold; margin-top: 20px; cursor: pointer; }

.header-left {
    display: flex;
    gap: 8px; /* Memberi jarak antara tombol kembali dan tombol menu level */
    align-items: center;
}

.game-header h2 {
    font-size: 1.1rem;
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 10px;
}

/* Modal Overlay */
.modal-overlay {
    display: none; /* Sembunyi secara default */
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

/* Kartu Modal */
.modal-card {
    background: var(--card);
    width: 100%;
    max-width: 340px;
    padding: 30px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    animation: slideUp 0.4s forwards;
}

.modal-icon {
    width: 70px;
    height: 70px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.modal-card h2 { margin-bottom: 10px; color: var(--text); }
.modal-card p { color: #64748b; margin-bottom: 25px; line-height: 1.5; }

/* Tombol Aksi */
.modal-actions { display: flex; flex-direction: column; gap: 12px; }

.btn-continue, .btn-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    border-radius: 14px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: 0.2s;
}
#btn-close-menu {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text);
    cursor: pointer;
    opacity: 0.5;
}

#btn-close-menu:hover {
    opacity: 1;
    color: #ef4444;
}

.btn-continue { background: var(--primary); color: white; }
.btn-continue:hover { background: #059669; }

.btn-menu { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-menu:hover { background: var(--border); }

/* Animasi */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { to { transform: translateY(0); } }