/* static/css/card-draw.css */

#card-draw-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    pointer-events: none;
    z-index: 9999;
    display: none;
}

#card-draw-overlay.active {
    display: block;
    pointer-events: auto;
}

.cards-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    perspective: 2000px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 50px 20px;
}

.card-wrapper {
    position: relative;
    opacity: 0;
    margin: 0 -30px;
    transition: z-index 0s;
}

.card-wrapper:hover,
.card-wrapper.active {
    z-index: 1000 !important;
}

.card-wrapper.draw-animation {
    animation: cardFlip 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes cardFlip {
    0% {
        opacity: 0;
        transform: 
            translateY(-150vh) 
            translateX(calc(var(--start-x) * 100px))
            rotateY(180deg) 
            rotateZ(calc(var(--rotation) * 2))
            scale(0.2);
    }
    50% {
        opacity: 1;
        transform: 
            translateY(0) 
            translateX(0)
            rotateY(360deg) 
            rotateZ(calc(var(--rotation) * 1.5))
            scale(1.2);
    }
    75% {
        transform: 
            translateY(20px)
            rotateY(540deg) 
            rotateZ(calc(var(--rotation) * 1.2))
            scale(0.95);
    }
    100% {
        opacity: 1;
        transform: 
            translateY(var(--final-y))
            rotateY(720deg) 
            rotateZ(var(--rotation))
            scale(1);
    }
}

.card {
    width: 200px;
    height: 290px;
    position: relative;
    transform-style: preserve-3d;
    cursor: pointer;
    /* 使用 will-change 优化性能和 Firefox 兼容性 */
    will-change: transform, filter;
    /* 默认状态过渡 - 包含所有可能变化的属性 */
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), 
                filter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 普通卡片样式 */
.normal-card {
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.3));
}

.normal-card .card-front {
    box-shadow: 
        0 0 20px rgba(0, 0, 0, 0.2),
        inset 0 0 10px rgba(0, 0, 0, 0.1),
        0 0 0 2px rgba(255, 255, 255, 0.1);
}

/* UR 卡片默认样式 */
.ur-card {
    filter: drop-shadow(0 8px 20px rgba(255, 215, 0, 0.6));
}

.ur-card .card-front {
    box-shadow: 
        0 0 20px rgba(0, 0, 0, 0.2),
        inset 0 0 10px rgba(0, 0, 0, 0.1),
        0 0 0 2px rgba(255, 215, 0, 0.6);
}

/* 悬停或激活时效果 - 所有属性使用相同的过渡 */
.card-wrapper:hover .card,
.card-wrapper.active .card {
    transform: translateY(-50px) scale(1.15) rotateZ(0deg) !important;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), 
                filter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.card-wrapper:hover .normal-card,
.card-wrapper.active .normal-card {
    filter: drop-shadow(0 10px 30px rgba(0, 200, 255, 0.6)) !important;
}

.card-wrapper:hover .card-title,
.card-wrapper.active .card-title {
    opacity: 1;
    transform: translateX(-50%) translateY(10px) scale(1.1);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    border-radius: 12px;
}

