/* ===== AaruJr — AI Kids Coding Platform ===== */
:root {
    --bg: #0B0A1A;
    --bg2: #151331;
    --bg3: #1E1B4B;
    --card: #252352;
    --card-hover: #302D6B;
    --purple: #7C3AED;
    --purple-light: #A78BFA;
    --pink: #EC4899;
    --blue: #3B82F6;
    --cyan: #06B6D4;
    --green: #10B981;
    --yellow: #F59E0B;
    --orange: #F97316;
    --red: #EF4444;
    --white: #F8FAFC;
    --muted: #94A3B8;
    --dim: #475569;
    --border: rgba(255, 255, 255, 0.06);
    --glow-purple: 0 0 30px rgba(124, 58, 237, 0.4);
    --glow-green: 0 0 20px rgba(16, 185, 129, 0.4);
    --glow-pink: 0 0 20px rgba(236, 72, 153, 0.4);
    --glow-yellow: 0 0 15px rgba(245, 158, 11, 0.4);
    --radius: 20px;
    --radius-sm: 12px;
    --radius-full: 50px;
    --font: 'Fredoka', sans-serif;
    --transition: all .3s cubic-bezier(.4, 0, .2, 1)
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

html,
body {
    height: 100%;
    overflow: hidden
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--white);
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation
}

button {
    cursor: pointer;
    border: none;
    font-family: var(--font);
    background: none;
    color: inherit
}

.hidden {
    display: none !important
}

/* SPLASH */
.splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: radial-gradient(circle at 50% 40%, #1E1B4B, #0B0A1A);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .8s, visibility .8s
}

.splash.done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none
}

.splash-inner {
    text-align: center
}

.splash-mascot {
    font-size: 5rem;
    animation: rocketFloat 1.2s ease-in-out infinite
}

.splash-stars {
    font-size: 1.5rem;
    margin: 12px 0;
    animation: twinkle 1s ease infinite alternate
}

.splash-title-text {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 8px 0
}

.splash-ai-badge {
    display: inline-block;
    padding: 4px 16px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--purple), var(--pink));
    font-size: 1rem;
    letter-spacing: 3px;
    margin: 8px 0;
    animation: pulse 2s ease-in-out infinite
}

.splash-bar {
    width: 180px;
    height: 8px;
    background: var(--bg3);
    border-radius: 4px;
    margin: 12px auto 0;
    overflow: hidden
}

.splash-fill {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--purple), var(--pink));
    border-radius: 4px;
    animation: splashLoad 2s ease forwards
}

.splash-status {
    font-size: 1.2rem;
    margin-top: 10px;
    letter-spacing: 4px;
    opacity: .6;
    animation: twinkle 1.5s ease infinite alternate
}

.logo-jr {
    color: var(--pink)
}

@keyframes rocketFloat {

    0%,
    100% {
        transform: translateY(0) rotate(-5deg)
    }

    50% {
        transform: translateY(-18px) rotate(5deg)
    }
}

@keyframes twinkle {
    from {
        opacity: .4
    }

    to {
        opacity: 1
    }
}

@keyframes splashLoad {
    to {
        width: 100%
    }
}

/* PLAYER SELECT */
.player-select {
    position: fixed;
    inset: 0;
    z-index: 8000;
    background: radial-gradient(circle at 50% 30%, #1E1B4B, #0B0A1A);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px;
    overflow-y: auto
}

.ps-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px
}

.ps-logo {
    font-size: 2.5rem
}

.ps-title {
    font-size: 2rem;
    font-weight: 700
}

.ps-ai-tag {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--purple), var(--cyan));
    font-size: .8rem;
    letter-spacing: 2px
}

.ps-subtitle {
    font-size: 2rem;
    margin-bottom: 16px;
    letter-spacing: 6px;
    opacity: .7
}

.ps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    max-width: 700px;
    width: 100%;
    padding: 8px
}

