:root {
    --cream: #FAF8F5;
    --sky-start: #87CEEB;
    --sky-end: #E0F4FF;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--cream);
    -webkit-font-smoothing: antialiased;
}

.bg-cream {
    background-color: var(--cream);
}

.pb-safe {
    padding-bottom: env(safe-area-inset-bottom, 8px);
}

.featured-creature {
    background: linear-gradient(180deg, var(--sky-start) 0%, var(--sky-end) 100%);
    position: relative;
    min-height: 200px;
}

.clouds {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.cloud {
    position: absolute;
    background: white;
    border-radius: 50px;
    opacity: 0.8;
}

.cloud::before,
.cloud::after {
    content: '';
    position: absolute;
    background: white;
    border-radius: 50%;
}

.cloud-1 {
    width: 100px;
    height: 40px;
    top: 20%;
    left: 10%;
    animation: cloud-drift 20s linear infinite;
}

.cloud-1::before {
    width: 50px;
    height: 50px;
    top: -25px;
    left: 15px;
}

.cloud-1::after {
    width: 35px;
    height: 35px;
    top: -18px;
    left: 55px;
}

.cloud-2 {
    width: 80px;
    height: 32px;
    top: 40%;
    right: 15%;
    animation: cloud-drift 25s linear infinite reverse;
}

.cloud-2::before {
    width: 40px;
    height: 40px;
    top: -20px;
    left: 12px;
}

.cloud-2::after {
    width: 28px;
    height: 28px;
    top: -14px;
    left: 42px;
}

.cloud-3 {
    width: 60px;
    height: 24px;
    bottom: 20%;
    left: 60%;
    animation: cloud-drift 18s linear infinite;
}

.cloud-3::before {
    width: 30px;
    height: 30px;
    top: -15px;
    left: 10px;
}

.cloud-3::after {
    width: 22px;
    height: 22px;
    top: -11px;
    left: 32px;
}

@keyframes cloud-drift {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(calc(100vw + 100%)); }
}

.creature-bounce {
    animation: bounce 2s ease-in-out infinite;
    image-rendering: pixelated;
}

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

.habit-card {
    transition: all 0.2s ease;
}

.habit-card:active {
    transform: scale(0.98);
}

.creature-card {
    transition: all 0.2s ease;
}

.creature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Confetti animation */
.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: confetti-fall 3s linear forwards;
}

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

.animate-bounce-in {
    animation: bounce-in 0.5s ease-out;
}

@keyframes bounce-in {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    70% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d4d4d8;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1aa;
}

/* Mobile optimizations */
@media (max-width: 640px) {
    .featured-creature {
        min-height: 180px;
    }
    
    .cloud-1 { width: 70px; height: 28px; }
    .cloud-2 { width: 56px; height: 22px; }
    .cloud-3 { width: 42px; height: 17px; }
}

/* Animation for level up */
@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.5); }
    50% { box-shadow: 0 0 40px rgba(16, 185, 129, 0.8); }
}

.level-up-glow {
    animation: glow 1s ease-in-out infinite;
}

/* Safe area for iOS */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    nav {
        padding-bottom: env(safe-area-inset-bottom);
    }
}