/* Phone portrait and desktop are independent views of the same simulation. */
@media(max-width:759px) and (orientation:portrait){
 #lobby-scene .lb-side{top:32%;gap:5px}#lobby-scene .lb-side.left{gap:5px}
 #lobby-scene .lb-side .lb-icon{width:48px;min-height:44px;padding:4px 2px;font-size:8px}
 #lobby-scene .lb-side .lb-icon .ic,#lobby-scene .lb-side .lb-icon>.cat-icon{width:22px;height:22px}
 #lobby-scene #wave-rewards>div{display:grid;grid-template-columns:repeat(4,40px);gap:4px}
 #lobby-scene #wave-rewards button{width:40px;height:40px;padding:2px}
 #lobby-scene #wave-rewards button>.cat-icon{width:25px;height:25px}
}
#result .result-box{width:min(680px,94vw);max-height:92vh;overflow:auto;padding:22px;border:4px solid #49353c;border-radius:12px;background:#f3e7ce;box-shadow:0 8px #231d29}
#result .result-box h2{font-size:28px;color:#38252e!important;background:#eeb44e;border:3px solid #5e3b32;border-radius:6px;padding:12px;margin-bottom:16px}
#result[data-win=false] .result-box h2{background:#b9675e;color:#fff0d7!important}
#result{background:#151320b8}
.result-player{display:grid;grid-template-columns:82px 1fr;gap:8px 12px;padding:16px;min-width:0;text-align:left}
.result-player>img{grid-column:1;grid-row:1/4;width:82px;height:95px}.result-player>h3{grid-column:2;margin:0;font-size:18px}.result-player>strong{grid-column:2;margin:0;font-size:13px}.result-player>.contribution-bar{grid-column:2;width:100%}.result-player>small,.result-player>.paper-btn{grid-column:1/-1;line-height:1.5}.result-player>.paper-btn{margin-top:3px}.result-player>small{font-size:11px}.damage-chart{margin:12px;min-height:155px}.mission-panel-head{position:sticky;top:-10px;background:#f3e7cf;z-index:2;padding:5px 0}.result-box .actions{margin-top:16px}
@media(max-width:759px) and (orientation:portrait){
 body{overscroll-behavior:none}#rotate-hint{display:none!important}
 .lb-top{display:grid;grid-template-columns:minmax(0,1fr) 44px;gap:8px;padding:10px 12px}.lb-profile{grid-column:1;min-width:0;width:max-content;max-width:100%;padding:5px 10px}.lb-avatar{width:40px;height:40px}.lb-pinfo b{font-size:14px}.lb-pinfo small{font-size:10px}.lb-iconbtn{grid-column:2;grid-row:1;width:42px;height:42px}.lb-wallet{grid-column:1/-1;grid-row:2;margin:0;justify-content:center;gap:8px}.lb-wallet .chip{font-size:12px;height:29px;padding:3px 10px}.lb-wallet #online-status{display:none}.lb-wallet .energy-chip{padding:3px 8px!important}.lb-wallet .energy-chip b{font-size:12px}
 #lobby-brand{top:18%;width:88vw;max-width:450px}#lobby-brand small{font-size:10px;letter-spacing:1px;margin-top:5px}#lobby-brand p{font-size:11px;margin:7px 0 0}#lobby-brand #btn-story{font-size:11px;margin-top:7px;padding:5px 10px}.hero{top:40%;gap:0}.hero img{width:78px}.hero img:nth-child(2){width:110px;margin:0 -5px}.lb-side{top:38%;gap:9px}.lb-side.left{left:10px;gap:9px}.lb-side.right{right:10px}.lb-side .lb-icon{width:53px;min-height:51px;padding:5px 2px;font-size:9px;gap:2px}.lb-side .lb-icon .ic,.lb-side .lb-icon>.cat-icon{width:25px;height:25px}
 .lb-actions{bottom:calc(83px + env(safe-area-inset-bottom));width:calc(100% - 28px);max-width:410px;gap:9px}.lb-actions .lb-row{width:100%;gap:9px}.lb-pill{min-height:42px;font-size:12px;padding:8px;flex:1}.lb-pill .cat-icon{width:24px;height:24px}.lb-start{width:100%;min-height:65px;font-size:22px;padding:10px}.lb-start small{font-size:11px}.lb-tabs{padding:7px 5px calc(7px + env(safe-area-inset-bottom));gap:4px}.lb-tab{flex:1;max-width:85px;min-width:0;font-size:10px;gap:3px;padding:5px 2px}.lb-tab .cat-icon{width:26px;height:26px}#wave-rewards{right:50%;bottom:300px;transform:translateX(50%);align-items:center;white-space:nowrap}#wave-rewards button{width:31px}.tchat{left:10px;right:10px;width:auto;height:min(370px,52vh);bottom:calc(80px + env(safe-area-inset-bottom));z-index:20;box-sizing:border-box;background:#f0e5cf}.tchat .join-row{display:flex}.tchat .join-row input{min-width:0}
 #game-wrap.portrait #hud-top{left:8px;right:8px;top:8px;width:auto;max-width:none;display:grid;grid-template-columns:65px minmax(0,1fr) 45px;grid-template-areas:'wave status audio' 'resources resources resources';gap:8px 9px;padding:10px 9px;min-height:0;border-width:2px;border-radius:7px;box-sizing:border-box}
 #game-wrap.portrait .hud-wave{grid-area:wave;min-width:0;padding:0}.portrait .wave-num{gap:3px;display:flex;align-items:baseline}.portrait .wave-num .wave-label{font-size:8px;position:absolute;top:-9px}.portrait .wave-num b{font-size:30px;line-height:1.05}.portrait .wave-num span{font-size:10px;margin:0}.portrait .wave-next{font-size:8px;white-space:nowrap;margin-top:3px}.portrait .wave-next b{font-size:10px}
 #game-wrap.portrait .hud-castle{grid-area:status;min-width:0;max-width:none;gap:5px}.portrait .hud-status{display:block;min-width:0}.portrait #hud-mode{font-size:10px;padding:2px 5px;display:inline-block;margin:0}.portrait #hud-partner{font-size:9px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:4px}.portrait #hud-story,.portrait .castle-caption{display:none}.portrait .castle-bar{height:16px!important}.portrait .castle-bar span{font-size:10px;line-height:14px}
 #game-wrap.portrait .hud-res{grid-area:resources;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));width:100%;gap:6px;margin:0;font-size:15px}.portrait .hud-res .res{min-width:0;padding:4px 8px;gap:6px;justify-content:center;border-radius:4px}.portrait .hud-res .cat-icon{width:26px!important;height:26px!important}.portrait .res-copy small{font-size:8px}.portrait .res-copy b{font-size:17px}.portrait .hud-audio{grid-area:audio;display:flex}.portrait .hud-audio .mute{display:none!important}.portrait #btn-battle-settings{width:43px;height:36px;font-size:10px;padding:5px;border-radius:5px}
 #game-wrap.portrait #hud-bottom{height:144px;bottom:calc(6px + env(safe-area-inset-bottom));left:8px;right:8px;transform:none;width:auto;max-width:none;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:1fr 1fr;gap:6px;padding:7px;border-radius:7px;box-sizing:border-box}
 .portrait #hud-bottom .act{padding:5px 2px;min-height:0;gap:2px;border-radius:5px!important}.portrait #hud-bottom .act .ic,.portrait #hud-bottom .act>.cat-icon{width:27px;height:27px}.portrait #hud-bottom .act .lb{font-size:11px;white-space:nowrap}.portrait #hud-bottom .act .cost{font-size:9px;white-space:nowrap}.portrait #btn-summon{order:1}.portrait #btn-guardian-summon{order:2}.portrait #btn-bounty{order:3}.portrait #btn-slime{order:4}.portrait #btn-missions{order:5}.portrait #btn-upgrade{order:6}.portrait #btn-chat{order:7}.portrait #btn-speed{order:8}
 #game-wrap.portrait #board{border-radius:7px;outline-width:2px}.portrait #gamelog{display:none!important}
 #game-wrap.portrait #unit-panel,#game-wrap.portrait #upgrade-panel,#game-wrap.portrait #chat{left:9px;right:9px;top:auto;bottom:calc(var(--bottom-height) + 5px);width:auto;max-width:none;max-height:min(55vh,470px);overflow:auto;transform:none;padding:14px;border:3px solid #49353c;background:#f3e7cf;border-radius:10px;z-index:22;box-sizing:border-box;box-shadow:0 5px #201b28}.portrait #unit-panel .up-head{gap:10px}.portrait #unit-panel .up-name{font-size:18px}.portrait #unit-panel .up-stats{display:grid;grid-template-columns:1fr 1fr;gap:10px;font-size:12px;margin:12px 0}.portrait #unit-panel .up-stats span{display:grid;gap:4px}.portrait #unit-panel .up-stats span:last-child{grid-column:1/-1}.portrait #unit-panel .up-actions{grid-template-columns:1fr 1fr;gap:9px}.portrait #unit-panel .up-actions .btn{min-height:42px;font-size:12px}.portrait #unit-panel .hint{font-size:10px;margin:10px 0 0}.portrait .upg-row{min-height:54px}.portrait .upg-row .g{min-width:95px!important;font-size:13px!important}.portrait .upg-row .lv{font-size:11px!important}.portrait .upg-row .btn{min-height:38px;min-width:70px;font-size:13px!important}.portrait #chat{height:360px}.portrait #chat .join-row input{min-width:0;font-size:14px}.portrait #chat .chat-quick button{min-height:35px}
 #screen-game #game-wrap.portrait #missions{left:50%;top:calc(var(--hud-height) + 8px);width:calc(100vw - 18px);max-height:calc(100vh - var(--hud-height) - var(--bottom-height) - 22px);padding:12px;border-width:3px}.portrait .collection-missions{gap:8px}.portrait .collection-mission{padding:8px}.portrait .collection-mission h4{font-size:11px}.portrait .collection-requirements{gap:5px}.portrait .collection-requirements img{width:35px;height:35px}.portrait .collection-mission button{min-height:31px;font-size:10px;padding:5px}.portrait .mission-panel-head{font-size:15px}.portrait .mission-panel-head button{min-height:36px}
 #game-wrap.portrait #hud-boss{left:10px;right:10px;top:var(--boss-top);bottom:auto;width:auto;max-width:none;padding:7px 10px;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 10px;z-index:7;border:2px solid #b69160;border-radius:5px;background:#f0dfba;box-sizing:border-box}.portrait #hud-boss .bname{font-size:11px;display:flex;gap:8px;justify-content:space-between}.portrait #hud-boss .bbar{grid-column:1;height:5px}.portrait #hud-boss .btimer{grid-column:2;grid-row:1/3;font-size:9px;margin:0;align-self:center;display:flex;align-items:center;gap:3px}.portrait #hud-boss .btimer b{font-size:21px;line-height:1}.portrait #hud-boss .boss-warning{display:none}
 #collection-overlay{padding:7px}.collection-window{width:100%;height:calc(100dvh - 20px);max-height:960px;border-width:3px;border-radius:10px}.collection-window>header{min-height:56px;padding:12px 58px 12px 16px;border-bottom-width:3px}.collection-window>header .stamp{display:none}.collection-window h2{font-size:20px}.collection-close{width:36px;height:36px;top:9px;right:10px;border-width:2px;font-size:27px}.collection-wallet{padding:7px 13px;gap:15px;font-size:11px}.collection-wallet svg{width:20px;height:20px}.collection-tabs{gap:5px;padding:9px 10px 0}.collection-tabs .paper-btn{font-size:11px;min-height:34px;padding:5px 4px;border-width:2px}.collection-content{padding:14px}.paper-btn{font-size:12px;min-height:38px;padding:7px 10px}.menu-grid{grid-template-columns:1fr 1fr;gap:12px}.menu-grid .paper-btn{min-height:95px}.menu-grid svg,.menu-grid .cat-icon{width:36px;height:36px}.settings-layout{grid-template-columns:1fr;gap:18px}.settings-audio{padding:16px}.paper-heading{font-size:18px;margin-bottom:17px}.volume-row{gap:10px;margin-bottom:20px;font-size:13px}.volume-row output{font-size:18px}.switch-row{font-size:12px;min-height:47px}.paper-switch{width:70px;font-size:12px}
 .profile-layout,.cosmetic-layout,.unit-detail-layout{grid-template-columns:1fr;gap:20px}.profile-card{gap:11px;padding:18px}.profile-card .profile-portrait{width:80px;height:80px}.profile-card h2{font-size:20px}.profile-card h3{font-size:14px}.profile-actions{width:100%}.profile-actions .paper-btn{flex:1;font-size:11px}.profile-preview{padding:18px;display:grid;grid-template-columns:90px 1fr;gap:12px;align-items:center}.profile-preview>.profile-portrait{width:80px;height:80px;grid-row:1/4}.profile-preview h3{font-size:13px}.profile-preview>b{font-size:13px}.profile-preview>.paper-btn{font-size:11px}.cosmetic-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.cosmetic-grid .paper-btn{min-height:100px}.cosmetic-grid img{width:60px;height:60px}.cosmetic-grid small{font-size:9px}.frame-sample{width:50px;height:50px}.record-row{font-size:12px;padding:15px 10px}
 .daily-chests{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:7px;padding:12px}.daily-chests>span{grid-column:1/-1;max-width:none;font-size:13px}.daily-chests>small{grid-column:1/-1;max-width:none;text-align:right}.daily-chests .paper-btn{font-size:11px;padding:6px 2px;min-height:69px}.daily-chests svg,.daily-chests .cat-icon{width:27px;height:27px}.quest-row{grid-template-columns:32px minmax(0,1fr) 65px;gap:10px;padding:12px 10px}.quest-row h3{font-size:12px;line-height:1.4}.quest-icon{width:30px;height:30px}.quest-icon .cat-icon{width:25px;height:25px}.quest-row small{font-size:9px}.quest-row .paper-btn{padding:6px 4px;font-size:11px}.quest-row .ink-progress span{font-size:10px}.mail-card{flex-direction:column;gap:12px;padding:16px}.mail-card h3{font-size:15px}.mail-card p{font-size:12px}.mail-reward{justify-content:space-between}.growth-step{grid-template-columns:45px minmax(0,1fr);gap:14px;padding:14px}.growth-step>.paper-btn{grid-column:2;justify-self:start}.growth-floor{width:42px;height:65px;font-size:25px}.growth-step h3{font-size:13px}.growth-step .reward-strip{gap:8px}.growth-step .prize{min-width:45px}.growth-step .prize svg{width:28px;height:28px}.growth-step .prize b{font-size:11px}.certificate{padding:20px 12px;border-width:7px}.certificate h2{font-size:27px;margin:20px 0}.certificate p{font-size:11px;line-height:2}.certificate .seal{position:static;margin:20px auto 0}.friend-search{flex-wrap:wrap;gap:7px}.friend-search input{width:calc(100% - 70px);font-size:16px!important}.friend-search>b{width:100%;font-size:12px}.friend-row{padding:12px 3px;gap:9px;font-size:12px}.friend-row .profile-portrait{width:42px;height:42px}.friend-row .paper-btn{font-size:10px;padding:5px}.empty-state{min-height:240px}.empty-state b{font-size:18px}.empty-state p{font-size:12px}
 .shop-grid{grid-template-columns:1fr 1fr;gap:12px}.shop-card{padding:17px 12px;gap:13px}.shop-card h3{font-size:13px}.shop-card>img{width:85px;height:85px}.shop-card .paper-btn{font-size:11px;width:100%}.daily-shop-head{flex-wrap:wrap;font-size:11px;gap:12px}.daily-shop-head>.paper-btn{width:100%;font-size:12px}.gacha-layout{display:flex;flex-direction:column;gap:15px;align-items:stretch}.gacha-info{padding:12px;display:grid;grid-template-columns:1fr 1fr;gap:10px;align-items:center}.gacha-info>.stamp{font-size:9px;letter-spacing:1px}.gacha-info>h3{font-size:14px;margin:0;text-align:right}.gacha-info>.key-rewards{grid-column:1/-1;grid-template-columns:repeat(6,minmax(0,1fr));gap:5px}.gacha-info .key-reward{padding:6px 1px;min-height:60px}.gacha-info .key-reward svg,.gacha-info .key-reward img{width:28px;height:28px}.gacha-info .key-reward .prize b{font-size:9px}.gacha-info .key-status{font-size:9px;width:14px;right:-2px;top:-5px}.gacha-info>.ink-progress{grid-column:1;min-width:0}.gacha-info>small{font-size:9px;grid-column:2;text-align:right}.gacha-info>p{display:none}.gacha-info>.paper-btn{min-width:0;font-size:11px}.gacha-board{width:100%;max-width:430px;align-self:center;padding:7px;gap:5px;border-width:3px;border-radius:8px}.draw-cell{border-width:2px;padding:2px;border-radius:5px}.draw-cell .prize svg,.draw-cell .prize img,.draw-cell .prize>.cat-icon{width:27px;height:27px}.draw-cell .prize b{font-size:10px}.draw-cell .prize small{display:none}.box-mark>.cat-icon{width:28px;height:28px}
 .unit-cards{grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}.unit-tile{padding:6px;border-width:2px;gap:5px}.unit-tile>img{height:70px}.unit-tile>b{font-size:10px;min-height:28px}.unit-tile>small{font-size:9px}.unit-collection>section>h3{font-size:15px}.unit-illustration{padding:14px;gap:8px}.unit-illustration>img{height:160px}.unit-illustration h2{font-size:21px}.unit-illustration>span{font-size:11px}.detail-arrows .paper-btn{min-height:34px;font-size:11px}.unit-stat-sheet h3{font-size:16px}.stat-grid{margin:14px 0;gap:9px}.stat-grid>div{padding:13px;gap:7px}.stat-grid b{font-size:19px}.stat-grid small{font-size:11px}.upgrade-sheet{margin:16px 0}.skill-list>.paper-btn{flex:1;font-size:11px}.skill-list .cat-icon{width:22px;height:22px}.ranking-podium{margin:15px 0;gap:7px}.ranking-podium>div{padding:12px 7px;gap:9px;min-width:0;flex:1}.ranking-podium>div:first-child{padding-top:28px}.ranking-podium .profile-portrait{width:60px;height:60px;border-radius:10px}.ranking-podium h3{font-size:10px;word-break:break-all}.ranking-podium span{font-size:10px}
 #result .result-box{padding:14px;width:calc(100% - 20px);max-height:calc(100dvh - 24px);border-width:3px}.result-box h2{font-size:24px!important;padding:12px!important}.result-players{gap:9px}.result-player{display:flex;flex-direction:column;align-items:center;text-align:center;gap:8px;padding:14px 9px;border-width:2px}.result-player>img{width:72px;height:72px}.result-player>h3{font-size:15px}.result-player>strong{font-size:11px}.result-player>small{font-size:10px;line-height:1.6}.result-player>.paper-btn{font-size:10px;min-height:36px;width:100%}#result-desc{font-size:12px}.damage-chart{min-height:150px;margin:12px 0;gap:15px}.damage-chart>div{width:90px}.damage-chart b{font-size:12px}#result-reward{font-size:13px}.result-box>.actions>.btn{min-height:44px;font-size:15px}.reveal-card{width:calc(100vw - 32px);padding:25px 18px;gap:24px;box-sizing:border-box}.reveal-card h2{font-size:29px}.reveal-card .prize svg,.reveal-card .prize img{width:75px;height:75px}.reveal-card p{font-size:13px}.reward-strip{gap:15px}
 body>#toasts{right:10px;bottom:calc(160px + env(safe-area-inset-bottom));width:calc(100% - 20px);box-sizing:border-box}.toast{font-size:12px!important}
 #comic-intro{grid-template-rows:60px minmax(0,1fr) 190px}#comic-intro header{padding:10px 15px}#comic-intro header b{font-size:18px}.comic-stage{margin:0 9px;border-width:4px}#intro-speech{font-size:17px;padding:12px;right:6%;max-width:77%}#comic-intro footer{padding:15px;display:flex;flex-direction:column;align-items:stretch;gap:9px}#comic-intro h1{font-size:24px;margin:4px 0}#comic-intro p{font-size:12px;margin:0}.intro-controls{max-width:none;width:100%;display:flex;justify-content:flex-end}.intro-controls .btn{min-height:40px;font-size:12px}.intro-dots i{width:25px}#training-coach{width:calc(100% - 18px);height:auto;min-height:100px;left:9px;transform:none;padding:10px;gap:10px;box-sizing:border-box;flex-wrap:wrap}#coach-portrait{display:none}.coach-copy b{font-size:16px}.coach-copy p{font-size:12px}#training-coach .btn{min-height:36px}
}
@media(max-width:759px) and (orientation:portrait) and (max-height:740px){#lobby-brand{top:18%;width:80vw}#lobby-brand p{display:none}.hero{top:40%}.hero img{width:62px}.hero img:nth-child(2){width:87px}.lb-side{top:36%}.lb-side .lb-icon{min-height:43px;width:48px}.lb-side .lb-icon>.cat-icon,.lb-side .lb-icon .ic{width:22px;height:22px}.lb-actions{bottom:76px;gap:7px}.lb-pill{min-height:36px;font-size:11px}.lb-start{min-height:55px;font-size:20px}#wave-rewards{bottom:255px}.portrait #hud-top{padding:8px}.portrait #hud-bottom{height:127px}.portrait #hud-bottom .act .ic,.portrait #hud-bottom .act>.cat-icon{width:24px;height:24px}.portrait #hud-bottom .act .lb{font-size:10px}}

@media(max-width:759px) and (orientation:portrait){.portrait .wave-num{position:relative;padding-top:8px}.portrait .wave-num .wave-label{top:-2px}.portrait .hud-res .res.slime{display:flex!important}#game-wrap.portrait #hud-boss{transform:none!important;max-height:none}.portrait #hud-boss .boss-name{display:inline!important}.portrait #hud-boss .bname{min-width:0}.portrait #hud-boss .bname .boss-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.portrait #hud-boss .bhp{font-size:10px;white-space:nowrap}}

@media(max-width:759px) and (orientation:portrait){.settings-audio{padding:12px}.settings-audio .paper-heading{font-size:16px;padding-bottom:8px;margin-bottom:10px}.settings-audio .volume-row{gap:7px;margin-bottom:13px}.settings-audio .volume-row output{font-size:16px}.settings-audio .audio-buttons .paper-btn{min-height:34px;font-size:11px}.settings-audio .paper-note{font-size:10px;line-height:1.5;padding:8px;margin:8px 0 0}.settings-layout{gap:15px}#comic-intro{grid-template-rows:60px minmax(0,1fr) 220px}.comic-cut{width:56%;height:31%;border-width:4px}.comic-cut b{font-size:13px;padding:6px 8px}#intro-tag{left:12px;top:12px;font-size:11px;padding:7px 10px}.comic-sfx{font-size:40px;left:38%}#intro-tap-hint{font-size:10px;padding:6px 10px}#intro-speech{font-size:16px}.intro-controls{gap:7px}.intro-controls .btn{padding:8px 10px}.intro-controls .btn.primary{min-width:145px}}

@media(max-width:759px) and (orientation:portrait){#game-wrap.portrait #hud-top{padding:8px 9px;gap:6px 9px}.portrait .hud-status{line-height:1.15}.portrait #hud-mode{line-height:1.1}.portrait #hud-partner{line-height:1.2;margin-top:3px}.portrait .wave-next{line-height:1.1;margin-top:2px}.portrait #hud-top .hud-castle{gap:4px}#game-wrap.portrait #hud-bottom{height:128px}.portrait #hud-bottom .act{padding:3px 2px;gap:1px}.portrait #hud-bottom .act .ic,.portrait #hud-bottom .act>.cat-icon{width:24px;height:24px}.portrait #hud-bottom .act .lb{font-size:10px;line-height:1.15}.portrait #hud-bottom .act .cost{font-size:8px;line-height:1.2}}
