/* v14.9 / v14.9b / v14.9c mobile HUD (phones, landscape). Everything here is scoped to body.mob — the desktop page is unchanged.
   v14.9c frames: ONE frame family = the deck v3.13 slot well (bronze, chamfered corners), corners cut to alpha (no leftover background):
     /v11/mobile/frame_oct.png (dark interior: panels, wells, inactive tabs) · frame_oct_red.png (deck red fabric interior: buttons, active tabs) · badge_c.png.
   Round buttons: GenerateImage (/v11/mobile/btn_*.png). Potion icons: GenerateImage (/v11/mobile/pot_*.png).
   Spacing rhythm: 6 px from the screen edges, 4 px between a block and its tabs (tabs sit flush on their block), 8 px between separate buttons. */
#mob{display:none}
body.mob{height:100dvh;overscroll-behavior:none;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}
body.mob #deck,body.mob #deckside,body.mob #hud{display:none!important}
body.mob #mob{display:block;position:fixed;inset:0;pointer-events:none;z-index:10;color:#f5ecd6;
  font-family:"Noto Sans TC","Noto Sans CJK TC","PingFang TC","Microsoft JhengHei",sans-serif;
  --sl:env(safe-area-inset-left,0px);--sr:env(safe-area-inset-right,0px);--st:env(safe-area-inset-top,0px);--sb:env(safe-area-inset-bottom,0px)}
#mob>*{position:absolute;pointer-events:auto}
#mob button{font:inherit;color:inherit;border:0;padding:0;margin:0;background:transparent;cursor:pointer;touch-action:manipulation}
#mob .tx,#mob span,#mob .ln{text-shadow:1px 0 rgba(16,10,6,.9),-1px 0 rgba(16,10,6,.9),0 1px rgba(16,10,6,.9),0 -1px rgba(16,10,6,.9)}
/* frames */
#mob .mvit,#mob .mtgt,#mob .mmap,#mob .mchat,#mob .mmenu .mgrid{border:10px solid transparent;border-image:url(/v11/mobile/frame_oct.png) 10 fill / 10px stretch;box-sizing:border-box}
#mob .mcell{border:8px solid transparent;border-image:url(/v11/mobile/frame_oct_red.png) 10 fill / 8px stretch;box-sizing:border-box;min-height:44px;min-width:44px;
  font-weight:700;font-size:15px;color:#e8c46e;display:flex;align-items:center;justify-content:center;white-space:nowrap;line-height:1}
#mob .mcell:active,#mob .mround:active,#mob .mslot:active,#mob .mtab:active,#mob .mpg:active{filter:brightness(1.3)}
/* bars (functional) */
#mob .mbar{position:relative;height:16px;background:rgba(10,6,4,.75);border-radius:3px;overflow:hidden}
#mob .mbar i{position:absolute;left:0;top:0;bottom:0;background-size:auto 100%;background-repeat:repeat-x}
#mob .mbar.hp i{background-image:url(/v11/deck/liq_hp.png);background-color:#8e1616}
#mob .mbar.mp i{background-image:url(/v11/deck/liq_mp.png);background-color:#1b4f9a}
#mob .mbar.thp i{background-image:url(/v11/deck/liq_hp.png);background-color:#8e1616}
#mob .mbar span{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;line-height:1}
/* top-left vitals */
#mob .mvit{left:calc(6px + var(--sl));top:calc(4px + var(--st));width:200px;height:68px;display:flex;align-items:center;gap:6px;padding:0}
#mob .mbadge{flex:0 0 42px;height:42px;background:url(/v11/mobile/badge_c.png) center/100% 100%;display:flex;align-items:center;justify-content:center}
#mob .mbadge b{font-size:18px;font-weight:700;text-shadow:1px 0 #100a06,-1px 0 #100a06,0 1px #100a06,0 -1px #100a06}
#mob .mvc{flex:1;display:flex;flex-direction:column;gap:2px;min-width:0}
#mob .mzone{font-size:12px;font-weight:700;color:#e8c46e;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:14px}
#mob .mvit .mbar{height:14px}
/* top-centre target (v14.9b: 換目標 moved to the thumb arc) */
#mob .mtgt{left:50%;top:calc(4px + var(--st));width:210px;height:56px;transform:translateX(-50%);display:flex;flex-direction:column;justify-content:center;gap:3px;padding:0 2px}
#mob .mtn{font-size:13px;font-weight:700;text-align:center;white-space:nowrap;overflow:hidden;line-height:15px}
/* top-right */
#mob .mmenub{right:calc(6px + var(--sr));top:calc(4px + var(--st));width:74px;height:44px}
#mob .msafe{right:calc(88px + var(--sr));top:calc(4px + var(--st));height:44px;display:flex;align-items:center;font-size:13px;font-weight:700;color:#d8ccb0;pointer-events:none;
  text-shadow:1px 0 #100a06,-1px 0 #100a06,0 1px #100a06,0 -1px #100a06}
