/* css/style.css */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none; /* Prevent text selection on touch */
    -webkit-user-select: none;
    touch-action: manipulation; /* Disable double-tap to zoom */
}

body {
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    background-color: #87CEEB; /* Sky blue */
    background-image: url('data:image/svg+xml;utf8,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40" fill="rgba(255,255,255,0.2)"/></svg>');
    color: #333;
    width: 100vw;
    height: 100vh;
    overflow: hidden; /* Prevent scrolling */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Screens */
.screen {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10;
    overflow-y: auto; /* Allow scroll globally but reset it for game arena */
}

#game-arena {
    overflow-y: hidden; /* Game arena should never scroll */
    justify-content: flex-start;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 20;
}

/* Containers */
.container {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 40px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    border: 8px solid #FFD700;
    max-width: 90%;
    width: 1200px;
    position: relative;
    margin: auto;
}

/* Typography */
h1 {
    font-size: 4.5rem;
    color: #FF4500;
    text-shadow: 4px 4px 0 #FFF, 8px 8px 0 rgba(0,0,0,0.2);
    margin-bottom: 10px;
    line-height: 1.1;
}

h2 {
    font-size: 2.2rem;
    color: #4CAF50;
    margin-bottom: 25px;
}

h3 {
    font-size: 2rem;
    color: #2196F3;
    margin-bottom: 10px;
}

