* {
    font-family: 'Nunito', 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
}

.font-heading {
    font-family: 'Fredoka One', 'Nunito', 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
}

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

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

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

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

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.3); }
    50% { box-shadow: 0 0 40px rgba(59, 130, 246, 0.6); }
}

@keyframes number-spin {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

@keyframes bounce-once {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.1); }
    50% { transform: scale(0.95); }
    75% { transform: scale(1.05); }
}

.animate-float { animation: float 3s ease-in-out infinite; }
.animate-bounce-once { animation: bounce-once 0.5s ease-out; }
.animate-wiggle { animation: wiggle 1s ease-in-out infinite; }
.animate-bounce-fun { animation: bounce-fun 2s ease-in-out infinite; }
.animate-pop { animation: pop 0.3s ease-out; }
.animate-pulse-glow { animation: pulse-glow 2s ease-in-out infinite; }
.animate-number-spin { animation: number-spin 0.5s ease-out; }

.text-gradient {
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 50%, #14b8a6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-gradient-gold {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 50%, #f97316 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-hero-title {
    font-size: 2rem;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

@media (min-width: 768px) {
    .welcome-hero-title {
        font-size: 2.6rem;
    }
}

@media (min-width: 1024px) {
    .welcome-hero-title {
        font-size: 3.1rem;
    }
}

.welcome-section-title {
    font-size: clamp(1.5rem, 6vw, 3rem);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.welcome-section-subtitle {
    font-size: clamp(0.95rem, 3.8vw, 1.125rem);
    line-height: 1.6;
}

.section-transition-icon {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 80;
    font-size: 1.5rem;
    pointer-events: none;
    opacity: 0;
    transform: translate3d(var(--start-x), var(--start-y), 0) scale(0.7) rotate(-8deg);
}

.section-transition-icon.is-active {
    animation: section-icon-flight 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes section-icon-flight {
    0% {
        opacity: 0;
        transform: translate3d(var(--start-x), var(--start-y), 0) scale(0.7) rotate(-8deg);
    }
    15% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate3d(var(--end-x), var(--end-y), 0) scale(1.15) rotate(10deg);
    }
}

.section-focus-ring {
    animation: section-focus-pulse 0.7s ease-out;
}

@keyframes section-focus-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
    45% {
        box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.18);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

.bubble {
    position: absolute;
    border-radius: 50%;
    opacity: 0.4;
}

.kids-body-bg {
    background-color: rgb(202, 227, 254);
}

.math-symbol {
    position: absolute;
    font-weight: bold;
    opacity: 0.15;
    color: #3b82f6;
}

.math-symbol-1 { animation-delay: 0s; color: rgba(59, 130, 246, 0.15); }
.math-symbol-2 { animation-delay: 1s; color: rgba(59, 130, 246, 0.12); }
.math-symbol-3 { animation-delay: 2s; color: rgba(59, 130, 246, 0.1); }
.math-symbol-4 { animation-delay: 0.5s; color: rgba(59, 130, 246, 0.12); }
.math-symbol-5 { animation-delay: 1.5s; color: rgba(59, 130, 246, 0.1); }
.math-symbol-6 { animation-delay: 2.5s; color: rgba(59, 130, 246, 0.08); }
.math-symbol-7 { animation-delay: 3s; color: rgba(59, 130, 246, 0.1); }

.bubble-1 { animation-delay: 0s; background: rgba(147, 197, 253, 0.5); }
.bubble-2 { animation-delay: 1s; background: rgba(165, 180, 252, 0.4); }
.bubble-3 { animation-delay: 2s; background: rgba(147, 197, 253, 0.3); }
.bubble-4 { animation-delay: 0.5s; background: rgba(191, 219, 254, 0.5); }

.btn-fun {
    transition: all 0.3s ease;
    transform-style: preserve-3d;
}

.btn-fun:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 30px -10px rgba(59, 130, 246, 0.4);
}

.btn-fun:active {
    transform: translateY(-2px) scale(0.98);
}

.card-fun {
    transition: all 0.3s ease;
}

.card-fun:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -15px rgba(59, 130, 246, 0.25);
}

