/* Device polish shared by the nine realm games. Native artwork, palettes and controls remain local. */
@media(max-width:1100px),(pointer:coarse){
 html body.device-polished{--dp-gap:10px;--dp-safe-top:max(10px,env(safe-area-inset-top));--dp-safe-bottom:max(10px,env(safe-area-inset-bottom))}
 body.device-polished :is(.screen,.cov-screen,.title-screen,.opening,.entry-content,.report,.modal,.dialog,.panel,.mm-panel,.quest-panel){overflow-wrap:break-word}
 body.device-polished :is(.screen,.cov-screen,.opening,.entry-content,.report,.modal,.dialog,.mm-panel) :is(button,.btn,.cov-btn,.cov-play,.link-btn,.cov-textlink){min-height:44px;white-space:normal;line-height:1.35}
 body.device-polished :is(.screen,.cov-screen,.opening,.entry-content,.report,.modal,.dialog,.mm-panel) :is(input:not([type=checkbox]):not([type=radio]):not([type=range]),select,textarea){font-size:16px;min-height:46px;max-width:100%;box-sizing:border-box}
 body.device-polished :is(.cov-form,.entry-content,.entry-form,.form-row) label{font-size:12px!important;line-height:1.4;letter-spacing:.06em!important}
 body.device-polished :is(.cov-tools,.entry-links,.entry-tools,.btn-row,.actions,.cov-row){gap:10px;flex-wrap:wrap}
 body.device-polished :is(.cov-tools,.entry-links,.entry-tools) :is(button,a){font-size:14px!important;min-height:44px;display:inline-flex;align-items:center}
 body.device-polished :is(.report,.report-panel,.quest-report,.cui-content) :is(h1,h2,h3){overflow-wrap:break-word}
 body.device-polished :is(.table-wrap,.cov-table-wrap,.cui-table-wrap){max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
 body.device-polished :is(.report,.report-panel,.quest-report-screen) table{min-width:560px;font-size:14px}
 body.device-polished :is(.result-code,.cov-code,.result-text,textarea,pre){max-width:100%;overflow-x:auto;overflow-wrap:anywhere;word-break:break-word}
 body.device-polished :is(.modal-backdrop,.mm-modal){padding:max(10px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));align-items:center;overflow:auto}
 body.device-polished :is(.modal,.dialog,.mm-panel,.cui-dialog){max-width:calc(100vw - 20px)!important;max-height:calc(var(--dp-visible-height,100dvh) - 20px)!important;overscroll-behavior:contain;box-sizing:border-box}
 body.device-polished dialog{max-width:calc(100vw - 20px);max-height:calc(var(--dp-visible-height,100dvh) - 20px);overscroll-behavior:contain}
 body.device-polished .cui-dialog :is(.cui-head,.cui-head-actions){flex-wrap:wrap;gap:8px}
 body.device-polished .cui-dialog :is(button,input,select){min-height:44px}
 html body.device-polished .cui-question :is(.q-stem,.question-stem,.qprompt,.question-title){font-size:17px!important;line-height:1.6!important}
 html body.device-polished .cui-question :is(.eq,.equation,.eq-in){font-size:clamp(21px,3.7vw,29px)!important;line-height:1.5!important;max-width:100%;overflow-x:auto;overflow-y:visible;padding:5px 0}
 html body.device-polished .cui-question :is(.choices button,.answer-options button,.choice,.answer,.option,.answer-option){min-height:48px!important;font-size:16px!important;white-space:normal!important;line-height:1.5!important}
 html body.device-polished .cui-question :is(.btn,.power-btn,.cui-supports button,.cui-native-tool){min-height:44px!important;white-space:normal!important;font-size:14px!important;line-height:1.35!important}
 html body.device-polished .cui-supports{display:flex!important;flex-wrap:wrap!important;gap:8px!important;padding:12px!important}
 html body.device-polished .cui-supports-label{flex-basis:100%;font-size:11px!important;line-height:1.4!important}
 html body.device-polished .cui-question :is(.lang-tools,.question-foot,.answer-help,.question-help,.mp-foot .btn-row){display:flex;flex-wrap:wrap;gap:8px}
 html body.device-polished .cui-question :is(.feedback,.explanation,.worked,.steps,.small-note){font-size:14px;line-height:1.6}
 html body.device-polished.device-question-open :is(.covenant-demo-panel,.demo-toggle,#demoToggle,.device-demo-toast){display:none!important}
 html body.device-polished .covenant-demo-panel{max-height:calc(var(--dp-visible-height,100dvh) - var(--demo-card-top,80px) - 16px)!important}
 html body.device-polished .covenant-demo-panel .demo-panel-toggle{min-height:44px!important}
 html body.device-polished .covenant-demo-panel:has(.demo-panel-body[hidden]){width:148px!important;padding:4px 12px!important}
 /* Parchment slides use readable, scrollable panels instead of scaling the math to the artwork. */
 body.device-polished :is(.overlay.staged[data-st=acad],.overlay.staged[data-st=acad].stacked){position:fixed!important;inset:0!important;z-index:30!important;padding:0!important;overflow:hidden!important}
 html body.device-polished .overlay.staged[data-st=acad] #panel.cui-question{
  left:max(10px,env(safe-area-inset-left))!important;right:max(10px,env(safe-area-inset-right))!important;top:var(--dp-safe-top)!important;bottom:var(--dp-safe-bottom)!important;
  width:auto!important;height:auto!important;max-width:920px!important;max-height:none!important;margin:0 auto!important;transform:none!important;font-size:16px!important;
  display:flex!important;flex-direction:column!important;border:1px solid #b89c65!important;border-radius:12px!important;background:linear-gradient(145deg,#fff5d9,#ebd6a7)!important;color:#302719!important;box-shadow:0 12px 45px #0008!important;
 }
 html body.device-polished .overlay.staged[data-st=acad] #panel.cui-question .mp-head{display:block!important;flex:none;padding:14px 18px!important;background:#f4e4bd;border-bottom:1px solid #b89c6588}
 html body.device-polished .overlay.staged[data-st=acad] #panel.cui-question .mp-head h2{font-size:22px!important;line-height:1.2!important}
 html body.device-polished .overlay.staged[data-st=acad] #panel.cui-question .mp-body{flex:1 1 auto!important;min-height:0!important;overflow:auto!important;padding:16px 18px!important;gap:14px!important;overscroll-behavior:contain}
 html body.device-polished .overlay.staged[data-st=acad] #panel.cui-question .mp-foot{flex:0 0 auto!important;max-height:35%;overflow:auto!important;flex-wrap:wrap!important;padding:10px 14px!important;gap:8px!important;background:#e7d0a0;border-top:1px solid #b89c65!important;font-size:14px!important}
 html body.device-polished .overlay.staged[data-st=acad] #panel.cui-question .choices{display:grid!important;grid-template-columns:1fr 1fr!important;gap:10px!important}
 html body.device-polished .overlay.staged[data-st=acad] #panel.cui-question .choices button{padding:12px!important;color:#352616!important}
 /* Stormwatch, Echoing and Moonshadow dialogs must scroll inside the viewport. */
 body.device-polished .quest-overlay{padding:10px!important;overflow:auto;align-items:flex-start}
 body.device-polished .quest-overlay .quest-panel{margin:auto;max-height:calc(var(--dp-visible-height,100dvh) - 20px);overflow:auto;overscroll-behavior:contain}
 body.device-polished[data-device-game="moonshadow-marsh"] .qwrap{top:68px!important;padding:8px 10px 20px!important;scroll-padding-top:10px}
 body.device-polished[data-device-game="moonshadow-marsh"] .qwrap .cui-question{margin:0!important}
 body.device-polished[data-device-game="sunfire-plains"] #modal{width:min(820px,calc(100vw - 20px));max-height:calc(var(--dp-visible-height,100dvh) - 20px)}
 body.device-polished[data-device-game="sunfire-plains"] #dialogBody{padding:20px!important}
 body.device-polished[data-device-game="sunfire-plains"] #dialogBody .actions{gap:10px}
 body.device-polished[data-device-game="sunfire-plains"] #dialogBody :is(button,label.setting,.options label){min-height:46px;font-size:15px}
 /* Scholar's Spire: put floor navigation on a horizontal shelf above the work. */
 body.device-polished[data-device-game="scholars-spire"] .workspace{display:block!important}
 body.device-polished[data-device-game="scholars-spire"] .sidebar{position:relative!important;width:100%!important;padding:14px!important;min-height:0!important;height:auto!important}
 body.device-polished[data-device-game="scholars-spire"] .sidebar .student{margin-bottom:10px}
 body.device-polished[data-device-game="scholars-spire"] .sidebar-note{display:none}
 body.device-polished[data-device-game="scholars-spire"] .floor-nav{display:flex!important;gap:8px!important;overflow-x:auto!important;max-width:100%;padding:6px 0 10px;scroll-snap-type:x proximity}
 body.device-polished[data-device-game="scholars-spire"] .floor-btn{flex:0 0 170px!important;width:170px!important;min-height:64px!important;padding:8px!important;scroll-snap-align:start}
 body.device-polished[data-device-game="scholars-spire"] .floor-thumbnail{width:42px!important;height:42px!important;flex:none}
 body.device-polished[data-device-game="scholars-spire"] .floor-name{font-size:13px!important}.device-polished .floor-name small{font-size:11px}
 body.device-polished[data-device-game="scholars-spire"] .review-grid{display:block!important}
 body.device-polished[data-device-game="scholars-spire"] .mainarea{min-width:0!important;padding:16px!important}
 body.device-polished[data-device-game="scholars-spire"] .question-card{margin-bottom:18px}
 body.device-polished[data-device-game="scholars-spire"] .room-banner{min-height:130px!important}
 body.device-polished[data-device-game="scholars-spire"] .room-banner h1{font-size:28px!important}
 /* Board questions retain their full-screen reading mode, with larger choices. */
 body.device-polished .mw-question-open .panel{font-size:16px}
 body.device-polished.mw-question-open .panel :is(button,.choice){min-height:46px;font-size:15px;line-height:1.5;white-space:normal}
 body.device-polished.mw-question-open #prompt{font-size:16px!important;line-height:1.6}
 body.device-polished .mw-score-dock .players li{min-height:44px}
}
@media(max-width:600px){
 body.device-polished :is(.stat-row,.cov-kpis,.report-kpis){grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px}
 body.device-polished :is(.report-head,.cov-head-row,.cov-map-head){flex-wrap:wrap;gap:14px}
 body.device-polished :is(.qset-grid,.qset-cards){grid-template-columns:minmax(0,1fr)!important}
 body.device-polished :is(.report,.quest-report-screen .report){padding:20px 16px!important}
 body.device-polished .report :is(h1,h2){font-size:26px!important;line-height:1.25}
 html body.device-polished .overlay.staged[data-st=acad] #panel.cui-question .choices{grid-template-columns:1fr!important}
 body.device-polished .cui-dialog .cui-head{padding:14px!important}
 body.device-polished .cui-dialog .cui-content{padding:16px!important}
 body.device-polished[data-device-game="sunfire-plains"] .entry-tools{gap:8px!important}
 body.device-polished[data-device-game="sunfire-plains"] .entry-tools button{min-height:46px}
 body.device-polished[data-device-game="scholars-spire"] .sidebar .student{display:none}
 body.device-polished[data-device-game="scholars-spire"] .sidebar>.eyebrow{font-size:11px;margin:0 0 4px}
 body.device-polished[data-device-game="scholars-spire"] .floor-btn{flex-basis:152px!important;width:152px!important}
}
@media(max-height:500px) and (orientation:landscape){
 body.device-polished :is(.modal,.dialog,.mm-panel,.cui-dialog){max-height:calc(var(--dp-visible-height,100dvh) - 16px)!important}
 body.device-polished .cui-dialog .cui-head{position:relative;padding:10px 14px!important}
 html body.device-polished .cui-question :is(.question-title,.q-stem,.qprompt){font-size:16px!important}
 html body.device-polished .cui-question .cqs-head{padding:10px 14px!important;min-height:0!important}
 html body.device-polished .cui-question .cqs-head h2{font-size:21px!important}
 html body.device-polished .cui-question .cqs-crest,html body.device-polished .cui-question .cqs-ornament{display:none!important}
 body.device-polished[data-device-game="moonshadow-marsh"] .v14-tutorial.clue-tip{display:none!important}
 body.device-polished[data-device-game="scholars-spire"] .sidebar{padding:8px 14px!important}
 body.device-polished[data-device-game="scholars-spire"] .sidebar .student,body.device-polished[data-device-game="scholars-spire"] .sidebar>.eyebrow{display:none}
 body.device-polished[data-device-game="scholars-spire"] .room-banner{min-height:105px!important}
 body.device-polished[data-device-game="scholars-spire"] .floor-btn{min-height:52px!important}
 html body.device-polished .overlay.staged[data-st=acad] #panel.cui-question .mp-head{padding:8px 14px!important}
 html body.device-polished .overlay.staged[data-st=acad] #panel.cui-question .mp-body{padding:12px 16px!important}
}
@media(max-width:1100px),(pointer:coarse){
 body.device-polished[data-device-game="scholars-spire"] .floor-nav{flex-direction:row!important;align-items:stretch!important}
 body.device-polished[data-device-game="scholars-spire"] .floor-name{display:block!important}
 html body.device-polished.device-question-open #demoBar{display:none!important}
}
@media(max-height:500px) and (orientation:landscape){
 html body.device-polished .overlay.staged[data-st=acad] #panel.cui-question .mp-head img{display:none!important}
 html body.device-polished .overlay.staged[data-st=acad] #panel.cui-question .mp-head h2{font-size:20px!important}
}
@media(max-width:1100px),(pointer:coarse){
 body.device-polished:has(.quest-report-screen) :is(#demoBar,.covenant-demo-panel),
 body.device-polished:has(.cov-report) :is(#demoBar,.covenant-demo-panel),
 body.device-polished.device-menu-open :is(#demoBar,.covenant-demo-panel){display:none!important}
 body.device-polished .report :is(.small-note,.stat span,.mission-line small){font-size:12px!important;line-height:1.5}
 body.device-polished .panel button{min-height:44px;white-space:normal}
}
@media(max-height:500px) and (orientation:landscape){
 body.device-polished[data-device-game="scholars-spire"] .topbar{min-height:60px;padding:8px 16px}
 body.device-polished[data-device-game="scholars-spire"] .floor-btn{min-height:48px!important}
 body.device-polished[data-device-game="scholars-spire"] .floor-thumbnail{display:none}
 body.device-polished[data-device-game="scholars-spire"] .room-banner{min-height:76px!important}
 body.device-polished[data-device-game="scholars-spire"] .notice:has([data-action="exit-demo"]){display:none}
}
@media(max-width:1100px),(pointer:coarse){
 body.device-polished input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),body.device-polished select,body.device-polished textarea{font-size:16px;min-height:44px;max-width:100%}
 body.device-polished #home button,body.device-polished.title-view summary{min-height:44px}
 body.device-polished[data-device-game="mertenswatch"] .panel :is(#prompt,#feedback){font-size:14px!important;line-height:1.55}
 body.device-polished[data-device-game="mertenswatch"] :is(.top-tools button,.mw-home,.mw-map-toggle){min-height:44px;min-width:44px;font-size:12px}
 body.device-polished[data-device-game="mertenswatch"] .mw-score-dock .players :is(li,small){font-size:11px}
}
@media(max-width:1100px),(pointer:coarse){
 html body.device-polished input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),html body.device-polished select,html body.device-polished textarea{font-size:16px!important}
}
