/* Reset & Styling Dasar */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Nunito', 'Segoe UI', Tahoma, sans-serif;
    /* Menghilangkan efek kedip/highlight warna saat elemen ditekan di HP (Android/iOS) */
    -webkit-tap-highlight-color: transparent; 
}

body {
    /* Background disesuaikan dengan nuansa ruangan terang/kaca */
    background: #e8f4f8;
    color: #1e293b;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 15px;
}

/* Container Utama (Efek Glassmorphism & Neon Border) */
.app-container {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px);
    border-radius: 28px;
    border: 2px solid #a5f3fc;
    box-shadow: 0 0 30px rgba(165, 243, 252, 0.4), 
                inset 0 0 15px rgba(255, 255, 255, 0.8);
    padding: 25px;
    width: 100%;
    max-width: 380px;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 20px;
}

.app-header h1 {
    font-size: 20px;
    font-weight: 800;
    color: #1e3a8a;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

.app-header p {
    font-size: 14px;
    color: #64748b;
}

/* Area Soal */
.soal-box {
    background: linear-gradient(135deg, #1e3a8a 0%, #06b6d4 100%);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 8px 20px rgba(6, 182, 212, 0.3);
    position: relative;
    /* Mencegah teks soal terblok tidak sengaja */
    -webkit-user-select: none;
    user-select: none;
}

#label-soal {
    font-size: 12px;
    font-weight: 800;
    color: #fde047;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

#display-soal {
    font-size: 42px;
    font-weight: 900;
    color: #FFFFFF;
    margin-top: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Textbox Input */
.input-group {
    margin-bottom: 20px;
}

#input-jawaban {
    width: 100%;
    text-align: center;
    font-size: 28px;
    font-weight: 800;
    padding: 12px;
    border: 2px solid #bae6fd;
    border-radius: 12px;
    background-color: #ffffff;
    color: #1e293b;
    outline: none;
    letter-spacing: 2px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
}

#input-jawaban:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3), inset 0 2px 5px rgba(0,0,0,0.05);
}

/* Base style untuk semua tombol interaktif */
button {
    /* Cegah teks tombol ter-highlight saat di-tap berkali-kali */
    -webkit-user-select: none;
    user-select: none;
    /* Cegah browser melakukan zoom saat double-tap pada tombol */
    touch-action: manipulation;
}

/* Keypad Angka 0-9 */
.keypad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.btn-angka {
    background: linear-gradient(145deg, #f0f9ff, #e0f2fe);
    color: #334155;
    border: 2px solid #a5f3fc;
    font-size: 20px;
    font-weight: 800;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(165, 243, 252, 0.4);
    transition: all 0.1s ease;
}

/* Tombol Hapus & Reset */
.btn-hapus {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
    font-size: 14px;
}

.btn-reset {
    background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 10px rgba(249, 115, 22, 0.4);
    font-size: 14px;
}

/* Feedback Pesan (Animasi & Pop-up) */
#feedback-pesan {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-weight: 900;
    font-size: 20px;
    min-height: 60px;
    min-width: 250px;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-radius: 16px;
    padding: 15px 30px;
    opacity: 0;
    pointer-events: none; 
}

.text-benar, .text-salah, .text-warning {
    animation: swalPopCenter 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes swalPopCenter {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    60% { transform: translate(-50%, -50%) scale(1.05); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: auto; }
}

.text-benar { 
    color: #059669; 
    background-color: rgba(236, 253, 245, 0.95); 
    border: 3px solid #6ee7b7;
    box-shadow: 0 15px 35px rgba(16, 185, 129, 0.3);
    backdrop-filter: blur(5px);
}

.text-salah { 
    color: #dc2626; 
    background-color: rgba(254, 242, 242, 0.95); 
    border: 3px solid #fca5a5;
    box-shadow: 0 15px 35px rgba(239, 68, 68, 0.3);
    backdrop-filter: blur(5px);
}

.text-warning { 
    color: #d97706; 
    background-color: rgba(255, 251, 235, 0.95); 
    border: 3px solid #fcd34d;
    box-shadow: 0 15px 35px rgba(245, 158, 11, 0.3);
    backdrop-filter: blur(5px);
}

/* Tombol Kontrol */
.action-buttons {
    display: flex;
    gap: 12px;
}

.btn-action {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-weight: 800;
    font-size: 12px;
    cursor: pointer;
    color: white;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

#btn-cek {
    background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%);
    box-shadow: 0 6px 15px rgba(2, 132, 199, 0.5);
}

#btn-next {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.5);
}

/* Efek Tap pada layar sentuh (Active state) */
.btn-angka:active { transform: scale(0.95); }
.btn-action:active:not(:disabled) { transform: scale(0.96); }

.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* Area Hasil Akhir */
.hidden { display: none !important; }

.result-box {
    text-align: center;
    padding: 15px 0;
}

.result-box h2 {
    font-size: 24px;
    color: #0f172a;
    margin-bottom: 8px;
    font-weight: 800;
}

.result-box p {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 25px;
}

.result-stats {
    background-color: #f8fafc;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid #e2e8f0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 12px 18px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    font-size: 15px;
    font-weight: 700;
}

.stat-total { color: #0052D4; }
.stat-benar { color: #00b894; }
.stat-salah { color: #ff7675; }

.btn-main-lagi {
    width: 100%;
    background: linear-gradient(135deg, #0093E9 0%, #80D0C7 100%);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 14px;
    font-weight: 800;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 147, 233, 0.25);
    transition: all 0.2s ease;
}
.btn-main-lagi:active {
    transform: scale(0.98);
}

.footer-action {
    margin-top: 20px;
    text-align: center;
}

.btn-akhiri {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
    /* Tambahan area sentuh agar lebih mudah ditekan */
    padding: 10px 20px; 
}


/* ---------------------------------------------------
   MEDIA QUERY: HANYA Terapkan efek Hover di PC/Desktop
   (Mencegah efek tombol nyangkut di layar sentuh)
------------------------------------------------------ */
@media (hover: hover) and (pointer: fine) {
    .btn-angka:hover {
        background: #e0f2fe;
        border-color: #67e8f9;
    }
    .btn-hapus:hover {
        filter: brightness(1.1);
    }
    .btn-reset:hover {
        filter: brightness(1.1);
    }
    #btn-cek:hover:not(:disabled), #btn-next:hover:not(:disabled) {
        filter: brightness(1.1);
    }
    .btn-main-lagi:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 25px rgba(0, 147, 233, 0.35);
    }
    .btn-akhiri:hover {
        color: #ef4444;
    }
}