@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@400;500;600;700&family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Neutral Theme */
    --neutral-primary: #667eea;
    --neutral-secondary: #764ba2;
    --neutral-accent: #f093fb;
    --neutral-text: #ffffff;
    
    /* Song 1 Theme (Romantic/Warm) */
    --song1-primary: #ff758c;
    --song1-secondary: #ff7eb3;
    --song1-accent: #ffd89b;
    --song1-text: #2d1b37;
    
    /* Song 2 Theme (Cool/Serene) */
    --song2-primary: #4facfe;
    --song2-secondary: #00f2fe;
    --song2-accent: #667eea;
    --song2-text: #ffffff;
}

/* Removed duplicate - consolidated below with iOS optimizations */

/* Background Styles */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at top, rgba(80, 50, 120, 0.5) 0%, transparent 50%),
        radial-gradient(ellipse at bottom, rgba(120, 80, 150, 0.4) 0%, transparent 50%),
        linear-gradient(135deg, #1a1625 0%, #2d1b3d 50%, #3d2947 100%);
    transition: all 3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -2;
    animation: backgroundShift 20s ease-in-out infinite alternate;
}

.theme-song1 .background {
    background: 
        radial-gradient(circle at 20% 20%, rgba(160, 80, 120, 0.6) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(200, 120, 80, 0.5) 0%, transparent 40%),
        radial-gradient(ellipse at center, rgba(140, 70, 110, 0.4) 0%, transparent 70%),
        linear-gradient(45deg, #2d1b2f 0%, #4a2c54 25%, #6b3d5e 50%, #3d2947 75%, #2d1b3d 100%);
    animation: romanticGlow 15s ease-in-out infinite alternate;
}

.theme-song2 .background {
    background: 
        radial-gradient(circle at 30% 10%, rgba(60, 80, 140, 0.5) 0%, transparent 50%),
        radial-gradient(circle at 70% 90%, rgba(80, 60, 120, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at center, rgba(40, 30, 60, 0.4) 0%, transparent 60%),
        linear-gradient(-45deg, #1a1625 0%, #2d1b3d 25%, #3d2947 50%, #2a1e3a 75%, #1f1a2e 100%);
    animation: sereneFlow 18s ease-in-out infinite alternate;
}

/* Background Animations */
@keyframes backgroundShift {
    0% {
        transform: scale(1) rotate(0deg);
    }
    50% {
        transform: scale(1.05) rotate(0.5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

@keyframes romanticGlow {
    0% {
        transform: scale(1) rotate(0deg);
        filter: hue-rotate(0deg) brightness(1);
    }
    25% {
        transform: scale(1.02) rotate(0.3deg);
        filter: hue-rotate(5deg) brightness(1.1);
    }
    50% {
        transform: scale(1.05) rotate(0deg);
        filter: hue-rotate(10deg) brightness(1.2);
    }
    75% {
        transform: scale(1.02) rotate(-0.3deg);
        filter: hue-rotate(5deg) brightness(1.1);
    }
    100% {
        transform: scale(1) rotate(0deg);
        filter: hue-rotate(0deg) brightness(1);
    }
}

@keyframes sereneFlow {
    0% {
        transform: scale(1) rotate(0deg);
        filter: hue-rotate(0deg) brightness(1);
    }
    33% {
        transform: scale(1.03) rotate(0.2deg);
        filter: hue-rotate(-5deg) brightness(1.1);
    }
    66% {
        transform: scale(1.06) rotate(-0.2deg);
        filter: hue-rotate(-10deg) brightness(1.2);
    }
    100% {
        transform: scale(1) rotate(0deg);
        filter: hue-rotate(0deg) brightness(1);
    }
}

/* Floating Musical Notes */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.particle {
    position: absolute;
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    animation: musicalFloat 12s infinite linear;
    user-select: none;
    pointer-events: none;
    transition: all 0.3s ease;
}

.theme-song1 .particle {
    color: rgba(255, 182, 193, 0.8);
    text-shadow: 0 0 10px rgba(255, 182, 193, 0.5);
}

.theme-song2 .particle {
    color: rgba(173, 216, 230, 0.7);
    text-shadow: 0 0 8px rgba(173, 216, 230, 0.4);
}

@keyframes musicalFloat {
    0% {
        transform: translateY(100vh) translateX(0px) rotate(0deg) scale(0.5);
        opacity: 0;
    }
    10% {
        opacity: 1;
        transform: translateY(90vh) translateX(20px) rotate(45deg) scale(1);
    }
    50% {
        transform: translateY(50vh) translateX(-20px) rotate(180deg) scale(1.2);
    }
    90% {
        opacity: 1;
        transform: translateY(10vh) translateX(30px) rotate(315deg) scale(0.8);
    }
    100% {
        transform: translateY(-10vh) translateX(-10px) rotate(360deg) scale(0.3);
        opacity: 0;
    }
}

/* Main Container */
#app-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: all 1s ease;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

/* Scene Management */
.scene {
    width: 100%;
    max-width: 700px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8) translateY(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: center center;
    box-sizing: border-box;
    margin: 0 auto;
}

.scene.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
    position: absolute;
    top: 50%;
    left: 50%;
}

/* Typography */
h1 {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5), 0 4px 20px rgba(0, 0, 0, 0.8);
    line-height: 1.2;
    transition: color 1s ease;
}

.theme-song1 h1 {
    color: #ffffff;
    text-shadow: 0 0 30px rgba(255, 182, 193, 0.8), 0 4px 20px rgba(0, 0, 0, 0.8);
}

.theme-song2 h1 {
    color: #ffffff;
    text-shadow: 0 0 30px rgba(173, 216, 230, 0.8), 0 4px 20px rgba(0, 0, 0, 0.8);
}

h2 {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 2rem;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.4), 0 2px 15px rgba(0, 0, 0, 0.8);
}

p {
    font-size: clamp(1.1rem, 3vw, 1.3rem);
    line-height: 1.8;
    margin-bottom: 1rem;
    color: #ffffff;
    font-weight: 400;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.3), 0 1px 10px rgba(0, 0, 0, 0.8);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Choice Buttons */
.choices {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

@media (min-width: 768px) {
    .choices {
        flex-direction: row;
        justify-content: center;
        gap: 2.5rem;
    }
}

.choices button {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: inherit;
    padding: 1.2rem 2.5rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 500;
    font-family: 'Crimson Text', serif;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-width: 250px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.choices button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.choices button:hover::before {
    left: 100%;
}

.choices button:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
    animation: buttonPulse 2s infinite ease-in-out;
}

.choices button:active {
    transform: translateY(-4px) scale(1.02);
}

/* Lyrics Container */
.lyrics-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: 3rem 2rem;
    margin-top: 2rem;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.1);
    transition: all 0.6s ease;
    text-align: center;
    max-height: 70vh;
    overflow-y: auto;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.theme-song1 .lyrics-container {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 182, 193, 0.4);
    box-shadow: 0 15px 50px rgba(255, 117, 140, 0.2);
}

.theme-song2 .lyrics-container {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(173, 216, 230, 0.4);
    box-shadow: 0 15px 50px rgba(44, 62, 80, 0.3);
}

/* Current Lyric Display */
.current-lyric {
    font-size: clamp(1.8rem, 5vw, 3rem);
    line-height: 1.6;
    font-weight: 500;
    text-align: center;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.8), 0 2px 10px rgba(0, 0, 0, 0.5);
    transition: all 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(30px) scale(0.8);
    padding: 2rem;
    margin: 1rem 0;
    font-family: 'Crimson Text', serif;
    font-style: italic;
    letter-spacing: 1px;
}

.current-lyric.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: lyricFadeGlow 4s ease-in-out infinite alternate;
}

