/* Reset and Basic Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Nunito', sans-serif;
}

body {
    background: linear-gradient(135deg, #FFB7B2, #E2F0CB, #B5EAD7);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px 20px 0;
    color: #333;
    overflow-x: hidden;
    position: relative;
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.app-container {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 30px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    width: 90vw;
    min-height: 85vh;
    padding: 40px;
    border: 5px solid white;
    backdrop-filter: blur(10px);
}

.split-layout {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 40px;
}

.left-panel {
    flex: 1;
    min-width: 400px;
}

.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

header {
    margin-bottom: 30px;
}

/* Language Toggle — fixed floating button, top-right on all screen sizes */
.lang-toggle {
    position: fixed;
    top: 18px;
    right: 22px;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 10px 20px;
    font-size: 0.88rem;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    letter-spacing: 0.6px;
    box-shadow: 0 4px 18px rgba(102, 126, 234, 0.45),
                0 1px 4px rgba(0,0,0,0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
}

.lang-toggle:hover {
    transform: translateY(-2px) scale(1.06);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.55),
                0 2px 6px rgba(0,0,0,0.14);
}

.lang-toggle:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.lang-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Tamil font mode */
body.tamil-mode {
    font-family: 'Hind Madurai', sans-serif;
}

body.tamil-mode header h1,
body.tamil-mode #animal-name {
    font-family: 'Hind Madurai', sans-serif;
    letter-spacing: 1px;
}

body.tamil-mode .btn {
    font-family: 'Hind Madurai', sans-serif;
    letter-spacing: 0;
}



header h1 {
    font-family: 'Fredoka One', cursive;
    color: #FF6B6B;
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: 2px;
}

header p {
    font-size: 1.2rem;
    color: #4ECDC4;
    font-weight: 700;
}

.card {
    background: white;
    border-radius: 20px;
    padding: 20px 20px 32px;
    /* extra bottom so yellow badge hangs clear */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
}

.image-container {
    position: relative;
    width: 100%;
    padding-top: 66.66%;
    /* 3:2 aspect ratio */
    border-radius: 15px;
    overflow: hidden;
    background-color: #f0f0f0;
    margin-bottom: 0;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1);
    border: 4px dashed #FFD166;
}

#animal-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 1.5s cubic-bezier(0.25, 0.1, 0.25, 1);
    /* Smooth unblur */
}

.blurred {
    filter: blur(30px) brightness(0.8);
    transform: scale(1.1);
    /* Prevents blurred edges from showing container background */
}

.unblurred {
    filter: blur(0) brightness(1);
    transform: scale(1);
}

.question-mark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8rem;
    color: rgba(255, 255, 255, 0.9);
    font-family: 'Fredoka One', cursive;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    transition: opacity 0.5s ease;
    z-index: 10;
}

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

.btn {
    border: none;
    border-radius: 50px;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'Nunito', sans-serif;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.play-btn {
    background-color: #4ECDC4;
    box-shadow: 0 6px 0 #3b9e97;
}

.play-btn:hover {
    background-color: #45b8b0;
    transform: translateY(-3px);
    box-shadow: 0 9px 0 #3b9e97;
}

.play-btn:active {
    box-shadow: 0 2px 0 #3b9e97;
}

.reveal-btn {
    background-color: #FFD166;
    color: #333;
    box-shadow: 0 6px 0 #dcae44;
}

.reveal-btn:hover {
    background-color: #e6bc5c;
    transform: translateY(-3px);
    box-shadow: 0 9px 0 #dcae44;
}

.reveal-btn:active {
    box-shadow: 0 2px 0 #dcae44;
}

.next-btn {
    background-color: #FF6B6B;
    box-shadow: 0 6px 0 #d95353;
    margin: 0 auto;
    font-size: 1.5rem;
    padding: 20px 40px;
}

.next-btn:hover {
    background-color: #e65c5c;
    transform: translateY(-3px);
    box-shadow: 0 9px 0 #d95353;
}

.next-btn:active {
    box-shadow: 0 2px 0 #d95353;
}

.animal-name-container {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%) rotate(-2deg);
    background-color: #FFE66D;
    border: 3px dashed #FF6B6B;
    border-radius: 12px;
    padding: 10px 28px;
    z-index: 20;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    white-space: nowrap;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    text-align: center;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0) rotate(-10deg);
    }

    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1) rotate(-2deg);
    }
}

#animal-name {
    font-family: 'Fredoka One', cursive;
    color: #1A535C;
    font-size: 2rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.6);
}

.navigation {
    margin-top: 30px;
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hidden {
    display: none !important;
}

footer {
    margin-top: 30px;
    color: #505050;
    font-weight: 700;
    text-align: center;
}

/* Page-level footer */
.page-footer {
    width: 100%;
    text-align: center;
    padding: 14px 20px;
    margin-top: 16px;
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    letter-spacing: 0.5px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.page-footer strong {
    color: #fff;
    font-weight: 800;
    letter-spacing: 1px;
}

/* Confetti styling */
.confetti {
    position: fixed;   /* viewport-relative, not affected by body's flex layout */
    top: -20px;
    z-index: 9999;
    pointer-events: none;
    animation: fall 3s ease-in forwards;
}

@keyframes fall {
    0% {
        transform: translateY(0) translateX(0px) rotate(0deg);
        opacity: 1;
    }

    70% {
        opacity: 1;
    }

    100% {
        transform: translateY(105vh) translateX(var(--drift, 0px)) rotate(780deg);
        opacity: 0;
    }
}

/* Sound wave animation logic */
.playing-animation {
    animation: pulse 1s infinite;
}

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

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* Responsive */
@media (max-width: 850px) {
    .app-container {
        width: 95vw;
        padding: 20px;
        min-height: auto;
    }

    .split-layout {
        flex-direction: column;
        gap: 20px;
    }

    .left-panel {
        min-width: 100%;
        width: 100%;
    }

    header h1 {
        font-size: 2.2rem;
    }

    .btn {
        padding: 12px 20px;
        font-size: 1rem;
        width: 100%;
    }

    .controls {
        flex-direction: column;
    }

    .question-mark {
        font-size: 6rem;
    }

    #animal-name {
        font-size: 1.6rem;
        letter-spacing: 2px;
    }

    /* Compact lang button on mobile — globe icon only */
    .lang-toggle {
        top: 12px;
        right: 14px;
        padding: 9px 14px;
        font-size: 0.82rem;
        gap: 5px;
    }
}