body.keyboard-open{position:fixed;top:var(--visible-top,0px);left:0;width:100%;height:var(--visible-height,100dvh);min-height:0!important}
.keyboard-open .header{height:48px;min-height:48px;padding-block:0}
.keyboard-open .footer,.keyboard-open .day{display:none}
.keyboard-open #game-shell{margin:0 6px 6px}
.keyboard-open .team-dialog{grid-template-rows:minmax(0,1fr)!important;padding:8px 10px!important}
.keyboard-open .team-dialog>#dialog-title{position:absolute!important;width:1px!important;height:1px!important;overflow:hidden;clip-path:inset(50%)}
.keyboard-open .team-dialog>#dialog-close{display:none!important}
.keyboard-open .team-dialog>#dialog-content{grid-row:1!important}
.keyboard-open .team-scene-art,.keyboard-open .team-prompt,.keyboard-open .team-room-note,.keyboard-open .team-help{display:none!important}
.keyboard-open .team-lobby{gap:6px}
.keyboard-open .team-next{min-height:44px;padding:6px 9px}
.keyboard-open .team-next strong{font-size:13px}
.keyboard-open .team-lobby-footer{padding-top:6px;gap:6px}
.keyboard-open .team-dialog .team-feedback{max-height:2.7em;font-size:12px;padding:5px 8px}
.keyboard-open .team-dialog>.speech-stop{top:8px!important;left:10px!important;right:72px!important;max-width:calc(100% - 84px)}
.keyboard-open .team-dialog:has(>.speech-stop:not([hidden])) .team-summary{visibility:hidden}

/* Long menus use the same stable header and return button as activity sheets.
   The details scroll between them, so reading more never hides the way out. */
.dialog-card.device-sheet{display:grid;grid-template-columns:minmax(0,1fr) 44px;grid-template-rows:auto auto minmax(0,1fr) auto;gap:10px;width:min(760px,100%);height:100%;max-height:820px;overflow:hidden;padding:24px}
.device-sheet>#dialog-eyebrow{grid-column:1;grid-row:1;align-self:center;padding:0}
.device-sheet>#dialog-close{grid-column:2;grid-row:1;position:static;justify-self:end;min-width:44px;min-height:44px;margin:0}
.device-sheet>#dialog-title{grid-column:1;grid-row:2;align-self:center;padding:0;margin:0;font-size:28px;line-height:1.15;overflow-wrap:anywhere}
.device-sheet>#dialog-hear{grid-column:2;grid-row:2;float:none;margin:0;align-self:center;min-width:44px;min-height:44px}
.device-sheet>#dialog-content{grid-column:1/-1;grid-row:3;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;padding:0 4px 8px;scroll-padding:8px}
.device-sheet>#dialog-action{grid-column:1/-1;grid-row:4;min-height:48px;margin:0;gap:12px}
.device-sheet>.speech-stop.inline-speech{grid-column:1;grid-row:2;align-self:center;justify-self:start;margin:0;min-height:44px;max-width:100%}
.device-sheet:has(>.speech-stop:not([hidden]))>#dialog-title{visibility:hidden}
@media(max-width:1100px),(max-height:600px){
 .dialog-card.device-sheet{grid-template-columns:minmax(0,1fr) 44px 44px;grid-template-rows:auto minmax(0,1fr) auto;gap:8px;padding:12px;height:100%;max-height:100%}
 .device-sheet>#dialog-eyebrow{display:none}
 .device-sheet>#dialog-title,.device-sheet>.speech-stop.inline-speech{grid-column:1;grid-row:1;font-size:25px}
 .device-sheet>.speech-stop.inline-speech{font-size:14px;padding:6px 10px}
 .device-sheet>#dialog-hear{grid-column:2;grid-row:1}
 .device-sheet>#dialog-close{grid-column:3;grid-row:1}
 .device-sheet>#dialog-content{grid-row:2}
 .device-sheet>#dialog-action{grid-row:3;font-size:15px;padding:12px 14px}
 .device-sheet .pause-settings{display:grid;grid-template-columns:1fr 1fr;gap:8px}
 .device-sheet .pause-settings>.secondary-button{min-height:48px;margin:0;font-size:14px;padding:8px}
 .device-sheet .pause-settings>#pause-adventures{grid-column:1/-1}
}
@media(max-height:430px){
 .dialog-card.device-sheet{padding:8px 12px;gap:6px}
 .device-sheet>#dialog-title{font-size:22px}
 .device-sheet>#dialog-content{padding-bottom:4px}
 .device-sheet>#dialog-action{padding-block:8px}
 .device-sheet #dialog-content>p:first-child{margin-top:4px}
}
@media(max-width:360px){.device-sheet>#dialog-title{font-size:21px}}
@media(max-width:1100px),(max-height:600px){
 .device-sheet .difficulty-option .difficulty-picture{font-size:12px;line-height:1.25}
 .device-sheet .difficulty-option{gap:5px;min-height:0;padding:9px 5px}
 .device-sheet .difficulty-option .difficulty-leaves{height:32px;flex-basis:32px}
 .device-sheet .difficulty-options{gap:8px}
}
@media(max-height:430px){
 .device-sheet:has(#difficulty-controls) #dialog-content>p:first-child{font-size:13px;margin:0 0 4px;line-height:1.3}
 .device-sheet .difficulty-choices{margin-top:2px}
 .device-sheet .difficulty-choices legend{float:left;display:flex;align-items:center;min-height:44px;margin:0 12px 0 0;font-size:16px}
 .device-sheet .difficulty-explainer{min-height:44px;margin:0 0 4px}
 .device-sheet .difficulty-explainer p{font-size:12px}
 .device-sheet .difficulty-options{clear:both}
 .device-sheet .difficulty-option{display:grid;grid-template-columns:40px minmax(0,1fr);align-items:center;align-content:center;gap:2px 5px;padding:6px 8px;min-height:78px}
 .device-sheet .difficulty-option .difficulty-leaves{grid-column:1;grid-row:1/3;width:40px;height:32px}
 .device-sheet .difficulty-option>strong{grid-column:2;grid-row:1;font-size:15px}
 .device-sheet .difficulty-option .difficulty-description{display:none}
 .device-sheet .difficulty-option .difficulty-picture{grid-column:2;grid-row:2;font-size:11px}
}
/* Safari's overlay scrollbar can cover the right edge of a wide button.
   Leave a small lane beside scrollable menu content. */
.device-sheet>#dialog-content{padding-right:18px}
