/* CSS Variables */
:root {
    --primary: #FF6B6B;
    --primary-light: #FF8E8E;
    --secondary: #4ECDC4;
    --secondary-light: #7EDDD6;
    --accent: #FFE66D;
    --accent-light: #FFF0A0;
    --purple: #A06CD5;
    --purple-light: #C4A1E8;
    --blue: #45B7D1;
    --blue-light: #7DCDE3;
    --green: #96CEB4;
    --orange: #FFEAA7;
    --pink: #FDA7DF;
    
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    --shadow-hover: 0 15px 50px rgba(0, 0, 0, 0.25);
    
    --font-main: 'Nunito', sans-serif;
    --font-display: 'Fredoka', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background: var(--bg-gradient);
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    position: relative;
}

/* Floating Shapes */
.floating-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.shape {
    position: absolute;
    font-size: 2rem;
    left: var(--x);
    top: var(--y);
    animation: float 4s ease-in-out infinite;
    animation-delay: var(--delay);
    opacity: 0.7;
}

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

/* Header */
.header {
    text-align: center;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 8vw, 3.5rem);
    color: white;
    text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.title-icon {
    animation: bounce 1s ease-in-out infinite;
}

.title-icon:last-child {
    animation-delay: 0.5s;
}

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

.stars-counter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    padding: 10px 25px;
    border-radius: 50px;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin-top: 15px;
    box-shadow: var(--shadow);
}

