/* Phone layout of the editors (msls-phone.js adds the Privacy choices menu items; tools/phone-layout).
   Loaded after every other stylesheet. Desktop is not touched: every rule sits in a phone or tablet media block
   (960 px and less), except the one that keeps the new Privacy choices items hidden outside phones. */

/* ---------- Main studio (front-lit): one-row top bar ---------- */
@media(max-width:760px),(max-width:960px) and (pointer:coarse){
 body.ms-main-studio[data-phone-ready]>header.msm-studio-header{display:flex!important;flex-wrap:wrap;align-items:center;gap:4px!important;padding:6px 8px!important;min-height:0;max-height:70%}
 body.ms-main-studio[data-phone-ready]>header>.brand{order:0;flex:1 1 0;min-width:0;min-height:44px;margin:0;font-size:13px!important;gap:6px;overflow:hidden;white-space:nowrap}
 body.ms-main-studio[data-phone-ready]>header>.brand>span:not(.brandmark){overflow:hidden;text-overflow:ellipsis}
 body.ms-main-studio[data-phone-ready]>header .brandmark{flex:none;width:28px!important;height:28px!important;border-radius:7px;font-size:17px;line-height:1}
 body.ms-main-studio[data-phone-ready]>header>.designer-halloween-banner{order:5}
 body.ms-main-studio[data-phone-ready]>header>.msu-switch{order:1;margin:0}
 body.ms-main-studio[data-phone-ready]>header>.msls-language{order:2}
 body.ms-main-studio[data-phone-ready]>header>#phoneMenu{order:3;margin:0;min-width:0;padding:6px 10px;font-size:14px}
 body.ms-main-studio[data-phone-ready]>header>.studio-help-nav{order:6;flex:0 0 100%}
 /* Preview panel: the 3D view takes the free height instead of a fixed 45 % strip */
 body.ms-main-studio[data-phone-panel=preview]>.ms-editor-layout>.workspace{display:flex;flex-direction:column}
 body.ms-main-studio[data-phone-panel=preview] .workspace>#viewport{flex:1 0 auto;height:auto;min-height:max(260px,48dvh);max-height:none}
}