.theme-song1 .current-lyric {
    color: #ffffff;
    text-shadow: 0 0 30px #ffd700, 0 0 60px #ffd700, 0 4px 20px rgba(0, 0, 0, 0.8);
}

.theme-song2 .current-lyric {
    color: #ffffff;
    text-shadow: 0 0 30px #87ceeb, 0 0 60px #87ceeb, 0 4px 20px rgba(0, 0, 0, 0.8);
}

/* Next Song Button */
.next-song-button-container {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    opacity: 0;
    transform: translateY(30px);
    transition: all 1s ease;
}

.next-song-button-container.show {
    opacity: 1;
    transform: translateY(0);
}

.next-song-button {
    background: linear-gradient(45deg, #ff6b6b, #ffd93d, #6bcf7f, #4ecdc4);
    background-size: 300% 300%;
    animation: gradientShift 3s ease infinite;
    border: none;
    color: #ffffff;
    padding: 1.5rem 3rem;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: 'Dancing Script', cursive;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.4s ease;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.next-song-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.6s ease;
}

.next-song-button:hover::before {
    left: 100%;
}

.next-song-button:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    animation: gradientShift 1.5s ease infinite, buttonPulse 2s ease-in-out infinite;
}

.next-song-button:active {
    transform: translateY(-4px) scale(1.02);
}

/* Lyric Fade Glow Animation */
@keyframes lyricFadeGlow {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.01);
        opacity: 0.9;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Gradient Shift Animation */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Hide old lyric line styles */
.lyric-line {
    display: none;
}

/* Verse and Chorus Styling (for other songs) */
.verse {
    margin-bottom: 2rem;
    padding: 1rem 0;
}

.verse p {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    line-height: 1.6;
}

.chorus {
    margin: 2rem 0;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    border-left: 4px solid rgba(255, 255, 255, 0.5);
}

