/* Keep the original desktop-style room and object controls in handheld landscape. */
#sanctuary-view[data-room-hub][data-phone-dorm-wide][data-scene] {
  --hub-bar:calc(54px + env(safe-area-inset-top,0px));
  -webkit-text-size-adjust:100%; text-size-adjust:100%;
}
#sanctuary-view[data-room-hub][data-phone-dorm-wide][data-scene] .room-hub-toolbar {
  grid-template-columns:minmax(44px,1fr) auto minmax(90px,1fr);
  padding:env(safe-area-inset-top,0px) max(14px,env(safe-area-inset-right,0px)) 0 max(14px,env(safe-area-inset-left,0px));
  gap:4px;
}
#sanctuary-view[data-room-hub][data-phone-dorm-wide][data-scene=cyber] .room-hub-toolbar {
  padding-inline:max(38px,env(safe-area-inset-left,0px)) max(38px,env(safe-area-inset-right,0px));
}
#sanctuary-view[data-room-hub][data-phone-dorm-wide][data-scene] .room-hub-primary {gap:3px}
#sanctuary-view[data-room-hub][data-phone-dorm-wide][data-scene] .room-hub-toolbar .room-hub-action {
  width:clamp(44px,7vw,62px);min-width:44px;min-height:44px;height:44px;padding:5px;
}
#sanctuary-view[data-room-hub][data-phone-dorm-wide][data-scene] .room-hub-toolbar .room-hub-label {
  position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;
}
#sanctuary-view[data-room-hub][data-phone-dorm-wide][data-scene] .room-hub-toolbar .room-hub-icon {width:23px;height:23px}
@media(max-width:640px) {
  #sanctuary-view[data-room-hub][data-phone-dorm-wide][data-scene] .room-hub-toolbar {
    padding-inline:max(8px,env(safe-area-inset-left,0px)) max(8px,env(safe-area-inset-right,0px));
  }
  #sanctuary-view[data-room-hub][data-phone-dorm-wide][data-scene] .room-hub-toolbar .room-hub-primary {justify-content:flex-start;overflow-x:auto;scrollbar-width:none}
}
#sanctuary-view[data-room-hub][data-phone-dorm] #sanctuary-fullscreen-status:not([hidden]) {
  position:absolute;z-index:80;bottom:max(14px,env(safe-area-inset-bottom,0px));left:50%;transform:translateX(-50%);
  width:max-content;max-width:calc(100% - 24px);margin:0;padding:10px 15px;border-radius:9px;
  background:var(--hub-base);color:var(--hub-ink);font:15px/1.4 system-ui,sans-serif;
}
/* Only the phone save dialog; actual text/controls reflow instead of being transformed. */
#sanctuary-view[data-room-hub][data-phone-dorm] #sanctuary-backpack.room-hub-welcome[data-welcome=true][open] {
  inset:0;box-sizing:border-box;width:min(590px,calc(100vw - 28px));max-width:calc(100vw - 28px);
  max-height:calc(100dvh - 22px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));
  margin:auto;padding:0;overflow:auto;overscroll-behavior:contain;
}
#sanctuary-view[data-room-hub][data-phone-dorm] #sanctuary-backpack[data-welcome=true] .sanctuary-dialog-head {
  min-height:0;padding:13px 17px;border-bottom:1px solid var(--san-line);
}
#sanctuary-view[data-room-hub][data-phone-dorm] #sanctuary-backpack[data-welcome=true] .sanctuary-dialog-head h2 {font:600 16px/1.35 system-ui,sans-serif}
#sanctuary-view[data-room-hub][data-phone-dorm] #sanctuary-backpack[data-welcome=true] .sanctuary-panel {max-height:none;overflow:visible;padding:0}
#sanctuary-view[data-room-hub][data-phone-dorm] #sanctuary-backpack[data-welcome=true] .sanctuary-welcome {padding:17px;font:16px/1.45 system-ui,sans-serif}
#sanctuary-view[data-room-hub][data-phone-dorm] #sanctuary-backpack[data-welcome=true] .sanctuary-welcome p {font-size:15px;line-height:1.5}
#sanctuary-view[data-room-hub][data-phone-dorm] #sanctuary-backpack[data-welcome=true] .sanctuary-welcome h3 {font-size:24px}
#sanctuary-view[data-room-hub][data-phone-dorm] #sanctuary-backpack[data-welcome=true] .sanctuary-button-row {display:flex;flex-wrap:wrap;gap:8px}
#sanctuary-view[data-room-hub][data-phone-dorm] #sanctuary-backpack[data-welcome=true] .sanctuary-button-row button {flex:1 1 auto;font-size:15px}
#sanctuary-view[data-room-hub][data-phone-dorm-wide] :is(#sanctuary-backpack-dock,#sanctuary-side-companion-r27).room-hub-workspace {
  width:min(610px,calc(100vw - 28px));max-width:calc(100vw - 28px);max-height:calc(100dvh - var(--hub-bar) - 12px);
}
/* One thin rail above the room. Original actions stay in their original groups.
   Only the middle action strip scrolls on exceptionally narrow portrait screens. */
