:root {
    --primary: #FF6B6B;
    --secondary: #4ECDC4;
    --tertiary: #FFE66D;
    --quaternary: #9D4EDD;
    --quinary: #FF9F1C;
    --bg-color: #F7FFF7;
    --text-color: #2F3E46;
    --card-bg: #FFFFFF;

    --color-0: #FF6B6B;
    /* Red */
    --color-1: #4ECDC4;
    /* Teal */
    --color-2: #FFE66D;
    /* Yellow */
    --color-3: #9D4EDD;
    /* Purple */
    --color-4: #FF9F1C;
    /* Orange */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    text-align: center;
    overflow-x: hidden;
    background-image: radial-gradient(var(--secondary) 1px, transparent 1px);
    background-size: 30px 30px;
    background-position: 0 0, 15px 15px;
    background-attachment: fixed;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

/* --- Hero Section --- */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--quinary));
    color: white;
    padding: 30px 20px 40px;
    border-radius: 0 0 40px 40px;
    box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3);
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.hero::after {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 5px;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.2);
    animation: bounceIn 1s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 700;
}

/* --- Mode Switch --- */
.mode-switch {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
}

.mode-btn {
    font-family: 'Nunito', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    padding: 12px 24px;
    border: none;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: inset 0 0 0 2px transparent;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.mode-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* --- Grid Section --- */
.alphabet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.alphabet-grid.hidden-section,
.blending-area.hidden-section {
    display: none;
}

.letter-btn {
    font-family: 'Nunito', sans-serif;
    font-size: 3.5rem;
    font-weight: 900;
    border: none;
    border-radius: 24px;
    aspect-ratio: 1;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.15), 0 15px 20px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.letter-btn::before {
    content: '';
    position: absolute;
    top: 5%;
    left: 5%;
    width: 30%;
    height: 15%;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50px;
    transform: rotate(-10deg);
}

.letter-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 0 rgba(0, 0, 0, 0.15), 0 20px 25px rgba(0, 0, 0, 0.15);
}

.letter-btn:active {
    transform: translateY(5px);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.15), 0 5px 10px rgba(0, 0, 0, 0.1);
}

/* Color Classes */
.color-0 {
    background: var(--color-0);
}

.color-1 {
    background: var(--color-1);
}

.color-2 {
    background: var(--color-2);
    color: #333;
}

.color-3 {
    background: var(--color-3);
}

.color-4 {
    background: var(--color-4);
}

.slot-color-0 {
    background: var(--color-0);
}

.slot-color-1 {
    background: var(--color-1);
}

.slot-color-2 {
    background: var(--color-4);
}

.slot-color-3 {
    background: var(--color-3);
}

.slot-color-4 {
    background: var(--color-2);
    color: #333;
}

/* --- Play Area Modal --- */
.play-area {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 100;
    display: flex;
    justify-content: center;
    flex-direction: row;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.play-area.hidden {
    opacity: 0;
    pointer-events: none;
}

.card {
    background: var(--card-bg);
    border-radius: 40px;
    padding: 30px;
    width: 90%;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    border: 8px solid var(--primary);
    position: relative;
    cursor: pointer;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin: 0 20px;
}

.card:hover {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}

.card-image {
    font-size: 8rem;
    margin-bottom: 20px;
    line-height: 1;
    display: inline-block;
    filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.2));
}

.card-letter {
    font-size: 6rem;
    color: var(--primary);
    margin: 0;
    line-height: 1;
}

.card-word {
    font-size: 2.5rem;
    color: var(--text-color);
    font-weight: 900;
    margin-top: 10px;
}

.card-english,
.blending-english {
    font-size: 1.5rem;
    color: var(--quinary);
    font-weight: 700;
    margin-top: 5px;
    font-style: italic;
}

.blending-english {
    margin-top: -20px;
    margin-bottom: 20px;
}

.close-btn {
    position: absolute;
    top: -20px;
    right: -20px;
    background: white;
    border: 5px solid #ff4757;
    color: #ff4757;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.close-btn:hover {
    transform: scale(1.1) rotate(90deg);
}

.nav-btn {
    background: white;
    border: 5px solid var(--secondary);
    color: var(--secondary);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    transform: scale(1.1);
    background: var(--secondary);
    color: white;
}

.nav-btn:active {
    transform: scale(0.95);
}

/* --- Blending Area --- */
.blending-area {
    background: white;
    border-radius: 40px;
    padding: 40px 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border: 5px dashed var(--quaternary);
    margin: 20px 0;
    animation: fadeIn 0.5s ease;
}

.blending-image {
    font-size: 7rem;
    margin-bottom: 30px;
    display: inline-block;
    filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.15));
}

.letter-slots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.slot-btn {
    font-family: 'Nunito', sans-serif;
    font-size: 4rem;
    font-weight: 900;
    border: none;
    border-radius: 20px;
    width: 100px;
    height: 120px;
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.15);
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
}

.slot-btn::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    width: 30%;
    height: 15%;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 20px;
}

.slot-btn:active {
    transform: translateY(8px);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

.plus-sign {
    font-size: 2.5rem;
    font-weight: 900;
    color: #ccc;
}

.read-btn {
    font-family: 'Nunito', sans-serif;
    font-size: 2rem;
    font-weight: 900;
    padding: 15px 40px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(to bottom, #4cd137, #44bd32);
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 0 #2e8622, 0 15px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
    margin-bottom: 20px;
    display: inline-flex;
    align-items: center;
    gap: 15px;
}

.read-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 11px 0 #2e8622, 0 20px 25px rgba(0, 0, 0, 0.2);
}

.read-btn:active,
.read-btn.playing {
    transform: translateY(8px);
    box-shadow: 0 0 0 #2e8622, 0 5px 10px rgba(0, 0, 0, 0.2);
}

.read-btn.playing {
    background: linear-gradient(to bottom, #e1b12c, #fbc531);
    box-shadow: 0 0 0 #c23616;
}

.next-btn {
    display: block;
    margin: 20px auto 0;
    font-family: 'Nunito', sans-serif;
    font-size: 1.2rem;
    font-weight: 800;
    padding: 12px 30px;
    border: none;
    border-radius: 30px;
    background: #f1f2f6;
    color: #2f3542;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.next-btn:hover {
    background: #eccc68;
    color: #2f3542;
    transform: translateY(-2px);
}

/* --- 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 popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0);
    }

    50% {
        transform: translateY(-15px) rotate(5deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 600px) {
    .alphabet-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 15px;
    }

    .letter-btn {
        font-size: 2.5rem;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .slot-btn {
        width: 70px;
        height: 90px;
        font-size: 2.5rem;
    }

    .plus-sign {
        font-size: 1.5rem;
    }

    .read-btn {
        font-size: 1.5rem;
        padding: 12px 25px;
    }

    .nav-btn {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
}