/* ===================================================================
   RPG 图形模式 - 场景视图样式
   非破坏式：仅 #rpg-scene 及其后代；文字模式 (#main-split) 不受影响
   =================================================================== */

/* ---------- 主容器 ---------- */
#rpg-scene {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: #0a0e17;
    color: #e8eaed;
    font-family: 'HanYiZhongYuan', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    /* RPG 派生色板：跟随主题 --accent-color，BUFF 胶囊 / 边框等据此变色（缺省回退紫色） */
    --rpg-btn-border: var(--accent-color, #8b5cf6);
    --rpg-card-bg2: color-mix(in srgb, var(--accent-color, #8b5cf6) 18%, transparent);
    --rpg-accent-dim: color-mix(in srgb, var(--accent-color, #8b5cf6) 62%, #ffffff);
}
#rpg-scene[hidden],
#rpg-scene.is-hidden {
    display: none !important;
}

/* 顶部切换按钮（header 内兄弟） */
#rpg-toggle-btn {
    margin-left: auto;
    padding: 2px 10px;
    font-size: 12px;
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    height: 26px;
    flex-shrink: 0;
}
#rpg-toggle-btn:active {
    transform: scale(0.96);
}

/* ---------- 场景背景层 ---------- */
#scene-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image: url('../image/scene/base.jpg');
    background-size: cover;
    background-position: center;
    transition: opacity 0.4s ease;
    opacity: 1;
}
#scene-bg.fading {
    opacity: 0;
}
/* 主题背景图：main_h5.js 的 changeTheme() 设置 #scene-bg[data-theme]，与 data-scene 色调叠加共存 */
#scene-bg[data-theme="theme-ink"]   { background-image: url('../image/scene/theme-ink.png'); }
#scene-bg[data-theme="theme-paper"] { background-image: url('../image/scene/theme-paper.png'); }
#scene-bg[data-theme="theme-ocean"] { background-image: url('../image/scene/theme-ocean.png'); }
#scene-bg[data-theme="theme-forest"]{ background-image: url('../image/scene/theme-forest.png'); }
#scene-bg[data-theme="theme-royal"] { background-image: url('../image/scene/theme-royal.png'); }
/* theme-dark 与默认主题共用 base.jpg（本身就是暗夜场景图） */
/* 场景标题条（叠在背景顶部） */
#scene-title-bar {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    padding: 6px 10px;
    background: linear-gradient(180deg, rgba(0,0,0,0.65), rgba(0,0,0,0.15));
    text-align: center;
    border-bottom: 1px solid rgba(139,92,246,0.25);
}
#scene-title-text {
    font-size: 14px;
    font-weight: 600;
    color: #fde68a;
    letter-spacing: 2px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}

/* ---------- 场景前景舞台（玩家卡 + NPC卡） ---------- */
#scene-stage {
    position: relative;
    z-index: 1;
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 6px;
    padding: 8px;
}
/* 底部渐变压暗，保证卡片可读 */
#scene-stage::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,0.55) 100%);
    z-index: 0;
}
#scene-stage > * {
    position: relative;
    z-index: 1;
}

