/* 10-08 礦洞關卡＋材料探險戰鬥照稿重排（只動版面；數值、規則全沿用原本） */

/* ── 礦洞關卡：全景地圖上一排礦洞卡 ── */
body[data-ui-version="3"] .cave-board{position:relative;background:linear-gradient(#0b2a3d22,#0b2a3d55),url('../img/mining-park/mining-park-overview-v1.webp') center/cover}
body[data-ui-version="3"] .cave-board-heading h3{display:inline-flex;align-items:center;gap:8px;padding:4px 16px 4px 4px;border-radius:999px;background:linear-gradient(#1d5f94,#0f3d68);color:#fff;font-size:18px;box-shadow:0 2px 8px #0005;border:2px solid #fff}
body[data-ui-version="3"] .cave-board-badge{display:grid;place-items:center;width:34px;height:34px;border-radius:50%;background:#fff;color:#0f3d68;font-size:19px;line-height:1}
body[data-ui-version="3"] .cave-board-heading>span{padding:3px 10px;border-radius:999px;background:#ffffffd9;color:#173d55;font-weight:700}
body[data-ui-version="3"] .cave-zone-strip{grid-auto-columns:calc((100% - 20px)/3);gap:10px;padding:6px 3px 4px;align-items:end}
/* 礦洞之間的金色虛線路徑 */
body[data-ui-version="3"] .cave-zone-strip::before{content:"";position:absolute;left:0;right:0;top:calc(6px + 22%);border-top:4px dotted #ffd54a;filter:drop-shadow(0 0 4px #ffb300);pointer-events:none;z-index:0;width:max(100%,calc((100% + 10px)/3*5))}
body[data-ui-version="3"] .cave-zone-card{z-index:1;gap:4px;min-height:0;padding:0 6px 10px;overflow:visible;border:0;border-radius:16px;background:#fffffff2;box-shadow:0 4px 12px #0004;scroll-snap-align:start}
body[data-ui-version="3"] .cave-zone-card.is-on{box-shadow:0 0 0 3px #ffd54a,0 4px 14px #0006}
body[data-ui-version="3"] .cave-zone-scene{width:calc(100% + 12px);margin:0 -6px;height:auto;aspect-ratio:4/3;min-height:0;border-radius:16px 16px 0 0}
body[data-ui-version="3"] .cave-zone-level{position:relative;z-index:2;margin-top:-16px;padding:3px 12px;font-size:13px;border:2px solid #fff;box-shadow:0 2px 6px #0004;background:linear-gradient(#1d5f94,#0f3d68);white-space:nowrap}
body[data-ui-version="3"] .cave-zone-card>strong{font-size:17px;line-height:1.2}
body[data-ui-version="3"] .cave-zone-card>small{font-size:11px;padding:0}
body[data-ui-version="3"] .cave-zone-gain{font-style:normal;font-size:11px;color:#345567}
body[data-ui-version="3"] .cave-zone-materials{gap:5px;flex-wrap:nowrap;margin-top:2px;padding:0}
body[data-ui-version="3"] .cave-zone-materials>span{padding:3px;border-radius:9px;background:#e8eef2;box-shadow:inset 0 0 0 1px #c9d6de}
body[data-ui-version="3"] .cave-zone-materials .inv-art{width:30px;height:30px}
body[data-ui-version="3"] .cave-zone-materials small{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
@media(max-width:899px){
body[data-ui-version="3"] .cave-zone-strip{grid-auto-columns:calc((100% - 20px)/3)}
}
@media(max-width:420px){
body[data-ui-version="3"] .cave-zone-card{padding:0 3px 8px}
body[data-ui-version="3"] .cave-zone-scene{width:calc(100% + 6px);margin:0 -3px}
body[data-ui-version="3"] .cave-zone-card>strong{font-size:15px}
body[data-ui-version="3"] .cave-zone-level{font-size:11px;padding:2px 7px}
body[data-ui-version="3"] .cave-zone-materials{gap:3px}
body[data-ui-version="3"] .cave-zone-materials>span{padding:2px}
body[data-ui-version="3"] .cave-zone-materials .inv-art{width:24px;height:24px}
body[data-ui-version="3"] .cave-zone-gain,body[data-ui-version="3"] .cave-zone-card>small{font-size:10px}
}
@media(min-width:900px){
body[data-ui-version="3"] .cave-zone-strip{grid-auto-columns:calc((100% - 40px)/5)}
}

/* ── 材料探險戰鬥：舞台 HUD 疊層 ── */
.ex-hud{position:relative;flex-shrink:0}
.ex-hud>.cs-stage{margin:0}
.ex-hud-tl,.ex-hud-tr,.ex-hud-me{position:absolute;z-index:6;pointer-events:none}
.ex-hud-tl{left:6px;top:6px;display:grid;justify-items:start;gap:4px;max-width:58%}
.ex-hud-title{display:inline-flex;align-items:center;gap:6px;padding:2px 12px 2px 2px;border-radius:999px;background:linear-gradient(#1d5f94,#0f3d68);border:2px solid #fff;color:#fff;font-weight:800;font-size:13px;box-shadow:0 2px 6px #0006}
.ex-hud-title b{display:grid;place-items:center;width:24px;height:24px;border-radius:50%;background:#fff;color:#0f3d68;font-size:14px}
.ex-hud-stage{padding:2px 10px;border-radius:8px;background:#0d1b24cc;color:#fff;font-size:12px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.ex-hud-tr{right:6px;top:6px;display:flex;align-items:center;gap:5px}
.ex-hud-wave,.ex-hud-loot{display:inline-flex;align-items:center;gap:3px;height:28px;padding:0 9px;border-radius:999px;background:#0d1b24cc;color:#fff;font-weight:800;font-size:13px;border:1px solid #ffffff55}
.ex-hud-loot b{font-size:14px}
.ex-hud-pause{pointer-events:auto;display:grid;place-items:center;width:32px;height:32px;padding:0;border-radius:50%;border:2px solid #fff;background:#0d1b24dd;color:#fff;font-size:11px;letter-spacing:-1px;cursor:pointer}
.ex-hud-me{left:6px;bottom:6px;display:flex;align-items:center;gap:6px;padding:3px 8px 3px 3px;border-radius:14px;background:#0d1b24cc;border:1px solid #ffffff55;min-width:150px;max-width:62%}
.ex-hud-me>img{width:40px;height:40px;border-radius:50%;object-fit:cover;object-position:50% 12%;background:#fff;border:2px solid #fff;flex-shrink:0}
.ex-hud-me>div{display:grid;gap:2px;flex:1;min-width:0}
.ex-hud-me b{color:#fff;font-size:12px;line-height:1.1}
.ex-hud-me i{position:relative;display:block;height:13px;border-radius:7px;background:#000a;overflow:hidden}
.ex-hud-me i.is-mp{height:9px}
.ex-hud-me em{position:absolute;inset:0 auto 0 0;background:linear-gradient(#5fe08a,#21a356);transition:width .25s}
.ex-hud-me i.is-mp em{background:linear-gradient(#7fb6ff,#3b74d8)}
.ex-hud-me.is-low i.is-hp em{background:linear-gradient(#ff8a7a,#d8322a)}
.ex-hud-me span{position:relative;display:block;color:#fff;font:800 10px/13px system-ui,sans-serif;text-align:center;text-shadow:0 1px 0 #000}
.ex-hud-me i.is-mp span{font-size:8px;line-height:9px}
/* 怪物頭上 Lv */
.cs-mlv{position:absolute;left:22%;top:calc(14% - 17px);z-index:4;padding:0 6px;border-radius:6px;background:#000b;color:#fff;font:800 11px/16px system-ui,sans-serif}
/* 玩家 HP／MP 已移到舞台左下：上方文字列與怪物重複血條只留給讀屏 */
.ex-panel.is-combat .ex-cb-me>.ex-cb-stat.is-hp,.ex-panel.is-combat .ex-cb-me>.ex-cb-stat.is-mp,.ex-panel.is-combat .ex-cb-monster>.ex-cb-bar.is-hp{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.ex-panel.is-combat .ex-cb-me:not(:has(.ex-cb-stat:not(.is-hp):not(.is-mp))){display:none}

/* 下方：圓形行動鈕＋自動戰鬥開關卡 */
.ex-cb-actrow{display:flex;align-items:center;gap:8px}
body .ex-panel.is-combat .ex-cb-actrow>.ex-cb-four{flex:1;display:flex;justify-content:flex-start;gap:6px;min-width:0}
body .ex-panel.is-combat .ex-cb-four>.ex-cb-big{flex:0 0 auto;width:62px;height:62px;min-height:0;padding:0;border-radius:50%;align-content:center;gap:0;border:2px solid #ffffffaa;background:radial-gradient(circle at 35% 30%,#2b8fa0,#0a3c47);color:#fff;box-shadow:0 3px 8px #0005}
body .ex-panel.is-combat .ex-cb-four>.ex-cb-big b{font-size:22px}
body .ex-panel.is-combat .ex-cb-four>.ex-cb-big span{font-size:11px;line-height:1.1}
body .ex-panel.is-combat .ex-cb-four>.ex-cb-big.is-primary{background:radial-gradient(circle at 35% 30%,#ffd36b,#e0731d);border-color:#fff0ad;color:#201907}
.ex-cb-autocard{flex:0 0 auto;display:grid;grid-template-columns:auto auto;grid-template-rows:auto auto;align-items:center;column-gap:6px;row-gap:3px;padding:6px 10px;border-radius:14px;border:1px solid #c9d6de;background:#f4f8fa;color:#173b52;font:inherit;font-weight:800;font-size:12px;cursor:pointer;box-shadow:0 2px 6px #0003}
.ex-cb-autocard>b{grid-row:1/3;font-size:20px}
.ex-cb-autocard>i{position:relative;width:40px;height:22px;border-radius:11px;background:#b8c4cc;transition:background .2s}
.ex-cb-autocard>i::after{content:"";position:absolute;left:2px;top:2px;width:18px;height:18px;border-radius:50%;background:#fff;box-shadow:0 1px 3px #0005;transition:left .2s}
.ex-cb-autocard.is-on>i{background:#1fa3c4}
.ex-cb-autocard.is-on>i::after{left:20px}
/* 10-24 老闆：LV10 前顯示上鎖的自動戰鬥鈕，避免以為功能不見 */
.ex-cb-autocard.is-locked{cursor:not-allowed;opacity:.72;background:#e6ebee;color:#5b6b76}
.ex-cb-autocard.is-locked>small{font-size:10px;font-weight:700;color:#7a8a94}
@media(max-width:420px){
body .ex-panel.is-combat .ex-cb-four>.ex-cb-big{width:54px;height:54px}
body .ex-panel.is-combat .ex-cb-four>.ex-cb-big b{font-size:19px}
body .ex-panel.is-combat .ex-cb-four>.ex-cb-big span{font-size:10px}
.ex-cb-autocard{padding:5px 7px;font-size:11px}
.ex-hud-me{min-width:132px}
}
@media(prefers-reduced-motion:reduce){.ex-hud-me em,.ex-cb-autocard>i,.ex-cb-autocard>i::after{transition:none}}
/* 手機：舞台縮一點，讓左下玩家血量框不被中段捲動區裁掉 */
@media(max-width:899px){body .panel-home .player-sheet.is-combat .ex-panel.is-combat .ex-hud>.cs-stage{height:clamp(190px,24dvh,330px);min-height:190px}}
/* 怪物 Lv＋血條放在右上 HUD 下方，避免重疊 */
body .ex-hud>.cs-stage .cs-hpbar{left:auto;right:6px;top:62px;width:44%}
body .ex-hud>.cs-stage .cs-mlv{left:auto;right:calc(6px + 44%);transform:translateX(100%);top:42px}
/* Keep the small labels readable over bright mine backgrounds and later theme rules. */
body[data-ui-version="3"] .cs-stage .cs-mlv,
body[data-ui-version="3"] .cs-stage .cs-pet-name{background:#fff7dc!important;color:#38270c!important;border:1px solid #b88928!important;text-shadow:none!important;font-size:12px!important;font-weight:800!important;line-height:1.2!important;min-height:18px;display:inline-flex;align-items:center;justify-content:center}
body[data-ui-version="3"] .cs-stage .cs-hpbar{height:18px;background:#16202c;border-color:#fff8df}
body[data-ui-version="3"] .cs-stage .cs-hpbar>span{color:#fff!important;font-size:11px!important;line-height:16px!important;text-shadow:0 1px 2px #000!important}
body[data-ui-version="3"] .mine-battle .cs-monster .cs-mlv{top:8%!important}
body[data-ui-version="3"] .mine-battle .cs-monster .cs-hpbar{top:17%!important}
/* 3D actors replace only the character art; combat labels, HP and effects stay in place. */
.cs-player.has-model-3d>img[data-f],.cs-player.has-model-3d>.cs-tint,.cs-player.has-model-3d>.cs-held,.cs-pet.has-model-3d>img[data-a]{visibility:hidden!important}
.dgb-heroes .dgb-unit.has-model-3d>img{visibility:hidden!important}
.cs-player .model-3d-canvas,.cs-pet .model-3d-canvas,.dgb-unit .model-3d-canvas{z-index:1}
.team-combat-3d-hero,.team-combat-3d-pet{position:relative;display:block;flex:none;overflow:hidden}
.team-combat-3d-hero{width:clamp(48px,6vw,84px);height:90px}
.team-combat-3d-pet{width:32px;height:32px}
/* 10-08 老闆：每回合三選一武器＋戰鬥速度 x1／x2／x3 */
.ex-cb-picks{display:flex;align-items:stretch;gap:6px;margin:6px 0}
.ex-cb-picks>small{align-self:center;font-weight:800;font-size:11px;color:#173b52;writing-mode:vertical-rl;letter-spacing:1px}
.ex-cb-pick{flex:1;min-width:0;display:grid;justify-items:center;gap:1px;padding:5px 4px;border-radius:12px;border:2px solid #c9d6de;background:#f4f8fa;color:#173b52;font:inherit;cursor:pointer}
.ex-cb-pick b{font-size:20px;line-height:1}
.ex-cb-pick span{font-size:11px;font-weight:800;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ex-cb-pick small{font-size:10px;color:#4b6a7c}
.ex-cb-pick.is-on{border-color:#e0a21d;background:#fff6dc;box-shadow:0 0 0 2px #ffd54a55}
.ex-cb-pick[aria-disabled="true"]{opacity:.5}
.ex-cb-speed{flex:0 0 auto;width:44px;height:44px;border-radius:50%;border:2px solid #fff;background:#0d1b24dd;color:#ffd54a;font:900 14px/1 system-ui,sans-serif;cursor:pointer;box-shadow:0 2px 6px #0004}
/* 10-08：加了速度鈕後窄螢幕放不下，四顆圓鈕自成一排，自動戰鬥卡＋速度鈕排第二排 */
.ex-cb-actrow{flex-wrap:wrap;row-gap:6px}body .ex-panel.is-combat .ex-cb-actrow>.ex-cb-four{flex:1 0 100%;justify-content:space-between}
