/* static/css/card-game.css */

#card-game-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-game-overlay.active {
    display: block;
    pointer-events: auto;
    z-index: 9999;
}

.card-game-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 50px 20px;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 200, 255, 0.5) transparent;
}

.card-game-container::-webkit-scrollbar {
    width: 8px;
}

.card-game-container::-webkit-scrollbar-track {
    background: transparent;
}

.card-game-container::-webkit-scrollbar-thumb {
    background-color: rgba(0, 200, 255, 0.5);
    border-radius: 4px;
}

.card-game-title {
    position: absolute;
    top: 45px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 36px;
    font-weight: bold;
    color: #fff;
    text-align: center;
    text-shadow: 0 0 15px rgba(0, 200, 255, 0.8), 0 0 30px rgba(0, 200, 255, 0.5);
    letter-spacing: 2px;
    z-index: 10;
    padding: 10px 30px;
    background: linear-gradient(135deg, rgba(0, 50, 100, 0.3), rgba(0, 100, 200, 0.2));
    border-radius: 10px;
    border: 1px solid rgba(0, 200, 255, 0.3);
    backdrop-filter: blur(5px);
    animation: titleGlow 2s ease-in-out infinite alternate;
    pointer-events: none; /* 防止标题阻挡鼠标事件 */
}

@keyframes titleGlow {
    0% {
        text-shadow: 0 0 15px rgba(0, 200, 255, 0.8), 0 0 30px rgba(0, 200, 255, 0.5);
        box-shadow: 0 0 20px rgba(0, 200, 255, 0.3);
    }
    100% {
        text-shadow: 0 0 20px rgba(0, 200, 255, 1), 0 0 40px rgba(0, 200, 255, 0.7);
        box-shadow: 0 0 30px rgba(0, 200, 255, 0.5);
    }
}

.card-game-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    justify-items: center;
}

.card-game-card-wrapper {
    position: relative;
    opacity: 0;
    transition: all 0.3s ease;
}

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

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

.card-game-card {
    width: 200px;
    height: 290px;
    position: relative;
    cursor: pointer;
    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);
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.3));
}

.card-game-card-wrapper:hover .card-game-card,
.card-game-card-wrapper.active .card-game-card {
    transform: translateY(-20px) scale(1.05);
    filter: drop-shadow(0 10px 30px rgba(0, 200, 255, 0.6));
}

.card-game-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 12px;
}

.card-game-card-front {
    width: 100%;
    height: 100%;
    position: relative;
    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 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);
    transition: box-shadow 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-game-card-wrapper:hover .card-game-card-front,
.card-game-card-wrapper.active .card-game-card-front {
    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-game-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 1;
}

.card-game-card-title {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    background: transparent;
    color: #fff;
    font-size: 0.9em;
    font-weight: bold;
    text-align: center;
    border-radius: 8px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 200px;
    white-space: normal;
    line-height: 1.4;
    opacity: 0.8;
    transition: all 0.3s ease;
    pointer-events: none;
}

.card-game-card-wrapper:hover .card-game-card-title,
.card-game-card-wrapper.active .card-game-card-title {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px) scale(1.05);
}

.card-game-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;
}

.card-game-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);
    }
}

.card-game-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;
}

.card-game-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);
    }
}

.card-game-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: 9;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(0, 200, 255, 0.6);
    transition: all 0.3s ease;
}

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

/* 3x3田字格按钮样式 */
.grid-icon {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 150, 255, 0.9), rgba(100, 0, 255, 0.9));
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 200, 255, 0.6);
    overflow: hidden;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 4px; /* 增加间隔 */
    padding: 4px; /* 增加内边距 */
}

.grid-square {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .card-game-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
    
    .card-game-card {
        width: 160px;
        height: 232px;
    }
    
    .card-game-card-title {
        width: 160px;
        font-size: 0.8em;
    }
    
    .card-game-title {
        font-size: 28px;
        margin-bottom: 30px;
    }
    
    .card-game-container {
        padding: 30px 15px;
    }
    
    .grid-icon {
        gap: 3px; /* 移动端稍微减小间隔 */
        padding: 3px;
    }
}