/**
 * 赛博寺庙 - 掷筊页面样式
 */

/* ========================================
   页面基础
   ======================================== */
body {
    overflow: hidden;
    position: relative;
}


/* ========================================
   CRT 扫描线效果
   ======================================== */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15) 0px,
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
}

.crt-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        rgba(0, 0, 0, 0.3) 100%
    );
}

/* ========================================
   噪点纹理
   ======================================== */
.noise {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ========================================
   背景层
   ======================================== */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        180deg,
        #08040c 0%,
        #120810 30%,
        #1a0c08 50%,
        #0a0608 80%,
        #050304 100%
    );
    z-index: -3;
}

/* ========================================
   氛围光效
   ======================================== */
.ambient-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
}

.ambient-glow::before {
    content: '';
    position: absolute;
    top: 0%;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 60%;
    background: radial-gradient(
        ellipse at center top,
        rgba(255, 200, 80, 0.12) 0%,
        rgba(255, 150, 50, 0.06) 30%,
        rgba(180, 100, 30, 0.03) 50%,
        transparent 70%
    );
    animation: glowPulse 8s infinite ease-in-out;
}

.ambient-glow::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 60%;
    background: radial-gradient(
        ellipse at center bottom,
        rgba(255, 180, 60, 0.08) 0%,
        rgba(200, 120, 40, 0.04) 40%,
        transparent 70%
    );
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.05); }
}

/* ========================================
   粒子效果
   ======================================== */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--gold);
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat 20s infinite ease-in-out;
}

.particle::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: inherit;
    border-radius: inherit;
    filter: blur(2px);
    transform: scale(2);
}

@keyframes particleFloat {
    0% { 
        transform: translateY(100vh) translateX(0); 
        opacity: 0; 
    }
    5% { opacity: 0.6; }
    95% { opacity: 0.3; }
    100% { 
        transform: translateY(-20vh) translateX(50px); 
        opacity: 0; 
    }
}

/* ========================================
   3D Canvas 容器
   ======================================== */
#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

/* ========================================
   烟雾动画
   ======================================== */
.smoke-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    overflow: hidden;
    pointer-events: none;
}

.smoke {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 200, 120, 0.05) 0%, rgba(200, 150, 80, 0.02) 40%, transparent 70%);
    animation: float 20s infinite ease-in-out;
    filter: blur(25px);
}

@keyframes float {
    0%, 100% { transform: translateY(100vh) scale(1) rotate(0deg); opacity: 0; }
    10% { opacity: 0.5; }
    90% { opacity: 0.15; }
    100% { transform: translateY(-100vh) scale(2.5) rotate(180deg); opacity: 0; }
}

/* ========================================
   香烟效果
   ======================================== */
.incense-smoke {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    height: 70%;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(
        to top,
        rgba(255, 200, 100, 0.12) 0%,
        rgba(255, 180, 80, 0.06) 20%,
        rgba(200, 150, 80, 0.03) 40%,
        transparent 100%
    );
    filter: blur(35px);
    animation: incenseWaver 10s infinite ease-in-out;
}

@keyframes incenseWaver {
    0%, 100% { transform: translateX(-50%) skewX(0deg); }
    25% { transform: translateX(-50%) skewX(3deg); }
    75% { transform: translateX(-50%) skewX(-3deg); }
}

/* ========================================
   寺庙装饰
   ======================================== */
.temple-decor {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30%;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(
        to top,
        rgba(10, 8, 18, 0.9) 0%,
        transparent 100%
    );
}

.temple-decor::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    width: 15%;
    height: 80%;
    background: linear-gradient(
        to top,
        rgba(20, 10, 30, 0.8) 0%,
        transparent 100%
    );
    clip-path: polygon(20% 100%, 80% 100%, 60% 0%, 40% 0%);
}

.temple-decor::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 10%;
    width: 15%;
    height: 80%;
    background: linear-gradient(
        to top,
        rgba(20, 10, 30, 0.8) 0%,
        transparent 100%
    );
    clip-path: polygon(20% 100%, 80% 100%, 60% 0%, 40% 0%);
}

/* ========================================
   灯笼光效
   ======================================== */
.lantern-glow {
    position: fixed;
    z-index: 0;
    pointer-events: none;
}