.ps-slot {
    aspect-ratio: 1;
    border-radius: var(--radius);
    background: var(--card);
    border: 3px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    min-height: 80px
}

.ps-slot:hover {
    transform: scale(1.08);
    border-color: var(--purple-light);
    box-shadow: var(--glow-purple)
}

.ps-slot:active {
    transform: scale(.95)
}

.ps-slot .slot-emoji {
    font-size: 2rem
}

.ps-slot .slot-num {
    font-size: .7rem;
    color: var(--muted);
    font-weight: 600
}

.ps-slot.has-data {
    border-color: var(--green)
}

.ps-slot .slot-level {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: .6rem;
    padding: 2px 6px;
    background: var(--purple);
    border-radius: var(--radius-full);
    color: white;
    font-weight: 700
}

.ps-footer {
    display: flex;
    gap: 12px;
    margin-top: 16px
}

.ps-more-btn,
.ps-board-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--card);
    border: 2px solid var(--border);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition)
}

.ps-more-btn:hover,
.ps-board-btn:hover {
    transform: scale(1.1);
    border-color: var(--purple-light)
}

/* DEMO */
.demo-overlay {
    position: fixed;
    inset: 0;
    z-index: 7000;
    background: rgba(0, 0, 0, .85);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px
}

.demo-overlay.open {
    display: flex
}

.demo-content {
    max-width: 420px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    position: relative
}

.demo-skip {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 2;
    transition: var(--transition)
}

.demo-skip:hover {
    background: var(--red)
}

.demo-dots {
    display: flex;
    gap: 8px
}

.demo-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--dim);
    transition: var(--transition)
}

.demo-dot.active {
    background: var(--purple-light);
    transform: scale(1.2)
}

.demo-dot.done {
    background: var(--green)
}

.demo-viewport {
    width: 100%;
    min-height: 280px;
    background: var(--card);
    border-radius: var(--radius);
    border: 2px solid var(--border);
    overflow: hidden;
    position: relative
}

.demo-step {
    display: none;
    width: 100%;
    height: 280px;
    align-items: center;
    justify-content: center;
    padding: 20px
}

.demo-step.active {
    display: flex
}

.demo-scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%
}

.demo-fake-block {
    padding: 16px 28px;
    border-radius: var(--radius-sm);
    background: rgba(59, 130, 246, .25);
    border-left: 5px solid var(--blue);
    font-size: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px
}

.demo-fake-block.placed {
    opacity: .6
}

.demo-fake-block.small {
    font-size: 1.5rem;
    padding: 10px 20px;
    min-width: 60px
}

.demo-fake-block.animate-in {
    animation: demoBlockDrop .6s ease backwards
}

.demo-fake-block.delay1 {
    animation-delay: .4s
}

.demo-fake-block.delay2 {
    animation-delay: .8s
}

@keyframes demoBlockDrop {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(.5)
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1)
    }
}

.demo-block-target {
    animation: demoBlockPulse 1.5s ease-in-out infinite
}

@keyframes demoBlockPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: none
    }

    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(59, 130, 246, .5)
    }
}

.demo-hand {
    font-size: 2.5rem;
    animation: demoHandTap 1.5s ease-in-out infinite
}

.demo-hand.tap-anim {
    animation: demoHandTap 1s ease-in-out infinite
}

@keyframes demoHandTap {

    0%,
    100% {
        transform: translateY(0) scale(1)
    }

    30% {
        transform: translateY(-8px) scale(1.1)
    }

    50% {
        transform: translateY(5px) scale(.9)
    }
}

.demo-arrow {
    font-size: 2rem;
    animation: demoArrowBounce 1s ease-in-out infinite
}

@keyframes demoArrowBounce {

    0%,
    100% {
        transform: translateX(0)
    }

    50% {
        transform: translateX(10px)
    }
}

.demo-fake-palette {
    display: flex;
    gap: 8px
}