/* ---------- 玩家卡片 ---------- */
.player-card {
    position: relative; /* 飘字伤害锚点 */
    flex-shrink: 0;
    width: 108px;
    padding: 6px;
    border-radius: 10px;
    background: rgba(15,20,35,0.72);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(139,92,246,0.45);
    box-shadow: 0 4px 14px rgba(0,0,0,0.5);
}
/* 玩家 / NPC 卡 debuff 标记（虚/冰/封/异）：警示色固定红系，不随主题（debuff 就该醒目） */
.rpg-debuff-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3px;
    margin-top: 4px;
}
.rpg-debuff-tag {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 10px;
    line-height: 1.6;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    border: 1px solid rgba(255,255,255,0.28);
    box-shadow: 0 0 6px rgba(239,68,68,0.55);
    animation: rpg-debuff-pulse 1.2s ease-in-out infinite;
}
@keyframes rpg-debuff-pulse {
    0%, 100% { box-shadow: 0 0 4px rgba(239,68,68,0.4); }
    50%      { box-shadow: 0 0 10px rgba(239,68,68,0.95); }
}
.player-avatar {
    width: 44px;
    height: 44px;
    margin: 0 auto 4px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #8b5cf6;
    background: #1a2332;
    animation: player-avatar-glow 2s ease-in-out infinite;
}
@keyframes player-avatar-glow {
    0%, 100% { border-color: #8b5cf6; box-shadow: 0 0 4px rgba(139,92,246,0.5); }
    50%      { border-color: #f0abfc; box-shadow: 0 0 12px rgba(240,171,252,0.95); }
}
/* 忙乱状态：头像框闪红色 */
.player-avatar.avatar-busy {
    animation: avatar-busy-pulse 0.8s ease-in-out infinite;
}
@keyframes avatar-busy-pulse {
    0%, 100% { border-color: #ef4444; box-shadow: 0 0 4px rgba(239,68,68,0.5); }
    50%      { border-color: #fca5a5; box-shadow: 0 0 14px rgba(239,68,68,0.95); }
}
/* 中毒状态：头像框闪绿色 */
.player-avatar.avatar-poison {
    animation: avatar-poison-pulse 0.8s ease-in-out infinite;
}
@keyframes avatar-poison-pulse {
    0%, 100% { border-color: #22c55e; box-shadow: 0 0 4px rgba(34,197,94,0.5); }
    50%      { border-color: #86efac; box-shadow: 0 0 14px rgba(34,197,94,0.95); }
}
.player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.player-name {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-level {
    text-align: center;
    font-size: 10px;
    color: #94a3b8;
    margin-bottom: 4px;
}
.bar-row {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 3px;
}
.bar-label {
    font-size: 9px;
    width: 14px;
    color: #cbd5e1;
    flex-shrink: 0;
}
.bar-track {
    flex: 1;
    height: 6px;
    background: rgba(0,0,0,0.55);
    border-radius: 3px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}
.bar-hp .bar-fill { background: linear-gradient(90deg, #ef4444, #f87171); }
.bar-mp .bar-fill { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.bar-exp .bar-fill { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

/* ---------- NPC 卡片 ---------- */
.npc-cards {
    display: flex;
    flex-wrap: nowrap;              /* 单行不换行，超出横向滚动 */
    align-items: flex-end;
    justify-content: flex-start;
    gap: 6px;
    flex: 1;
    max-height: 100%;
    overflow-x: auto;               /* 横向滚动查看后面的 NPC */
    overflow-y: hidden;
    padding: 2px;
    -webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
    scrollbar-width: thin;          /* Firefox 细滚动条 */
    cursor: grab;                   /* 提示可拖拽 */
    user-select: none;              /* 拖拽时避免误选文字 */
}
.npc-cards.dragging { cursor: grabbing; }
.npc-cards::-webkit-scrollbar { width: 4px; height: 4px; }
.npc-cards::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.4); border-radius: 2px; }

.npc-card {
    position: relative;
    flex: 0 0 auto;                 /* 禁止 flex 压缩，保证宽度稳定，超宽走横向滚动 */
    width: 70px;
    padding: 5px 4px;
    border-radius: 8px;
    background: rgba(15,20,35,0.72);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(239,68,68,0.35);
    box-shadow: 0 3px 10px rgba(0,0,0,0.5);
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
    animation: rpg-card-in 0.3s ease-out;
}
.npc-card:active {
    transform: scale(0.94);
    border-color: #fbbf24;
}
.npc-card.untargetable {
    border-color: rgba(148,163,184,0.35);
}
.npc-card.targeted {
    border-color: #fbbf24;
    box-shadow: 0 0 12px rgba(251,191,36,0.5);
}
.npc-avatar {
    width: 40px;
    height: 40px;
    margin: 0 auto 3px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #ef4444;
    background: #1a2332;
}
.npc-card.untargetable .npc-avatar { border-color: #64748b; }
.npc-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
/* 无真实头像时的 Emoji 头像 */
.avatar-emoji {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 24px;
    line-height: 1;
}
.player-avatar .avatar-emoji { font-size: 26px; }
.npc-card.nonliving .avatar-emoji { filter: grayscale(0.5); opacity: 0.8; }
@media (max-width: 768px) {
    .player-avatar .avatar-emoji { font-size: 20px; }
    .npc-avatar .avatar-emoji { font-size: 17px; }
}
.npc-name {
    font-size: 10px;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.npc-hp-bar,
.npc-jing-bar {
    height: 5px;
    margin-top: 3px;
    background: rgba(0,0,0,0.6);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}
.npc-hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #dc2626, #ef4444);
    transition: width 0.35s ease;
    width: 100%;
}
.npc-jing-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    transition: width 0.35s ease;
    width: 100%;
}
.npc-card .npc-hp-bar.hidden,
.npc-card .npc-jing-bar.hidden {
    display: none;
}
/* 非活物（物品）：头像灰显，不显示血条 */
.npc-card.nonliving {
    cursor: default;
    border-color: rgba(100,116,139,0.3);
    opacity: 0.85;
}
.npc-card.nonliving .npc-avatar {
    border-color: #64748b;
    filter: grayscale(0.5);
}

/* ---------- 导航盘 ---------- */
#nav-panel {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(0,0,0,0.55);
    border-top: 1px solid rgba(139,92,246,0.25);
}
.nav-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 34px);
    gap: 3px;
    flex-shrink: 0;
    width: 180px;
}
.nav-btn {
    border: 1px solid rgba(139,92,246,0.4);
    background: rgba(30,40,60,0.8);
    color: #e8eaed;
    border-radius: 5px;
    font-size: 11px;
    line-height: 1.1;
    cursor: pointer;
    padding: 2px 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    transition: background 0.15s, transform 0.1s;
}
.nav-btn.center {
    border-color: #06b6d4;
    background: linear-gradient(135deg, #06b6d4, #8b5cf6);
    color: #fff;
}
.nav-btn:not([disabled]):active {
    transform: scale(0.9);
    background: #8b5cf6;
}
.nav-btn[disabled] {
    opacity: 0.2;
    cursor: default;
    background: rgba(30,30,30,0.5);
    border-color: rgba(100,100,100,0.3);
}
.nav-other {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
    align-content: center;
}
.nav-other:empty { display: none; }
/* 九宫格旁动作区（action_list：建房/建帮/打开/拾取等）3 列，与九宫格同宽 */
.nav-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    flex-shrink: 0;
    width: 180px;
    align-content: center;
}
.nav-actions:empty { display: none; }
.nav-act-btn {
    border: 1px solid rgba(139,92,246,0.4);
    background: rgba(30,40,60,0.8);
    color: #e8eaed;
    border-radius: 5px;
    font-size: 11px;
    line-height: 1.1;
    cursor: pointer;
    padding: 3px 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    transition: background 0.15s, transform 0.1s;
}
.nav-act-btn:active {
    transform: scale(0.9);
    background: #8b5cf6;
}
.nav-other-btn {
    padding: 3px 8px;
    font-size: 11px;
    border: 1px solid rgba(139,92,246,0.4);
    background: rgba(30,40,60,0.8);
    color: #e8eaed;
    border-radius: 5px;
    cursor: pointer;
}
.nav-other-btn:active { background: #8b5cf6; transform: scale(0.94); }

/* ---------- 动作栏 ---------- */
.action-bar {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    display: flex;
    gap: 4px;
    padding: 4px 8px;
    overflow-x: auto;
    background: rgba(0,0,0,0.6);
    border-top: 1px solid rgba(51,51,51,0.6);
    scrollbar-width: none;
}
.action-bar::-webkit-scrollbar { display: none; }
.action-bar .action-btn {
    flex-shrink: 0;
    padding: 4px 10px;
    font-size: 11px;
    min-width: auto;
}

/* ---------- 可折叠日志（置于场景顶部） ---------- */
#rpg-log-panel {
    position: relative;
    z-index: 3;
    flex-shrink: 0;
    width: 100%;
    background: rgba(0,0,0,0.7);
    border-bottom: 1px solid rgba(139,92,246,0.25);
    display: flex;
    flex-direction: column;
    max-height: 34%;
}
#rpg-log-handle {
    padding: 4px 10px;
    font-size: 11px;
    color: #94a3b8;
    cursor: pointer;
    background: rgba(20,25,40,0.8);
    user-select: none;
    flex-shrink: 0;
}
#rpg-log-handle:active { background: rgba(40,45,65,0.9); }
#rpg-log {
    overflow-y: auto;
    padding: 4px 8px;
    font-size: 11px;
    line-height: 1.5;
    color: #cbd5e1;
    max-height: 150px;
    transition: max-height 0.25s ease;
}
#rpg-log-panel.collapsed #rpg-log {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
}
/* 房间动作按钮区（战斗日志下方）：横向排列，可横向滚动 */
#rpg-room-actions:empty { display: none; }
#rpg-room-actions {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    background: rgba(15,18,30,0.55);
    border-bottom: 1px solid rgba(139,92,246,0.15);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    max-height: 34px;
    white-space: nowrap;
}
.room-act-btn {
    border: 1px solid rgba(139,92,246,0.4);
    background: rgba(30,40,60,0.85);
    color: #d8b4fe;
    border-radius: 4px;
    font-size: 11px;
    padding: 3px 8px;
    cursor: pointer;
    transition: background 0.15s;
    flex: 0 0 auto;
    white-space: nowrap;
}
.room-act-btn:hover { background: rgba(88,58,160,0.6); }
@media (max-width: 768px) {
    #rpg-room-actions { max-height: 28px; padding: 2px 4px; }
    .room-act-btn { font-size: 10px; padding: 2px 6px; }
}
#rpg-log .out-msg {
    padding: 1px 0;
    word-break: break-word;
}
#rpg-log::-webkit-scrollbar { width: 4px; }
#rpg-log::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.4); border-radius: 2px; }

/* ---------- 飘字伤害 ----------
   数字用中文单位缩写（100兆/1.2亿/100京），字号小 + 中心锚定，保证不超出头像框
   注意：飘字动画用 JS 内联 transition 实现（不依赖 @keyframes），此处只保留基础定位样式 */
.damage-number {
    position: absolute;
    pointer-events: none;
    font-weight: bold;
    font-size: 12px;
    z-index: 10;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}
.damage-number.crit {
    font-size: 15px;
    color: #fde047;
    text-shadow: 0 0 8px rgba(251,191,36,0.9), 0 1px 3px rgba(0,0,0,0.9);
}
.damage-number.normal {
    color: #ffffff;
}
.damage-number.mega {
    font-size: 18px;
    font-weight: 900;
    color: #ffe066;
    white-space: nowrap;
    text-shadow: 0 0 8px rgba(255,180,0,0.95), 0 0 20px rgba(255,90,0,0.9), 0 2px 4px rgba(0,0,0,0.9);
}

/* ---------- 受击 / 死亡动画 ---------- */
.npc-card.hit-flash {
    animation: rpg-hit-flash 0.3s ease-out;
}
.npc-card.death-fade {
    animation: rpg-death-fade 0.6s ease-out forwards;
    pointer-events: none;
}
.player-card.hit-flash {
    animation: rpg-hit-flash 0.3s ease-out;
}

/* ---------- 关键帧 ---------- */
@keyframes rpg-card-in {
    from { opacity: 0; transform: translateY(8px) scale(0.92); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes rpg-hit-flash {
    0% { box-shadow: 0 3px 10px rgba(0,0,0,0.5); }
    50% { box-shadow: 0 0 18px rgba(239,68,68,0.95); background: rgba(239,68,68,0.35); }
    100% { box-shadow: 0 3px 10px rgba(0,0,0,0.5); }
}
@keyframes rpg-death-fade {
    0% { opacity: 1; transform: scale(1); filter: grayscale(0); }
    100% { opacity: 0; transform: scale(0.8) rotate(-8deg); filter: grayscale(1); }
}

/* ---------- 场景色调（data-scene 驱动，叠加在 base.jpg 上） ---------- */
#scene-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background: linear-gradient(180deg, rgba(10,14,23,0.25), rgba(10,14,23,0.55));
    transition: background 0.5s ease;
}
#scene-bg[data-scene="tavern"]::before   { background: linear-gradient(180deg, rgba(120,60,10,0.35), rgba(40,20,5,0.65)); }
#scene-bg[data-scene="forest"]::before   { background: linear-gradient(180deg, rgba(20,70,30,0.4),  rgba(8,30,12,0.7)); }
#scene-bg[data-scene="mountain"]::before { background: linear-gradient(180deg, rgba(60,75,95,0.4),  rgba(20,28,40,0.7)); }
#scene-bg[data-scene="city"]::before     { background: linear-gradient(180deg, rgba(80,60,50,0.35), rgba(25,20,18,0.65)); }
#scene-bg[data-scene="market"]::before   { background: linear-gradient(180deg, rgba(130,80,30,0.4), rgba(50,30,10,0.65)); }
#scene-bg[data-scene="cave"]::before     { background: linear-gradient(180deg, rgba(40,35,30,0.55), rgba(5,5,8,0.85)); }
#scene-bg[data-scene="river"]::before    { background: linear-gradient(180deg, rgba(20,70,110,0.4), rgba(8,30,50,0.7)); }
#scene-bg[data-scene="temple"]::before   { background: linear-gradient(180deg, rgba(130,40,30,0.4), rgba(50,15,10,0.65)); }
#scene-bg[data-scene="snow"]::before     { background: linear-gradient(180deg, rgba(180,200,220,0.4), rgba(120,140,170,0.6)); }
#scene-bg[data-scene="desert"]::before   { background: linear-gradient(180deg, rgba(200,150,60,0.4), rgba(120,80,20,0.6)); }
#scene-bg[data-scene="palace"]::before   { background: linear-gradient(180deg, rgba(140,90,30,0.4), rgba(60,40,80,0.65)); }
#scene-bg[data-scene="night"]::before    { background: linear-gradient(180deg, rgba(20,20,50,0.45), rgba(8,8,20,0.78)); }

/* 浅色主题背景图：减轻暗化叠加，让水墨/羊皮纸画面通透 */
#scene-bg[data-theme="theme-ink"]::before,
#scene-bg[data-theme="theme-paper"]::before {
    background: linear-gradient(180deg, rgba(10,14,23,0.12), rgba(10,14,23,0.42));
}
#scene-bg[data-theme="theme-ink"][data-scene="cave"]::before,
#scene-bg[data-theme="theme-ink"][data-scene="night"]::before,
#scene-bg[data-theme="theme-paper"][data-scene="cave"]::before,
#scene-bg[data-theme="theme-paper"][data-scene="night"]::before {
    background: linear-gradient(180deg, rgba(10,14,23,0.35), rgba(10,14,23,0.68));
}

