:root {
    --primary-green: #4CAF50;
    --primary-orange: #FF9800;
    --primary-yellow: #FFEB3B;
    --primary-pink: #E91E63;
    --primary-purple: #9C27B0;
    --primary-blue: #2196F3;
    --primary-teal: #00BCD4;
    --dark-green: #2E7D32;
    --light-green: #81C784;
    --bg-gradient-start: #1B5E20;
    --bg-gradient-end: #4CAF50;
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-dark: #333;
    --shadow-soft: 0 4px 15px rgba(0, 0, 0, 0.2);
    --shadow-strong: 0 8px 25px rgba(0, 0, 0, 0.3);
    --border-radius: 20px;
    --border-radius-lg: 30px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow: hidden;
}

body {
    font-family: 'Nunito', sans-serif;
    min-height: 100vh;
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 50%, #8BC34A 100%);
}

.game-container {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    padding: 20px;
    z-index: 10;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* Start Screen Styles */
#start-screen {
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 235, 59, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(233, 30, 99, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(33, 150, 243, 0.2) 0%, transparent 70%),
        linear-gradient(135deg, #1B5E20 0%, #2E7D32 30%, #4CAF50 70%, #8BC34A 100%);
    overflow-y: auto;
}

.jungle-decoration {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.jungle-decoration span {
    position: absolute;
    font-size: 3rem;
    animation: float 6s ease-in-out infinite;
    opacity: 0.8;
}

.tree { top: 5%; left: 5%; font-size: 4rem; animation-delay: 0s; }
.flower { top: 15%; right: 10%; animation-delay: 1s; }
.butterfly { top: 25%; left: 15%; animation-delay: 2s; }
.bird { top: 10%; right: 20%; animation-delay: 0.5s; }
.sun { top: 5%; right: 5%; font-size: 5rem; animation-delay: 0s; }
.cloud { top: 20%; left: 5%; font-size: 3rem; animation-delay: 1.5s; }
.leaf { bottom: 20%; left: 10%; animation-delay: 2s; }
.flower2 { bottom: 15%; right: 15%; animation-delay: 0.8s; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

.title-container {
    text-align: center;
    margin-bottom: 30px;
    z-index: 1;
}

.main-title {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(2.5rem, 8vw, 5rem);
    color: var(--primary-yellow);
    text-shadow: 
        4px 4px 0 var(--primary-orange),
        6px 6px 0 var(--primary-pink),
        8px 8px 15px rgba(0, 0, 0, 0.3);
    animation: titleBounce 2s ease-in-out infinite;
    margin-bottom: 10px;
}

@keyframes titleBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.subtitle {
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    color: white;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.start-content {
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

.difficulty-selector {
    background: var(--card-bg);
    padding: 25px 35px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-strong);
    text-align: center;
}

.difficulty-selector h2 {
    color: var(--dark-green);
    font-size: 1.5rem;
    margin-bottom: 15px;
    font-weight: 800;
}

.difficulty-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.diff-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 25px;
    border: none;
    border-radius: var(--border-radius);
    background: linear-gradient(145deg, #fff, #f0f0f0);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.diff-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.diff-btn.active {
    background: linear-gradient(145deg, var(--primary-green), var(--light-green));
    transform: scale(1.05);
}

.diff-icon {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.diff-label {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 1.1rem;
}

.diff-count {
    font-size: 0.85rem;
    color: #666;
}

.diff-btn.active .diff-label {
    color: white;
}

.diff-btn.active .diff-count {
    color: rgba(255, 255, 255, 0.8);
}

.start-button {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px 50px;
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    color: white;
    background: linear-gradient(145deg, var(--primary-orange), #F57C00);
    border: none;
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    box-shadow: 
        0 6px 0 #E65100,
        0 8px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    animation: buttonPulse 2s ease-in-out infinite;
}

@keyframes buttonPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

.start-button:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 8px 0 #E65100,
        0 12px 25px rgba(0, 0, 0, 0.3);
}

.start-button:active {
    transform: translateY(3px);
    box-shadow: 
        0 3px 0 #E65100,
        0 5px 10px rgba(0, 0, 0, 0.3);
}

.btn-icon {
    font-size: 1.5rem;
}

.mute-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s ease;
    z-index: 100;
}

.mute-btn:hover {
    transform: scale(1.1);
}

/* Game Screen Styles */
#game-screen {
    background: linear-gradient(180deg, #87CEEB 0%, #98FB98 50%, #32CD32 100%);
    padding: 15px;
    overflow-y: auto;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 800px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.score-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    padding: 10px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
}

.score-icon {
    font-size: 1.5rem;
    animation: starSpin 3s linear infinite;
}

@keyframes starSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

#score {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    color: var(--primary-orange);
}

.timer-container {
    position: relative;
    width: 70px;
    height: 70px;
}

.timer-ring {
    transform: rotate(-90deg);
}

.timer-ring svg {
    width: 70px;
    height: 70px;
}

.timer-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.5);
    stroke-width: 4;
}

.timer-progress {
    fill: none;
    stroke: var(--primary-orange);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

.timer-progress.warning {
    stroke: var(--primary-pink);
}

.timer-progress.danger {
    stroke: #f44336;
    animation: timerPulse 0.5s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% { stroke-width: 4; }
    50% { stroke-width: 6; }
}

#timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    color: var(--text-dark);
}

.progress-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.progress-bar {
    width: 120px;
    height: 15px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-green), var(--light-green));
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

