/* 圖片是獨立全幅底層；人物、投牌區、手牌、角落HUD各自定位。 */
body.card-skin .battle.actor-layout-v13.compact-combat-v14.fan-battle-v15.resource-hud-v16.reference-layout-v17{display:block;position:relative;width:100%;height:100svh;min-height:0;overflow:clip;background:#0b1723;isolation:isolate}
.battle-backdrop{position:absolute;inset:0;z-index:-2;pointer-events:none;background:#0b1723;overflow:hidden}.scene-image{width:100%;height:100%;display:block;object-fit:cover;pointer-events:none}
.battle-backdrop::after{content:'';position:absolute;inset:0;background:linear-gradient(#0814211c 35%,#06101c05 62%,#04101e61);pointer-events:none}
.reference-layout-v17.scene-ready .city{display:none}
.reference-layout-v17 .topbar{position:absolute;inset:0 0 auto;height:44px;z-index:80;background:#0a1723d9;border-bottom:1px solid #9fc7cf30;display:flex;justify-content:space-between}
.reference-layout-v17 .brand{max-width:42%;min-width:0}.reference-layout-v17 .brand-mark,.reference-layout-v17 .brand>div:not(.player-summary){display:none}
.player-summary{display:flex;align-items:center;gap:18px;min-width:0;color:#ecf4f2}.header-player-name{font-size:13px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.header-player-hp{font-size:14px;font-weight:750;color:#fff0cf;white-space:nowrap}
.reference-layout-v17 .turn{position:absolute;left:50%;transform:translateX(-50%);font-size:11px;gap:7px}.reference-layout-v17 .top-actions{margin-left:auto}
.reference-layout-v17 .arena{position:absolute;inset:44px 0 auto;height:calc(72svh - 44px);overflow:visible;z-index:1;pointer-events:none;background:transparent}
.reference-layout-v17 .combatant,.reference-layout-v17 .arena:has(.duel-intent) .combatant.enemy{position:absolute;top:calc(67svh - 232px)!important;bottom:auto!important;width:min(280px,26%);height:266px;grid-template-rows:18px 170px 28px 50px;pointer-events:auto}
.reference-layout-v17 .combatant.player{left:calc(25% - min(140px,13%))}.reference-layout-v17 .combatant.enemy,.reference-layout-v17 .arena:has(.duel-intent) .combatant.enemy{right:calc(25% - min(140px,13%));left:auto}
.reference-layout-v17 .actor-orbit-stage{height:170px;width:100%}.reference-layout-v17 .figure-target{height:170px!important}.reference-layout-v17 .figure-target .figure{height:170px;max-height:170px}
.reference-layout-v17 .actor-meters{width:100%;max-width:220px}.reference-layout-v17 .actor-effects-dock{height:50px}.reference-layout-v17 .compact-intent-icon{top:-42px}
.battle-drop-surface{position:absolute;left:0;right:0;top:44px;height:calc(58svh - 44px);z-index:40;pointer-events:none}
.reference-layout-v17 .hand-zone{position:absolute;left:22%;right:22%;top:55svh;bottom:auto;height:45svh;min-height:0;z-index:10;border:0;background:transparent;pointer-events:none}
.reference-layout-v17 .hand-area{height:100%}.reference-layout-v17 .hand-window{inset:0!important;overflow:visible!important;pointer-events:none}.reference-layout-v17 .hand{pointer-events:none}.reference-layout-v17 .hand>.card{pointer-events:auto}
.reference-layout-v17 .hand-meta{position:absolute;left:0;right:90px;top:calc(24svh - 38px);height:32px;padding:3px 0;font-size:10px;color:#e4eef1;text-shadow:0 1px 3px #000;pointer-events:none}
.reference-layout-v17 .hand-nav{top:calc(24svh - 44px);right:0;pointer-events:auto;background:#10233175;border-radius:8px}
body.card-skin .compact-combat-v14.reference-layout-v17.fan-desktop .hand>.card.card-face.fan-active{top:var(--fan-open-y,0);height:var(--fan-open-h,306px);width:248px!important;grid-template-rows:34px var(--compact-art-height,100px) 20px minmax(72px,1fr) auto 20px 18px}
.reference-layout-v17 .bottom-bar{position:absolute;inset:0;z-index:30;display:block;height:100%;padding:0;border:0;background:transparent;pointer-events:none;isolation:auto}
.reference-layout-v17 .bottom-bar .energy-panel{position:absolute;left:calc(10svw - 52px);top:min(calc(82svh - 52px),calc(100svh - 202px));margin:0;pointer-events:auto}
.reference-layout-v17 .bottom-bar .zones{display:contents}
.reference-layout-v17 .bottom-bar .zones .pile-control{position:absolute;width:96px;height:84px;padding:7px 5px;grid-template-columns:38px 27px;grid-template-rows:42px 20px;background:#102a38c9;pointer-events:auto}
.reference-layout-v17 .bottom-bar [data-zone=drawPile]{left:calc(5svw - 48px);bottom:8px}
.reference-layout-v17 .bottom-bar [data-zone=discardPile]{right:calc(5svw - 48px);bottom:8px}
.reference-layout-v17 .bottom-bar [data-zone=exhaustPile]{right:calc(5svw - 48px);bottom:106px}
.reference-layout-v17 #end-turn{position:absolute;left:calc(86svw - 56px);top:calc(81svh - 32px);width:112px;height:64px;pointer-events:auto}
.reference-layout-v17 .bottom-bar .pile-picture{width:36px;height:36px}.reference-layout-v17 .bottom-bar .pile-count{font-size:24px}
.scene-settings{border:1px solid #617e8b;border-radius:8px;margin:10px 0;padding:10px}.scene-settings label{display:flex;align-items:center;gap:10px}.scene-settings select{min-height:44px;font:inherit;color:#e8f1ef;background:#102b3b;padding:6px;border:1px solid #718f9c;border-radius:6px}.scene-settings p{font-size:12px;margin:8px 0;line-height:1.5}.scene-notice{position:absolute;left:50%;top:50px;transform:translateX(-50%);z-index:70;max-width:calc(100% - 16px);padding:8px 12px;border:1px solid #8aa6aa;border-radius:8px;background:#102b3bed;color:#eef6f4;font:12px/1.5 system-ui}.scene-notice[hidden]{display:none}.scene-notice button{margin-left:8px;min-height:44px;background:#244550;color:#fff;border:1px solid #91adb5;border-radius:5px;padding:4px 10px}
@media(max-width:999px) and (orientation:portrait){
 .reference-layout-v17{--portrait-hand-h:clamp(270px,calc(100svh - 490px),350px)}
 /* 直向等比cover後再裁去上緣，讓地面對齊較緊湊的人物區；不改圖片或拉伸。 */
 .reference-layout-v17 .scene-image{position:absolute;left:0;top:-440px;height:calc(100% + 440px);object-fit:cover}
 .reference-layout-v17 .topbar{height:40px;padding:0 8px}.reference-layout-v17 .brand{max-width:43%}.player-summary{display:block;line-height:1.2}.header-player-name{display:block;font-size:10px;max-width:140px}.header-player-hp{font-size:10px}.reference-layout-v17 .turn{font-size:9px;gap:4px}.reference-layout-v17 .turn-dot{display:none}
 .reference-layout-v17 .arena{top:40px;height:calc(100svh - 164px - var(--portrait-hand-h))}
 .reference-layout-v17 .combatant,.reference-layout-v17 .arena:has(.duel-intent) .combatant.enemy{top:calc(100svh - 340px - var(--portrait-hand-h))!important;width:calc(50% - 20px);height:198px;grid-template-rows:14px 110px 24px 50px}
 .reference-layout-v17 .combatant.player{left:10px}.reference-layout-v17 .combatant.enemy,.reference-layout-v17 .arena:has(.duel-intent) .combatant.enemy{right:10px}
 .reference-layout-v17 .actor-orbit-stage{height:110px}.reference-layout-v17 .figure-target{height:108px!important}.reference-layout-v17 .figure-target .figure{height:108px;max-height:108px}.reference-layout-v17 .compact-intent-icon{top:-36px}
 .battle-drop-surface{top:40px;height:calc(100svh - 164px - var(--portrait-hand-h))}
 .reference-layout-v17 .hand-zone{left:8px;right:8px;top:auto;bottom:94px;height:var(--portrait-hand-h)}
 .reference-layout-v17 .hand-window{overflow-x:auto!important;overflow-y:hidden!important;pointer-events:auto}.reference-layout-v17 .hand{padding:5px 0 6px;min-width:100%;gap:8px;pointer-events:auto}
 .reference-layout-v17 .hand-meta{top:-30px;height:28px;font-size:10px}.reference-layout-v17 .hand-nav{top:-44px;height:44px;right:0}
 .reference-layout-v17 .bottom-bar{inset:auto 0 0;height:88px;padding:0 5px;display:grid;grid-template-columns:76px minmax(0,1fr);grid-template-rows:44px 44px;gap:0 5px}
 .reference-layout-v17 .bottom-bar .energy-panel{position:static;grid-column:1;grid-row:1/3;justify-self:center;margin:0}
 .reference-layout-v17 .bottom-bar .zones{display:grid;grid-column:2;grid-row:1;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px}
 .reference-layout-v17 .bottom-bar .zones .pile-control{position:static;width:100%;height:44px;padding:1px 2px;grid-template-columns:26px minmax(0,auto);grid-template-rows:25px 14px;column-gap:1px;border-radius:7px}
 .reference-layout-v17 .bottom-bar .zones .pile-picture{width:24px;height:24px}.reference-layout-v17 .bottom-bar .zones .pile-count{font-size:19px}
 .reference-layout-v17 #end-turn{position:static;grid-column:2;grid-row:2;width:100%;height:40px;align-self:center}
}
@media(max-width:999px) and (orientation:landscape){
 .reference-layout-v17 .topbar{height:40px}.reference-layout-v17 .brand{max-width:40%}.player-summary{gap:8px}.header-player-name,.header-player-hp{font-size:10px}.reference-layout-v17 .turn{font-size:9px}
 .reference-layout-v17 .arena{top:40px;height:calc(65svh - 40px)}
 .reference-layout-v17 .combatant,.reference-layout-v17 .arena:has(.duel-intent) .combatant.enemy{top:calc(60svh - 164px)!important;width:160px;height:188px;grid-template-rows:14px 110px 20px 44px}
 .reference-layout-v17 .combatant.player{left:calc(25% - 80px)}.reference-layout-v17 .combatant.enemy,.reference-layout-v17 .arena:has(.duel-intent) .combatant.enemy{right:calc(25% - 80px)}
 .reference-layout-v17 .actor-orbit-stage{height:110px}.reference-layout-v17 .figure-target{height:108px!important}.reference-layout-v17 .figure-target .figure{height:108px;max-height:108px}.reference-layout-v17 .actor-effects-dock,.reference-layout-v17 .compact-effect-dock{height:44px}.reference-layout-v17 .compact-intent-icon{top:-34px}
 .battle-drop-surface{left:32%;right:0;top:40px;height:calc(64svh - 40px)}
 .reference-layout-v17 .hand-zone{left:30%;right:30%;top:72svh;bottom:auto;height:28svh}
 .reference-layout-v17 .hand-window{overflow-x:auto!important;overflow-y:hidden!important;pointer-events:auto}.reference-layout-v17 .hand{padding:5px 0 0;gap:8px;pointer-events:auto}
 body.card-skin .compact-combat-v14.reference-layout-v17 .hand>.card.card-face{width:160px!important;min-width:160px;height:100%;overflow:hidden;grid-template-rows:32px var(--compact-art-height,70px) 18px minmax(66px,1fr) auto 18px 16px}
 body.card-skin .compact-combat-v14.reference-layout-v17 .hand>.card.card-face.fan-active{position:fixed;left:calc(50svw - 112px);top:48px;width:224px!important;height:calc(100svh - 56px);max-width:none;overflow:visible;z-index:60;grid-template-rows:32px var(--compact-art-height,70px) 18px minmax(72px,1fr) auto 18px 16px}
 .reference-layout-v17 .hand-meta{top:-30px;height:28px;font-size:9px}.reference-layout-v17 .hand-nav{top:-40px;height:40px;right:0;width:80px}.reference-layout-v17 .hand-nav button{width:40px}
 .reference-layout-v17 .bottom-bar .energy-panel{left:calc(10svw - 35px);top:calc(70svh - 35px)}
 .reference-layout-v17 .bottom-bar .zones .pile-control{width:70px;height:52px;padding:3px;grid-template-columns:26px 22px;grid-template-rows:25px 17px;border-radius:8px}
 .reference-layout-v17 .bottom-bar .zones .pile-picture{width:24px;height:24px}.reference-layout-v17 .bottom-bar .zones .pile-name{font-size:10px}.reference-layout-v17 .bottom-bar .zones .pile-count{font-size:18px}
 .reference-layout-v17 .bottom-bar [data-zone=drawPile]{left:calc(5svw - 35px);bottom:6px}.reference-layout-v17 .bottom-bar [data-zone=discardPile]{right:calc(5svw - 35px);bottom:6px}.reference-layout-v17 .bottom-bar [data-zone=exhaustPile]{right:calc(5svw - 35px);bottom:130px}
 .reference-layout-v17 #end-turn{left:calc(86svw - 48px);top:calc(78svh - 22px);width:96px;height:44px}
}
