body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: radial-gradient(circle, #fdfbfb 0%, #ebedee 100%); /* 更中性的背景，突出蛋糕 */
    color: #4a4a4a;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
    overflow-x: hidden;
}

.hidden {
    display: none !important; /* 重要，确保隐藏 */
}

.container {
    background-color: #ffffff;
    padding: 25px 30px;
    border-radius: 18px; /* 略微调整圆角 */
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.08), 0 3px 10px rgba(0,0,0,0.04); /* 更细致的阴影 */
    max-width: 750px; /* 默认最大宽度 */
    width: 90%;
    position: relative;
    min-height: 400px; /* 给容器一个最小高度 */
    transition: max-width 0.5s ease-in-out, padding 0.5s ease-in-out, min-height 0.5s ease-in-out; /* 添加过渡效果, 包括min-height */
    overflow: hidden; /* 确保内容不溢出 */
}

/* 当生日祝福视图激活时，扩大容器 */
.container.birthday-view-active {
    max-width: 950px; /* 再扩大一些 */
    min-height: 550px; /* 增加最小高度以容纳更大内容 */
    padding: 35px 45px; /* 相应增加内边距 */
}


/* 名字输入视图特定样式 */
#nameEntryView .prompt-message {
    font-size: 1.2em;
    color: #555;
    margin-bottom: 20px;
}

.name-input-container {
    margin-bottom: 25px; /* 增加底部间距 */
    display: flex; /* 使输入框和按钮在同一行 */
    flex-direction: column; /* 默认垂直排列 */
    align-items: center; /* 居中对齐 */
}

#nameInput {
    padding: 12px 18px; /* 增加内边距 */
    border: 2px solid #f7b2c2;
    border-radius: 25px; /* 更大的圆角 */
    font-size: 1.1em; /* 稍大字体 */
    text-align: center;
    color: #e75480;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 15px; /* 与按钮的间距 */
    width: 80%; /* 限制宽度 */
    max-width: 300px;
}

#nameInput::placeholder {
    color: #fbc2d3;
}

#nameInput:focus {
    border-color: #e75480;
    box-shadow: 0 0 10px rgba(231, 84, 128, 0.4);
}

#submitNameBtn {
    padding: 12px 25px;
    background-color: #e75480;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 10px rgba(231, 84, 128, 0.3);
}

#submitNameBtn:hover {
    background-color: #d64570;
    transform: translateY(-2px);
}

#submitNameBtn:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(231, 84, 128, 0.3);
}


/* 通用 header h1 样式，两个视图都可能用到 */
header h1 {
    color: #e75480; /* 调整主色调为更深的粉色 */
    font-size: 2.8em;
    margin-bottom: 0.6em;
    animation: fadeInDown 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.06);
}

/* 针对扩大后的视图调整标题大小 */
.container.birthday-view-active header h1 {
    font-size: 3.5em; /* 进一步增大标题 */
    margin-bottom: 0.8em;
}

/* 飘动文字容器 */
#floating-text-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* 允许点击穿透 */
    overflow: hidden; /* 确保文字在容器内飘动 */
    z-index: 0; /* 与掉落蛋糕同层或略低/高，根据效果调整 */
}

.floating-text {
    position: absolute;
    font-size: 1.8em; /* 文字大小 */
    color: rgba(231, 84, 128, 0.3); /* 半透明粉色 */
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
    white-space: nowrap; /* 防止文字换行 */
    animation: floatAround 15s linear infinite;
    opacity: 0; /* 初始透明，由动画或JS控制淡入 */
}


#falling-cakes-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.falling-cake {
    position: absolute;
    width: 26px; /* 略小 */
    height: 26px;
    background: linear-gradient(180deg, #ffdde1 0%, #ffc3c9 100%); /* 调整小蛋糕颜色 */
    border-radius: 4px 4px 7px 7px;
    opacity: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.12);
    animation: fall 2.5s linear infinite, fadeInElement 0.5s ease-out forwards; /* 减少基础掉落时间 */
}

.falling-cake::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background-color: #f7b2c2;
    border-radius: 50%;
    box-shadow: 0 0 3px rgba(231,84,128,0.5);
}

