/* 粒子背景 */
#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    transition: background 0.5s ease;
}

/* 手机端触摸优化 */
@media (hover: none) and (pointer: coarse) {
    .card-hover:hover {
        transform: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .photo-item:hover {
        transform: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .cake-option:hover {
        transform: none;
        background-color: rgba(255, 255, 255, 0.5);
    }
    
    .card-button:hover {
        transform: none;
    }
}

/* 触摸设备的点击反馈 */
@media (hover: none) and (pointer: coarse) {
    .card-hover:active {
        transform: scale(0.98);
    }
    
    .photo-item:active {
        transform: scale(0.95);
    }
    
    .cake-option:active {
        transform: scale(0.95);
        background-color: rgba(255, 255, 255, 0.8);
    }
    
    .card-button:active {
        transform: scale(0.95);
    }
    
    .like-btn:active {
        transform: scale(0.9);
    }
}

/* 内容容器 */
.content-wrapper {
    backdrop-filter: blur(8px);
    background-color: rgba(255, 255, 255, 0.85);
    transition: background-color 0.5s ease;
}

/* 手机端滚动优化 */
body {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* 手机端输入框优化 */
input, textarea {
    -webkit-appearance: none;
    border-radius: 8px;
    font-size: 16px; /* 防止iOS缩放 */
}

/* 手机端按钮优化 */
button {
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* 手机端选择器优化 */
.cake-option {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* 手机端图片优化 */
img {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* 文字渐变效果 */
.text-gradient {
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    background-image: linear-gradient(135deg, #43a047, #2e7d32);
}

/* 卡片悬停效果 */
.card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

/* 照片布局核心样式 */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 24px;
}
.photo-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    aspect-ratio: 1 / 1; /* 强制 1:1 比例 */
}
.photo-item:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}
.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 保持比例填充裁剪 */
}

/* 蛋糕选择区域样式 */
#cake-selection {
    transition: all 0.5s ease;
}

.cake-selector {
    width: 100%;
    margin: 0 auto;
}

.cakes-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.cake-option {
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 12px;
    padding: 10px;
    text-align: center;
}

.cake-option:hover {
    background-color: rgba(255, 255, 255, 0.7);
    transform: translateY(-5px);
}

.cake-display {
    width: 100px;
    height: 100px;
    margin: 0 auto 10px;
    position: relative;
}

.cake-label {
    display: block;
    font-weight: 600;
    color: #5d4037;
    cursor: pointer;
}

/* 隐藏原生radio按钮 */
.flavor {
    display: none;
}

/* 选中状态样式 */
#redvelvet:checked ~ .cakes-container .cake-option[data-flavor="redvelvet"],
#cheese:checked ~ .cakes-container .cake-option[data-flavor="cheese"],
#matcha:checked ~ .cakes-container .cake-option[data-flavor="matcha"],
#chocolate:checked ~ .cakes-container .cake-option[data-flavor="chocolate"],
#blueberry:checked ~ .cakes-container .cake-option[data-flavor="blueberry"],
#lemon:checked ~ .cakes-container .cake-option[data-flavor="lemon"] {
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* 蛋糕样式 */
.pastry {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto;
}

.pastry .top {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 60px;
    height: 30px;
    border-radius: 50%;
    z-index: 2;
}

.pastry .side {
    position: absolute;
    top: 25px;
    left: 15px;
    width: 50px;
    height: 40px;
    border-radius: 5px;
    z-index: 1;
}

/* 红丝绒蛋糕 */
.pastry.redvelvet .top {
    background-color: #f8bbd0;
}

.pastry.redvelvet .side {
    background-color: #c2185b;
}

.pastry.redvelvet .cherry {
    position: absolute;
    top: 5px;
    left: 25px;
    width: 15px;
    height: 15px;
    background-color: #c62828;
    border-radius: 50%;
    z-index: 3;
}

.pastry.redvelvet .cream {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 50px;
    height: 20px;
    background-color: #f8bbd0;
    border-radius: 50%;
    z-index: 2;
}

/* 芝士蛋糕 */
.pastry.cheese .top {
    background-color: #ffecb3;
}

.pastry.cheese .side {
    background-color: #ffe082;
}

/* 抹茶蛋糕（新增） */
.pastry.matcha .top {
    background-color: #c8e6c9;
}

.pastry.matcha .side {
    background-color: #81c784;
}

.pastry.matcha .powder {
    position: absolute;
    top: 10px;
    left: 15px;
    width: 50px;
    height: 20px;
    background-color: #a5d6a7;
    border-radius: 3px;
    z-index: 3;
}

.pastry.matcha .cream {
    position: absolute;
    top: 15px;
    left: 10px;
    width: 55px;
    height: 25px;
    background-color: #c8e6c9;
    border-radius: 50%;
    z-index: 2;
}

.pastry.matcha .decor {
    position: absolute;
    top: 5px;
    left: 35px;
    width: 8px;
    height: 15px;
    background-color: #ffb74d;
    border-radius: 3px;
    z-index: 4;
}

/* 巧克力蛋糕 */
.pastry.chocolate .top {
    background-color: #8D6E63;
}

.pastry.chocolate .side {
    background-color: #5D4037;
}

.pastry.chocolate .cherry {
    position: absolute;
    top: 5px;
    left: 25px;
    width: 15px;
    height: 15px;
    background-color: #c62828;
    border-radius: 50%;
    z-index: 3;
}

.pastry.chocolate .cream {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 50px;
    height: 20px;
    background-color: #8D6E63;
    border-radius: 50%;
    z-index: 2;
}

/* 蓝莓蛋糕 */
.pastry.blueberry .top {
    background-color: #bbdefb;
}

.pastry.blueberry .side {
    background-color: #1976d2;
}

.pastry.blueberry .berries {
    position: absolute;
    top: 5px;
    left: 15px;
    z-index: 3;
}

.pastry.blueberry .berries::before,
.pastry.blueberry .berries::after {
    content: '';
    position: absolute;
    width: 15px;
    height: 15px;
    background-color: #3949ab;
    border-radius: 50%;
}

.pastry.blueberry .berries::after {
    left: 20px;
}

.pastry.blueberry .cream {
    position: absolute;
    top: 15px;
    left: 10px;
    width: 55px;
    height: 25px;
    background-color: #bbdefb;
    border-radius: 50%;
    z-index: 2;
}

/* 柠檬蛋糕 */
.pastry.lemon .top {
    background-color: #fff9c4;
}

.pastry.lemon .side {
    background-color: #ffeb3b;
}

.pastry.lemon .lemon-slice {
    position: absolute;
    top: 5px;
    left: 20px;
    width: 30px;
    height: 15px;
    background-color: #ffee58;
    border-radius: 0 15px 15px 0;
    z-index: 3;
}

.pastry.lemon .leaf {
    position: absolute;
    top: 3px;
    left: 45px;
    width: 10px;
    height: 10px;
    background-color: #66bb6a;
    border-radius: 0 50% 50% 50%;
    transform: rotate(45deg);
    z-index: 3;
}

.pastry.lemon .cream {
    position: absolute;
    top: 15px;
    left: 10px;
    width: 55px;
    height: 25px;
    background-color: #fff9c4;
    border-radius: 50%;
    z-index: 2;
}

/* 三页式生日卡片样式 */
#birthday-card {
    max-width: 800px;
    margin: 0 auto 3rem;
}

.card-section-title {
    text-align: center;
    font-size: 2.5rem;
    color: #2e7d32;
    margin-bottom: 2rem;
    font-weight: bold;
}

.card-container-3d {
    position: relative;
    width: 100%;
    height: 600px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.card-page {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-page.active {
    opacity: 1;
    transform: translateX(0);
}

.card-page.prev {
    transform: translateX(-100%);
}

/* 第一页：封面样式 */
.card-page-1 {
    background: #ffefef;
}

.card-cover {
    text-align: center;
    color: #8B4B6B;
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cover-title {
    font-size: 3.5rem;
    font-weight: bold;
    margin-bottom: 2rem;
    text-shadow: 2px 2px 4px rgba(139, 75, 107, 0.2);
    font-family: 'Brush Script MT', cursive;
    transform: rotate(-2deg);
}

.cake-icon {
    position: relative;
    font-size: 8rem;
    margin: 2rem 0;
    color: #D4A574;
}

.candle-flame {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    color: #FF6B35;
    animation: flicker 1.5s infinite alternate;
}

@keyframes flicker {
    0% { opacity: 1; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.8; transform: translateX(-50%) scale(1.1); }
    100% { opacity: 1; transform: translateX(-50%) scale(0.9); }
}

.decorations {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.decorations i {
    position: absolute;
    animation: float 3s ease-in-out infinite;
}

.decoration-heart-1 {
    top: 15%;
    left: 15%;
    font-size: 2rem;
    color: #D4669A;
    animation-delay: 0s;
}

.decoration-star-1 {
    top: 20%;
    right: 20%;
    font-size: 1.5rem;
    color: #F4C2A1;
    animation-delay: 0.5s;
}

.decoration-gift-1 {
    bottom: 25%;
    left: 10%;
    font-size: 2.5rem;
    color: #B85C8A;
    animation-delay: 1s;
}

.decoration-heart-2 {
    bottom: 20%;
    right: 15%;
    font-size: 1.8rem;
    color: #D4669A;
    animation-delay: 1.5s;
}

.decoration-star-2 {
    top: 50%;
    left: 5%;
    font-size: 1.2rem;
    color: #F4C2A1;
    animation-delay: 2s;
}

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

/* 第二页：回忆样式 */
.card-page-2 {
    background: #f5f0f0;
}

.card-memory {
    padding: 3rem;
    text-align: center;
    color: #8B4B6B;
    width: 100%;
}

.memory-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 2rem;
    color: #8B4B6B;
}

/* 第三页：内容样式 */
.card-page-3 {
    background: #f8f5f5;
}

.card-content {
    padding: 3rem;
    text-align: center;
    color: #8B4B6B;
    width: 100%;
}

.content-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 2rem;
    color: #8B4B6B;
}

.blessing-text {
    font-size: 1.2rem;
    line-height: 1.8;
    color: #6B4C57;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.blessing-text p {
    margin-bottom: 1rem;
}

.polaroid-frame {
    width: 280px;
    background: white;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: rotate(-3deg);
    margin: 0 auto 2rem;
    position: relative;
}

.polaroid-frame img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.polaroid-caption {
    position: absolute;
    bottom: 15px;
    left: 20px;
    right: 20px;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    font-family: 'Comic Sans MS', cursive;
}

.memory-message {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #6B4C57;
    max-width: 500px;
    margin: 0 auto;
}

.memory-message p {
    margin-bottom: 0.5rem;
}

/* 导航按钮 */
.card-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(139, 75, 107, 0.4);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    color: white;
    transition: all 0.3s ease;
    z-index: 10;
}

.card-nav-btn:hover {
    background: rgba(139, 75, 107, 0.7);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 5px 15px rgba(139, 75, 107, 0.3);
}

.next-btn {
    right: 20px;
}

.prev-btn {
    left: 20px;
}



/* 页面指示器 */
.card-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(139, 75, 107, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
}

.indicator.active {
    background: #8B4B6B;
    transform: scale(1.2);
}

/* 照片板块过渡语样式 */
.section-intro {
    font-size: 1.2rem;
    line-height: 1.8;
    color: #5d4037;
    margin-bottom: 2rem;
    text-align: center;
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
}

/* 响应式调整 */
@media (max-width: 768px) {
    /* 标题区域调整 */
    .content-wrapper {
        padding: 1rem;
    }
    
    h1 {
        font-size: 2.5rem !important;
        line-height: 1.2;
        margin-bottom: 1rem !important;
    }
    
    header p {
        font-size: 1rem !important;
        padding: 0 1rem;
    }
    
    /* 蛋糕选择区域 */
    #cake-selection {
        padding: 1rem;
        margin-bottom: 2rem;
    }
    
    #cake-selection h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .cakes-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .cake-display {
        width: 70px;
        height: 70px;
    }
    
    .pastry {
        width: 60px;
        height: 60px;
    }
    
    .cake-label {
        font-size: 0.9rem;
    }
    
    /* 贺卡区域 */
    .card-container-3d {
        height: 500px;
    }
    
    .cover-title {
        font-size: 2.5rem;
    }
    
    .cake-icon {
        font-size: 6rem;
        margin: 1.5rem 0;
    }
    
    .content-title, .memory-title {
        font-size: 2rem;
    }
    
    .card-content, .card-memory {
        padding: 2rem;
    }
    
    .blessing-text, .memory-message {
        font-size: 1rem;
    }
    
    .polaroid-frame {
        width: 220px;
        padding: 15px 15px 45px 15px;
    }
    
    .polaroid-frame img {
        height: 160px;
    }
    
    .decorations i {
        font-size: 1.5rem;
    }
    
    .decoration-gift-1 {
        font-size: 2rem;
    }
    
    /* 照片展示区域 */
    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .section-intro {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    /* 留言板区域 */
    .bg-white {
        margin-bottom: 1rem;
    }
    
    /* 页脚 */
    footer {
        padding: 1rem 0;
    }
}

@media (max-width: 480px) {
    /* 更小屏幕的额外调整 */
    .content-wrapper {
        padding: 0.5rem;
    }
    
    h1 {
        font-size: 1.6rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    header {
        margin-bottom: 1.5rem !important;
    }
    
    header p {
        font-size: 0.9rem !important;
    }
    
    /* 蛋糕选择 */
    #cake-selection {
        padding: 0.75rem;
        margin-bottom: 1.5rem;
    }
    
    #cake-selection h2 {
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }
    
    .cakes-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .cake-display {
        width: 60px;
        height: 60px;
        margin-bottom: 8px;
    }
    
    .pastry {
        width: 50px;
        height: 50px;
    }
    
    .cake-label {
        font-size: 0.8rem;
    }
    
    /* 贺卡 */
    .card-container-3d {
        height: 400px;
    }
    
    .card-section-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .cover-title {
        font-size: 2rem;
    }
    
    .cake-icon {
        font-size: 4rem;
        margin: 1rem 0;
    }
    
    .content-title, .memory-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .card-content, .card-memory {
        padding: 1.5rem;
    }
    
    .blessing-text, .memory-message {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    .polaroid-frame {
        width: 180px;
        padding: 12px 12px 35px 12px;
    }
    
    .polaroid-frame img {
        height: 120px;
    }
    
    .card-nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .decorations i {
        font-size: 1.2rem;
    }
    
    .decoration-gift-1 {
        font-size: 1.8rem;
    }
    
    .candle-flame {
        font-size: 1.2rem;
    }
    
    /* 照片展示 */
    .text-3xl {
        font-size: 1.5rem !important;
    }
    
    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-top: 1rem;
    }
    
    .section-intro {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
        padding: 0 0.5rem;
    }
    
    /* 留言板 */
    .space-y-4 > * + * {
        margin-top: 0.75rem;
    }
    
    .space-y-6 > * + * {
        margin-top: 1rem;
    }
    
    .bg-white {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .w-full {
        font-size: 0.9rem;
    }
    
    textarea {
        min-height: 80px;
    }
    
    /* 按钮调整 */
    button[type="submit"] {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .like-btn {
        font-size: 0.85rem;
    }
}

/* 超小屏幕适配 */
@media (max-width: 360px) {
    h1 {
        font-size: 1.75rem !important;
    }
    
    .cakes-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .card-container-3d {
        height: 350px;
    }
    
    .cover-title {
        font-size: 1.8rem;
    }
    
    .cake-icon {
        font-size: 3.5rem;
    }
    
    .content-title, .memory-title {
        font-size: 1.3rem;
    }
    
    .blessing-text, .memory-message {
        font-size: 0.8rem;
    }
    
    .polaroid-frame {
        width: 150px;
        padding: 10px 10px 30px 10px;
    }
    
    .polaroid-frame img {
        height: 100px;
    }
    
    .card-nav-btn {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    .decorations i {
        font-size: 1rem;
    }
    
    .decoration-gift-1 {
        font-size: 1.5rem;
    }
    
         .photo-grid {
         gap: 6px;
     }
}

/* iOS Safari 特殊优化 */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari 的安全区域适配 */
    .content-wrapper {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
    
    /* iOS Safari 输入框优化 */
    input[type="text"], textarea {
        font-size: 16px !important; /* 防止iOS自动缩放 */
        transform: translateZ(0); /* 硬件加速 */
    }
    
    /* iOS Safari 滚动优化 */
    .content-wrapper {
        -webkit-overflow-scrolling: touch;
    }
}

/* 横屏模式优化 */
@media screen and (orientation: landscape) and (max-height: 500px) {
    .card-container-3d {
        height: 350px !important;
    }
    
    .cover-title {
        font-size: 1.8rem !important;
    }
    
    .cake-icon {
        font-size: 3rem !important;
        margin: 0.5rem 0 !important;
    }
    
    .content-title, .memory-title {
        font-size: 1.3rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .card-content, .card-memory {
        padding: 1rem !important;
    }
    
    .blessing-text, .memory-message {
        font-size: 0.8rem !important;
        line-height: 1.4 !important;
    }
    
    .polaroid-frame {
        width: 140px !important;
        padding: 8px 8px 25px 8px !important;
    }
    
    .polaroid-frame img {
        height: 90px !important;
    }
    
    .decorations i {
        font-size: 0.9rem !important;
    }
    
    .decoration-gift-1 {
        font-size: 1.3rem !important;
    }
    
    header {
        margin-bottom: 1rem !important;
    }
    
    h1 {
        font-size: 1.5rem !important;
    }
}