#mob .msafe.on{color:#78d282}
#mob .mmap{right:calc(6px + var(--sr));top:calc(54px + var(--st));width:104px;height:84px;padding:0;pointer-events:none}
#mob .mmap canvas{border-radius:2px}
#mob .mmap canvas{width:100%;height:100%;display:block}
#mob .mbuffs{right:calc(6px + var(--sr));top:calc(142px + var(--st));max-width:150px;font-size:12px;font-weight:700;color:#9fe08f;text-align:right;pointer-events:none;
  text-shadow:1px 0 #100a06,-1px 0 #100a06,0 1px #100a06,0 -1px #100a06}
/* menu grid (9 items) */
#mob .mmenu{display:none;inset:0;background:rgba(8,5,3,.35);z-index:20}
#mob .mmenu.on{display:block}
#mob .mgrid{position:absolute;right:calc(10px + var(--sr));top:calc(54px + var(--st));display:grid;grid-template-columns:repeat(3,72px);gap:8px;padding:6px}
#mob .mgi{width:72px;height:64px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;font-size:13px;font-weight:700;color:#f5ecd6}
#mob .mgi img{width:39px;height:39px}
#mob .mmenu>.mx{position:absolute;right:calc(6px + var(--sr));top:calc(4px + var(--st));width:74px;height:44px;font-size:24px}
/* chat: 2 lines collapsed, tap = half screen with input */
#mob .mchat{left:calc(6px + var(--sl));bottom:calc(20px + var(--sb));width:38%;max-width:340px;height:58px;padding:0 4px;overflow:hidden}
#mob .mlog{font-size:12px;line-height:17px;height:100%;overflow:hidden;display:flex;flex-direction:column;justify-content:flex-end}
#mob .mlog .ln{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#mob .mcin,#mob .mchx{display:none}
#mob .mchat.open{width:min(50%,calc(100% - 409px - var(--sl) - var(--sr)));max-width:none;height:calc(50% - 10px);z-index:3;background:rgba(14,8,5,.6)}
#mob .mchat.open .mlog{height:calc(100% - 52px);overflow-y:auto;justify-content:flex-start;font-size:13px;line-height:19px;padding-right:44px;box-sizing:border-box}
#mob .mchat.open .mcin{display:flex;gap:6px;height:44px;margin-top:6px}
#mob .mcin input{flex:1;min-width:0;height:44px;box-sizing:border-box;background:rgba(10,6,4,.8);border:1px solid rgba(150,104,58,.8);color:#f5ecd6;font:16px "Noto Sans TC",sans-serif;padding:0 8px;outline:none}
#mob .mcin button{width:64px}
#mob .mchat.open .mchx{display:flex;position:absolute;right:0;top:0;width:44px;height:44px;font-size:22px}
/* v14.9c thumb zone (天堂M-style layout): 攻擊 84 px (centre right 62 / bottom 66 from the safe edges) + arc at radius 86:
   180° 撿取 (54) / 135° 換目標 (54) / 90° 治療藥水 key (58, potion icon + count). Quickslots: ONE framed bar, 4x2 wells of 50 px flush (no gaps),
   right edge 8 px left of the arc; page tabs 1/2/3 flush on the bar's top-left (like the desktop deck's 3 tabs). */