.wish {
    font-size: 1.35em;
    color: #555; /* 略微加深 */
    margin-bottom: 1.2em;
    font-style: italic;
    animation: fadeInUp 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.5s backwards;
    position: relative;
    z-index: 1;
    line-height: 1.5;
}

/* 针对扩大后的视图调整祝福语大小 */
.container.birthday-view-active .wish {
    font-size: 1.6em; /* 进一步增大祝福语 */
    margin-bottom: 1.8em; /* 增加间距 */
}

#main-cake-area {
    display: flex;
    justify-content: center;
    align-items: center;
    /* margin: 30px 0 35px; */ /* 原有 */
    position: relative;
    z-index: 1;
    perspective: 800px; /* 为蛋糕添加透视效果 */
    margin: 40px 0 50px; /* 调整外边距以适应更大蛋糕 */
}

/* 针对扩大后的视图调整大蛋糕尺寸 */
.container.birthday-view-active #big-cake {
    width: 240px; /* 再增大蛋糕 */
    height: 175px; /* 相应增加高度 */
    /* animation-delay: 0.5s; /* 如果需要，可以调整动画延迟 */
}


#big-cake {
    width: 180px; /* 蛋糕再大一点 */
    height: 130px;
    position: relative;
    animation: popInCake 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.8s backwards;
    transform-style: preserve-3d; /* 允许3D变换 */
    transition: width 0.5s ease-in-out, height 0.5s ease-in-out; /* 为蛋糕尺寸变化添加过渡 */
    /* transform: rotateX(10deg) rotateY(-5deg); /* 轻微倾斜增加立体感 - 可选 */
}

/* 蛋糕分层 */
#big-cake .layer {
    width: 100%;
    height: 33.33%;
    position: absolute;
    left: 0;
    box-shadow: 0 2px 2px rgba(0,0,0,0.03) inset, 0 0 10px rgba(0,0,0,0.05); /* 更细致的内阴影 */
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 5px,
        rgba(255,255,255,0.03) 5px,
        rgba(255,255,255,0.03) 10px
    ); /* 细微纹理 */
}

#big-cake .layer1 { /* 顶层 */
    background-color: #fddde6; /* 淡粉色海绵蛋糕 */
    bottom: 66.66%;
    z-index: 1;
    border-radius: 12px 12px 5px 5px;
}
#big-cake .layer2 { /* 中间层 - 夹心 */
    background-color: #fbc2d3; /* 草莓夹心色 */
    bottom: 33.33%;
    height: 34.33%;
    border-radius: 5px;
    transform: scaleX(0.96) scaleY(0.9); /* 夹心层略薄且窄 */
    left: 2%;
    z-index: 2;
    box-shadow: 0 1px 1px rgba(0,0,0,0.05) inset, 0 -1px 1px rgba(0,0,0,0.05) inset;
}
#big-cake .layer3 { /* 底层 */
    background-color: #fddde6; /* 淡粉色海绵蛋糕 */
    bottom: 0;
    border-radius: 5px 5px 18px 18px / 5px 5px 40px 40px; /* 底部形状调整 */
    transform: scaleX(0.92);
    left: 4%;
    z-index: 3;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1), 0 3px 8px rgba(0,0,0,0.06);
}


#big-cake .icing {
    position: absolute;
    top: -20px;
    left: -7.5%; /* 糖霜覆盖更广 */
    width: 115%;
    height: 55px; /* 糖霜更厚实 */
    background: #fff;
    border-radius: 50% / 20px 20px 30px 30px; /* 更自然的滴落边缘 */
    box-shadow: 0 5px 15px rgba(0,0,0,0.1), 0 2px 5px rgba(0,0,0,0.05) inset;
    z-index: 4;
}
/* 糖霜滴落效果 */
#big-cake .icing::before, #big-cake .icing::after {
    content: '';
    position: absolute;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
#big-cake .icing::before {
    width: 25px; height: 35px; top: 30px; left: 20%;
}
#big-cake .icing::after {
    width: 20px; height: 30px; top: 32px; left: 65%;
}
/* 更多小的滴落 */
.icing-drip {
    position: absolute;
    background: #fff;
    border-radius: 0 0 50% 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    z-index: 5; /* 确保在糖霜主体之上 */
}
.icing-drip.drip1 { width: 10px; height: 15px; top: 50px; left: 35%; }
.icing-drip.drip2 { width: 8px; height: 12px; top: 52px; left: 50%; }
.icing-drip.drip3 { width: 12px; height: 18px; top: 48px; left: 78%; }