.demo-fake-zone {
    background: rgba(124, 58, 237, .1);
    border: 2px dashed var(--purple);
    border-radius: var(--radius-sm);
    padding: 12px 24px;
    min-width: 100px;
    display: flex;
    align-items: center;
    justify-content: center
}

.demo-fake-zone.stacked {
    flex-direction: column;
    gap: 6px;
    padding: 10px 16px
}

.demo-play-btn {
    font-size: 4rem;
    background: rgba(16, 185, 129, .2);
    border: 3px solid var(--green);
    border-radius: 50%;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center
}

.demo-play-btn.pulse-big {
    animation: demoPulseBig 1.5s ease-in-out infinite
}

@keyframes demoPulseBig {

    0%,
    100% {
        transform: scale(1);
        box-shadow: none
    }

    50% {
        transform: scale(1.15);
        box-shadow: 0 0 40px rgba(16, 185, 129, .6)
    }
}

.demo-stage-preview {
    width: 200px;
    height: 100px;
    background: #1a1a3e;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center
}

.demo-character {
    font-size: 3rem;
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%)
}

.demo-character.animate-move {
    animation: demoCharMove 2s ease-in-out infinite
}

@keyframes demoCharMove {
    0% {
        left: 30px
    }

    50% {
        left: 130px
    }

    100% {
        left: 30px
    }
}

.demo-speech {
    position: absolute;
    top: 10px;
    right: 30px;
    font-size: 1.5rem;
    animation: demoSpeechPop 2s ease-in-out infinite
}

@keyframes demoSpeechPop {

    0%,
    40%,
    100% {
        opacity: 0;
        transform: scale(0)
    }

    50%,
    90% {
        opacity: 1;
        transform: scale(1)
    }
}

.demo-ai-helper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--card);
    border-radius: var(--radius-full);
    border: 2px solid var(--purple);
    animation: fadeUp .8s ease
}

.demo-ai-face {
    font-size: 1.5rem
}

.demo-ai-text {
    font-size: 1.2rem;
    letter-spacing: 3px
}

.demo-celebration {
    font-size: 2rem;
    letter-spacing: 8px;
    animation: demoCelebrate 1s ease-in-out infinite alternate
}

@keyframes demoCelebrate {
    from {
        transform: scale(.9)
    }

    to {
        transform: scale(1.1)
    }
}

.demo-nav {
    display: flex;
    gap: 16px
}

.demo-nav-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--card);
    border: 2px solid var(--border);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition)
}

.demo-nav-btn:hover {
    background: var(--card-hover);
    transform: scale(1.1)
}

.demo-next-btn {
    background: var(--purple);
    border-color: var(--purple)
}

.demo-try-btn {
    padding: 16px 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--green), var(--cyan));
    font-size: 1.8rem;
    letter-spacing: 6px;
    box-shadow: 0 8px 30px rgba(16, 185, 129, .5);
    transition: var(--transition);
    animation: demoPulseBig 2s ease-in-out infinite
}

/* APP */
.app {
    height: 100vh;
    display: flex;
    flex-direction: column
}

.screen {
    display: none;
    flex: 1;
    overflow: hidden;
    position: relative
}

.screen.active {
    display: flex;
    flex-direction: column
}

/* HOME */
#screen-home {
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 30%, #1E1B4B 0%, #0B0A1A 70%)
}

.home-bg {
    position: absolute;
    inset: 0;
    z-index: 0
}

#home-particles {
    width: 100%;
    height: 100%
}

.home-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px
}

.home-mascot-wrap {
    position: relative
}

.home-mascot {
    font-size: 7rem;
    animation: mascotBounce 2s ease-in-out infinite;
    filter: drop-shadow(0 10px 30px rgba(124, 58, 237, .5));
    cursor: pointer;
    transition: transform .2s
}

.home-mascot:hover {
    transform: scale(1.1)
}

