/* ========================================
   养成场景样式
   ======================================== */

.cultivate-scene {
    padding: 16px;
}

/* ========================================
   融合场景样式（替代养成+战斗分离）
   ======================================== */

.game-scene {
    width: 100%;
    height: 100%;
    overflow: auto;
}

.game-scene-container {
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: auto;
    position: relative;
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 8px;
    flex-shrink: 0;
}

.game-header h3 {
    font-size: 16px;
    color: var(--color-primary);
    margin: 0;
}

.game-hint {
    font-size: 12px;
    color: var(--color-text-dim);
    margin-left: 12px;
}

.game-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: #ff4444;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    pointer-events: none;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 1.5s forwards;
}

/* 游戏场景右下角悬浮按钮 */
.game-scene .battle-float-btn {
    right: 40px;
    left: auto;
    transform: none;
}

/* 眩晕视觉标记闪烁动画 */
@keyframes stunPulse {
    0%   { opacity: 0.7; transform: translate(-50%,-50%) rotate(-15deg) scale(1); }
    100% { opacity: 1;   transform: translate(-50%,-50%) rotate(-15deg) scale(1.1); }
}

/* 灼烧视觉标记闪烁动画 */
@keyframes burnFlicker {
    0%   { opacity: 0.6; text-shadow: 0 0 6px #FF4400, 0 0 10px #FF4400; }
    100% { opacity: 1;   text-shadow: 0 0 12px #FF6600, 0 0 20px #FF4400; }
}

/* ===== 抽卡按钮 ===== */
.draw-buttons {
    position: fixed;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    z-index: 99998;
}

.draw-btn {
    padding: 10px 24px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 14px;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.draw-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: 0 4px 20px rgba(233, 69, 96, 0.25);
}

.draw-btn:active {
    transform: scale(0.96);
}

.game-monster-card {
    opacity: 0.9;
}

/* 战斗进行时禁用卡牌拖拽/交互 */
.battle-active .card,
.battle-active .monster-card {
    pointer-events: none !important;
    user-select: none;
}

.cultivate-layout {
    width: 100%;
    height: 100%;
}

/* ----- 卡牌区 ----- */
.cultivate-left {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: auto;
}

.cultivate-left h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--color-primary);
    flex-shrink: 0;
}

.card-list {
    position: relative;
    overflow: auto;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    flex: 1;
    min-width: 1350px;
    min-height: 600px;
}

/* ========================================
   生存循环模式样式 - 极简桌面
   ======================================== */

.survival-scene {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.survival-desktop {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    background: radial-gradient(ellipse at center, #1e2a3a 0%, #0d1520 100%);
}

/* ----- Nav Bar ----- */
.survival-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: rgba(22, 33, 62, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    z-index: 1000;
    position: relative;
}

.survival-nav-title {
    font-size: 20px;
    font-weight: bold;
    color: var(--color-primary);
}

.survival-nav-stats {
    font-size: 18px;
    font-weight: bold;
    color: var(--color-text);
    flex: 1;
    text-align: center;
}

.survival-nav-stats span {
    color: var(--color-primary);
    font-weight: bold;
}

.survival-nav-tip {
    font-size: 13px;
    color: var(--color-text-dim);
}

/* ----- 桌面（卡牌自由放置区域） ----- */
.survival-board {
    flex: 1;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 20% 50%, rgba(30, 60, 90, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(60, 30, 60, 0.2) 0%, transparent 50%);
}

/* 桌面网格纹理（极淡） */
.survival-board::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

/* ----- 浮动休息区 ----- */
.rest-zone {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 12px;
    background: rgba(22, 33, 62, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    justify-content: center;
}

.rest-slot {
    width: 100px;
    height: 130px;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.rest-slot:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.06);
}

.rest-slot-placeholder {
    font-size: 14px;
    color: var(--color-text-dim);
    opacity: 0.8;
}

/* 休息区中的缩略卡牌 */
.rest-card {
    width: 100%;
    height: 100%;
    border: 2px solid;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(22, 33, 62, 0.9), rgba(30, 50, 80, 0.9));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: transform 0.15s;
    padding: 4px;
}

.rest-card:hover {
    transform: scale(1.05);
}

.rest-card-name {
    font-size: 12px;
    font-weight: bold;
    color: var(--color-text);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.rest-card-stamina {
    width: 80%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.rest-card-stamina-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.rest-card-status {
    font-size: 10px;
    color: var(--color-text-dim);
}

/* ----- 底部浮动操作栏（fixed 定位于视口） ----- */
.survival-action-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2147483647;
    display: flex;
    gap: 12px;
    padding: 10px 20px;
    background: rgba(22, 33, 62, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
}

.survival-action-bar button {
    pointer-events: auto;
}

.survival-btn {
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-text);
    font-size: 15px;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 500;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
}

.survival-btn .btn-label {
    font-size: 15px;
    font-weight: 600;
}

.survival-btn .btn-cost {
    font-size: 13px;
    color: #FFC107;
    font-weight: 600;
    background: rgba(255, 193, 7, 0.12);
    padding: 2px 7px;
    border-radius: 4px;
}

.survival-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: 0 4px 16px rgba(233, 69, 96, 0.15);
}

.survival-btn:active {
    transform: scale(0.96);
}

.survival-btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    font-weight: bold;
}

