.shelter-screen[hidden]{display:none!important}.battle-screen.shelter-screen{z-index:70;grid-template-columns:minmax(0,1fr);grid-template-rows:88px minmax(0,1fr) 250px;gap:0;padding:12px 3%;overflow:hidden;background:#080d15}.shelter-top{display:flex;align-items:center;gap:24px;min-width:0}.shelter-top h2{font-size:24px;color:#c6d9df;letter-spacing:5px;flex:none}.shelter-vitals{display:flex;justify-content:space-evenly;gap:12px;width:100%;min-width:0}.shelter-vital{display:flex;align-items:center;gap:8px;min-width:0}.shelter-vital>img{width:46px;height:46px;object-fit:cover;border-radius:50%}.shelter-vital b{font-size:15px}.shelter-vital small{display:block;font-size:12px;color:#b7c6cf}.shelter-vital .route-health-frame{display:block;width:124px;height:18px}.shelter-vital progress{width:100%;height:100%}.battle-screen .shelter-field{grid-row:2;position:relative;min-height:0;height:100%;width:100%;margin:0;background:url(shelter/rest-background-crop-v2.webp) center/cover no-repeat;overflow:hidden}.shelter-actors{position:absolute;inset:0}.shelter-person{position:absolute;transform:translateX(-50%);height:46%;width:18%;object-fit:contain;object-position:center bottom;filter:drop-shadow(0 6px 3px #0008);z-index:2}.shelter-person.incapacitated{opacity:.45;filter:grayscale(.8)}.shelter-agent{left:14%;bottom:13%;height:33%;width:18%;z-index:3}.shelter-screen .shelter-bottom[data-ui-frame]{display:grid;grid-row:3;grid-template-columns:minmax(0,1.5fr) 132px minmax(220px,1fr);grid-template-rows:1fr;gap:14px;min-height:0;height:100%;padding:24px 24px 14px;overflow:hidden}.shelter-screen .shelter-bottom>.shelter-command-panel{min-width:0;display:flex;flex-direction:column;justify-content:space-between}.shelter-controls{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}.shelter-screen .shelter-bottom .shelter-controls .shelter-command{display:flex;flex-direction:column;align-items:center;width:100%;height:auto;min-width:0;background:none;border:none;padding:0;color:#d8c7a7}.shelter-skill-icon{display:block;aspect-ratio:1;width:min(100%,110px);background:url(shelter/action-icons-v1.webp) left center/400% 142% no-repeat}.shelter-command[aria-pressed=true]:not(:disabled){filter:drop-shadow(0 0 5px #d8b266)}.shelter-command:disabled{filter:grayscale(1);opacity:.45}.shelter-command b{font-size:17px;margin-top:5px}.shelter-desc{font-size:14px;line-height:1.65;min-height:48px;margin:10px 0 0;color:#b7c6cf}.shelter-dice-panel{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px}.shelter-die{width:74px;height:74px;display:grid;place-items:center;border:2px solid #917c58;background:#111c28;border-radius:12px;font-size:56px;color:#d1e0e7;line-height:1}.shelter-die.rolling{animation:shelter-roll .13s linear infinite}.shelter-dice-panel .seal{font-size:15px;padding:8px 12px;letter-spacing:1px}.shelter-screen .shelter-bottom .shelter-log{width:100%;height:100%;min-height:0;overflow:auto;font-size:14px;line-height:1.7;padding:12px 18px}.shelter-log p{margin:0 0 10px}.shelter-gate{position:fixed;inset:0;z-index:2147483646;overflow:hidden;pointer-events:all;background:transparent}.shelter-gate-leaf{position:absolute;left:0;right:0;height:calc(50% + 1px);background:#060607 url(shelter/vertical-gate-v1.webp) center top/100% 200% no-repeat}.shelter-gate-leaf.upper{top:0;transform:translateY(-101%)}.shelter-gate-leaf.lower{bottom:0;background-position:center bottom;transform:translateY(101%)}@keyframes shelter-roll{50%{transform:rotate(10deg) scale(.92)}}@media(max-width:760px){.battle-screen.shelter-screen{grid-template-rows:110px minmax(0,1fr) 290px;padding:8px 10px}.shelter-top{flex-direction:column;gap:4px;justify-content:center}.shelter-top h2{font-size:19px;margin:0}.shelter-vital>img{display:none}.shelter-vital .route-health-frame{width:72px}.shelter-vital b{font-size:12px}.shelter-vital small{font-size:10px}.shelter-vitals{gap:5px}.shelter-screen .shelter-bottom[data-ui-frame]{grid-template-columns:minmax(0,1fr) 86px;grid-template-rows:174px 1fr;gap:5px;padding:14px}.shelter-screen .shelter-bottom .shelter-log{grid-column:1/-1;font-size:12px;padding:6px 10px}.shelter-controls{gap:4px}.shelter-command b{font-size:14px}.shelter-desc{font-size:12px}.shelter-die{width:54px;height:54px;font-size:42px}.shelter-person{height:48%;width:20%}.shelter-agent{height:35%;width:20%}}@media(prefers-reduced-motion:reduce){.shelter-die.rolling{animation:none}}

.shelter-screen .shelter-field[data-ui-frame="battlefield"]{background-size:cover!important;background-position:center!important}.shelter-screen .shelter-field[data-ui-frame="battlefield"]::before{background-size:cover;background-position:center}.shelter-screen .shelter-bottom .shelter-log{max-height:none;box-sizing:border-box;align-self:stretch}.shelter-screen .shelter-bottom .shelter-controls .shelter-command{grid-template-rows:none;min-height:0;max-height:none;flex:none;transform:none}.shelter-screen .shelter-bottom>.shelter-command-panel{display:flex;grid-template-rows:none;gap:0}

/* Shared combat scale, calibrated per source portrait; sitting poses keep their natural height. */
.shelter-screen .shelter-person:not(.shelter-agent){height:calc(clamp(150px,27vh,310px)*var(--rest-scale,1));width:auto;max-width:none;object-fit:contain}
@media(max-width:760px){.shelter-screen .shelter-person:not(.shelter-agent){height:calc(170px*var(--rest-scale,1))}}

/* Preserve the cropped background proportions and replace the inherited combat scenery. */
.shelter-screen .shelter-field[data-ui-frame="battlefield"]::before{background-image:url(shelter/rest-background-crop-v2.webp);background-size:cover;background-position:center}
.shelter-agent-turn-ring{position:absolute;left:14%;bottom:11%;width:120px;height:24px;transform:translateX(-50%);background:url(ui/selection-light-woven-blue.webp) center/100% 100% no-repeat;filter:brightness(.68) saturate(.5) contrast(.82);opacity:.8;z-index:1;pointer-events:none}
.shelter-screen .shelter-bottom .shelter-skill-icon{width:88px;height:88px;flex:none;aspect-ratio:1;background-size:400% 142%}
@media(max-width:1000px){.shelter-screen .shelter-bottom .shelter-skill-icon{width:64px;height:64px}}
@media(max-width:760px){.shelter-screen .shelter-bottom .shelter-skill-icon{width:50px;height:50px}.shelter-agent-turn-ring{height:18px;width:90px}}

/* Shelter actions use the same painted crest and caption layout as combat. */
.shelter-screen .shelter-bottom .shelter-dice-panel .battle-confirm-stack{height:114px;grid-template-rows:88px 22px;gap:3px;align-self:auto}
.shelter-screen .shelter-bottom .shelter-dice-panel .battle-confirm-stack>b{color:#88bce9}
.shelter-dice-panel .shelter-die{height:42px;width:42px;font-size:34px;border:0;background:none}
.shelter-screen .shelter-person.incapacitated{opacity:1;filter:drop-shadow(0 6px 3px #0008);height:clamp(150px,27vh,310px)}
.shelter-cinema{position:fixed;inset:0;z-index:900;pointer-events:all;overflow:hidden;animation:shelter-cinema-in .3s ease-out}
.shelter-cinema-shade{position:absolute;inset:0;background:#070d18a8}
.shelter-water-trail{position:absolute;width:110%;height:76%;left:-5%;top:6%;object-fit:fill;animation:shelter-water-in .45s ease-out}
.shelter-cinema-party{position:absolute;left:24%;right:4%;bottom:22%;height:46%;display:flex;align-items:flex-end;justify-content:space-evenly;gap:1%}
.shelter-cinema-member{position:relative;flex:1;min-width:0;height:100%;display:flex;align-items:flex-end;justify-content:center;animation:shelter-cinema-in .4s ease-out}
.shelter-cinema-member>img:first-child{width:100%;height:100%;object-fit:contain;object-position:center bottom}
.shelter-opening-agent{position:absolute;left:2%;bottom:22%;width:23%;height:46%;object-fit:contain;object-position:center bottom;animation:shelter-cinema-in .4s ease-out}
.shelter-recovery-fx{position:absolute;left:0;top:-4%;width:100%;height:65%;object-fit:contain;animation:shelter-recovery 1.1s ease-out forwards;filter:drop-shadow(0 0 8px #fff1a988)}
.shelter-cinema.returning{opacity:0;transition:opacity .3s}
@keyframes shelter-cinema-in{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:none}}
@keyframes shelter-water-in{from{opacity:0;transform:translateX(-30%)}to{opacity:1;transform:none}}
@keyframes shelter-recovery{0%{opacity:0;transform:translateY(25px) scale(.7)}25%{opacity:1}80%{opacity:1}100%{opacity:0;transform:translateY(-45px) scale(1.05)}}
@media(max-width:760px){.shelter-screen .shelter-bottom .shelter-dice-panel .battle-confirm-stack{height:74px;grid-template-rows:54px 17px}.shelter-cinema-party{left:25%;right:1%;height:36%}.shelter-opening-agent{height:36%;width:25%}}
@media(prefers-reduced-motion:reduce){.shelter-cinema,.shelter-cinema-member,.shelter-water-trail,.shelter-recovery-fx{animation:none}.shelter-opening-agent{animation:none}}

.shelter-gain{position:absolute;left:50%;top:24%;transform:translateX(-50%);font-size:24px;white-space:nowrap;color:#a8d5ff;text-shadow:0 2px 5px #081321;animation:shelter-recovery 1.1s ease-out forwards}
/* Shelter uses undistorted scenery and combat-sized actions and vitals. */
.battle-screen.shelter-screen{grid-template-rows:104px minmax(0,1fr) 250px}
.shelter-lamp{width:70px;height:78px;object-fit:contain;flex:none}
.shelter-screen .shelter-field[data-ui-frame="battlefield"]{background-image:url(shelter/rest-background-v1.webp)!important;background-size:contain!important;background-position:center bottom!important;background-color:#11100d!important}
.shelter-screen .shelter-field[data-ui-frame="battlefield"]::before{background-image:url(shelter/rest-background-v1.webp)!important;background-size:contain!important;background-position:center bottom!important;background-color:#11100d!important;inset:0}
.shelter-unit{position:absolute;transform:translateX(-50%);width:18%;height:1px;border:0;background:none;padding:0;overflow:visible;z-index:2;opacity:1!important;cursor:pointer}
.shelter-unit .shelter-person{position:absolute;left:50%;bottom:0;transform:translateX(-50%);pointer-events:none}
.shelter-unit::after{content:"";position:absolute;bottom:-5px;left:50%;transform:translateX(-50%);width:110px;height:24px;background:url(ui/selection-light-woven-blue.webp) center/100% 100% no-repeat;opacity:0;z-index:-1;pointer-events:none}
.shelter-unit.target::after{opacity:1}.shelter-unit.target{filter:drop-shadow(0 0 3px #86bbe988)}
.shelter-vital>div{position:relative;min-width:100px}.shelter-vital .route-health-frame{position:relative;height:26px;width:140px;background:none;padding:0;border:0}
.shelter-vital progress{appearance:none;display:block;position:absolute;inset:0;width:100%;height:100%;border:1px solid #b5985e;border-radius:4px;overflow:hidden;background:#182019}
.shelter-vital progress::-webkit-progress-bar{background:#151f1a}.shelter-vital progress::-webkit-progress-value{background:#739b80}.shelter-vital progress::-moz-progress-bar{background:#739b80}
.shelter-vital .shelter-hp-value{position:absolute;top:24px;left:0;width:140px;text-align:center;font-size:13px;line-height:22px;color:#f0ead9;text-shadow:0 1px 3px #000}
.shelter-vital .tp-pips{display:flex;gap:4px;justify-content:center;height:18px;padding:5px 0;margin:0}
.shelter-vital .tp-pips i{width:12px;height:12px;display:block;border:1px solid #586378;background:#18202e;transform:rotate(45deg)}.shelter-vital .tp-pips i.on{background:#79b4dc;border-color:#b3d4e7;box-shadow:0 0 4px #6badd077}
.shelter-controls{grid-template-columns:repeat(5,minmax(0,1fr));gap:10px}
.shelter-screen .shelter-bottom .skill-icon{width:88px;height:88px;display:block;flex:none;margin:0 0 5px}
.shelter-screen .shelter-bottom .skill-inner>img{width:100%;height:100%;object-fit:cover}
.shelter-screen .shelter-bottom .skill-frame{position:absolute;inset:0;width:100%;height:100%;object-fit:contain}
.shelter-screen .shelter-bottom[data-ui-frame]{grid-template-columns:minmax(0,1fr) 112px minmax(180px,.48fr)}
.shelter-die:empty{display:none}
@media(max-width:1000px){.shelter-screen .shelter-bottom[data-ui-frame]{grid-template-columns:minmax(0,1fr) 100px}.shelter-screen .shelter-bottom .shelter-log{display:none}.shelter-vital .route-health-frame,.shelter-vital .shelter-hp-value{width:105px}}
@media(max-width:760px){.battle-screen.shelter-screen{grid-template-rows:106px minmax(0,1fr) 220px}.shelter-top{flex-direction:row;gap:8px}.shelter-lamp{width:42px;height:60px}.shelter-vital>div{min-width:0}.shelter-vital .route-health-frame,.shelter-vital .shelter-hp-value{width:70px}.shelter-vital .tp-pips{gap:3px}.shelter-vital .tp-pips i{width:7px;height:7px}.shelter-screen .shelter-bottom .skill-icon{width:clamp(38px,8vw,64px);height:clamp(38px,8vw,64px)}.shelter-screen .shelter-bottom[data-ui-frame]{grid-template-rows:1fr}.shelter-command b{font-size:12px}.shelter-unit::after{width:70px;height:16px}}

.shelter-unit{height:clamp(150px,27vh,310px)}
@media(max-width:760px){.shelter-unit{height:170px}}
.shelter-vital .route-health-frame progress{inset:5px 18px;width:calc(100% - 36px);height:calc(100% - 10px);border:0;border-radius:0;background:#251816}
.shelter-vital progress::-webkit-progress-value{background:#aa5147}.shelter-vital progress::-moz-progress-bar{background:#aa5147}
.shelter-vital .shelter-hp-value{z-index:3;top:22px;font-size:12px;line-height:26px}

/* Layout anchors vitals within the frame and reuses battle gas-light pips. */
.shelter-vital .route-health-frame{display:block;position:relative;height:30px}
.shelter-vital .route-health-frame .shelter-hp-value{position:absolute;inset:0;width:auto;height:100%;margin:0;display:flex;align-items:center;justify-content:center;line-height:1;font-size:12px;pointer-events:none}
.shelter-screen .shelter-vital .tp-pips{height:26px;padding:0;gap:3px}
.shelter-screen .shelter-vital .tp-pips i{width:14px;height:23px;flex:0 0 14px;border:0;transform:none;border-radius:0;background:transparent url(ui/tp-gas-unlit.webp) center/contain no-repeat;box-shadow:none}
.shelter-screen .shelter-vital .tp-pips i.filled{background-image:url(ui/tp-gas-lit.webp);filter:drop-shadow(0 0 2px #efb74866)}
.shelter-screen .shelter-vital .tp-pips.azure-tp i.filled{filter:hue-rotate(165deg) saturate(.85) drop-shadow(0 0 2px #72caff88)}
.shelter-unit .shelter-person.shelter-mirrored{transform:translateX(-50%) scaleX(-1)}
.shelter-screen .shelter-command.skill-unavailable{filter:grayscale(1);opacity:.45;cursor:pointer}
.shelter-screen .shelter-dice-panel [data-shelter-roll]:disabled{filter:grayscale(1);opacity:.4;cursor:default}
.shelter-screen .shelter-field[data-ui-frame="battlefield"],.shelter-screen .shelter-field[data-ui-frame="battlefield"]::before{background-image:url(shelter/rest-background-close-v4.webp)!important;background-size:cover!important;background-position:center bottom!important}
.shelter-cinema{z-index:900;animation:none;pointer-events:all}
.shelter-cinema [hidden]{display:none!important}
.shelter-dice-overlay{z-index:950}
.shelter-water-trail{animation:none;object-fit:contain;top:12%;height:68%;z-index:0}
.shelter-cinema .cinema-shade{z-index:-1}
.shelter-opening-agent{animation:none;left:3%;bottom:22%;height:46%;width:23%;transform-origin:center bottom}
.shelter-cinema-party{left:28%;right:3%;bottom:22%;height:46%}
.shelter-cinema-member{animation:none}
.shelter-recovery-fx{width:52%;height:48%;left:24%;top:28%;animation:shelter-orbit 1.9s ease-in-out both;animation-delay:calc(var(--orbit-index)*.12s);z-index:8}
@keyframes shelter-orbit{0%{opacity:0;transform:translate(-50%,25%) scale(.5)}20%{opacity:1;transform:translate(30%,-45%) scale(.8)}55%{opacity:1;transform:translate(-35%,-85%) scale(1)}80%{opacity:1;transform:translate(-60%,-15%) scale(.8)}100%{opacity:0;transform:translate(35%,15%) scale(.5)}}
.shelter-gain{z-index:10;animation:damage-rise .9s ease-out forwards}
@media(max-width:760px){.shelter-screen .shelter-vital .tp-pips i{width:9px;flex-basis:9px;height:20px}.shelter-screen .shelter-vital .tp-pips{gap:1px}.shelter-vital .route-health-frame .shelter-hp-value{font-size:10px}.shelter-opening-agent{width:25%;height:36%}.shelter-cinema-party{height:36%}}

/* Combat-sized close-ups, body-bound buffs, and a plain enemy-selection crest. */
.shelter-unit.target{filter:none;box-shadow:none}.shelter-unit::after{background-image:url(ui/selection-light-woven-gold.webp);filter:none;box-shadow:none;animation:none}
.shelter-opening-agent{left:1%;bottom:15%;height:70%;width:27%;animation:none}
.shelter-cinema-party{left:25%;right:1%;bottom:15%;height:70%}
.shelter-cinema-member>img:first-child{width:100%;height:100%;object-fit:contain;object-position:center bottom}
.shelter-recovery-fx{width:115%;height:95%;left:-7.5%;top:0;filter:none;animation:shelter-body-buff 2.15s ease-in-out both}
@keyframes shelter-body-buff{0%{opacity:0;transform:translateY(20px)}20%,75%{opacity:1;transform:none}100%{opacity:0;transform:translateY(-24px)}}
.shelter-search-fx{position:absolute;left:40%;top:15%;width:45%;height:65%;object-fit:contain;animation:shelter-body-buff 2.15s ease-in-out both}
.shelter-cinema-aid .shelter-cinema-party{left:35%;right:12%}
.shelter-search-reward{z-index:950}.shelter-search-reward .battle-retreat-result{width:min(520px,88vw);padding:30px;display:grid;gap:20px;text-align:center}.shelter-found{font-size:20px;color:#ddd3bd;line-height:1.6}.shelter-search-reward h2{color:#c7ac72;margin:0}
@media(max-width:760px){.shelter-opening-agent{height:65%;width:27%}.shelter-cinema-party{height:65%;left:26%;right:0}.shelter-recovery-fx{width:125%;left:-12.5%}.shelter-search-fx{left:33%;width:60%}}
@media(prefers-reduced-motion:reduce){.shelter-recovery-fx,.shelter-search-fx{animation:none}}

.shelter-cinema-member>img:first-child{width:160%;max-width:none;flex-shrink:0;height:100%}

.shelter-cinema .shelter-water-trail{top:0;left:-5%;width:110%;height:100%;object-fit:cover;opacity:.65;z-index:-1}
.shelter-lamp{transform:translateX(-14px) scale(1.28);transform-origin:center}
@media(max-width:760px){.shelter-lamp{transform:translateX(-5px) scale(1.2)}}

/* Match battle close-up scale and keep the agent's active-turn marker visible. */
.shelter-lamp{transform:translate(-14px,-9px) scale(1.28)}
.shelter-agent-turn-ring{display:block;left:14%;bottom:11%;filter:none;opacity:1;animation:none}
.shelter-controls{gap:clamp(14px,2vw,30px)}
.shelter-screen .shelter-bottom[data-ui-frame]{grid-template-columns:minmax(0,1fr) 112px minmax(150px,.28fr);column-gap:26px}
.shelter-screen .shelter-bottom>.shelter-command-panel{justify-content:flex-start}
.shelter-dice-panel{justify-content:flex-start;padding-top:0;gap:8px}
.shelter-screen .shelter-bottom .shelter-dice-panel .battle-confirm-stack{height:114px;grid-template-rows:88px 22px;align-self:center}
.shelter-cinema{isolation:isolate}.shelter-cinema .cinema-shade{z-index:0;background:#02060df2}
.shelter-cinema .shelter-water-trail{z-index:1;opacity:.5}
.shelter-opening-agent{z-index:2;left:3%;bottom:22%;height:clamp(230px,46vh,440px);width:23%}
.shelter-cinema-party{z-index:2;left:28%;right:3%;bottom:22%;height:clamp(230px,46vh,440px)}
.shelter-cinema-member{transform-origin:center bottom}.shelter-cinema-member>img:first-child{width:120%;height:100%;max-width:none}
@media(max-width:1000px){.shelter-screen .shelter-bottom[data-ui-frame]{grid-template-columns:minmax(0,1fr) 100px;column-gap:18px}}
@media(max-width:760px){.shelter-lamp{transform:translate(-5px,-6px) scale(1.2)}.shelter-controls{gap:8px}.shelter-screen .shelter-bottom .shelter-dice-panel .battle-confirm-stack{height:auto;grid-template-rows:clamp(38px,8vw,64px) 20px}.shelter-dice-panel .battle-confirm-crest{height:clamp(38px,8vw,64px);width:clamp(38px,8vw,64px)}.shelter-opening-agent,.shelter-cinema-party{height:min(280px,46vh)}.shelter-opening-agent{width:25%}}

/* The shared combat renderer owns shelter cinematics. */
.shelter-battle-cinema{z-index:900;pointer-events:all}
.shelter-screen.cinematic .shelter-person,.shelter-screen.cinematic .shelter-unit::after,.shelter-screen.cinematic .shelter-agent-turn-ring{visibility:hidden}

/* Shelter uses the centered shared close-up, with the agent facing her party. */
.shelter-battle-cinema{isolation:isolate}
.shelter-battle-cinema .cinema-shade{z-index:0;background:#02060de6}
.shelter-battle-cinema .cinema-oil-backdrop{z-index:1;display:block!important;opacity:1}
.shelter-battle-cinema .cinema-performer{z-index:2}
.shelter-battle-cinema .cinema-actor.ally canvas{transform:none}