#candle {
    width: 13px;
    height: 60px; /* 蜡烛更高 */
    background: linear-gradient(180deg, #fff8dc 0%, #fdf5e6 70%, #f5eabe 100%); /* 蜡烛颜色细节 */
    position: absolute;
    bottom: 115px; /* 调整到糖霜之上 */
    left: 50%;
    transform: translateX(-50%);
    border-radius: 5px 5px 2px 2px; /* 顶部更圆润 */
    box-shadow: 0px -1px 2px rgba(0,0,0,0.06) inset, 0 1px 3px rgba(0,0,0,0.12);
    z-index: 6; /* 确保在糖霜滴落之上 */
    transition: height 0.5s ease-in-out, bottom 0.5s ease-in-out; /* 为蜡烛尺寸变化添加过渡 */
}

/* 针对扩大后的视图调整蜡烛尺寸 */
.container.birthday-view-active #candle {
    height: 75px; /* 蜡烛更高 */
    bottom: 155px; /* 相应调整位置 (基于新蛋糕高度) */
}
.container.birthday-view-active #flame {
    width: 20px; /* 火焰更大 */
    height: 32px;
    top: -30px; /* 调整位置 */
}

/* 蜡烛上的纹路 */
#candle::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 80%;
    top: 10%;
    left: 0;
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.03) 2px,
        rgba(0,0,0,0.03) 4px
    );
    border-radius: 5px 5px 0 0;
}


#flame {
    width: 15px;
    height: 25px;
    background: radial-gradient(ellipse at bottom, #ffec8b 10%, #ffd700 40%, #ffae42 80%, #ff8c00 98%);
    border-radius: 50% 50% 40% 40% / 60% 60% 45% 45%; /* 火焰形状微调 */
    position: absolute;
    top: -23px;
    left: 50%;
    transform: translateX(-50%) scale(1);
    animation: flicker 0.25s infinite alternate ease-in-out;
    cursor: pointer;
    transition: opacity 0.4s ease-out, height 0.5s ease-in-out, transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55), width 0.5s ease-in-out, top 0.5s ease-in-out; /* 为火焰尺寸变化添加过渡 */
    filter: blur(0.8px); /* 增加模糊 */
    z-index: 7;
}

#flame.out {
    opacity: 0;
    height: 5px;
    transform: translateX(-50%) translateY(18px) scale(0.2);
    background: #444;
    animation: none;
    filter: blur(0);
}

.message h2 {
    color: #e75480;
    border-bottom: 2px solid #f7b2c2;
    padding-bottom: 0.4em;
    margin-bottom: 0.9em;
    animation: fadeIn 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) 1.5s backwards;
    position: relative;
    z-index: 1;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.04);
}
/* 针对扩大后的视图调整消息区域文字 */
.container.birthday-view-active .message h2 {
    font-size: 2em; /* 增大标题 */
    margin-bottom: 1em;
}
.container.birthday-view-active .message p {
    font-size: 1.25em; /* 增大段落文字 */
    line-height: 1.7;
}

.message p {
    font-size: 1.1em;
    line-height: 1.65;
    margin-bottom: 1em;
    animation: fadeIn 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) 1.7s backwards;
    position: relative;
    z-index: 1;
}

footer {
    margin-top: 2.5em;
    padding-top: 1.2em;
    border-top: 1px solid #e8e8e8;
    font-size: 0.9em;
    color: #777; /* 页脚文字颜色调整 */
    animation: fadeInUp 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) 2.5s backwards;
    position: relative;
    z-index: 1;
}