#sanctuary-view[data-room-hub][data-hud-r38][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true]){
  --hub-bar:calc(46px + env(safe-area-inset-top,0px)) !important;
}
#sanctuary-view[data-room-hub][data-hud-r38][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true])>.room-hub-toolbar{
  display:grid!important;grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;column-gap:4px;height:var(--hub-bar);min-height:0;
  padding:env(safe-area-inset-top,0px) max(5px,env(safe-area-inset-right,0px)) 0 max(5px,env(safe-area-inset-left,0px));
  overflow:visible;z-index:54;
}
#sanctuary-view[data-room-hub][data-hud-r38][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true]) .room-hub-toolbar :is(.room-hub-start,.room-hub-primary,.room-hub-end){
  position:static;inset:auto;transform:none;display:flex;grid-row:1;gap:3px;align-items:center;min-width:0;max-width:100%;flex-wrap:nowrap;margin:0;padding:0;border:0;border-radius:0;background:none;box-shadow:none;height:44px;
}
#sanctuary-view[data-room-hub][data-hud-r38][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true]) .room-hub-start{grid-column:1}
#sanctuary-view[data-room-hub][data-hud-r38][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true]) .room-hub-primary{grid-column:2;width:100%;justify-content:safe center;overflow:auto hidden;scrollbar-width:thin;overscroll-behavior-inline:contain}
#sanctuary-view[data-room-hub][data-hud-r38][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true]) .room-hub-end{grid-column:3}
#sanctuary-view[data-room-hub][data-hud-r38][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true]) .room-hub-toolbar :is(button[data-hud42-compact],#sanctuary-fullscreen,#sanctuary-return,.room-hub-more,.hud38-room-lights,.hud38-room-lights input[type=checkbox]){
  box-sizing:border-box;flex:0 0 44px;width:44px;min-width:44px;max-width:44px;height:44px;min-height:44px;max-height:44px;margin:0;padding:5px;
}
#sanctuary-view[data-room-hub][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true]) .room-hub-toolbar .sanctuary-home-toggle{
  min-width:44px;max-width:clamp(52px,18vw,142px);min-height:44px;max-height:44px;padding:4px 7px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;
}
#sanctuary-view[data-room-hub][data-hud-r38][data-hud42-compact][data-scene][data-mobile-expanded-r39=true] .sanctuary-frame{
  top:var(--hub-bar)!important;height:calc(100dvh - var(--hub-bar))!important;
}
#sanctuary-view[data-room-hub][data-hud-r38][data-hud42-compact][data-scene][data-mobile-expanded-r39=true] .sanctuary-mobile-collapse39{
  top:auto;bottom:max(8px,env(safe-area-inset-bottom,0px));font-size:13px;min-height:44px;padding:6px 10px;
}
#sanctuary-view[data-room-hub][data-hud-r38][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true]) #sanctuary-window-view .sanctuary-window-head{
  min-height:46px;
}
/* Compete only with existing mobile material overrides, not desktop or modals. */
#sanctuary-view#sanctuary-view[data-room-hub][data-hud-r38][data-hud-art-r39][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true])>.room-hub-toolbar{
  grid-template:44px / auto minmax(0,1fr) auto!important;
  grid-template-areas:none!important;height:var(--hub-bar)!important;min-height:0!important;
  gap:4px!important;padding:env(safe-area-inset-top,0px) max(5px,env(safe-area-inset-right,0px)) 0 max(5px,env(safe-area-inset-left,0px))!important;
}
#sanctuary-view#sanctuary-view[data-room-hub][data-hud-r38][data-hud-art-r39][data-hud42-compact][data-scene=cyber]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true])>.room-hub-toolbar{
 --hud40-safe-inset:40px;
 padding-inline:max(40px,env(safe-area-inset-left,0px)) max(40px,env(safe-area-inset-right,0px))!important;
}
#sanctuary-view#sanctuary-view[data-room-hub][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native]) .sanctuary-frame{
 top:var(--hub-bar)!important;
}
#sanctuary-view#sanctuary-view[data-room-hub][data-hud-art-r39][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true])>.room-hub-toolbar .room-hub-start{grid-area:1/1!important}
#sanctuary-view#sanctuary-view[data-room-hub][data-hud-art-r39][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true])>.room-hub-toolbar .room-hub-primary{grid-area:1/2!important;position:static!important;height:44px!important}
#sanctuary-view#sanctuary-view[data-room-hub][data-hud-art-r39][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true])>.room-hub-toolbar .room-hub-end{grid-area:1/3!important}
#sanctuary-view#sanctuary-view[data-room-hub][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true])[data-window-open=true]>.room-hub-toolbar{visibility:hidden!important;pointer-events:none!important}