.card-front {
    width: 100%;
    height: 100%;
    position: relative;
    backface-visibility: hidden;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 4px solid transparent;
    background-clip: padding-box;
    /* 默认蓝色边框 */
    box-shadow: 
        0 0 40px rgba(0, 200, 255, 0.8),
        inset 0 0 30px rgba(0, 150, 255, 0.3),
        0 0 0 4px rgba(0, 200, 255, 0.6);
    /* 为所有 card-front 添加过渡 */
    transition: box-shadow 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 悬停或激活时边框效果 */
.card-wrapper:hover .card-front,
.card-wrapper.active .card-front {
    box-shadow: 
        0 0 40px rgba(255, 200, 0, 0.8),
        inset 0 0 30px rgba(255, 180, 0, 0.3),
        0 0 0 4px rgba(255, 200, 0, 0.6);
    transition: box-shadow 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.card-wrapper:hover .ur-card .card-front,
.card-wrapper.active .ur-card .card-front {
    /* 黄色悬停光晕 */
    box-shadow: 
        0 0 40px rgba(255, 200, 0, 0.8),
        inset 0 0 30px rgba(255, 180, 0, 0.3),
        0 0 0 4px rgba(255, 200, 0, 0.6);
    transition: box-shadow 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.card-wrapper:hover .normal-card .card-front,
.card-wrapper.active .normal-card .card-front {
    box-shadow: 
        0 0 30px rgba(0, 200, 255, 0.6),
        inset 0 0 20px rgba(0, 150, 255, 0.2),
        0 0 0 3px rgba(0, 200, 255, 0.4);
    transition: box-shadow 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

/* UR卡片光晕效果 - 优化后的连贯呼吸动画 */
.card-glow {
    position: absolute;
    top: -15px;
    left: -15px;
    right: -15px;
    bottom: -15px;
    border-radius: 16px;
    /* 黄金色渐变光晕 */
    background: radial-gradient(ellipse at center, 
        rgba(255, 215, 0, 0.5) 0%,
        rgba(255, 180, 0, 0.4) 30%,
        rgba(255, 150, 0, 0.3) 60%,
        transparent 100%
    );
    filter: blur(15px);
    opacity: 0;
    z-index: -1;
    /* 连贯的呼吸动画 */
    animation: urGlowBreath 3s ease-in-out infinite;
    /* 确保 Firefox 的过渡平滑 */
    transition: opacity 0.6s ease-in-out, 
                transform 0.6s ease-in-out,
                filter 0.6s ease-in-out;
    /* Firefox 优化 */
    will-change: opacity, transform;
}

/* 连贯的光晕呼吸动画 */
@keyframes urGlowBreath {
    0%, 100% {
        opacity: 0.7;
        transform: scale(1);
        filter: blur(15px);
    }
    50% {
        opacity: 1;
        transform: scale(1.15);
        filter: blur(20px);
    }
}

/* 普通卡片隐藏光晕 */
.normal-card .card-glow {
    display: none !important;
}

/* 悬停或激活时光晕效果 - 平滑过渡到更强烈的状态 */
.card-wrapper:hover .ur-card .card-glow,
.card-wrapper.active .ur-card .card-glow {
    /* 暂停呼吸动画 */
    animation-play-state: paused;
    /* 固定在强烈状态 */
    opacity: 1;
    transform: scale(1.3);
    filter: blur(25px);
    background: radial-gradient(ellipse at center, 
        rgba(255, 215, 0, 0.7) 0%,
        rgba(255, 180, 0, 0.6) 30%,
        rgba(255, 150, 0, 0.4) 60%,
        transparent 100%
    );
    /* 使用相同的过渡时间确保连贯性 */
    transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), 
                transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                filter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                background 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 移除悬停后的光晕，恢复呼吸动画 */
.card-wrapper:not(:hover):not(.active) .ur-card .card-glow {
    animation-play-state: running;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 1;
}

.card-title {
    position: absolute;
    bottom: -70px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    /* 移除背景 */
    background: transparent !important;
    color: #fff;
    font-size: 0.85em;
    font-weight: bold;
    text-align: center;
    border-radius: 8px;
    /* 移除边框 */
    border: none !important;
    /* 移除阴影 */
    box-shadow: none !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 200px;
    backdrop-filter: none;
    white-space: normal;
    line-height: 1.4;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

/* 悬停或激活时标题效果 */
.card-wrapper:hover .card-title,
.card-wrapper.active .card-title {
    opacity: 1;
    transform: translateX(-50%) translateY(10px) scale(1.1);
}

.ur-card .card-title {
    /* UR 卡片标题可以添加特殊效果，但保持透明背景 */
    color: rgba(255, 215, 0, 0.9);
    text-shadow: 
        0 0 10px rgba(255, 215, 0, 0.8),
        0 2px 10px rgba(0, 0, 0, 0.8);
}

.normal-card .card-title {
    color: rgba(255, 255, 255, 0.9);
}

.energy-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.energy-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    /* 默认蓝色粒子 */
    background: rgba(0, 200, 255, 0.8);
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(0, 200, 255, 1);
    animation: particleFloat 3s ease-out forwards;
    opacity: 0;
}

@keyframes particleFloat {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0);
    }
    20% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(var(--drift-x), var(--drift-y)) scale(1.5);
    }
}

.burst-ring {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    /* 默认蓝色环 */
    border: 3px solid rgba(0, 200, 255, 0.8);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 99;
    opacity: 0;
}

.burst-ring.active {
    animation: ringExpand 1s ease-out forwards;
}

@keyframes ringExpand {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(15);
    }
}

.light-beam {
    position: fixed;
    bottom: -50%;
    left: 50%;
    width: 400px;
    height: 200%;
    /* 默认蓝色光束 */
    background: linear-gradient(to top, 
        rgba(0, 200, 255, 0.3) 0%,
        rgba(0, 200, 255, 0.1) 50%,
        transparent 100%
    );
    transform: translateX(-50%);
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

.light-beam.active {
    animation: beamRise 1.5s ease-out forwards;
}

@keyframes beamRise {
    0% {
        opacity: 0;
        transform: translateX(-50%) scaleY(0);
    }
    30% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) scaleY(1);
    }
}

.close-button {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, rgba(0, 150, 255, 0.9), rgba(100, 0, 255, 0.9));
    border: 2px solid rgba(0, 200, 255, 0.8);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(0, 200, 255, 0.6);
    transition: all 0.3s ease;
}

.close-button:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 0 50px rgba(0, 200, 255, 1);
}

/* 刷新按钮样式 - 与关闭按钮保持一致 */
#refresh-cards-btn {
    position: absolute;
    bottom: -120px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, rgba(0, 150, 255, 0.9), rgba(100, 0, 255, 0.9));
    border: 2px solid rgba(0, 200, 255, 0.8);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(0, 200, 255, 0.6);
    transition: all 0.3s ease;
    animation: buttonFloat 3s ease-in-out infinite;
}

#refresh-cards-btn:hover {
    transform: translateX(-50%) scale(1.1) translateY(-5px);
    box-shadow: 0 0 50px rgba(0, 200, 255, 1);
}

#refresh-cards-btn:active {
    transform: translateX(-50%) scale(0.95);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .card-wrapper {
        margin: 0 -20px;
    }
    
    .card {
        width: 160px;
        height: 232px;
    }
    
    .card-title {
        width: 160px;
        font-size: 0.75em;
    }
}

