* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    touch-action: manipulation;
}

body {
    overflow: hidden;
    background-color: #f8f3f7;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
}

.container {
    position: relative;
    width: 100%;
    height: 100%;
}

#rose-container {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.rose-petal {
    position: absolute;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.9;
    z-index: 10;
    pointer-events: none;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.3));
    image-rendering: pixelated;
}

.rose-bouquet-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 500px;
    z-index: 5;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
}

.bouquet {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    animation: floatRose 8s ease-in-out infinite;
}

.rose {
    position: absolute;
    width: 100px;
    height: 100px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.3));
    transform-origin: bottom center;
    image-rendering: pixelated;
}

@keyframes floatRose {
    0% {
        transform: translateY(0) rotateY(0) scale(1);
    }

    25% {
        transform: translateY(-15px) rotateY(8deg) scale(1.02);
    }

    50% {
        transform: translateY(10px) rotateY(-12deg) scale(0.98);
    }

    75% {
        transform: translateY(-8px) rotateY(6deg) scale(1.01);
    }

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

@keyframes fall {
    0% {
        transform: translateY(-100px) rotate(0deg) scale(1);
        opacity: 0.3;
    }

    10% {
        opacity: 0.9;
    }

    90% {
        opacity: 0.9;
    }

    100% {
        transform: translateY(calc(100vh + 100px)) rotate(720deg) scale(0.6);
        opacity: 0.1;
    }
}

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

    25% {
        transform: translateX(30px) rotateX(20deg);
    }

    50% {
        transform: translateX(-20px) rotateX(-15deg);
    }

    75% {
        transform: translateX(15px) rotateX(10deg);
    }

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

.rose:hover {
    filter: brightness(1.3) drop-shadow(0 0 15px rgba(255, 150, 150, 0.9));
    transform: scale(1.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 20;
}

/* 添加光晕效果 */
.glow-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255, 182, 193, 0.4) 0%, rgba(255, 182, 193, 0.1) 40%, rgba(255, 182, 193, 0) 70%);
    border-radius: 50%;
    z-index: 1;
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.4;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.6;
    }
}

/* 鼠标跟随花瓣特效 */
.mouse-petal {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
}

/* 为屏幕添加柔和阴影 */
.container::after {
    content: '';
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 150px rgba(255, 182, 193, 0.3);
    pointer-events: none;
}

/* 添加像素风格效果 */
.pixel-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* 添加微妙的像素网格覆盖层 */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(rgba(255, 255, 255, .02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .02) 1px, transparent 1px);
    background-size: 4px 4px;
    z-index: 20;
    pointer-events: none;
}

/* 为花束添加独立的光晕效果 */
.rose-bouquet-container::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(255, 182, 193, 0.3) 0%, rgba(255, 182, 193, 0.1) 40%, rgba(255, 182, 193, 0) 70%);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
    animation: smallPulse 3s ease-in-out infinite;
}

@keyframes smallPulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.3;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.5;
    }
}

/* 移动设备适配 */
@media (max-width: 768px) {
    .rose {
        width: 70px;
        height: 70px;
    }

    .rose-petal {
        width: 15px !important;
        height: 15px !important;
    }

    .mini-rose {
        width: 15px !important;
        height: 15px !important;
    }

    .pixel-particle {
        width: 2px !important;
        height: 2px !important;
    }

    .glow-effect {
        width: 300px;
        height: 300px;
    }

    .rose-bouquet-container::after {
        width: 100px;
        height: 100px;
    }

    .funny-popup {
        font-size: 14px;
        padding: 15px;
    }

    .funny-popup-title {
        font-size: 1.2em;
        margin-bottom: 8px;
    }

    .funny-popup-message {
        font-size: 1em;
        margin-bottom: 12px;
    }

    .funny-popup-button {
        font-size: 0.95em;
        padding: 8px 22px;
    }
}

/* 优化触摸区域 */
.funny-popup-button {
    background: linear-gradient(145deg, #ff4081, #ff5a92);
    color: white;
    border: none;
    padding: 10px 28px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(255, 64, 129, 0.3), 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    min-height: 44px;
    min-width: 120px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.5px;
    transform: translateY(0);
}

.funny-popup-button:hover {
    background: linear-gradient(145deg, #ff5a92, #ff4081);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(255, 64, 129, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1);
}

.funny-popup-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(255, 64, 129, 0.2), 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 添加按钮点击涟漪效果 */
.funny-popup-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1) translate(-50%, -50%);
    transform-origin: left top;
}

.funny-popup-button.animate::after {
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    0% {
        opacity: 0.5;
        transform: scale(0) translate(-50%, -50%);
    }

    100% {
        opacity: 0;
        transform: scale(20) translate(-50%, -50%);
    }
}

/* 弹窗移动动画 */
@keyframes popup-float {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(var(--scale, 1));
    }

    20% {
        transform: translate(30px, -20px) rotate(2deg) scale(var(--scale, 1));
    }

    40% {
        transform: translate(-20px, 35px) rotate(-3deg) scale(var(--scale, 1));
    }

    60% {
        transform: translate(-35px, -15px) rotate(1deg) scale(var(--scale, 1));
    }

    80% {
        transform: translate(25px, 25px) rotate(-2deg) scale(var(--scale, 1));
    }

    100% {
        transform: translate(0, 0) rotate(0deg) scale(var(--scale, 1));
    }
}

/* 修改弹窗样式，让动画更流畅 */
.funny-popup {
    position: fixed;
    background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
    border: 3px solid #ff6b6b;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    max-width: 320px;
    text-align: center;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    color: #333;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    will-change: transform, opacity;
}

.funny-popup.show {
    transform: scale(1);
    opacity: 1;
}

