/* ===================================
   main-scene.css — 主场景布局 + 天空/城市
   =================================== */

#main-scene {
    position: fixed;
    inset: 0;
    z-index: 1;
    opacity: 0;
    overflow: hidden;
}

/* 初始隐藏（在屏幕右侧外，不可交互） */
#main-scene.hidden-scene {
    opacity: 0;
    pointer-events: none;
    transform: translateX(100%);
}

/* 激活后可见（由 entry.js 控制滑动动画） */
#main-scene.visible {
    opacity: 1;
}

/* ---- 天空背景 ---- */
.sky-layer {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        #0a0a2e 0%,      /* 顶部：深蓝夜空 */
        #1a1a3e 25%,     /* 中上部：深紫蓝 */
        #2a1a4e 55%,     /* 中部：深紫 */
        #1a2a3e 80%,     /* 中下部：深蓝 */
        #0f1a2e 100%     /* 底部：最深蓝 */
    );
    z-index: 0;
}

/* ---- 星星层 ---- */
.stars-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.star {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 6px 2px rgba(255, 255, 200, 0.8);
    animation: twinkle 2s ease-in-out infinite;
}

/* ---- 云朵层 ---- */
.clouds-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.cloud {
    position: absolute;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    filter: blur(2px);
}

.cloud::before,
.cloud::after {
    content: '';
    position: absolute;
    background: inherit;
    border-radius: 50%;
}

/* 用多层圆形拼出云朵蓬松感 */
.cloud-part {
    position: absolute;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 50%;
}