/* ---------- Shared pieces of the editor top bars on phones and tablets ---------- */
@media(max-width:960px){
 /* language: the flag only (the name stays for screen readers, the list shows every name) */
 :is(body.ms-main-studio>header,dialog[open]>header,body>.app-header) .msls-language{margin:0!important;flex:none;width:auto}
 :is(body.ms-main-studio>header,dialog[open]>header,body>.app-header) .msls-language .language-dropdown{min-width:0;width:auto}
 :is(body.ms-main-studio>header,dialog[open]>header,body>.app-header) .msls-language summary{min-height:44px;padding:6px 7px!important;gap:6px}
 :is(body.ms-main-studio>header,dialog[open]>header,body>.app-header) .msls-language summary::after{padding-left:2px}
 :is(body.ms-main-studio>header,dialog[open]>header,body>.app-header) .msls-language summary>span{position:absolute!important;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
 :is(body.ms-main-studio>header,dialog[open]>header,body>.app-header) .msls-language>small{display:none}
 :is(body.ms-main-studio>header,dialog[open]>header,body>.app-header) .msls-language .language-options{right:0;left:auto}
 /* mm | in */
 :is(body.ms-main-studio>header,dialog[open]>header) .msu-switch{margin:0;flex:none}
 :is(body.ms-main-studio>header,dialog[open]>header) .msu-switch button{min-width:30px;min-height:40px;padding:3px 5px}
}

/* ---------- Decorative + Backlit editors (shared header): one row ---------- */
@media(max-width:760px){
 dialog[open]>header.shared-designer-header{display:flex!important;flex-direction:row!important;flex-wrap:wrap!important;align-items:center!important;justify-content:flex-start!important;gap:4px!important;padding:6px 8px!important;min-height:0}
 dialog[open]>header.shared-designer-header>.shared-brand{order:0;flex:1 1 0;min-width:0;overflow:hidden;font-size:13px!important}
 dialog[open]>header.shared-designer-header>.shared-brand>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 dialog[open]>header.shared-designer-header>.shared-brand b{flex:none;padding:5px 8px}
 dialog[open]>header.shared-designer-header>.shared-season{order:1}
 dialog[open]>header.shared-designer-header>.msu-switch{order:2}
 dialog[open]>header.shared-designer-header>.msls-language{order:3}
 dialog[open]>header.shared-designer-header>.shared-menu-toggle{order:4;min-height:44px;padding:6px 10px!important;font-size:14px!important}
 dialog[open]>header.shared-designer-header>.shared-menu{order:9;flex:0 0 100%}
}
@media(min-width:761px) and (max-width:960px){
 dialog[open]>header.shared-designer-header{display:flex!important;flex-direction:row!important;flex-wrap:wrap!important;align-items:center!important;justify-content:flex-start!important;gap:8px!important}
 dialog[open]>header.shared-designer-header>.shared-brand{order:0}
 dialog[open]>header.shared-designer-header>.shared-season{order:1}
 dialog[open]>header.shared-designer-header>.shared-menu{order:2;flex:1 1 auto;width:auto;margin:0;justify-content:flex-end}
 dialog[open]>header.shared-designer-header>.msu-switch{order:3}
 dialog[open]>header.shared-designer-header>.msls-language{order:4}
}

/* ---------- Decorative editor: big preview on top, settings scroll below ---------- */
@media(max-width:640px){
 #nonlitStudio:not(.msls-pro)>.nl-layout{display:grid!important;grid-template-columns:minmax(0,1fr)!important;grid-template-rows:auto minmax(0,1fr)!important;height:auto!important;flex:1 1 auto;min-height:0;overflow:hidden}
 #nonlitStudio:not(.msls-pro) .nl-main{grid-row:1;display:flex;flex-direction:column;min-height:0;height:auto;overflow:visible}
 #nonlitStudio:not(.msls-pro) .nl-settings{grid-row:2;min-height:0;overflow-y:auto;border-top:1px solid var(--ms-line,#2c3e57)}
 /* view bar: size on one short line, the view buttons on one row */
 #nonlitStudio:not(.msls-pro) .nl-viewbar{flex:none;display:flex;flex-direction:column;align-items:stretch;gap:4px;padding:6px 10px!important}
 #nonlitStudio:not(.msls-pro) .nl-viewbar>#nlDimensions{font-size:12px;line-height:1.4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 #nonlitStudio:not(.msls-pro) .nl-viewbar>div{display:flex;flex-wrap:nowrap;align-items:center;gap:4px;margin:0;padding:0;overflow-x:auto;scrollbar-width:none}
 #nonlitStudio:not(.msls-pro) .nl-viewbar>div::-webkit-scrollbar{display:none}
 #nonlitStudio:not(.msls-pro) .nl-viewbar>div>*{flex:none;margin:0!important}
 #nonlitStudio:not(.msls-pro) .nl-viewbar>div button{min-height:40px;padding:6px 9px;font-size:13px;white-space:nowrap}
 #nonlitStudio:not(.msls-pro) .nl-viewbar>div label{display:flex;align-items:center;gap:4px;min-height:40px;font-size:13px;white-space:nowrap}
 #nonlitStudio:not(.msls-pro) .nl-viewbar>div label small,#nonlitStudio:not(.msls-pro) .nl-viewbar #nlGridScale{display:none}
 #nonlitStudio:not(.msls-pro) .nl-viewbar>div>#nlProToggle::before{display:none}
 #nonlitStudio:not(.msls-pro) .nl-preview{flex:none;height:max(220px,40dvh)!important;min-height:0!important;max-height:none}
 #nonlitStudio:not(.msls-pro) #nlStatus{flex:none;margin:0;padding:4px 10px!important;font-size:12px!important;line-height:1.4}
 #nonlitStudio:not(.msls-pro) .nl-warnings{flex:none;max-height:none!important;padding:0 10px!important;margin:0}
 #nonlitStudio:not(.msls-pro) .nl-warnings>summary{padding:8px 0;font-size:13px;line-height:1.4}
 #nonlitStudio:not(.msls-pro) .nl-warnings[open]>ul{max-height:30dvh;overflow:auto}
 /* settings: a slimmer sticky step bar, so the fields keep room under the bigger preview */
 #nonlitStudio:not(.msls-pro) .nl-settings>nav.ux-step-nav{padding:4px 8px;margin-bottom:10px}
 #nonlitStudio:not(.msls-pro) .nl-settings>nav.ux-step-nav button{flex-direction:row;justify-content:center;gap:5px;min-height:44px;padding:4px 2px;font-size:12px}
 #nonlitStudio:not(.msls-pro) .nl-settings>nav.ux-step-nav svg{width:16px;height:16px;flex:none}
}

/* ---------- Backlit editor, Preview on a phone: short title row, view buttons on one row, a big 3D view ---------- */
@media(max-width:600px){
 #haloStudio[data-unified] .halo-main>.backlit-viewhead{align-items:center;gap:8px;margin:0;padding:0}
 #haloStudio[data-unified] .halo-main>.backlit-viewhead>div>span{display:none}
 #haloStudio[data-unified] .halo-main>.backlit-viewhead h2{margin:0;font-size:17px;line-height:1.25}
 #haloStudio[data-unified] .halo-main>.backlit-viewhead>button{flex:none;min-height:40px;padding:6px 10px;font-size:13px}
 #haloStudio[data-unified] .halo-main>.halo-toolbar{display:flex;flex-wrap:nowrap;align-items:center;gap:4px;margin:8px 0}
 #haloStudio[data-unified] .halo-main>.halo-toolbar>div{display:flex;flex:1 1 auto;flex-wrap:nowrap;min-width:0;gap:4px;overflow-x:auto;scrollbar-width:none;margin:0}
 #haloStudio[data-unified] .halo-main>.halo-toolbar>div::-webkit-scrollbar{display:none}
 #haloStudio[data-unified] .halo-main>.halo-toolbar button{flex:none;min-height:40px;margin:0;padding:6px 10px;font-size:13px;white-space:nowrap}
 #haloStudio[data-unified] .halo-main>#haloView{flex:1 0 auto;height:auto;min-height:max(260px,46dvh)}
 #haloStudio[data-unified] .halo-main>#haloStatus{font-size:12px;line-height:1.45}
}

/* ---------- Decorative Pro layout on a phone: brand + units + print on top, menus + language below ---------- */
@media(max-width:760px){
 #nonlitStudio.msls-pro>header.nl-header{padding:6px 10px!important;row-gap:6px}
 #nonlitStudio.msls-pro>header.nl-header>.shared-brand{flex:1 1 0;min-width:0}
 #nonlitStudio.msls-pro .pro-menus{flex:1 1 auto;min-width:0;flex-wrap:wrap;row-gap:2px}
 #nonlitStudio.msls-pro .pro-menus>div>button{padding-inline:5px}
}

/* ---------- Privacy choices: in the menu on phones, never over the settings ---------- */
:is(body,dialog) .msls-phone-privacy{display:none!important}
@media(max-width:760px),(max-width:960px) and (pointer:coarse){
 body.ms-main-studio[data-phone-ready] .studio-help-nav>.msls-phone-privacy{display:flex!important}
 body.ms-main-studio[data-phone-ready][data-msls-privacy-menu]>#ms-analytics-settings{display:none!important}
 /* the first-visit project chooser: a quiet button in its footer */
 body.ms-main-studio #projectWelcome .ux-welcome-footer>.msls-phone-privacy{display:flex!important;align-items:center;min-height:44px;margin:0 0 0 auto;padding:6px 10px;border:1px solid var(--card-line,#2c3e57);border-radius:8px;background:transparent;color:inherit;font:600 14px/1.3 system-ui,sans-serif}
 body.ms-main-studio #projectWelcome[data-msls-privacy-end]>#ms-analytics-settings{display:none!important}
}
@media(max-width:760px){
 dialog[open]:not(.msls-pro)>header.shared-designer-header .shared-menu>.msls-phone-privacy{display:inline-flex!important;align-items:center}
 dialog[open][data-msls-privacy-menu]>#ms-analytics-settings{display:none!important}
 #nonlitStudio.msls-pro .pro-pop>.msls-phone-privacy{display:flex!important}
 /* neon and canvas: a quiet button at the end of the settings column */
 dialog[open] .msls-phone-privacy[data-where=editor-end]{display:block!important;width:auto;min-height:44px;margin:24px auto 8px;padding:8px 14px;border:1px solid var(--card-line,#2c3e57);border-radius:8px;background:transparent;color:inherit;font:600 14px/1.3 system-ui,sans-serif}
 dialog[open][data-msls-privacy-end]>#ms-analytics-settings{display:none!important}
}

/* ---------- Neon editor: title + units + language, then Back + Print; the 3D view right under the view buttons ---------- */
@media(max-width:960px){
 #neonStudio>header.halo-header{display:flex!important;flex-wrap:wrap;align-items:center;gap:6px 4px!important;padding:6px 8px!important}
 #neonStudio>header.halo-header>div:has(>#neonTitle){order:0;flex:1 1 0;min-width:0}
 #neonStudio>header.halo-header #neonTitle{font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 #neonStudio>header.halo-header>.msu-switch{order:1}
 #neonStudio>header.halo-header>.msls-language{order:2}
 #neonStudio>header.halo-header::after{content:"";order:3;flex:0 0 100%;height:0}
 #neonStudio>header.halo-header>#neonClose{order:4;flex:1 1 auto;min-height:44px;margin:0}
 #neonStudio>header.halo-header>#neonPrintStep{order:5;flex:0 0 auto;min-height:44px;margin:0}
}
@media(max-width:820px){
 #neonStudio .neon-main{display:flex!important;flex-direction:column;gap:8px}
 #neonStudio .neon-main>.neon-workspace-title{display:none}
 #neonStudio .neon-main>.neon-toolbar{order:-3;display:flex;flex-direction:column;align-items:stretch;gap:6px;margin:0}
 #neonStudio .neon-main>.neon-toolbar>div{display:flex;flex-wrap:nowrap;justify-content:flex-start;gap:4px;overflow-x:auto;scrollbar-width:none;margin:0}
 #neonStudio .neon-main>.neon-toolbar>div::-webkit-scrollbar{display:none}
 #neonStudio .neon-main>.neon-toolbar button{flex:none;min-height:40px;padding:6px 10px;font-size:13px;white-space:nowrap}
 #neonStudio .neon-main>#neonView{order:-2;height:max(240px,42dvh)!important;margin:0}
 #neonStudio .neon-main>.neon-row{order:-1;display:flex;flex-wrap:nowrap;align-items:center;gap:10px;margin:0}
 #neonStudio .neon-main>.neon-row>#neonNight{flex:none;width:auto;min-height:40px;padding:6px 10px;font-size:13px}
 #neonStudio .neon-main>.neon-row>label{flex:1 1 0;min-width:0;font-size:12px}
}

/* ---------- Design your own (canvas): title + units + language, then the edit buttons; tools on one row ---------- */
@media(max-width:760px){
 #designCanvas>header.dc-header{display:flex!important;flex-wrap:wrap;align-items:center;gap:6px 4px!important;padding:6px 8px!important}
 #designCanvas>header.dc-header>div:has(>#dcTitle){order:0;flex:1 1 0;min-width:0}
 #designCanvas>header.dc-header #dcTitle{font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 #designCanvas>header.dc-header>.msu-switch{order:1}
 #designCanvas>header.dc-header>.msls-language{order:2}
 #designCanvas>header.dc-header>div:has(>.dc-apply){order:3;flex:0 0 100%;display:flex;flex-wrap:nowrap;justify-content:flex-end;gap:4px}
 #designCanvas>header.dc-header>div:has(>.dc-apply)>:nth-child(-n+2){margin-right:auto}
 #designCanvas>header.dc-header>div:has(>.dc-apply)>:first-child{margin-right:0}
 #designCanvas>.dc-toolbar{flex-wrap:nowrap!important;overflow-x:auto;scrollbar-width:none;padding:6px 8px!important;gap:4px!important}
 #designCanvas>.dc-toolbar::-webkit-scrollbar{display:none}
 #designCanvas>.dc-toolbar>*{flex:none}
 #designCanvas>.dc-toolbar button{min-height:40px;white-space:nowrap}
}

/* ---------- Christmas editor: two header rows, Privacy choices at the end of the page ---------- */
@media(max-width:760px){
 body:has(>.app-header #printJump)>.app-header{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;padding:8px 12px}
 body:has(>.app-header #printJump)>.app-header>.brand{order:0;flex:1 1 0;min-width:0;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 body:has(>.app-header #printJump)>.app-header>.brand .brand-mark{flex:none;width:32px;height:32px;font-size:18px}
 body:has(>.app-header #printJump)>.app-header>.msls-language{order:1;margin:0}
 body:has(>.app-header #printJump)>.app-header>#printJump{order:2;min-height:44px;margin:0}
 body:has(>.app-header #printJump)>.app-header::after{content:"";order:3;flex:0 0 100%;height:0}
 body:has(>.app-header #printJump)>.app-header>.collection-link{order:4;flex:1 1 0;min-width:0;margin:0}
 body:has(>.app-header #printJump)>.app-header>.lang{order:5;margin:0}
 body:has(>.app-header #printJump)>.app-header>.msls-ask-button{order:6;margin:0;min-height:36px}
 body:has(>.app-header #printJump)>#ms-analytics-settings{position:static;display:block;margin:8px auto 24px}
}

/* ---------- Halloween editor: the "Back to the collection" link off the screen edge ---------- */
@media(max-width:760px){
 body>header.product-designer-header+p.family-return{padding:0 12px}
}

/* ---------- MS 3D Lab (PC first): on a phone the page grows instead of squeezing the panels over the 3D view;
   on a tablet the top bar wraps instead of pushing the page sideways ---------- */
@media(max-width:980px){
 body:has(>main.ws){grid-template-rows:auto auto minmax(0,1fr) auto}
 body:has(>main.ws)>header.top{flex-wrap:wrap;row-gap:6px;padding-block:6px}
 body:has(>main.ws)>header.top>.top-right{flex-wrap:wrap;min-width:0}
 body:has(>main.ws)>#toolbar{overflow-x:auto}
}
@media(max-width:760px){
 body:has(>main.ws){height:auto;min-height:100dvh}
}