/* ===================================================================
   主题场景配色（#rpg-scene[data-theme] 由 main_h5.js 的 changeTheme() 设置）
   浅色主题：白/米色半透明卡片 + 深色文字；深色主题：同色系深底 + 亮边框
   =================================================================== */

/* ---------- 水墨江湖（浅色） ---------- */
#rpg-scene[data-theme="theme-ink"] { color: #1a1a1a; }
#rpg-scene[data-theme="theme-ink"] #scene-bg { background-color: #f5f1e6; }
#rpg-scene[data-theme="theme-ink"] #scene-title-bar {
    background: linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255,255,255,0.25));
    border-bottom: 1px solid rgba(0,0,0,0.6);
}
#rpg-scene[data-theme="theme-ink"] #scene-title-text { color: #111; text-shadow: 0 1px 3px rgba(255,255,255,0.7); }
#rpg-scene[data-theme="theme-ink"] .player-card,
#rpg-scene[data-theme="theme-ink"] .npc-card {
    background: rgba(255,255,255,0.82);
    border-color: rgba(0,0,0,0.55);
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}
#rpg-scene[data-theme="theme-ink"] .player-name,
#rpg-scene[data-theme="theme-ink"] .npc-name { color: #111; }
#rpg-scene[data-theme="theme-ink"] .player-level,
#rpg-scene[data-theme="theme-ink"] .bar-label { color: #444; }
#rpg-scene[data-theme="theme-ink"] .bar-track { background: rgba(0,0,0,0.18); }
#rpg-scene[data-theme="theme-ink"] .player-avatar,
#rpg-scene[data-theme="theme-ink"] .npc-avatar { background: #f0ece4; border-color: #b71c1c; }
#rpg-scene[data-theme="theme-ink"] #nav-panel,
#rpg-scene[data-theme="theme-ink"] .action-bar,
#rpg-scene[data-theme="theme-ink"] #rpg-log-panel,
#rpg-scene[data-theme="theme-ink"] #rpg-room-actions {
    background: rgba(255,255,255,0.85);
    border-color: rgba(0,0,0,0.4);
}
#rpg-scene[data-theme="theme-ink"] #rpg-log-handle { background: rgba(240,236,228,0.9); color: #333; }
#rpg-scene[data-theme="theme-ink"] #rpg-log { color: #222; }
#rpg-scene[data-theme="theme-ink"] .nav-btn,
#rpg-scene[data-theme="theme-ink"] .nav-other-btn,
#rpg-scene[data-theme="theme-ink"] .room-act-btn {
    border-color: rgba(0,0,0,0.45);
    background: rgba(255,255,255,0.9);
    color: #111;
}
#rpg-scene[data-theme="theme-ink"] .nav-btn:not([disabled]):active,
#rpg-scene[data-theme="theme-ink"] .nav-other-btn:active,
#rpg-scene[data-theme="theme-ink"] .room-act-btn:hover { background: rgba(183,28,28,0.15); }
#rpg-scene[data-theme="theme-ink"] .nav-btn.center {
    border-color: #b71c1c;
    background: linear-gradient(135deg, #b71c1c, #7f1d1d);
    color: #fff;
}
#rpg-scene[data-theme="theme-ink"] #scene-stage::after {
    background: linear-gradient(180deg, rgba(0,0,0,0.06) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,0.28) 100%);
}
#rpg-scene[data-theme="theme-ink"] .damage-number.normal { color: #111; }

