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

html, body {
    height: 100vh;
    width: 100vw;
    font-family: 'Comic Neue', cursive;
    background: url('/bg.svg') center center / cover no-repeat;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Background Container */
#background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
}

#game-background {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Top Controls */
.top-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.right-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.premium-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(45deg, #f59e0b, #f97316);
    border: none;
    border-radius: 25px;
    color: white;
    font-family: 'Fredoka', cursive;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
    transition: all 0.3s ease;
    animation: bounce 2s infinite;
}

.premium-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

.premium-icon {
    width: 20px;
    height: 20px;
}

.settings-button,
.music-button,
.login-button {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.settings-button:hover,
.music-button:hover,
.login-button:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.settings-icon,
.music-icon,
.login-icon {
    width: 24px;
    height: 24px;
    color: #6366f1;
}

.music-button.muted .music-icon {
    color: #ef4444;
    opacity: 0.7;
}

.music-button.playing .music-icon {
    animation: musicPulse 2s ease-in-out infinite;
}

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

/* Main Game Container */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 80px 20px 80px;
    position: relative;
}

/* Logo */
.logo-container {
    margin-bottom: 20px;
}

.game-logo {
    height: 60px;
    width: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

/* Progress Display */
.progress-display {
    font-size: 24px;
    font-weight: 600;
    color: #4f46e5;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Visual Prompt Container */
.visual-prompt-container {
    margin-bottom: 30px;
}

.decorative-frame {
    background: linear-gradient(45deg, #fbbf24, #f59e0b);
    padding: 16px;
    border-radius: 40px;
    box-shadow: 0 16px 50px rgba(245, 158, 11, 0.3);
    animation: glow 2s ease-in-out infinite alternate;
}

.visual-prompt {
    width: 400px;
    height: 400px;
    background: white;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.visual-prompt img,
.visual-prompt svg {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Spelling Container */
.spelling-container {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.letter-box {
    width: 100px;
    height: 120px;
    border: 6px solid #6366f1;
    border-radius: 24px;
    background: white;
    font-size: 56px;
    font-weight: 600;
    text-align: center;
    color: #4f46e5;
    font-family: 'Fredoka', cursive;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.2);
}

.letter-box:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3);
    transform: scale(1.05);
}

.letter-box.correct {
    background: #10b981;
    color: white;
    border-color: #059669;
    animation: correctBounce 0.5s ease;
}

.letter-box.incorrect {
    background: #ef4444;
    color: white;
    border-color: #dc2626;
    animation: shake 0.5s ease;
}

/* Magic Check Button */
.magic-check-button {
    position: relative;
    padding: 16px 32px;
    background: linear-gradient(45deg, #8b5cf6, #6366f1);
    border: none;
    border-radius: 30px;
    color: white;
    font-family: 'Fredoka', cursive;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
    transition: all 0.3s ease;
    overflow: hidden;
    margin-bottom: 20px;
}

.magic-check-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.6);
}

.magic-check-button:active {
    transform: translateY(-1px);
}

.button-sparkles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1) 25%, transparent 25%), linear-gradient(-45deg, rgba(255, 255, 255, 0.1) 25%, transparent 25%);
    opacity: 0.3;
    animation: sparkle 2s linear infinite;
}

/* Navigation Buttons */
.navigation-buttons {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.nav-button {
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 50%;
}

.nav-button:hover {
    transform: scale(1.1);
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.nav-button img {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

/* Locked State */
.locked-state {
    text-align: center;
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid #ef4444;
    border-radius: 20px;
    padding: 20px;
    margin-top: 20px;
}

.lock-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.lock-message {
    font-size: 18px;
    font-weight: 600;
    color: #dc2626;
    margin-bottom: 10px;
}

.countdown-timer {
    font-size: 24px;
    font-weight: 700;
    color: #ef4444;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 12px;
    display: inline-block;
}

/* Help Button */
.help-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 3px solid #ff9500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(255, 149, 0, 0.3);
    z-index: 1000;
}

.help-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 149, 0, 0.4);
    background: #ff9500;
}

.help-button:hover .help-icon {
    filter: brightness(0) invert(1);
}

.help-icon {
    width: 30px;
    height: 30px;
    transition: filter 0.3s ease;
}

