/* Course Builder Online - Styles */
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@600;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Nunito', sans-serif;
    background: #1a1a2e;
    overflow: hidden;
    touch-action: manipulation;
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.screen.active {
    display: flex;
}

/* ========== BUTTONS ========== */
.btn {
    font-family: 'Fredoka One', cursive;
    font-size: 1.3rem;
    padding: 15px 40px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
}

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

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

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

.btn-glow {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
    animation: pulse-glow 2s ease-in-out infinite;
}

.btn:disabled {
    animation: none;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 30px rgba(102, 126, 234, 0.5); }
    50% { box-shadow: 0 0 50px rgba(102, 126, 234, 0.8); }
}

.btn-play {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: white;
    padding: 12px 30px;
}

.btn-build {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 12px 30px;
}

.btn-charge {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1a2e;
    font-size: 1.1rem;
    padding: 12px 30px;
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.5);
    animation: charge-pulse 1.5s ease-in-out infinite;
}

@keyframes charge-pulse {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 40px rgba(251, 191, 36, 0.8), 0 0 60px rgba(251, 191, 36, 0.4);
        transform: scale(1.02);
    }
}

/* Floating Emojis */
.floating-emojis {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 5;
}

.floating-emoji {
    position: absolute;
    font-size: 2.5rem;
    animation: float-up 2s ease-out forwards;
    opacity: 0;
}

@keyframes float-up {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.5) rotate(0deg);
    }
    20% {
        opacity: 1;
        transform: translateY(-20px) scale(1.2) rotate(10deg);
    }
    80% {
        opacity: 1;
        transform: translateY(-150px) scale(1) rotate(-10deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-200px) scale(0.8) rotate(15deg);
    }
}

/* Aura Bar Sparkles */
.aura-sparkles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.sparkle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: sparkle-pop 0.6s ease-out forwards;
}

@keyframes sparkle-pop {
    0% {
        opacity: 1;
        transform: scale(0);
    }
    50% {
        opacity: 1;
        transform: scale(1.5);
    }
    100% {
        opacity: 0;
        transform: scale(0.5) translateY(-20px);
    }
}

/* Aura bar glow animation when growing */
.aura-fill.growing {
    animation: bar-glow 0.5s ease-out;
}

@keyframes bar-glow {
    0% {
        box-shadow: 0 0 20px rgba(167, 139, 250, 0.6);
        filter: brightness(1.5);
    }
    50% {
        box-shadow: 0 0 40px rgba(167, 139, 250, 1), 0 0 60px rgba(255, 255, 255, 0.5);
        filter: brightness(2);
    }
    100% {
        box-shadow: 0 0 20px rgba(167, 139, 250, 0.6);
        filter: brightness(1);
    }
}

/* ========== TITLE SCREEN ========== */
#title-screen {
    background: linear-gradient(180deg, #0a0a1a 0%, #1a1a3a 50%, #0f0f2a 100%);
    gap: 20px;
    overflow: hidden;
    position: relative;
}

.starfield {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle var(--duration) ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: var(--min-opacity); transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

.shooting-star {
    position: absolute;
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, white, transparent);
    animation: shoot 3s linear infinite;
    opacity: 0;
}

@keyframes shoot {
    0% { transform: translateX(-100px) translateY(0); opacity: 0; }
    10% { opacity: 1; }
    30% { opacity: 0; }
    100% { transform: translateX(100vw) translateY(100px); opacity: 0; }
}

.title-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.game-title {
    font-family: 'Fredoka One', cursive;
    font-size: 3rem;
    color: #fbbf24;
    text-shadow: 4px 4px 0 #b45309, 0 0 40px rgba(251, 191, 36, 0.5), 0 0 80px rgba(251, 191, 36, 0.3);
    animation: title-bounce 2s ease-in-out infinite;
}

.game-subtitle {
    font-family: 'Fredoka One', cursive;
    font-size: 2rem;
    color: #60a5fa;
    margin-top: -15px;
}

.tlearner-credit {
    color: rgba(255,255,255,0.5);
    font-size: 0.9rem;
    margin-top: 30px;
}

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

/* ========== AGE SCREEN ========== */
#age-screen {
    background: linear-gradient(180deg, #7c3aed 0%, #4c1d95 100%);
    gap: 30px;
    overflow-y: auto;
    padding: 20px;
}

