/* =========================================
   1. 重置与基础设置
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* 移动端防误触 - 禁用长按选中和高亮 */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

body {
    /* 核心要求：舞台聚光灯背景 */
    background: radial-gradient(circle at center, #4a0e0e 0%, #000000 80%);
    color: #ffffff;
    font-family: 'Noto Serif SC', serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    /* 移动端防误触 - 禁用双击缩放 */
    touch-action: manipulation;
}

/* =========================================
   2. 氛围与纹理
   ========================================= */

/* 噪点纹理叠加 - 增加胶片质感 */
.noise-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    opacity: 0.03;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Canvas 图层 */
#bg-canvas, #fireworks-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transition: transform 0.1s ease-out; /* 用于视差平滑度 */
}
#bg-canvas { z-index: 1; opacity: 0.6; } /* 星空背景调暗 */
#fireworks-canvas { z-index: 2; }

/* UI 图层 */
#ui-layer {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* 预加载器 */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    transition: opacity 0.8s ease-out;
}

.loader-text {
    font-family: 'LXGW WenKai Lite', 'KaiTi', 'STKaiti', 'Ma Shan Zheng', cursive;
    font-size: 2rem;
    color: #ffecb3;
    margin-bottom: 20px;
    letter-spacing: 5px;
    animation: pulseText 2s infinite;
}

.progress-bar {
    width: 200px;
    height: 2px;
    background: rgba(255, 236, 179, 0.2);
    position: relative;
    overflow: hidden;
}

.progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    background: #ffecb3;
    box-shadow: 0 0 10px #ffecb3;
    transition: width 0.2s ease-out;
}

@keyframes pulseText {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* 音频控制 */
.audio-ctrl {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255, 236, 179, 0.8);
    transition: all 0.3s ease;
    z-index: 100;
}

.audio-ctrl:hover {
    background: rgba(255, 236, 179, 0.1);
    border-color: rgba(255, 236, 179, 0.5);
    transform: scale(1.1);
}

/* =========================================
   3. 排版与主要布局
   ========================================= */

#countdown-phase {
    display: flex; /* 由 JS 状态控制 */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    height: 100%;
    width: 100%;
    max-width: 1200px;
    animation: fadeIn 1.5s ease-out;
}

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

/* 顶部小文字 */
.top-greeting {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    letter-spacing: 0.3rem;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 3rem;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

/* 主标题 - 金箔书法效果 */
.main-title {
    font-family: 'LXGW WenKai Lite', 'Ma Shan Zheng', 'KaiTi', 'STKaiti', cursive;
    font-size: clamp(2.5rem, 8vw, 6rem); /* 调整最小字体大小以适配小屏 */
    margin: 0 0 1.5rem 0;
    line-height: 1.2;
    font-weight: 400;
    padding: 0 10px; /* 防止贴边 */
    word-break: keep-all; /* 中文尽量不截断词组 */
    white-space: normal; /* 允许换行 */
    
    /* 真金箔质感渐变 */
    background: linear-gradient(to bottom, #cfc09f 10%, #ffecb3 40%, #b3a17b 70%, #8c7648 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    
    /* 微弱的光晕，模拟反光 */
    filter: drop-shadow(0 0 20px rgba(179, 161, 123, 0.2));
}

/* 副标题 - 优雅宋体 */
.poem-subtitle {
    font-family: 'Noto Serif SC', serif;
    font-size: clamp(1rem, 2vw, 1.5rem);
    font-weight: 200; /* 细字体 */
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.5rem; /* 宽间距 */
    margin-bottom: 4rem;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
}

/* =========================================
   4. 极简倒计时
   ========================================= */

.countdown-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.countdown-label {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.9rem;
    letter-spacing: 0.2rem;
    color: rgba(255, 255, 255, 0.5);
    position: relative;
    display: inline-block;
}

.countdown-label::before, .countdown-label::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 30px;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}
.countdown-label::before { left: -40px; }
.countdown-label::after { right: -40px; }

.countdown-box {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 1.5rem; /* 数字之间的间距 */
}

.time-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 巨大的细体数字 */
.time-val {
    font-family: 'Cinzel', serif; /* 优雅的衬线数字 */
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 100; /* 超细 */
    line-height: 1;
    color: #fff;
    
    /* 数字也有微妙的金色渐变 */
    background: linear-gradient(180deg, #fff 0%, #ffecb3 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.time-label {
    font-family: 'Cinzel', serif;
    font-size: 0.6rem;
    letter-spacing: 0.1rem;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 10px;
}

.separator {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    font-weight: 100;
    color: rgba(255, 255, 255, 0.2);
    transform: translateY(-20px); /* 与数字对齐 */
}

/* =========================================
   5. 交互元素
   ========================================= */

.enter-btn {
    margin-top: 4rem;
    background: transparent;
    border: 1px solid rgba(255, 236, 179, 0.3);
    color: #ffecb3;
    padding: 12px 30px;
    font-family: 'Noto Serif SC', serif;
    font-size: 1rem;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all 0.4s ease;
    border-radius: 2px;
    opacity: 0.8;
}

.enter-btn:hover {
    border-color: #ffecb3;
    background: rgba(255, 236, 179, 0.05);
    opacity: 1;
    box-shadow: 0 0 20px rgba(255, 236, 179, 0.1);
}

.small-btn {
    padding: 8px 20px;
    margin-top: 20px;
    font-size: 0.9rem;
}

/* =========================================
   6. 庆祝阶段
   ========================================= */

#message-container {
    display: none;
    text-align: center;
    animation: zoomIn 1s ease-out;
    padding: 0 20px;
}

.celebration-title {
    font-family: 'LXGW WenKai Lite', 'KaiTi', 'STKaiti', 'Ma Shan Zheng', cursive;
    font-size: 6rem;
    color: #ffecb3;
    text-shadow: 0 0 30px rgba(255, 69, 0, 0.5);
    margin-bottom: 20px;
}

.celebration-sub {
    font-family: 'Noto Serif SC', serif;
    font-size: 2rem;
    letter-spacing: 10px;
    color: rgba(255, 255, 255, 0.8);
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* 按钮组 */
.celebration-actions {
    margin-top: 3rem;
    opacity: 0;
    animation: fadeIn 1s ease-out 1s forwards; /* 延迟淡入 */
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    margin-top: 0;
    background: rgba(255, 236, 179, 0.05);
}

/* 海报模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

.modal-content {
    background: transparent;
    padding: 20px;
    text-align: center;
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.modal-title {
    color: #ffecb3;
    font-family: 'Noto Serif SC', serif;
    margin-bottom: 15px;
    font-weight: 200;
    letter-spacing: 2px;
}

#poster-result img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain; /* 确保图片完整显示 */
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 236, 179, 0.2);
    border-radius: 4px;
}

