/* ==================================================
   🌌 世界选择界面 (V17.0 丝滑层级最终修正版)
   ================================================== */

/* 1. 全屏锁定 */
#world-selection-screen {
    position: fixed !important; 
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #000 !important; 
    z-index: 2147483647 !important; 
    display: none; 
    justify-content: center; align-items: center;
    overflow: hidden; 
    font-family: "Microsoft YaHei", sans-serif;
    -webkit-tap-highlight-color: transparent; 
}

/* 背景特效 */
.world-selection-bg-overlay {
    position: absolute; width: 200%; height: 200%;
    background: radial-gradient(ellipse at center, #1a0033 0%, #000000 70%);
    animation: bg-cosmic-shift 60s linear infinite; opacity: 0.9;
    pointer-events: none;
}
@keyframes bg-cosmic-shift { 0% { transform: translate(-25%, -25%) rotate(0deg); } 100% { transform: translate(-25%, -25%) rotate(360deg); } }

/* 2. 布局容器 */
.portals-wrapper {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 500px; height: 500px; /* 电脑端标准 */
    pointer-events: none;
    /* 🔥 开启3D透视，让动画更具空间感，更丝滑 */
    perspective: 1000px; 
}

/* 3. 节点通用设置 (动画引擎核心) */
.portal-node {
    position: absolute !important; 
    pointer-events: auto;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: pointer; 
    
    /* 🔥 极致丝滑曲线 (Quint Ease Out) 🔥
       这种曲线是“快启动，极慢结束”，像磁悬浮一样，比之前的有质感得多。
    */
    transition: transform 0.45s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.3s ease;
    
    z-index: 10;
    
    /* 🚀 硬件加速三件套：防止手机端掉帧 */
    will-change: transform; 
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    
    outline: none; 
}

/* === 💻 电脑端默认定位 === */
.top-node { top: 0; left: 0; color: #9c27b0; }
.right-node { top: 0; right: 0; color: #009688; }
.left-node { bottom: 0; left: 0; color: #d32f2f; }
.bottom-node { bottom: 0; right: 0; color: #ff5722; }

/* === 🌀 中间：核心 (电脑端) === */
.center-node { 
    top: 50%; left: 50%; 
    transform: translate(-50%, -50%); 
    /* 🔥 层级修正：中间球设为 200，永远压在四周球(150)上面 */
    z-index: 200; 
}
.center-node:hover { transform: translate(-50%, -50%) scale(1.05); }


/* ==================================================
   📱 手机端深度适配 (V17 层级与手感优化)
   ================================================== */
@media (max-width: 600px) {
    .portals-wrapper {
        width: 100vw; height: 100vh;
        max-width: none; max-height: none;
    }

    /* 1. 位置调整 (严格对称) */
    .top-node    { top: 110px; left: 10px; }
    .right-node  { top: 110px; right: 10px; }
    .left-node   { bottom: 110px; left: 10px; } 
    .bottom-node { bottom: 110px; right: 10px; }

    /* 2. 四周球默认尺寸 (0.9) - 保持无 !important 以允许 hover */
    .top-node, .right-node, .left-node, .bottom-node {
        transform: scale(0.9); 
    }

    /* 3. 选中/保持状态 (放大到 1.1) 
       🔥 层级修正：选中时 z-index 设为 150。
       (自身 > 10, 但 < 中间球的 200)。
       这样文字会浮在自己上面，但被中间球遮挡。
    */
    .top-node:active,  .top-node:hover,  .top-node:focus,  .top-node.active,
    .right-node:active,.right-node:hover,.right-node:focus,.right-node.active,
    .left-node:active, .left-node:hover, .left-node:focus, .left-node.active,
    .bottom-node:active,.bottom-node:hover,.bottom-node:focus,.bottom-node.active {
        transform: scale(1.1); 
        z-index: 150; /* 比默认高，但比中间球(200)低 */
        filter: drop-shadow(0 0 10px currentColor); 
    }

    /* 4. 中间球尺寸 (0.8) */
    .center-node {
        transform: translate(-50%, -50%) scale(0.8);
    }
    
    /* 5. 中间球激活 (0.9) */
    .center-node.active {
        transform: translate(-50%, -50%) scale(0.9) !important;
        /* 激活时层级最高 */
        z-index: 300 !important; 
    }

    /* 文字标签调整 */
    .portal-label {
        margin-top: 155px !important;
        font-size: 18px !important;
        background: rgba(0,0,0,0.85) !important;
        white-space: nowrap;
        /* 文字在节点内部，不需要极高的 z-index，依靠父节点的 z-index 排序即可 */
        /* 但为了保险起见，给个局部高分，保证在光环之上 */
        z-index: 10; 
    }
}

/* --- 🤏 小屏手机适配 (<=375px) --- */
@media (max-width: 375px) {
    .top-node    { top: 90px; left: 5px; }
    .right-node  { top: 90px; right: 5px; }
    .left-node   { bottom: 100px; left: 5px; }
    .bottom-node { bottom: 100px; right: 5px; }

    /* 默认 0.8 */
    .top-node, .right-node, .left-node, .bottom-node {
        transform: scale(0.8); 
    }
    
    /* 选中 1.0 */
    .top-node:active,  .top-node:hover,  .top-node:focus,  .top-node.active,
    .right-node:active,.right-node:hover,.right-node:focus,.right-node.active,
    .left-node:active, .left-node:hover, .left-node:focus, .left-node.active,
    .bottom-node:active,.bottom-node:hover,.bottom-node:focus,.bottom-node.active {
        transform: scale(1.0); 
    }

    .center-node {
        transform: translate(-50%, -50%) scale(0.7);
    }
    .center-node.active {
        transform: translate(-50%, -50%) scale(0.8) !important;
    }
}


/* ==================================================
   ✨ 通用视觉 & 动画
   ================================================== */

/* 启程按钮激活态 (PC端基础) */
.center-node.active {
    opacity: 1 !important; 
    transform: translate(-50%, -50%) scale(1.1); 
    filter: drop-shadow(0 0 15px #FFD700); 
    cursor: pointer;
    z-index: 300; /* 确保激活时最高 */
}

.center-node.active .lg-ring { border-color: #fff; box-shadow: 0 0 50px #FFD700; animation: spin 2s linear infinite; }
.center-node.active .void-energy { background: radial-gradient(circle, rgba(255, 215, 0, 0.9) 0%, rgba(255, 69, 0, 0.8) 50%, rgba(0,0,0,1) 90%); animation: spin 1.5s linear infinite; }
.center-node.active .center-label div { color: #FFD700; }

/* 基础组件 */
.portal-ring { border-radius: 50%; position: absolute; box-shadow: 0 0 20px currentColor, inset 0 0 20px currentColor; pointer-events: none; }
.sm-ring { width: 160px; height: 160px; border: 4px solid; opacity: 0.7; animation: ring-pulse 3s infinite alternate; }
.lg-ring { 
    width: 180px; height: 180px; 
    border: 6px solid #fff; color: #fff; 
    box-shadow: 0 0 40px #00bfff, inset 0 0 20px #00bfff; 
    animation: spin 10s linear infinite; 
}

/* 标签通用 */
.portal-label { 
    margin-top: 170px; 
    color: #fff; text-shadow: 0 2px 5px #000; font-weight: bold; font-size: 18px; 
    background: rgba(0,0,0,0.6); padding: 4px 12px; border-radius: 20px;
    white-space: nowrap; 
    pointer-events: none;
    transform: translateZ(50px); 
}

.portal-logout-btn {
    position: absolute; top: 20px; right: 20px; z-index: 30000;
    background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.3); color: #ccc;
    padding: 8px 15px; border-radius: 4px; cursor: pointer; transition: all 0.3s;
}
.portal-logout-btn:hover { background: rgba(211, 47, 47, 0.8); color: #fff; border-color: #f44336; }

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes ring-pulse { 0% { opacity: 0.5; transform: scale(0.95); } 100% { opacity: 0.9; transform: scale(1.05); } }

/* 核心球体 */
.main-portal-core { width: 150px; height: 150px; border-radius: 50%; background: #000; overflow: hidden; position: relative; box-shadow: inset 0 0 30px #00bfff; }
.void-energy { position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: radial-gradient(circle, rgba(0,191,255,0.8) 0%, rgba(0,0,0,1) 70%); animation: spin 5s linear infinite; opacity: 0.7; }
.center-label { position: absolute; text-align: center; color: #fff; text-shadow: 0 0 10px #00bfff; pointer-events: none; }
.center-label div { font-size: 28px; font-weight: bold; }

/* --- 主题背景 --- */
.theme-bg {
    width: 150px; height: 150px; border-radius: 50%;
    position: absolute; overflow: hidden;
    border: 3px solid rgba(255,255,255,0.3);
    background: #000; box-shadow: inset 0 0 30px rgba(0,0,0,0.8);
}

/* === 🏰 上方：中世纪 (使用你提供的 CSS) === */
.medieval-bg { background: linear-gradient(to bottom, #311b92 0%, #4a148c 60%, #000 100%); }
.castle-silhouette {
    position: absolute; bottom: 0; left: 15%; width: 70%; height: 70px;
    background: #212121;
    /* 你的代码：方正塔楼和城垛 */
    clip-path: polygon(
        0% 100%, 
        0% 40%, 10% 40%, 10% 30%, 20% 30%, 20% 40%, 30% 40%, 
        30% 20%, 40% 20%, 40% 10%, 50% 10%, 50% 20%, 60% 20%, 
        60% 40%, 70% 40%, 70% 30%, 80% 30%, 80% 40%, 90% 40%, 100% 40%, 
        100% 100%
    );
    z-index: 1;
}
.castle-silhouette::after {
    content: ''; position: absolute; top: 50%; left: 45%; width: 4px; height: 6px;
    background: #ffd700; box-shadow: 15px 10px 0 #ffd700, -15px 15px 0 #ffd700;
}
.floating-sword {
    position: absolute; top: 30%; left: 50%; font-size: 40px;
    transform: translateX(-50%); z-index: 2;
    filter: drop-shadow(0 0 10px #e040fb);
    animation: sword-float 3s ease-in-out infinite alternate;
}
.magic-particles::before, .magic-particles::after {
    content: '✨'; position: absolute; font-size: 14px; animation: magic-rise 2s linear infinite; opacity: 0;
}
.magic-particles::before { left: 30%; animation-delay: 0.5s; }
.magic-particles::after { left: 70%; animation-delay: 1s; }

/* === 蛮荒：猎鹰 + 大象 === */
.wild-bg { 
    background: linear-gradient(to bottom, #ff5722 0%, #ff9800 40%, #5d4037 100%); 
}
.savanna-sun { 
    position: absolute; top: 20px; left: 20px; width: 40px; height: 40px; 
    background: #ffeb3b; border-radius: 50%; box-shadow: 0 0 20px #ffeb3b; 
}

/* 🐘 大象：地面背景 (左下) */
.elephant-silhouette { 
    position: absolute; bottom: 35px; left: 5px; 
    font-size: 40px; 
    filter: brightness(0) opacity(0.3); 
    transform: scaleX(-1); 
    z-index: 1;
}

/* 🦅 猎鹰：空中霸主 (右上) - 替代野猪 */
.eagle-silhouette {
    position: absolute; top: 30px; right: 20px; 
    font-size: 32px; 
    filter: brightness(0); /* 纯黑剪影 */
    z-index: 3;
    animation: eagle-hover 3s infinite ease-in-out alternate;
}
@keyframes eagle-hover {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-5px) scale(1.1); }
}

/* 🐐 猎物：地面前景 (右下) */
.prey-silhouette { 
    position: absolute; bottom: 5px; right: 50px; 
    font-size: 16px; 
    filter: brightness(0); 
    z-index: 2; 
}

/* === 三国：战马 + 城楼 (错位布局) === */
.threek-bg { 
    background: linear-gradient(to bottom, #b71c1c 0%, #f44336 60%, #4e342e 100%); 
}

/* 城楼：居中靠后 */
.gate-silhouette { 
    position: absolute; bottom: 25px; left: 50%; 
    width: 90px; /* 稍微改小一点点防止太挤 */
    height: 50px; 
    transform: translateX(-50%); 
    background: #3e2723; 
    clip-path: polygon(10% 100%, 10% 20%, 0% 20%, 20% 0%, 80% 0%, 100% 20%, 90% 20%, 90% 100%, 70% 100%, 70% 50%, 30% 50%, 30% 100%); 
    z-index: 1;
}

/* 🐎 战马：移到右下角，面向左侧 (错开) */
.horse-silhouette {
    position: absolute; bottom: 5px; right: 5px; /* 改为右下 */
    font-size: 28px;
    filter: brightness(0) opacity(0.6); 
    transform: scaleX(1); /* 面向左侧 (Emoji马原图通常面向左，如需调整可改-1) */
    z-index: 3; /* 在最前面 */
}

/* 决斗场景：居中前景 */
.duel-scene { 
    position: absolute; bottom: 10px; width: 100%; 
    display: flex; justify-content: center; align-items: center; 
    z-index: 2; 
}
.warrior { width: 20px; height: 30px; background: #212121; margin: 0 5px; clip-path: polygon(50% 0%, 100% 40%, 80% 100%, 20% 100%, 0% 40%); }
.w1 { animation: fight-l 0.8s infinite; } 
.w2 { animation: fight-r 0.8s infinite reverse; }
.weapon-clash { position: absolute; top: -10px; font-size: 24px; animation: flash 0.4s infinite; }

.army-flags::before, .army-flags::after { content: '🚩'; position: absolute; bottom: 50px; font-size: 16px; filter: brightness(0.5); animation: wave 2s infinite alternate; }
.army-flags::before { left: 15px; } .army-flags::after { right: 15px; animation-delay: 1s; }

/* === ⛰️ 右侧：武侠 (保持原样) === */
.wuxia-bg { background: linear-gradient(to bottom, #e0f2f1, #004d40); }
.mountains-layer { position: absolute; bottom: 0; width: 100%; background: #004d40; opacity: 0.6; border-radius: 50% 50% 0 0; }
.m1 { height: 50px; left: -20%; width: 140%; z-index: 2; opacity: 0.8; } .m2 { height: 80px; left: 0; width: 100%; z-index: 1; opacity: 0.4; filter: blur(2px); }
.pagoda-silhouette { position: absolute; bottom: 40px; right: 30px; width: 20px; height: 40px; background: #00251a; clip-path: polygon(50% 0, 100% 20%, 80% 20%, 100% 40%, 80% 40%, 100% 60%, 80% 60%, 100% 80%, 80% 80%, 100% 100%, 0 100%, 20% 80%, 0 80%, 20% 60%, 0 60%, 20% 40%, 0 40%, 20% 20%, 0 20%); z-index: 3; }
.martial-artist { position: absolute; bottom: 10px; left: 40px; font-size: 28px; z-index: 4; filter: brightness(0); animation: kungfu 3s infinite linear; }

/* 🌀 核心 (缩小) */
.main-portal-core { 
    width: 150px; height: 150px; /* 电脑端缩小到 150 */
    border-radius: 50%; background: #000; overflow: hidden; position: relative; 
    box-shadow: inset 0 0 30px #00bfff; 
}
.void-energy { position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: radial-gradient(circle, rgba(0,191,255,0.8) 0%, rgba(0,0,0,1) 70%); animation: spin 5s linear infinite; opacity: 0.7; }

/* 动画定义 */
@keyframes sword-float { 0% { top: 30%; transform: translateX(-50%) rotate(-5deg); } 100% { top: 20%; transform: translateX(-50%) rotate(5deg); } }
@keyframes magic-rise { 0% { bottom: 0; opacity: 1; } 100% { bottom: 80%; opacity: 0; transform: scale(1.5); } }
@keyframes fight-l { 0%,100% { transform: translateX(0); } 50% { transform: translateX(5px) rotate(15deg); } }
@keyframes fight-r { 0%,100% { transform: translateX(0); } 50% { transform: translateX(-5px) rotate(-15deg); } }
@keyframes flash { 0%,100% { opacity: 0; scale: 0.5; } 50% { opacity: 1; scale: 1.2; } }
@keyframes wave { 0% { transform: rotate(-5deg); } 100% { transform: rotate(5deg); } }
@keyframes kungfu { 0% { transform: scaleX(1); } 50% { transform: scaleX(-1); } 100% { transform: scaleX(1); } }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes ring-pulse { 0% { opacity: 0.5; transform: scale(0.95); } 100% { opacity: 0.9; transform: scale(1.05); } }


/* ================================================== */
        /* 物品卡片样式 */
        .item-card {
            background: #252525; border: 1px solid #444; border-radius: 4px;
            padding: 8px; text-align: center; cursor: pointer; transition: 0.2s;
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            height: 90px; position: relative;
        }
        .item-card:hover { background: #333; border-color: var(--highlight); }
        .item-icon { font-size: 32px; margin-bottom: 5px; }
        .item-name { font-size: 11px; color: #ccc; line-height: 1.2; overflow: hidden; height: 26px;}
        .item-count { 
            position: absolute; top: 2px; right: 4px; 
            font-size: 10px; color: #fff; background: rgba(0,0,0,0.6); 
            padding: 1px 4px; border-radius: 4px;
        }

        /* --- 物品品质 (对齐 NPC Rank: 1=白, 2=绿, 3=蓝, 4=紫, 5=金, 6=橙, 7=彩) --- */

        /* 1: Common / 普通 (对应 NPC Rank 1) */
        .item-quality-1 { 
            border-color: #b0bec5; 
            box-shadow: inset 0 0 5px rgba(176, 190, 197, 0.2); 
            color: #b0bec5; /* 可选：文字颜色也跟随 */
        }

        /* 2: Green / 优秀 (对应 NPC Rank 2) */
        .item-quality-2 { 
            border-color: #76ff03; 
            box-shadow: inset 0 0 5px rgba(118, 255, 3, 0.2); 
            color: #76ff03;
        }

        /* 3: Blue / 稀有 (对应 NPC Rank 3) */
        .item-quality-3 { 
            border-color: #2979ff; 
            box-shadow: inset 0 0 5px rgba(41, 121, 255, 0.2); 
            color: #2979ff;
        }

        /* 4: Purple / 史诗 (对应 NPC Rank 4) */
        .item-quality-4 { 
            border-color: #ea80fc; 
            box-shadow: inset 0 0 5px rgba(234, 128, 252, 0.2); 
            color: #ea80fc;
        }

        /* 5: Gold / 传说 (对应 NPC Rank 5) */
        .item-quality-5 { 
            border-color: #ffb300; 
            box-shadow: inset 0 0 8px rgba(255, 179, 0, 0.4); 
            color: #ffb300;
        }

        /* 6: Orange / 神话 (对应 NPC Rank 6) */
        .item-quality-6 { 
            border-color: #ff3d00; 
            box-shadow: inset 0 0 10px rgba(255, 61, 0, 0.5); 
            color: #ff3d00;
        }

        /* 7: Rainbow / 巅峰 (对应 NPC Rank 7) */
        .item-quality-7 { 
            border-color: #00e5ff; /* 青色底或用 CSS 动画 */
            box-shadow: inset 0 0 15px rgba(0, 229, 255, 0.6), 0 0 10px rgba(255, 255, 255, 0.5); 
            background: linear-gradient(135deg, rgba(255,0,0,0.1), rgba(0,255,0,0.1), rgba(0,0,255,0.1));
            /* 如果想要边框也是彩虹色，CSS 稍复杂，这里先用强发光代替 */
        }

        :root {
            --bg-color: #202020;
            --panel-bg: #2d2d2d;
            --highlight: #FFD700;
            --hp-green: #4caf50;
            --hp-red: #d32f2f;
            --ap-color: #ffeb3b; 
            
            /* 稀有度颜色 */
            --color-common: #eeeeee; 
            --color-green: #76ff03;  
            --color-blue: #2979ff;   
            --color-purple: #ea80fc; 
            --color-gold: #ffb300;   
            --color-orange: #ff6d00; 
            --color-rainbow: linear-gradient(90deg, #ff80ab, #ffeb3b, #69f0ae, #40c4ff, #e040fb);

            /* 动态背景变量默认值 */
            --scene-bg: linear-gradient(to bottom, #0f2027, #203a43, #2c5364);
            --orb-color: #fff;
            --orb-shadow: 0 0 40px #fff, 0 0 80px #b3e5fc;
            --mt-color-1: #080808;
            --mt-color-2: #111;
            --fog-opacity: 0.3;
        }

        /* 天赋标签样式 */
        .skill-tag.talent {
            background: #006064; /* 深青色背景 */
            border-color: #00bcd4; /* 青色边框 */
            color: #e0f7fa;
            font-weight: bold;
            box-shadow: 0 0 5px #00bcd4;
        }

        * { box-sizing: border-box; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; /* 加上这句，禁止双击缩放延迟 */}

        html, body {
            font-family: "Microsoft YaHei", sans-serif;
            background-color: #000;
            color: #ddd;
            margin: 0; padding: 0;
            position: fixed; top: 0; left: 0; right: 0; bottom: 0;
            width: 100%; height: 100%;
            overflow: hidden;
            overscroll-behavior: none; 
            /* 【修改】只禁止双击缩放，允许双指缩放和滚动 */
            touch-action: manipulation; 
        }

        #game-app {
            width: 100%; height: 100%;
            max-width: none; max-height: none; 
            background: var(--bg-color);
            position: relative;
            display: flex; flex-direction: column;
            margin: 0;
            /* 【修改】同上 */
            touch-action: manipulation; 
        }

    /* =========================================
       🏰 副本系统 - 旗舰版 UI (最终修正)
       ========================================= */

    /* 1. 弹窗容器：强制 Flex 居中 (解决左上角问题) */
    #dungeon-setup-modal.modal-overlay {
        display: none; /* JS控制显隐 */
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.85);
        z-index: 5000;
        /* 🔥 核心：上下左右居中 */
        justify-content: center; 
        align-items: center;
        flex-direction: column;
    }

    /* 2. 弹窗主体 */
    #dungeon-setup-modal .modal-content {
        width: 95%; 
        max-width: 480px; /* 电脑端不至于太宽 */
        max-height: 90vh; /* 防止超出一屏 */
        background: #1e1e1e;
        border: 1px solid #FFD700; /* 金色边框 */
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.15);
        border-radius: 12px;
        padding: 0;
        display: flex; flex-direction: column;
        overflow: hidden;
        color: #fff;
        position: relative;
    }

    /* 3. 标题栏容器 (负责显示底纹和边框) */
    .dungeon-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 18px; /* 这里的 padding 撑开高度 */
        background: linear-gradient(180deg, #2a2a2a 0%, #1e1e1e 100%); /* 背景移到这里 */
        border-bottom: 1px solid #333; /* 边框移到这里 */
        margin-bottom: 10px; /* 保持原来的下间距 */
    }

    /* 标题文字 (只负责文字样式，去掉背景) */
    #dungeon-setup-modal h2 {
        margin: 0;
        padding: 0;       /* 去掉内边距 */
        background: none; /* 去掉背景 */
        border: none;     /* 去掉边框 */
        
        /* 保持原来的文字效果 */
        color: #FFD700;
        font-size: 18px;
        letter-spacing: 2px;
        text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    }

    /* 4. 滚动内容区 */
    .dungeon-scroll-body {
        flex: 1; /* 自动撑开高度 */
        overflow-y: auto; /* 只有这里滚动 */
        padding: 15px;
        background: #121212;
    }

    /* 5. 底部按钮栏 (双按钮布局) */
    .dungeon-footer {
        padding: 12px 15px;
        background: #1e1e1e;
        border-top: 1px solid #333;
        display: flex; gap: 10px;
        justify-content: center;
    }

    /* 按钮通用样式 */
    .btn-dungeon-action {
        flex: 1; /* 平分宽度 */
        border: none; border-radius: 6px;
        padding: 12px 0;
        font-size: 16px; font-weight: bold;
        cursor: pointer; color: #fff;
        display: flex; align-items: center; justify-content: center; gap: 5px;
        box-shadow: 0 4px 6px rgba(0,0,0,0.3);
        transition: transform 0.1s;
    }
    .btn-dungeon-action:active { transform: scale(0.96); }

    /* 红色取消按钮 */
    .btn-action-cancel {
        background: linear-gradient(180deg, #d32f2f 0%, #b71c1c 100%);
        border: 1px solid #e57373;
    }
    /* 绿色确认按钮 */
    .btn-action-confirm {
        background: linear-gradient(180deg, #2e7d32 0%, #1b5e20 100%);
        border: 1px solid #66bb6a;
    }

    /* 模式卡片 (优化版) */
    .dungeon-mode-card {
        background: #252525; border: 1px solid #444;
        padding: 15px; margin-bottom: 12px;
        border-radius: 8px;
        display: flex; align-items: center;
        cursor: pointer; position: relative;
    }
    .dungeon-mode-card:hover { border-color: #FFD700; background: #303030; }
    
    /* 选人网格 */
    #dungeon-pick-container {
        display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px; padding-bottom: 10px;
    }

    /* 人物卡片 (适配 skins) */
    .pick-card {
        background: #222; border: 1px solid #444; border-radius: 6px;
        aspect-ratio: 0.75; /* 竖长方形 */
        position: relative; cursor: pointer;
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        overflow: hidden;
    }
    /* 立绘容器修正 */
    .pick-card .pc-visual { 
        flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; 
        font-size: 28px; /* Emoji 默认大小 */
        overflow: hidden;
    }
    /* 让图片/HTML立绘自适应 */
    .pick-card .pc-visual img, 
    .pick-card .pc-visual .visual-huang-container,
    .pick-card .pc-visual .visual-yideng-container { 
        transform: scale(0.8); transform-origin: center; 
    }

    .pick-card.selected { border: 2px solid #00e676; box-shadow: 0 0 10px rgba(0, 230, 118, 0.2); }
    .pick-card.selected::after {
        content: '✔'; position: absolute; top: 2px; right: 2px;
        background: #00e676; color: #000; font-size: 10px; font-weight: bold;
        width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    }
    .pick-card.dead { filter: grayscale(100%); opacity: 0.4; }

        /* 进度条内部颜色 */
        .hp-bar-mini div { background: #4caf50; height: 100%; }
        .mp-bar-mini div { background: #2196f3; height: 100%; }

        /* --- 顶部 --- */
        header {
            background: #222; padding: 0 
            px; display: flex; justify-content: space-between; border-bottom: 1px solid #333; align-items: center; flex-shrink: 0; height: 45px; 
            z-index: 200; position: relative;
        }
        .header-title { color: var(--highlight); font-weight: bold; font-size: 16px; letter-spacing: 1px; display:flex; align-items:center; gap:10px;}
        .header-status { font-size: 12px; color: #888; display:flex; gap:10px; align-items:center;}
        
        #cloud-status {
            font-size: 10px; padding: 2px 6px; border-radius: 4px; background: #333; color: #666; transition: 0.3s;
        }
        #cloud-status.saving { color: #fff; background: #e65100; animation: pulse-cloud 1s infinite; }
        #cloud-status.synced { color: #fff; background: #2e7d32; }
        @keyframes pulse-cloud { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

        .icon-btn { cursor: pointer; padding: 2px 6px; border-radius: 4px; background: #333; border: 1px solid #555; font-size: 14px; min-width: 28px; text-align: center; }
        .icon-btn:active { transform: scale(0.95); background: #555; }

        /* 顶部右侧工具栏容器 */
        .header-right {
            display: flex; 
            align-items: center; 
            gap: 12px; /* 各个功能块之间的间距 */
        }
        
        /* --- 动态仙侠背景系统 --- */
        #dynamic-bg-container {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            z-index: 0; overflow: hidden; pointer-events: none;
            background: var(--scene-bg);
            transition: background 1.5s ease;
        }
        #custom-bg-layer {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            z-index: 4; 
            background-size: cover; background-position: center;
            display: none; pointer-events: none;
        }

        .orb {
            position: absolute; top: 50px; right: 50px; width: 80px; height: 80px;
            background: var(--orb-color); border-radius: 50%;
            box-shadow: var(--orb-shadow);
            opacity: 0.8; transition: all 1.5s ease;
        }
        .mountain {
            position: absolute; bottom: 0; width: 100%; height: 40%;
            background: var(--mt-color-1);
            clip-path: polygon(0% 100%, 0% 20%, 20% 60%, 40% 10%, 60% 50%, 80% 20%, 100% 60%, 100% 100%);
            opacity: 0.6; z-index: 1; transition: background 1.5s ease;
        }
        .mountain.layer2 {
            height: 30%; background: var(--mt-color-2); z-index: 2;
            clip-path: polygon(0% 100%, 15% 30%, 35% 60%, 60% 20%, 85% 50%, 100% 10%, 100% 100%);
            opacity: 0.8;
        }
        .fog-container {
            position: absolute; bottom: 0; left: 0; width: 100%; height: 100%;
            z-index: 3; pointer-events: none;
        }
        .fog {
            position: absolute; width: 200%; height: 100%;
            background: url('https://raw.githubusercontent.com/danielstuart14/CSS_FOG_ANIMATION/master/fog1.png') repeat-x;
            background-size: contain;
            animation: fogAnim 60s linear infinite;
            opacity: var(--fog-opacity); bottom: 0;
        }
        .fog.two {
            background: url('https://raw.githubusercontent.com/danielstuart14/CSS_FOG_ANIMATION/master/fog2.png') repeat-x;
            animation: fogAnim 40s linear infinite reverse;
            bottom: 50px; opacity: 0.2;
        }
        @keyframes fogAnim { 0% { transform: translate3d(0,0,0); } 100% { transform: translate3d(-50%,0,0); } }



        /* --- PC端 UI面板 --- */
        #ui-panel { 
            height: 180px; background: var(--panel-bg); border-top: 1px solid #444; 
            display: flex; padding: 10px; gap: 8px; flex-shrink: 0; 
            z-index: 200; position: relative;
        }
        #current-actor-name { position: relative; z-index: 210; text-shadow: 1px 1px 2px #000; }
        #log-box { 
            flex: 1; background: #111; border: 1px solid #333; padding: 6px; 
            font-size: 12px; font-family: monospace; overflow-y: auto; color: #aaa; line-height: 1.5; 
        }
        .log-exp { color: #69f0ae; }
        .log-death { color: #ef5350; font-weight: bold; }
        .log-rare { color: var(--rare-color); font-weight: bold; }
        .log-god { color: #ff5252; font-weight: bold; border: 1px solid #ff5252; padding: 1px 2px; }
        .log-sys { color: #ff3d00; font-weight: bold; border-left: 2px solid #ff3d00; padding-left:4px; }

        /* 1. 默认样式（移动端优先） */
        #heal-area {
            margin-bottom: 5px; /* 手机上保持 5px */
        }

        /* 2. PC 端样式（当屏幕宽度大于 768px 时） */
        @media screen and (min-width: 768px) {
            #heal-area {
                margin-bottom: 60px; /* 电脑大屏变成 60px */
            }
        }
        
        /* PC端按钮区加宽 */
        #actions-box { width: 260px; display: flex; flex-direction: column; gap: 6px; justify-content: center; flex-shrink: 0;}
        .action-row { display: flex; gap: 4px; width: 100%;}
        
        button { 
            flex: 1; padding: 12px 0; border: none; border-radius: 4px; 
            font-weight: bold; cursor: pointer; color: white; font-size: 16px; 
            position: relative; transition: 0.1s; white-space: nowrap;
            text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
        }        
        button:active { transform: scale(0.96); }
        button:disabled { background: #444 !important; color: #777 !important; cursor: not-allowed; filter: grayscale(100%);pointer-events: none;border-color: #555 !important;box-shadow: none !important; }
        
        .btn-atk { background: #b71c1c; }
        .btn-skill { background: #4a148c; }
        .btn-def { background: #0d47a1; }
        .btn-cap { background: #e65100; }
        .btn-manage { background: #1b5e20; }
        .btn-auto { background: #f57f17; color: #fff; }
        .btn-auto.active { background: #ff3d00; animation: pulse-btn 1s infinite; }
        
        .btn-cancel { background: #444; border: 1px solid #666; color: #ccc; width: 100%; margin-top: 4px;}

        /* --- 弹窗通用 --- */
        #game-over-screen {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.95); z-index: 3000; display: none;
            flex-direction: column; justify-content: center; align-items: center; color: #fff; text-align: center;
        }
        #game-over-screen h1 { color: #d32f2f; font-size: 36px; margin-bottom: 20px; text-shadow: 0 0 10px red;}
        #btn-restart { padding: 12px 30px; font-size: 18px; background: #388e3c; color: white; border: none; border-radius: 5px; cursor: pointer; }
        
        #loading-screen {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background: #111; z-index: 4000; display: flex;
            flex-direction: column; justify-content: center; align-items: center; color: #fff; text-align: center;
        }
        .loader {
            border: 4px solid #333; border-top: 4px solid var(--highlight);
            border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin-bottom: 20px;
        }

        .modal-overlay {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.95); z-index: 3000; display: none;
            flex-direction: column; justify-content: center; align-items: center; color: #fff;
        }
        .modal-input {
            background: #222; color: #fff; border: 1px solid #555; 
            padding: 10px; font-size: 16px; width: 80%; max-width: 300px; margin-bottom: 15px; text-align: center;
        }

        #custom-modal-overlay {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.8); z-index: 3500; display: none;
            justify-content: center; align-items: center;
        }
        .custom-modal-box {
            background: #2d2d2d; border: 1px solid #555; padding: 20px; border-radius: 8px;
            width: 80%; max-width: 320px; text-align: center; box-shadow: 0 0 20px #000;
        }
        .custom-modal-msg { color: #eee; font-size: 15px; margin-bottom: 20px; line-height: 1.5; }
        .custom-modal-btns { display: flex; gap: 10px; justify-content: center; }
        .custom-modal-btn { padding: 8px 20px; border-radius: 4px; border:none; cursor: pointer; font-weight: bold;}
        .btn-confirm { background: #2e7d32; color: white; }
        .btn-cancel-modal { background: #d32f2f; color: white; }
        .btn-ok { background: #1976d2; color: white; width: 100px;}

        #mode-options-container {
            display: flex; gap: 30px; justify-content: center; align-items: center; width: 90%; max-width: 500px;
        }
        .mode-card {
            background: #2a2a2a; border: 2px solid #444; border-radius: 12px; padding: 30px;
            display: flex; flex-direction: column; align-items: center; cursor: pointer;
            transition: 0.2s; width: 140px; box-shadow: 0 4px 10px rgba(0,0,0,0.5);
        }
        .mode-card:hover { border-color: var(--highlight); background: #333; transform: scale(1.05); box-shadow: 0 0 15px var(--highlight); }
        .mode-icon { font-size: 50px; margin-bottom: 15px; }
        .mode-title { font-weight: bold; margin-bottom: 8px; color: #fff; font-size: 16px; }
        .mode-desc { font-size: 12px; color: #888; text-align: center; }

        /* 技能选择菜单 */
        #skill-select-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.8); z-index: 5000; display: none; 
            justify-content: center; align-items: center; flex-direction: column;
        }
        .skill-select-box {
            background: #2d2d2d; border: 1px solid #666; border-radius: 8px;
            padding: 15px; width: 80%; max-width: 300px;
            display: flex; flex-direction: column; gap: 10px; box-shadow: 0 0 20px rgba(0,0,0,0.9);
        }
        .skill-select-title {
            color: var(--highlight); font-size: 16px; font-weight: bold; text-align: center; 
            margin-bottom: 5px; border-bottom: 1px solid #444; padding-bottom: 8px;
        }
        .skill-select-btn {
            background: #333; color: #ddd; border: 1px solid #444; padding: 12px;
            border-radius: 4px; cursor: pointer; font-size: 14px;
            display: flex; justify-content: space-between; align-items: center; transition: 0.2s;
        }
        .skill-select-btn:active { transform: scale(0.98); background: #444; }
        .skill-select-btn:hover { border-color: var(--highlight); color: #fff; background: #444; }
        .skill-select-cost { font-size: 12px; color: #2196f3; font-weight: bold; }
        .skill-select-cancel {
            background: #d32f2f; color: white; text-align: center; justify-content: center; margin-top: 5px;
        }
/* 琅环玉洞入口按钮 */
.langhuan-entry-btn {
    /* === 核心修复：强制改为自适应宽度 === */
    width: auto !important;      /* 强制取消 100% 宽度 */
    min-width: 0 !important;     /* 取消最小宽度限制 */
    display: inline-block !important; /* 防止变成块级元素撑满一行 */
    flex: none;                  /* 防止被父级 flex 容器拉伸 */
    
    /* === 外观样式 === */
    background: linear-gradient(135deg, #00695c, #004d40);
    border: 1px solid #4db6ac;
    color: #e0f2f1;
    padding: 4px 10px;           /* 紧凑内边距 */
    font-size: 12px;             /* 小字体 */
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    transition: all 0.3s;
    white-space: nowrap;         /* 禁止文字换行 */
    margin-left: 10px;           /* 离左边标题稍微远一点 */
}

/* 灰色状态（未解锁） */
.langhuan-entry-btn.disabled {
    background: #424242;
    border: 1px solid #616161;
    color: #9e9e9e;
    filter: none;
    opacity: 0.8;
}

/* 悬停效果 */
.langhuan-entry-btn:not(.disabled):hover {
    filter: brightness(1.2);
    transform: translateY(-1px);
}
.langhuan-entry-btn:active {
    transform: scale(0.95);
}

/* 商品卡片样式 */
.langhuan-item-card {
    background: #3e2723;
    border: 1px solid #5d4037;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    position: relative;
    transition: transform 0.2s;
}
.langhuan-item-card:hover {
    transform: translateY(-2px);
    border-color: #FFD700;
}
.langhuan-item-icon {
    font-size: 32px;
    margin-bottom: 5px;
}
.langhuan-item-name {
    font-size: 12px;
    color: #FFD700;
    font-weight: bold;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.langhuan-item-cost {
    font-size: 11px;
    color: #ccc;
    background: rgba(0,0,0,0.3);
    padding: 2px 6px;
    border-radius: 10px;
    display: inline-block;
}
.langhuan-exchange-btn {
    margin-top: 8px;
    width: 100%;
    background: #ffb300;
    color: #3e2723;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    padding: 4px 0;
    cursor: pointer;
    font-weight: bold;
}
.langhuan-exchange-btn:disabled {
    background: #616161;
    color: #9e9e9e;
    cursor: not-allowed;
}
/* 真气图标/文字容器 */
#current-actor-name span {
    display: inline-block;
    vertical-align: middle;
}

/* 技能选择列表里的真气消耗行 */
.skill-select-btn div {
    line-height: 1.2;
}