:root {
    --bg-main: #D4F0F0; --btn-mulai: #77D970; --btn-skor: #9AB7D3;
    --bg-modal: #638CA6; --btn-batal: #F8C32E; --text-dark: #000000;
    --grid-size: 60px;
}

body { margin: 0; padding: 0; font-family: 'Poppins', sans-serif; background-color: #222; display: flex; justify-content: center; align-items: center; height: 100vh; color: var(--text-dark); user-select: none; }

/* === GAME CONTAINER (Ukuran Kotak Rapi) === */
#game-container { 
    width: 800px; height: 450px; 
    max-width: 100vw; max-height: 100vh; /* Agar menyesuaikan layar HP kalau lebih kecil */
    background-color: var(--bg-main); position: relative; overflow: hidden; 
    border: 4px solid #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); 
}

/* === PORTRAIT WARNING === */
#portrait-warning { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #222; color: #fff; z-index: 9999; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 20px; box-sizing: border-box; }
#portrait-warning h2 { font-family: 'Poppins', sans-serif; margin: 0 0 10px 0; }

/* Trigger Peringatan jika layar berdiri (Portrait) khusus di device mobile/tablet */
@media screen and (max-width: 1024px) and (orientation: portrait) {
    #portrait-warning { display: flex; }
    #game-container { display: none !important; }
}

.screen { width: 100%; height: 100%; position: absolute; top: 0; left: 0; display: none; flex-direction: column; justify-content: center; align-items: center; background-color: var(--bg-main); z-index: 5; }
.active { display: flex; }
.modal-overlay { background-color: rgba(0,0,0,0.6); z-index: 30; }
.flex-center { display: flex; justify-content: center; gap: 10px; align-items: center;}
.center-text { text-align: center; }
.full-width { width: 100%; }

h1 { font-size: 56px; font-weight: 700; margin: 0; text-transform: uppercase; }
h2, h3 { font-weight: 700; margin-top: 0; }
.subtitle { font-size: 20px; margin-bottom: 40px; font-weight: 700; }