/* ---------- 羊皮古卷（浅色暖黄） ---------- */
#rpg-scene[data-theme="theme-paper"] { color: #3e2c14; }
#rpg-scene[data-theme="theme-paper"] #scene-bg { background-color: #efe3c2; }
#rpg-scene[data-theme="theme-paper"] #scene-title-bar {
    background: linear-gradient(180deg, rgba(244,229,196,0.92), rgba(244,229,196,0.3));
    border-bottom: 1px solid rgba(122,88,44,0.6);
}
#rpg-scene[data-theme="theme-paper"] #scene-title-text { color: #4a3209; text-shadow: 0 1px 3px rgba(255,255,255,0.6); }
#rpg-scene[data-theme="theme-paper"] .player-card,
#rpg-scene[data-theme="theme-paper"] .npc-card {
    background: rgba(248,235,205,0.88);
    border-color: rgba(122,88,44,0.6);
    box-shadow: 0 4px 14px rgba(80,50,10,0.3);
}
#rpg-scene[data-theme="theme-paper"] .player-name,
#rpg-scene[data-theme="theme-paper"] .npc-name { color: #3e2c14; }
#rpg-scene[data-theme="theme-paper"] .player-level,
#rpg-scene[data-theme="theme-paper"] .bar-label { color: #6b5320; }
#rpg-scene[data-theme="theme-paper"] .bar-track { background: rgba(80,50,10,0.2); }
#rpg-scene[data-theme="theme-paper"] .player-avatar,
#rpg-scene[data-theme="theme-paper"] .npc-avatar { background: #f2e3c0; border-color: #8b5a2b; }
#rpg-scene[data-theme="theme-paper"] #nav-panel,
#rpg-scene[data-theme="theme-paper"] .action-bar,
#rpg-scene[data-theme="theme-paper"] #rpg-log-panel,
#rpg-scene[data-theme="theme-paper"] #rpg-room-actions {
    background: rgba(248,235,205,0.9);
    border-color: rgba(122,88,44,0.45);
}
#rpg-scene[data-theme="theme-paper"] #rpg-log-handle { background: rgba(240,222,186,0.92); color: #5a4410; }
#rpg-scene[data-theme="theme-paper"] #rpg-log { color: #4a3a14; }
#rpg-scene[data-theme="theme-paper"] .nav-btn,
#rpg-scene[data-theme="theme-paper"] .nav-other-btn,
#rpg-scene[data-theme="theme-paper"] .room-act-btn {
    border-color: rgba(122,88,44,0.55);
    background: rgba(255,246,222,0.92);
    color: #4a3209;
}
#rpg-scene[data-theme="theme-paper"] .nav-btn:not([disabled]):active,
#rpg-scene[data-theme="theme-paper"] .nav-other-btn:active,
#rpg-scene[data-theme="theme-paper"] .room-act-btn:hover { background: rgba(139,90,43,0.2); }
#rpg-scene[data-theme="theme-paper"] .nav-btn.center {
    border-color: #8b5a2b;
    background: linear-gradient(135deg, #8b5a2b, #a4763e);
    color: #fff;
}
#rpg-scene[data-theme="theme-paper"] #scene-stage::after {
    background: linear-gradient(180deg, rgba(0,0,0,0.06) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,0.3) 100%);
}
#rpg-scene[data-theme="theme-paper"] .damage-number.normal { color: #2c1c06; }

