:root {
    --bg-gradient: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    --card-bg: rgba(255, 255, 255, 0.25);
    --text-color: #4a4a4a;
    --btn-bg: #4a4a4a;
    --btn-text: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    /* transition: all 0.5s ease; <--- REMOVED: Too broad, causes glitches */
}

body {
    transition: background 1s ease;
    /* Specific transition for theme changes */
    height: 100vh;
    /* Fallback */
    height: 100dvh;
    /* Mobile-friendly dynamic height */
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Optically center by pushing down slightly */
    padding-top: 5vh;

    background: var(--bg-gradient);
    background-size: 200% 200%;
    animation: gradientMove 15s ease infinite;
    overflow: hidden;
    position: relative;
    /* Force GPU acceleration and clean mobile rendering */
    transform-style: preserve-3d;
    -webkit-tap-highlight-color: transparent;
}

/* Vignette Overlay (Dark corners) */
body::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.4) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Grain/Noise Overlay (Lo-Fi Texture) */
body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.05;
    pointer-events: none;
    z-index: 2;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

#particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50% !important;
    pointer-events: none;
    z-index: 5;
    /* Force mobile clean rendering */
    background-color: rgba(255, 255, 255, 0.8);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    animation: floatUp linear forwards;
}

@keyframes floatUp {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }

    10% {
        opacity: 0.8;
    }

    90% {
        opacity: 0.8;
    }

    100% {
        transform: translateY(-100px) scale(1);
        opacity: 0;
    }
}

/* Luxury Reset */
.container {
    padding: 2rem;
    width: 100%;
    max-width: 800px;
    text-align: center;
    position: relative;
    z-index: 10;

    /* WOW: Smooth entrance */
    animation: containerEntry 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes containerEntry {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Remove Glass Card - Go for "Floating in Void" */
.glass-card {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    color: var(--text-color);
}

.image-container {
    width: 280px;
    /* Slightly larger */
    height: 280px;
    margin: 0 auto 3rem;

    /* Static Circle on Landing (No Fluid Yet) */
    border-radius: 50%;
    /* animation: none; <--- Removed default blob */

    overflow: hidden;
    /* Deep, soft shadow for depth */
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    border: none;
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), border 0.3s ease;
}

@keyframes blob {
    0% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }

    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }

    100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
}

@keyframes beat {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    /* Subtle pulse */
}

/* Class added via JS when music starts */
/* Class added via JS when music starts */
/* Class added via JS when music starts */
.image-container.pulsing {
    /* 1. Fluid Morph + Beat Pulse */
    animation: blob 8s ease-in-out infinite, beat 1.6s ease-in-out infinite;

    /* 2. No Border/Glow as requested */
    box-shadow: none;
}

#josie-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
}

#josie-img:hover {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><text y="20" font-size="20">🧸</text></svg>'), auto;
}

h1 {
    font-family: 'Playfair Display', serif;
    font-size: 4rem;
    /* Big and editorial */
    font-weight: 400;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    color: var(--text-color);
    font-style: italic;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

p#vibe-text {
    font-family: 'Outfit', sans-serif;
    /* Container settings for stability */
    min-height: 4.5rem;
    /* Reserves space for 2 lines essentially */
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center content vertically */
    align-items: center;

    margin-bottom: 3rem;
    color: var(--text-color);
}

.caption-en {
    /* Responsive font: slightly smaller min for ultra-mobile */
    font-size: clamp(0.6rem, 2.5vw, 1.1rem);
    font-weight: 300;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: center;

    /* ALWAYS one line - shrink font instead of wrapping */
    white-space: nowrap;
    width: 100%;
    max-width: 90vw;
    padding: 0 1rem;
    line-height: 1.4;

    /* Strict 1-line cutoff */
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    /* Ensure it behaves as a block for width/overflow */
}

.caption-cn {
    font-size: clamp(0.85rem, 3vw, 1rem);
    /* Also responsive */
    font-weight: 400;
    letter-spacing: 0.05em;
    margin-top: 0.4rem;
    opacity: 0.85;

    /* ALWAYS one line */
    white-space: nowrap;
    width: 100%;
    max-width: 90vw;
    padding: 0 1rem;

    /* Strict 1-line cutoff */
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

button {
    /* Solid High-Contrast Button */
    background: var(--btn-bg);
    color: var(--btn-text);
    border: none;
    /* Clean solid look */

    padding: 0.8rem 1rem;
    width: 220px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    /* Bold for legibility */
    letter-spacing: 0.2em;
    /* Extremely wide tracking */
    text-transform: uppercase;
    border-radius: 0;
    /* Boxy/Sharp is more high-fashion */
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    /* Slight lift */
    transform: translateY(0);
    transition: all 0.4s ease;
}

button:hover {
    /* No color swap - preserves legibility */
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    /* Stronger glow on hover */
}

button:active {
    transform: translateY(1px) scale(0.98);
    /* Tactile click feel */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

button.btn-finished {
    pointer-events: none;
    opacity: 0.6;
    background: #ccc;
    color: #666;
    box-shadow: none;
    cursor: default;
}

.music-footer {
    position: fixed;
    /* Position off-screen but keep visible for browser audio policy */
    bottom: -200px;
    right: 10px;
    opacity: 0.01;
    pointer-events: none;
    z-index: -1;
    /* Must have real dimensions for iframe to work */
    width: 200px;
    height: 120px;
}

.music-footer:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.music-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #fff;
}

.music-icon {
    font-size: 1rem;
}

.music-text {
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-player {
    width: 60px;
    height: 34px;
    border-radius: 6px;
    overflow: hidden;
}

.music-player iframe {
    width: 100%;
    height: 100%;
}

/* Clean Sticker Styles - Bulletproof Mobile version */
.stamp-sticker {
    position: absolute;
    pointer-events: none;
    user-select: none;
    z-index: 1000;

    /* Zero box dimension to prevent layout artifacts */
    width: 0;
    height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;

    /* Absolute transparency */
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    -webkit-appearance: none;
    appearance: none;

    /* Mobile rendering quality */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    will-change: transform, opacity;

    /* Center the emoji character */
    line-height: 0;

    /* Single Animation lifecycle: Pop In -> Wait -> Fade Out */
    animation: stickerLife 3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes stickerLife {
    0% {
        transform: scale(0) rotate(-20deg);
        opacity: 0;
    }

    10% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }

    80% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: scale(0.5) rotate(15deg);
        opacity: 0;
    }
}

/* Add body styles as per instruction */
body {
    -webkit-tap-highlight-color: transparent;
    transform-style: preserve-3d;
}

/* Assuming .particle should have similar zero-dimension properties if it exists */
.particle {
    width: 0;
    height: 0;
    overflow: visible;
    display: flex;
    /* To center content if it's an emoji/text */
    justify-content: center;
    align-items: center;
    line-height: 0;
    /* To center content if it's an emoji/text */
}

/* ============================================
   VISITOR COUNTER - FLIP CLOCK STYLE (TRAIN)
   ============================================ */
.visitor-counter {
    position: fixed;
    bottom: 12px;
    left: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Outfit', sans-serif;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    z-index: 100;
    /* Train animation */
    animation: trainMove 20s linear infinite;
}

.visitor-counter:hover {
    opacity: 1;
    animation-play-state: paused;
}

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

    100% {
        transform: translateX(100vw);
    }
}