.close-btn {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.7;
}

/* 运势卡片样式 */
.fortune-card {
    background: #fff;
    width: 300px;
    max-width: 90vw; /* 移动端适配 */
    padding: 40px 20px;
    text-align: center;
    border-radius: 4px;
    position: relative;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.3);
    animation: flipIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23f0f0f0' fill-opacity='0.4' fill-rule='evenodd'%3E%3Ccircle cx='3' cy='3' r='3'/%3E%3Ccircle cx='13' cy='13' r='3'/%3E%3C/g%3E%3C/svg%3E");
}

@keyframes flipIn {
    from { transform: perspective(1000px) rotateY(90deg); opacity: 0; }
    to { transform: perspective(1000px) rotateY(0deg); opacity: 1; }
}

.fortune-header {
    border-bottom: 2px solid #8B0000;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.fortune-label {
    writing-mode: vertical-rl;
    font-family: 'LXGW WenKai Lite', 'KaiTi', 'STKaiti', 'Ma Shan Zheng', cursive;
    font-size: 1.5rem;
    color: #8B0000;
    border: 1px solid #8B0000;
    padding: 10px 5px;
    border-radius: 4px;
}

.fortune-body h2 {
    font-family: 'LXGW WenKai Lite', 'KaiTi', 'STKaiti', 'Ma Shan Zheng', cursive;
    font-size: 2rem;
    color: #333;
    margin-bottom: 15px;
}

.fortune-body p {
    font-family: 'Noto Serif SC', serif;
    font-size: 1rem;
    color: #666;
    line-height: 1.6;
}

.fortune-footer {
    margin-top: 30px;
}

.fortune-footer .small-btn {
    border-color: #8B0000;
    color: #8B0000;
}

.fortune-footer .small-btn:hover {
    background: rgba(139, 0, 0, 0.05);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .audio-ctrl { top: 1rem; right: 1rem; }
    .countdown-box { gap: 0.5rem; }
    .separator { display: none; } /* 小屏幕隐藏分隔符以节省空间 */
    .time-val { font-size: 3.5rem; } /* 使用固定大小而非 vw，避免过大 */
    
    .main-title { 
        font-size: 2.8rem; /* 强制较小字号 */
        margin-bottom: 1rem; 
        white-space: normal; /* 允许换行 */
        line-height: 1.4;
        width: 100%;
        padding: 0 15px;
        word-wrap: break-word;
    }
    
    .poem-subtitle { 
        font-size: 1.2rem; 
        letter-spacing: 2px; 
        width: 90%;
        margin: 0 auto 3rem auto;
        line-height: 1.6;
    }
    
    .enter-btn { margin-top: 1.5rem; width: 80%; }
    
    .celebration-title { 
        font-size: 3rem; /* 修复庆祝标题过大 */
        line-height: 1.3; 
        white-space: normal;
        padding: 0 10px;
    } 
    .celebration-sub { 
        font-size: 1.2rem; 
        letter-spacing: 3px; 
        margin-top: 10px;
    }
    
    .site-footer {
        padding: 10px;
        font-size: 0.6rem;
    }
}

/* 页脚备案信息 */
.site-footer {
    position: absolute;
    bottom: 10px;
    width: 100%;
    text-align: center;
    z-index: 100;
    pointer-events: auto; /* 允许点击 */
}

.footer-content p {
    margin: 5px 0;
    font-family: 'Noto Serif SC', serif;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
}

.site-footer a {
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    transition: color 0.3s ease;
}

.site-footer a:hover {
    color: #ffecb3;
}

.gongan-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.gongan-icon {
    width: 20px;
    height: 20px;
}

@media (max-width: 480px) {
    /* 更小屏幕的适配 */
    .celebration-actions {
        flex-direction: column;
        width: 100%;
        padding: 0 20px;
    }
    
    .action-btn {
        width: 100%;
        margin-left: 0 !important; /* 覆盖内联样式 */
        margin-bottom: 10px;
    }

    .fortune-card {
        padding: 30px 15px;
    }
}