.section-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    color: white;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.3);
}

.age-buttons {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.age-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 30px 50px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Fredoka One', cursive;
}

.age-btn.young {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
}

.age-btn.older {
    background: linear-gradient(135deg, #f472b6, #ec4899);
}

.age-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.age-icon {
    font-size: 3rem;
}

.age-range {
    font-size: 1.8rem;
    color: white;
}

/* ========== RULES SCREEN ========== */
#rules-screen {
    background: linear-gradient(180deg, #059669 0%, #047857 100%);
    gap: 20px;
    padding: 30px;
    overflow-y: auto;
}

.rules-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 350px;
}

.rule {
    background: rgba(255,255,255,0.15);
    padding: 15px 25px;
    border-radius: 15px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: left;
}

/* ========== CHARACTER SELECT ========== */
#character-screen {
    background: linear-gradient(180deg, #0c4a6e 0%, #075985 50%, #0369a1 100%);
    padding: 0;
    padding-top: 50px;
}

#character-screen .screen-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

#character-screen .screen-content::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-width: 400px;
    width: 100%;
}

.character-card {
    background: rgba(255,255,255,0.15);
    border: 3px solid transparent;
    border-radius: 15px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.character-card:hover:not(.locked) {
    background: rgba(255,255,255,0.25);
    transform: scale(1.05);
}

.character-card.selected {
    border-color: #fbbf24;
    background: rgba(251, 191, 36, 0.3);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

.character-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.character-preview {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-preview img {
    max-width: 100%;
    max-height: 100%;
    image-rendering: pixelated;
}

.character-name {
    font-family: 'Fredoka One', cursive;
    font-size: 0.8rem;
    color: white;
    text-align: center;
}

.lock-icon {
    font-size: 1.5rem;
}

/* Mr. T Unlock Progress */
.unlock-progress {
    background: rgba(255,255,255,0.1);
    padding: 12px 20px;
    border-radius: 15px;
    text-align: center;
    width: 100%;
    max-width: 300px;
}

.unlock-label {
    font-size: 0.9rem;
    color: white;
    margin-bottom: 8px;
}

.unlock-bar {
    width: 100%;
    height: 12px;
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    overflow: hidden;
}

.unlock-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    border-radius: 6px;
    transition: width 0.3s;
}

.unlock-text {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.7);
    margin-top: 5px;
}

/* ========== AURA SCREEN ========== */
#aura-screen {
    background: linear-gradient(180deg, #0a0015 0%, #1a0a2e 40%, #0a0015 100%);
    padding: 0;
    gap: 0;
    overflow: hidden;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Layer 1: Starfield canvas */
#starfield-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
}

/* Layer 2: Rain emojis */
.weather-container {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 2;
    overflow: hidden;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.weather-emoji {
    position: absolute;
    pointer-events: none;
    user-select: none;
    will-change: transform, opacity;
}

@keyframes weatherFall {
    0% { transform: translateY(0) translateX(0); }
    100% { transform: translateY(110vh) translateX(-30px); opacity: 0; }
}

/* Layer 3: Character + rainbow glow */
.streak-character-bg {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.streak-character-img {
    position: relative;
    z-index: 1;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.streak-character-img img {
    width: 100%; height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    opacity: 0.2;
    transition: all 0.5s ease;
    filter: drop-shadow(0 0 10px rgba(167, 139, 250, 0.5));
}

/* Blacked-out unicorn silhouette */
.streak-character-img .silhouette-char {
    width: 100%; height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    opacity: 0.15;
    filter: brightness(0) drop-shadow(0 0 20px rgba(167, 139, 250, 0.6));
    transition: all 0.5s ease;
}

.streak-character-bg.powered .streak-character-img img,
.streak-character-bg.powered .streak-character-img .silhouette-char {
    opacity: 0.3;
    filter: drop-shadow(0 0 20px rgba(167, 139, 250, 0.8))
           drop-shadow(0 0 40px rgba(139, 92, 246, 0.4));
}
.streak-character-bg.powered .streak-character-img .silhouette-char {
    filter: brightness(0) drop-shadow(0 0 20px rgba(167, 139, 250, 0.8))
           drop-shadow(0 0 40px rgba(139, 92, 246, 0.4));
}

.streak-character-bg.supercharged .streak-character-img img,
.streak-character-bg.supercharged .streak-character-img .silhouette-char {
    opacity: 0.45;
    filter: drop-shadow(0 0 30px rgba(251, 191, 36, 1))
           drop-shadow(0 0 60px rgba(239, 68, 68, 0.6))
           drop-shadow(0 0 100px rgba(167, 139, 250, 0.8));
}
.streak-character-bg.supercharged .streak-character-img .silhouette-char {
    filter: brightness(0) drop-shadow(0 0 30px rgba(251, 191, 36, 1))
           drop-shadow(0 0 60px rgba(239, 68, 68, 0.6))
           drop-shadow(0 0 100px rgba(167, 139, 250, 0.8));
}

.streak-rainbow-glow {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 0;
    opacity: 0;
    transition: all 0.5s ease;
}

.streak-character-bg.powered .streak-rainbow-glow {
    opacity: 0.4;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.6) 0%, rgba(139, 92, 246, 0.2) 50%, transparent 70%);
}

.streak-character-bg.supercharged .streak-rainbow-glow {
    opacity: 0.6;
    background: radial-gradient(circle,
        rgba(255, 50, 50, 0.4) 0%, rgba(255, 165, 0, 0.3) 15%,
        rgba(255, 255, 0, 0.3) 30%, rgba(50, 255, 50, 0.3) 45%,
        rgba(50, 50, 255, 0.3) 60%, rgba(139, 0, 255, 0.3) 75%,
        transparent 90%);
    animation: rainbowSpin 3s linear infinite;
}

@keyframes rainbowSpin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Layer 4: Aura number */
.aura-number-overlay {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Fredoka One', cursive;
    font-size: 5rem;
    color: white;
    text-shadow:
        0 0 20px rgba(167, 139, 250, 0.8),
        0 0 40px rgba(139, 92, 246, 0.5),
        0 4px 8px rgba(0, 0, 0, 0.6);
    z-index: 4;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0.9;
}

/* Layer 5: UI content */
.aura-ui-layer {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 500px;
    padding: 10px 15px;
    margin-top: auto;
    padding-bottom: 70px;
}

.aura-header {
    text-align: center;
    flex-shrink: 0;
}

.aura-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    color: #c4b5fd;
    text-shadow: 0 0 30px rgba(196, 181, 253, 0.8), 0 0 60px rgba(167, 139, 250, 0.5);
    animation: title-glow 3s ease-in-out infinite;
}

/* Layer 6: Nav bar */
.aura-nav-bar {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 12px 15px;
    background: linear-gradient(transparent, rgba(10, 0, 21, 0.95) 30%);
    z-index: 6;
}



.aura-nav-bar .nav-btn {
    font-size: 1rem;
    padding: 12px 20px;
}

.aura-nav {
    display: none;
}

@keyframes title-glow {
    0%, 100% { text-shadow: 0 0 30px rgba(167, 139, 250, 0.8); }
    50% { text-shadow: 0 0 60px rgba(167, 139, 250, 1), 0 0 100px rgba(139, 92, 246, 0.5); }
}

.aura-subtitle {
    color: #c4b5fd;
    font-size: 1.1rem;
    margin-top: 5px;
}

/* Aura Orb Display */
.aura-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.aura-orb {
    position: relative;
    width: 100px;
    height: 100px;
}

.aura-orb-inner {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 30%, #a78bfa, #7c3aed, #4c1d95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        inset 0 -10px 30px rgba(0,0,0,0.3),
        inset 0 10px 30px rgba(255,255,255,0.1);
    animation: orb-float 3s ease-in-out infinite;
}

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

#aura-amount {
    font-family: 'Fredoka One', cursive;
    font-size: 2.2rem;
    color: white;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.aura-glow {
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    animation: glow-pulse 2s ease-in-out infinite;
    pointer-events: none;
}

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

.aura-bar-container {
    width: 280px;
    text-align: center;
}

.aura-bar {
    width: 100%;
    height: 24px;
    background: rgba(0,0,0,0.4);
    border-radius: 12px;
    overflow: visible;
    border: 2px solid rgba(167, 139, 250, 0.3);
    position: relative;
}

.aura-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #667eea, #a78bfa, #c4b5fd);
    border-radius: 10px;
    transition: width 0.3s ease;
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.6);
    position: relative;
}