.counter-emoji {
    font-size: 0.9rem;
    line-height: 1;
    display: flex;
    align-items: center;
}

.flip-counter {
    display: flex;
    gap: 2px;
    align-items: center;
}

.flip-digit {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 3px;
    padding: 2px 4px;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 0.65rem;
    line-height: 1;
    color: var(--text-color);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.06),
        0 1px 1px rgba(0, 0, 0, 0.03);
    min-width: 12px;
    text-align: center;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}


/* Flip animation */
.flip-digit.flip {
    animation: flipTile 0.4s ease-out;
}

@keyframes flipTile {
    0% {
        transform: rotateX(0deg);
    }

    50% {
        transform: rotateX(-90deg);
    }

    100% {
        transform: rotateX(0deg);
    }
}

/* Hide counter when not on landing page */
.visitor-counter.hidden {
    display: none !important;
}


/* ============================================
   MILESTONE TOAST STYLES
   ============================================ */
.milestone-toast {
    position: fixed;
    bottom: 70px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-color);
    padding: 12px 20px;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.milestone-toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.milestone-toast.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    pointer-events: none;
}

/* Mobile adjustments for counter */
@media (max-width: 600px) {
    .visitor-counter {
        bottom: 8px;
        gap: 4px;
        /* Faster animation on mobile so it appears within ~1 second */
        animation: trainMoveMobile 12s linear infinite;
    }

    @keyframes trainMoveMobile {
        0% {
            transform: translateX(-20%);
        }

        100% {
            transform: translateX(100vw);
        }
    }

    .counter-emoji {
        font-size: 0.8rem;
    }

    .flip-digit {
        padding: 1px 3px;
        font-size: 0.55rem;
        min-width: 10px;
        border-radius: 2px;
    }

    .milestone-toast {
        right: 12px;
        left: 12px;
        bottom: 45px;
        text-align: center;
        font-size: 0.8rem;
    }
}

/* ============================================
   INTEGRATED SMOL FEATURES (V2.2)
   ============================================ */

/* Smol Bubbles (Passive Background Flow) */
.smol-bubble {
    position: fixed;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    z-index: 1;
    /* Behind container (10) and image */
    backdrop-filter: blur(1px);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.9rem;
    animation: riseAndPop 6s ease-out forwards;
}

@keyframes riseAndPop {
    0% {
        transform: translateY(0) scale(0);
        opacity: 0;
    }

    15% {
        opacity: 0.6;
        transform: translateY(-20px) scale(1);
    }

    100% {
        transform: translateY(-100vh) scale(1.2);
        opacity: 0;
    }
}

/* Photo-Reactive Thought Bubble (Clean Semi-Transparent Pill) */
.thought-bubble {
    position: fixed;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.75);
    /* Semi-transparent */
    backdrop-filter: blur(8px);
    /* Subtle glass effect */
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 40px;
    /* Pill shape */
    font-size: 0.85rem;
    font-weight: 500;
    color: #4a4a4a;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    z-index: 1600;
    pointer-events: none;
    animation: thoughtPop 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

/* No tail/connectors for the clean pill style */
.thought-bubble::after,
.thought-bubble::before {
    display: none;
}

@keyframes thoughtPop {
    0% {
        opacity: 0;
        transform: translateY(15px) scale(0.8);
    }

    15% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    85% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
}

/* ============================================
   INTERACTIVE "PRESS X TO DOUBT" (Josie_15)
   ============================================ */
.doubt-x {
    display: inline-block;
    cursor: pointer;
    font-weight: 700;
    color: inherit;
    transition: transform 0.2s ease, color 0.2s ease;
    padding: 0 4px;
    user-select: none;
    -webkit-user-select: none;
    /* Larger tap target for mobile */
    min-width: 32px;
    min-height: 32px;
    line-height: 32px;
    text-align: center;
}

.doubt-x:hover {
    transform: scale(1.3) rotate(-5deg);
    color: #ff6e6c;
}