/* ===== CSS Variables ===== */
:root {
    --sky-light: #87CEEB;
    --sky-mid: #5BB5E0;
    --grass-light: #7CB342;
    --grass-dark: #558B2F;
    --sun-yellow: #FFD93D;
    --sun-glow: #FFF176;
    --cloud-white: #ffffff;
    
    --letter-c: #FF6B6B;
    --letter-c-dark: #E85555;
    --letter-a: #4ECDC4;
    --letter-a-dark: #3DB8B0;
    --letter-t: #FFE66D;
    --letter-t-dark: #E6CF5C;
    
    --cat-orange: #FF9F43;
    --cat-dark: #E08833;
    --cat-pink: #FFB6C1;
    
    --text-dark: #2D3436;
    --text-light: #636E72;
    --white: #FFFFFF;
    
    --card-bg: rgba(255, 255, 255, 0.95);
    --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.1);
    --shadow-button: 0 6px 20px rgba(0, 0, 0, 0.15);
    
    --font-display: 'Fredoka', sans-serif;
    --font-body: 'Nunito', sans-serif;
    
    --transition-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(180deg, var(--sky-light) 0%, var(--sky-mid) 60%, var(--grass-light) 100%);
    min-height: 100vh;
    color: var(--text-dark);
}

/* Prevent scroll while dragging slider on touch devices */
body.dragging-slider {
    overflow: hidden;
    touch-action: none;
    -webkit-overflow-scrolling: auto;
}

body.dragging-slider * {
    touch-action: none;
}

/* ===== Admin Button ===== */
.admin-btn {
    position: fixed;
    top: 15px;
    right: 15px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    text-decoration: none;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    opacity: 0.6;
}

.admin-btn:hover {
    opacity: 1;
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.letters-btn {
    position: fixed;
    top: 15px;
    right: 70px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    text-decoration: none;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    opacity: 0.6;
}

.letters-btn:hover {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.words-btn {
    position: fixed;
    top: 15px;
    right: 125px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    text-decoration: none;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    opacity: 0.6;
}

.words-btn:hover {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Quiz Navigation Buttons */
.nav-btn {
    position: fixed;
    top: 15px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    opacity: 0.6;
    color: #558B2F;
}

.nav-btn:hover {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.nav-prev {
    right: 235px;
}

.nav-next {
    right: 180px;
}

/* ===== Meadow Background ===== */
.meadow-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* Allow clicks on interactive elements */
.meadow-bg .cloud,
.meadow-bg .butterfly {
    pointer-events: auto;
}

.grass {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 25%;
    background: linear-gradient(180deg, var(--grass-light) 0%, var(--grass-dark) 100%);
    border-radius: 50% 50% 0 0 / 20% 20% 0 0;
}

.grass::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    height: 40px;
    background: 
        radial-gradient(ellipse 30px 20px at 10% 100%, var(--grass-light) 50%, transparent 50%),
        radial-gradient(ellipse 25px 18px at 25% 100%, var(--grass-dark) 50%, transparent 50%),
        radial-gradient(ellipse 35px 22px at 40% 100%, var(--grass-light) 50%, transparent 50%),
        radial-gradient(ellipse 28px 19px at 55% 100%, var(--grass-dark) 50%, transparent 50%),
        radial-gradient(ellipse 32px 21px at 70% 100%, var(--grass-light) 50%, transparent 50%),
        radial-gradient(ellipse 26px 17px at 85% 100%, var(--grass-dark) 50%, transparent 50%),
        radial-gradient(ellipse 30px 20px at 95% 100%, var(--grass-light) 50%, transparent 50%);
}

.sun {
    position: absolute;
    top: 30px;
    right: 50px;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, var(--sun-glow) 0%, var(--sun-yellow) 50%, transparent 70%);
    border-radius: 50%;
    animation: sun-pulse 4s ease-in-out infinite;
}

@keyframes sun-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.9; }
}

.cloud {
    position: absolute;
    background: var(--cloud-white);
    border-radius: 50px;
    opacity: 0.9;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.1s ease;
}

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

.cloud.popping {
    animation: pop-away 0.4s ease-out forwards !important;
}

