/**
 * 寒江孤影 - 沉浸式剧情样式
 * 包含：天气效果、情感冲击、记忆碎片、隐藏事件
 */

/* ==================== 天气效果 ==================== */
.weather-rain::before,
.weather-heavy-rain::before,
.weather-thunder::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1000;
}

.weather-rain::before {
    background: linear-gradient(transparent 0%, rgba(100, 149, 237, 0.1) 100%);
}

.weather-heavy-rain::before {
    background: linear-gradient(transparent 0%, rgba(70, 130, 180, 0.2) 50%, rgba(100, 149, 237, 0.3) 100%);
    animation: heavyRain 0.5s infinite;
}

.weather-thunder::before {
    background: linear-gradient(transparent 0%, rgba(70, 130, 180, 0.2) 50%, rgba(100, 149, 237, 0.3) 100%);
    animation: thunderFlash 3s infinite;
}

.weather-snow::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1000;
    background-image:
        radial-gradient(3px 3px at 20% 30%, white, transparent),
        radial-gradient(3px 3px at 60% 70%, white, transparent),
        radial-gradient(2px 2px at 50% 50%, white, transparent),
        radial-gradient(3px 3px at 80% 10%, white, transparent);
    background-size: 200% 200%;
    animation: snowfall 10s linear infinite;
    opacity: 0.6;
}

.weather-fog::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1000;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(200, 200, 200, 0.3) 20%,
        rgba(200, 200, 200, 0.4) 50%,
        rgba(200, 200, 200, 0.3) 80%,
        transparent 100%);
    animation: fogMove 8s ease-in-out infinite;
}

@keyframes heavyRain {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.5; }
}

@keyframes thunderFlash {
    0%, 90%, 100% { opacity: 0.3; }
    92% { opacity: 0.8; }
    94% { opacity: 0.2; }
    96% { opacity: 0.9; }
}

@keyframes snowfall {
    0% { background-position: 0% 0%, 20% 20%, 40% 40%, 60% 60%, 80% 80%, 100% 100%; }
    100% { background-position: 100% 100%, 80% 80%, 60% 60%, 40% 40%, 20% 20%, 0% 0%; }
}

@keyframes fogMove {
    0%, 100% { transform: translateX(-20%); }
    50% { transform: translateX(20%); }
}

/* ==================== 情感冲击场景 ==================== */
.emotional-beat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2500;
    animation: fadeIn 0.5s;
}

.emotional-beat-overlay.fade-out {
    animation: fadeOut 1s forwards;
}

.emotional-beat-container {
    max-width: 600px;
    padding: 40px;
    text-align: center;
}

.emotional-content {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    transition: opacity 0.3s;
}

.emotional-text {
    font-size: 20px;
    line-height: 2;
    color: #ecf0f1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    animation: textGlow 2s ease-in-out infinite;
}

/* 根据情感类型调整样式 */
.emotional-beat-overlay[data-impact="betrayal"] .emotional-text {
    color: #e74c3c;
}

.emotional-beat-overlay[data-impact="sacrifice"] .emotional-text {
    color: #3498db;
}

.emotional-beat-overlay[data-impact="identity"] .emotional-text {
    color: #9b59b6;
}

.emotional-beat-overlay[data-impact="climax"] .emotional-text {
    color: #f1c40f;
    font-size: 24px;
}

.emotional-progress {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px;
}

.progress-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s;
}

.progress-dot.active {
    background: #e94560;
    border-color: #e94560;
    box-shadow: 0 0 10px #e94560;
}

.emotional-continue-btn {
    padding: 12px 40px;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.emotional-continue-btn:hover {
    border-color: #e94560;
    color: #e94560;
}

/* ==================== 记忆碎片 ==================== */
.memory-fragment-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2400;
    animation: fadeIn 0.5s;
}

.memory-fragment-container {
    text-align: center;
    padding: 40px;
    max-width: 500px;
}

.memory-fragment-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: memoryPulse 2s ease-in-out infinite;
}

.memory-fragment-text {
    font-size: 18px;
    line-height: 2;
    color: #ecf0f1;
    font-style: italic;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    animation: textFadeIn 1s;
}

.memory-fragment-hint {
    margin-top: 20px;
    font-size: 14px;
    color: #95a5a6;
}

@keyframes memoryPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

@keyframes textFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes textGlow {
    0%, 100% { text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); }
    50% { text-shadow: 0 2px 20px rgba(233, 69, 96, 0.5), 0 0 30px rgba(233, 69, 96, 0.3); }
}

/* ==================== 隐藏事件 ==================== */
.hidden-event-overlay,
.easter-egg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2300;
    animation: fadeIn 0.3s;
}

