* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Comic Sans MS', cursive; overflow: auto; min-height: 100vh; display: flex; justify-content: center; align-items: flex-start; margin: 0; padding: 0; }

#game-container {
    width: 100%; max-width: 800px; min-height: 100vh;
    position: relative; border-radius: 0; overflow: visible;
    transition: all 0.5s ease;
    padding-bottom: 60px;
}

.level-1 { background: linear-gradient(180deg, #87CEEB 0%, #90EE90 40%, #228B22 100%); }
.level-2 { background: linear-gradient(180deg, #2E8B57 0%, #006400 40%, #8B4513 100%); }
.level-3 { background: linear-gradient(180deg, #4A0000 0%, #8B0000 30%, #FF4500 60%, #FFD700 100%); }
.level-4 { background: linear-gradient(180deg, #0B0B2B 0%, #1B1B5E 30%, #2B2B8E 60%, #4B4BAE 100%); }

.flower { position: absolute; font-size: 24px; animation: float 4s ease-in-out infinite; }
.flower:nth-child(1) { top: 10%; left: 5%; animation-delay: 0s; }
.flower:nth-child(2) { top: 20%; right: 10%; animation-delay: 1s; }
.flower:nth-child(3) { bottom: 15%; left: 15%; animation-delay: 2s; }
.star { position: absolute; font-size: 16px; animation: twinkle 2s ease-in-out infinite; }
.star:nth-child(4) { top: 10%; left: 20%; animation-delay: 0s; }
.star:nth-child(5) { top: 30%; right: 15%; animation-delay: 0.5s; }

@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-15px); } }
@keyframes twinkle { 0%,100% { opacity: 0.3; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.1); } }

#header {
    position: absolute; top: 0; left: 0; right: 0;
    padding: 10px 15px; background: rgba(0,0,0,0.4); backdrop-filter: blur(10px);
    display: flex; justify-content: space-between; align-items: center; color: white;
    font-size: 16px; z-index: 10; border-radius: 20px 20px 0 0;
}

#step-indicator {
    position: absolute; top: 50px; left: 50%; transform: translateX(-50%);
    background: rgba(255,215,0,0.8); padding: 4px 15px; border-radius: 15px;
    font-size: 14px; font-weight: bold; z-index: 10; color: #333;
}

#message {
    position: absolute; top: 75px; left: 50%; transform: translateX(-50%);
    background: rgba(255,255,255,0.9); padding: 10px 20px; border-radius: 25px;
    font-size: 18px; font-weight: bold; text-align: center; z-index: 10;
    max-width: 90%; color: #333; border: 3px solid rgba(255,215,0,0.3);
}

#animals { 
    position: absolute; top: 130px; left: 50%; transform: translateX(-50%); 
    display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; 
    padding: 10px; z-index: 5; max-width: 90%;
    max-height: 120px; overflow-y: auto;
}
#animals span { 
    font-size: 45px; cursor: pointer; transition: all 0.3s ease; 
    animation: bounce 1.5s ease-in-out infinite; 
    display: inline-block; padding: 8px; border-radius: 15px; user-select: none;
}
#animals span.active { 
    background: rgba(255,255,255,0.4); border: 3px dashed #4CAF50; 
}
#animals span.active:hover { 
    background: rgba(255,255,100,0.6); transform: scale(1.3); 
}
#animals span.clicked { 
    opacity: 0.3; transform: scale(0.7); animation: none; 
}

#grid { 
    position: absolute; top: 260px; left: 50%; transform: translateX(-50%); 
    display: grid; grid-template-columns: repeat(5, 55px); grid-template-rows: repeat(2, 55px); 
    gap: 8px; padding: 12px; background: rgba(255,255,255,0.3); border-radius: 18px; z-index: 5; 
}
.grid-cell { 
    width: 55px; height: 55px; background: rgba(255,255,255,0.2); 
    border: 3px solid rgba(255,255,255,0.5); border-radius: 10px; 
    display: flex; justify-content: center; align-items: center; 
    font-size: 30px; cursor: pointer; transition: all 0.3s ease; 
}
.grid-cell.active { border-color: #4CAF50; border-style: dashed; }
.grid-cell.active:hover { background: rgba(255,255,100,0.5); transform: scale(1.15); }
.grid-cell.filled { background: rgba(255,215,0,0.5); border-color: gold; animation: pop 0.3s ease; }

#options { 
    position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%); 
    display: flex; gap: 20px; z-index: 5; 
}
.option-btn { 
    width: 90px; height: 70px; background: linear-gradient(145deg, #ffffff, #e6e6e6); 
    border: 4px solid #ddd; border-radius: 18px; font-size: 30px; font-weight: bold; 
    cursor: pointer; transition: all 0.2s ease; box-shadow: 0 6px 15px rgba(0,0,0,0.15); 
    color: #333; display: flex; justify-content: center; align-items: center; 
}
.option-btn:hover { transform: translateY(-5px); border-color: #4CAF50; }
.option-btn.correct { background: linear-gradient(145deg, #4CAF50, #45a049); color: white; border-color: #4CAF50; animation: celebrate 0.5s ease; }
.option-btn.wrong { background: linear-gradient(145deg, #f44336, #d32f2f); color: white; border-color: #f44336; animation: shake 0.5s ease; }

#formula-display {
    position: absolute; bottom: 160px; right: 20px;
    background: rgba(255,255,255,0.9); padding: 15px 20px; border-radius: 15px;
    font-size: 22px; font-family: monospace; z-index: 5; text-align: right;
}
.formula-row { padding: 2px 0; }
.formula-line { border-bottom: 2px solid #333; margin: 3px 0; }
.result { color: #4CAF50; font-weight: bold; }

.counter-hint {
    width: 100%; text-align: center; font-size: 16px; 
    color: #fff; background: rgba(0,0,0,0.5); padding: 5px; border-radius: 10px; margin-top: 5px;
}

#reset-btn { 
    position: absolute; bottom: 15px; right: 15px; 
    padding: 10px 20px; background: rgba(255,255,255,0.2); backdrop-filter: blur(10px); 
    border: 2px solid rgba(255,255,255,0.3); border-radius: 12px; 
    color: white; font-size: 16px; cursor: pointer; 
}

@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes pop { 0% { transform: scale(1); } 50% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes celebrate { 0% { transform: scale(1); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

#clock-display {
    position: absolute;
    top: 130px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    max-width: 90%;
}

#clock-face {
    touch-action: none;
}

#formula-display {
    position: absolute;
    right: 10px;
    bottom: 120px;
    background: rgba(255,255,255,0.9);
    border-radius: 10px;
    z-index: 5;
}