/* Use the unobscured viewport, including browser toolbars, keyboard and cutouts. */
.mobile-safe-probe{position:fixed;visibility:hidden;pointer-events:none;width:0;height:0;padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px)}
html.mobile-fit{width:100%;height:100%;-webkit-text-size-adjust:100%;text-size-adjust:100%}.mobile-fit body{width:100%;height:100%;overflow:hidden}.mobile-fit #app{position:fixed;left:var(--jh-left);top:var(--jh-top);width:var(--jh-safe-w);height:var(--jh-safe-h);display:flex;align-items:center;justify-content:center;overflow:hidden}
.mobile-fit #app>.game,.mobile-fit #app>.role-screen{width:var(--jh-stage-w)!important;height:var(--jh-stage-h)!important;min-height:0!important;max-width:none!important;flex:none;margin:0!important}
.mobile-fit #app>.classic-login{width:var(--jh-login-w)!important;height:var(--jh-login-h)!important;min-height:0;flex:none;margin:0!important}
.mobile-fit #app>.welcome,.mobile-fit #app>.loading{width:100%;height:100%;min-height:0;overflow:auto}.mobile-fit .role-frame{overscroll-behavior:contain;touch-action:pan-y}.mobile-fit .role-screen footer{flex:none}
.mobile-fit #modal{inset:auto!important;left:calc(var(--jh-left) + var(--jh-safe-w)/2)!important;top:calc(var(--jh-top) + var(--jh-safe-h)/2)!important;transform:translate(-50%,-50%);margin:0!important;max-width:calc(var(--jh-stage-w) - 12px)!important;max-height:calc(var(--jh-stage-h) - 12px)!important;box-sizing:border-box;overscroll-behavior:contain}
.mobile-fit #modal.original-panel{width:var(--jh-stage-w)!important;height:var(--jh-stage-h)!important;min-height:0!important}
.mobile-fit #modal .original-content{min-height:0;overscroll-behavior:contain;touch-action:pan-y}.mobile-fit #modal:not(.original-panel){width:min(520px,calc(var(--jh-stage-w) - 16px));overflow:auto;padding:clamp(12px,4vw,24px)}
.mobile-fit #modal.scroll-menu{width:min(260px,calc(var(--jh-stage-w)*.64))!important;height:auto!important;max-height:calc(var(--jh-stage-h) - 20px)!important}
.mobile-fit #modal.scroll-menu .original-content{max-height:calc(var(--jh-stage-h)*.7)!important;overflow-y:auto!important}.mobile-fit #modal.scroll-menu .scroll-option{font-size:clamp(17px,6vw,28px)!important;min-height:36px!important}
.mobile-fit #modal.inset-panel{height:min(780px,calc(var(--jh-stage-h) - 16px))!important;width:min(520px,calc(var(--jh-stage-w) - 16px))!important}
.mobile-fit #modal.restoration-panel,.mobile-fit #modal.grid-bag-panel{width:min(480px,calc(var(--jh-stage-w) - 16px))!important;height:min(740px,calc(var(--jh-stage-h) - 16px))!important;min-height:0!important}
/* battle-result-size-061: the settlement screen only needs to fit a short stat summary and an item list, so it no longer claims near-fullscreen height.
   battle-result-fill-064: 061's caps made the panel look like a small floating block with oversized margins on wider/taller screens; sized up so the stat/reward text fills the panel body instead of shrinking to a corner. */
