/* ===================================
   entry.css — 入口页：3D 礼物盒
   斜视角正方体，可见正面+右侧面+顶面
   =================================== */

#entry-page {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 40%, #0f3460 100%);
    transition: opacity 0.4s ease;
}
#entry-page.slide-out { opacity: 0; pointer-events: none; }

/* ---- 容器 ---- */
.giftbox-container {
    position: relative;
    width: 360px; height: 360px;
    cursor: pointer;
    animation: float-3d 3s ease-in-out infinite;
    z-index: 10;
}

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

/* ---- 3D 场景 ---- */
.giftbox-3d-scene {
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    transform-style: preserve-3d;
    transform: translate(-50%, -50%) rotateX(-20deg) rotateY(-30deg);
}

.giftbox-container.shaking .giftbox-3d-scene {
    animation: shake-3d 0.5s ease-in-out;
}
@keyframes shake-3d {
    0%,100%{transform:translate(-50%,-50%)rotateX(-20deg)rotateY(-30deg)}
    20%    {transform:translate(-48%,-52%)rotateX(-18deg)rotateY(-28deg)}
    40%    {transform:translate(-52%,-48%)rotateX(-22deg)rotateY(-32deg)}
    60%    {transform:translate(-49%,-51%)rotateX(-19deg)rotateY(-29deg)}
    80%    {transform:translate(-51%,-49%)rotateX(-21deg)rotateY(-31deg)}
}

/* ==================== 盒身 ==================== */
.giftbox-body-3d {
    position: absolute;
    transform-style: preserve-3d;
}

/* 正方体尺寸：W=200 H=150 D=140 */
/* 所有面以 (0,0,0) 为中心，用 translate 推到正确位置 */

/* 正面 */
.gb-front {
    position: absolute;
    width: 200px; height: 150px;
    margin-left: -100px; margin-top: -75px;
    background: linear-gradient(180deg, #FFD1DC 0%, #FFB7C5 100%);
    border-radius: 5px;
    transform: translateZ(70px);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.3), 0 8px 24px rgba(0,0,0,0.2);
    overflow: hidden;
}