#progress-text {
    font-size: 0.9rem;
    color: var(--text-dark);
    font-weight: 700;
}

.game-content {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.animal-prompt {
    text-align: center;
    background: var(--card-bg);
    padding: 20px 40px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-strong);
}

.prompt-text {
    font-size: 1.3rem;
    color: #666;
    margin-bottom: 10px;
    font-weight: 600;
}

.target-animal {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.target-emoji {
    font-size: 4rem;
    animation: targetBounce 1s ease-in-out infinite;
}

@keyframes targetBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.1); }
}

.target-name {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5rem;
    color: var(--primary-green);
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1);
    letter-spacing: 2px;
}

.speak-btn {
    margin-top: 15px;
    padding: 10px 25px;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    background: var(--primary-blue);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    box-shadow: 0 4px 0 #1976D2;
    transition: all 0.2s ease;
}

.speak-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #1976D2;
}

.speak-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #1976D2;
}

.animal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 12px;
    width: 100%;
    max-width: 700px;
}

.animal-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px 10px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    min-height: 100px;
}

.animal-card:hover {
    transform: scale(1.08) rotate(3deg);
    box-shadow: var(--shadow-strong);
    border-color: var(--primary-yellow);
}

.animal-card:active {
    transform: scale(0.95);
}

.animal-card .emoji {
    font-size: 3rem;
    transition: transform 0.3s ease;
}

.animal-card:hover .emoji {
    animation: emojiWiggle 0.5s ease-in-out infinite;
}

@keyframes emojiWiggle {
    0%, 100% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
}

.animal-card .name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-top: 5px;
    text-align: center;
}

/* Feedback Overlay */
.feedback-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.feedback-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.feedback-content {
    text-align: center;
    animation: feedbackPop 0.5s ease;
}

@keyframes feedbackPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.feedback-emoji {
    font-size: 6rem;
    animation: feedbackBounce 0.6s ease infinite;
}

@keyframes feedbackBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.feedback-text {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5rem;
    color: white;
    text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
    margin-top: 20px;
}

.gift-box {
    font-size: 4rem;
    margin-top: 20px;
    animation: giftPop 0.8s ease infinite;
}

.gift-box.hidden {
    display: none;
}

@keyframes giftPop {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
}

/* End Screen Styles */
#end-screen {
    background: 
        radial-gradient(circle at 30% 70%, rgba(255, 235, 59, 0.4) 0%, transparent 50%),
        radial-gradient(circle at 70% 30%, rgba(233, 30, 99, 0.4) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(33, 150, 243, 0.3) 0%, transparent 70%),
        linear-gradient(135deg, #7B1FA2 0%, #9C27B0 50%, #E040FB 100%);
    overflow-y: auto;
    z-index: 100;
    position: relative;
}

.floating-home-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 55px;
    height: 55px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--primary-blue), #1976D2);
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 200;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#start-screen .floating-home-btn {
    display: none;
}