.lantern-glow.left {
    top: 15%;
    left: 5%;
    width: 100px;
    height: 150px;
    background: radial-gradient(
        ellipse at center,
        rgba(255, 100, 50, 0.15) 0%,
        rgba(255, 50, 30, 0.05) 40%,
        transparent 70%
    );
    animation: lanternFlicker 3s infinite ease-in-out;
}

.lantern-glow.right {
    top: 15%;
    right: 5%;
    width: 100px;
    height: 150px;
    background: radial-gradient(
        ellipse at center,
        rgba(255, 100, 50, 0.15) 0%,
        rgba(255, 50, 30, 0.05) 40%,
        transparent 70%
    );
    animation: lanternFlicker 3.5s infinite ease-in-out 0.5s;
}

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

/* ========================================
   UI 层
   ======================================== */
#ui-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

/* ========================================
   寺庙边框
   ======================================== */
.temple-frame {
    position: relative;
    width: 90%;
    max-width: 600px;
    padding: 40px;
    background: #0a0812;
    border: 3px solid var(--gold);
    box-shadow: 
        0 0 30px rgba(212, 168, 75, 0.2),
        inset 0 0 60px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.temple-frame::before,
.temple-frame::after {
    content: '☯';
    position: absolute;
    font-size: 24px;
    color: var(--gold);
}

.temple-frame::before {
    top: 10px;
    left: 10px;
}

.temple-frame::after {
    bottom: 10px;
    right: 10px;
}

/* ========================================
   标题
   ======================================== */
.title {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: clamp(48px, 10vw, 72px);
    text-align: center;
    color: var(--gold);
    text-shadow: 
        0 0 20px var(--gold-glow),
        0 0 40px rgba(212, 168, 75, 0.5),
        3px 3px 0 var(--cinnabar-dark);
    margin-bottom: 10px;
    letter-spacing: 10px;
}

.subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--wood-light);
    opacity: 0.7;
    margin-bottom: 30px;
    letter-spacing: 3px;
}

/* ========================================
   阶段切换
   ======================================== */
.phase {
    display: none;
    animation: fadeIn 0.8s ease-out;
}

.phase.active {
    display: block;
}

/* ========================================
   问题输入阶段
   ======================================== */
.deity-silhouette {
    width: 120px;
    height: 160px;
    margin: 0 auto 20px;
    background: linear-gradient(
        180deg,
        rgba(212, 168, 75, 0.15) 0%,
        transparent 100%
    );
    clip-path: polygon(50% 0%, 80% 20%, 90% 60%, 70% 100%, 30% 100%, 10% 60%, 20% 20%);
    position: relative;
}

.deity-silhouette::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at 50% 30%,
        rgba(255, 215, 0, 0.2) 0%,
        transparent 50%
    );
    animation: pulse 3s infinite ease-in-out;
}

.dialog-box {
    background: #1a0a2e;
    border: 2px solid var(--gold);
    padding: 20px;
    margin-bottom: 25px;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

.dialog-box::before {
    content: '『';
    position: absolute;
    top: -12px;
    left: 10px;
    font-size: 24px;
    color: var(--gold);
}

.dialog-box::after {
    content: '』';
    position: absolute;
    bottom: -12px;
    right: 10px;
    font-size: 24px;
    color: var(--gold);
}

.dialog-text {
    font-size: 18px;
    text-align: center;
    color: var(--text-light);
    line-height: 1.6;
}

.question-input {
    width: 100%;
    padding: 15px;
    font-family: 'Noto Serif TC', serif;
    font-size: 16px;
    background: #0a0608;
    border: 1px solid var(--wood-dark);
    color: var(--text-light);
    margin-bottom: 20px;
    resize: none;
    min-height: 80px;
    transition: all 0.3s;
}

.question-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 20px rgba(212, 168, 75, 0.3);
}

.question-input::placeholder {
    color: rgba(240, 230, 211, 0.4);
}

/* ========================================
   按钮样式
   ======================================== */
.btn {
    display: block;
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
    padding: 15px 35px;
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 22px;
    background: linear-gradient(
        180deg,
        var(--cinnabar) 0%,
        var(--cinnabar-dark) 100%
    );
    color: var(--text-light);
    border: 2px solid var(--gold);
    cursor: pointer;
    transition: all 0.3s;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    box-shadow: 0 4px 15px rgba(194, 58, 43, 0.4);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(194, 58, 43, 0.6),
        0 0 30px rgba(212, 168, 75, 0.3);
}