/* 动画效果 */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-35px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(35px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInElement {
    from { opacity: 0; transform: translateY(-20px) scale(0.8); }
    to { opacity: 0.8; transform: translateY(0) scale(1); }
}

@keyframes popInCake { /* 蛋糕入场动画 */
    0% { opacity: 0; transform: scale(0.2) rotate(-20deg) translateY(50px); }
    60% { opacity: 1; transform: scale(1.05) rotate(8deg) translateY(0px); }
    100% { opacity: 1; transform: scale(1) rotate(0deg) translateY(0px); }
}


@keyframes flicker {
    0% { transform: translateX(-50%) scaleY(1) scaleX(1) skewX(-2deg); opacity: 1; box-shadow: 0 0 12px #ffd700, 0 0 18px #ffd700, 0 0 25px #ffae42; }
    50% { transform: translateX(-48%) scaleY(0.92) scaleX(1.08) skewX(2deg); opacity: 0.8; box-shadow: 0 0 15px #ffec8b, 0 0 22px #ffec8b, 0 0 30px #ffd700; }
    100% { transform: translateX(-52%) scaleY(1.08) scaleX(0.92) skewX(-2deg); opacity: 1; box-shadow: 0 0 12px #ffae42, 0 0 18px #ffae42, 0 0 25px #ff8c00; }
}

@keyframes fall {
    0% {
        transform: translateY(-60px) rotate(-15deg);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(calc(100vh + 60px)) rotate(720deg);
        opacity: 0;
    }
}

@keyframes floatAround {
    0% {
        transform: translate(10vw, 80vh) rotate(-10deg) scale(0.8);
        opacity: 0;
    }
    10% {
        opacity: 1;
        transform: translate(20vw, 60vh) rotate(5deg) scale(1);
    }
    25% {
        transform: translate(70vw, 30vh) rotate(-15deg) scale(0.9);
    }
    50% {
        transform: translate(30vw, 10vh) rotate(10deg) scale(1.1);
    }
    75% {
        transform: translate(80vw, 50vh) rotate(20deg) scale(0.8);
    }
    90% {
        opacity: 1;
        transform: translate(10vw, 70vh) rotate(-5deg) scale(1);
    }
    100% {
        transform: translate(5vw, 85vh) rotate(-12deg) scale(0.8);
        opacity: 0;
    }
}
/* “永远18岁！” 特效 */
#specialWishText {
    font-weight: bold;
    color: #ff63a5; /* 初始颜色 */
    animation: specialWishEffect 3s infinite;
    display: inline-block; /* 使transform生效 */
    position: relative; /* 确保在其他内容之上，如果需要 */
    z-index: 2; /* 高于普通段落，但低于主要动画元素如蛋糕 */
}

@keyframes specialWishEffect {
    0%, 100% {
        transform: scale(1) translateY(0px);
        color: #ff63a5;
        text-shadow: 0 0 5px rgba(255, 192, 203, 0.7), 0 0 10px rgba(255, 192, 203, 0.5);
    }
    25% {
        color: #ff85c1;
        text-shadow: 0 0 8px rgba(255, 192, 203, 0.8), 0 0 15px rgba(255, 192, 203, 0.6), 0 0 20px rgba(231, 84, 128, 0.4);
    }
    50% {
        transform: scale(1.15) translateY(-5px); /* 放大并轻微上移 */
        color: #e75480;
        text-shadow: 0 0 12px rgba(255, 192, 203, 0.9), 0 0 22px rgba(231, 84, 128, 0.7), 0 0 35px rgba(231, 84, 128, 0.5);
    }
    75% {
        color: #ff85c1;
        text-shadow: 0 0 8px rgba(255, 192, 203, 0.8), 0 0 15px rgba(255, 192, 203, 0.6), 0 0 20px rgba(231, 84, 128, 0.4);
    }
}
/* 闪动爱心样式 */
.pulsing-heart-container {
    text-align: center; /* 使爱心居中 */
    margin-top: 10px; /* 与上方文字的间距 */
}

#pulsingHeart {
    font-size: 2.5em; /* 爱心大小 */
    color: #e75480; /* 爱心颜色 */
    display: inline-block;
    animation: pulseHeart 1.5s infinite ease-in-out;
    text-shadow: 0 0 8px rgba(231, 84, 128, 0.5);
}

@keyframes pulseHeart {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.25);
        opacity: 1;
        color: #ff63a5; /* 脉冲时颜色更亮 */
        text-shadow: 0 0 15px rgba(231, 84, 128, 0.7), 0 0 5px #fff; /* 增加白色内发光感 */
    }
}