.chorus p {
    font-style: italic;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
}

/* Theme-specific text colors */
.theme-neutral {
    color: var(--neutral-text);
}

.theme-song1 {
    color: var(--song1-text);
}

.theme-song2 {
    color: var(--song2-text);
}

/* Button Animations */
@keyframes buttonPulse {
    0% {
        transform: translateY(-8px) scale(1.05);
        box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
    }
    50% {
        transform: translateY(-10px) scale(1.08);
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    }
    100% {
        transform: translateY(-8px) scale(1.05);
        box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
    }
}

/* iOS and Mobile Optimizations - Consolidated body styles */
html {
    height: -webkit-fill-available;
    height: fill-available;
}

body {
    font-family: 'Crimson Text', serif;
    margin: 0;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    min-height: fill-available;
    overflow-x: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #app-container {
        padding: 10px;
        min-height: 100vh;
        min-height: -webkit-fill-available;
        min-height: fill-available;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow: hidden;
    }
    
    .scene {
        max-width: 95%;
        padding: 10px;
        box-sizing: border-box;
    }
    
    .choices button {
        min-width: 280px;
        max-width: 320px;
        padding: 1rem 2rem;
        font-size: 1rem;
        margin: 0 auto 1rem auto;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        border-radius: 25px;
    }
    
    .lyrics-container {
        padding: 1.5rem 1rem;
        margin-top: 1rem;
        border-radius: 15px;
        max-height: 50vh;
        min-height: 300px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .current-lyric {
        font-size: clamp(1.2rem, 4vw, 2rem);
        padding: 1rem;
        min-height: 150px;
    }
    
    .cat-gif {
        max-width: 120px;
    }
    
    /* Fix iOS audio issues */
    audio {
        display: none;
    }
    
    .verse p {
        font-size: 1rem;
    }
    
    .chorus p {
        font-size: 1.1rem;
    }
}

/* iPhone specific fixes */
@media (max-width: 480px) and (-webkit-min-device-pixel-ratio: 2) {
    .lyrics-container {
        padding: 1rem 0.8rem;
        margin-top: 0.5rem;
        max-height: 45vh;
        border-radius: 12px;
    }
    
    .current-lyric {
        font-size: clamp(1rem, 3.5vw, 1.8rem);
        padding: 0.8rem;
        min-height: 120px;
        line-height: 1.4;
    }
    
    .choices button {
        min-width: 250px;
        padding: 0.9rem 1.5rem;
        font-size: 0.9rem;
        margin: 0 auto 0.8rem auto;
    }
    
    .cat-gif {
        max-width: 100px;
    }
    
    h1 {
        font-size: clamp(2rem, 6vw, 3.5rem);
    }
    
    h2 {
        font-size: clamp(1.8rem, 5vw, 3rem);
    }
    
    p {
        font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    }
}

/* Fix backdrop-filter for older iOS */
@supports not (backdrop-filter: blur(10px)) {
    .choices button {
        background: rgba(255, 255, 255, 0.25);
    }
    
    .lyrics-container {
        background: rgba(255, 255, 255, 0.15);
    }
    
    .theme-song1 .lyrics-container {
        background: rgba(255, 255, 255, 0.25);
    }
    
    .theme-song2 .lyrics-container {
        background: rgba(0, 0, 0, 0.3);
    }
}

/* Initial animation */
#scene-initial {
    animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Improved hover states */
.choices button {
    position: relative;
    overflow: hidden;
}

.choices button:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Cat GIF Styling */
.cat-gif-container {
    text-align: center;
    margin: 2rem 0 1rem 0;
    transition: all 1s ease;
    background: transparent;
}

.cat-gif {
    max-width: 150px;
    height: auto;
    border-radius: 10px;
    background: transparent;
}

/* Better accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .particle {
        display: none;
    }
}

/* MARIPOSA (BUTTERFLY) EFFECT */

/* Animation stage */
.stage {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    height: 100vh;
    width: 100%;
    max-width: 900px;
    overflow-y: hidden;
    z-index: 2;
    pointer-events: none;
}

/* Hide some butterflies in Song 2 theme to reduce chaos */
.theme-song2 .mariposa-4,
.theme-song2 .mariposa-6,
.theme-song2 .mariposa-7,
.theme-song2 .mariposa-8 {
    display: none;
}

/* Parent is for vertical flight */
.mariposa {
    position: absolute;
    width: 200px;
    height: 200px;
    opacity: 0; /* start at 0 so they don't appear while loading */
    -webkit-animation-fill-mode: backwards;
    animation-fill-mode: backwards;
    animation: fly 6s infinite linear;
}

/* Random positioning and timing for each butterfly */
.mariposa-1 {
    left: 20%;
    animation-delay: 0.5s;
    animation-duration: 5s;
}

