/* client/style.css */
body {
    background-color: #1a5e3a; /* 经典的桌布绿 */
    margin: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 顶部工具栏 */
#top-bar {
    background: rgba(0, 0, 0, 0.3);
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

#top-bar button {
    padding: 8px 15px;
    cursor: pointer;
    background: #eee;
    border: none;
    border-radius: 4px;
    font-weight: bold;
}

/* 游戏主体区域 */
#game-container {
    flex: 1;
    position: relative;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* 1. 发牌堆：移动到右下角 */
#stock-container {
    position: fixed;
    right: 20px;
    bottom: 20px;
    top: auto;        /* 覆盖掉之前的 top: 20px */
    left: auto;       /* 覆盖掉之前的 left: 20px */
    z-index: 1000;
}

#stock-pile {
    width: 80px;
    height: 110px;
    background: #2e5a88;
    border: 2px solid white;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8em;
    text-align: center;
    user-select: none;
}

/* 增加一个简单的发牌堆抖动反馈 */
#stock-pile:active {
    transform: scale(0.95);
}

/* 3. 核心列：往上移动 */
#columns-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px; /* 紧贴顶部工具栏 */
    height: auto;     /* 让高度自适应内容 */
}

.column {
    width: 80px;
    height: 600px;
    background: rgba(255, 255, 255, 0.05); /* 淡淡的槽位感 */
    border-radius: 6px;
    position: relative;
    z-index: 1;
}
.column:focus-within, .column:hover {
    z-index: 10; /* 悬停或操作时提升层级 */
}

/* 每一张牌的基本样式 */
.card {
    width: 80px;
    height: 110px;
    background: white;
    border: 1px solid #999;
    border-radius: 6px;
    position: absolute; /* 关键：为了实现堆叠效果 */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    user-select: none;
    transition: transform 0.1s;
    box-sizing: boarder-box;
}

/* 红色花色的牌面颜色 */
.card.red {
    color: #e44145;
}

/* 扑克牌内部文字容器 */
.card-index {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: absolute;
    width: 25px;
    top: 5px;
    left: 5px;
    line-height: 1;
    pointer-events: none;
}

.card .rank {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 2px;
}

.card .suit {
    font-size: 12px;
    margin-top: -2px;
}

/* 没翻开的牌（背面） */
.card.back {
    background-color: #2e5a88 !important;
    background-image: repeating-linear-gradient(
        45deg, 
        transparent, 
        transparent 5px, 
        rgba(255,255,255,0.1) 5px, 
        rgba(255,255,255,0.1) 10px
    ) !important;
    border: 1px solid #1a3a5a;
}

/* --- 💥 收牌动画核心样式 --- */
.card-complete-animation {
    z-index: 9999 !important;
    pointer-events: none !important;
    animation: complete-set-glow 0.5s ease-in-out forwards !important;
}

@keyframes complete-set-glow {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.1); /* 闪烁放大 */
        filter: brightness(1.8) drop-shadow(0 0 15px gold);
    }
    100% {
        transform: scale(1.05); /* 停留在轻微放大状态，准备飞行 */
        filter: brightness(1.2) drop-shadow(0 0 10px gold);
    }
}

/* 飞往收牌区的过渡类 */
.flying-to-slot {
    position: fixed !important;
    transition: all 0.6s cubic-bezier(0.5, 0, 0.5, 1) !important;
    z-index: 10000 !important;
}

/* 状态栏样式 */
#game-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-size: 1.2em;
    padding: 10px;
    background: rgba(0,0,0,0.5);
    border-radius: 5px;
}

/* 这里的 selector 建议给你的撤销按钮加个 class="undo-btn" */
.undo-btn {
    margin-left: auto; /* 关键：推到右边 */
    margin-right: 20px; /* 离右边缘留一点空隙 */
    background: #4a90e2 !important; /* 给它个显眼的蓝色 */
    color: white !important;
}



/* 死局弹窗遮罩 */
#game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7); /* 半透明黑背景 */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* 弹窗主体 */
.game-over-content {
    background: #2c3e50;
    padding: 30px;
    border-radius: 12px;
    border: 2px solid #e74c3c;
    text-align: center;
    color: white;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.game-over-content h2 {
    color: #ff4444;
    margin-top: 0;
}

.game-over-btns {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.game-over-btns button {
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    transition: background 0.2s;
}

.undo-btn { background: #3498db; color: white; }
.undo-btn:hover { background: #2980b9; }

.new-game-btn { background: #2ecc71; color: white; }
.new-game-btn:hover { background: #27ae60; }


/* 2. 收牌槽：保持在左下角（确保是 fixed） */
#completed-container {
    position: fixed;
    left: 20px;
    bottom: 20px;
    display: flex;
    gap: 10px;        /* 槽位之间的间距 */
    z-index: 100;
}

.slot {
    width: 80px;
    height: 110px;
    border: 2px dashed rgba(255, 255, 255, 0.2); 
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.1);
    position: relative;
    box-sizing: border-box; /* 确保边框不撑大宽高 */
}

/* 当槽位里有牌时，显示一张 K 的样式 */
/* 当槽位里有牌时，显示一张更有质感的 K */
.slot.filled::after {
    content: "K";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 40px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.8);
    background: #2e5a88;
    border-radius: 4px;
    border: 1px solid white;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
}



/* 飞行中的卡牌基础样式 */
.flying-card {
    position: fixed !important;
    z-index: 10000 !important; /* 确保在最顶层 */
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    width: 80px;  /* 必须指定宽度，否则 fixed 元素可能塌陷 */
    height: 110px;
}

/* 收牌成功时的缩放闪烁效果 */
@keyframes collect-glow {
    0% { filter: brightness(1); transform: scale(1); }
    50% { filter: brightness(1.5); transform: scale(1.1); }
    100% { filter: brightness(1); transform: scale(1); }
}

.collecting {
    animation: collect-glow 0.4s ease-in-out;
}

.victory-card {
    position: fixed;
    z-index: 10001;
    pointer-events: none;
    width: 80px;
    height: 110px;
    border-radius: 6px;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.3);
}


/* 晃动动画 */
@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

/* 专门给发牌堆准备的类 */
.shake-warning {
    animation: error-shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

/* 死局专用的剧烈震动 */
@keyframes intense-shake {
    0%, 100% { transform: translate(0, 0); }
    10%, 30%, 50%, 70%, 90% { transform: translate(-10px, -5px); }
    20%, 40%, 60%, 80% { transform: translate(10px, 5px); }
}

.shake-death {
    animation: intense-shake 0.6s cubic-bezier(.36,.07,.19,.97) both;
}

/* 确保内容框有基础样式（如果还没写的话） */
.game-over-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    border: 3px solid #ff4444; /* 红色边框增强警告感 */
}