/* 庆祝游戏样式 */

/* === 入口标志 === */
.celebration-entrance {
    position: relative;
    margin: 40px auto 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 80px;
    height: 80px;
    cursor: pointer;
    transition: transform 300ms ease-out;
    z-index: 10;
    border-radius: 50%;
    padding: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    border: 2px solid;
    animation: breathe 3s ease-in-out infinite;
}

/* 针对不同主题设置不同颜色 */
#screen-4[data-mood="calm"] .celebration-entrance {
    background: rgba(255, 248, 220, 0.95); /* 浅黄色 */
    border-color: rgba(255, 200, 100, 0.6);
}

#screen-4[data-mood="joy"] .celebration-entrance {
    background: rgba(255, 240, 245, 0.95); /* 浅粉色 */
    border-color: rgba(255, 182, 193, 0.6);
}

#screen-4[data-mood="romantic"] .celebration-entrance {
    background: rgba(230, 230, 250, 0.95); /* 浅紫色 */
    border-color: rgba(186, 85, 211, 0.4);
}

#screen-4[data-mood="melancholy"] .celebration-entrance {
    background: rgba(240, 248, 255, 0.95); /* 浅蓝色 */
    border-color: rgba(135, 206, 235, 0.6);
}

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.celebration-entrance.show {
    animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { opacity: 0.85; }
    50% { opacity: 1; }
}

.celebration-entrance:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    transform: scale(1.1);
}

.celebration-icon {
    width: 32px;
    height: 32px;
    color: #FF6B35;
}

.celebration-label {
    font-size: 0.75rem; /* 12px */
    letter-spacing: 0.1em;
    color: #8B4513;
    margin-top: -4px;
}

/* === 二选一选择界面 === */
.game-selector-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 400ms ease-out;
    z-index: 2000;
}

.game-selector-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* 信件屏模糊状态 */
#screen-4.blur-background {
    transform: scale(0.96);
    filter: blur(8px);
    opacity: 0.3;
    transition: transform 400ms ease-out, filter 400ms ease-out, opacity 400ms ease-out;
}

.game-selector {
    background: var(--paper-color);
    border: 1px solid rgba(var(--text-secondary-rgb), 0.2);
    border-radius: 12px;
    padding: 32px 24px 24px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 20px;
    position: relative;
}

@media (max-width: 400px) {
    .game-selector {
        flex-direction: column;
        gap: 16px;
        padding: 32px 20px 20px;
    }
}

.game-card {
    width: 120px;
    height: 150px;
    background: transparent;
    border: 1px solid rgba(var(--text-secondary-rgb), 0.15);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: transform 100ms ease-out, opacity 400ms ease-out, border-color 200ms;
}

.game-card:hover {
    border-color: rgba(var(--text-secondary-rgb), 0.3);
}

.game-card:active {
    transform: scale(0.97);
}

.game-card.selected {
    transform: scale(1.1);
    opacity: 0;
}

.game-card.unselected {
    opacity: 0;
    transition: opacity 200ms ease-out;
}

.game-card-icon {
    width: 48px;
    height: 48px;
    color: var(--text-primary);
}

.game-card-title {
    font-size: 1rem; /* 16px */
    font-weight: 500;
    color: var(--text-primary);
}

.game-card-subtitle {
    font-size: 0.6875rem; /* 11px */
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.close-selector {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 200ms;
    line-height: 1;
    z-index: 1;
}

.close-selector:hover {
    opacity: 1;
}

/* === 蜡烛游戏 === */
.candle-game {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--bg-color);
    display: none;
    flex-direction: column;
    align-items: center;
    z-index: 1500;
}

.candle-game.active {
    display: flex;
}

.candle-prompt {
    position: absolute;
    top: 25%;
    font-size: 0.875rem; /* 14px */
    color: var(--text-secondary);
    opacity: 0.7;
    transition: opacity 300ms ease-out;
}

.candle-scene {
    position: absolute;
    bottom: 33.33%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.cake {
    width: 280px;
    height: 140px;
    position: relative;
}

.candles-container {
    display: flex;
    gap: 10px;
    margin-top: -160px;
    position: relative;
    z-index: 10;
}

.candle {
    position: relative;
    cursor: pointer;
    width: 40px;
    height: 60px;
    display: flex;
    justify-content: center;
}

.candle-body {
    width: 8px;
    height: 40px;
    fill: #F0E6D2;
}

.candle-wick {
    width: 2px;
    height: 6px;
    fill: #3D3D3D;
}

.candle-flame {
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%) scale(0) !important;
    opacity: 0 !important;
    transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1), opacity 200ms;
}

.candle.lit .candle-flame {
    transform: translateX(-50%) scale(1) !important;
    opacity: 1 !important;
    animation: flicker 1.2s ease-in-out infinite;
}