#sanctuary-view[data-phone-dorm] #sanctuary-fullscreen-status:not([hidden]){pointer-events:none}
#sanctuary-view[data-phone-dorm] #sanctuary-fullscreen-status:not([hidden]){
  top:calc(var(--hub-bar,46px) + 7px)!important;bottom:auto!important;
  height:auto!important;min-height:0!important;max-height:none!important;
}
/* Portrait preview is now the actual, interactive room. Only the pill is a button. */
#sanctuary-view#sanctuary-view[data-phone-dorm][data-mobile-r39=true][data-mobile-expanded-r39=false] #sanctuary-scene-bounds button{
 pointer-events:auto;
}
#sanctuary-view#sanctuary-view[data-phone-dorm][data-mobile-r39=true][data-mobile-expanded-r39=false] .sanctuary-mobile-expand39{
 inset:auto 8px 8px auto!important;width:max-content!important;height:34px!important;min-width:0!important;min-height:34px!important;padding:0!important;
}
#sanctuary-view#sanctuary-view[data-phone-dorm][data-mobile-r39=true][data-mobile-expanded-r39=false] .sanctuary-mobile-expand39 span{
 padding:5px 10px;font-size:12px;
}
#sanctuary-view#sanctuary-view[data-phone-dorm][data-mobile-r39=true] .sanctuary-mobile-header39{
 min-height:48px;padding-block:4px;gap:6px;
}
#sanctuary-view#sanctuary-view[data-phone-dorm][data-mobile-r39=true] .sanctuary-mobile-header39 .sanctuary-mobile-action39,
#sanctuary-view#sanctuary-view[data-phone-dorm][data-mobile-r39=true] .sanctuary-mobile-header39 #sanctuary-fullscreen{
 min-height:36px;height:36px;min-width:36px;width:36px;max-width:36px;padding:5px;
}
#sanctuary-view#sanctuary-view[data-phone-dorm][data-mobile-r39=true] .sanctuary-mobile-header39 .sanctuary-mobile-action39 span{
 position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;
}
#sanctuary-view#sanctuary-view[data-phone-dorm][data-mobile-r39=true] .sanctuary-mobile-actions39{
 padding:10px max(12px,env(safe-area-inset-right)) 12px max(12px,env(safe-area-inset-left));
}
#sanctuary-view#sanctuary-view[data-phone-dorm][data-mobile-r39=true] .sanctuary-mobile-actions39 .sanctuary-mobile-action39{
 min-height:42px;padding:5px;font-size:12px;gap:5px;flex-direction:row;
}
#sanctuary-view#sanctuary-view[data-phone-dorm][data-mobile-r39=true] .sanctuary-mobile-secondary39{
 margin-top:8px;padding-top:8px;
}
#sanctuary-view#sanctuary-view[data-room-hub][data-hud-r38][data-hud-art-r39][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true]){
 --hub-bar:calc(38px + env(safe-area-inset-top,0px))!important;
}
#sanctuary-view#sanctuary-view[data-room-hub][data-hud-r38][data-hud-art-r39][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true])>.room-hub-toolbar{
 grid-template-rows:36px!important;
}
#sanctuary-view#sanctuary-view[data-room-hub][data-hud-r38][data-hud-art-r39][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true])>.room-hub-toolbar :is(.room-hub-start,.room-hub-primary,.room-hub-end){
 height:36px!important;
}
#sanctuary-view#sanctuary-view[data-room-hub][data-hud-r38][data-hud-art-r39][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true])>.room-hub-toolbar :is(button[data-hud42-compact],#sanctuary-fullscreen,#sanctuary-return,.room-hub-more,.hud38-room-lights,.hud38-room-lights input[type=checkbox]){
 flex:0 0 36px!important;width:36px!important;min-width:36px!important;max-width:36px!important;height:36px!important;min-height:36px!important;max-height:36px!important;padding:4px!important;
}
#sanctuary-view#sanctuary-view[data-room-hub][data-hud-art-r39][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true])>.room-hub-toolbar :is(.room-hub-icon,#sanctuary-fullscreen>svg:not(.hud39-material-art)){
 width:19px!important;height:19px!important;flex-basis:19px!important;
}
#sanctuary-view#sanctuary-view[data-room-hub][data-hud-art-r39][data-hud42-compact][data-scene]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true])>.room-hub-toolbar :is(.sanctuary-home-toggle,.sanctuary-cat-cap41){
 min-height:36px!important;max-height:36px!important;
}