.cloud.popping::before,
.cloud.popping::after {
    animation: pop-away-part 0.4s ease-out forwards !important;
}

@keyframes pop-away-part {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 0; }
}

@keyframes pop-away {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.5; }
    100% { transform: scale(0); opacity: 0; visibility: hidden; }
}

.cloud::before, .cloud::after {
    content: '';
    position: absolute;
    background: var(--cloud-white);
    border-radius: 50%;
}

.cloud-1 {
    top: 60px;
    left: 10%;
    width: 100px;
    height: 40px;
    animation: cloud-drift 25s linear infinite;
}

.cloud-1::before {
    width: 50px;
    height: 50px;
    top: -25px;
    left: 15px;
}

.cloud-1::after {
    width: 40px;
    height: 40px;
    top: -20px;
    left: 45px;
}

.cloud-2 {
    top: 120px;
    left: 60%;
    width: 80px;
    height: 32px;
    animation: cloud-drift 30s linear infinite reverse;
}

.cloud-2::before {
    width: 40px;
    height: 40px;
    top: -20px;
    left: 10px;
}

.cloud-2::after {
    width: 35px;
    height: 35px;
    top: -15px;
    left: 35px;
}

.cloud-3 {
    top: 180px;
    left: 30%;
    width: 70px;
    height: 28px;
    animation: cloud-drift 20s linear infinite;
    animation-delay: -5s;
}

.cloud-3::before {
    width: 35px;
    height: 35px;
    top: -18px;
    left: 8px;
}

.cloud-3::after {
    width: 30px;
    height: 30px;
    top: -12px;
    left: 32px;
}

@keyframes cloud-drift {
    0% { transform: translateX(-100px); }
    100% { transform: translateX(calc(100vw + 100px)); }
}

.butterfly {
    position: absolute;
    font-size: 24px;
    animation: flutter 8s ease-in-out infinite;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.1s ease;
}

.butterfly:active {
    transform: scale(1.2);
}

.butterfly.popping {
    animation: butterfly-pop 0.5s ease-out forwards;
}

@keyframes butterfly-pop {
    0% { transform: scale(1) rotate(0deg); opacity: 1; }
    25% { transform: scale(1.5) rotate(15deg); opacity: 0.8; }
    50% { transform: scale(1.8) rotate(-10deg); opacity: 0.5; }
    100% { transform: scale(0) rotate(45deg); opacity: 0; }
}

.butterfly-1 {
    top: 25%;
    left: 15%;
    animation-delay: 0s;
}

.butterfly-2 {
    top: 35%;
    right: 20%;
    animation-delay: -4s;
}

@keyframes flutter {
    0%, 100% { 
        transform: translate(0, 0) rotate(0deg); 
    }
    25% { 
        transform: translate(30px, -20px) rotate(10deg); 
    }
    50% { 
        transform: translate(60px, 10px) rotate(-5deg); 
    }
    75% { 
        transform: translate(30px, 30px) rotate(5deg); 
    }
}

.flower {
    position: absolute;
    bottom: 5%;
    font-size: 32px;
    animation: sway 3s ease-in-out infinite;
}

.flower-1 { left: 5%; animation-delay: 0s; }
.flower-2 { left: 25%; animation-delay: -0.5s; font-size: 28px; }
.flower-3 { right: 30%; animation-delay: -1s; }
.flower-4 { right: 8%; animation-delay: -1.5s; font-size: 36px; }

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

/* ===== Main Container ===== */
.container {
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ===== Header ===== */
header {
    text-align: center;
    margin-bottom: 20px;
    animation: fadeInDown 0.8s ease-out;
}

.title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 8vw, 3rem);
    font-weight: 700;
    color: var(--white);
    text-shadow: 
        3px 3px 0 var(--grass-dark),
        -1px -1px 0 var(--grass-dark),
        1px -1px 0 var(--grass-dark),
        -1px 1px 0 var(--grass-dark);
    letter-spacing: 2px;
}

.subtitle {
    font-family: var(--font-body);
    font-size: 1.2rem;
    color: var(--white);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    margin-top: 8px;
    font-weight: 600;
}