.candle.lit .candle-flame.intense {
    animation: flicker-intense 1.2s ease-in-out infinite;
}

@keyframes flicker {
    0%, 100% { transform: translateX(-50%) scale(1, 1) rotate(-3deg); }
    50% { transform: translateX(-50%) scale(1, 1.05) rotate(3deg); }
}

@keyframes flicker-intense {
    0%, 100% { transform: translateX(-50%) scale(1, 0.92) rotate(-5deg); }
    50% { transform: translateX(-50%) scale(1, 1.08) rotate(5deg); }
}

.flame-glow {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 200, 100, 0.4) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 300ms;
}

.candle.lit .flame-glow {
    opacity: 1;
}

.wish-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    transition: background 500ms ease-out;
    pointer-events: none;
}

.wish-overlay.active {
    background: rgba(0, 0, 0, 0.15);
}

.blow-hint {
    position: absolute;
    bottom: 20%;
    font-size: 0.75rem; /* 12px */
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity 300ms;
}

.blow-hint.show {
    opacity: 0.5;
}

.blow-progress {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    opacity: 0;
    transition: opacity 200ms;
}

.blow-progress.active {
    opacity: 1;
}

.smoke {
    position: absolute;
    width: 8px;
    height: 12px;
    border-radius: 50%;
    background: rgba(200, 200, 200, 0.5);
    opacity: 0;
    animation: smoke-rise 1200ms ease-out forwards;
}

@keyframes smoke-rise {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.5;
    }
    100% {
        transform: translateY(-60px) scale(1.5);
        opacity: 0;
    }
}

.wish-complete {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    opacity: 0;
    transition: opacity 800ms, transform 800ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wish-complete.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.wish-complete.show.preparing {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
}

.wish-text {
    font-size: 1.75rem; /* 28px */
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(201, 169, 97, 0.6);
    letter-spacing: 0.1em;
}

body[data-mood="4"] .wish-text {
    color: #FFE5B4;
    text-shadow: 0 0 20px rgba(201, 169, 97, 0.8);
}

.wish-actions {
    margin-top: 60px;
    display: flex;
    justify-content: center;
    gap: 40px;
    opacity: 0;
    transition: opacity 400ms;
}

.wish-actions.show {
    opacity: 1;
}

.wish-btn {
    background: transparent;
    border: 1px solid var(--text-primary);
    border-radius: 4px;
    font-size: 0.875rem; /* 14px */
    color: var(--text-primary);
    cursor: pointer;
    padding: 10px 20px;
    transition: all 200ms;
}

.wish-btn:hover {
    background: var(--text-primary);
    color: var(--paper-color);
}

/* === 烟花游戏 === */
.fireworks-game {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #1A2238;
    display: none;
    transition: background 600ms ease-out;
    z-index: 1500;
}

.fireworks-game.active {
    display: block;
}

#fireworks-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* === 烟花游戏 === */
.fireworks-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(10, 10, 30, 1);
    opacity: 0;
    pointer-events: none;
    transition: opacity 400ms ease-out;
    z-index: 3000;
}

.fireworks-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.fireworks-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.fireworks-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.8);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 200ms;
    z-index: 10;
}

.fireworks-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 1);
}

.fireworks-prompt {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.875rem; /* 14px */
    color: rgba(255, 255, 255, 0.5);
    opacity: 1;
    transition: opacity 300ms;
}

.fireworks-prompt.hidden {
    opacity: 0;
}

.fireworks-return {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    font-size: 0.875rem; /* 14px */
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 8px 16px;
    transition: opacity 200ms;
}

.fireworks-return:hover {
    opacity: 1;
}

/* === 减少动态效果适配 === */
@media (prefers-reduced-motion: reduce) {
    @keyframes flicker {
        0%, 100% { transform: translateX(-50%) scale(1, 1) rotate(-1.5deg); }
        50% { transform: translateX(-50%) scale(1, 1.025) rotate(1.5deg); }
    }

    @keyframes flicker-intense {
        0%, 100% { transform: translateX(-50%) scale(1, 0.96) rotate(-2.5deg); }
        50% { transform: translateX(-50%) scale(1, 1.04) rotate(2.5deg); }
    }

    .wish-complete {
        transition: opacity 400ms, transform 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
    }
}

/* === 烟花彩蛋弹窗 === */
.easter-egg-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 400ms ease-out;
}

.easter-egg-modal.show {
    opacity: 1;
}

.easter-egg-image {
    max-width: 80%;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: easterEggAppear 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.easter-egg-close {
    position: absolute;
    top: 40px;
    right: 40px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    transition: all 300ms;
    z-index: 10000;
}

.easter-egg-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

@keyframes easterEggAppear {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}
