.hero-figure{display:none}
.bag-window{display:flex;flex-direction:column;min-height:0;max-height:100%;background:linear-gradient(140deg,#314538,#1a2b25 75%);border:3px double #ad9365;border-radius:8px;box-shadow:0 8px 32px #101b18ba}
.bag-window>header{display:flex;align-items:center;justify-content:space-between;padding:4px 13px;border-bottom:1px solid #7e714f;background:#20342a}.bag-window h1{font:700 21px var(--serif);letter-spacing:.12em;color:#f3dcac}
.bag-tabs{display:grid;grid-template-columns:repeat(4,1fr);gap:4px;padding:7px 10px}.bag-tabs button,.camp-rail button{padding:3px 7px}
.bag-shelf{flex:1;min-height:0;overflow:auto;margin:0 10px 9px;padding:8px;background:#192a24;border:1px solid #5e644f;border-radius:3px}
.item-grid{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:5px;align-content:start}
.item-cell{position:relative;border:2px solid #928560;padding:1px;aspect-ratio:1;min-width:0;border-radius:5px;overflow:hidden;box-shadow:inset 0 0 0 1px #1b2922}
.item-cell.quality-2{border-color:#7da9ad}.item-cell.quality-3,.item-cell:has(img){border-color:#ba95b4}.item-cell.picked,.item-cell.ready{border-color:#efcb76}
.item-cell .item-art{position:absolute;inset:0;width:100%;height:100%}.item-art{display:block;aspect-ratio:1;object-fit:cover;border-radius:3px;background-color:#102b20}
.icon-sheet{background-size:400% 300%;background-repeat:no-repeat}
.item-cell b,.item-cell i{position:absolute;right:0;bottom:0;color:#ffedcc;font:700 12px/1.25 system-ui;text-shadow:0 1px 2px black;padding:0 3px;background:#18241dcc}
.item-cell i{top:0;left:0;bottom:auto;right:auto;font-size:10px;color:#ffdb91}
.empty-shelf{display:grid;place-items:center;text-align:center;color:#c2c7b4;padding:18px 12px;min-height:95px}
.camp-rail{display:flex;justify-content:center;gap:5px;flex-wrap:wrap;padding:0 8px 8px}.camp-rail button{font-size:13px}
.item-info{display:flex;gap:14px;align-items:center;padding:6px 0 12px}.item-info .item-art{width:66px;flex:none;border:2px solid #b39b64}.wear-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.wear-list button{display:flex;align-items:center;gap:8px;text-align:left;padding:5px}.wear-list img{width:40px}.wear-list small{display:block}
#phone[data-page="bag"] #scene{display:grid;place-items:center;background:linear-gradient(#10231bb0,#13221cc7),var(--town-bg) center/cover}
#phone[data-page="bag"] .bag-window{width:min(100%,780px);height:100%}
#phone[data-page="armory"] .item-grid{grid-template-columns:repeat(auto-fill,minmax(54px,1fr))}
@media(orientation:portrait){.item-grid{grid-template-columns:repeat(5,minmax(0,1fr))}.bag-window{max-height:min(580px,100%)}.hero-stat{margin-bottom:8px}}
@media(orientation:landscape){
 body{display:grid;place-items:center;background:radial-gradient(ellipse at center,#3e493e,#111e1e 80%)}
 #phone{isolation:isolate;position:relative;width:min(100vw,218dvh,1440px);height:min(100dvh,70vw,850px);max-width:none;margin:0;container-type:size;padding-inline:env(safe-area-inset-left) env(safe-area-inset-right)}
 #hud{min-height:42px;padding:3px 14px;gap:8px}#hud .crest{height:30px;width:30px;font-size:20px}#hud .identity{display:flex;align-items:baseline;gap:8px}#hud .identity b{font-size:16px}#hud .money{font-size:13px}
 #scene{padding:8px clamp(12px,2.5cqw,35px);min-width:0}.heading{margin:0 0 6px}.heading h1{font-size:24px}.heading small{font-size:11px}
 #nav{display:flex;justify-content:center;gap:4px;padding:2px 10px max(2px,env(safe-area-inset-bottom))}#nav button{display:flex;align-items:center;justify-content:center;gap:5px;min-width:74px;padding:0 8px;min-height:41px}
 #dock{padding:4px 12px;justify-content:center}#dock .red,#dock .soft{flex:0 1 auto;min-width:130px}
 #phone[data-page="town"] #hud{position:absolute;top:0;left:0;right:0;z-index:3;color:#fff2cf;background:linear-gradient(#14251fe8,#182a2180);border:0;pointer-events:none;padding-inline:14px}
 #phone[data-page="town"] #scene.home{padding:0;overflow-x:auto;overflow-y:hidden;container-type:size}
 #phone[data-page="town"] #nav{position:absolute;bottom:7px;right:12px;border:1px solid #a68d5a;border-radius:6px;background:#172c23ed}
 .town.map{min-height:0;width:max(110%,190cqh);height:100%;background-image:var(--wide-town)!important;background-size:100% 100%;touch-action:pan-x}
 .maphead{left:2.2%;top:13%}.maphead h1{font-size:clamp(20px,3cqw,38px);letter-spacing:.08em}.maphead small{display:none}
 .town .ticker{left:2%;right:auto;max-width:45%;bottom:1.8%;font-size:12px;text-align:left}
 .building{min-width:75px;padding:4px 9px}.building b{font-size:clamp(14px,2cqw,19px)}
 .town [data-action="nav:recruit"]{left:21%!important;top:40%!important}.town [data-action="nav:market"]{left:37%!important;top:75%!important}
 .town [data-action="nav:campaign"]{left:70%!important;top:40%!important}.town [data-action="nav:cave"]{left:90%!important;top:65%!important}
 .town [data-action="nav:fusion"]{left:49%!important;top:55%!important}.town [data-action="nav:tower"]{left:90%!important;top:22%!important}
 .town [data-action="nav:armory"]{left:16%!important;top:73%!important}
 #phone[data-page="bag"] #hud,#phone[data-page="bag"] #nav{display:none}
 #phone[data-page="bag"] #scene{padding:4px 6%;overflow:hidden}
 #phone[data-page="bag"] .bag-window{width:min(88%,92cqh,780px);min-width:min(96%,460px);height:min(98%,600px)}
 .bag-shelf{padding:6px}.bag-tabs{padding:4px 9px}.bag-window>header{padding-block:0}
 .smith{display:grid;grid-template-columns:1.1fr 1fr;gap:10px}
 .formation-layout{display:grid;grid-template-columns:minmax(220px,.86fr) minmax(240px,1.14fr);gap:14px;align-items:start;max-width:1180px;margin:auto}
 .formation-left,.formation-right{min-width:0}.formation-head{margin:0 0 4px}.opponent{flex-direction:row;align-items:center}.formation-head .heading h1{font-size:21px}
 .scout-strip{margin:0 0 4px}.scout-strip img{width:24px}.formation-board{padding:5px 8px}.slots button{height:clamp(40px,14cqh,115px);aspect-ratio:auto}
 .bench-grid{grid-template-columns:repeat(auto-fill,minmax(clamp(48px,7.3cqw,82px),1fr))}.bench-head{margin-top:0}.formation-right .filter{margin:3px 0 7px}
 .cards{grid-template-columns:repeat(auto-fill,minmax(clamp(64px,10cqw,104px),1fr))}.cards .portrait{width:100%}
 #phone[data-page="campaign"] #scene{display:grid;grid-template-columns:minmax(0,1fr) minmax(210px,.72fr);gap:5px 12px;align-content:start}
 #phone[data-page="campaign"] .heading{grid-column:1/-1}#phone[data-page="campaign"] .landscape{grid-column:1;grid-row:2/4;min-height:112px}
 #phone[data-page="campaign"] .stage-strip{grid-column:1;grid-row:4;margin:0}
 #phone[data-page="campaign"] #scene>.box,#phone[data-page="campaign"] #scene>.hint{grid-column:2;margin:0}
 #phone[data-page="recruit"] #scene{max-width:min(100%,780px);width:100%;align-self:center}.tavern-pool{position:relative;padding:6px 12px;margin:4px 0;min-height:65px}
 .pool-actions{position:absolute;top:6px;right:10px;margin:0}.pool-info{justify-content:flex-start}
 #phone[data-page="battle"] #hud{display:none}#scene.battlepage{display:flex;flex-direction:column;padding:0;position:relative;overflow:auto}
 .battlepage .field,.battlepage.settled .field{height:auto;min-height:110px;flex:1;background-image:var(--wide-field)!important;background-size:cover;background-position:center 55%}
 .fighter .body{height:clamp(32px,21cqh,120px)}.battlehead{padding:4px 14px}.narrate{min-height:20px;margin:2px 14px}
 .playback{margin:2px 12px;justify-content:flex-end}.battlepage.settled .debrief{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:min(70%,560px);margin:0;max-height:95%;overflow:auto}
 dialog{width:min(650px,87vw);max-height:94dvh}dialog[data-kind="hero"],dialog[data-kind="drawHero"]{width:min(92vw,1020px)}
 .hero-layout{display:grid;grid-template-columns:minmax(145px,.8fr) minmax(88px,.65fr) minmax(200px,1.25fr);gap:12px;align-items:start}
 .hero-stat .profile{display:block}.hero-stat .profile img{display:none}.hero-figure{display:flex;min-height:140px;align-items:center;justify-content:center}.hero-figure img{width:100%;height:clamp(135px,48dvh,360px);object-fit:contain}
 .hero-controls .actions{margin-top:0}.hero-controls .box{margin-top:6px}#toast{bottom:calc(50% - min(50dvh,35vw,425px) + 36px)}
}
@media(orientation:landscape) and (max-height:480px){
 #phone[data-page="formation"] #hud,#phone[data-page="setup"] #hud{display:none}
 #phone[data-page="campaign"] #hud{display:flex}
 .tavern-pool .pool-info h2{font-size:18px}.tavern-pool{min-height:55px}
 #phone[data-page="bag"] .bag-window{width:min(88%,620px)}
 .bag-window .item-cell{min-height:0}.bag-window .camp-rail button{padding-inline:6px}
}
@media(orientation:landscape){
 .cave-exploration{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.15fr);gap:10px;align-items:start}.cave-team .box,.cave-route{margin:4px 0}.cave-banner{padding:6px 12px}.cave-banner b{font-size:19px}
 .caveparty img{max-height:56px}.caverow{padding:2px 0}.caverow button{flex:1}.caveparty button{width:min(19%,85px)}
 @media(pointer:fine){#scene.home{cursor:grab}#scene.home.panning{cursor:grabbing;user-select:none}}
}