/* ---------- 深邃暗夜（深紫，默认风格的紫强化） ---------- */
#rpg-scene[data-theme="theme-dark"] #scene-title-bar {
    background: linear-gradient(180deg, rgba(10,10,20,0.75), rgba(10,10,20,0.2));
    border-bottom: 1px solid rgba(124,77,255,0.3);
}
#rpg-scene[data-theme="theme-dark"] .player-card,
#rpg-scene[data-theme="theme-dark"] .npc-card {
    background: rgba(12,12,20,0.78);
    border-color: rgba(124,77,255,0.5);
}
#rpg-scene[data-theme="theme-dark"] .player-avatar,
#rpg-scene[data-theme="theme-dark"] .npc-avatar { border-color: #7c4dff; }
#rpg-scene[data-theme="theme-dark"] #nav-panel,
#rpg-scene[data-theme="theme-dark"] #rpg-log-panel {
    background: rgba(8,8,16,0.8);
    border-color: rgba(124,77,255,0.3);
}
#rpg-scene[data-theme="theme-dark"] .nav-btn,
#rpg-scene[data-theme="theme-dark"] .nav-other-btn,
#rpg-scene[data-theme="theme-dark"] .room-act-btn {
    border-color: rgba(124,77,255,0.5);
    background: rgba(25,25,40,0.85);
    color: #d8d8ff;
}