.text-yellow { color: #FFC107; text-shadow: 4px 4px 0 #FF5722; }

/* Mascots & Icons */
.mascot-large {
    font-size: 7rem;
    margin-bottom: -10px;
}

/* Buttons */
button {
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 10px 0 rgba(0,0,0,0.2);
    transition: transform 0.1s, box-shadow 0.1s, background-color 0.2s;
    text-transform: uppercase;
}

button:active {
    transform: translateY(10px);
    box-shadow: 0 0 0 rgba(0,0,0,0.2);
}

.btn-huge {
    font-size: 2.5rem;
    padding: 20px 40px;
    border-radius: 40px;
}

.btn-large {
    font-size: 1.8rem;
    padding: 15px 30px;
}

.btn-small {
    font-size: 1.2rem;
    padding: 8px 16px;
    border-radius: 15px;
}

.btn-primary { background-color: #4CAF50; color: white; }
.btn-primary:hover { background-color: #45a049; }

.btn-secondary { background-color: #2196F3; color: white; }
.btn-secondary:hover { background-color: #1976D2; }

.btn-tertiary { background-color: #FF9800; color: white; }
.btn-tertiary:hover { background-color: #F57C00; }

.btn-danger { background-color: #F44336; color: white; }
.btn-danger:hover { background-color: #D32F2F; }

/* Layouts */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    margin-top: 25px;
}

.menu-buttons.row {
    flex-direction: row;
    justify-content: center;
}

.menu-buttons.small-margin {
    margin-top: 20px;
}

.top-right {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
}

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-top: 30px;
}

.setting-group {
    background-color: #f0f8ff;
    padding: 20px;
    border-radius: 20px;
    border: 4px solid #B0E0E6;
}

.big-select {
    font-size: 2rem;
    padding: 15px;
    border-radius: 15px;
    border: 4px solid #2196F3;
    font-family: inherit;
    width: 100%;
    color: #333;
}

.radio-group {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.btn-radio {
    font-size: 2rem;
    padding: 15px 40px;
    background-color: #E0E0E0;
    color: #555;
    box-shadow: 0 6px 0 #9E9E9E;
}

.btn-radio.active {
    background-color: #4CAF50;
    color: white;
    box-shadow: 0 6px 0 #388E3C;
}

/* Teacher Mode */
.teacher-container {
    background-color: #FFF3E0;
    padding: 30px;
    border-radius: 20px;
    border: 4px solid #FFB74D;
    margin-bottom: 30px;
    text-align: left;
}

.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: #E65100;
}
.big-input {
    width: 100%;
    font-size: 1.8rem;
    padding: 15px;
    border-radius: 15px;
    border: 3px solid #FF9800;
    font-family: inherit;
}

.bank-soal-container {
    background-color: #E8F5E9;
    padding: 20px;
    border-radius: 20px;
    border: 4px solid #81C784;
    text-align: left;
    max-height: 300px;
    overflow-y: auto;
}

.question-list {
    list-style: none;
    font-size: 1.5rem;
}
.question-list li {
    background: white;
    margin-bottom: 10px;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #ccc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.btn-delete-q {
    background-color: #F44336;
    color: white;
    font-size: 1.2rem;
    padding: 5px 15px;
    border-radius: 10px;
    box-shadow: none;
}
.btn-delete-q:active { transform: scale(0.95); }

/* Game Arena */
#game-arena {
    background-color: #A8E6CF;
    background-image: linear-gradient(180deg, #87CEEB 0%, #A8E6CF 50%, #8BC34A 100%);
    justify-content: flex-start;
}

.hud {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 10px 30px;
    background-color: rgba(255,255,255,0.7);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.hud-item {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    background: white;
    padding: 5px 20px;
    border-radius: 20px;
    border: 4px solid #333;
}

.score-box { border-color: #FF9800; color: #E65100; }
.progress-box { border-color: #2196F3; color: #0D47A1; }
.lives-box { border-color: #F44336; }

.combo-display {
    position: absolute;
    top: 100px;
    font-size: 3rem;
    color: #FF5722;
    text-shadow: 3px 3px 0 #FFF, 4px 4px 0 rgba(0,0,0,0.2);
    animation: pulse 0.5s infinite alternate;
    z-index: 5;
}

.question-display {
    background-color: white;
    border: 6px solid #9C27B0;
    border-radius: 40px;
    padding: 15px 40px;
    font-size: 3rem;
    color: #4A148C;
    margin-top: 20px;
    box-shadow: 0 10px 0 #7B1FA2, 0 15px 15px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 5;
    max-width: 90%;
}

.sound-icon {
    cursor: pointer;
    font-size: 4rem;
    transition: transform 0.2s;
}
.sound-icon:active { transform: scale(0.8); }

.arena {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 15px 50px;
    margin-top: 10px;
    width: 80%;
    max-width: 1400px;
    height: auto;
}

/* Holes and Moles */
.hole {
    position: relative;
    width: 160px;
    height: 180px; /* Container tall enough to hold mole + hole */
    margin: 0 auto;
    overflow: hidden; /* Magic part: cuts off the mole when it goes down! */
}

/* The dark ellipse hole graphic */
.hole::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: #3E2723;
    border-radius: 50%;
    box-shadow: inset 0 -10px 0 rgba(0,0,0,0.5), 0 5px 0 #2E7D32;
    z-index: 1;
}

/* The front lip of the hole to give 3D effect overlapping the mole */
.hole::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background: transparent;
    border-radius: 0 0 80px 80px; 
    box-shadow: inset 0 -10px 0 rgba(0,0,0,0.5), 0 5px 0 #2E7D32;
    z-index: 3;
    pointer-events: none;
}

.mole {
    position: absolute;
    bottom: 10px; /* Sits slightly inside the hole graphic */
    left: 10px; /* Center horizontally in the 160px container */
    width: 140px;
    height: 160px;
    background-color: #8D6E63;
    border-radius: 70px 70px 30px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 10px;
    cursor: pointer;
    box-shadow: 0 5px 10px rgba(0,0,0,0.3);
    border: 4px solid #5D4037;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2; /* In between hole back and hole front */
    
    /* Animation state */
    transform: translateY(300px); /* Hidden far below the container (cropped) */
    pointer-events: none;
}

.mole:active {
    transform: scale(0.95);
    transition: transform 0.05s;
}

.mole.up {
    transform: translateY(0);
    pointer-events: auto;
}

.mole.hit {
    background-color: #FFCC80;
    transform: translateY(100px) scale(0.9);
    transition: transform 0.1s, background-color 0.1s;
}

.mole-face {
    font-size: 4rem;
    line-height: 1;
}

.mole-board {
    background-color: #FFF;
    border: 3px solid #333;
    border-radius: 10px;
    padding: 2px 5px;
    font-size: 1.8rem;
    font-weight: bold;
    color: #D84315;
    margin-top: 5px;
    width: 90%;
    text-align: center;
    box-shadow: 0 4px 0 #CCC;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50px;
    word-break: break-word;
    line-height: 1.1;
}

/* Result Screen */
.stats-box {
    background-color: #F3E5F5;
    padding: 40px;
    border-radius: 30px;
    border: 6px solid #CE93D8;
    font-size: 3rem;
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 30px 0;
    text-align: left;
    display: inline-block;
}

.stat-item {
    font-weight: bold;
    color: #4A148C;
}

/* Feedback Overlay */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    pointer-events: none;
}

.overlay.hidden { display: none; }

.feedback-content {
    text-align: center;
    animation: popOut 0.8s ease forwards;
}

#feedback-emoji { font-size: 15rem; }
#feedback-text { 
    font-size: 8rem; 
    font-weight: bold; 
    color: #FF5722;
    text-shadow: 4px 4px 0 white, 8px 8px 0 black;
}

/* Animations */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-30px); }
}

.bounce { animation: bounce 2s infinite ease-in-out; }

@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

@keyframes popOut {
    0% { transform: scale(0.5); opacity: 1; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Utilities */
.hidden { display: none !important; }