.survival-btn-primary:hover {
    background: #ff5a75;
    border-color: #ff5a75;
    color: #fff;
    box-shadow: 0 4px 20px rgba(233, 69, 96, 0.3);
}

/* ----- 生存模式Toast ----- */
.survival-toast {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: bold;
    z-index: 99999;
    pointer-events: none;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
    background: rgba(200, 30, 30, 0.92);
    color: #fff;
    border: 1px solid #ff4444;
    box-shadow: 0 4px 20px rgba(255, 68, 68, 0.3);
}

/* 生存模式卡牌特殊类 */
.survival-card {
    z-index: 100;
}

.survival-card:hover {
    z-index: 101;
}

/* 建筑卡牌 */
.building-card .item-card-header {
    background: rgba(76, 175, 80, 0.1);
}

/* 战斗进行时禁用交互 */
.battle-active .survival-board {
    pointer-events: none;
}

/* ----- 响应式适配 ----- */
@media (max-width: 768px) {
    .rest-zone {
        min-width: auto;
        padding: 8px 12px;
        gap: 6px;
        top: 50px;
    }
    .rest-slot {
        width: 70px;
        height: 100px;
    }
    .survival-action-bar {
        gap: 6px;
        padding: 8px 12px;
    }
    .survival-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    .survival-nav-stats {
        font-size: 11px;
    }
}

/* ----- 图鉴按钮 ----- */
.survival-nav-handbook {
    font-size: 14px;
    font-weight: bold;
    color: var(--color-text);
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 6px;
    background: rgba(36, 140, 185, 0.585);
    transition: background 0.15s;
    user-select: none;
    flex-shrink: 0;
}
.survival-nav-handbook:hover {
    background: rgba(57, 162, 181, 0.15);
}

/* ----- 图鉴弹窗 ----- */
.handbook-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    cursor: pointer;
}
.handbook-content {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 24px 32px;
    max-width: 740px;
    max-height: calc(80vh + 40px);
    overflow-y: auto;
    cursor: default;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.handbook-content h2 {
    font-size: 20px;
    color: var(--color-primary);
    margin: 0 0 12px 0;
    text-align: center;
}
.handbook-content h3 {
    font-size: 15px;
    color: var(--color-text);
    margin: 14px 0 6px 0;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 4px;
}
.handbook-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.handbook-content td, .handbook-content th {
    padding: 3px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.handbook-content th {
    color: var(--color-primary);
    font-weight: bold;
}
.handbook-content p {
    font-size: 13px;
    color: var(--color-text-dim);
    margin: 4px 0;
}
.handbook-tip {
    text-align: center;
    margin-top: 12px !important;
    font-size: 12px;
    color: var(--color-text-dim);
    opacity: 0.6;
}

/* ========================================
   建筑插槽系统样式
   ======================================== */

/* 插槽网格容器 */
.building-grid {
    pointer-events: auto;
    animation: buildingGridIn 0.4s ease-out;
}

@keyframes buildingGridIn {
    from { opacity: 0; transform: translateY(-50%) translateX(30px); }
    to   { opacity: 1; transform: translateY(-50%) translateX(0); }
}

/* 插槽基础 */
.building-slot {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}
.building-slot[data-slot-state="locked"]:hover {
    border-color: rgba(255,255,255,0.12);
}
.building-slot[data-slot-state="empty"]:hover {
    border-color: rgba(76,175,80,0.5);
    background: rgba(76,175,80,0.08);
}

/* 生产中脉冲动画 */
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.08); opacity: 0.8; }
}

/* 进度条流动动画 */
@keyframes shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* 可领取闪烁动画 */
@keyframes slotReady {
    0%, 100% { box-shadow: 0 0 8px rgba(76,175,80,0.3); }
    50%      { box-shadow: 0 0 20px rgba(76,175,80,0.6); }
}

/* 建筑卡牌在桌面的样式 */
.building-card {
    transition: border-color 0.3s, box-shadow 0.3s;
}
.building-card:hover {
    box-shadow: 0 4px 20px rgba(255, 152, 0, 0.4), inset 0 0 30px rgba(255, 152, 0, 0.08);
    border-color: #FFB74D;
}

/* 战斗时建筑不隐藏，但禁用交互 */
#building-grid.battle-active {
    pointer-events: none;
    opacity: 0.5;
}
#building-grid.battle-active .building-slot {
    pointer-events: none;
}
