:root {
    --font-stack: 'Inter', system-ui, -apple-system, sans-serif;
    --text-color: #ffffff;
    --bg-dark: #121212;
    --spotify-green: #1ed760;
    --neon-pink: #FF0080;
    --electric-purple: #7928CA;
    --electric-blue: #2BD2FF;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-color);
    font-family: var(--font-stack);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 500px;
    /* Mobile first, constrained width on desktop */
    margin: 0 auto;
    background: #000;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

/* Start Overlay */
#start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    cursor: pointer;
}

.start-content {
    text-align: center;
    padding: 2rem;
}

.start-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    animation: icon-float 2s ease-in-out infinite;
}

@keyframes icon-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.start-content h2 {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 1rem;
    background: linear-gradient(90deg, #1ed760, #7928CA, #FF0080);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.start-text {
    font-size: 1.2rem;
    opacity: 0.8;
    margin-bottom: 2rem;
    animation: pulse-text 1.5s ease-in-out infinite;
}

@keyframes pulse-text {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

.tap-animation {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    margin: 0 auto;
    animation: tap-pulse 1.5s ease-out infinite;
}

@keyframes tap-pulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Progress Bars */
.progress-container {
    position: absolute;
    top: 10px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    z-index: 100;
    gap: 4px;
}

.progress-bar-bg {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: #fff;
    border-radius: 2px;
    /* transition is handled via JS usually, but we can keep a smooth default */
}

.progress-bar.completed {
    width: 100%;
}

/* Slides */
.slides-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    padding-top: 40px;
    /* Space for progress bars */
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    z-index: 1;
    overflow: hidden;
    box-sizing: border-box;
}

.slide.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}

/* Typography & Content */
.content {
    z-index: 10;
    width: 100%;
    max-width: 400px;
}

h1 {
    font-size: 3.2rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -2px;
    margin-bottom: 0.5rem;
    overflow-wrap: break-word;
    word-break: normal;
}

.neon-text {
    text-shadow: 0 0 20px rgba(30, 215, 96, 0.6);
}

h2 {
    font-size: 3.5rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -1px;
    margin-bottom: 2rem;
}

h3 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

p {
    font-size: 1.2rem;
    font-weight: 600;
    opacity: 0.9;
    letter-spacing: 0.5px;
}

/* Specific Visualizations */
.giant-stat {
    font-size: 4rem;
    font-weight: 900;
    margin: 1rem 0;
    letter-spacing: -2px;
    word-break: break-all;
    line-height: 1;
}

/* Versus Bars */
.versus-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 1rem;
    width: 100%;
}

.versus-row {
    text-align: left;
}

.versus-row .label {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.bar-wrapper {
    width: 100%;
    background: rgba(255, 255, 255, 0.2);
    height: 30px;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.bar-fill {
    height: 100%;
    display: flex;
    align-items: center;
    padding-left: 10px;
    font-weight: 800;
    color: #000;
    font-size: 0.9rem;
}

.bar-fill.pink {
    background-color: var(--neon-pink);
}

.bar-fill.green {
    background-color: var(--spotify-green);
}

.sub-stat {
    font-size: 0.9rem;
    opacity: 0.7;
    text-align: right;
}

/* Stat Grid for Habits */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    width: 100%;
    margin-top: 2rem;
}

.stat-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-item .icon {
    font-size: 2rem;
}

.stat-item h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    opacity: 0.7;
    margin-bottom: 0.2rem;
}

.stat-item .highlight {
    font-size: 1.5rem;
    font-weight: 800;
}