.hidden-event-container,
.easter-egg-container {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid #e94560;
    border-radius: 16px;
    padding: 30px;
    max-width: 500px;
    text-align: center;
}

.hidden-event-header {
    color: #e94560;
    font-size: 18px;
    margin-bottom: 20px;
}

.hidden-dialogues p {
    color: #ecf0f1;
    font-size: 16px;
    line-height: 2;
    margin-bottom: 15px;
}

.easter-egg-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.easter-egg-content {
    color: #ecf0f1;
    font-size: 15px;
    line-height: 1.8;
    margin-bottom: 20px;
}

/* ==================== 章节过渡 ==================== */
.chapter-transition {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 3000;
    pointer-events: none;
}

.chapter-transition.transition-fade {
    opacity: 0;
    transition: opacity 0.8s;
}

.chapter-transition.transition-fade.active {
    opacity: 1;
}

.chapter-transition.transition-slide {
    transform: translateX(100%);
    transition: transform 0.6s;
}

.chapter-transition.transition-slide.active {
    transform: translateX(0);
}

.chapter-transition.transition-dramatic {
    transform: scale(0.8);
    opacity: 0;
    transition: all 0.5s;
}

.chapter-transition.transition-dramatic.active {
    transform: scale(1);
    opacity: 1;
}

/* ==================== 章节开始 ==================== */
.chapter-start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2900;
    opacity: 0;
    transition: opacity 0.5s;
}

.chapter-start-overlay.show {
    opacity: 1;
}

.chapter-start-overlay.hide {
    opacity: 0;
    transition: opacity 1s;
}

.chapter-start-content {
    text-align: center;
}

.chapter-start-content .chapter-icon {
    font-size: 72px;
    margin-bottom: 20px;
    animation: iconFloat 3s ease-in-out infinite;
}

.chapter-start-content .chapter-title {
    font-size: 32px;
    color: #e94560;
    margin-bottom: 20px;
}

/* 任务列表中的章节标题保持合理大小 */
.volume-section .chapter-title,
.chapter-card .chapter-title {
    font-size: 15px;
    color: #fff;
    font-weight: 500;
}

.chapter-divider {
    width: 200px;
    height: 2px;
    background: linear-gradient(to right, transparent, #e94560, transparent);
    margin: 0 auto;
}

@keyframes iconFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

/* ==================== 氛围效果 ==================== */
#game-container {
    transition: filter 1s ease;
}

/* 夜晚效果 */
#game-container.time-night {
    filter: brightness(0.7) saturate(0.8);
}

/* 深夜效果 */
#game-container.time-midnight {
    filter: brightness(0.5) saturate(0.6);
}

/* 黄昏效果 */
#game-container.time-afternoon {
    filter: sepia(0.2) saturate(1.2);
}

/* ==================== 伏笔提示 ==================== */
.foreshadow-hint {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(142, 68, 173, 0.2);
    border: 1px solid #9b59b6;
    border-radius: 8px;
    padding: 12px 16px;
    color: #d4b3e0;
    font-size: 13px;
    z-index: 1000;
    animation: slideInRight 0.5s, fadeOut 0.5s 4.5s forwards;
    cursor: pointer;
}

.foreshadow-hint:hover {
    background: rgba(142, 68, 173, 0.4);
}

.foreshadow-hint::before {
    content: '🔮 ';
}

/* ==================== 情绪指示器 ==================== */
.mood-indicator {
    position: fixed;
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    padding: 8px 16px;
    z-index: 900;
    transition: all 0.3s;
}

.mood-icon {
    font-size: 20px;
}

.mood-text {
    font-size: 13px;
    color: #ecf0f1;
}

/* ==================== 响应式 ==================== */
@media (max-width: 600px) {
    .emotional-text {
        font-size: 16px;
    }

    .chapter-start-content .chapter-icon {
        font-size: 48px;
    }

    .chapter-title {
        font-size: 24px;
    }
}

/* ==================== 粒子效果 ==================== */
.particle-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

.particle {
    position: absolute;
    background: white;
    border-radius: 50%;
    opacity: 0.6;
    animation: particleFloat linear infinite;
}

@keyframes particleFloat {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 0.6; }
    90% { opacity: 0.6; }
    100% { transform: translateY(-10vh) rotate(360deg); opacity: 0; }
}

/* ==================== 闪回效果 ==================== */
.flashback-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 2800;
    animation: flashbackFlash 0.3s ease-out;
}

@keyframes flashbackFlash {
    0% { opacity: 0; }
    20% { opacity: 0.8; }
    100% { opacity: 0; }
}

/* ==================== 屏幕震动 ==================== */
.screen-shake {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}