/* ---------- 碧海潮生（深蓝青） ---------- */
#rpg-scene[data-theme="theme-ocean"] #scene-title-bar {
    background: linear-gradient(180deg, rgba(4,30,54,0.8), rgba(4,30,54,0.25));
    border-bottom: 1px solid rgba(56,189,248,0.4);
}
#rpg-scene[data-theme="theme-ocean"] #scene-title-text { color: #7dd3fc; }
#rpg-scene[data-theme="theme-ocean"] .player-card,
#rpg-scene[data-theme="theme-ocean"] .npc-card {
    background: rgba(6,34,60,0.78);
    border-color: rgba(56,189,248,0.5);
}
#rpg-scene[data-theme="theme-ocean"] .player-avatar,
#rpg-scene[data-theme="theme-ocean"] .npc-avatar { border-color: #38bdf8; }
#rpg-scene[data-theme="theme-ocean"] #nav-panel,
#rpg-scene[data-theme="theme-ocean"] .action-bar,
#rpg-scene[data-theme="theme-ocean"] #rpg-log-panel,
#rpg-scene[data-theme="theme-ocean"] #rpg-room-actions {
    background: rgba(3,24,44,0.82);
    border-color: rgba(56,189,248,0.35);
}
#rpg-scene[data-theme="theme-ocean"] #rpg-log-handle { background: rgba(8,45,80,0.85); color: #a5d8ff; }
#rpg-scene[data-theme="theme-ocean"] #rpg-log { color: #cfe9ff; }
#rpg-scene[data-theme="theme-ocean"] .nav-btn,
#rpg-scene[data-theme="theme-ocean"] .nav-other-btn,
#rpg-scene[data-theme="theme-ocean"] .room-act-btn {
    border-color: rgba(56,189,248,0.5);
    background: rgba(10,55,95,0.85);
    color: #d6f0ff;
}
#rpg-scene[data-theme="theme-ocean"] .nav-btn:not([disabled]):active,
#rpg-scene[data-theme="theme-ocean"] .nav-other-btn:active { background: #0ea5e9; }
#rpg-scene[data-theme="theme-ocean"] .nav-btn.center {
    border-color: #38bdf8;
    background: linear-gradient(135deg, #0ea5e9, #0369a1);
    color: #fff;
}

