/* ==========================================
   STYLE UTUK GAME MENU UTAMA (INDEX.HTML)
   ========================================== */

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Mengunci scroll layar penuh */
    background: linear-gradient(135deg, #101c26 0%, #050a10 100%); 
    color: #ffffff;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.wrap {
    width: 100%;
    max-width: 700px; /* Lebar optimal untuk form 2 kolom */
    padding: 15px;
    text-align: center;
    box-sizing: border-box;
    animation: fadeIn 0.6s ease-out;
}

.title {
    font-size: 2.4rem;
    font-weight: 900;
    margin: 0 0 5px 0;
    letter-spacing: 2px;
    background: linear-gradient(to bottom, #ffe066 0%, #f5b041 100%); 
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0px 4px 10px rgba(245, 176, 65, 0.2);
}

.subtitle {
    font-size: 1rem;
    color: #a3c2de;
    margin: 0 0 20px 0;
    font-weight: 500;
}

.card {
    background: rgba(22, 38, 51, 0.75); 
    border: 2px solid #b8860b; 
    border-radius: 16px;
    padding: 25px 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

/* ==========================================
   DESAIN FORM REGISTRASI 2 KOLOM (NO SCROLL)
   ========================================== */

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Membagi form menjadi 2 kolom */
    gap: 15px 25px; /* Jarak antar input field */
    text-align: left;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field label {
    font-size: 0.9rem;
    color: #a3c2de;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Merombak total tampilan kotak input dan select */
.form-field input, 
.form-field select {
    width: 100%;
    padding: 11px 14px;
    font-size: 0.95rem;
    color: #ffffff;
    background-color: rgba(11, 23, 34, 0.8) !important; /* Memaksa warna latar belakang gelap */
    border: 1.5px solid #2e4a62;
    border-radius: 8px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

/* Menghilangkan background putih standar bawaan browser pada opsi dropdown */
.form-field select option {
    background-color: #162633;
    color: #ffffff;
}

/* Efek menyala emas saat kolom input sedang aktif diketik */
.form-field input:focus, 
.form-field select:focus {
    outline: none;
    border-color: #ffd700; 
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.25);
    background-color: rgba(16, 32, 48, 0.9) !important;
}

.form-field input::placeholder {
    color: #557591;
    font-size: 0.85rem;
}

/* ==========================================
   DESAIN TOMBOL GAME PREMIUM
   ========================================== */

.btn {
    display: inline-block;
    text-decoration: none;
    font-weight: bold;
    letter-spacing: 1px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-sizing: border-box;
    border: none;
}

/* Tombol Daftar berwarna hijau petualangan alam */
.btn-hijau {
    background: linear-gradient(135deg, #27ae60 0%, #1e7e43 100%);
    color: #ffffff;
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.3);
}

.btn-besar {
    grid-column: span 2; /* Tombol memanjang penuh di bawah */
    padding: 14px;
    font-size: 1.15rem;
    border-radius: 50px; /* Bentuk kapsul modern */
    margin-top: 10px;
    cursor: pointer;
}

.btn-hijau:hover {
    transform: translateY(-3px);
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    box-shadow: 0 8px 20px rgba(46, 204, 113, 0.4);
}

.btn-hijau:active {
    transform: translateY(-1px);
}

/* Tombol emas (daftar) */
.btn-emas {
    background: linear-gradient(135deg, #f5b041 0%, #d68910 100%);
    color: #4a3200;
    box-shadow: 0 5px 15px rgba(245, 176, 65, 0.3);
}
.btn-emas:hover {
    transform: translateY(-3px);
    background: linear-gradient(135deg, #f8c471 0%, #f5b041 100%);
    box-shadow: 0 8px 20px rgba(245, 176, 65, 0.45);
}

/* Tombol biru (login) */
.btn-biru {
    background: linear-gradient(135deg, #2f8fd0 0%, #1d4e89 100%);
    color: #ffffff;
    box-shadow: 0 5px 15px rgba(47, 143, 208, 0.3);
}
.btn-biru:hover {
    transform: translateY(-3px);
    background: linear-gradient(135deg, #5cb6ee 0%, #2f8fd0 100%);
    box-shadow: 0 8px 20px rgba(47, 143, 208, 0.45);
}

/* Baris tombol sejajar (halaman utama) */
.row {
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 22px;
}

/* Form kolom tunggal (login) */
.form-single {
    grid-template-columns: 1fr;
}

/* ==========================================
   DEKORASI NOTIFIKASI RESPON (NOTICE)
   ========================================== */

.notice {
    grid-column: span 2;
    margin-top: 10px;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
    display: none;
    line-height: 1.4;
}

.notice:not(:empty) {
    display: block;
}

.notice.ok {
    background-color: rgba(39, 174, 96, 0.15);
    border: 1px solid #27ae60;
    color: #2ecc71;
}

.notice.err {
    background-color: rgba(231, 76, 60, 0.15);
    border: 1px solid #e74c3c;
    color: #ff7675;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}
/* ==========================================
   STYLE UNTUK HALAMAN GAMEPLAY (GAME.HTML)
   ========================================== */

/* Mengunci tubuh halaman gameplay */
.game-body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: #0b1319;
    font-family: 'Segoe UI', Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
}

/* Memastikan canvas game Phaser mengunci rasio 16:9 di tengah */
#game-canvas {
    width: 100vw;
    height: 56.25vw;
    max-width: 177.78vh;
    max-height: 100vh;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    position: relative;
    z-index: 1;
}

/* Tombol Keluar / Silang (HUD Kanan Atas) */
.tombol-hud {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: 2px solid #ffffff;
    border-radius: 50%;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s, background 0.2s;
}
.tombol-hud:hover {
    transform: scale(1.1) rotate(90deg);
    background: linear-gradient(135deg, #ff7675 0%, #e74c3c 100%);
}

/* Tombol Setting / Gerigi (HUD Kanan Atas) */
#btn-setting {
    background: linear-gradient(135deg, #2e4a62 0%, #162633 100%);
    border-color: #ffd34d;
    font-size: 1.4rem;
}
#btn-setting:hover {
    transform: scale(1.1) rotate(180deg);
    background: linear-gradient(135deg, #3d5f7d 0%, #2e4a62 100%);
}

/* ==========================================
   MODAL PENGATURAN KECIL (GAME.HTML)
   ========================================== */

#overlay-setting {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(5, 10, 15, 0.55);
    backdrop-filter: blur(3px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
#overlay-setting.tampil {
    display: flex;
}

.setting-modal {
    background: rgba(22, 38, 51, 0.96);
    border: 2px solid #b8860b;
    border-radius: 16px;
    width: 280px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    box-sizing: border-box;
}

.setting-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.setting-head h3 {
    margin: 0;
    font-size: 1.15rem;
    color: #ffd34d;
    letter-spacing: 1px;
}

.setting-x {
    width: 30px;
    height: 30px;
    background: rgba(30, 50, 68, 0.6);
    color: #fff;
    border: 2px solid #2e4a62;
    border-radius: 50%;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}
.setting-x:hover {
    background: rgba(231, 76, 60, 0.8);
    border-color: #ff7675;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background: rgba(30, 50, 68, 0.6);
    border: 2px solid #2e4a62;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    box-sizing: border-box;
}
.setting-item:hover {
    background: rgba(46, 74, 98, 0.85);
    border-color: #ffd700;
    transform: translateX(3px);
}

.setting-item.danger {
    background: rgba(231, 76, 60, 0.25);
    border-color: #e74c3c;
}
.setting-item.danger:hover {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border-color: #ff7675;
}

/* Base overlay pembungkus panel (Latar gelap transparan blur) */
#overlay-awal, #quiz-overlay, #overlay-selesai, #overlay-gagal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(5, 10, 15, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

/* Sembunyikan overlay secara default, tampilkan hanya jika game memicu class .tampil */
#overlay-awal, #quiz-overlay, #overlay-selesai, #overlay-gagal {
    display: none;
}
#overlay-awal.tampil, #quiz-overlay.tampil, #overlay-selesai.tampil, #overlay-gagal.tampil {
    display: flex;
}

/* Desain Kartu Dialog Utama */
.panel-card {
    background: rgba(22, 38, 51, 0.9);
    border: 3px solid #b8860b;
    border-radius: 20px;
    width: 90%;
    max-width: 580px;
    padding: 25px 30px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
    color: #ffffff;
    box-sizing: border-box;
    max-height: 95vh;
    overflow-y: auto; /* Jaga-jaga jika layar ponsel sangat pendek */
}

/* Gambar Notifikasi Cara Bermain */
.howto-img {
    width: 100%;
    max-height: 140px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid #2e4a62;
    margin-bottom: 12px;
}

.panel-card h2 {
    margin: 5px 0;
    font-size: 2.2rem;
    letter-spacing: 1px;
    background: linear-gradient(to bottom, #ffe066 0%, #f5b041 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.panel-card ul li {
    margin-bottom: 8px;
    color: #e1ecf4;
}

/* ==========================================
   DESAIN KHUSUS MODAL KUIS (QUIZ INTERACTIVE)
   ========================================== */

.quiz-card {
    background: rgba(16, 28, 38, 0.95);
    border: 3px solid #d4af37;
    border-radius: 24px;
    width: 90%;
    max-width: 520px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0,0,0,0.7), inset 0 0 20px rgba(212, 175, 55, 0.1);
    color: white;
    box-sizing: border-box;
}

.quiz-banner {
    background: linear-gradient(90deg, #aa7c11 0%, #d4af37 50%, #aa7c11 100%);
    color: #0b1319;
    padding: 6px 20px;
    border-radius: 30px;
    font-weight: bold;
    font-size: 0.9rem;
    display: inline-block;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

#quiz-tag {
    margin: 0 0 10px 0;
    color: #a3c2de;
    font-size: 1.1rem;
}

.soal {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 25px;
    color: #ffffff;
}

/* Wadah Penampung Opsi Jawaban */
.opsi {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

/* Tombol Opsi Jawaban (A, B, C, D) */
.opsi button, .quiz-btn {
    width: 100%;
    padding: 14px 18px;
    font-size: 1rem;
    font-weight: 500;
    text-align: left;
    color: #ffffff;
    background: rgba(30, 50, 68, 0.6);
    border: 2px solid #2e4a62;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
}
.opsi button:hover {
    background: rgba(46, 74, 98, 0.8);
    border-color: #ffd700;
    transform: translateX(4px);
}

/* Status Jawaban Benar / Salah */
.opsi button.benar {
    background: linear-gradient(135deg, #27ae60 0%, #1e7e43 100%) !important;
    border-color: #2ecc71 !important;
    color: white;
}
.opsi button.salah {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%) !important;
    border-color: #ff7675 !important;
    color: white;
}

/* Teks Feedback Kuis */
.feedback {
    font-size: 1.05rem;
    font-weight: bold;
    margin: 12px 0;
    min-height: 24px;
}
.feedback.ok { color: #2ecc71; }
.feedback.err { color: #ff7675; }

.btn-lanjut {
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
    border-radius: 12px;
    display: none; /* Muncul hanya jika user sudah memilih jawaban */
}

/* ==========================================
   DESAIN KONTROL SENTUH GAMEPLAY
   Kiri = panah gerak, Kanan = tombol lompat
   ========================================== */

#touch-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 18px;
    padding: 0 24px;
    z-index: 50;
    display: none;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none; /* jangan halangi klik area permainan */
}

#touch-controls.aktif {
    display: flex;
}

.kontrol-kiri {
    display: flex;
    gap: 14px;
    pointer-events: auto;
}

.tombol-kontrol {
    width: 68px;
    height: 68px;
    background: radial-gradient(circle at 30% 30%, rgba(56, 92, 122, 0.85), rgba(16, 28, 38, 0.85));
    border: 2px solid #a3c2de;
    color: #ffffff;
    border-radius: 50%;
    font-size: 1.7rem;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5), inset 0 0 12px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(5px);
    transition: transform 0.1s, background 0.1s, border-color 0.1s, box-shadow 0.1s;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.tombol-kontrol.ditekan,
.tombol-kontrol:active {
    transform: scale(0.9);
    background: radial-gradient(circle at 30% 30%, #ffe066, #ffd700);
    color: #0b1319;
    border-color: #b8860b;
    box-shadow: 0 0 18px rgba(255, 215, 0, 0.55);
}

/* Tombol lompat lebih besar di sisi kanan */
.tombol-lompat {
    width: 84px;
    height: 84px;
    font-size: 2rem;
    border-color: #ffd34d;
    color: #ffd34d;
    pointer-events: auto;
}
.tombol-lompat.ditekan,
.tombol-lompat:active {
    background: radial-gradient(circle at 30% 30%, #ffe066, #ffd700);
    color: #0b1319;
    border-color: #b8860b;
}

/* Row tata letak tombol overlay gagal */
.row {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 15px;
}
.row .btn {
    flex: 1;
    padding: 12px;
    font-size: 1rem;
    border-radius: 30px;
}
