:root {
    --bg-color: #fce4ec; /* Soft pink */
    --card-color: #ffffff;
}

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

body {
    font-family: 'Comic Sans MS', sans-serif;
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    touch-action: manipulation;
}

header {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.back-btn {
    font-size: 2rem;
    text-decoration: none;
    margin-right: 15px;
}

h1 {
    font-size: 1.8rem;
    color: #4caf50; /* Green */
    flex-grow: 1;
    text-align: center;
}

.animal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

@media (min-width: 500px) {
    .animal-grid { grid-template-columns: repeat(3, 1fr); }
}

.animal {
    background: var(--card-color);
    border: none;
    border-radius: 20px;
    font-size: 5rem; /* Big emojis! */
    padding: 20px 0;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    touch-action: manipulation; /* Prevent delay */
    outline: none;
}

.animal:active {
    transform: scale(0.9);
}

.animal.wiggling {
    animation: wiggle 0.5s ease-in-out;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
    75% { transform: rotate(-5deg); }
}

/* Sound text pop up */
.sound-text {
    position: absolute;
    font-size: 2rem;
    font-weight: bold;
    color: #ff4081;
    pointer-events: none;
    animation: floatAway 1s ease-out forwards;
    z-index: 100;
}

@keyframes floatAway {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-50px) scale(1.5); opacity: 0; }
}

.animal.grow-bounce {
    animation: growBounce 0.4s ease-out;
}

@keyframes growBounce {
    0% { transform: scale(1); }
    40% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

.rainbow-ring {
    position: fixed;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 4px solid transparent;
    border-top-color: #ff6b6b;
    border-right-color: #feca57;
    border-bottom-color: #48dbfb;
    border-left-color: #ff9ff3;
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: rainbowExpand 0.7s ease-out forwards;
    z-index: 50;
}

@keyframes rainbowExpand {
    0% { width: 20px; height: 20px; opacity: 1; }
    100% { width: 120px; height: 120px; opacity: 0; }
}

.fullscreen-btn {
    font-size: 1.5rem;
    background: rgba(255,255,255,0.8);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.2s;
    flex-shrink: 0;
    text-decoration: none;
    color: inherit;
}
.fullscreen-btn:active {
    transform: scale(0.9);
}