/* ===== Word Card ===== */
.word-card {
    background: var(--card-bg);
    border-radius: 30px;
    padding: 30px;
    box-shadow: var(--shadow-soft);
    width: 100%;
    max-width: 500px;
    min-width: 350px;
    min-height: 350px;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

/* ===== Cat Illustration ===== */
.cat-illustration {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    cursor: pointer;
    transition: transform 0.3s var(--transition-bounce);
}

.cat-illustration:hover {
    transform: scale(1.05);
}

.cat-illustration:active {
    transform: scale(0.95);
}

.cat {
    position: relative;
    width: 120px;
    height: 140px;
}

.cat-head {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 70px;
    background: var(--cat-orange);
    border-radius: 50% 50% 45% 45%;
    z-index: 2;
}

.cat-ear {
    position: absolute;
    top: 5px;
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-bottom: 30px solid var(--cat-orange);
    z-index: 1;
}

.cat-ear::after {
    content: '';
    position: absolute;
    top: 8px;
    left: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 18px solid var(--cat-pink);
}

.cat-ear-left {
    left: 18px;
    transform: rotate(-15deg);
}

.cat-ear-right {
    right: 18px;
    transform: rotate(15deg);
}

.cat-eye {
    position: absolute;
    top: 22px;
    width: 18px;
    height: 20px;
    background: var(--white);
    border-radius: 50%;
    overflow: hidden;
}

.cat-eye-left { left: 15px; }
.cat-eye-right { right: 15px; }

.pupil {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 14px;
    background: #2D3436;
    border-radius: 50%;
    animation: blink 4s ease-in-out infinite;
}

.pupil::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
}

@keyframes blink {
    0%, 90%, 100% { transform: translateX(-50%) scaleY(1); }
    95% { transform: translateX(-50%) scaleY(0.1); }
}

.cat-nose {
    position: absolute;
    top: 42px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 10px;
    background: var(--cat-pink);
    border-radius: 50% 50% 40% 40%;
}

.cat-mouth {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 10px;
    border: 3px solid var(--cat-dark);
    border-top: none;
    border-radius: 0 0 50% 50%;
    background: transparent;
}

.whisker {
    position: absolute;
    top: 45px;
    width: 25px;
    height: 2px;
    background: var(--cat-dark);
    border-radius: 2px;
}

.whisker-left-1 { left: -15px; transform: rotate(-10deg); }
.whisker-left-2 { left: -18px; top: 50px; transform: rotate(0deg); }
.whisker-left-3 { left: -15px; top: 55px; transform: rotate(10deg); }
.whisker-right-1 { right: -15px; transform: rotate(10deg); }
.whisker-right-2 { right: -18px; top: 50px; transform: rotate(0deg); }
.whisker-right-3 { right: -15px; top: 55px; transform: rotate(-10deg); }

.cat-body {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 50px;
    background: var(--cat-orange);
    border-radius: 50% 50% 40% 40%;
    z-index: 1;
}

.cat-tail {
    position: absolute;
    bottom: 25px;
    right: 5px;
    width: 40px;
    height: 12px;
    background: var(--cat-orange);
    border-radius: 10px;
    transform-origin: left center;
    animation: tail-wag 1s ease-in-out infinite;
}

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

.cat-paw {
    position: absolute;
    bottom: 0;
    width: 20px;
    height: 15px;
    background: var(--cat-orange);
    border-radius: 50%;
}

.cat-paw-left { left: 25px; }
.cat-paw-right { right: 25px; }

/* Cat animation on click */
.cat-illustration.meow .cat-head {
    animation: meow-head 0.5s ease-in-out;
}

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

/* ===== Letter Display ===== */
.word-display {
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.letter-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    width: 100%;
    max-width: 350px;
    min-height: 110px;
}

.letter {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 90px;
    height: 110px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s var(--transition-bounce);
    font-family: var(--font-display);
    position: relative;
    overflow: hidden;
}

.letter:nth-child(1) {
    background: linear-gradient(145deg, var(--letter-c), var(--letter-c-dark));
    box-shadow: 0 8px 0 var(--letter-c-dark), var(--shadow-button);
}

.letter:nth-child(2) {
    background: linear-gradient(145deg, var(--letter-a), var(--letter-a-dark));
    box-shadow: 0 8px 0 var(--letter-a-dark), var(--shadow-button);
}