.btn { font-family: 'Poppins', sans-serif; font-weight: 700; border: 3px solid var(--text-dark); padding: 10px 30px; margin: 5px; border-radius: 8px; cursor: pointer; font-size: 18px; color: var(--text-dark); background: #fff; transition: transform 0.1s; }
.btn:active { transform: scale(0.95); }
.btn-mulai { background-color: var(--btn-mulai); }
.btn-skor { background-color: var(--btn-skor); }
.btn-batal { background-color: var(--btn-batal); }
.admin-trigger { position: absolute; bottom: 10px; right: 10px; font-size: 12px; padding: 5px 10px; }

.box-modal-nama { background-color: var(--bg-modal); padding: 30px; border-radius: 12px; border: 3px solid var(--text-dark); width: 320px; text-align: center; }
.box-panel { background-color: var(--bg-main); padding: 30px; border-radius: 12px; border: 3px solid var(--text-dark); width: 70%; max-width: 500px; position: relative; }
.input-field { padding: 10px; width: 80%; font-family: 'Poppins', sans-serif; border-radius: 5px; border: 3px solid var(--text-dark); margin-bottom: 20px; font-size: 16px; color: var(--text-dark); font-weight: 700; }

#toast-container { position: absolute; top: 15px; left: 15px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { background: #fff; color: var(--text-dark); padding: 12px 20px; border-radius: 8px; font-weight: 700; border: 3px solid var(--text-dark); border-left: 8px solid var(--text-dark); animation: slideIn 0.3s forwards, fadeOut 0.3s forwards 2.5s; opacity: 0; transform: translateX(-100%); }
.toast.success { border-left-color: var(--btn-mulai); }
.toast.error { border-left-color: #e74c3c; }
.toast.warning { border-left-color: var(--btn-batal); }
@keyframes slideIn { to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateX(-100%); } }

#screen-admin { justify-content: flex-start; padding: 20px; overflow-y: auto; box-sizing: border-box; }
.admin-content { width: 100%; max-width: 600px; margin: 0 auto; }
.admin-form { background: #fff; padding: 15px; border: 3px solid var(--text-dark); border-radius: 8px; width: 100%; margin-bottom: 20px; box-sizing: border-box;}
.admin-form input, .admin-form select { width: 100%; padding: 8px; margin: 5px 0 15px 0; font-family: 'Poppins', sans-serif; font-weight: 700; border: 2px solid var(--text-dark); border-radius: 5px; box-sizing: border-box;}
.q-item { background: #fff; padding: 10px; border: 2px solid var(--text-dark); margin-bottom: 5px; border-radius: 5px; display: flex; justify-content: space-between; align-items: center; font-weight: 700;}

.sky { height: 70%; background-color: var(--bg-main); background-size: cover; background-position: center; }
.dirt-container { height: 30%; display: flex; border-top: 4px solid var(--text-dark); }
.dirt-block { width: var(--grid-size); height: 100%; background-color: #8B5A2B; background-size: cover; background-position: top center; border-right: 1px solid #5C3A21; }

.top-ui { position: absolute; top: 15px; width: 100%; display: flex; justify-content: center; z-index: 20; }
.timer { font-size: 28px; font-weight: 700; background: #fff; padding: 2px 15px; border: 3px solid var(--text-dark); border-radius: 8px; }
.status-info { position: absolute; left: 20px; top: 15px; font-weight: 700; background: #fff; padding: 5px 10px; border: 3px solid var(--text-dark); border-radius: 8px; z-index: 20; display: flex; flex-direction: column; font-size: 14px;}
.top-right-actions { position: absolute; right: 20px; }

/* PANEL QUEST */
.quest-box { position: absolute; left: 20px; top: 90px; background: rgba(255, 255, 255, 0.95); border: 3px solid var(--text-dark); border-radius: 8px; width: 200px; padding: 12px; z-index: 15; box-shadow: 0 4px 0 rgba(0,0,0,0.2); animation: slideInLeft 0.5s ease-out; }
.quest-header { font-weight: 700; font-size: 14px; border-bottom: 2px dashed #ccc; padding-bottom: 5px; margin-bottom: 8px; color: #e74c3c; }
.quest-text { font-size: 13px; font-weight: 700; line-height: 1.4; color: var(--text-dark); }
.quest-highlight { animation: highlightAnim 0.6s ease; }
@keyframes highlightAnim { 0% { transform: scale(1); background: rgba(255,255,255,0.95); } 50% { transform: scale(1.05); background: #77D970; } 100% { transform: scale(1); background: rgba(255,255,255,0.95); } }
@keyframes slideInLeft { from { transform: translateX(-100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

#game-world { position: absolute; bottom: 30%; width: 100%; height: var(--grid-size); z-index: 10; }
#player { position: absolute; bottom: 0; left: 0; width: 50px; height: 50px; background-color: transparent; background-size: contain; background-repeat: no-repeat; background-position: center bottom; transition: left 0.15s ease-out, transform 0.1s; }

.is-jumping { animation: jumpAnim 0.4s ease-out; }
@keyframes jumpAnim { 0% { bottom: 0; } 50% { bottom: 60px; } 100% { bottom: 0; } }

.plant, .trophy-block { position: absolute; bottom: 0; width: var(--grid-size); height: var(--grid-size); display: flex; justify-content: center; align-items: flex-end; background-size: contain; background-repeat: no-repeat; background-position: center bottom; color: #F8C32E;}
.trophy-block { font-size: 40px; }
.plant-timer { position: absolute; top: -35px; font-size: 16px; font-weight: 700; background: #fff; padding: 2px 8px; border: 3px solid var(--text-dark); border-radius: 6px; }

.controls { position: absolute; bottom: 15px; width: 100%; display: flex; justify-content: space-between; padding: 0 20px; box-sizing: border-box; z-index: 20; }
.ctrl-btn { width: 55px; height: 55px; background-color: #fff; border: 3px solid var(--text-dark); border-radius: 8px; font-size: 24px; display: flex; justify-content: center; align-items: center; cursor: pointer; font-weight: 700; transition: transform 0.1s; }
.ctrl-btn:active { background-color: #ccc; transform: scale(0.9); }

.answer-btn { display: block; width: 100%; margin: 10px 0; background-color: #fff; border: 3px solid var(--text-dark); border-radius: 8px; padding: 12px; text-align: left; font-family: 'Poppins', sans-serif; font-weight: 700; cursor: pointer; font-size: 16px; transition: 0.2s;}
.answer-btn:hover { background-color: #eee; padding-left: 20px; }
.close-btn { position: absolute; top: 10px; right: 10px; background: #fff; border: 3px solid var(--text-dark); border-radius: 8px; font-size: 18px; font-weight: 700; width: 35px; height: 35px; cursor: pointer; }

.leaderboard-list { max-height: 200px; overflow-y: auto; background: #fff; padding: 15px; border-radius: 8px; border: 3px solid var(--text-dark); text-align: left; margin-bottom: 20px; font-weight: 700; }
.score-entry { border-bottom: 2px solid #ccc; padding: 10px 0; font-size: 16px; display: flex; justify-content: space-between; }
.score-entry:last-child { border-bottom: none; }