.aura-label {
    color: #c4b5fd;
    font-weight: 800;
    margin-top: 8px;
    font-size: 1rem;
}

/* Math Zone */
.math-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.05);
    padding: 20px 30px;
    border-radius: 20px;
    border: 1px solid rgba(167, 139, 250, 0.2);
    flex-shrink: 0;
    width: 100%;
    max-width: 500px;
    backdrop-filter: blur(8px);
}

.math-problem {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    color: white;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.math-input {
    font-family: 'Fredoka One', cursive;
    font-size: 1.6rem;
    width: 130px;
    padding: 10px 15px;
    text-align: center;
    border: 3px solid #667eea;
    border-radius: 15px;
    background: rgba(255,255,255,0.1);
    color: white;
    outline: none;
}

.math-input:focus {
    border-color: #a78bfa;
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.5);
}

.math-feedback {
    font-weight: 800;
    font-size: 1.2rem;
    min-height: 30px;
}

.math-feedback.correct {
    color: #4ade80;
    animation: pop 0.3s ease;
}

.math-feedback.wrong {
    color: #f87171;
    animation: shake 0.3s ease;
}

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

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

/* Streak display */
.streak-display {
    color: #fbbf24;
    font-family: 'Fredoka One', cursive;
    font-size: 1.3rem;
    text-align: center;
    text-shadow: 0 0 15px rgba(251, 191, 36, 0.6);
    animation: streakPulse 1s ease-in-out infinite;
    display: none;
}

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