.number-card {
    background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
    border: 3px solid #bfdbfe;
    transition: all 0.2s ease;
}

.number-card:hover {
    border-color: #3b82f6;
    transform: scale(1.05);
}

.number-card.correct {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-color: #22c55e;
}

.number-card.wrong {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #ef4444;
}

.progress-bar-animated {
    animation: progress-animation 1s ease-out forwards;
}

@keyframes progress-animation {
    from { width: 0%; }
}

.timer-circle {
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #3b82f6, #06b6d4);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #2563eb, #0891b2);
}

.welcome-float-delay-1 { animation-delay: 0.2s; }
.welcome-float-delay-2 { animation-delay: 0.4s; }
.welcome-float-delay-3 { animation-delay: 0.6s; }
.welcome-float-delay-4 { animation-delay: 0.8s; }

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

@keyframes star-burst {
    0% { transform: translate(0, 0) scale(0); opacity: 1; }
    100% {
        transform: translate(calc(cos(var(--angle)) * 80px), calc(sin(var(--angle)) * 80px - 50px)) scale(1);
        opacity: 0;
    }
}

@media (max-width: 767px) {
    .mobile-app-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(239,246,255,0.92));
        border: 1px solid rgba(147, 197, 253, 0.35);
        border-radius: 16px;
        padding: 10px 12px;
        box-shadow: 0 10px 30px rgba(30, 64, 175, 0.08);
        backdrop-filter: blur(6px);
        position: sticky;
        top: 0;
        z-index: 55;
        transition: all 180ms ease;
    }

    .mobile-app-topbar.is-scrolled {
        padding-top: 8px;
        padding-bottom: 8px;
        box-shadow: 0 8px 22px rgba(30, 64, 175, 0.14);
        transform: translateY(-1px);
    }

    .mobile-app-section {
        scroll-margin-top: 82px;
    }

    .mobile-bottom-tabs {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
        z-index: 60;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 6px;
        padding: 8px;
        border-radius: 18px;
        background: rgba(255, 255, 255, 0.93);
        border: 1px solid rgba(147, 197, 253, 0.38);
        backdrop-filter: blur(10px);
        box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
    }

    .mobile-tab-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 7px 4px;
        border-radius: 12px;
        color: #64748b;
        font-size: 11px;
        font-weight: 700;
        line-height: 1.1;
        text-decoration: none;
        transition: all 160ms ease;
        position: relative;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-tab-item:active {
        transform: translateY(0) scale(0.96);
    }

    .mobile-tab-item.is-active {
        color: #1d4ed8;
        background: linear-gradient(135deg, rgba(219,234,254,0.95), rgba(165,243,252,0.7));
        transform: translateY(-1px);
        box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.25);
    }

    .mobile-tab-item.is-active > .text-lg {
        animation: mobileTabPulse 0.45s ease;
    }

    .mobile-tab-badge {
        position: absolute;
        top: 2px;
        right: 6px;
        min-width: 15px;
        height: 15px;
        border-radius: 999px;
        background: #ef4444;
        color: #fff;
        font-size: 9px;
        font-weight: 700;
        line-height: 15px;
        padding: 0 3px;
        text-align: center;
        pointer-events: none;
        transform: scale(0.95);
    }

    @keyframes mobileTabPulse {
        0% { transform: scale(1); }
        45% { transform: scale(1.22); }
        100% { transform: scale(1); }
    }

    .mobile-section-focus {
        animation: mobileSectionFocus 560ms ease;
    }

    @keyframes mobileSectionFocus {
        0% {
            box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
            transform: translateZ(0) scale(1);
        }
        35% {
            box-shadow: 0 0 0 10px rgba(59, 130, 246, 0.13);
            transform: translateZ(0) scale(1.008);
        }
        100% {
            box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
            transform: translateZ(0) scale(1);
        }
    }
}