.letter:nth-child(3) {
    background: linear-gradient(145deg, var(--letter-t), var(--letter-t-dark));
    box-shadow: 0 8px 0 var(--letter-t-dark), var(--shadow-button);
}

.letter:hover {
    transform: translateY(-5px) scale(1.05);
}

.letter:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 currentColor, 0 2px 10px rgba(0,0,0,0.2);
}

.letter-char {
    font-size: 3rem;
    font-weight: 700;
    color: var(--white);
    text-shadow: 2px 2px 0 rgba(0,0,0,0.2);
    line-height: 1;
}

.letter-sound {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    margin-top: 5px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.letter:hover .letter-sound,
.letter.active .letter-sound {
    opacity: 1;
    transform: translateY(0);
}

.letter.active {
    animation: letter-pop 0.4s ease-out;
}

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

/* ===== Sound Slider ===== */
.slider-container {
    position: relative;
    width: 100%;
    max-width: 350px;
    height: 70px;
    margin: 20px 0 10px;
    touch-action: none;
}

.slider-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 24px;
    transform: translateY(-50%);
    border-radius: 12px;
    display: flex;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
    overflow: hidden;
}

.slider-zone {
    flex: 1;
    height: 100%;
    position: relative;
}

.slider-zone::after {
    content: attr(data-letter);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    color: rgba(255,255,255,0.6);
    text-shadow: 1px 1px 1px rgba(0,0,0,0.2);
}

.slider-zone.active::after {
    color: white;
    font-size: 1.1rem;
}

.slider-handle {
    position: absolute;
    top: 50%;
    left: 0;
    width: 60px;
    height: 60px;
    transform: translate(-50%, -50%);
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border-radius: 50%;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 4px 15px rgba(0,0,0,0.2),
        0 2px 4px rgba(0,0,0,0.1),
        inset 0 2px 4px rgba(255,255,255,0.8);
    transition: transform 0.1s ease, box-shadow 0.2s ease, left 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 10;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    -webkit-touch-callout: none;
}

/* Bigger touch target on mobile */
@media (pointer: coarse) {
    .slider-handle {
        width: 80px;
        height: 80px;
    }
    
    .slider-handle::before {
        content: '';
        position: absolute;
        width: 120px;
        height: 120px;
        border-radius: 50%;
    }
    
    .slider-container {
        height: 80px;
        margin: 20px 0 10px;
        width: 100%;
        max-width: 350px;
    }
    
    .slider-track {
        height: 50px;
    }
    
    .handle-icon {
        font-size: 2.2rem;
    }
    
    .letter-container {
        max-width: 350px;
    }
}

.slider-handle:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 
        0 6px 20px rgba(0,0,0,0.25),
        0 3px 6px rgba(0,0,0,0.15),
        inset 0 2px 4px rgba(255,255,255,0.8);
}

.slider-handle:active,
.slider-handle.dragging {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: 
        0 8px 25px rgba(0,0,0,0.3),
        0 4px 8px rgba(0,0,0,0.2),
        inset 0 2px 4px rgba(255,255,255,0.8);
    transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.handle-icon {
    font-size: 1.8rem;
    pointer-events: none;
    animation: wiggle 2s ease-in-out infinite;
}

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

.slider-handle.dragging .handle-icon {
    animation: none;
}

.slider-hint {
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-light);
    margin-top: 5px;
    font-weight: 600;
}

/* Letter highlight when slider is under it */
.letter.slider-active {
    transform: scale(1.15);
    filter: brightness(1.1);
}

/* ===== Controls ===== */
.controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: nowrap; /* Prevent wrapping on initial load */
    width: 100%;
    min-height: 50px;
}

.btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    border: none;
    border-radius: 50px;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--transition-bounce);
    white-space: nowrap; /* Prevent text wrapping */
    flex-shrink: 0; /* Don't shrink buttons */
}

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

.btn-sound {
    background: linear-gradient(145deg, #A8E6CF, #88D8B0);
    color: #2D5A3F;
    box-shadow: 0 6px 0 #6BC89A, var(--shadow-button);
}

.btn-sound:hover {
    transform: translateY(-3px);
    box-shadow: 0 9px 0 #6BC89A, var(--shadow-button);
}

.btn-sound:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #6BC89A;
}