/* Disabled nav buttons (0 aura) */
.nav-disabled {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    filter: grayscale(1) !important;
}

/* Buttons light up at 99 aura */
.nav-maxed {
    animation: navMaxedPulse 1.5s ease-in-out infinite !important;
    filter: brightness(1.3) saturate(1.4) !important;
}

.nav-maxed.nav-blue {
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.8), 0 0 30px rgba(59, 130, 246, 0.4) !important;
}
.nav-maxed.nav-green {
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.8), 0 0 30px rgba(34, 197, 94, 0.4) !important;
}
.nav-maxed.nav-orange {
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.8), 0 0 30px rgba(249, 115, 22, 0.4) !important;
}

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

.aura-nav {
    display: none; /* Replaced by game-nav */
}

/* ========== PLAY SCREEN ========== */
#play-screen {
    background: #87ceeb;
}

#play-canvas {
    display: block;
}

/* ========== TOP BAR (Universal) ========== */
.top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(10px);
    z-index: 100;
}

.nav-left {
    display: flex;
    gap: 8px;
}

.top-aura {
    flex: 1;
    max-width: 200px;
    margin: 0 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-aura .aura-bar {
    flex: 1;
    height: 20px;
}

.aura-number {
    font-family: 'Fredoka One', cursive;
    font-size: 1.1rem;
    color: white;
    text-shadow: 0 0 10px rgba(167, 139, 250, 0.8);
    min-width: 30px;
}

/* Color-coded nav buttons */
.nav-btn {
    font-family: 'Fredoka One', cursive;
    font-size: 1.2rem;
    padding: 8px 14px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
}

.nav-btn:hover {
    transform: scale(1.1);
    filter: brightness(1.2);
}

.nav-btn.nav-blue {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.4);
}

.nav-btn.nav-green {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.4);
}

.nav-btn.nav-orange {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

.nav-btn.nav-purple {
    background: linear-gradient(135deg, #a855f7, #7c3aed);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}

.farm-btn {
    font-size: 1.3rem;
}

/* Magical aura bar */
.aura-bar.magical {
    background: rgba(0,0,0,0.5);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    border: 2px solid rgba(167, 139, 250, 0.3);
}

.aura-fill.magical {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #a78bfa, #c4b5fd);
    border-radius: 8px;
    position: relative;
    transition: width 0.3s ease;
    box-shadow: 0 0 15px rgba(167, 139, 250, 0.6);
}

.aura-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s ease-in-out infinite;
}

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

/* ========== BUILD SCREEN ========== */
#build-screen {
    background: #1e293b;
    padding: 0;
    padding-top: 50px;
}

.build-layout {
    display: flex;
    width: 100%;
    height: calc(100% - 50px);
}

.build-sidebar {
    width: 150px;
    background: rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    border-right: 2px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.build-canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#build-canvas {
    display: block;
    cursor: crosshair;
}

.build-toolbar {
    display: contents;
}

.zoom-section {
    flex-shrink: 0;
    border-bottom: 2px solid rgba(255,255,255,0.2);
    padding: 10px;
}

.zoom-fit-btn {
    width: 100%;
    padding: 8px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    font-family: 'Fredoka One', cursive;
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.zoom-fit-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

.toolbar-label {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.6);
    text-align: center;
    font-weight: 800;
    margin-bottom: 5px;
}

.toolbar-hint {
    font-size: 0.55rem;
    color: rgba(255,255,255,0.4);
    text-align: center;
    margin-bottom: 8px;
}

/* Zoom controls in build sidebar */

.zoom-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.zoom-btn {
    width: 32px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: 'Fredoka One', cursive;
}

.zoom-btn:hover {
    background: rgba(255,255,255,0.25);
}

#zoom-level {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.7);
    min-width: 30px;
    text-align: center;
}