/* ---------- 青葱岁月（深绿） ---------- */
#rpg-scene[data-theme="theme-forest"] #scene-title-bar {
    background: linear-gradient(180deg, rgba(6,40,22,0.8), rgba(6,40,22,0.25));
    border-bottom: 1px solid rgba(74,222,128,0.4);
}
#rpg-scene[data-theme="theme-forest"] #scene-title-text { color: #86efac; }
#rpg-scene[data-theme="theme-forest"] .player-card,
#rpg-scene[data-theme="theme-forest"] .npc-card {
    background: rgba(8,45,25,0.78);
    border-color: rgba(74,222,128,0.5);
}
#rpg-scene[data-theme="theme-forest"] .player-avatar,
#rpg-scene[data-theme="theme-forest"] .npc-avatar { border-color: #4ade80; }
#rpg-scene[data-theme="theme-forest"] #nav-panel,
#rpg-scene[data-theme="theme-forest"] .action-bar,
#rpg-scene[data-theme="theme-forest"] #rpg-log-panel,
#rpg-scene[data-theme="theme-forest"] #rpg-room-actions {
    background: rgba(4,32,17,0.82);
    border-color: rgba(74,222,128,0.35);
}
#rpg-scene[data-theme="theme-forest"] #rpg-log-handle { background: rgba(10,60,32,0.85); color: #b9f6ca; }
#rpg-scene[data-theme="theme-forest"] #rpg-log { color: #d7f5dd; }
#rpg-scene[data-theme="theme-forest"] .nav-btn,
#rpg-scene[data-theme="theme-forest"] .nav-other-btn,
#rpg-scene[data-theme="theme-forest"] .room-act-btn {
    border-color: rgba(74,222,128,0.5);
    background: rgba(12,60,34,0.85);
    color: #e0fbe6;
}
#rpg-scene[data-theme="theme-forest"] .nav-btn:not([disabled]):active,
#rpg-scene[data-theme="theme-forest"] .nav-other-btn:active { background: #16a34a; }
#rpg-scene[data-theme="theme-forest"] .nav-btn.center {
    border-color: #4ade80;
    background: linear-gradient(135deg, #22c55e, #15803d);
    color: #fff;
}