#mob .mround{background:url(/v11/mobile/btn_m.png) center/100% 100% no-repeat;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-direction:column;overflow:hidden}
#mob .matk{right:calc(20px + var(--sr));bottom:calc(24px + var(--sb));width:84px;height:84px;background-image:url(/v11/mobile/btn_l.png)}
#mob .matk span{font-size:20px;font-weight:700;color:#f5ecd6;letter-spacing:1px}
#mob .marc{width:54px;height:54px;background-image:url(/v11/mobile/btn_s.png)}
#mob .marc span{font-size:13px;font-weight:700;line-height:15px;color:#f5ecd6}
#mob .marc.a0{right:calc(121px + var(--sr));bottom:calc(39px + var(--sb))}
#mob .marc.a1{right:calc(96px + var(--sr));bottom:calc(100px + var(--sb))}
#mob .marc.a2{right:calc(33px + var(--sr));bottom:calc(123px + var(--sb));width:58px;height:58px}
#mob .mhpot{position:absolute}
#mob .mhpot .pi{width:36px;height:36px;margin-top:-6px;pointer-events:none;filter:drop-shadow(0 1px 1px rgba(0,0,0,.6))}
#mob .mhpot .nm{position:absolute;left:0;right:0;bottom:7px;font-size:10px;line-height:11px;color:#f5ecd6}
#mob .mhpot .ct{position:absolute;right:12px;top:11px;min-width:14px;font-size:12px;font-weight:700;line-height:13px;color:#ffe2a8;text-align:right}
#mob .mhpot.empty .pi{filter:grayscale(1) brightness(.55)}
#mob .mhpot.empty .nm,#mob .mhpot.empty .ct{color:#8a7a62}
#mob .cd{position:absolute;left:0;right:0;bottom:0;height:0;background:rgba(0,0,0,.55);pointer-events:none}
#mob .mqs{right:calc(183px + var(--sr));bottom:calc(20px + var(--sb));width:212px;height:112px;box-sizing:border-box;border:6px solid transparent;
  border-image:url(/v11/mobile/frame_oct_red.png) 10 fill / 6px stretch;display:grid;grid-template-columns:repeat(4,50px);grid-auto-rows:50px;gap:0}
#mob .mslot{position:relative;width:50px;height:50px;border:7px solid transparent;border-image:url(/v11/mobile/frame_oct.png) 10 fill / 7px stretch;box-sizing:border-box;
  display:flex;flex-direction:column;align-items:center;justify-content:center;overflow:hidden}
#mob .mslot .nm{font-size:12px;font-weight:700;line-height:13px;color:#f5ecd6}
#mob .mslot .ct{font-size:10px;color:#d8ccb0;line-height:11px}
#mob .mslot .ky{display:none}   /* phones have no F keys; the page tabs show the page */
#mob .mslot .si{display:none;position:absolute;left:50%;top:50%;width:34px;height:34px;transform:translate(-50%,-52%);pointer-events:none}
#mob .mslot.ic .si{display:block}
#mob .mslot.ic .nm{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}   /* icon slots: name kept for a11y / tests */
#mob .mslot.ic .ct{position:absolute;right:1px;bottom:0;z-index:1;font-size:11px;font-weight:700;color:#f5ecd6}
#mob .mslot.empty .nm{color:#8a7a62}
#mob .mslot.empty.ic .si{filter:grayscale(1) brightness(.55)}
#mob .mpages{right:calc(263px + var(--sr));bottom:calc(132px + var(--sb));display:flex;gap:0}
#mob .mpg{position:relative;width:44px;height:32px;border:6px solid transparent;border-image:url(/v11/mobile/frame_oct.png) 10 fill / 6px stretch;box-sizing:border-box;
  font-size:13px;font-weight:700;color:#9c8a6c;display:flex;align-items:center;justify-content:center;line-height:1}
#mob .mpg.on{border-image-source:url(/v11/mobile/frame_oct_red.png);color:#e8c46e}
/* chat tabs + quick phrases */
#mob .mctabs{left:calc(6px + var(--sl));bottom:calc(78px + var(--sb));display:flex;gap:0;pointer-events:none}
#mob .mtab{position:relative;pointer-events:auto;height:32px;min-width:56px;padding:0 10px;border:6px solid transparent;border-image:url(/v11/mobile/frame_oct.png) 10 fill / 6px stretch;box-sizing:border-box;
  font-size:13px;font-weight:700;color:#9c8a6c;display:flex;align-items:center;justify-content:center;line-height:1}
#mob .mtab.on{border-image-source:url(/v11/mobile/frame_oct_red.png);color:#e8c46e}
#mob .mtab.mqpb{color:#d8ccb0;min-width:64px}
body.mob.mchato #mob .mctabs{bottom:calc(50% + 10px)}
#mob .mqp{display:none;inset:0;background:rgba(8,5,3,.35);z-index:22}
#mob .mqp.on{display:block}
#mob .mqpl{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:grid;grid-template-columns:repeat(2,170px);gap:8px;padding:8px;
  border:10px solid transparent;border-image:url(/v11/mobile/frame_oct.png) 10 fill / 10px stretch}