/* Streak Circle */
.streak-circle {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    border: 10px solid #fff;
    margin: 2rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

.inner-text {
    display: flex;
    flex-direction: column;
}

.inner-text .number {
    font-size: 5rem;
    font-weight: 900;
    line-height: 1;
}

.inner-text .label {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Card Stack */
.card-stack {
    position: relative;
    width: 100%;
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.stat-card {
    position: relative;
    width: 100%;
    background: #fff;
    color: #000;
    padding: 1.5rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    /* Remove absolute positioning to stop overlap */
}

.stat-card .card-title {
    font-size: 1rem;
    text-transform: uppercase;
    font-weight: 800;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.stat-card .card-value {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
}

.stat-card .card-sub {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Final Stats */
.final-stats {
    background: rgba(0, 0, 0, 0.3);
    padding: 2rem;
    border-radius: 20px;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 2rem 0;
}

/* Navigation & Interactive */
.nav-area {
    position: absolute;
    top: 0;
    height: 100%;
    width: 40%;
    /* Larger tap area */
    z-index: 50;
    cursor: pointer;
}

.nav-area.left {
    left: 0;
}

.nav-area.right {
    right: 0;
}

.replay-btn {
    margin-top: 2rem;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    border: none;
    background: #fff;
    color: #000;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Animations */
.animate-up {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.slide.active .animate-up {
    opacity: 1;
    transform: translateY(0);
}

.animate-scale {
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.slide.active .animate-scale {
    opacity: 1;
    transform: scale(1);
}

.animate-width {
    width: 0;
    transition: width 1s ease-out;
}

.slide.active .animate-width {
    width: 100px;
}

/* for decor line */

.decor-line {
    height: 6px;
    background: #fff;
    margin: 20px auto 0;
    border-radius: 3px;
}

.slide.active .animate-rotate-left {
    opacity: 1;
    transform: rotate(-2deg) translateY(0);
}

.slide.active .animate-rotate-right {
    opacity: 1;
    transform: rotate(2deg) translateY(0);
}

.animate-rotate-left,
.animate-rotate-right {
    opacity: 0;
    transform: translateY(100px);
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Delays */
.delay-1 {
    transition-delay: 0.1s;
}

.delay-2 {
    transition-delay: 0.2s;
}

.delay-3 {
    transition-delay: 0.3s;
}

.delay-4 {
    transition-delay: 0.4s;
}

.delay-5 {
    transition-delay: 3.5s;
}

/* Background Shapes (Blur blobs) */
.floating-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.6;
}

.blur-purple {
    background: var(--electric-purple);
    width: 300px;
    height: 300px;
    top: -50px;
    right: -50px;
}

.blur-green {
    background: var(--spotify-green);
    width: 250px;
    height: 250px;
    bottom: -50px;
    left: -50px;
}

.blur-pink {
    background: var(--neon-pink);
    width: 400px;
    height: 400px;
    top: 0;
    right: -100px;
}

.blur-blue {
    background: var(--electric-blue);
    width: 300px;
    height: 300px;
    bottom: 0;
    left: -50px;
}

/* Confetti placeholder */
.confetti-container {
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Added for improved Total Time Slide */
.time-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150vw;
    height: 150vw;
    background: repeating-conic-gradient(transparent 0deg,
            transparent 15deg,
            rgba(255, 255, 255, 0.03) 15deg,
            rgba(255, 255, 255, 0.03) 30deg);
    animation: rotate-burst 60s linear infinite;
    z-index: -1;
    pointer-events: none;
}

.glass-pill {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 30px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

@keyframes rotate-burst {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ============================================
   NEW ANIMATIONS - Friendship Wrapped 2025
   ============================================ */

/* 1. BLOOMING FLOWERS ANIMATION */
.flowers-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.flower {
    position: absolute;
    width: 80px;
    height: 80px;
    animation: bloom 2s ease-out forwards;
    opacity: 0;
    transform: scale(0);
}

.flower-1 {
    top: 10%;
    left: 10%;
    animation-delay: 0.2s;
}

.flower-2 {
    top: 15%;
    right: 15%;
    animation-delay: 0.5s;
}

.flower-3 {
    bottom: 25%;
    left: 8%;
    animation-delay: 0.8s;
}

.flower-4 {
    bottom: 20%;
    right: 10%;
    animation-delay: 1.1s;
}

.flower-5 {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    animation-delay: 0.3s;
    width: 100px;
    height: 100px;
}

.petal {
    position: absolute;
    width: 30px;
    height: 50px;
    background: linear-gradient(135deg, #FF0080 0%, #b5179e 50%, #7928CA 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    left: 50%;
    top: 50%;
    transform-origin: center bottom;
    opacity: 0.9;
    box-shadow: 0 0 15px rgba(255, 0, 128, 0.5);
}

.flower-5 .petal {
    width: 40px;
    height: 65px;
}

.petal:nth-child(1) {
    transform: translateX(-50%) rotate(0deg) translateY(-20px);
}

.petal:nth-child(2) {
    transform: translateX(-50%) rotate(60deg) translateY(-20px);
}

.petal:nth-child(3) {
    transform: translateX(-50%) rotate(120deg) translateY(-20px);
}

.petal:nth-child(4) {
    transform: translateX(-50%) rotate(180deg) translateY(-20px);
}

.petal:nth-child(5) {
    transform: translateX(-50%) rotate(240deg) translateY(-20px);
}

.petal:nth-child(6) {
    transform: translateX(-50%) rotate(300deg) translateY(-20px);
}

.flower-center {
    position: absolute;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #FFD700 0%, #FFA500 100%);
    border-radius: 50%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    z-index: 2;
}

.flower-5 .flower-center {
    width: 28px;
    height: 28px;
}

@keyframes bloom {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.flower-5 {
    animation-name: bloom-center;
}

@keyframes bloom-center {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0) rotate(-180deg);
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
}

/* Petal breathing animation after bloom */
.slide.active .flower {
    animation: bloom 2s ease-out forwards, flower-breathe 3s ease-in-out infinite 2s;
}

@keyframes flower-breathe {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.slide.active .flower-5 {
    animation: bloom-center 2s ease-out forwards, flower-breathe-center 3s ease-in-out infinite 2s;
}

@keyframes flower-breathe-center {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
}


/* 2. SPARKLE PARTICLES ANIMATION */
.sparkles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.sparkle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #1ed760;
    animation: sparkle-float 4s ease-in-out infinite;
    opacity: 0;
}

@keyframes sparkle-float {

    0%,
    100% {
        opacity: 0;
        transform: translateY(0) scale(0);
    }

    25% {
        opacity: 1;
        transform: translateY(-30px) scale(1);
    }

    50% {
        opacity: 0.8;
        transform: translateY(-60px) scale(0.8);
    }

    75% {
        opacity: 0.4;
        transform: translateY(-90px) scale(0.4);
    }
}

@keyframes sparkle-twinkle {

    0%,
    100% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }

    50% {
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }
}


/* 3. TEXT SHIMMER ANIMATION */
.shimmer-text {
    background: linear-gradient(90deg,
            #1ed760 0%,
            #7928CA 25%,
            #FF0080 50%,
            #7928CA 75%,
            #1ed760 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% center;
    }

    100% {
        background-position: -200% center;
    }
}


/* 4. PULSING GLOW ANIMATION */
.pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite alternate;
}

@keyframes pulse-glow {
    0% {
        opacity: 0.4;
        filter: blur(60px) brightness(1);
        transform: scale(1);
    }

    100% {
        opacity: 0.8;
        filter: blur(80px) brightness(1.3);
        transform: scale(1.2);
    }
}


/* 5. FLOATING HEARTS ANIMATION */
.floating-hearts {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.heart {
    position: absolute;
    font-size: 20px;
    animation: float-up 4s ease-out infinite;
    opacity: 0;
}

@keyframes float-up {
    0% {
        opacity: 0;
        transform: translateY(100vh) scale(0) rotate(0deg);
    }

    10% {
        opacity: 1;
        transform: translateY(80vh) scale(1) rotate(10deg);
    }

    50% {
        opacity: 0.8;
        transform: translateY(40vh) scale(0.9) rotate(-10deg);
    }

    100% {
        opacity: 0;
        transform: translateY(-20vh) scale(0.5) rotate(20deg);
    }
}


/* 6. WAVE TEXT ANIMATION */
.wave-text {
    display: inline-block;
    animation: wave-float 2s ease-in-out infinite;
}

@keyframes wave-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}


/* 7. COUNTER NUMBER GLOW */
.counter {
    transition: text-shadow 0.3s ease;
}

.counter.counting {
    text-shadow:
        0 0 20px rgba(255, 255, 255, 0.8),
        0 0 40px rgba(255, 0, 128, 0.5),
        0 0 60px rgba(121, 40, 202, 0.3);
}


/* 8. ENHANCED SLIDE TRANSITIONS */
.slide {
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform: scale(0.98);
}

.slide.active {
    transform: scale(1);
}


/* 9. ENHANCED CONFETTI */
.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confetti-fall 4s ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(0) rotateZ(0deg) rotateX(0deg);
    }

    100% {
        opacity: 0;
        transform: translateY(100vh) rotateZ(720deg) rotateX(360deg);
    }
}


/* 10. CARD ENTRANCE ENHANCEMENT */
.stat-card {
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.3s ease,
        opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.slide.active .stat-card:hover {
    transform: translateY(-5px) rotate(0deg) !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}


/* 11. STREAK CIRCLE PULSE */
.streak-circle {
    animation: streak-pulse 2s ease-in-out infinite;
}

@keyframes streak-pulse {

    0%,
    100% {
        box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
    }

    50% {
        box-shadow: 0 0 50px rgba(255, 255, 255, 0.6), 0 0 80px rgba(181, 23, 158, 0.4);
    }
}


/* 12. GLASS PILL SHINE */
.glass-pill {
    position: relative;
    overflow: hidden;
}

.glass-pill::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.3),
            transparent);
    animation: shine-slide 3s ease-in-out infinite;
}

@keyframes shine-slide {

    0%,
    100% {
        left: -100%;
    }

    50% {
        left: 100%;
    }
}


/* 13. BAR FILL ANIMATION */
.bar-fill {
    position: relative;
    width: 0 !important;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide.active .bar-fill.pink {
    width: 53% !important;
}

.slide.active .bar-fill.green {
    width: 47% !important;
}


@keyframes bar-shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}


/* 14. REPLAY BUTTON ANIMATION */
.replay-btn {
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.replay-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.replay-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.replay-btn:active::after {
    width: 300px;
    height: 300px;
}


/* 15. STAT ITEM HOVER */
.stat-item {
    transition: transform 0.3s ease, background 0.3s ease;
}

.stat-item:hover {
    transform: translateX(10px);
    background: rgba(255, 255, 255, 0.15);
}

.stat-item .icon {
    animation: icon-bounce 1s ease-in-out infinite;
}

@keyframes icon-bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}


/* ============================================
   PHOTOS GALLERY - Best Moments Slide
   ============================================ */

.photos-gallery {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

.photo-frame {
    background: #fff;
    padding: 6px;
    padding-bottom: 18px;
    border-radius: 4px;
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    transform-origin: center;
    position: relative;
}

.photo-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 2px;
}

.photo-frame:nth-child(1) {
    transform: rotate(-3deg);
}

.photo-frame:nth-child(2) {
    transform: rotate(2deg);
}

.photo-frame:nth-child(3) {
    transform: rotate(-2deg);
}

.photo-placeholder {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    aspect-ratio: 16/9;
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.photo-icon {
    font-size: 2.5rem;
}

.photo-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
}

.photo-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 2px;
    object-fit: cover;
}

/* Photo entrance animation */
.animate-photo {
    opacity: 0;
    transform: translateY(50px) scale(0.8) rotate(0deg);
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.slide.active .animate-photo {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.slide.active .animate-photo:nth-child(1) {
    transform: translateY(0) scale(1) rotate(-3deg);
}

.slide.active .animate-photo:nth-child(2) {
    transform: translateY(0) scale(1) rotate(2deg);
}

.slide.active .animate-photo:nth-child(3) {
    transform: translateY(0) scale(1) rotate(-2deg);
}


/* ============================================
   ENVELOPE & LETTER - Son Bir Mesaj Slide
   ============================================ */

.envelope-container {
    perspective: 1000px;
    margin: 1rem auto;
    width: 100%;
    max-width: 350px;
    height: 280px;
    position: relative;
}

.envelope {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 150px;
    transform-style: preserve-3d;
}

/* Envelope back - behind everything */
.envelope-body {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    width: 100%;
    height: 100%;
    /* Fill the container so flap hinges correctly */
    background: linear-gradient(180deg, #e8d5c4 0%, #d4c4b0 100%);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    z-index: 1;
}

/* Envelope inner shadow for depth */
.envelope-body::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, transparent 100%);
    border-radius: 0;
}

/* The triangular flap */
.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    top: 0;
    left: 0;
    width: 100%;
    height: 90px;
    /* Increased for better proportion with 350px width */
    background: linear-gradient(180deg, #f5e6d3 0%, #ead5c0 100%);
    clip-path: polygon(0 0, 50% 100%, 100% 0);
    transform-origin: top center;
    z-index: 5;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    backface-visibility: hidden;
}

/* Flap opens on slide active */
.slide.active .envelope-flap {
    animation: envelope-open 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.8s;
}

@keyframes envelope-open {
    0% {
        transform: rotateX(0deg);
        z-index: 5;
    }

    50% {
        z-index: 5;
    }

    51% {
        z-index: 0;
    }

    100% {
        transform: rotateX(-180deg);
        z-index: 0;
    }
}

/* The letter paper */
.letter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    width: 95%;
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    z-index: 2;
    opacity: 0;
    overflow: hidden;
    /* Changed to hidden to clip border radius if needed, but we use flex for content */
    display: flex;
    flex-direction: column;
    max-height: 45vh;
    /* Limit height */
}

/* Letter slides up after envelope opens */
.slide.active .letter {
    animation: letter-emerge 2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 1.8s;
}

@keyframes letter-emerge {
    0% {
        transform: translateX(-50%) translateY(0) scale(0.9);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    100% {
        transform: translateX(-50%) translateY(-180px) scale(0.9);
        opacity: 1;
    }
}

@keyframes letter-emerge {
    0% {
        transform: translateX(-50%) translateY(0) scale(0.9);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    100% {
        transform: translateX(-50%) translateY(-180px) scale(0.9);
        opacity: 1;
    }
}

.letter-content {
    padding: 1.5rem;
    text-align: left;
    opacity: 0;
    transform: translateY(10px);
    overflow-y: auto;
    /* Enable scrolling */
    scrollbar-width: thin;
}

.slide.active .letter-content {
    animation: letter-text-fade 1s ease-out forwards;
    animation-delay: 2.8s;
}

@keyframes letter-text-fade {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.letter-text {
    font-size: 0.85rem;
    line-height: 1.7;
    color: #2a2a2a;
    font-weight: 500;
    margin: 0;
    font-style: italic;
}

/* Rainbow gradient top border on letter */
.letter::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #FF0080, #7928CA, #1ed760, #FF0080);
    background-size: 200% 100%;
    animation: rainbow-slide 3s linear infinite;
    border-radius: 8px 8px 0 0;
}

/* Position Slide 8 content to bottom */
#slide-8 .content {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
    padding-bottom: 20px;
    /* Adjust as needed */
}

/* Override envelope scale/delay if needed, but mainly position */
#slide-8 .envelope-container {
    margin: 0 auto;
    /* Remove default top margin if it interferes, or scale margin */
    flex-shrink: 0;
}

/* Ensure title sits above */
#slide-8 h3 {
    margin-bottom: auto;
    /* Pushes title to top or lets it sit above if justified flex-end */
    margin-top: 2rem;
}

@keyframes rainbow-slide {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 200% 50%;
    }
}

/* Wax seal on envelope */
.envelope-body::before {
    content: '💜';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    font-size: 2rem;
    z-index: 10;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.slide.active .envelope-body::before {
    animation: seal-appear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 0.3s;
}

@keyframes seal-appear {
    0% {
        transform: translateX(-50%) scale(0) rotate(-180deg);
    }

    100% {
        transform: translateX(-50%) scale(1) rotate(0deg);
    }
}

/* Envelope front pocket - covers the letter initially */
.envelope::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(180deg, #f5e6d3 0%, #e8d5c4 100%);
    border-radius: 0 0 12px 12px;
    z-index: 3;
    box-shadow: inset 0 10px 20px rgba(0, 0, 0, 0.05);
}

/* Delay classes for photo animations */
.animate-photo.delay-1 {
    transition-delay: 0.2s;
}

.animate-photo.delay-2 {
    transition-delay: 0.4s;
}

.animate-photo.delay-3 {
    transition-delay: 0.6s;
}


/* ============================================
   RESPONSIVE MEDIA QUERIES - Mobile First
   ============================================ */

/* Small phones (iPhone SE, etc.) */
@media screen and (max-width: 375px) {
    .slide {
        padding: 1rem;
    }

    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }

    h3 {
        font-size: 1.4rem;
        margin-bottom: 1rem;
    }

    p {
        font-size: 1rem;
    }

    .giant-stat {
        font-size: 2.8rem;
    }

    /* Envelope for small screens */
    /* .envelope-container override moved below */

    .envelope-body {
        height: 110px;
    }

    .envelope-flap {
        height: 70px;
    }

    .letter-text {
        font-size: 0.85rem;
        line-height: 1.5;
        color: #000;
    }

    .letter-content {
        padding: 1rem;
    }

    @keyframes letter-emerge {
        0% {
            transform: translateX(-50%) translateY(0) scale(0.9);
            opacity: 0;
        }

        10% {
            opacity: 1;
        }

        100% {
            transform: translateX(-50%) translateY(-150px) scale(0.9);
            opacity: 1;
        }
    }

    .envelope-container {
        max-width: 280px;
        height: 280px;
        margin: 0.5rem auto;
    }

    .envelope {
        height: 140px;
    }

    .letter {
        max-height: 40vh;
        /* Stricter limit for small screens */
    }

    .envelope-body {
        height: 115px;
    }

    .envelope::after {
        height: 85px;
    }

    .envelope-flap {
        height: 55px;
    }

    .letter {
        width: 85%;
    }

    .letter-text {
        font-size: 0.7rem;
        line-height: 1.4;
    }

    .letter-content {
        padding: 0.8rem;
    }

    /* Photos gallery */
    .photos-gallery {
        gap: 0.4rem;
        max-width: 260px;
    }

    .photo-frame {
        padding: 5px;
        padding-bottom: 14px;
    }


    /* Stats */
    .stat-item {
        padding: 1rem;
    }

    .stat-item .icon {
        font-size: 1.5rem;
    }

    .stat-item .highlight {
        font-size: 1.2rem;
    }

    /* Streak circle */
    .streak-circle {
        width: 180px;
        height: 180px;
        border-width: 6px;
    }

    .inner-text .number {
        font-size: 3.5rem;
    }

    .inner-text .label {
        font-size: 1.1rem;
    }

    /* Final stats */
    .final-stats {
        padding: 1rem;
        font-size: 1.2rem;
    }

    /* Cards */
    .stat-card {
        padding: 1rem;
    }

    .stat-card .card-value {
        font-size: 2rem;
    }

    .stat-card .card-sub {
        font-size: 0.9rem;
    }

    /* Replay button */
    .replay-btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }

    /* Glass pill */
    .glass-pill {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    /* Flowers smaller */
    .flower {
        width: 50px;
        height: 50px;
    }

    .flower-5 {
        width: 70px;
        height: 70px;
    }

    .petal {
        width: 18px;
        height: 30px;
    }

    .flower-5 .petal {
        width: 25px;
        height: 40px;
    }

    .flower-center {
        width: 12px;
        height: 12px;
    }

    .flower-5 .flower-center {
        width: 18px;
        height: 18px;
    }
}

/* Very small phones (iPhone 5/SE first gen, 320px) */
@media screen and (max-width: 320px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 2rem;
    }

    h3 {
        font-size: 1.2rem;
    }

    .giant-stat {
        font-size: 2.2rem;
    }

    .envelope-container {
        max-width: 230px;
        height: 260px;
    }

    .letter-text {
        font-size: 0.65rem;
    }

    .streak-circle {
        width: 150px;
        height: 150px;
    }

    .inner-text .number {
        font-size: 3rem;
    }

    .photos-gallery {
        max-width: 220px;
        gap: 0.3rem;
    }

    .photo-frame {
        padding: 4px;
        padding-bottom: 10px;
    }

    /* Envelope for very small screens */
    .envelope-container {
        max-width: 200px;
        height: 200px;
        margin: 0.3rem auto;
    }

    .envelope {
        height: 100px;
    }

    .envelope-body {
        height: 75px;
    }

    .envelope-flap {
        height: 45px;
    }

    .letter {
        width: 85%;
    }

    .letter-text {
        font-size: 0.7rem;
        line-height: 1.3;
    }

    .letter-content {
        padding: 0.6rem;
    }

    @keyframes letter-emerge {
        0% {
            transform: translateX(-50%) translateY(0);
            opacity: 0;
        }

        10% {
            opacity: 1;
        }

        100% {
            transform: translateX(-50%) translateY(-70px);
            opacity: 1;
        }
    }
}

/* Medium phones (iPhone 6/7/8, 375px - 414px) */
@media screen and (min-width: 376px) and (max-width: 414px) {
    .slide {
        padding: 1.5rem;
    }

    h1 {
        font-size: 2.8rem;
    }

    h2 {
        font-size: 3rem;
    }

    h3 {
        font-size: 1.6rem;
    }

    .giant-stat {
        font-size: 3.2rem;
    }

    .envelope-container {
        max-width: 290px;
        height: 320px;
    }

    .photos-gallery {
        max-width: 320px;
    }

    .streak-circle {
        width: 200px;
        height: 200px;
    }

    .inner-text .number {
        font-size: 4rem;
    }
}

/* Larger phones (iPhone Plus, Max, Pro Max) */
@media screen and (min-width: 415px) and (max-width: 500px) {
    .envelope-container {
        max-width: 300px;
        height: 340px;
    }
}

/* Fix for landscape mode on phones */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .slide {
        padding: 0.5rem 1rem;
    }

    h1,
    h2 {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    h3 {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }

    .giant-stat {
        font-size: 2.5rem;
        margin: 0.5rem 0;
    }

    .envelope-container {
        max-width: 250px;
        height: 200px;
        margin: 0.5rem auto;
    }

    .streak-circle {
        width: 120px;
        height: 120px;
        margin: 0.5rem auto;
    }

    .inner-text .number {
        font-size: 2.5rem;
    }

    .photos-gallery {
        flex-direction: row;
        gap: 0.5rem;
    }

    .photo-frame {
        padding: 4px;
        padding-bottom: 15px;
    }

    .stat-grid {
        display: flex;
        gap: 0.5rem;
    }

    .stat-item {
        padding: 0.5rem;
    }
}

/* Safe area for notched phones (iPhone X and newer) */
@supports (padding: max(0px)) {
    .slide {
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
        padding-left: max(1.5rem, env(safe-area-inset-left));
        padding-right: max(1.5rem, env(safe-area-inset-right));
    }

    .progress-container {
        top: max(10px, env(safe-area-inset-top));
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
    }
}