.toolbar-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.toolbar-section {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.toolbar-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.tool {
    width: 100%;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: rgba(255,255,255,0.08);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
}

.tool:hover {
    background: rgba(255,255,255,0.15);
}

.tool.selected {
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.2);
}

.tool.special {
    font-size: 1.1rem;
}

.tool.danger {
    color: #f87171;
}

.build-info {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.5);
    color: #a0aec0;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
}

/* ========== CELEBRATION SCREEN ========== */
/* ========== ENCOURAGEMENT OVERLAY ========== */
.encourage-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(30, 10, 60, 0.92) 0%, rgba(10, 5, 30, 0.97) 100%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    cursor: pointer;
    animation: encourage-fade-in 0.5s ease;
}

@keyframes encourage-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.encourage-character {
    width: 140px;
    height: 140px;
    image-rendering: pixelated;
    animation: encourage-bounce 1s ease infinite alternate;
}

.encourage-character img {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}

@keyframes encourage-bounce {
    from { transform: translateY(0) scale(1); }
    to { transform: translateY(-12px) scale(1.05); }
}

.encourage-bubble {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    padding: 16px 28px;
    border-radius: 20px;
    max-width: 320px;
    text-align: center;
    position: relative;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    animation: encourage-pop 0.4s ease 0.2s both;
}

@keyframes encourage-pop {
    from { transform: scale(0.7); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.encourage-bubble::after {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    border: 12px solid transparent;
    border-bottom-color: rgba(255, 255, 255, 0.95);
    border-top: 0;
}

.encourage-tap {
    color: rgba(255,255,255,0.5);
    font-size: 0.85rem;
    margin: 0;
    animation: encourage-pulse 1.5s ease infinite;
}

@keyframes encourage-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

#celebration-screen {
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
    gap: 0;
    overflow: hidden;
    padding: 0;
    padding-top: 50px;
}

.celebration-bar {
    background: rgba(0,0,0,0.4);
}

.celebration-bar .nav-left {
    gap: 6px;
}

#celebration-canvas {
    width: 100%;
    flex: 1;
    background: transparent;
}

.celebration-nav {
    display: none; /* Replaced by hud-nav */
}

.winner-character {
    width: 120px;
    height: 120px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: dance 0.3s ease infinite alternate;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    overflow: hidden;
}

.winner-character img {
    max-width: 90%;
    max-height: 90%;
    image-rendering: pixelated;
}

@keyframes dance {
    from { transform: translateX(-15px) rotate(-15deg) translateY(0); }
    to { transform: translateX(15px) rotate(15deg) translateY(-20px); }
}

.emoji-rain {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    font-size: 2.5rem;
    max-width: 300px;
}

.emoji-rain span {
    animation: wiggle 0.4s ease infinite;
    display: inline-block;
}

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

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

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #fff;
    animation: confetti-fall 3s linear infinite;
}

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

/* ========== RESPONSIVE ========== */
@media (max-width: 500px) {
    .aura-title { font-size: 2rem; }
    .math-problem { font-size: 1.8rem; }
    .math-input { font-size: 1.5rem; width: 120px; }
    .aura-orb { width: 110px; height: 110px; }
    #aura-amount { font-size: 2.5rem; }
    .aura-bar-container { width: 220px; }
    .btn { font-size: 1.1rem; padding: 12px 30px; }
}