#mob .mqi{height:44px;font-size:15px;color:#f5ecd6}
/* joystick on: chat (and its tabs) sit above the stick; open chat hides the stick */
body.mob.mjoy #mob .mchat:not(.open){bottom:calc(172px + var(--sb))}
body.mob.mjoy:not(.mchato) #mob .mctabs{bottom:calc(230px + var(--sb))}
body.mob.mchato #joy{display:none!important}
/* minimap -> big map overlay */
#mob .mmap{pointer-events:auto;cursor:pointer}
#mob .mbig{display:none;inset:0;background:rgba(8,5,3,.55);z-index:24}
#mob .mbig.on{display:block}
#mob .mbigf{position:absolute;left:calc(8px + var(--sl));right:calc(8px + var(--sr));top:calc(6px + var(--st));bottom:calc(6px + var(--sb));
  border:10px solid transparent;border-image:url(/v11/mobile/frame_oct.png) 10 fill / 10px stretch;box-sizing:border-box;display:flex;flex-direction:column}
#mob .mbigt{height:30px;line-height:30px;font-size:15px;font-weight:700;color:#e8c46e;text-align:center;flex:0 0 auto}
#mob .mbigf canvas{flex:1;min-height:0;width:100%;display:block}
#mob .mbigl{height:20px;font-size:12px;text-align:center;color:#d8ccb0;flex:0 0 auto}
#mob .mbig>.mbigx{position:absolute;right:calc(14px + var(--sr));top:calc(10px + var(--st));width:52px;height:44px;font-size:24px}
/* menu: 全螢幕 under the 9-item grid (hidden when standalone / unsupported, see mobile.js) */
#mob .mmenu>.mfs{position:absolute;right:calc(10px + var(--sr));top:calc(302px + var(--st));width:264px;height:44px}
/* full-width EXP bar */
#mob .mexp{left:0;right:0;bottom:0;height:calc(14px + var(--sb));background:#120b07;pointer-events:none}
#mob .mexp i{position:absolute;left:0;top:0;height:14px;background:url(/v11/deck/liq_exp.png) 0 0/auto 100% repeat-x #b48a2a}
#mob .mexp span{position:absolute;left:0;right:0;top:0;height:14px;display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;line-height:1}
/* death frame */
#mob .mdead{display:none;left:50%;top:40%;transform:translate(-50%,-50%);text-align:center;font-size:22px;font-weight:700;color:#f5ecd6}
#mob .mdead.on{display:block}
#mob .mdead .mcell{margin:10px auto 0;width:160px;height:56px;font-size:18px}
/* panels: one right-side panel ~55 % wide, X >= 44 px, the game keeps running on the left */
body.mob #win,body.mob #npcwin{left:auto!important;right:0!important;top:0!important;bottom:0;transform:none!important;width:55vw!important;max-width:none;box-sizing:border-box;
  overflow-y:auto;-webkit-overflow-scrolling:touch;padding-right:var(--sr,env(safe-area-inset-right,0px));border-radius:0;font-size:15px;z-index:30;touch-action:pan-y}
body.mob #win .wt,body.mob #npcwin .wt{min-height:44px;padding:0 0 0 12px;position:sticky;top:0;background:rgba(28,16,10,.98);z-index:1}
body.mob #win .wx,body.mob #npcwin .wx{min-width:52px;min-height:44px;font-size:26px}
body.mob #npcwin button,body.mob #win .wb button{min-height:40px;min-width:44px;padding:0 12px}
body.mob #npcwin .bb{gap:8px}
body.mob #toast{top:24%;font-size:18px}
body.mob #roomst{top:auto;bottom:calc(84px + env(safe-area-inset-bottom,0px));font-size:13px}
body.mob #joy{bottom:calc(30px + env(safe-area-inset-bottom,0px))!important;left:calc(22px + env(safe-area-inset-left,0px))}
#rotate{z-index:200}
/* v15.1 death penalty line under 你倒下了 (functional text) */
#mob .mdead .mdl{font-size:14px;font-weight:400;color:#f09a8a;margin-top:4px;text-shadow:0 1px 2px #000}

/* v16.3 法術／物品圖集圖示（CSS 背景） */
#mob .mslot .sb{display:none;position:absolute;left:50%;top:50%;width:34px;height:34px;transform:translate(-50%,-52%);pointer-events:none}
#mob .mslot.ic .sb{display:block}
#mob .mslot.empty.ic .sb{filter:grayscale(1) brightness(.55)}
#mob .mslot .sb.gl{width:38px;height:38px}
#mob .mslot.sp.ic .ct{color:#8fc8f0}   /* v16.3 法術格：MP 只顯示數字、藍色（跟桌面一致） */
