/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --gold: #f0d5a0;
    --gold-bright: #ffe4a0;
    --gold-shadow: #c9973b;
    --accent: #e8c170;
    --dark-bg: #0a0a0f;
    --text-color: #f5f5f5;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'STKaiti', serif;
    background: var(--dark-bg);
    color: var(--text-color);
    overflow: hidden;
    min-height: 100vh;
}

/* ==================== 开屏容器 ==================== */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    background: #000;
    will-change: opacity;
}

.splash-screen.fade-out {
    animation: splashFadeOut 1.5s ease-in-out forwards;
}

@keyframes splashFadeOut {
    0%   { opacity: 1; }
    100% { opacity: 0; pointer-events: none; }
}

/* ==================== 视频 ==================== */
#cg-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

/* ==================== 视频加载指示器 ==================== */
.video-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 8;
    transition: opacity 0.5s ease;
}

.video-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(240, 213, 160, 0.2);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spinnerRotate 0.8s linear infinite;
}

.loading-text {
    margin-top: 14px;
    font-size: 14px;
    color: var(--gold);
    letter-spacing: 4px;
    opacity: 0.7;
}

@keyframes spinnerRotate {
    to { transform: rotate(360deg); }
}

/* ==================== 播放引导 ==================== */
.play-guide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    cursor: pointer;
}

.play-guide.hidden {
    display: none;
}

.guide-content {
    text-align: center;
    animation: guidePulse 2.5s ease-in-out infinite;
}

.guide-icon {
    font-size: 72px;
    margin-bottom: 16px;
    filter: drop-shadow(0 0 25px rgba(240, 213, 160, 0.6));
}

.guide-content p {
    font-size: 18px;
    color: var(--gold);
    letter-spacing: 6px;
    text-shadow: 0 0 12px rgba(240, 213, 160, 0.4);
}

@keyframes guidePulse {
    0%, 100% { transform: scale(1);   opacity: 0.7; }
    50%       { transform: scale(1.08); opacity: 1;   }
}

/* ==================== 视频字幕 ==================== */
.video-subtitle {
    position: absolute;
    bottom: 18%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
}

/* 每个字幕字符 */
.subtitle-char {
    display: inline-block;
    font-size: clamp(24px, 4vw, 42px);
    color: transparent;
    background: linear-gradient(180deg, #fff6e0 0%, var(--gold) 40%, var(--gold-shadow) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    letter-spacing: 0.15em;
    text-shadow: none;
    filter: drop-shadow(0 0 8px rgba(240, 213, 160, 0.5))
            drop-shadow(0 2px 15px rgba(201, 151, 59, 0.3));
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    transition: none;
    will-change: transform, opacity;
}

/* 字符出现动画 */
.subtitle-char.visible {
    animation: charReveal 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes charReveal {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8) rotate(-5deg);
    }
    60% {
        opacity: 1;
        transform: translateY(-4px) scale(1.05) rotate(1deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }
}

/* 字符出现后的呼吸/浮动 */
.subtitle-char.float {
    animation: charFloat 3s ease-in-out infinite;
}

@keyframes charFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
}

/* 字幕整体淡出 */
.video-subtitle.fade-out .subtitle-char {
    animation: charFadeOut 1s ease forwards;
}

@keyframes charFadeOut {
    to {
        opacity: 0;
        transform: translateY(-15px) scale(0.9);
        filter: drop-shadow(0 0 20px rgba(240, 213, 160, 0.8))
                drop-shadow(0 0 40px rgba(240, 213, 160, 0.4));
    }
}

/* ==================== 底部信息区 ==================== */
.splash-info {
    position: absolute;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    pointer-events: none;
}

/* 检测状态行 */
.detect-line {
    font-size: clamp(13px, 1.8vw, 15px);
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 3px;
    min-height: 20px;
    white-space: nowrap;
}

.detect-line.hidden {
    display: none;
}

/* 检测文字逐字打出 */
.detect-char {
    display: inline;
    opacity: 0;
    animation: detectType 0.1s ease forwards;
}

@keyframes detectType {
    to { opacity: 1; }
}

/* 光标闪烁 */
.detect-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: rgba(255, 255, 255, 0.5);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: cursorBlink 0.8s step-end infinite;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0; }
}

/* "按任意键继续" — 游龙飘动效果 */
.continue-line {
    font-size: clamp(15px, 2.2vw, 20px);
    white-space: nowrap;
    min-height: 28px;
}

.continue-line.hidden {
    display: none;
}

.continue-char {
    display: inline-block;
    color: var(--gold);
    letter-spacing: 0.2em;
    text-shadow: 0 0 10px rgba(240, 213, 160, 0.4);
    opacity: 0;
    will-change: transform;
}

/* 入场：从下方飘入 */
.continue-char.enter {
    animation: dragonEnter 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes dragonEnter {
    0% {
        opacity: 0;
        transform: translateY(15px) translateX(-5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) translateX(0);
    }
}

/* 入场完成后切换为持续飘动 */
.continue-char.dragon {
    opacity: 1;
    animation: dragonFloat 3.5s ease-in-out infinite;
    animation-delay: var(--d);
}

@keyframes dragonFloat {
    0%   { transform: translateY(0) rotate(0deg); }
    20%  { transform: translateY(-6px) rotate(0.8deg); }
    40%  { transform: translateY(-2px) rotate(-0.3deg); }
    60%  { transform: translateY(-7px) rotate(0.5deg); }
    80%  { transform: translateY(-1px) rotate(-0.6deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

/* 整体呼吸光晕 */
.continue-line.active {
    animation: lineGlow 3s ease-in-out infinite;
}

@keyframes lineGlow {
    0%, 100% { filter: brightness(1); }
    50%      { filter: brightness(1.2) drop-shadow(0 0 8px rgba(240, 213, 160, 0.3)); }
}


/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .video-subtitle {
        bottom: 22%;
    }

    .splash-info {
        bottom: 8%;
    }
}