/* ---------- 紫禁之巅（深红金） ---------- */
#rpg-scene[data-theme="theme-royal"] #scene-title-bar {
    background: linear-gradient(180deg, rgba(60,10,12,0.82), rgba(60,10,12,0.28));
    border-bottom: 1px solid rgba(251,191,36,0.5);
}
#rpg-scene[data-theme="theme-royal"] #scene-title-text { color: #fde68a; }
#rpg-scene[data-theme="theme-royal"] .player-card,
#rpg-scene[data-theme="theme-royal"] .npc-card {
    background: rgba(64,12,14,0.8);
    border-color: rgba(251,191,36,0.55);
}
#rpg-scene[data-theme="theme-royal"] .player-avatar,
#rpg-scene[data-theme="theme-royal"] .npc-avatar { border-color: #fbbf24; }
#rpg-scene[data-theme="theme-royal"] #nav-panel,
#rpg-scene[data-theme="theme-royal"] .action-bar,
#rpg-scene[data-theme="theme-royal"] #rpg-log-panel,
#rpg-scene[data-theme="theme-royal"] #rpg-room-actions {
    background: rgba(52,8,10,0.85);
    border-color: rgba(251,191,36,0.4);
}
#rpg-scene[data-theme="theme-royal"] #rpg-log-handle { background: rgba(90,18,20,0.88); color: #fcd34d; }
#rpg-scene[data-theme="theme-royal"] #rpg-log { color: #fde8b0; }
#rpg-scene[data-theme="theme-royal"] .nav-btn,
#rpg-scene[data-theme="theme-royal"] .nav-other-btn,
#rpg-scene[data-theme="theme-royal"] .room-act-btn {
    border-color: rgba(251,191,36,0.55);
    background: rgba(85,16,18,0.88);
    color: #fde8b0;
}
#rpg-scene[data-theme="theme-royal"] .nav-btn:not([disabled]):active,
#rpg-scene[data-theme="theme-royal"] .nav-other-btn:active { background: #b45309; }
#rpg-scene[data-theme="theme-royal"] .nav-btn.center {
    border-color: #fbbf24;
    background: linear-gradient(135deg, #d97706, #92400e);
    color: #fff;
}

/* ---------- 移动端竖屏适配 ---------- */
@media (max-width: 768px) {
    #scene-title-text { font-size: 13px; letter-spacing: 1px; }
    /* 玩家卡：紧凑 */
    .player-card { width: 86px; padding: 4px; }
    .player-avatar { width: 34px; height: 34px; }
    .player-name { font-size: 10px; }
    .player-level { font-size: 8px; }
    .bar-row { height: 7px; }
    .bar-label { font-size: 8px; width: 10px; }
    /* NPC 卡：小巧多列 */
    .npc-card { width: 52px; padding: 3px 2px; }
    .npc-avatar { width: 30px; height: 30px; }
    .npc-name { font-size: 8px; }
    .npc-card .npc-hp-bar,
    .npc-card .npc-jing-bar { height: 3px; margin-top: 2px; }
    .npc-cards { gap: 3px; }
    #nav-panel { flex-wrap: wrap; }
    .nav-pad { width: 130px; grid-template-rows: repeat(3, 26px); gap: 2px; }
    .nav-actions { width: 130px; gap: 2px; }
    .nav-act-btn { font-size: 9px; padding: 2px 1px; }
    .nav-btn { font-size: 9px; padding: 1px 2px; }
    .action-bar .action-btn { padding: 3px 7px; font-size: 10px; }
    /* 战斗日志：默认折叠，标题更紧凑 */
    #rpg-log-panel:not(.force-open) { max-height: 26px; }
    #rpg-log-panel:not(.force-open) #rpg-log { max-height: 0; padding: 0 6px; }
    #rpg-log { font-size: 10px; max-height: 90px; padding: 3px 6px; }
    #rpg-log-handle { padding: 3px 8px; font-size: 10px; }
    .damage-number { font-size: 11px; }
    .damage-number.crit { font-size: 13px; }
    .damage-number.mega { font-size: 15px; }
}