.btn:active {
    transform: translateY(1px);
}

/* ========================================
   掷筊阶段
   ======================================== */
.toss-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    pointer-events: auto;
}

.toss-hint {
    text-align: center;
    margin-bottom: 15px;
    font-size: 16px;
    color: var(--wood-light);
    opacity: 0.8;
}

/* ========================================
   结果阶段
   ======================================== */
.result-container {
    text-align: center;
}

.result-title {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 64px;
    margin-bottom: 15px;
    animation: resultReveal 1s ease-out;
}

.result-title.sheng {
    color: var(--gold);
    text-shadow: 
        0 0 30px var(--gold-glow),
        0 0 60px rgba(255, 215, 0, 0.5);
}

.result-title.xiao {
    color: #66bb6a;
    text-shadow: 
        0 0 30px rgba(102, 187, 106, 0.8),
        0 0 60px rgba(102, 187, 106, 0.4);
}

.result-title.yin-jiao {
    color: #42a5f5;
    text-shadow: 
        0 0 30px rgba(66, 165, 245, 0.8),
        0 0 60px rgba(66, 165, 245, 0.5);
}

@keyframes resultReveal {
    0% { 
        opacity: 0; 
        transform: scale(0.5); 
        filter: blur(10px);
    }
    50% { 
        transform: scale(1.1); 
    }
    100% { 
        opacity: 1; 
        transform: scale(1); 
        filter: blur(0);
    }
}

.result-description {
    font-size: 20px;
    margin-bottom: 25px;
    color: var(--text-light);
}

.fortune-text {
    font-size: 18px;
    line-height: 2;
    padding: 25px;
    background: rgba(0, 0, 0, 0.4);
    border-left: 3px solid var(--gold);
    margin-bottom: 25px;
    text-align: left;
}

.fortune-text .question-recall {
    font-size: 14px;
    color: var(--wood-light);
    opacity: 0.7;
    margin-bottom: 12px;
    font-style: italic;
}

/* ========================================
   筊杯图标
   ======================================== */
.jiaobei-result {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 25px 0;
}

.jiaobei-icon {
    width: 60px;
    height: 90px;
    border-radius: 30px 30px 15px 15px;
    position: relative;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

.jiaobei-icon.yang {
    background: linear-gradient(
        180deg,
        var(--wood-light) 0%,
        var(--wood-dark) 100%
    );
    border: 2px solid var(--wood-dark);
}

.jiaobei-icon.yin {
    background: linear-gradient(
        180deg,
        var(--cinnabar) 0%,
        var(--cinnabar-dark) 100%
    );
    border: 2px solid var(--cinnabar-dark);
}

.jiaobei-icon.yang::after {
    content: '☯';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: var(--cinnabar-dark);
    opacity: 0.4;
}

.jiaobei-icon.glow {
    animation: jiaoGlow 1.5s infinite;
}

@keyframes jiaoGlow {
    0%, 100% { box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5); }
    50% { box-shadow: 0 8px 40px rgba(255, 215, 0, 0.5); }
}

/* ========================================
   分享按钮
   ======================================== */
.share-btn {
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 10px 25px;
    font-family: 'Noto Serif TC', serif;
    font-size: 14px;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s;
}

.share-btn:hover {
    background: rgba(212, 168, 75, 0.2);
}

/* ========================================
   加载动画
   ======================================== */
.loading {
    display: none;
    text-align: center;
    padding: 30px;
}

.loading.active {
    display: block;
}

.incense-animation {
    width: 4px;
    height: 80px;
    background: linear-gradient(
        180deg,
        transparent 0%,
        var(--cinnabar) 20%,
        var(--cinnabar) 100%
    );
    margin: 0 auto 15px;
    position: relative;
}

.incense-animation::before {
    content: '';
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: 25px;
    height: 50px;
    background: radial-gradient(
        ellipse at center bottom,
        rgba(200, 180, 160, 0.3) 0%,
        transparent 70%
    );
    animation: smokeRise 2s infinite ease-out;
}

@keyframes smokeRise {
    0% { 
        opacity: 0.8; 
        transform: translateX(-50%) translateY(0) scale(1); 
    }
    100% { 
        opacity: 0; 
        transform: translateX(-50%) translateY(-30px) scale(1.5); 
    }
}