.funny-popup.hide {
    transform: scale(0.8);
    opacity: 0;
}

/* 修改背景形状样式，提高可见度 */
.background-shape {
    position: absolute;
    z-index: 3;
    pointer-events: none;
    animation: shape-float 8s ease-in-out infinite;
    filter: blur(1px);
    will-change: transform, opacity;
    opacity: 0.7 !important;
    /* 强制提高不透明度 */
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    /* 添加光晕效果提高可见度 */
    animation-duration: var(--duration, 8s) !important;
    animation-delay: var(--delay, 0s) !important;
    filter: blur(var(--blur, 1px));
    box-shadow: 0 0 var(--glow-size, 5px) var(--glow-color, rgba(255, 255, 255, 0.5));
}

.circle {
    border-radius: 50%;
    animation: circle-float 11s ease-in-out infinite !important;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.3), transparent 70%) !important;
}

.square {
    border-radius: 4px;
    animation: square-float 13s ease-in-out infinite !important;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), transparent 70%) !important;
}

/* 修改三角形实现，解决黑色问题 */
.triangle {
    width: 0 !important;
    height: 0 !important;
    border-left: 25px solid transparent !important;
    border-right: 25px solid transparent !important;
    border-bottom: 40px solid rgba(255, 133, 161, 0.8);
    /* 设置默认颜色并移除!important */
    background-color: transparent !important;
    animation: triangle-float 12s ease-in-out infinite !important;
}

@keyframes triangle-float {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
    }

    20% {
        transform: translateY(-25px) translateX(15px) rotate(30deg);
    }

    40% {
        transform: translateY(15px) translateX(30px) rotate(-20deg);
    }

    60% {
        transform: translateY(25px) translateX(-20px) rotate(-50deg);
    }

    80% {
        transform: translateY(-10px) translateX(-25px) rotate(40deg);
    }

    100% {
        transform: translateY(0) translateX(0) rotate(0deg);
    }
}

/* 使用更简单的星形实现 */
.star {
    background-color: transparent !important;
    position: relative;
    animation: star-float 10s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite !important;
}

.star:before {
    content: '★';
    font-size: 40px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: inherit;
    /* 使用继承的颜色 */
}

@keyframes star-float {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg) scale(1);
    }

    15% {
        transform: translateY(-30px) translateX(20px) rotate(45deg) scale(1.1);
    }

    30% {
        transform: translateY(10px) translateX(40px) rotate(90deg) scale(0.9);
    }

    45% {
        transform: translateY(35px) translateX(25px) rotate(180deg) scale(1);
    }

    60% {
        transform: translateY(20px) translateX(-20px) rotate(225deg) scale(1.05);
    }

    75% {
        transform: translateY(-15px) translateX(-35px) rotate(270deg) scale(0.95);
    }

    90% {
        transform: translateY(-25px) translateX(-10px) rotate(315deg) scale(1);
    }

    100% {
        transform: translateY(0) translateX(0) rotate(360deg) scale(1);
    }
}

/* 使用更简单的心形实现 */
.heart {
    background-color: transparent !important;
    position: relative;
    animation: heart-float 8s ease-in-out infinite !important;
}

.heart:before {
    content: '❤';
    font-size: 40px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: inherit;
    /* 使用继承的颜色 */
}

@keyframes heart-float {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
    }

    25% {
        transform: translateY(-20px) rotate(-10deg) scale(1.1);
    }

    40% {
        transform: translateY(-10px) rotate(8deg) scale(1.15);
    }

    50% {
        transform: translateY(5px) rotate(0deg) scale(1);
    }

    60% {
        transform: translateY(10px) rotate(-8deg) scale(0.95);
    }

    75% {
        transform: translateY(15px) rotate(10deg) scale(0.9);
    }

    100% {
        transform: translateY(0) rotate(0deg) scale(1);
    }
}

@keyframes shape-float {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: var(--opacity, 0.5);
    }

    25% {
        transform: translateY(-15px) rotate(5deg);
        opacity: var(--opacity, 0.5);
    }

    50% {
        transform: translateY(10px) rotate(-10deg);
        opacity: var(--opacity, 0.3);
    }

    75% {
        transform: translateY(-5px) rotate(15deg);
        opacity: var(--opacity, 0.5);
    }

    100% {
        transform: translateY(0) rotate(0deg);
        opacity: var(--opacity, 0.5);
    }
}

@keyframes circle-float {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
        border-radius: 50%;
    }

    33% {
        transform: translate(30px, -25px) scale(1.1) rotate(120deg);
        border-radius: 50%;
    }

    66% {
        transform: translate(-20px, 30px) scale(0.9) rotate(240deg);
        border-radius: 45%;
    }

    100% {
        transform: translate(0, 0) scale(1) rotate(360deg);
        border-radius: 50%;
    }
}

@keyframes square-float {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
        border-radius: 4px;
    }

    25% {
        transform: translate(-30px, 15px) scale(0.9) rotate(90deg);
        border-radius: 12px;
    }

    50% {
        transform: translate(15px, 25px) scale(1.05) rotate(180deg);
        border-radius: 8px;
    }

    75% {
        transform: translate(25px, -20px) scale(0.95) rotate(270deg);
        border-radius: 15px;
    }

    100% {
        transform: translate(0, 0) scale(1) rotate(360deg);
        border-radius: 4px;
    }
}

/* 添加颜色变化动画到形状 */
@keyframes color-shift {
    0% {
        filter: hue-rotate(0deg);
    }

    50% {
        filter: hue-rotate(30deg);
    }

    100% {
        filter: hue-rotate(0deg);
    }
}

.color-shift {
    animation: color-shift 8s infinite alternate;
}