.mobile-fit #modal.settlement-panel{width:min(480px,calc(var(--jh-stage-w) - 12px))!important;height:auto!important;max-height:min(560px,calc(var(--jh-stage-h)*.72))!important;min-height:0!important}
.mobile-fit #modal.grid-bag-panel .bag-grid{height:min(220px,calc(var(--jh-stage-h)*.3))!important;min-height:48px!important;gap:clamp(5px,1.8vw,10px)!important}
.mobile-fit #modal.grid-bag-panel .original-content,.mobile-fit #modal.restoration-panel .original-content{overflow-y:auto!important;min-height:0!important}
.mobile-fit #modal.settlement-panel .original-content{max-height:none!important;overflow:auto;flex:1;min-height:0}.mobile-fit #modal .original-footer{flex-shrink:0;flex-wrap:wrap}
.mobile-fit input,.mobile-fit textarea,.mobile-fit select{font-size:16px!important;max-width:100%;min-width:0}.mobile-fit .email-code-row{flex-wrap:wrap}.mobile-fit .email-code-row label{flex:1 1 150px}.mobile-fit .email-code-row button{min-height:44px}
.mobile-fit #toast{left:calc(var(--jh-left) + var(--jh-safe-w)/2);bottom:auto;top:calc(var(--jh-top) + var(--jh-safe-h)*.72);max-width:calc(var(--jh-stage-w) - 24px);overflow-wrap:anywhere}
@media(max-height:480px){.mobile-fit #modal .original-title{max-height:48px;flex-shrink:0}.mobile-fit #modal:not(.original-panel){padding:12px}.mobile-fit #modal .original-footer{min-height:36px}.mobile-fit .welcome-card{padding:16px}.mobile-fit #modal.grid-bag-panel .original-content{padding:6px 10px!important}}

/* fixed-bag-grid-049:start */
/* Margins support old WebViews; fixed cells never shrink. */
#modal.grid-bag-panel .bag-grid,.mobile-fit #modal.grid-bag-panel .bag-grid{
 box-sizing:border-box!important;display:flex!important;flex-flow:row wrap!important;
 gap:0!important;width:100%!important;max-width:310px!important;padding:0!important;
 align-self:center;align-content:flex-start!important;justify-content:flex-start!important;
 overflow-x:hidden!important;overflow-y:auto!important;
}
#modal.grid-bag-panel .bag-cell{
 box-sizing:border-box!important;flex:0 0 52px!important;
 width:52px!important;min-width:52px!important;max-width:52px!important;
 height:52px!important;min-height:52px!important;max-height:52px!important;
 aspect-ratio:auto!important;margin:3px!important;padding:0!important;
 display:flex!important;align-items:center!important;justify-content:center!important;
 position:relative;overflow:visible!important;clip-path:none!important;border-radius:0!important;
 border:2px solid #88b4b5!important;background:#1b2939!important;
 box-shadow:inset 2px 2px #42566c,inset -2px -2px #0d1724!important;
}
#modal.grid-bag-panel .bag-cell.selected{border-color:#f3d978!important;background:#384a60!important;box-shadow:inset 2px 2px #687785,inset -2px -2px #202e42!important}
#modal.grid-bag-panel .bag-cell:disabled{background:#233241!important;opacity:1}
#modal.grid-bag-panel .bag-cell .unified-item-icon{
 position:static!important;inset:auto!important;transform:none!important;flex:0 0 40px!important;
 width:40px!important;min-width:40px!important;max-width:40px!important;
 height:40px!important;min-height:40px!important;max-height:40px!important;
 margin:0!important;padding:0!important;border:0!important;object-fit:contain;image-rendering:pixelated;pointer-events:none;
}
/* Crisp quality outline follows sprite alpha; the source pixels retain their original colors. */
#modal.grid-bag-panel .bag-cell .unified-item-icon[data-equip-quality]{
 filter:drop-shadow(1px 0 0 var(--bag-quality-color))
        drop-shadow(-1px 0 0 var(--bag-quality-color))
        drop-shadow(0 1px 0 var(--bag-quality-color))
        drop-shadow(0 -1px 0 var(--bag-quality-color));
}
#modal.grid-bag-panel .bag-cell .unified-item-icon[data-equip-quality="0"]{
 --bag-quality-color:#ffffff;
}
#modal.grid-bag-panel .bag-cell .unified-item-icon[data-equip-quality="1"]{
 --bag-quality-color:#00ff00;
}
#modal.grid-bag-panel .bag-cell .unified-item-icon[data-equip-quality="2"]{
 --bag-quality-color:#29faff;
}
#modal.grid-bag-panel .bag-cell .unified-item-icon[data-equip-quality="3"],
#modal.grid-bag-panel .bag-cell .unified-item-icon[data-equip-quality="4"]{
 --bag-quality-color:#ee10f6;
}
#modal.grid-bag-panel .bag-quantity{
 position:absolute;right:2px!important;bottom:1px!important;z-index:2;
 margin:0;max-width:46px;line-height:14px;font-size:12px!important;
 white-space:nowrap;pointer-events:none;text-shadow:1px 1px #10211e,-1px -1px #10211e;
}
#modal.grid-bag-panel .bag-cell .enhance-badge{
 position:absolute;left:2px;top:1px;z-index:2;margin:0;
 font:9px 'JHPixel',SimSun,monospace;font-style:normal;color:#ffe719;
 text-shadow:1px 1px #10211e,-1px -1px #10211e;pointer-events:none;
}
/* fixed-bag-grid-049:end */