.btn-blend {
    background: linear-gradient(145deg, #81C784, #66BB6A);
    color: #1B5E20;
    box-shadow: 0 6px 0 #4CAF50, var(--shadow-button);
}

.btn-blend:hover {
    transform: translateY(-3px);
    box-shadow: 0 9px 0 #4CAF50, var(--shadow-button);
}

.btn-blend:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #4CAF50;
}

.btn-blend-fast {
    background: linear-gradient(145deg, #FFB74D, #FFA726);
    color: #E65100;
    box-shadow: 0 6px 0 #FB8C00, var(--shadow-button);
}

.btn-blend-fast:hover {
    transform: translateY(-3px);
    box-shadow: 0 9px 0 #FB8C00, var(--shadow-button);
}

.btn-blend-fast:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #FB8C00;
}

.btn-blend-faster {
    background: linear-gradient(145deg, #EF5350, #E53935);
    color: white;
    box-shadow: 0 6px 0 #C62828, var(--shadow-button);
}

.btn-blend-faster:hover {
    transform: translateY(-3px);
    box-shadow: 0 9px 0 #C62828, var(--shadow-button);
}

.btn-blend-faster:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #C62828;
}

.btn-blend-3x {
    background: linear-gradient(145deg, #AB47BC, #8E24AA);
    color: white;
    box-shadow: 0 6px 0 #6A1B9A, var(--shadow-button);
}

.btn-blend-3x:hover {
    transform: translateY(-3px);
    box-shadow: 0 9px 0 #6A1B9A, var(--shadow-button);
}

.btn-blend-3x:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #6A1B9A;
}

.btn-blend-4x {
    background: linear-gradient(145deg, #26C6DA, #00ACC1);
    color: white;
    box-shadow: 0 6px 0 #00838F, var(--shadow-button);
}

.btn-blend-4x:hover {
    transform: translateY(-3px);
    box-shadow: 0 9px 0 #00838F, var(--shadow-button);
}

.btn-blend-4x:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #00838F;
}

.btn-again {
    background: linear-gradient(145deg, var(--sun-yellow), #F4C430);
    color: #5D4E0B;
    box-shadow: 0 6px 0 #DAA520, var(--shadow-button);
}

.btn-again:hover {
    transform: translateY(-3px);
    box-shadow: 0 9px 0 #DAA520, var(--shadow-button);
}

.btn-again:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #DAA520;
}

/* ===== Instruction Bubble ===== */
.instruction-bubble {
    background: linear-gradient(145deg, #FFF9C4, #FFF59D);
    border-radius: 20px;
    padding: 15px 25px;
    text-align: center;
    position: relative;
    animation: float 3s ease-in-out infinite;
}

.instruction-bubble::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 12px solid #FFF9C4;
}

.instruction-bubble p {
    font-size: 1.1rem;
    font-weight: 600;
    color: #5D4E0B;
    margin: 0;
}

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

/* ===== Celebration ===== */
.celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: rgba(135, 206, 235, 0.95);
    animation: fadeIn 0.5s ease-out;
}

.celebration.hidden {
    display: none;
}

.celebration-content {
    text-align: center;
    background: var(--card-bg);
    padding: 40px 60px;
    border-radius: 30px;
    box-shadow: var(--shadow-soft);
    animation: celebrationPop 0.6s var(--transition-bounce);
}

.celebration-content h2 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: var(--text-dark);
    margin-bottom: 15px;
}

.celebration-content p {
    font-size: 1.5rem;
    color: var(--text-light);
    margin-bottom: 25px;
}

.celebration-content strong {
    color: var(--letter-c);
    font-family: var(--font-display);
    font-size: 2rem;
}

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

/* ===== Confetti ===== */
.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    animation: confetti-fall 3s ease-out forwards;
}

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

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Responsive ===== */

/* Tablet (iPad) */
@media (max-width: 1024px) {
    .controls {
        gap: 8px;
        flex-wrap: nowrap;
    }
    
    .btn {
        padding: 10px 14px;
        font-size: 0.9rem;
    }
}

