:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --accent-color: #28a745;
    --danger-color: #dc3545;
    --background-light: #f8f9fa;
    --background-dark: #e9ecef;
    --text-color: #343a40;
    --header-color: #0056b3;
    --card-bg: #ffffff;
    --border-color: #dee2e6;
    --shadow-light: 0 4px 10px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 8px 20px rgba(0, 0, 0, 0.12);
    --shadow-strong: 0 12px 25px rgba(0, 0, 0, 0.18);
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, var(--background-dark) 0%, var(--background-light) 100%);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    overflow-x: hidden;
}

.container {
    background: var(--card-bg);
    border-radius: 25px;
    box-shadow: var(--shadow-strong);
    padding: 40px;
    text-align: center;
    width: 100%;
    max-width: 900px;
    border: none;
    animation: fadeIn 0.8s ease-in-out;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.container::before {
    content: '';
    position: absolute;
    top: -50px; left: -50px; right: -50px; bottom: -50px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><rect x="0" y="0" width="100" height="100" fill="%23f8f9fa" /><circle cx="20" cy="20" r="5" fill="%23e0e0e0" /><circle cx="80" cy="80" r="5" fill="%23e0e0e0" /><circle cx="20" cy="80" r="5" fill="%23e0e0e0" /><circle cx="80" cy="20" r="5" fill="%23e0e0e0" /></svg>');
    background-size: 80px;
    opacity: 0.1;
    z-index: 0;
    pointer-events: none;
}

#game-container {
    position: relative;
    z-index: 1;
    width: 100%;
}

h1 { font-size: 3em; font-weight: 700; margin-bottom: 10px; color: var(--header-color); }
h2 { font-size: 2.2em; font-weight: 600; margin-top: 25px; margin-bottom: 20px; color: var(--header-color); }
h3 { font-size: 1.6em; font-weight: 500; margin-top: 20px; margin-bottom: 15px; color: var(--text-color); }
p { font-size: 1.1em; line-height: 1.6; color: var(--text-color); }

.deskripsi {
    font-style: normal;
    color: var(--secondary-color);
    font-size: 1.1em;
    margin-bottom: 30px;
}

.info-area {
    display: flex; justify-content: space-around; align-items: center;
    font-size: 1.3em; font-weight: 600; margin-bottom: 30px;
    color: var(--header-color); background-color: var(--background-light);
    padding: 15px 20px; border-radius: 15px; box-shadow: var(--shadow-light);
    gap: 15px; flex-wrap: wrap;
}

#game-area {
    background: var(--background-dark); border-radius: 20px;
    padding: 25px; border: none; box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
    flex-grow: 1; display: flex; flex-direction: column; justify-content: center; gap: 20px;
}

#soal-area { display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; min-height: 150px; align-items: center; }
#pilihan-area { display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; min-height: 120px; align-items: center; }

.drop-zone {
    flex: 1; min-width: 120px; max-width: 200px; height: 130px;
    background-color: var(--card-bg); border: 3px dashed var(--border-color);
    border-radius: 15px; display: flex; flex-direction: column; justify-content: center;
    align-items: center; font-size: 1.1em; font-weight: 600; color: var(--primary-color);
    transition: all 0.3s ease-in-out; box-shadow: var(--shadow-light); padding: 10px;
    box-sizing: border-box; text-transform: uppercase;
}
.drop-zone:hover { transform: translateY(-5px) scale(1.02); box-shadow: var(--shadow-medium); }
.drop-zone.drag-over { background-color: #e0f2f7; border-color: var(--primary-color); transform: scale(1.05); box-shadow: var(--shadow-medium); }
.drop-zone.correct { background-color: var(--accent-color); border-color: #218838; color: white; transform: scale(1.02); }

.draggable {
    width: 90px; height: 90px; background-color: var(--card-bg);
    border: 3px solid var(--primary-color); border-radius: 18px;
    cursor: grab; transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
    font-size: 4.5em; display: flex; justify-content: center; align-items: center;
    box-shadow: var(--shadow-light); line-height: 1;
}
.draggable:active { cursor: grabbing; transform: scale(0.95); }
.draggable.touch-dragging { position: fixed; z-index: 1000; pointer-events: none; transition: none; }
.draggable.touch-revert { transition: transform 0.4s ease-out; }

#pesan-hasil {
    font-size: 1.6em; font-weight: 600; margin-top: 25px; min-height: 40px;
    transition: all 0.5s ease; text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.05);
}