.ai-neural-aura {
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    border: 2px solid rgba(124, 58, 237, .2);
    animation: auraRotate 4s linear infinite
}

@keyframes auraRotate {
    to {
        transform: rotate(360deg)
    }
}

.home-sparkle {
    position: absolute;
    font-size: 1.5rem;
    animation: sparkleFloat 3s ease-in-out infinite
}

.s1 {
    top: -10px;
    right: -20px
}

.s2 {
    top: 20px;
    left: -25px;
    animation-delay: .6s
}

.s3 {
    bottom: 0;
    right: -15px;
    animation-delay: 1.2s
}

@keyframes mascotBounce {

    0%,
    100% {
        transform: translateY(0)
    }

    50% {
        transform: translateY(-15px)
    }
}

@keyframes sparkleFloat {

    0%,
    100% {
        transform: translateY(0) scale(1);
        opacity: .7
    }

    50% {
        transform: translateY(-10px) scale(1.3);
        opacity: 1
    }
}

.home-title {
    display: flex;
    align-items: center;
    gap: 8px
}

.home-logo-icon {
    font-size: 2rem
}

.home-logo-text {
    font-size: 2.5rem;
    font-weight: 700
}

.home-ai-badge {
    font-size: 1.5rem;
    animation: pulse 2s ease-in-out infinite
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: .8
    }

    50% {
        transform: scale(1.15);
        opacity: 1
    }

    100% {
        transform: scale(1);
        opacity: .8
    }
}

.home-player-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card);
    padding: 8px 18px;
    border-radius: var(--radius-full);
    border: 2px solid var(--purple);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition)
}

.home-player-badge:hover {
    box-shadow: var(--glow-purple);
    transform: scale(1.05)
}

.player-num {
    color: var(--muted);
    font-size: .85rem;
    font-weight: 600
}

.player-streak {
    font-size: .85rem;
    color: var(--orange)
}

.home-play-btn {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green), var(--cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 8px 30px rgba(16, 185, 129, .5);
    transition: var(--transition)
}

.home-play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(16, 185, 129, .7)
}

.home-play-btn:active {
    transform: scale(.95)
}

.play-icon {
    font-size: 3rem;
    position: relative;
    z-index: 1
}

.play-pulse {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 3px solid var(--green);
    animation: pulse 2s ease-in-out infinite
}

.home-demo-btn {
    padding: 10px 20px;
    border-radius: var(--radius-full);
    background: var(--card);
    border: 2px solid var(--border);
    font-size: 1.2rem;
    letter-spacing: 4px;
    transition: var(--transition)
}

.home-demo-btn:hover {
    border-color: var(--yellow);
    box-shadow: var(--glow-yellow)
}

.ai-bubble {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    padding: 10px 18px;
    border-radius: var(--radius-full);
    animation: fadeUp .8s .5s ease backwards
}

.ai-face {
    font-size: 1.5rem
}

.ai-msg {
    font-size: 1.2rem;
    letter-spacing: 4px
}

.ai-mood {
    font-size: 1.2rem
}

.home-level {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--card);
    border-radius: var(--radius-full);
    border: 1px solid var(--border)
}

.level-star {
    font-size: 1.3rem
}

.level-dots {
    display: flex;
    gap: 6px
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--dim);
    transition: var(--transition)
}

.dot.filled {
    background: var(--yellow);
    box-shadow: 0 0 8px rgba(245, 158, 11, .5)
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.home-ai-features {
    display: flex;
    gap: 10px;
    margin-top: 4px
}

.ai-feature-btn {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--card);
    border: 2px solid var(--border);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden
}

.ai-feature-btn:hover {
    border-color: var(--purple);
    transform: scale(1.1);
    box-shadow: var(--glow-purple)
}

.ai-feature-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(124, 58, 237, .15), transparent);
    opacity: 0;
    transition: opacity .3s
}

.ai-feature-btn:hover .ai-feature-glow {
    opacity: 1
}