.loading-text {
    font-size: 16px;
    color: var(--wood-light);
    animation: textFade 1.5s infinite;
}

@keyframes textFade {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ========================================
   闪光效果
   ======================================== */
.flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 998;
    opacity: 0;
}

.flash-overlay.gold {
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4) 0%, transparent 70%);
    animation: flash 0.5s ease-out;
}

.flash-overlay.green {
    background: radial-gradient(circle, rgba(102, 187, 106, 0.4) 0%, transparent 70%);
    animation: flash 0.5s ease-out;
}

.flash-overlay.blue {
    background: radial-gradient(circle, rgba(66, 165, 245, 0.4) 0%, transparent 70%);
    animation: flash 0.5s ease-out;
}

@keyframes flash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* ========================================
   音效开关
   ======================================== */
.audio-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(10, 8, 18, 0.8);
    border: 1px solid var(--gold);
    color: var(--gold);
    font-size: 18px;
    cursor: pointer;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    pointer-events: auto;
}

.audio-toggle:hover {
    background: rgba(212, 168, 75, 0.2);
}

.audio-toggle.muted {
    opacity: 0.5;
}

/* ========================================
   响应式
   ======================================== */
@media (max-width: 600px) {
    .temple-frame {
        padding: 25px;
        margin: 10px;
        width: calc(100% - 20px);
    }
    
    .title {
        letter-spacing: 5px;
    }
    
    .dialog-text {
        font-size: 16px;
    }
    
    .result-title {
        font-size: 48px;
    }
    
    .jiaobei-icon {
        width: 50px;
        height: 75px;
    }
    
    .toss-container {
        bottom: 60px;
    }
}


/* ========================================
   钱包 & 模式切换 UI
   ======================================== */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-right: 20px;
}

.btn-wallet {
    background: rgba(212, 168, 75, 0.1);
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 8px 16px;
    font-family: 'Noto Serif TC', serif;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.btn-wallet:hover {
    background: rgba(212, 168, 75, 0.3);
    box-shadow: 0 0 15px rgba(212, 168, 75, 0.2);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: .4s;
    border: 1px solid #555;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: #888;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--cinnabar-dark);
    border-color: var(--gold);
}

input:checked + .slider:before {
    transform: translateX(26px);
    background-color: var(--gold);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

.mode-label {
    color: var(--wood-light);
    font-size: 14px;
    min-width: 60px;
}

/* Wallet Info Bar */
.wallet-info {
    position: fixed;
    top: 70px;
    right: 20px;
    background: rgba(10, 8, 18, 0.9);
    border: 1px solid var(--gold);
    padding: 10px 20px;
    z-index: 99;
    display: flex;
    flex-direction: column;
    gap: 5px;
    backdrop-filter: blur(5px);
    animation: slideInRight 0.5s ease-out;
}

.wallet-info.hidden {
    display: none;
}

.info-item {
    font-family: 'Noto Serif TC', serif;
    color: var(--text-light);
    font-size: 14px;
}

.info-item .label {
    color: var(--wood-light);
    margin-right: 5px;
}

.info-item .value {
    color: var(--gold);
    font-weight: bold;
    font-family: monospace;
}

.info-item.jackpot .value {
    color: #ff4444;
    text-shadow: 0 0 5px rgba(255, 68, 68, 0.5);
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ========================================
   Toast Notification
   ======================================== */
.toast-container {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: rgba(10, 8, 18, 0.9);
    border: 1px solid var(--gold);
    padding: 12px 24px;
    border-radius: 4px;
    color: var(--gold);
    font-family: 'Noto Serif TC', serif;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    animation: toastSlideIn 0.3s ease-out, toastFadeOut 0.5s ease-in 2.5s forwards;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.negative {
    border-color: #ff4444;
    color: #ff4444;
}

.toast.positive {
    border-color: #00C851;
    color: #00C851;
}

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

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

.btn-add-token {
    background: transparent;
    border: 1px solid var(--wood-light);
    color: var(--wood-light);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    margin-left: 5px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-add-token:hover {
    border-color: var(--gold);
    color: var(--gold);
    transform: scale(1.1);
}

.btn-faucet {
    background: transparent;
    border: 1px solid var(--wood-light);
    color: var(--wood-light);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    margin-left: 5px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-faucet:hover {
    border-color: #00C851;
    color: #00C851;
    transform: scale(1.1);
}