/* Small screens */
@media (max-width: 500px) {
    .letter {
        width: 75px;
        height: 95px;
    }
    
    .letter-char {
        font-size: 2.5rem;
    }
    
    .letter-sound {
        font-size: 0.85rem;
    }
    
    .btn {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .controls {
        gap: 6px;
        flex-wrap: wrap; /* Allow wrapping only on very small screens */
    }
    
    .word-card {
        padding: 20px;
    }
    
    .cat {
        transform: scale(0.85);
    }
    
    .sun {
        width: 60px;
        height: 60px;
        right: 20px;
    }
}

/* ===== Word Selector Tabs ===== */
.word-selector {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    animation: fadeInDown 0.6s ease-out;
}

.word-tab {
    padding: 10px 18px;
    border: none;
    border-radius: 25px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-dark);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.word-tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.word-tab.active {
    background: linear-gradient(145deg, var(--letter-c), var(--letter-c-dark));
    color: white;
    transform: scale(1.05);
}

.word-tab.quiz-tab {
    background: linear-gradient(145deg, #9B59B6, #8E44AD);
    color: white;
}

.word-tab.quiz-tab:hover {
    background: linear-gradient(145deg, #A66BBE, #9B59B6);
}

.word-tab.quiz-tab.active {
    background: linear-gradient(145deg, #8E44AD, #7D3C98);
    box-shadow: 0 4px 20px rgba(142, 68, 173, 0.4);
}

/* ===== Animal Illustration (Dynamic) ===== */
.animal-illustration {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    min-height: 140px;
}

.animal-emoji {
    font-size: 100px;
    line-height: 1;
    animation: animal-bounce 2s ease-in-out infinite;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.animal-emoji:hover {
    transform: scale(1.1);
}

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

@keyframes animal-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ===== Quiz Mode ===== */
.quiz-card {
    background: var(--card-bg);
    border-radius: 30px;
    padding: 30px;
    box-shadow: var(--shadow-soft);
    width: 100%;
    max-width: 500px;
    text-align: center;
    animation: fadeInUp 0.5s ease-out;
}

.quiz-card.hidden,
.word-card.hidden {
    display: none;
}

.quiz-score {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--grass-dark);
    margin-bottom: 15px;
    padding: 10px 20px;
    background: linear-gradient(145deg, #A8E6CF, #88D8B0);
    border-radius: 20px;
    display: inline-block;
}

.quiz-prompt {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 20px;
}

/* Main Quiz Layout - Word on left, Animals on right */
.quiz-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    width: 100%;
    max-width: 900px;
    flex-wrap: nowrap;
    min-height: 400px;
}

/* Answer Section - Right side */
.answer-section {
    background: var(--card-bg);
    border-radius: 25px;
    padding: 20px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
    min-width: 140px;
    min-height: 380px;
}

/* Hint Button */
.hint-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 25px;
    background: linear-gradient(145deg, #FFD93D, #F6C90E);
    border: none;
    border-radius: 20px;
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: #333;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 217, 61, 0.4);
    transition: all 0.3s ease;
}

.hint-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 217, 61, 0.5);
}

.hint-btn.hidden {
    display: none;
}

.hint-finger {
    font-size: 1.5rem;
}

.hint-btn.hint-animate .hint-finger {
    animation: finger-tap 0.8s ease-in-out infinite;
}

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

/* Make sure word card doesn't grow too much */
.quiz-layout .word-card {
    flex: 0 1 auto;
    max-width: 400px;
}

.answer-prompt {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--text-light);
    margin: 0;
}

.animal-choices {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.animal-choice {
    width: 100px;
    height: 100px;
    border: 4px solid #e0e0e0;
    border-radius: 20px;
    font-size: 3.5rem;
    cursor: pointer;
    background: white;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.animal-choice:hover {
    transform: scale(1.08);
    border-color: #74b9ff;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

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

.animal-choice:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.animal-choice.correct {
    border-color: #00b894;
    border-width: 6px;
    background: linear-gradient(145deg, #d4edda, #c3e6cb);
    animation: correct-pulse 0.5s ease;
}

.animal-choice.wrong {
    border-color: #e74c3c;
    background: linear-gradient(145deg, #f8d7da, #f5c6cb);
    animation: wrong-shake 0.5s ease;
}

@keyframes correct-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

@keyframes wrong-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Text choices (for words without emojis) */
.animal-choice.text-choice {
    font-size: 1.8rem;
    font-family: var(--font-display);
    font-weight: 700;
    color: #2d3436;
    letter-spacing: 2px;
}

/* Feedback Area */
.feedback-area {
    text-align: center;
    margin-top: 15px;
    padding: 15px 30px;
    border-radius: 20px;
    font-family: var(--font-display);
    font-size: 1.4rem;
    animation: fadeInUp 0.3s ease;
}

.feedback-area.hidden {
    display: none;
}

.feedback-area.correct {
    background: linear-gradient(145deg, #d4edda, #c3e6cb);
    color: #155724;
}

.feedback-area.wrong {
    background: linear-gradient(145deg, #f8d7da, #f5c6cb);
    color: #721c24;
}

/* Score Display */
.score-display {
    position: fixed;
    top: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 20px;
    border-radius: 25px;
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--grass-dark);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 100;
}

/* Responsive - only stack on very small screens */
@media (max-width: 600px) {
    .quiz-layout {
        flex-direction: column;
    }
    
    .answer-section {
        flex-direction: row;
    }
    
    .animal-choices {
        flex-direction: row;
    }
}

.quiz-feedback {
    font-family: var(--font-display);
    font-size: 1.5rem;
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 15px;
}

.quiz-feedback.correct {
    background: linear-gradient(145deg, #d4edda, #c3e6cb);
    color: #155724;
}

.quiz-feedback.wrong {
    background: linear-gradient(145deg, #f8d7da, #f5c6cb);
    color: #721c24;
}

.quiz-feedback.hidden {
    display: none;
}

.btn-next {
    background: linear-gradient(145deg, var(--sun-yellow), #F4C430);
    color: #5D4E0B;
    box-shadow: 0 6px 0 #DAA520, var(--shadow-button);
    padding: 15px 40px;
    font-size: 1.2rem;
}

.btn-next:hover {
    transform: translateY(-3px);
    box-shadow: 0 9px 0 #DAA520, var(--shadow-button);
}

.btn-next.hidden {
    display: none;
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
.letter:focus,
.btn:focus {
    outline: 4px solid var(--sun-yellow);
    outline-offset: 4px;
}

.letter:focus-visible,
.btn:focus-visible {
    outline: 4px solid var(--sun-yellow);
    outline-offset: 4px;
}

/* ===== Sound It Out First (Locked Choices) ===== */
#soundOutPrompt {
    background: linear-gradient(145deg, #FFF9C4, #FFF59D);
    color: #5D4E0B;
    padding: 15px 25px;
    border-radius: 20px;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    text-align: center;
    animation: prompt-bounce 1.5s ease-in-out infinite;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(255, 217, 61, 0.3);
}

#soundOutPrompt.hidden {
    display: none;
}

@keyframes prompt-bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-5px) scale(1.02); }
}

/* Locked animal choices - blurred and non-interactive */
.animal-choices.locked {
    filter: blur(10px) grayscale(50%);
    pointer-events: none;
    opacity: 0.5;
    transform: scale(0.95);
    transition: all 0.4s ease;
}

.animal-choices.locked .animal-choice {
    cursor: not-allowed;
}

/* Unlocking animation */
.animal-choices.unlocking {
    animation: unlock-reveal 0.5s ease-out forwards;
}

@keyframes unlock-reveal {
    0% {
        filter: blur(10px) grayscale(50%);
        opacity: 0.5;
        transform: scale(0.95);
    }
    50% {
        filter: blur(5px) grayscale(25%);
        opacity: 0.75;
        transform: scale(0.98);
    }
    100% {
        filter: blur(0) grayscale(0%);
        opacity: 1;
        transform: scale(1);
    }
}

/* Cooldown flash when clicking too fast */
.animal-choices.cooldown-flash {
    animation: cooldown-shake 0.2s ease-out;
}

.animal-choices.cooldown-flash .animal-choice {
    background: rgba(255, 100, 100, 0.3) !important;
    border-color: #ff6b6b !important;
}

@keyframes cooldown-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