/* ---- 地面区域 ---- */
.ground-layer {
    position: absolute;
    bottom: -9%;
    left: 0;
    width: 100%;
    height: 50%;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

/* ---- 人物立绘（独立绝对定位，不影响蛋糕/桌子布局） ---- */
.person-img {
    position: absolute;
    bottom: 12%;
    z-index: 1;
    pointer-events: none;
    transform-origin: bottom center;
}
.person-img img {
    display: block;
    width: 320px;
    height: 500px;
    object-fit: contain;
    object-position: bottom center;
    pointer-events: auto;
    cursor: pointer;
    transition: filter 0.35s ease, transform 0.35s ease;
}
.person-left  { left: calc(50% - 420px); }
.person-right { right: calc(50% - 420px); transform-origin: bottom center; }

/* JS 触发的悬停态：容器摆动 + 图片放大发光 */
.person-img.hovering {
    animation: person-wiggle 0.55s ease-in-out infinite;
}
.person-img.hovering img {
    transform: scale(1.06);
    filter: drop-shadow(0 0 18px rgba(255,215,0,0.45)) drop-shadow(0 0 8px rgba(255,183,197,0.35));
}

/* 高兴态：上下弹跳 */
.person-img.bouncing.hovering {
    animation: person-bounce 0.5s ease-in-out infinite;
}
.person-img.bouncing.hovering img {
    transform: scale(1.06);
    filter: drop-shadow(0 0 18px rgba(255,215,0,0.45)) drop-shadow(0 0 8px rgba(255,183,197,0.35));
}

/* 点击反馈 */
.person-img:active img {
    transform: scale(0.95) !important;
    transition: transform 0.1s ease;
}

/* 左右摆动 */
@keyframes person-wiggle {
    0%, 100% { transform: rotate(0deg); }
    25%      { transform: rotate(-5deg); }
    75%      { transform: rotate(5deg); }
}

/* 上下弹跳 */
@keyframes person-bounce {
    0%, 100% { transform: translateY(0); }
    30%      { transform: translateY(-14px); }
    50%      { transform: translateY(0); }
    70%      { transform: translateY(-6px); }
    85%      { transform: translateY(0); }
}

/* ---- 桌子（在蛋糕容器内，自然排列） ---- */
.table-top {
    width: 400px;
    height: 28px;
    background: linear-gradient(180deg, #D4A574, #C49464);
    box-shadow:
        0 2px 8px rgba(0,0,0,0.15),
        inset 0 1px 0 rgba(255,255,255,0.3);
    margin-top: -2px;
    z-index: 4;
    position: relative;
}

.table-legs {
    position: relative;
    width: 260px;
    height: 120px;
    z-index: 3;
    display: flex;
    justify-content: space-between;
    align-self: center;
}

.table-leg {
    width: 28px;
    height: 120px;
    background: linear-gradient(180deg, #C49464, #A07050);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

/* ---- 烟花 Canvas ---- */
#fireworksCanvas {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
}

/* ---- 吹蜡烛按钮 ---- */
.blow-candle-btn {
    position: absolute;
    bottom: 84px;
    right: 24px;
    z-index: 10;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.blow-candle-btn:hover {
    background: rgba(255,165,0,0.3);
    transform: scale(1.15);
}

.blow-candle-btn.listening {
    background: rgba(255,80,0,0.5);
    animation: twinkle 0.8s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(255,100,0,0.4);
}

/* ---- 烟花提示按钮 ---- */
.firework-hint {
    position: absolute;
    bottom: 24px;
    right: 24px;
    z-index: 10;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: float 3s ease-in-out infinite;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Ctext y='28' font-size='28'%3E%F0%9F%8E%86%3C/text%3E%3C/svg%3E") 16 28, pointer;
}

.firework-hint:hover {
    background: rgba(255, 255, 255, 0.45);
    transform: scale(1.15);
}

.firework-hint:active {
    transform: scale(0.9);
}

/* ---- 许愿流星按钮 ---- */
.wish-star-btn {
    position: absolute;
    top: 24px;
    right: 80px;
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: twinkle 2s ease-in-out infinite;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Ctext y='28' font-size='28'%3E%F0%9F%8C%A0%3C/text%3E%3C/svg%3E") 16 28, pointer;
}

.wish-star-btn:hover {
    background: rgba(255,215,0,0.25);
    transform: scale(1.15);
    box-shadow: 0 0 16px rgba(255,215,0,0.3);
}

/* ---- 许愿弹窗 ---- */
.wish-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.wish-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.wish-dialog {
    background: linear-gradient(135deg, #1a1a3e, #2a1a4e);
    border-radius: 20px;
    padding: 28px 24px;
    width: 90%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,215,0,0.2);
}

.wish-dialog h3 {
    font-family: 'Nunito', sans-serif;
    font-size: 1.3rem;
    color: #FFD700;
    margin-bottom: 6px;
}

.wish-sub {
    font-family: 'Quicksand', sans-serif;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    margin-bottom: 16px;
}

.wish-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-family: 'Quicksand', sans-serif;
    font-size: 1rem;
    text-align: center;
    transition: border-color 0.2s;
}

.wish-input:focus {
    outline: none;
    border-color: #FFD700;
}

.wish-input::placeholder {
    color: rgba(255,255,255,0.3);
}

.wish-btns {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    justify-content: center;
}

.wish-cancel {
    padding: 8px 20px;
    border-radius: 20px;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
    font-family: 'Quicksand', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
}

.wish-send {
    padding: 8px 20px;
    border-radius: 20px;
    background: linear-gradient(135deg, #FFD700, #FFB7C5);
    color: #1a1a2e;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.wish-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(255,215,0,0.4);
}

/* ---- 音效开关 ---- */
.sound-toggle {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 20;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.sound-toggle:hover {
    background: rgba(255, 255, 255, 0.45);
}

/* ============ 响应式 ============ */
@media (max-width: 800px) {
    .person-img img { width: 220px; height: 340px; }
    .person-left  { left: calc(50% - 260px); }
    .person-right { right: calc(50% - 260px); }
}

@media (max-width: 600px) {
    .person-img img { width: 150px; height: 230px; }
    .person-left  { left: calc(50% - 210px); }
    .person-right { right: calc(50% - 210px); }
}