.difficulty-button-bottom {
    position: fixed;
    bottom: 20px;
    left: 100px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(45deg, #f59e0b, #f97316);
    border: none;
    border-radius: 25px;
    color: white;
    font-family: 'Fredoka', cursive;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
}

.difficulty-button-bottom:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

.logo-bottom-right {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.game-logo-large {
    width: 300px;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

/* Popup Styles */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.popup-content {
    background: white;
    border-radius: 20px;
    padding: 0;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: popupSlideIn 0.3s ease;
    font-family: 'Fredoka', cursive;
}

.popup-header {
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    color: white;
    padding: 20px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popup-header h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.popup-body {
    padding: 20px;
}

/* User Info Styling - Override italic font */
.user-info {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-style: normal;
    font-weight: 500;
    line-height: 1.5;
}

.user-info p {
    font-style: normal;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
    font-size: 16px;
}

.user-info strong {
    font-weight: 600;
    color: #1F2937;
}

/* Age Selection Popup */
.age-popup .popup-body {
    text-align: center;
}

.age-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.age-btn {
    width: 60px;
    height: 60px;
    border: 3px solid #6366f1;
    border-radius: 50%;
    background: white;
    color: #6366f1;
    font-size: 24px;
    font-weight: 700;
    font-family: 'Fredoka', cursive;
    cursor: pointer;
    transition: all 0.3s ease;
}

.age-btn:hover,
.age-btn.selected {
    background: #6366f1;
    color: white;
    transform: scale(1.1);
}

.difficulty-selector {
    margin-bottom: 20px;
}

.difficulty-selector h4 {
    margin-bottom: 10px;
    color: #4f46e5;
}

#difficulty-select {
    width: 100%;
    padding: 10px;
    border: 2px solid #6366f1;
    border-radius: 10px;
    font-family: 'Fredoka', cursive;
    font-size: 16px;
    background: white;
}

.start-game-button {
    width: 100%;
    padding: 15px;
    background: linear-gradient(45deg, #10b981, #059669);
    border: none;
    border-radius: 15px;
    color: white;
    font-family: 'Fredoka', cursive;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.start-game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* Form Styles */
.popup-menu-btn,
.form-submit-btn {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: 2px solid #6366f1;
    border-radius: 10px;
    background: white;
    color: #6366f1;
    font-family: 'Fredoka', cursive;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.popup-menu-btn:hover,
.form-submit-btn:hover {
    background: #6366f1;
    color: white;
}

.popup-body input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid #d1d5db;
    border-radius: 10px;
    font-family: 'Fredoka', cursive;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.popup-body input:focus {
    outline: none;
    border-color: #6366f1;
}

/* Help Content */
.help-content p {
    margin-bottom: 15px;
    font-size: 16px;
    color: #4b5563;
    line-height: 1.5;
}

/* Playful Account Creation Popup Styles */
.account-prompt-popup {
    max-width: 500px;
    border: 3px solid #FFD700;
    box-shadow: 0 15px 40px rgba(255, 215, 0, 0.3), 0 0 0 5px rgba(255, 215, 0, 0.1);
    animation: popupBounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.cute-header {
    background: linear-gradient(135deg, #FF6B9D, #C44569, #F8B500);
    padding: 25px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.cute-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: sparkleMove 3s linear infinite;
}

.cute-character {
    font-size: 2.5rem;
    animation: bounce 2s infinite;
    display: inline-block;
    margin: 0 10px;
}

.cute-header h3 {
    font-size: 24px;
    font-weight: 700;
    margin: 10px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.cute-message {
    text-align: center;
    padding: 20px;
}

.main-message {
    font-size: 20px;
    font-weight: 600;
    color: #2D3748;
    margin-bottom: 10px;
}

.main-message strong {
    color: #FF6B9D;
    font-size: 24px;
}

.sub-message {
    font-size: 16px;
    color: #4A5568;
    margin-bottom: 25px;
}

.cute-benefits {
    background: linear-gradient(135deg, #E6FFFA, #F0FFF4);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    border: 2px solid #68D391;
}

.benefit-item {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-size: 16px;
    color: #2D3748;
    font-weight: 500;
}

.benefit-item:last-child {
    margin-bottom: 0;
}

.benefit-icon {
    font-size: 1.5rem;
    margin-right: 12px;
    animation: pulse 2s infinite;
}

.account-buttons {
    padding: 0 20px 20px;
}

.cute-btn {
padding: 15px 25px;
border: none;
border-radius: 25px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
position: relative;
overflow: hidden;
}

.cute-btn::before {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 0;
height: 0;
background: rgba(255, 255, 255, 0.3);
border-radius: 50%;
transition: all 0.3s ease;
transform: translate(-50%, -50%);
}

.cute-btn:hover::before {
width: 300px;
height: 300px;
    height: 300px;
}

.primary-btn {
    background: linear-gradient(135deg, #FF6B9D, #C44569);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.4);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.6);
}

.secondary-btn {
    background: linear-gradient(135deg, #667EEA, #764BA2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.secondary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.skip-btn {
    background: linear-gradient(135deg, #A0AEC0, #718096);
    color: white;
    font-size: 14px;
    padding: 12px 20px;
}

.skip-btn:hover {
    background: linear-gradient(135deg, #718096, #4A5568);
    transform: translateY(-1px);
}

.btn-icon {
    font-size: 1.2rem;
    animation: wiggle 1s ease-in-out infinite;
}

.cute-footer {
    text-align: center;
    padding: 0 20px 20px;
    font-size: 14px;
    color: #6B7280;
    font-style: italic;
}

/* Premium Popup Styles */
.premium-popup {
    max-width: 600px;
    border: 3px solid #FFD700;
    box-shadow: 0 20px 50px rgba(255, 215, 0, 0.4), 0 0 0 5px rgba(255, 215, 0, 0.1);
    animation: premiumBounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.premium-header {
    background: linear-gradient(135deg, #FFD700, #FFA500, #FF8C00);
    padding: 25px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.premium-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: premiumSparkle 4s linear infinite;
}

.premium-crown {
    font-size: 3rem;
    animation: crownFloat 3s ease-in-out infinite;
    display: block;
    margin-bottom: 10px;
}

.premium-header h3 {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 26px;
    font-weight: 700;
    margin: 0;
    text-shadow: none;
    color: white;
    font-style: normal;
}

.premium-content {
    padding: 0;
}

.premium-hero {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #FFF8DC, #FFFACD);
    border-bottom: 2px solid #FFD700;
}

.premium-stars {
    font-size: 1.5rem;
    margin-bottom: 10px;
    animation: twinkle 2s ease-in-out infinite;
}

.premium-tagline {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: #374151;
    margin: 0;
    font-style: normal;
}

.premium-features {
    padding: 25px;
    background: white;
}

.feature-item {
    display: block;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #F0F9FF, #E0F2FE);
    border-radius: 12px;
    border: 2px solid #BAE6FD;
    transition: all 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(186, 230, 253, 0.4);
}

.feature-item:last-child {
    margin-bottom: 0;
}

.feature-icon {
    font-size: 2rem;
    margin-right: 15px;
    animation: featureFloat 2s ease-in-out infinite;
}

.feature-text h4 {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #1E40AF;
    margin: 0 0 5px 0;
    font-style: normal;
}

.feature-text p {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    color: #64748B;
    margin: 0;
    font-style: normal;
}

.premium-pricing {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 25px;
    background: linear-gradient(135deg, #F8FAFC, #F1F5F9);
}

.pricing-option {
    background: white;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    border: 2px solid #E2E8F0;
    transition: all 0.3s ease;
    position: relative;
}

.pricing-option.popular {
    border-color: #10B981;
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.2);
}

.popular-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

.price-badge {
    font-size: 14px;
    font-weight: 600;
    color: #6B7280;
    margin-bottom: 10px;
}

.price-amount {
    font-size: 32px;
    font-weight: 700;
    color: #1F2937;
    margin-bottom: 10px;
}

.price-period {
    font-size: 16px;
    color: #6B7280;
}

.savings {
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    color: #92400E;
    padding: 5px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 15px;
    display: inline-block;
}

.premium-btn {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.monthly-btn {
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: white;
}

.yearly-btn {
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
}

.premium-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.premium-footer {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #F9FAFB, #F3F4F6);
    border-top: 1px solid #E5E7EB;
}

.premium-footer p {
    font-size: 12px;
    color: #6B7280;
    margin-bottom: 15px;
}

.maybe-later-btn {
    background: none;
    border: 1px solid #D1D5DB;
    color: #6B7280;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.maybe-later-btn:hover {
    background: #F3F4F6;
    color: #374151;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes glow {
    from {
        box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
    }
    to {
        box-shadow: 0 8px 25px rgba(245, 158, 11, 0.6);
    }
}

@keyframes sparkle {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

@keyframes popupBounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(-100px);
    }
    50% {
        opacity: 1;
        transform: scale(1.05) translateY(0);
    }
    70% {
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes sparkleMove {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(0deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(360deg);
    }
}

@keyframes wiggle {
    0%, 7% {
        transform: rotateZ(0);
    }
    15% {
        transform: rotateZ(-15deg);
    }
    20% {
        transform: rotateZ(10deg);
    }
    25% {
        transform: rotateZ(-10deg);
    }
    30% {
        transform: rotateZ(6deg);
    }
    35% {
        transform: rotateZ(-4deg);
    }
    40%, 100% {
        transform: rotateZ(0);
    }
}

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

@keyframes premiumBounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(-100px) rotate(-10deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.05) translateY(0) rotate(2deg);
    }
    70% {
        transform: scale(0.95) rotate(-1deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes premiumSparkle {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(0deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(360deg);
    }
}

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

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

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

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

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

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Auth Popup Styles */
.auth-popup {
    max-width: 400px;
    width: 90%;
}

.google-signin-btn {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #dadce0;
    border-radius: 8px;
    background: white;
    color: #3c4043;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 20px;
}

.google-signin-btn:hover {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-color: #c1c7cd;
}

.google-signin-btn:active {
    background: #f8f9fa;
}

.google-icon {
    flex-shrink: 0;
}

.auth-divider {
    position: relative;
    text-align: center;
    margin: 20px 0;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e5e7eb;
}

.auth-divider span {
    background: white;
    padding: 0 16px;
    color: #6b7280;
    font-size: 14px;
    position: relative;
}

.form-group {
    margin-bottom: 16px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.auth-submit-btn {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 16px;
}

.auth-submit-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.auth-submit-btn:active {
    transform: translateY(0);
}

.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.auth-toggle {
    text-align: center;
    margin-bottom: 12px;
}

.auth-toggle p {
    color: #6b7280;
    font-size: 14px;
    margin: 0;
}

.toggle-link {
    background: none;
    border: none;
    color: #3b82f6;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
}

.toggle-link:hover {
    text-decoration: underline;
}

.forgot-password {
    text-align: center;
}

.forgot-password button {
    color: #6b7280;
    font-size: 13px;
}

.auth-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Try Again Popup Styles */
.try-again-content {
    max-width: 450px;
    text-align: center;
}

.try-again-header {
    background: linear-gradient(45deg, #ef4444, #f97316);
    color: white;
    padding: 20px;
    border-radius: 20px 20px 0 0;
}

.try-again-header h3 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    font-family: 'Fredoka', cursive;
}

.try-again-body {
    padding: 30px 20px;
}

.try-again-message {
    margin-bottom: 25px;
}

.sad-emoji {
    font-size: 48px;
    margin-bottom: 15px;
    animation: bounce 1s ease-in-out infinite;
}

.try-again-message p {
    font-size: 18px;
    color: #374151;
    margin: 10px 0;
    font-family: 'Fredoka', cursive;
}

.correct-answer-display {
    background: linear-gradient(45deg, #10b981, #059669);
    color: white;
    padding: 15px 20px;
    border-radius: 15px;
    font-size: 24px;
    font-weight: 600;
    font-family: 'Fredoka', cursive;
    letter-spacing: 2px;
    margin: 15px 0;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    text-transform: uppercase;
}

.try-again-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.try-again-buttons .cute-btn {
    min-width: 140px;
    font-family: 'Fredoka', cursive;
}

.primary-btn {
    background: linear-gradient(45deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
}

.primary-btn:hover {
    background: linear-gradient(45deg, #1d4ed8, #1e40af);
    transform: translateY(-2px);
}

.secondary-btn {
    background: linear-gradient(45deg, #f59e0b, #d97706);
    color: white;
    border: none;
}

.secondary-btn:hover {
    background: linear-gradient(45deg, #d97706, #b45309);
    transform: translateY(-2px);
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Payment Modal Styles */
.payment-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.payment-modal-content {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.payment-modal.success .payment-modal-content {
    border: 3px solid #4CAF50;
}

.payment-modal.canceled .payment-modal-content {
    border: 3px solid #FF9800;
}

.payment-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.payment-modal h2 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.payment-modal p {
    color: #666;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.payment-modal button {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.payment-modal button:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Responsive Design */
@media (max-width: 768px) {
    /* Header adjustments */
    .header {
        padding: 10px 15px;
        height: auto;
        min-height: 60px;
    }

    .premium-button {
        padding: 8px 12px;
        font-size: 14px;
        gap: 4px;
    }

    .premium-icon {
        width: 16px;
        height: 16px;
    }

    .right-buttons {
        gap: 8px;
    }

    .settings-button,
    .music-button,
    .login-button {
        width: 40px;
        height: 40px;
    }

    .settings-icon,
    .music-icon,
    .login-icon {
        width: 20px;
        height: 20px;
    }

    /* Game container */
    .game-container {
        padding: 15px;
        gap: 20px;
    }

    /* Progress display */
    .progress-display {
        font-size: 18px;
        padding: 8px 16px;
    }

    /* Visual prompt */
    .visual-prompt-container {
        max-width: 280px;
        margin: 0 auto;
    }

    .decorative-frame {
        padding: 15px;
    }

    .visual-prompt {
        width: 200px;
        height: 200px;
    }

    /* Spelling container */
    .spelling-container {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .letter-box {
        width: 60px;
        height: 70px;
        font-size: 32px;
        margin: 0 4px;
        border-radius: 16px;
        border-width: 4px;
    }

    /* Magic check button */
    .magic-check-btn {
        padding: 12px 24px;
        font-size: 16px;
        margin: 15px 0;
    }

    /* Navigation buttons */
    .navigation-container {
        gap: 15px;
    }

    .nav-btn {
        width: 40px;
        height: 40px;
    }

    .nav-btn img {
        width: 20px;
        height: 20px;
    }

    /* Bottom buttons */
    .help-button {
        width: 50px;
        height: 50px;
        bottom: 15px;
        left: 15px;
    }

    .help-icon {
        width: 24px;
        height: 24px;
    }

    .difficulty-button-bottom {
        padding: 10px 16px;
        font-size: 14px;
        bottom: 15px;
        left: 80px;
    }

    /* Logo */
    .logo-bottom-right {
        bottom: 15px;
        right: 15px;
    }

    .game-logo-large {
        width: 120px;
    }

    /* Popups */
    .popup-content {
        width: 90%;
        max-width: 400px;
        margin: 20px;
        padding: 20px;
    }

    .popup-header h3 {
        font-size: 20px;
    }

    .popup-menu-btn {
        padding: 12px 20px;
        font-size: 14px;
    }

    /* Age selection */
    .age-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 0 10px;
    }

    .age-btn {
        padding: 15px;
        font-size: 16px;
    }

    /* Auth popup */
    .auth-form {
        gap: 15px;
    }

    .form-group input {
        padding: 12px;
        font-size: 16px;
    }

    .auth-btn {
        padding: 12px;
        font-size: 16px;
    }

    .google-signin-btn {
        padding: 12px;
        font-size: 14px;
    }

    /* Premium popup */
    .premium-plans {
        flex-direction: column;
        gap: 15px;
    }

    .plan-card {
        padding: 20px;
    }

    .plan-price {
        font-size: 24px;
    }

    /* Locked state */
    .locked-state {
        padding: 20px;
    }

    .lock-icon {
        font-size: 36px;
    }

    .lock-message {
        font-size: 16px;
    }

    .countdown-timer {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    /* Extra small mobile adjustments */
    .header {
        padding: 8px 10px;
    }

    .premium-button {
        padding: 6px 10px;
        font-size: 12px;
    }

    .right-buttons {
        gap: 6px;
    }

    .settings-button,
    .music-button,
    .login-button {
        width: 35px;
        height: 35px;
    }

    .settings-icon,
    .music-icon,
    .login-icon {
        width: 18px;
        height: 18px;
    }

    .visual-prompt-container {
        max-width: 240px;
    }

    .visual-prompt {
        width: 160px;
        height: 160px;
    }

    .letter-box {
        width: 55px;
        height: 65px;
        font-size: 28px;
        margin: 0 3px;
        border-radius: 14px;
        border-width: 3px;
    }

    .magic-check-btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    .help-button {
        width: 45px;
        height: 45px;
        bottom: 10px;
        left: 10px;
    }

    .difficulty-button-bottom {
        padding: 8px 12px;
        font-size: 12px;
        bottom: 10px;
        left: 70px;
    }

    .logo-bottom-right {
        bottom: 10px;
        right: 10px;
    }

    .game-logo-large {
        width: 80px;
    }

    .popup-content {
        width: 95%;
        margin: 10px;
        padding: 15px;
    }

    .age-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .age-btn {
        padding: 12px;
        font-size: 14px;
    }

    .spelling-container {
        gap: 5px;
    }
    
    .navigation-buttons {
        gap: 10px;
    }
    
    .nav-button img {
        width: 40px;
        height: 40px;
    }
}

@media (orientation: landscape) and (max-height: 600px) {
    /* Landscape mobile adjustments */
    .game-container {
        gap: 10px;
        padding: 10px;
    }

    .visual-prompt {
        width: 120px;
        height: 120px;
    }

    .help-button,
    .difficulty-button-bottom {
        bottom: 10px;
    }

    .logo-bottom-right {
        bottom: 10px;
    }

    .game-logo-large {
        width: 60px;
    }

    .popup-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}
