.phone-tools,.phone-panel-heading,.phone-tabs,#phoneDesignDeck{display:none}
#phonePanelBody{display:contents}
#phoneSettingsDialog{width:min(560px,calc(100vw - 20px));max-height:85dvh;padding:0;border:1px solid #d1d8de;border-radius:18px;background:#fff;color:#273345}
#phoneSettingsDialog::backdrop{background:#17201799}
#phoneSettingsDialog[open]{display:flex;flex-direction:column}
.phone-drawer-heading{display:flex;flex:none;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;border-bottom:1px solid #e1e6eb}
.phone-drawer-heading h2{font-size:19px;margin:0}.phone-drawer-heading button{min-height:44px}
#phoneSettingsBody{padding:16px;min-height:0;overflow:auto;overscroll-behavior:contain}
#phoneSettingsBody>label{font-size:14px}#phoneSettingsBody .two,#phoneSettingsBody .three{grid-template-columns:repeat(2,minmax(0,1fr))}
#phoneSettingsBody input:not([type=checkbox]),#phoneSettingsBody select,#phoneSettingsBody textarea{font-size:16px}
@media screen and (max-width:600px){
 #phoneSettingsDialog{position:fixed;left:0;right:0}
 body:has(#studio.phone-workspace:not([hidden]))>.site-header,body:has(#studio.phone-workspace:not([hidden]))>footer{display:none}
 #studio.phone-workspace{position:fixed;inset:var(--phone-top,0px) 0 auto;height:var(--phone-height,100dvh);width:100%;max-width:none;padding:0;z-index:20;background:#edf0f3;display:flex;flex-direction:column;overflow:hidden}
 #studio.phone-workspace[hidden]{display:none}
 .phone-workspace>.intro,.phone-workspace>#mobilePreview{display:none}
 .phone-workspace .phone-tools{display:flex;align-items:center;justify-content:space-between;flex:none;padding:env(safe-area-inset-top,0px) 12px 0;min-height:48px;background:#fff;border-bottom:1px solid #d9e0e6;font-size:13px}
 .phone-tools a{color:inherit;text-decoration:none;padding:14px 0}.phone-tools>button{background:transparent;border:0}
 #studio.phone-workspace .phone-tools #quickExport{background:#283c50;color:#fff;font-size:12px;padding:8px;min-height:44px;border:1px solid #283c50}
 #studio.phone-workspace .workspace{display:flex;flex:1;min-height:0;flex-direction:column;gap:0;width:100%}
 #studio.phone-workspace .preview{order:0;display:flex;flex-direction:column;flex:1;min-height:0;max-width:none;margin:0;padding:8px 12px;overflow:hidden}
 #studio.phone-workspace .paper-mat{display:flex;flex-direction:column;flex:1;min-height:0;padding:4px 8px;background:transparent;width:100%}
 #studio.phone-workspace .paper-mat>.preview-top{flex:none;flex-wrap:nowrap;margin:0 0 4px;gap:5px}
 #studio.phone-workspace .preview-top #formatLabel{flex:1;flex-basis:auto;font-size:10px}
 #studio.phone-workspace .preview-top .segmented button{min-height:44px;padding:6px;font-size:11px}
 #studio.phone-workspace #paper{display:flex;flex:1;min-height:0;width:100%;max-width:none;box-shadow:none;align-items:center;justify-content:center}
 #studio.phone-workspace #paper>svg{width:100%;height:100%;max-height:100%;filter:drop-shadow(0 2px 4px #23344824)}
 #studio.phone-workspace .preview-bottom,#studio.phone-workspace .preview>.privacy{display:none}
 #studio.phone-workspace .preview-disclosure{display:block;font-size:10px;line-height:1.3;margin:3px 0 0;text-align:center}
 #studio.phone-workspace #globalStatus{flex:none;max-height:42px;overflow:auto;margin:0;font-size:11px}
 /* The design tray is a bounded tool, never a scrollable desktop form. */
 #studio.phone-workspace .editor{order:1;flex:none;height:calc(240px + env(safe-area-inset-bottom,0px));max-height:46%;min-height:0;display:flex;flex-direction:column;width:100%;max-width:none;margin:0;border-radius:18px 18px 0 0;border-bottom:0;box-shadow:0 -3px 15px #23344812;padding-bottom:env(safe-area-inset-bottom,0px)}
 #studio.phone-workspace[data-phone-tab=content][data-phone-size=expanded] .editor{height:67%;max-height:67%}
 #studio.phone-workspace[data-phone-size=collapsed] .editor{height:auto;max-height:none}
 .phone-workspace .phone-panel-heading{display:flex;flex:none;align-items:center;justify-content:space-between;padding:0 12px;min-height:44px;font-size:13px;font-weight:600;border-bottom:1px solid #edf0f3}
 .phone-panel-heading>div{display:flex;gap:2px}.phone-panel-heading button{border:0;background:transparent;font-size:12px;padding:7px;min-height:44px}.phone-panel-heading button[hidden]{display:none}
 #studio.phone-workspace #phonePanelBody{display:block;flex:1;min-height:0;overflow-x:hidden;overflow-y:hidden}
 #studio.phone-workspace[data-phone-tab=content] #phonePanelBody{overflow-y:auto;overscroll-behavior-y:contain}
 #studio.phone-workspace #phonePanelBody[hidden]{display:none}
 .phone-workspace .phone-tabs{display:flex;flex:none;overflow-x:auto;overscroll-behavior-x:contain;border-top:1px solid #d9e0e6;background:#fafbfc}
 .phone-tabs button{flex:1 0 auto;min-height:44px;padding:10px 9px;border:0;border-radius:0;font-size:12px;background:transparent}
 .phone-tabs button[aria-selected=true]{color:#273345;background:#fff;box-shadow:inset 0 3px #9b7855;font-weight:700}
 /* No CSS specificity exception can leak the desktop design/print stack. */
 #studio.phone-workspace #phonePanelBody>#design,#studio.phone-workspace #phonePanelBody>#print,#studio.phone-workspace .tabs,#studio.phone-workspace .step-navigation,#studio.phone-workspace .editor-history{display:none!important}
 #studio.phone-workspace #story{padding:14px;min-width:0}.phone-workspace #story[hidden]{display:none!important}
 .phone-workspace .draft-bar{margin:0 0 18px;padding:8px;display:block}.phone-workspace .draft-bar>div{display:flex;flex-wrap:wrap;gap:6px}
 #studio.phone-workspace #phoneDesignDeck{display:block;height:100%;min-height:0}
 #studio.phone-workspace #phoneDesignDeck[hidden],#studio.phone-workspace .phone-deck-pane[hidden]{display:none}
 .phone-deck-pane{height:100%;min-height:0;display:grid;grid-template-rows:minmax(0,1fr) 44px;gap:4px;padding:6px 0 4px}
 .phone-choice-rail{display:flex;gap:8px;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;min-height:0;padding:2px 12px 5px;scroll-snap-type:x proximity;scroll-padding:12px}
 .phone-choice-card{flex:0 0 112px;min-width:0;min-height:44px;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;padding:5px;border:1px solid #d8dee4;background:#f8fafb;font-size:11px;line-height:1.2;scroll-snap-align:start;overflow:hidden}
 .phone-choice-card[aria-pressed=true]{border:2px solid #9b7855;background:#fff9ef}
 .phone-miniature{position:relative;display:block;flex:1;min-width:0;min-height:0;width:100%;overflow:hidden}
 .phone-miniature>img{position:absolute;inset:0;display:block;width:100%;height:100%;max-width:100%;max-height:100%;object-fit:contain;object-position:center}
 .phone-choice-card>svg{width:100%;flex:1;min-height:0;height:60px}.phone-choice-card>span:last-child{flex:none;max-width:100%;overflow-wrap:anywhere}
 .phone-inline-actions{display:flex;align-items:center;gap:6px;padding:0 12px;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;border-top:1px solid #edf0f3}
 .phone-inline-actions button{flex:none;min-height:44px;font-size:12px;padding:8px;background:transparent;border:0;white-space:nowrap}
 .phone-inline-actions button[aria-pressed=true]{background:#eee8de;font-weight:700}
 .phone-art-card{flex:0 0 164px;display:flex;flex-direction:row;min-height:0;scroll-snap-align:start}.phone-art-card>.phone-choice-card{flex:1;width:120px;min-height:44px}
 .phone-variants-button{flex:0 0 44px;width:44px;min-height:44px;padding:4px;border:0;background:transparent;font-size:11px}
 .phone-palette-sample{width:64px;flex:1;min-height:24px;max-height:52px;border-radius:8px;border:1px solid #d9e0e6}
 .phone-font-card{font-size:14px;flex-basis:144px}
 .phone-empty{flex:0 0 220px;font-size:12px;padding:10px;margin:0;line-height:1.4}
 .phone-variation-rail{height:180px;padding:4px}.phone-variation-rail>.phone-choice-card{flex:0 0 140px}
 #studio.phone-workspace[data-phone-compact=true] .preview-top,#studio.phone-workspace[data-phone-compact=true] .preview-disclosure{display:none}
 #studio.phone-workspace[data-phone-compact=true][data-phone-tab=content] .editor{flex:1;height:auto;max-height:none}
 #studio.phone-workspace[data-phone-compact=true][data-phone-tab=content] .preview{flex:0 1 50px}
 #studio.phone-workspace[data-phone-compact=true][data-phone-size=collapsed] .editor{flex:none}
 #studio.phone-workspace[data-phone-compact=true][data-phone-size=collapsed] .preview{flex:1}
 .phone-workspace input:not([type=checkbox]),.phone-workspace select,.phone-workspace textarea{font-size:16px}
 .phone-workspace .two{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media screen and (max-width:600px){
 /* Short windows keep a real 44px choice row. Extremely short windows use an
    explicit full-height tool view; Hide returns to the preview and Home bar. */
 #studio.phone-workspace[data-phone-compact=true]:not([data-phone-tab=content]) .editor{height:calc(204px + env(safe-area-inset-bottom,0px));max-height:none}
 #studio.phone-workspace[data-phone-tiny=true]:not([data-phone-tab=content]):not([data-phone-size=collapsed]) .phone-tools,#studio.phone-workspace[data-phone-tiny=true]:not([data-phone-tab=content]):not([data-phone-size=collapsed]) .preview{display:none}
 #studio.phone-workspace[data-phone-tiny=true]:not([data-phone-tab=content]):not([data-phone-size=collapsed]) .editor{height:auto;flex:1;max-height:none}
 #studio.phone-workspace[data-phone-compact=true][data-phone-size=collapsed] .editor{height:auto;flex:none;max-height:none}
}
/* Mobile detail polish: a bottom sheet with a fixed, reachable close control. */
body.phone-settings-open{overflow:hidden}
.phone-icon-button{display:inline-flex;align-items:center;justify-content:center;flex:0 0 44px;width:44px;min-width:44px;height:44px;min-height:44px;padding:10px}
.phone-icon-button svg{pointer-events:none;flex:none}
.phone-drawer-heading h2{min-width:0;flex:1;line-height:1.3;overflow-wrap:break-word;word-break:normal}
.phone-drawer-heading>button{flex:none}
#phoneSettingsBody>*{min-width:0;max-width:100%}
#phoneSettingsBody .hint,#phoneSettingsBody p,#phoneSettingsBody label{overflow-wrap:break-word;word-break:normal}
@media screen and (max-width:600px){
 #phoneSettingsDialog{top:auto;bottom:var(--phone-dialog-bottom,0px);width:100%;max-width:100%;margin:0;max-height:min(82dvh,var(--phone-dialog-height,82dvh));border-radius:18px 18px 0 0;border-bottom:0;padding-bottom:env(safe-area-inset-bottom,0px)}
 .phone-drawer-heading{padding:10px 12px;gap:8px}.phone-drawer-heading h2{font-size:17px}
 #phoneSettingsBody{padding:12px 16px;overflow-x:hidden;overflow-y:auto}
 #phoneSettingsBody .section-heading{flex-wrap:wrap;gap:10px}
 #phoneSettingsBody .catalog-search-row{display:flex;flex-wrap:nowrap;min-width:0}.catalog-search-row input{min-width:0;flex:1}
 #phoneSettingsBody button{white-space:normal;overflow-wrap:break-word}
 #phoneSettingsBody .search-clear{white-space:nowrap;flex:none}
 #phoneSettingsBody .two,#phoneSettingsBody .three{gap:10px}
 #phoneSettingsBody .three{grid-template-columns:repeat(3,minmax(0,1fr))}
 #previewDialog{position:fixed;top:auto;bottom:var(--phone-dialog-bottom,0px);left:0;right:0;margin:0;width:100%;max-width:100%;height:min(94dvh,var(--phone-dialog-height,94dvh));max-height:var(--phone-dialog-height,94dvh);border-radius:18px 18px 0 0;padding-bottom:env(safe-area-inset-bottom,0px)}
 #previewDialog .dialog-toolbar{gap:8px;padding:10px 12px;min-width:0}
 #previewDialog .dialog-toolbar h2{min-width:0;flex:1;font-size:16px;line-height:1.3;word-break:normal}
 #previewDialog .dialog-toolbar label{flex:none;min-width:0;font-size:0}
 #previewDialog .dialog-toolbar select{width:105px;max-width:105px;font-size:16px;min-height:44px;padding:7px}
 #previewDialog #closePreview{flex:0 0 44px;padding:10px}
 .phone-panel-heading>span{min-width:0;line-height:1.3;overflow-wrap:normal;word-break:normal}
 .phone-panel-heading>div{flex:none}
 .phone-panel-heading .phone-icon-button{padding:10px}
 .phone-tabs button,.phone-inline-actions button,.phone-tools>a,.phone-tools>button{white-space:nowrap}
 .phone-choice-card>span:last-child{word-break:normal;overflow-wrap:break-word;hyphens:none;line-height:1.25}
 .phone-font-card{word-break:normal;overflow-wrap:break-word;hyphens:none;line-height:1.25}
}
/* Font role choices are a pair; type sizing is a separate settings command. */
@media screen and (max-width:600px){
 .phone-font-targets{display:flex;align-items:center;gap:2px;flex:none}
 .phone-inline-actions .phone-font-size-action{margin-left:auto;flex:0 0 44px;width:44px;min-width:44px;padding:10px;border:0;border-left:1px solid #d9e0e6;border-radius:0;background:transparent;box-shadow:none}
 .phone-inline-actions .phone-font-size-action:focus-visible{outline:2px solid #9b7855;outline-offset:-3px}
}
/* Settings commands are separate from choice groups in every design mode. */
@media screen and (max-width:600px){
 .phone-action-summary{min-width:0;flex:1;font-size:12px;color:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 .phone-settings-actions{display:flex;flex:none;align-items:center;gap:6px;margin-left:auto;border-left:1px solid #d9e0e6;padding-left:6px}
 .phone-inline-actions .phone-settings-command{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;flex:0 0 44px;width:44px;min-width:44px;height:44px;min-height:44px;padding:3px;border:0;border-radius:0;background:transparent;box-shadow:none}
 .phone-settings-command>svg{width:18px;height:18px}.phone-settings-command>span{font-size:10px;line-height:1.1;white-space:nowrap}
 /* Give the intrinsic pt-sized SVG a definite display slot; it cannot size or
    displace the flex layout. This changes screen fitting, never print data. */
 #studio.phone-workspace .workspace{align-items:stretch;min-width:0}
 #studio.phone-workspace .preview{position:static;inset:auto;min-width:0;width:100%;flex:1 1 0}
 #studio.phone-workspace .paper-mat{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);align-items:stretch;justify-content:stretch;min-width:0;min-height:0;flex:1 1 0;overflow:hidden}
 #studio.phone-workspace #paper{position:relative;display:block;width:100%;height:100%;min-width:0;min-height:0;margin:0;overflow:hidden}
 #studio.phone-workspace #paper>svg{position:absolute;inset:0;display:block;width:100%;height:100%;max-width:100%;max-height:100%}
}
@media screen and (max-width:600px){
 #studio.phone-workspace .paper-mat>.preview-top{grid-row:1;grid-column:1}
 #studio.phone-workspace #paper{grid-row:2;grid-column:1}
}