.original-idle-entry{position:absolute;left:22%;bottom:9.8%;z-index:7;width:24%;height:5.5%;min-height:30px;padding:0 6px;display:flex;align-items:center;justify-content:center;gap:4px;font:clamp(16px,5cqw,25px) JHPixel,SimSun,monospace;color:#d3e1c2;background:#203c37;border:solid transparent;border-width:5px 8px;border-image:url('original/UI2.gif.png') 8 10 fill stretch;border-radius:0;image-rendering:pixelated;touch-action:manipulation}.original-idle-entry.in-combat{left:auto;right:2%;top:1%;bottom:auto;z-index:10;width:auto;min-width:20%;height:6%;min-height:34px;gap:4px;white-space:nowrap;font-size:clamp(12px,3.2cqw,18px);padding:0 10px}.original-idle-entry .auto-icon{width:1em;height:.78em;image-rendering:pixelated;flex:none;object-fit:contain}.original-idle-entry[hidden]{display:none}

/* idle-layout-050:start */
.game{--scene-chat-height:13%}
.game .original-chat{height:var(--scene-chat-height);box-sizing:border-box}
.game .original-menu.pixel-control,
.game .original-idle-entry:not(.in-combat){
 box-sizing:border-box;width:14cqw!important;height:9cqw!important;min-height:40px;
 bottom:calc(var(--scene-chat-height) + .5%);
}
.game .original-idle-entry:not(.in-combat){
 left:50%;right:auto;transform:translateX(-50%);
 padding:0 2px;border-width:3px 4px;
 font:clamp(13px,3.8cqw,23px)/1 JHPixel,SimSun,monospace;
 white-space:nowrap;letter-spacing:0;gap:0;
}
/* idle-layout-050:end */

/* idle-skin-051:start */
.game .original-idle-entry:not(.in-combat){border:0;border-image:none;background:transparent url('idle-button-051.svg') center/100% 100% no-repeat;padding:4px 6px;color:#eadfa8;text-shadow:1px 1px #071b16;font-size:clamp(14px,4cqw,26px);box-shadow:none}
.game .original-idle-entry:not(.in-combat):hover{filter:brightness(1.1)}
.game .original-idle-entry:not(.in-combat):active{filter:brightness(1.2)}
.game .original-idle-entry:not(.in-combat).active{color:#c5f2ad}
.game .original-idle-entry:not(.in-combat).active::after{content:'';position:absolute;right:13%;top:17%;width:3px;height:3px;background:#a9e580;box-shadow:1px 1px #163a28}
.game .original-idle-entry:not(.in-combat):focus-visible{outline:2px solid #e5d17c;outline-offset:2px}
/* idle-skin-051:end */

/* bag-description-051:start */
#modal.grid-bag-panel .original-content,
.mobile-fit #modal.grid-bag-panel .original-content{
 display:flex;flex-direction:column;overflow:hidden!important;min-height:0!important;
}
#modal.grid-bag-panel .bag-grid,
.mobile-fit #modal.grid-bag-panel .bag-grid{
 flex:1 1 0!important;height:auto!important;min-height:58px!important;
 overflow-y:auto!important;overscroll-behavior:contain;touch-action:pan-y;
}
#modal.grid-bag-panel .bag-description,
.mobile-fit #modal.grid-bag-panel .bag-description{
 box-sizing:border-box;flex:0 0 34%!important;height:34%!important;min-height:80px!important;
 overflow-x:hidden!important;overflow-y:auto!important;overscroll-behavior:contain;
 touch-action:pan-y;-webkit-overflow-scrolling:touch;scrollbar-width:thin;
 padding:6px 2px!important;border-top:1px solid #52786c;
}
#modal.grid-bag-panel .bag-capacity,
#modal.grid-bag-panel .original-money,
#modal.grid-bag-panel .original-footer{flex-shrink:0!important}
/* bag-description-051:end */

/* The figure and slots stay above an independently scrolling equipment description. */
#modal.original-panel[data-view="装备"] .equipment-content{display:flex;flex-direction:column;min-height:0;overflow:hidden}
#modal.original-panel[data-view="装备"] .equipment-stage{flex:0 0 auto;height:auto;min-height:0}
#modal.original-panel[data-view="装备"] .equipment-description{
 flex:1 1 0;min-height:0;overflow-x:hidden;overflow-y:auto;
 padding:12px clamp(16px,5cqw,28px);box-sizing:border-box;
 touch-action:pan-y;overscroll-behavior:contain;scroll-padding-block:12px;
 border-top:1px solid #52786c;text-align:left;overflow-wrap:anywhere;
}
.equipment-detail-body{width:100%;max-width:440px;margin-inline:auto}
.equipment-detail-body h3{font-size:clamp(16px,4.8cqw,22px)!important;margin:0 0 12px}
.equipment-detail-body p,.equipment-detail-body .gear-stat{font-size:clamp(14px,3.8cqw,18px)!important;line-height:1.5!important;margin:0 0 8px}
.equipment-detail-body .gear-meta{margin-bottom:14px}
.equipment-detail-body .gear-stat>span{flex:1;min-width:0}
.equipment-detail-body .gear-stat em{flex:none;min-width:42px;text-align:right}
.equipment-detail-body .gear-buttons{grid-template-columns:repeat(auto-fit,minmax(88px,1fr));gap:8px;margin-top:16px;padding:8px;background:#29493e}
.equipment-detail-body .gear-buttons button{width:100%;min-height:36px;padding:5px;font-size:clamp(14px,3.8cqw,18px)}

/* Duel controls reuse the original pixel frame with a compact, stable action panel. */
.duel-battle .combat-title{padding-left:3cqw;gap:2cqw}
.duel-battle .duel-status{flex:1;min-width:0;color:#f1e398;font:clamp(12px,3.2cqw,17px)/1.4 JHPixel,monospace;text-align:center;text-shadow:1px 1px #10271f}
.duel-battle .combat-scroll{left:auto;right:3%;top:18%;width:44%;height:auto;max-height:64%;min-height:24%;border-width:6cqw 4cqw 3cqw;padding:1cqw;box-sizing:border-box}
.duel-battle .combat-scroll h2{top:-5cqw;left:-3cqw;right:-3cqw;font-size:4.2cqw;letter-spacing:1cqw}
.duel-battle .combat-options{gap:5px;justify-content:flex-start;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y}
.duel-battle .duel-root .combat-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
.duel-battle .combat-options button{flex:none;min-height:34px;padding:5px 2px;font-size:clamp(13px,3.8cqw,19px);letter-spacing:0;border:0;border-bottom:1px solid #9aa583;background:none;color:#2f3b16}
.duel-battle .duel-root .combat-options button:nth-child(odd){border-right:1px solid #9aa583}
.duel-battle .combat-options button:disabled{opacity:.5}
.duel-battle .combat-options button.selected,.duel-battle .combat-options button:active{background:#4b6158;color:#f1fff5}
.duel-battle .combat-options button[data-combat="escape"]{color:#7a2c1f}
.duel-battle .duel-wait{grid-column:1/-1;font-size:clamp(12px,3.5cqw,17px);padding:5px 0}
.duel-battle .combat-scroll.compact-spells{top:12%;max-height:77%}
.duel-opponent-status{position:absolute;left:3%;top:3%;width:43%;z-index:4;box-sizing:border-box;padding:5cqw 3.5cqw;border:solid transparent;border-width:4cqw 5cqw;border-image:url('original/UI2.gif.png') 12 13 12 13 fill stretch;background:#213d3a;color:#edf4d8;font:clamp(11px,3cqw,15px)/1.4 JHPixel,monospace;pointer-events:none;image-rendering:pixelated}
.duel-opponent-status strong{display:block;color:#f4df87;overflow-wrap:anywhere}
.duel-hp-track{height:8px;margin:4px 0;border:1px solid #55735b66;border-radius:3px;background:#091b14;overflow:hidden}
.duel-hp-track i{display:block;height:100%;background:#e03828;transition:width .15s}
.duel-hp-number,.duel-feedback{display:block;font-size:inherit}.duel-feedback{margin-top:3px;color:#fee485}
.bulk-sale-panel .original-content{display:flex;flex-direction:column;overflow:hidden!important;padding:12px!important;gap:8px}
.bulk-sale-tools{display:flex;flex-wrap:wrap;gap:8px;align-items:center;flex:none}
.bulk-sale-tools label{display:flex;gap:6px;align-items:center;font-size:14px}
.bulk-sale-tools label[hidden]{display:none}
.bulk-sale-tools select,.bulk-sale-tools button{font-size:14px;min-height:32px;padding:4px 6px}
.bulk-sale-panel .bulk-sale-hint,.bulk-sale-panel #bulk-sale-total{flex:none;font-size:14px!important;line-height:1.5;margin:0;padding:4px!important}
.bulk-sale-list{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y}
.bulk-sale-row{display:flex;align-items:center;gap:8px;min-height:52px;padding:6px;border-bottom:1px solid #52786c;font-size:14px}
.bulk-sale-row input{flex:none;width:20px;height:20px;accent-color:#e0c76f}
.bulk-sale-row .unified-item-icon{flex:none;width:32px;height:32px;object-fit:contain;image-rendering:pixelated}
.bulk-sale-row span{min-width:0;overflow-wrap:anywhere}.bulk-sale-row strong,.bulk-sale-row small{display:block;font-size:14px;line-height:1.5}
.bulk-sale-panel .bulk-sale-list>p{font-size:14px;padding:6px;line-height:1.5}

.money-values .voucher-label{font-family:JHPixel,monospace;font-size:.85em;line-height:1;white-space:nowrap;color:inherit}
