:root {
    --bg-color: #f0f8ff;
    /* Alice Blue */
    --primary: #ff6b6b;
    --secondary: #4ecdc4;
    --tertiary: #ffe66d;
    --quaternary: #1a535c;
    --text: #2b2d42;
    --card-bg: rgba(255, 255, 255, 0.95);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(255, 107, 107, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(78, 205, 196, 0.1) 0%, transparent 20%);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    user-select: none;
    /* Prevent text selection for toddlers tapping wildly */
    -webkit-tap-highlight-color: transparent;
    /* Remove tap highlight on mobile */
}

.hero {
    text-align: center;
    padding: 2rem 1rem;
    margin-bottom: 1rem;
    animation: bounceIn 1s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--primary);
    text-shadow: 2px 2px 0px #fff, 4px 4px 0px rgba(0, 0, 0, 0.1);
    letter-spacing: 2px;
}

.hero p {
    font-size: 1.5rem;
    color: var(--quaternary);
    margin-top: 0.5rem;
    font-weight: 700;
}

.container {
    width: 100%;
    max-width: 1200px;
    padding: 0 1rem 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.alphabet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 1.5rem;
    width: 100%;
    padding: 1rem;
}

.letter-btn {
    background: var(--card-bg);
    border: 4px solid var(--secondary);
    border-radius: 20px;
    font-size: 4rem;
    font-weight: 900;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

/* Add a fun shine effect on hover */
.letter-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(45deg) translateY(100%);
    transition: all 0.5s ease;
}

.letter-btn:hover::after {
    transform: rotate(45deg) translateY(-100%);
}

.letter-btn:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.15);
    border-color: var(--tertiary);
}

.letter-btn:active {
    transform: translateY(5px) scale(0.95);
}

/* Play Area (Modal Style) */
.play-area {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.play-area.hidden {
    opacity: 0;
    pointer-events: none;
}

.card {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: 40px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    border: 8px solid var(--tertiary);
    position: relative;
    transform: scale(1);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    /* Suggests it can be tapped again */
}

.play-area.hidden .card {
    transform: scale(0.5);
}

.nav-btn {
    background: #FF6B6B;
    color: white;
    border: 4px solid white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    margin: 0 -20px;
}

.nav-btn:active {
    transform: scale(0.9);
    background: #e55a5a;
}

@media (max-width: 480px) {
    .nav-btn {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
        margin: 0 -10px;
    }
}

.close-btn {
    position: absolute;
    top: -20px;
    right: -20px;
    background: #ff6b6b;
    color: white;
    border: 4px solid white;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.close-btn:hover {
    transform: scale(1.1) rotate(90deg);
}

.card-image {
    font-size: 8rem;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

.card-letter {
    font-size: 6rem;
    color: var(--primary);
    margin-bottom: 0px;
    line-height: 1;
}

.card-word {
    font-size: 3rem;
    color: var(--quaternary);
    font-weight: 900;
    margin-top: 0.5rem;
}

/* Animations */
@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-15px);
    }

    100% {
        transform: translateY(0px);
    }
}

/* Colors for buttons based on index to make it rainbow-like */
.color-0 {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.color-1 {
    border-color: #4ecdc4;
    color: #4ecdc4;
}

.color-2 {
    border-color: #fca311;
    color: #fca311;
}

.color-3 {
    border-color: #1a535c;
    color: #1a535c;
}

.color-4 {
    border-color: #9d4edd;
    color: #9d4edd;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .hero h1 {
        font-size: 2.8rem;
    }

    .hero p {
        font-size: 1.2rem;
    }

    .letter-btn {
        font-size: 3.5rem;
    }

    .card-image {
        font-size: 6rem;
    }

    .card-letter {
        font-size: 4.5rem;
    }

    .card-word {
        font-size: 2.5rem;
    }

    .alphabet-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
}

/* --- Stage 2: Blending Board Styles --- */

/* Mode Switch Navigation */
.mode-switch {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.mode-btn {
    background: white;
    border: 3px solid var(--secondary);
    color: var(--quaternary);
    padding: 0.8rem 1.5rem;
    font-size: 1.2rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.mode-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.mode-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.2);
    transform: translateY(2px);
}

/* Hidden Section Helper */
.hidden-section {
    display: none !important;
}

/* Blending Area Layout */
.blending-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 800px;
    background: var(--card-bg);
    border-radius: 40px;
    padding: 3rem 2rem;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    border: 8px solid var(--secondary);
    animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.blending-image {
    font-size: 8rem;
    margin-bottom: 2rem;
    animation: float 4s ease-in-out infinite;
    text-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

/* Letter Slots (C-V-C) */
.letter-slots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
    /* for small screens */
}

.plus-sign {
    font-size: 3rem;
    color: #ccc;
    font-weight: 900;
}

.slot-btn {
    width: 100px;
    height: 120px;
    background: white;
    border: 5px solid;
    border-radius: 20px;
    font-size: 5rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    justify-content: center;
    align-items: center;
}

.slot-btn:hover {
    transform: scale(1.1) translateY(-5px);
}

.slot-btn:active {
    transform: scale(0.95);
}

.slot-color-0 {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.slot-color-1 {
    border-color: #4ecdc4;
    color: #4ecdc4;
}

.slot-color-2 {
    border-color: #fca311;
    color: #fca311;
}

/* Read it & Next Buttons */
.read-btn {
    background: linear-gradient(135deg, #FFE66D, #FFD166);
    color: var(--quaternary);
    border: 6px solid #FF9F1C;
    padding: 1.5rem 4rem;
    font-size: 3rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    border-radius: 60px;
    cursor: pointer;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    animation: idlePulse 2.5s infinite;
}

.read-btn:hover {
    transform: scale(1.1) translateY(-5px);
    background: #FFD166;
    animation: none;
}

.read-btn:active {
    transform: scale(0.95);
}

.read-btn.playing {
    animation: playingPulse 0.5s infinite;
    background: #4ECDC4;
    border-color: #1A535C;
    color: white;
}

@keyframes idlePulse {
    0% {
        transform: scale(1);
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 20px 40px rgba(255, 159, 28, 0.4);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    }
}

@keyframes playingPulse {
    0% {
        transform: scale(1.1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1.1);
    }
}

.next-btn {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 1.5rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    cursor: pointer;
    text-decoration: underline;
    transition: opacity 0.2s;
}

.next-btn:hover {
    opacity: 0.7;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 230, 109, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 20px rgba(255, 230, 109, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 230, 109, 0);
    }
}

@media (max-width: 600px) {
    .blending-area {
        padding: 2rem 1rem;
        border-width: 5px;
    }

    .slot-btn {
        width: 70px;
        height: 90px;
        font-size: 3.5rem;
    }

    .plus-sign {
        font-size: 2rem;
    }

    .read-btn {
        font-size: 2rem;
        padding: 0.8rem 2rem;
    }

    .blending-image {
        font-size: 6rem;
        margin-bottom: 1rem;
    }
}