.mariposa-1 .mariposa-turn {
    animation-delay: 0.2s;
}

.mariposa-1 .mariposa-flutter {
    transform: scale(0.8) rotateX(35deg);
}

.mariposa-2 {
    left: 70%;
    animation-delay: 1.2s;
    animation-duration: 7s;
}

.mariposa-2 .mariposa-turn {
    animation-delay: 0.8s;
}

.mariposa-2 .mariposa-flutter {
    transform: scale(0.6) rotateX(55deg);
}

.mariposa-3 {
    left: 45%;
    animation-delay: 2.1s;
    animation-duration: 6s;
}

.mariposa-3 .mariposa-turn {
    animation-delay: 1.5s;
}

.mariposa-3 .mariposa-flutter {
    transform: scale(0.9) rotateX(25deg);
}

.mariposa-4 {
    left: 15%;
    animation-delay: 3.3s;
    animation-duration: 8s;
}

.mariposa-4 .mariposa-turn {
    animation-delay: 2.1s;
}

.mariposa-4 .mariposa-flutter {
    transform: scale(0.4) rotateX(65deg);
}

.mariposa-5 {
    left: 80%;
    animation-delay: 0.8s;
    animation-duration: 5.5s;
}

.mariposa-5 .mariposa-turn {
    animation-delay: 0.4s;
}

.mariposa-5 .mariposa-flutter {
    transform: scale(0.7) rotateX(45deg);
}

.mariposa-6 {
    left: 35%;
    animation-delay: 4.2s;
    animation-duration: 7.5s;
}

.mariposa-6 .mariposa-turn {
    animation-delay: 3.1s;
}

.mariposa-6 .mariposa-flutter {
    transform: scale(0.5) rotateX(75deg);
}

.mariposa-7 {
    left: 60%;
    animation-delay: 1.8s;
    animation-duration: 6.5s;
}

.mariposa-7 .mariposa-turn {
    animation-delay: 1.2s;
}

.mariposa-7 .mariposa-flutter {
    transform: scale(0.85) rotateX(15deg);
}

.mariposa-8 {
    left: 25%;
    animation-delay: 5.1s;
    animation-duration: 8.5s;
}

.mariposa-8 .mariposa-turn {
    animation-delay: 4.2s;
}

.mariposa-8 .mariposa-flutter {
    transform: scale(0.3) rotateX(85deg);
}

/* Establishes perspective, animates rotation and horizontal movement */
.mariposa-turn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 200px;
    height: 150px;
    perspective: 1000px;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    left: 0;
    margin: auto;
    transform-origin: 50% 80%; /* turn from a natural center */
    -webkit-animation-fill-mode: both;
    animation-fill-mode: both;
    animation: turn 3s infinite cubic-bezier(.31,.09,.77,1.5);
    transform-style: preserve-3d;
    filter: drop-shadow(50px 30px 10px rgba(0, 0, 0, 0.5));
}

.mariposa-flutter {
    width: 2rem;
    height: 8rem;
    position: relative;
    top: 0;
    margin: 0 auto;
    background: url("https://assets.codepen.io/2273448/butterfly-body.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    transform-style: preserve-3d;
    transform: rotateX(25deg) rotateY(5deg);
}

/* Wings */
.mariposa-flutter::before,
.mariposa-flutter::after {
    position: absolute;
    top: 5%;
    margin: auto;
    content: "";
    height: 100%;
    width: 250%;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    transform-style: preserve-3d;
    animation-delay: 0;
}

.mariposa-flutter::before {
    background-image: url("https://assets.codepen.io/2273448/butterfly-wing.png");
    transform-origin: 0% 50%;
    animation: flutter-r 0.3s infinite ease-out;
    left: 55%;
}

.mariposa-flutter::after {
    background-image: url("https://assets.codepen.io/2273448/butterfly-wing-l.png");
    transform-origin: 100% 50%;
    animation: flutter-l 0.3s infinite ease-out;
    right: 55%;
}

/* Wing flutter - right wing */
@keyframes flutter-r {
    0%, 100% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(-40deg);
    }
}

/* Wing flutter - left wing */
@keyframes flutter-l {
    0%, 100% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(40deg);
    }
}

/* Horizontal motion and rotation */
@keyframes turn {
    0%, 100% {
        transform: translateX(-20%) rotateZ(30deg);
    }
    25% {
        transform: translateX(50%) rotateZ(-30deg);
    }
    50% {
        transform: translateX(-80%) rotateZ(30deg);
    }
    75% {
        transform: translateX(30%) rotateZ(-30deg);
    }
}

/* Vertical flight motion */
@keyframes fly {
    0% {
        opacity: 0;
        transform: translateY(70vh);
    }
    3%, 99% {
        opacity: 1;
    }
    100% {
        transform: translateY(-70vh);
    }
}
