/* Grimwood V20.6 · Caza Adaptativa · UI fluida + rendimiento */
:root{--gw-ui:1}
html,body,#game{width:100%;height:100%;max-width:100%;max-height:100%;overflow:hidden}
#panel{box-sizing:border-box;width:min(920px,calc(100vw - max(20px,env(safe-area-inset-left)) - max(20px,env(safe-area-inset-right))));max-width:calc(100vw - 16px);max-height:calc(100dvh - max(16px,env(safe-area-inset-top)) - max(16px,env(safe-area-inset-bottom)));overflow:hidden;grid-template-rows:auto minmax(0,1fr) auto}
#panel[open]{display:grid}
#panel-body{min-height:0;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scrollbar-gutter:stable;padding-right:clamp(0px,1vw,8px)}
#panel-footer{position:sticky;bottom:0;z-index:8;background:linear-gradient(180deg,transparent,#0a0d0df4 28%);padding-bottom:max(2px,env(safe-area-inset-bottom));flex-wrap:wrap}
#panel-footer>button{min-width:min(180px,42vw);min-height:clamp(42px,7vh,54px)}
#panel h2{font-size:clamp(24px,calc(38px * var(--gw-ui)),40px);margin-block:clamp(8px,2vh,16px)}
#panel-body{font-size:clamp(13px,calc(16px * var(--gw-ui)),16px)}
.cards,.equip-grid,.achievement-grid,.profile-grid,.slot-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,190px),1fr))!important}
.choice,.profile-card,.save-slot{min-height:clamp(92px,calc(150px * var(--gw-ui)),190px)!important;padding:clamp(12px,2.2vw,22px)!important}
.choice strong,.profile-card strong,.save-slot strong{font-size:clamp(16px,calc(22px * var(--gw-ui)),24px)!important}
.choice small,.profile-card small,.save-slot small{font-size:clamp(11px,calc(13px * var(--gw-ui)),14px)!important;line-height:1.42!important}
.settings-book{grid-template-columns:repeat(auto-fit,minmax(min(100%,250px),1fr))!important;align-items:start}.settings-section{padding:clamp(12px,2vw,18px)!important}.settings-section .setting{gap:10px;min-width:0}.settings-section .setting>span{min-width:0}.settings-section input[type=range]{width:clamp(105px,14vw,160px);max-width:44vw}.settings-section select{max-width:48%;min-width:120px}
#reward-action{max-width:min(88vw,520px);white-space:normal;text-align:center;line-height:1.25;padding:clamp(10px,1.6vh,14px) clamp(14px,2vw,24px)!important;font-size:clamp(12px,calc(16px * var(--gw-ui)),17px)!important;bottom:max(92px,calc(env(safe-area-inset-bottom) + 9vh))}
#interact-prompt{max-width:min(88vw,560px);white-space:normal;line-height:1.25}
#toast{max-width:min(86vw,560px);font-size:clamp(10px,calc(13px * var(--gw-ui)),14px)!important;line-height:1.35}
#boss-hud{width:min(76vw,650px)!important;max-height:min(84px,14vh);transform-origin:top center}.boss-copy{min-width:0}#boss-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:clamp(12px,calc(18px * var(--gw-ui)),19px)!important}#boss-phase{font-size:clamp(8px,calc(10px * var(--gw-ui)),11px)!important}
.room-heading{max-width:min(58vw,760px)}.room-heading h2{font-size:clamp(13px,calc(24px * var(--gw-ui)),26px)!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.player-vitals{transform-origin:top left;max-width:min(44vw,330px)}
#objective{max-width:min(36vw,430px);font-size:clamp(10px,calc(12px * var(--gw-ui)),13px)}#objective-text{overflow-wrap:anywhere}
dialog[data-kind=dialogue]{width:min(930px,calc(100vw - 20px));bottom:max(8px,env(safe-area-inset-bottom));max-height:min(72dvh,600px);padding:clamp(14px,3vw,30px)!important}dialog[data-kind=dialogue] #panel-body{overflow:auto}.dialogue-page{min-height:0!important}.spoken{font-size:clamp(15px,calc(21px * var(--gw-ui)),23px)!important;line-height:clamp(1.42,1.55,1.65)!important;max-width:none!important}.dialogue-location,.dialogue-count{font-size:clamp(9px,calc(11px * var(--gw-ui)),12px)!important}
.demo-splash-card,.title-content{max-height:calc(100dvh - 16px);overflow:auto;overscroll-behavior:contain}.demo-splash-card{width:min(940px,94vw)!important;padding:clamp(14px,3vw,34px)!important}.device-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr))!important}.device-card{min-height:clamp(120px,24vh,190px)!important}
body[data-graphics-quality="low"] #vignette{opacity:.72}body[data-graphics-quality="low"] #boss-hud:after{display:none}
@media(max-width:900px),(max-height:680px){#panel{padding:clamp(14px,2.6vw,24px)!important}.settings-book{grid-template-columns:1fr!important}.controls-page{grid-column:auto!important}.control-player-grid{grid-template-columns:1fr!important}.room-heading{max-width:52vw}.player-vitals{max-width:39vw}#objective{max-width:42vw}}
@media(max-width:760px){#panel{width:calc(100vw - 12px)!important;max-width:none!important;margin:auto 6px max(6px,env(safe-area-inset-bottom))!important;padding:14px!important}#panel-footer{gap:6px;margin-top:10px!important}#panel-footer>button{flex:1 1 42%;min-width:0!important}.settings-section .setting{align-items:flex-start;flex-wrap:wrap!important}.settings-section .setting>span{flex:1 1 100%}.settings-section input[type=range],.settings-section select{width:100%!important;max-width:none!important}.room-heading{top:max(70px,calc(env(safe-area-inset-top) + 66px))!important;width:58vw!important;max-width:58vw!important}.player-vitals{width:min(46vw,210px)!important}.top-actions{max-width:48vw}.currency{font-size:11px!important}#objective{max-width:min(72vw,360px)!important}.spoken{font-size:clamp(15px,4.3vw,19px)!important}.topic-list button{padding:13px 0!important}.topic-list strong{font-size:16px!important}.v13-boss-scene{grid-template-columns:minmax(78px,26vw) 1fr!important;gap:12px!important}.v13-boss-scene img{max-width:100%!important;height:auto!important}}
@media(max-height:520px) and (orientation:landscape){#panel{max-height:96dvh!important;padding:10px 15px!important}#panel h2{font-size:22px!important;margin:5px 0 8px!important;padding-bottom:8px!important}.panel-header{position:sticky;top:0;z-index:9;background:#0c0f0ff3}.choice,.profile-card,.save-slot{min-height:74px!important;padding:9px 12px!important}.choice .sigil{display:none!important}dialog[data-kind=dialogue]{max-height:94dvh!important;bottom:3px!important;padding:10px 16px!important}.spoken{font-size:15px!important;line-height:1.4!important}.dialogue-location{margin-bottom:5px!important}.dialogue-count{margin:2px 0!important}#panel-footer>button{min-height:38px!important}.player-vitals{transform:scale(.86)}.room-heading{top:5px!important}.room-heading h2{font-size:14px!important}#boss-hud{top:50px!important;max-height:50px!important}.touch-mode #reward-action{bottom:max(76px,calc(env(safe-area-inset-bottom) + 70px))!important}.touch-mode #objective{max-width:44vw!important}}
@media(max-width:420px) and (orientation:portrait){.title-links{grid-template-columns:1fr!important}.title-content h1{font-size:clamp(38px,15vw,58px)!important}.demo-mini-prologue p{font-size:12px!important}.room-heading{display:none}.player-vitals{width:min(58vw,220px)!important}.top-actions{max-width:44vw}.touch-mode #objective{bottom:max(176px,calc(env(safe-area-inset-bottom) + 168px))!important;max-width:78vw!important}.touch-mode #reward-action{bottom:max(150px,calc(env(safe-area-inset-bottom) + 144px))!important}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}
