/* ===== 礼物应用 ===== */

#scene-gift {
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    overflow: hidden;
}

/* 暗色蒙层 — 让星星在背景图上可见 */
.gift-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 50%, rgba(5, 2, 15, 0.4) 0%, rgba(5, 2, 15, 0.85) 100%);
    z-index: 0;
    pointer-events: none;
}

/* 星星背景 — 增强闪烁 */
.gift-stars {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.gift-star {
    position: absolute;
    background: #ffd700;
    border-radius: 50%;
    box-shadow: 0 0 3px #ffd700;
    animation: starTwinkle 1.8s ease-in-out infinite;
}

@keyframes starTwinkle {
    0%, 100% { opacity: 0.1; transform: scale(0.6); }
    30% { opacity: 1; transform: scale(1.3); }
    60% { opacity: 0.2; transform: scale(0.7); }
}

/* ── 导航 ── */
.gift-nav {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    padding: calc(14px + var(--safe-top)) 8px 6px;
}

.gift-nav-back {
    width: 40px;
    height: 36px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.gift-nav-back:active { opacity: 0.5; }

.gift-nav-back svg {
    width: 22px;
    height: 22px;
    stroke: rgba(255, 255, 255, 0.7);
    stroke-width: 2.5;
}

/* ── 礼物盒 ── */
.gift-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    padding: 20px;
    animation: giftFadeIn 0.6s ease both;
}

@keyframes giftFadeIn {
    from { opacity: 0; transform: translateY(30px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.gift-box {
    width: 180px;
    height: 180px;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.gift-box:active { transform: scale(0.95); }

.gift-box-body {
    position: absolute;
    bottom: 0;
    left: 10px;
    right: 10px;
    height: 120px;
    background: linear-gradient(180deg, #ff4d4d 0%, #cc1a2a 100%);
    border-radius: 10px 10px 4px 4px;
    box-shadow: 0 8px 40px rgba(255, 50, 50, 0.4), inset 0 1px 0 rgba(255,255,255,0.15);
}

.gift-box-lid {
    position: absolute;
    top: 50px;
    left: -2px;
    right: -2px;
    height: 50px;
    background: linear-gradient(180deg, #ff6b6b 0%, #ff3b3b 100%);
    border-radius: 8px 8px 0 0;
    box-shadow: 0 6px 28px rgba(255, 59, 48, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
    transform-origin: center bottom;
    transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 2;
}

.gift-box.opened .gift-box-lid {
    transform: translateY(-65px) rotate(-6deg);
}

.gift-ribbon-v {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 120px;
    background: linear-gradient(180deg, #ffe566 0%, #ffd700 40%, #e6b800 100%);
    border-radius: 9px;
    box-shadow: 0 0 18px rgba(255, 215, 0, 0.5);
    z-index: 3;
}

.gift-ribbon-h {
    position: absolute;
    top: 95px;
    left: 10px;
    right: 10px;
    height: 18px;
    background: linear-gradient(90deg, #ffe566, #ffd700 40%, #e6b800);
    border-radius: 9px;
    box-shadow: 0 0 18px rgba(255, 215, 0, 0.5);
    z-index: 3;
}

.gift-bow {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 44px;
    z-index: 4;
}

.gift-bow::before, .gift-bow::after {
    content: '';
    position: absolute;
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, #ffe566, #ffd700);
    border-radius: 50% 50% 50% 0;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

.gift-bow::before { left: -10px; top: 4px; transform: rotate(-45deg); }
.gift-bow::after  { right: -10px; top: 4px; transform: rotate(45deg); }

/* 开盒后礼物盒消失 */
.gift-box.opened {
    animation: boxFadeOut 0.35s ease 0.4s both;
}

@keyframes boxFadeOut {
    to { opacity: 0; transform: scale(0.75); }
}

/* ── 礼物揭晓卡片 ── */
.gift-glass-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 6;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.gift-glass-overlay.show {
    display: flex;
    animation: overlayReveal 0.4s ease both;
}

@keyframes overlayReveal {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 主卡片 — 液态玻璃风格 */
.gift-reveal-card {
    position: relative;
    width: 300px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(25, 15, 45, 0.92), rgba(8, 3, 20, 0.96));
    border: 0.5px solid rgba(255, 215, 0, 0.3);
    box-shadow:
        0 0 80px rgba(255, 215, 0, 0.06),
        0 20px 60px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    overflow: hidden;
    animation: cardFloat 0.5s cubic-bezier(0.32, 0.72, 0, 1) both;
}

@keyframes cardFloat {
    from { opacity: 0; transform: translateY(30px) scale(0.92); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 卡片顶部发光装饰条 */
.gift-reveal-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 20%;
    right: 20%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ffd700, transparent);
    z-index: 2;
}

/* 游戏封面区域 */
.gift-reveal-cover {
    position: relative;
    width: 100%;
    height: 240px;
    overflow: hidden;
}

.gift-reveal-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 封面上的渐变遮罩 */
.gift-reveal-cover::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(0deg, rgba(10, 5, 25, 0.9) 0%, transparent 100%);
    pointer-events: none;
}

/* 封面上的奖杯标记 */
.gift-reveal-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #1a0e2e;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 9999px;
    letter-spacing: 1px;
    box-shadow: 0 2px 12px rgba(255, 215, 0, 0.4);
    z-index: 3;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { box-shadow: 0 2px 12px rgba(255, 215, 0, 0.3); }
    50% { box-shadow: 0 2px 24px rgba(255, 215, 0, 0.6); }
}

/* 内容区 */
.gift-reveal-body {
    padding: 20px 24px 24px;
    position: relative;
}

.gift-reveal-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    text-align: center;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.gift-reveal-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
    text-align: center;
    letter-spacing: 3px;
    margin-bottom: 20px;
}

/* CD-Key 区域 */
.gift-reveal-cdkey {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 215, 0, 0.15);
    border-radius: 12px;
    padding: 14px 18px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.gift-reveal-cdkey:active {
    transform: scale(0.97);
    background: rgba(255, 215, 0, 0.08);
}

/* CD-Key 锁定状态 */
.gift-reveal-cdkey-code.locked {
    font-size: 14px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.3);
}

.gift-reveal-cdkey-code strong {
    color: #ffd700;
    font-weight: 700;
}

.gift-reveal-cdkey-label {
    font-size: 10px;
    color: rgba(255, 215, 0, 0.4);
    letter-spacing: 2px;
    font-weight: 600;
    flex-shrink: 0;
}

.gift-reveal-cdkey-code {
    font-family: 'SF Mono', ui-monospace, 'Courier New', monospace;
    font-size: 16px;
    font-weight: 700;
    color: #ffd700;
    letter-spacing: 3px;
    user-select: all;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.15);
}

.gift-reveal-cdkey-copy {
    font-size: 14px;
    opacity: 0.4;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.gift-reveal-cdkey:hover .gift-reveal-cdkey-copy {
    opacity: 0.8;
}

/* 底部提示 */
.gift-reveal-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.2);
    text-align: center;
    margin-top: 12px;
    letter-spacing: 1px;
}

/* 一键跳转消息页按钮 — 液态玻璃风格 */
.gift-go-messages-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 16px;
    padding: 11px 0;
    border: 0.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}
.gift-go-messages-btn:hover {
    background: rgba(255, 255, 255, 0.13);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.gift-go-messages-btn:active {
    transform: scale(0.96);
    background: rgba(255, 255, 255, 0.16);
}
.gift-go-messages-btn svg {
    width: 15px;
    height: 15px;
    stroke: rgba(255, 255, 255, 0.7);
}

/* 金色角标装饰 */
.gift-reveal-card::after {
    content: '✦';
    position: absolute;
    bottom: 12px;
    right: 16px;
    font-size: 10px;
    color: rgba(255, 215, 0, 0.15);
    letter-spacing: 6px;
}

/* ── 老虎机 - 开盒悬念 ── */
.gift-slot-stage {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 15;
    animation: slotStageIn 0.4s cubic-bezier(0.32, 0.72, 0, 1) both;
}

.gift-slot-stage.active {
    display: flex;
}

@keyframes slotStageIn {
    from { opacity: 0; transform: scale(0.7); }
    to { opacity: 1; transform: scale(1); }
}

.gift-slot-frame {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 18px 20px;
    background: linear-gradient(180deg, #2a1e3c 0%, #140c28 100%);
    border: 1.5px solid rgba(255, 215, 0, 0.45);
    border-radius: 18px;
    box-shadow:
        0 0 40px rgba(255, 215, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
    position: relative;
    animation: borderGlow 2s ease-in-out infinite alternate;
}

@keyframes borderGlow {
    from { border-color: rgba(255, 215, 0, 0.3); box-shadow: 0 0 20px rgba(255, 215, 0, 0.06); }
    to   { border-color: rgba(255, 215, 0, 0.55); box-shadow: 0 0 45px rgba(255, 215, 0, 0.14); }
}

.gift-slot-reel-wrap {
    width: 80px;
    height: 100px;
    overflow: hidden;
    border-radius: 8px;
    background: #0a0820;
    border: 1px solid rgba(255, 215, 0, 0.15);
    position: relative;
}

/* 转轴旋转时的运动模糊效果 */
.gift-slot-reel-wrap.spinning .gift-slot-reel-inner {
    filter: blur(1px) brightness(0.9);
    transition: none;
}

.gift-slot-reel-wrap.stopped .gift-slot-reel-inner {
    filter: blur(0) brightness(1);
    transition: filter 0.2s ease;
}

.gift-slot-reel-inner {
    display: flex;
    flex-direction: column;
    transition: none;
}

.gift-slot-reel-inner img {
    width: 80px;
    height: 100px;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

/* 旋转变暗遮罩 - 让没转的看起来暗 */
.gift-slot-reel-wrap.stopped::after {
    opacity: 0;
}

.gift-slot-reel-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    pointer-events: none;
    transition: opacity 0.3s;
}

/* 高光扫描线 */
.gift-slot-frame::before {
    content: '';
    position: absolute;
    left: 16px;
    right: 16px;
    top: -2px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ffd700, transparent);
    animation: scanLine 1.5s ease-in-out infinite;
    opacity: 0.6;
}

@keyframes scanLine {
    0%   { top: -2px; opacity: 0.3; }
    50%  { top: calc(100% - 0px); opacity: 0.8; }
    100% { top: -2px; opacity: 0.3; }
}

/* 老虎机标题 */
.gift-slot-title {
    color: #ffd700;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 4px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    margin-bottom: 16px;
    text-align: center;
}

/* 老虎机底部装饰灯 */
.gift-slot-lights {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    justify-content: center;
}

.gift-slot-light {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffd700;
    animation: lightBlink 0.6s ease-in-out infinite alternate;
}

.gift-slot-light:nth-child(2n) { animation-delay: 0.3s; background: #ff6b6b; }
.gift-slot-light:nth-child(3n) { animation-delay: 0.15s; background: #4ecdc4; }

@keyframes lightBlink {
    from { opacity: 0.2; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1.2); }
}

/* 抽奖按钮 — 液态玻璃金边 */
.gift-draw-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
    padding: 11px 32px;
    border: 1.5px solid rgba(255, 215, 0, 0.5);
    border-radius: 9999px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.12), rgba(255, 215, 0, 0.03));
    color: #ffd700;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 24px rgba(255, 215, 0, 0.08);
}

.gift-draw-btn::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(120deg, transparent 35%, rgba(255, 215, 0, 0.25) 48%, transparent 65%);
    animation: shimmer 2.2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.gift-draw-btn:hover {
    box-shadow: 0 0 36px rgba(255, 215, 0, 0.15);
}
.gift-draw-btn:active {
    transform: scale(0.93);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.22), rgba(255, 215, 0, 0.08));
}
.gift-draw-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}
.gift-draw-btn:disabled::before { animation: none; }
.gift-draw-btn .btn-icon { font-size: 18px; }

/* ── 再来一次提示 ── */
.gift-retry-msg {
    text-align: center;
    margin-top: 12px;
    font-size: 14px;
    color: rgba(255, 215, 0, 0.7);
    letter-spacing: 2px;
    animation: retryPulse 1s ease-in-out infinite alternate;
    display: none;
}

.gift-retry-msg.show {
    display: block;
}

@keyframes retryPulse {
    from { opacity: 0.4; }
    to { opacity: 1; }
}

/* 彩纸 */
.gift-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 20;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -10px;
    width: 8px;
    height: 8px;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Toast */
.gift-toast {
    position: absolute;
    bottom: calc(60px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    padding: 8px 18px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 30;
    white-space: nowrap;
}

.gift-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