.floating-home-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.floating-home-btn:active {
    transform: scale(0.95);
}

.celebration-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    z-index: 1;
    min-height: 60vh;
    justify-content: center;
}

.celebration-container .play-again-button,
.celebration-container .home-button {
    z-index: 200;
    position: relative;
    pointer-events: auto;
}

.trophy {
    font-size: 6rem;
    animation: trophyBounce 1s ease-in-out infinite;
}

@keyframes trophyBounce {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

.celebration-title {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(1.8rem, 6vw, 3rem);
    color: var(--primary-yellow);
    text-shadow: 
        3px 3px 0 var(--primary-orange),
        5px 5px 0 var(--primary-pink);
    animation: titleCelebrate 1s ease-in-out infinite;
    text-align: center;
    padding: 0 10px;
}

@keyframes titleCelebrate {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.final-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--card-bg);
    padding: 20px 50px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-strong);
}

.final-score-label {
    font-size: 1.2rem;
    color: #666;
    font-weight: 600;
}

.final-score-value {
    font-family: 'Fredoka One', cursive;
    font-size: 4rem;
    color: var(--primary-orange);
}

.stars-earned {
    margin: 10px 0;
}

.stars-display {
    font-size: 3rem;
    animation: starsAppear 1s ease-out;
}

@keyframes starsAppear {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); opacity: 1; }
}

.animal-gift {
    font-size: 5rem;
    animation: giftFloat 2s ease-in-out infinite;
}

@keyframes giftFloat {
    0%, 100% { transform: translateY(0) rotate(-10deg); }
    50% { transform: translateY(-15px) rotate(10deg); }
}

.play-again-button {
    padding: 20px 50px;
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    color: white;
    background: linear-gradient(145deg, var(--primary-green), var(--light-green));
    border: none;
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    box-shadow: 
        0 6px 0 var(--dark-green),
        0 8px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.play-again-button:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 8px 0 var(--dark-green),
        0 12px 25px rgba(0, 0, 0, 0.3);
}

.play-again-button:active {
    transform: translateY(3px);
    box-shadow: 
        0 3px 0 var(--dark-green),
        0 5px 10px rgba(0, 0, 0, 0.3);
}

.home-button {
    padding: 15px 35px;
    font-family: 'Fredoka One', cursive;
    font-size: 1.2rem;
    color: white;
    background: linear-gradient(145deg, var(--primary-blue), #1976D2);
    border: none;
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    box-shadow: 
        0 5px 0 #1565C0,
        0 7px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.home-button:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 7px 0 #1565C0,
        0 10px 20px rgba(0, 0, 0, 0.3);
}

.home-button:active {
    transform: translateY(2px);
    box-shadow: 
        0 3px 0 #1565C0,
        0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Canvas & Confetti */
#fireworks-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 51;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 12px;
    height: 12px;
    top: -20px;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 600px) {
    .animal-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    
    .animal-card {
        padding: 10px 5px;
        min-height: 80px;
    }
    
    .animal-card .emoji {
        font-size: 2.2rem;
    }
    
    .animal-card .name {
        font-size: 0.65rem;
    }
    
    .target-emoji {
        font-size: 3rem;
    }
    
    .target-name {
        font-size: 2rem;
    }
    
    .game-header {
        justify-content: center;
    }
    
    .difficulty-buttons {
        flex-direction: column;
    }
    
    .diff-btn {
        width: 100%;
    }
}

@media (min-width: 768px) {
    .animal-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .animal-card .emoji {
        font-size: 3.5rem;
    }
}

/* Correct answer animation */
.animal-card.correct {
    animation: correctAnswer 0.6s ease;
    background: linear-gradient(145deg, #C8E6C9, #A5D6A7);
    border-color: var(--primary-green);
}

@keyframes correctAnswer {
    0% { transform: scale(1); }
    30% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 0; }
}

/* Wrong answer animation */
.animal-card.wrong {
    animation: wrongAnswer 0.4s ease;
    background: linear-gradient(145deg, #FFCDD2, #EF9A9A);
    border-color: #f44336;
}

@keyframes wrongAnswer {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

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