#sanctuary-view#sanctuary-view[data-room-hub][data-hud-r38][data-hud-art-r39][data-hud42-compact][data-scene=cyber]:is([data-phone-dorm-wide],[data-phone-dorm-native],[data-mobile-expanded-r39=true])>.room-hub-toolbar>.sanctuary-cat-cap41{
 width:36px!important;min-width:36px!important;max-width:36px!important;
}
/* Content-first dorm sheets, scoped to handhelds. Keep a single scrolling body
   for longer conversations and large accessibility text. */
#sanctuary-view[data-phone-dorm] {
 --dorm-sheet-gap:max(8px,env(safe-area-inset-bottom,0px));
 --dorm-sheet-max:calc(100dvh - var(--dorm-sheet-gap) - max(8px,env(safe-area-inset-top,0px)) - 46px);
}
#sanctuary-view#sanctuary-view[data-phone-dorm][data-room-hub][data-hud-r38][data-scene] :is(#sanctuary-side-companion-r27,#sanctuary-backpack-dock).room-hub-workspace:not([hidden]){
 box-sizing:border-box;
 inset:auto max(8px,env(safe-area-inset-right,0px)) var(--dorm-sheet-gap) max(8px,env(safe-area-inset-left,0px))!important;
 width:auto!important;max-width:640px!important;height:auto!important;max-height:var(--dorm-sheet-max)!important;min-height:0;
 margin:0 auto!important;transform:none!important;z-index:120;overflow:hidden!important;
}
#sanctuary-view#sanctuary-view[data-phone-dorm] :is(#sanctuary-side-companion-r27,#sanctuary-backpack-dock) :is(.room-hub-conversation-head,.sanctuary-dialog-head){
 flex:0 0 auto;min-height:44px;max-height:none;box-sizing:border-box;padding:4px 12px;position:static;
}
#sanctuary-view#sanctuary-view[data-phone-dorm] :is(#sanctuary-side-companion-r27,#sanctuary-backpack-dock) :is(.room-hub-conversation-head,.sanctuary-dialog-head) h2{
 font-size:clamp(16px,4vw,20px);line-height:1.25;
}
#sanctuary-view#sanctuary-view[data-phone-dorm] :is(#sanctuary-side-companion-r27,#sanctuary-backpack-dock) :is(.room-hub-close,.sanctuary-dialog-close){
 width:38px;min-width:38px;height:38px;min-height:38px;padding:7px;
}
#sanctuary-view#sanctuary-view[data-phone-dorm] #sanctuary-side-companion-r27>[data-sanctuary-docked]{
 display:flex!important;flex:1 1 auto;flex-direction:column;min-height:0;max-height:none;overflow:hidden!important;
}
#sanctuary-view#sanctuary-view[data-phone-dorm] #sanctuary-side-companion-r27 #sanctuary-resident-dialog>.room-hub-conversation-head{
 flex:0 0 auto;min-height:44px;
}
#sanctuary-view#sanctuary-view[data-phone-dorm] #sanctuary-side-companion-r27>[data-sanctuary-docked]>:not(.room-hub-conversation-head):not([hidden]),
#sanctuary-view#sanctuary-view[data-phone-dorm] #sanctuary-side-companion-r27 #ar-azeroth-bubble:not([hidden]),
#sanctuary-view#sanctuary-view[data-phone-dorm] #sanctuary-backpack-dock .sanctuary-panel{
 flex:1 1 auto;min-height:0!important;max-height:none!important;padding:10px 14px 14px!important;overflow:auto!important;
 overscroll-behavior:contain;scroll-padding:12px;
}
#sanctuary-view#sanctuary-view[data-phone-dorm] #sanctuary-side-companion-r27 #ar-azeroth-bubble>.ar-azeroth-footer35{
 padding-top:8px;margin-top:0;
}
#sanctuary-view#sanctuary-view[data-phone-dorm] #sanctuary-side-companion-r27 #ar-azeroth-bubble .ar-azeroth-name-form{
 margin-block:8px;padding:8px;gap:6px;
}
#sanctuary-view#sanctuary-view[data-phone-dorm] #sanctuary-side-companion-r27 #ar-azeroth-bubble .ar-azeroth-name-form input{
 min-height:40px;font-size:max(16px,1em);
}
#sanctuary-view#sanctuary-view[data-phone-dorm] #sanctuary-side-companion-r27 #ar-azeroth-bubble .ar-azeroth-name-form button{
 min-height:36px;padding:5px 10px;
}
#sanctuary-view#sanctuary-view[data-phone-dorm] #sanctuary-side-companion-r27 #ar-azeroth-bubble .ar-azeroth-name-form:not([hidden]){
 display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr);
}
#sanctuary-view#sanctuary-view[data-phone-dorm] #sanctuary-side-companion-r27 #ar-azeroth-bubble .ar-azeroth-name-form :is(label,p){
 grid-column:1/-1;margin:0!important;
}
#sanctuary-view#sanctuary-view[data-phone-dorm] #sanctuary-side-companion-r27 #ar-azeroth-bubble .ar-azeroth-name-form input{
 grid-column:1/3;min-width:0;width:100%;
}
#sanctuary-view#sanctuary-view[data-phone-dorm] #sanctuary-side-companion-r27 #ar-azeroth-bubble .ar-azeroth-name-form button{
 white-space:normal;overflow-wrap:normal;line-height:1.2;font-size:13px;
}
#sanctuary-view#sanctuary-view[data-phone-dorm] #sanctuary-side-companion-r27 :is(.ar-azeroth-choices,.ar-agandar-dialogue-actions,.ar-azeroth-bubble-actions){
 display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin-block:6px;
}
#sanctuary-view#sanctuary-view[data-phone-dorm] #sanctuary-side-companion-r27 :is(.ar-azeroth-choices,.ar-agandar-dialogue-actions,.ar-azeroth-bubble-actions)>button {
 min-width:0;min-height:38px;white-space:normal;overflow-wrap:break-word;padding:6px 9px;line-height:1.2;
}
#sanctuary-view#sanctuary-view[data-phone-dorm] #sanctuary-side-companion-r27 #ar-azeroth-bubble .ar-azeroth-personal-greeting{
 margin-block:6px 8px;
}
/* A floating assistant launcher must not cover the active sheet's actions. */
body:has(#sanctuary-view[data-phone-dorm]:not([hidden]) :is(#sanctuary-side-companion-r27,#sanctuary-backpack-dock).room-hub-workspace:not([hidden])) ar-avdi-companion{
 visibility:hidden!important;pointer-events:none!important;
}