/* 右侧面 */
.gb-right {
    position: absolute;
    width: 140px; height: 150px;
    margin-left: -70px; margin-top: -75px;
    background: linear-gradient(180deg, #E0AEB8 0%, #D895A0 100%);
    transform: rotateY(90deg) translateZ(100px);
}

/* 左侧面 */
.gb-left {
    position: absolute;
    width: 140px; height: 150px;
    margin-left: -70px; margin-top: -75px;
    background: linear-gradient(180deg, #D8A0AA 0%, #CC8895 100%);
    transform: rotateY(-90deg) translateZ(100px);
}

/* 背面 */
.gb-back {
    position: absolute;
    width: 200px; height: 150px;
    margin-left: -100px; margin-top: -75px;
    background: linear-gradient(180deg, #D895A0 0%, #CC8895 100%);
    transform: rotateY(180deg) translateZ(70px);
}

/* 正面十字丝带 */
.gb-ribbon-v {
    position: absolute; width: 8px; height: 100%;
    left: 50%; transform: translateX(-50%);
    background: rgba(255,255,255,0.5); z-index: 1;
}
.gb-ribbon-h {
    position: absolute; width: 100%; height: 8px;
    top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.5); z-index: 1;
}
.gb-ribbon-v-side {
    position: absolute; width: 100%; height: 8px;
    top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.3);
}

/* 提示文字 */
.giftbox-hint {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    z-index: 2;
    font-family: 'Quicksand', sans-serif; font-size: 1.15rem; font-weight: 700;
    color: #fff; letter-spacing: 0.1em;
    text-shadow: 0 2px 6px rgba(0,0,0,0.15);
    animation: twinkle 1.5s ease-in-out infinite;
    pointer-events: none; transition: opacity 0.3s ease;
}
.giftbox-hint.fade-out { opacity: 0; }

/* ==================== 盖子（整体绕后沿旋转打开） ==================== */
.giftbox-lid-3d {
    position: absolute;
    transform-style: preserve-3d;
    transform-origin: 0 -75px -70px;   /* 铰链：正面后沿 */
    transition: transform 0.7s cubic-bezier(0.4,0,0.2,1);
}
.giftbox-lid-3d.open {
    transform: rotateX(125deg);
}

/* 盖顶面 (200×140, 比盒身稍大一圈) */
.gb-lid-top {
    position: absolute;
    width: 208px; height: 148px;
    margin-left: -104px; margin-top: -74px;
    background: linear-gradient(135deg, #FFE0E8 0%, #FFB7C5 100%);
    border-radius: 6px;
    transform: rotateX(90deg) translateZ(75px);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.4);
}

/* 盖子前沿 (208×25) */
.gb-lid-front {
    position: absolute;
    width: 208px; height: 25px;
    margin-left: -104px; margin-top: -75px;
    background: linear-gradient(180deg, #FFC5D0, #FF8E9E);
    border-radius: 4px 4px 0 0;
    transform: translateZ(74px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
}

/* 盖子右沿 (148×25) */
.gb-lid-right {
    position: absolute;
    width: 148px; height: 25px;
    margin-left: -74px; margin-top: -75px;
    background: linear-gradient(180deg, #E8B0BD, #D8788A);
    transform: rotateY(90deg) translateZ(104px);
}

/* 盖子左沿 */
.gb-lid-left {
    position: absolute;
    width: 148px; height: 25px;
    margin-left: -74px; margin-top: -75px;
    background: linear-gradient(180deg, #D8A0AA, #C87885);
    transform: rotateY(-90deg) translateZ(104px);
}

/* 盖子后沿 */
.gb-lid-back {
    position: absolute;
    width: 208px; height: 25px;
    margin-left: -104px; margin-top: -75px;
    background: linear-gradient(180deg, #D895A0, #C07080);
    transform: rotateY(180deg) translateZ(74px);
}

/* ==================== 蝴蝶结 ==================== */
.giftbox-bow {
    position: absolute;
    top: -20px; left: 50%;
    transform: translateX(-50%);
    z-index: 5;
}
.gb-bow-loop {
    position: absolute;
    width: 28px; height: 20px;
    border-radius: 50%;
    border: 3px solid #FF6B7A;
    background: #FFB7C5;
}
.gb-bow-left  { right: 5px; transform: rotate(-35deg); }
.gb-bow-right { left: 5px;  transform: rotate(35deg); }
.gb-bow-knot {
    position: relative; z-index: 1;
    font-size: 1rem; display: block; text-align: center;
}

/* ==================== 贺卡（不变） ==================== */
.giftbox-card {
    position: fixed;
    top: 50%; left: 50%;
    width: 180px; height: 120px;
    margin-left: -90px; margin-top: -60px;
    z-index: 3;
    background: linear-gradient(180deg, #FFFBF5 0%, #FFF0E0 100%);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    text-align: center;
    display: flex; align-items: center; justify-content: center;
    transform: scale(0.3); opacity: 0;
    pointer-events: none;
    transition: all 0.7s cubic-bezier(0.34,1.56,0.64,1);
}
.giftbox-card::before {
    content: ''; position: absolute; inset: 8px;
    border: 2px solid #FFD700; border-radius: 8px;
    opacity: 0.4; pointer-events: none;
}
.giftbox-card::after {
    content: '🌸'; position: absolute;
    top: 10px; right: 14px; font-size: 0.9rem;
    opacity: 0.5; pointer-events: none;
}
.giftbox-card.popped {
    width: 420px; height: 320px;
    margin-left: -210px; margin-top: -160px;
    transform: scale(1); opacity: 1;
    z-index: 50; pointer-events: auto;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,215,0,0.3);
}
.giftbox-card.popped::after {
    content: '🌸 💐 🌸';
    top: auto; bottom: 14px; right: auto; left: 50%;
    transform: translateX(-50%); font-size: 1rem;
    letter-spacing: 8px; opacity: 0.4;
}
.giftbox-card.slide-to-left {
    margin-left: -210px;
    transform: translateX(-120vw) scale(1); opacity: 0;
    transition: all 0.6s cubic-bezier(0.4,0,0.2,1);
}

.card-inner-content { position: relative; z-index: 2; width: 100%; padding: 20px; }
.card-sparkles { font-size: 1.3rem; margin-bottom: 6px; }
.giftbox-card.popped .card-sparkles { font-size: 1.8rem; margin-bottom: 12px; }
.card-title {
    font-family: 'Nunito', sans-serif; font-size: 1.3rem; font-weight: 800;
    color: #6C5B7B; margin: 6px 0;
}
.giftbox-card.popped .card-title { font-size: 2.2rem; margin: 10px 0; }
.card-msg {
    font-family: 'Quicksand', sans-serif; font-size: 0.75rem;
    color: #5B4B5E; margin: 3px 0; line-height: 1.6;
}
.giftbox-card.popped .card-msg { font-size: 1.15rem; margin: 8px 0; line-height: 1.8; }

.card-next-btn {
    display: none; margin-top: 12px; padding: 12px 30px;
    border-radius: 30px;
    background: linear-gradient(135deg, #FFB7C5, #C7CEEA);
    color: #fff; font-family: 'Nunito', sans-serif;
    font-size: 1.05rem; font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px rgba(255,183,197,0.4); cursor: pointer;
}
.giftbox-card.popped .card-next-btn {
    display: inline-block; position: absolute;
    bottom: -50px; right: 50%; transform: translateX(50%);
}
.card-next-btn:hover { transform: scale(1.08); }
.card-next-btn:active { transform: scale(0.95); }
.card-corner-tl {
    position: absolute; top: 10px; left: 14px;
    font-size: 0.8rem; opacity: 0.4; pointer-events: none;
}
.giftbox-card.popped .card-corner-tl { font-size: 1rem; }

/* ==================== 彩带 ==================== */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
.confetti-piece {
    position: absolute; width: 12px; height: 18px;
    animation: confetti-fall 2s ease-out forwards;
}
@keyframes confetti-fall {
    0%{transform:translate(0,0)rotate(0deg)scale(1);opacity:1}
    100%{transform:translate(var(--cx),var(--cy))rotate(var(--cr))scale(0.3);opacity:0}
}

.confetti-emoji {
    position: absolute; font-size: 1.5rem;
    animation: confetti-emoji-fall 3s ease-out forwards;
}
@keyframes confetti-emoji-fall {
    0%{transform:translate(0,0)rotate(0deg)scale(.5);opacity:1}
    30%{transform:translate(calc(var(--cx)*.3),calc(var(--cy)*.3))rotate(calc(var(--cr)*.3))scale(var(--sc,1));opacity:1}
    100%{transform:translate(var(--cx),var(--cy))rotate(var(--cr))scale(.2);opacity:0}
}

.confetti-spark {
    position: absolute;
    animation: confetti-spark-fall 1.5s ease-out forwards;
}
@keyframes confetti-spark-fall {
    0%{transform:translate(0,0)scale(1);opacity:1}
    50%{opacity:.9}
    100%{transform:translate(var(--cx),var(--cy))scale(0);opacity:0}
}

/* ==================== 聚光灯 ==================== */
.spotlight {
    position: absolute;
    top: 50%; left: 50%;
    width: 600px; height: 600px;
    margin-left: -300px; margin-top: -300px;
    background: radial-gradient(ellipse at center,
        rgba(255,215,0,0.22) 0%,
        rgba(255,183,197,0.12) 30%,
        rgba(200,180,255,0.06) 55%,
        transparent 72%);
    pointer-events: none;
    animation: spotlight-pulse 3s ease-in-out infinite;
    z-index: 1;
}

@keyframes spotlight-pulse {
    0%,100% { transform: scale(0.95); opacity: 0.8; }
    50%     { transform: scale(1.12); opacity: 1; }
}

/* ==================== 金色粒子飘落 ==================== */
.gold-particles {
    position: fixed; inset: 0;
    pointer-events: none; z-index: 2;
}

.gold-particle {
    position: absolute;
    width: 3px; height: 3px;
    border-radius: 50%;
    background: #FFD700;
    box-shadow: 0 0 4px 1px rgba(255,215,0,0.5);
    animation: gold-fall linear forwards;
}

@keyframes gold-fall {
    0%   { transform: translateY(-20px) rotate(0deg); opacity: 0; }
    10%  { opacity: 0.8; }
    90%  { opacity: 0.5; }
    100% { transform: translateY(105vh) rotate(360deg); opacity: 0; }
}

/* ==================== 流星（JS动态控制） ==================== */
.shooting-star {
    position: fixed;
    pointer-events: none; z-index: 2;
    width: 5px; height: 5px;
    border-radius: 50%;
    background: #fff;
    box-shadow:
        0 0 6px 2px #fff,
        0 0 14px 6px #FFD700,
        0 0 24px 10px #FFB7C5,
        0 0 40px 16px rgba(255,150,200,0.6);
}

/* 拖尾粒子（JS生成） */
.star-trail {
    position: fixed;
    pointer-events: none; z-index: 2;
    border-radius: 50%;
    background: #FFD700;
    animation: trail-fade 1.2s ease-out forwards;
}

@keyframes trail-fade {
    0%   { opacity: 0.8; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.1); }
}

/* ==================== 漂浮星星 ==================== */
.floating-stars { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.floating-star {
    position: absolute; font-size: 1.2rem;
    animation: twinkle-delayed 3s ease-in-out infinite;
}