.star-icon {
    font-size: 1.8rem;
    animation: spin 3s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Navigation */
.nav-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 15px 25px;
    border: none;
    border-radius: 20px;
    background: var(--card-bg);
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.nav-tab:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.nav-tab.active {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

.tab-emoji {
    font-size: 1.4rem;
}

/* Main Content */
.main-content {
    position: relative;
    z-index: 1;
}

.tab-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

.tab-content.active {
    display: block;
}

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

.section-header {
    text-align: center;
    background: var(--card-bg);
    padding: 25px;
    border-radius: 25px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.section-header h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--purple);
    margin-bottom: 8px;
}

.section-header p {
    color: #666;
    font-size: 1.1rem;
}

/* Consonant Selector */
.consonant-selector {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.consonant-btn {
    min-width: 45px;
    height: 45px;
    padding: 0 12px;
    border: none;
    border-radius: 12px;
    background: var(--card-bg);
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--purple);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.consonant-btn:hover {
    transform: scale(1.1);
    background: var(--purple-light);
    color: white;
}

.consonant-btn.active {
    background: var(--purple);
    color: white;
    transform: scale(1.1);
}

/* Syllables Grid */
.syllables-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.syllable-card {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border-radius: 20px;
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.syllable-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.5) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.syllable-card:hover {
    transform: scale(1.1) rotate(-3deg);
    box-shadow: var(--shadow-hover);
}

.syllable-card:hover::before {
    opacity: 1;
}

.syllable-card:active {
    transform: scale(0.95);
}

.syllable-card:nth-child(1) { color: var(--primary); }
.syllable-card:nth-child(2) { color: var(--secondary); }
.syllable-card:nth-child(3) { color: var(--purple); }
.syllable-card:nth-child(4) { color: var(--blue); }
.syllable-card:nth-child(5) { color: #E17055; }

/* Vowels Reminder */
.vowels-reminder {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.vowel {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border-radius: 50%;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.vowel:hover {
    transform: scale(1.2);
    background: var(--primary);
    color: white;
}

/* Category Selector */
.category-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.category-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 15px;
    background: var(--card-bg);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.category-btn:hover {
    transform: translateY(-3px);
}

.category-btn.active {
    background: var(--secondary);
    color: white;
}

/* Words Grid */
.words-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

/* Numbers Grid */
.numbers-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    max-width: 500px;
    margin: 0 auto;
}

.number-card {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border-radius: 20px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.number-card:hover {
    transform: scale(1.1) rotate(-3deg);
    box-shadow: var(--shadow-hover);
}

.number-card:active {
    transform: scale(0.95);
}

.number-card:nth-child(4n+1) { 
    background: linear-gradient(135deg, #FF6B6B, #FF8E8E); 
}
.number-card:nth-child(4n+2) { 
    background: linear-gradient(135deg, #4ECDC4, #7EDDD6); 
}
.number-card:nth-child(4n+3) { 
    background: linear-gradient(135deg, #A06CD5, #C4A1E8); 
}
.number-card:nth-child(4n+4) { 
    background: linear-gradient(135deg, #45B7D1, #7DCDE3); 
}

.number-digit {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    line-height: 1;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}

.number-word {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: white;
    margin-top: 5px;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

@media (max-width: 600px) {
    .numbers-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    
    .number-digit {
        font-size: 2rem;
    }
    
    .number-word {
        font-size: 0.85rem;
    }
}

.word-card {
    background: var(--card-bg);
    border-radius: 25px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.word-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-hover);
}

.word-card:active {
    transform: scale(0.95);
}

.word-emoji {
    font-size: 4rem;
    margin-bottom: 10px;
    display: block;
    animation: wiggle 2s ease-in-out infinite;
}

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

.word-text {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--purple);
    display: block;
    margin-bottom: 5px;
}

.word-syllables {
    font-family: var(--font-main);
    font-size: 1rem;
    color: #999;
    letter-spacing: 2px;
}

/* Game Section */
.game-container {
    background: var(--card-bg);
    border-radius: 30px;
    padding: 30px;
    text-align: center;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.game-prompt {
    margin-bottom: 30px;
}

.game-emoji {
    font-size: 8rem;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

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

.listen-btn {
    padding: 15px 40px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--blue) 0%, var(--secondary) 100%);
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.listen-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-hover);
}

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

/* Game Options */
.game-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    max-width: 400px;
    margin: 0 auto 20px;
}

.game-option {
    padding: 20px;
    border: 4px solid transparent;
    border-radius: 20px;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, var(--purple-light), var(--blue-light)) border-box;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--purple);
    cursor: pointer;
    transition: all 0.3s ease;
}

.game-option:hover {
    transform: scale(1.05);
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, var(--purple), var(--blue)) border-box;
}

.game-option.correct {
    background: var(--green);
    border-color: var(--green);
    color: white;
    animation: correctPop 0.5s ease;
}

.game-option.wrong {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    animation: shake 0.5s ease;
}

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

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

/* Game Feedback */
.game-feedback {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-feedback.correct {
    color: var(--green);
}

.game-feedback.wrong {
    color: var(--primary);
}

/* Next Button */
.next-btn {
    padding: 15px 40px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--orange) 100%);
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    margin-top: 15px;
}

.next-btn:hover {
    transform: scale(1.05);
}

/* Game Score */
.game-score {
    display: flex;
    justify-content: center;
    gap: 30px;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.score-item {
    text-align: center;
}

.score-label {
    display: block;
    font-size: 0.9rem;
    color: #999;
    margin-bottom: 5px;
}

.score-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--purple);
}

.streak-fire {
    font-size: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.streak-fire.active {
    opacity: 1;
    animation: fire 0.5s ease infinite;
}

@keyframes fire {
    0%, 100% { transform: scale(1) rotate(-5deg); }
    50% { transform: scale(1.2) rotate(5deg); }
}

/* Celebration Overlay */
.celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.celebration.active {
    opacity: 1;
    pointer-events: auto;
}

.celebration-content {
    text-align: center;
    animation: celebrationPop 0.5s ease;
}

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

.celebration-emoji {
    font-size: 8rem;
    animation: celebrationBounce 0.5s ease infinite;
}

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

.celebration-text {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    color: white;
    text-shadow: 3px 3px 0 var(--purple);
    margin: 20px 0;
}

.celebration-stars {
    font-size: 3rem;
    animation: starSpin 1s ease infinite;
}

@keyframes starSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 600px) {
    .app-container {
        padding: 10px;
    }
    
    .syllables-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
    }
    
    .syllable-card {
        font-size: 1.5rem;
    }
    
    .nav-tab {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    .tab-text {
        display: none;
    }
    
    .tab-emoji {
        font-size: 1.8rem;
    }
    
    .word-emoji {
        font-size: 3rem;
    }
    
    .game-emoji {
        font-size: 5rem;
    }
    
    .game-options {
        grid-template-columns: 1fr;
    }
}

/* Counting Game */
.counting-game-container {
    background: var(--card-bg);
    border-radius: 30px;
    padding: 30px;
    text-align: center;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.fruit-display {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    min-height: 120px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    margin-bottom: 25px;
}

.fruit-item {
    font-size: 2.5rem;
    animation: fruitPop 0.3s ease backwards;
}

@keyframes fruitPop {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.counting-options {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.counting-option {
    width: 80px;
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 4px solid var(--purple-light);
    border-radius: 20px;
    background: white;
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.counting-option:hover {
    transform: scale(1.1);
    border-color: var(--purple);
}

.counting-option .number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--purple);
}

.counting-option .word {
    font-size: 0.8rem;
    color: #666;
}

.counting-option.correct {
    background: var(--green);
    border-color: var(--green);
    animation: correctPop 0.5s ease;
}

.counting-option.correct .number,
.counting-option.correct .word {
    color: white;
}

.counting-option.wrong {
    background: var(--primary);
    border-color: var(--primary);
    animation: shake 0.5s ease;
}

.counting-option.wrong .number,
.counting-option.wrong .word {
    color: white;
}

.counting-option:disabled {
    pointer-events: none;
}

.counting-feedback {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    min-height: 40px;
    margin-bottom: 15px;
}

.counting-feedback.success {
    color: var(--green);
}

.counting-feedback.error {
    color: var(--primary);
}

.counting-next-btn {
    margin-top: 10px;
}

.counting-score {
    display: flex;
    justify-content: center;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

@media (max-width: 600px) {
    .fruit-item {
        font-size: 2rem;
    }
    
    .counting-option {
        width: 70px;
        height: 70px;
    }
    
    .counting-option .number {
        font-size: 1.6rem;
    }
}

/* Name Spelling Game */
.name-game-container {
    background: var(--card-bg);
    border-radius: 30px;
    padding: 30px;
    text-align: center;
    box-shadow: var(--shadow);
}

.target-name {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.target-letter {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--purple), var(--purple-light));
    border-radius: 12px;
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.2);
    box-shadow: var(--shadow);
}

.drop-zones {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.drop-zone {
    width: 55px;
    height: 55px;
    border: 4px dashed var(--purple-light);
    border-radius: 15px;
    background: rgba(160, 108, 213, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.drop-zone.drag-over {
    border-color: var(--purple);
    background: rgba(160, 108, 213, 0.3);
    transform: scale(1.1);
}

.drop-zone.filled {
    border-style: solid;
    border-color: var(--secondary);
    background: var(--secondary);
}

.drop-zone.wrong-shake {
    animation: wrongShake 0.5s ease;
    border-color: var(--primary);
    background: rgba(255, 107, 107, 0.3);
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-8px); }
    80% { transform: translateX(8px); }
}

.drop-zone .draggable-letter {
    margin: 0;
}

.letter-bank {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 25px;
    min-height: 70px;
    padding: 15px;
    background: rgba(0,0,0,0.05);
    border-radius: 20px;
}

.draggable-letter {
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 15px;
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.2);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    z-index: 10;
}

.draggable-letter:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-hover);
}

.draggable-letter:active,
.draggable-letter.dragging {
    cursor: grabbing;
    transform: scale(1.15);
    opacity: 0.9;
    z-index: 100;
}

.draggable-letter.selected {
    transform: scale(1.15);
    box-shadow: 0 0 0 4px white, 0 0 0 8px var(--purple), var(--shadow-hover);
    animation: pulse-selected 0.8s ease-in-out infinite;
}

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

.name-game-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.mix-btn, .reset-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 50px;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.mix-btn {
    background: linear-gradient(135deg, var(--accent), var(--orange));
    color: #333;
}

.reset-btn {
    background: linear-gradient(135deg, var(--blue), var(--blue-light));
    color: white;
}

.mix-btn:hover, .reset-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-hover);
}

.name-feedback {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    min-height: 40px;
}

.name-feedback.success {
    color: var(--green);
}

.name-feedback.error {
    color: var(--primary);
}

@media (max-width: 600px) {
    .target-letter, .drop-zone, .draggable-letter {
        width: 42px;
        height: 42px;
        font-size: 1.4rem;
    }
    
    .target-name, .drop-zones, .letter-bank {
        gap: 6px;
    }
    
    .name-game-container {
        padding: 20px 15px;
    }
}