.pesan-bonus { color: var(--primary-color); font-weight: 700; font-size: 1.1em; display: block; margin-top: 8px; }

.btn {
    padding: 15px 35px; margin: 10px; font-size: 1.2em; font-weight: 600; color: white;
    background-color: var(--primary-color); border: none; border-radius: 12px;
    cursor: pointer; transition: all 0.3s ease; box-shadow: var(--shadow-light); letter-spacing: 0.5px;
}
.btn:hover { background-color: #0056b3; transform: translateY(-4px); box-shadow: var(--shadow-medium); }
.btn:disabled { background-color: var(--secondary-color); cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary { background-color: var(--secondary-color); }
.btn-secondary:hover { background-color: #5a6268; }
.btn-danger { background-color: var(--danger-color); }
.btn-danger:hover { background-color: #c82333; }

#form-simpan-skor input[type="text"],
#form-simpan-skor input[type="password"] {
    padding: 12px 18px; font-size: 1.1em; margin: 8px; border-radius: 10px;
    border: 1px solid var(--border-color); outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    width: calc(50% - 30px); max-width: 250px; box-shadow: var(--shadow-light);
}
#form-simpan-skor input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25); }

.game-actions { margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--border-color); }

.dashboard-container { width: 100%; animation: fadeIn 0.8s ease-in-out; padding: 0 10px; box-sizing: border-box; }
.kesulitan-title { font-size: 2em; color: var(--header-color); margin: 0 0 20px 0; text-align: center; }
.no-data { color: var(--secondary-color); font-style: italic; text-align: center; padding: 15px; background-color: var(--background-light); border-radius: 10px; margin: 20px 0; }
.dashboard-actions { margin-top: 30px; display: flex; justify-content: center; flex-wrap: wrap; gap: 15px; }

.kategori-section { width: 100%; margin-bottom: 20px; }
.accordion-trigger { display: flex; justify-content: space-between; align-items: center; cursor: pointer; padding: 20px; background-color: var(--background-light); border-radius: 15px; transition: all 0.3s ease; border: 1px solid var(--border-color); }
.accordion-trigger:hover { background-color: var(--background-dark); }
.accordion-trigger .kategori-title { margin: 0; font-size: 2em; }
.accordion-icon { font-size: 2.5em; font-weight: 300; color: var(--primary-color); transition: transform 0.4s ease; }
.accordion-trigger.active .accordion-icon { transform: rotate(45deg); }
.accordion-content { max-height: 0; overflow: hidden; transition: max-height 0.5s ease-out; padding: 0 10px; }
.accordion-content .leaderboard-card:first-child { margin-top: 15px; }

.leaderboard-card { background-color: var(--card-bg); border-radius: 20px; padding: 25px 35px; margin-top: 30px; box-shadow: var(--shadow-medium); border: none; text-align: left; transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out; }
.dashboard-container .leaderboard-card { cursor: pointer; }
.dashboard-container .leaderboard-card:hover { transform: translateY(-8px) scale(1.02); box-shadow: var(--shadow-strong); }
.leaderboard-card table { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 20px; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-light); }
.leaderboard-card th, .leaderboard-card td { padding: 15px 20px; border-bottom: 1px solid var(--border-color); text-align: left; }
.leaderboard-card th { background-color: var(--primary-color); color: white; font-weight: 600; font-size: 1.1em; }
.leaderboard-card thead th:first-child { border-top-left-radius: 10px; }
.leaderboard-card thead th:last-child { border-top-right-radius: 10px; }
.leaderboard-card tbody tr:nth-child(even) { background-color: var(--background-light); }
.leaderboard-card tbody tr:last-child td { border-bottom: none; }
.leaderboard-card td:first-child { font-weight: 700; font-size: 1.5em; text-align: center; width: 80px; color: var(--primary-color); }
.leaderboard-card td:last-child { font-weight: 600; color: var(--accent-color); font-size: 1.2em; }

.modal-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); display: flex; justify-content: center; align-items: center; z-index: 1000; animation: fadeIn 0.3s ease-in-out; }
.modal-content { background: var(--card-bg); padding: 30px 40px; border-radius: 20px; box-shadow: var(--shadow-strong); width: 90%; max-width: 600px; max-height: 80vh; display: flex; flex-direction: column; position: relative; animation: pop 0.4s ease-out; }
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 15px; margin-bottom: 20px; }
.modal-header h3 { margin: 0; font-size: 1.8em; color: var(--header-color); }
.modal-close-btn { font-size: 2.5em; font-weight: bold; color: var(--secondary-color); cursor: pointer; background: none; border: none; line-height: 1; }
.modal-close-btn:hover { color: var(--danger-color); }
.modal-body { overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 15px; padding-top: 20px; margin-top: 20px; border-top: 1px solid var(--border-color); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop { 0% { transform: scale(0.9); } 100% { transform: scale(1); } }
@keyframes shake { 10%, 90% { transform: translate3d(-1px, 0, 0); } 20%, 80% { transform: translate3d(2px, 0, 0); } 30%, 50%, 70% { transform: translate3d(-4px, 0, 0); } 40%, 60% { transform: translate3d(4px, 0, 0); } }

/* === ATURAN RESPONSIVE === */

.dashboard-kategori-wrapper { width: 100%; display: block; }
@media (orientation: landscape) and (min-width: 1024px) {
    .dashboard-kategori-wrapper { display: flex; gap: 40px; align-items: flex-start; }
    .kategori-section { flex: 1; min-width: 0; }
    .kategori-title { font-size: 2em; }
}

/* Tata letak khusus untuk HP Landscape */
@media (max-width: 900px) and (orientation: landscape) {
    body { padding: 5px; }
    .container { padding: 15px; }
    .info-area { font-size: 0.9em; padding: 8px; margin-bottom: 10px; }
    #game-area { flex-direction: row; align-items: stretch; gap: 15px; padding: 15px; }
    #soal-area { flex: 2; min-height: initial; } /* Area soal lebih besar */
    #pilihan-area { flex: 1; flex-direction: column; min-height: initial; justify-content: space-around; } /* Pilihan di kanan */
    .drop-zone { height: 75px; min-width: 75px; font-size: 0.8em; }
    .draggable { width: 50px; height: 50px; font-size: 2.5em; }
    .game-actions { margin-top: 10px; padding-top: 10px; }
}

/* Tablet & HP Potret */
@media (max-width: 768px) {
    body { padding: 5px; }
    .container { padding: 20px 15px; border-radius: 15px; }
    h1 { font-size: 2.2em; } h2 { font-size: 1.8em; } h3 { font-size: 1.4em; }
    .deskripsi { font-size: 1em; margin-bottom: 15px; }
    .info-area { font-size: 1em; flex-direction: row; gap: 10px; padding: 8px 10px; margin-bottom: 15px; }
    #game-area { padding: 15px; gap: 15px; }
    #soal-area { gap: 10px; min-height: 100px; }
    .drop-zone { min-width: 70px; max-width: 140px; height: 90px; font-size: 0.8em; border-radius: 12px; }
    #pilihan-area { gap: 10px; min-height: 80px; }
    .draggable { width: 60px; height: 60px; font-size: 3em; border-radius: 12px; }
    #pesan-hasil { font-size: 1.2em; margin-top: 15px; min-height: 25px; }
    .game-actions { margin-top: 15px; padding-top: 10px; }
    .btn { padding: 12px 20px; font-size: 1em; margin: 5px; border-radius: 10px; }
    #form-simpan-skor input { width: calc(100% - 20px); max-width: none; margin: 5px 0; }
    .leaderboard-card { padding: 15px; margin-top: 15px; border-radius: 15px; }
    .kesulitan-title, .accordion-trigger .kategori-title { font-size: 1.5em; }
    .leaderboard-card th, .leaderboard-card td { padding: 8px 10px; font-size: 0.9em; }
    .leaderboard-card td:first-child { font-size: 1.2em; width: 50px; }
    .modal-content { padding: 20px; }
    .modal-header h3 { font-size: 1.4em; }
}