@import url('./poster-fonts.css');
#posterWorkspace,#posterSurface{display:none}
body[data-ux-step="poster"] aside #posterWorkspace{padding:12px!important;margin:0!important;border:0!important;border-radius:0!important;background:var(--studio-surface)!important;box-shadow:none!important}
body[data-ux-step="poster"] aside>.inspectorBody{padding:0!important}
#posterWorkspace .pw-heading{margin-bottom:12px!important;position:sticky;top:0;z-index:2;background:var(--studio-surface);padding:4px 0 8px}
#posterWorkspace h2{font-size:16px!important;font-weight:500!important}
#posterWorkspace .pw-document{margin-bottom:16px;padding:0;border:0}
#posterWorkspace .pw-document-heading{display:flex;align-items:center;gap:10px;margin-bottom:20px}
#posterWorkspace .pw-document-heading button{width:40px;padding:6px;font-size:18px}
#posterWorkspace .pw-document>h3{margin:16px 0 10px}
#posterWorkspace #pwCanvasSettings{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;padding:10px 12px;margin-bottom:12px;background:var(--studio-rail);text-align:left;font-size:13px}
#posterWorkspace #pwCanvasSettings svg{width:18px;height:18px;flex:none}
#posterWorkspace #pwCanvasFormat{margin-left:auto;font-size:12px;color:var(--studio-muted);font-variant-numeric:tabular-nums}
#posterWorkspace .pw-document .pw-row{margin-top:8px}
#posterWorkspace .pw-add button{display:flex;align-items:center;justify-content:center;gap:8px;background:transparent}
#posterWorkspace :is(.pw-add button,#pwPlay) svg{width:18px;height:18px;vertical-align:middle}
#posterWorkspace .pw-layer{border-radius:0!important;border:0!important;border-bottom:1px solid var(--studio-edge)!important;padding:2px 0!important;background:transparent!important}
#posterWorkspace .pw-layer.selected{background:var(--studio-rail)!important;box-shadow:inset 2px 0 var(--ux-action)}
#posterWorkspace .pw-layer-heading{margin-top:8px!important}
#posterWorkspace #pwLayerEditor{border:0!important;padding:0!important}
#posterWorkspace #pwEditorFields>.pw-layer-heading{margin:0 0 12px!important;padding-bottom:12px;border-bottom:1px solid var(--studio-edge)}
#posterWorkspace #pwSelectedName{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#posterWorkspace #pwLayerEditor input[type="number"]{width:100%;font-variant-numeric:tabular-nums}
#posterWorkspace #pwLayerEditor label{margin-bottom:12px}
#posterWorkspace .pw-export{position:static;padding:12px 0 4px;margin:0!important;border-top:1px solid var(--studio-edge);background:var(--studio-surface)}
#posterWorkspace .pw-transform{border-top:1px solid var(--studio-edge);border-bottom:1px solid var(--studio-edge);margin:0 0 12px;padding:0}
#posterWorkspace .pw-transform summary{font-size:12px;min-height:44px;align-content:center;padding:8px 0}
#posterWorkspace .pw-export button{min-height:44px}
#posterWorkspace .pw-hint{margin:12px 0;font-size:11px}
#posterWorkspace #pwStatus:empty{display:none}
#presets [hidden]{display:none!important}
body[data-ux-step="poster"] #posterWorkspace{display:block!important}
body[data-ux-step="poster"] #posterSurface{display:flex;align-items:center;justify-content:center;position:absolute;inset:16px;min-height:0}
body[data-ux-step="poster"] .stage>:not(#posterSurface):not(#sideToggle){visibility:hidden!important;pointer-events:none!important}
body[data-ux-step="poster"] :is(#tlDock,#workflowGuide,#styleAccess){display:none!important}
#pwCanvas{max-width:100%;max-height:100%;width:auto;height:auto;object-fit:contain;box-shadow:none;outline:1px solid var(--studio-edge);touch-action:none;cursor:default}
#posterWorkspace .pw-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}
#posterWorkspace h2{margin:0;font-size:18px}
#posterWorkspace label{display:flex;flex-direction:column;gap:6px;font-size:12px;color:var(--studio-muted);margin-bottom:14px;min-width:0}
#posterWorkspace :is(input,select,textarea,button){font:inherit;color:var(--studio-copy);background:var(--studio-rail);border:1px solid var(--studio-edge);border-radius:6px;box-sizing:border-box;min-height:40px;padding:8px}
#posterWorkspace textarea{width:100%;resize:vertical;font-size:16px;line-height:1.3}
#posterWorkspace input[type="color"]{padding:3px;width:100%}
#posterWorkspace input[type="range"]{width:100%;padding:0;accent-color:var(--ux-action)}
#posterWorkspace .pw-row{display:flex;gap:10px}#posterWorkspace .pw-row>label{flex:1}
#posterWorkspace .pw-presets,#posterWorkspace .pw-export{display:flex;gap:6px;margin-bottom:16px}#posterWorkspace .pw-presets>button,#posterWorkspace .pw-export>button{flex:1}
#posterWorkspace #pwPng{background:var(--ux-action);color:var(--ux-action-ink)}
#posterWorkspace .pw-hint,#pwStatus{font-size:12px;line-height:1.5;color:var(--studio-muted)}
#posterWorkspace details{margin-bottom:16px}#posterWorkspace summary{padding:8px 0;cursor:pointer}
#posterWorkspace [hidden],#posterWorkspace .pw-legacy{display:none!important}
#posterWorkspace .pw-layer-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:12px 0 8px}
#posterWorkspace h3{font-size:13px;margin:0;font-weight:600}
#posterWorkspace .pw-layer-heading>div{display:flex;gap:4px}
#posterWorkspace .pw-layer-heading button{width:36px;padding:4px;min-height:36px}
#posterWorkspace .pw-add{display:flex;gap:8px;margin-bottom:8px}
#posterWorkspace .pw-add button{flex:1}
#posterWorkspace .pw-add{flex-wrap:wrap}
#posterWorkspace .pw-add button{min-width:80px}
#posterWorkspace .pw-variation{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.15fr);gap:8px;align-items:end;margin:12px 0}
#posterWorkspace .pw-variation label{margin:0}
#posterWorkspace .pw-variation input{font-variant-numeric:tabular-nums}
#posterWorkspace .pw-variation button{min-height:44px;margin:0}
#posterWorkspace .pw-check{display:flex;flex-direction:row;align-items:center;gap:10px;min-height:44px}
#posterWorkspace .pw-check input[type="checkbox"]{width:18px;height:18px;min-height:18px;flex:none;margin:0}
#posterWorkspace :is(#pwGeneratorControls,#pwGraphicAccentLabel)[hidden]{display:none!important}
#pwLayers{display:grid;gap:4px;margin-bottom:16px}
#posterWorkspace .pw-layer{display:grid;grid-template-columns:minmax(0,1fr) repeat(3,36px);gap:2px;border:1px solid var(--studio-edge);border-radius:6px;padding:3px;background:var(--studio-rail)}
#posterWorkspace .pw-layer.selected{border-color:var(--ux-action)}
#posterWorkspace .pw-layer button{border:0;background:transparent;min-height:36px;padding:4px;border-radius:3px}
#posterWorkspace .pw-layer svg{width:16px;height:16px;vertical-align:middle}
#posterWorkspace .pw-layer button[data-action="select"]{display:flex;align-items:center;gap:8px;text-align:left;min-width:0}
#posterWorkspace .pw-layer button[data-action="select"] span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#posterWorkspace .pw-layer.muted button[data-action="select"]{opacity:.5}
#posterWorkspace button:disabled{opacity:.35;cursor:default}
#posterWorkspace button:not(:disabled){cursor:pointer}
#posterWorkspace :is(button,input,select,textarea):focus-visible{outline:2px solid var(--ux-action);outline-offset:2px}
#pwLayerEditor{padding-top:4px;border-top:1px solid var(--studio-edge)}
#pwSelection{position:absolute;border:1px solid var(--ux-action);box-sizing:border-box;pointer-events:none;max-width:100%;max-height:100%}
#pwSelection[hidden]{display:none}
body .flow:has(#stepPoster){grid-template-columns:repeat(6,minmax(0,1fr))!important}
body .flow:has(#stepPoster) .fbtn{min-width:0;padding-left:3px;padding-right:3px}
@media(max-width:680px){body[data-ux-step="poster"] #posterSurface{inset:8px}#posterWorkspace :is(button,select,input){min-height:44px}#posterWorkspace select{font-size:16px}}
@media(max-width:680px){#posterWorkspace .pw-layer{grid-template-columns:minmax(0,1fr) repeat(3,44px)}#posterWorkspace .pw-layer button{min-height:44px}#posterWorkspace .pw-layer-heading button{width:44px;min-height:44px}#posterWorkspace label{font-size:13px}#posterWorkspace input[type="number"]{width:100%;font-size:16px}}
#posterWorkspace .pw-toolbar{display:flex;gap:4px}
#posterWorkspace .pw-toolbar button{width:40px;min-height:40px;padding:6px}
#posterWorkspace .pw-field-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:32px;color:var(--studio-muted)}
#posterWorkspace #pwLayerEditor .pw-field-heading input[type="number"]{width:64px;min-height:32px;padding:4px 6px;text-align:right;font-size:12px}
#posterWorkspace #pwLayerEditor input[type="range"]{border:0!important;background:transparent!important;border-radius:0;min-height:28px;height:28px;padding:0;box-shadow:none}
#posterWorkspace .pw-empty{padding:20px 8px 24px;text-align:center;color:var(--studio-muted);font-size:13px;line-height:1.5}
#posterWorkspace .pw-empty p{margin:0 0 16px}
#posterWorkspace .pw-locked{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;font-size:12px;color:var(--studio-muted)}
#posterWorkspace .pw-arrange{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px;color:var(--studio-muted);font-size:12px}
#posterWorkspace .pw-arrange>div{display:flex;gap:4px}
#posterWorkspace .pw-arrange button{width:40px;padding:6px}
#posterWorkspace :is(.pw-arrange,.pw-layer-heading) svg{width:18px;height:18px;vertical-align:middle}
#posterWorkspace button[data-action="delete"]:not(:disabled):hover,#posterWorkspace #pwRemove:not(:disabled):hover{color:#f08b91;background:var(--studio-rail)}
#posterWorkspace #pwSaveState{min-height:18px}
#posterWorkspace #pwTemplates{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;padding:10px 12px;margin-bottom:8px;text-align:left;font-size:13px;border-color:var(--ux-action)}
#posterWorkspace #pwTemplates svg{width:18px;height:18px;flex:none}
#posterWorkspace #pwTemplates span:last-child{margin-left:auto;font-size:12px;color:var(--studio-muted)}
#posterWorkspace .pw-template-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-bottom:16px}
#posterWorkspace .pw-template{display:flex;flex-direction:column;gap:8px;min-width:0;text-align:left;padding:6px 6px 10px;overflow:hidden;border-radius:6px;background:transparent;box-shadow:none}
#posterWorkspace .pw-template canvas{display:block;width:100%;height:auto;margin-bottom:4px}
#posterWorkspace .pw-template>span{font:500 12px/1.4 var(--ui-font);color:var(--studio-copy);padding:0 4px;overflow-wrap:anywhere}
#posterWorkspace .pw-template>small{font-size:11px;color:var(--studio-muted);padding:0 4px;line-height:1.4}
#posterWorkspace .pw-template:hover{border-color:var(--ux-action)}
#posterWorkspace .pw-template[hidden]{display:none!important}
#posterWorkspace .pw-template-filter{display:block;margin:0;font-size:12px}
#posterWorkspace .pw-template-filter select{width:100%;min-height:44px;font-size:13px}
#posterWorkspace .pw-template-section{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:12px;font:500 12px/1.4 var(--ui-font);color:var(--studio-muted);margin:16px 0 2px;padding:0;border:0}
#posterWorkspace .pw-template-section:first-child{margin-top:0}
#posterWorkspace .pw-template-section:after{content:attr(data-count);font-variant-numeric:tabular-nums}
#posterWorkspace #pwTemplateGallery .pw-document-heading{margin-bottom:12px}
#posterWorkspace #pwTemplateGallery h3{font:500 16px/1.4 var(--ui-font);margin:0}
#posterWorkspace[data-inspector="templates"]>:is(.pw-heading,.pw-export,#pwSaveState,#pwStatus){display:none!important}
#posterWorkspace #pwTemplateGallery .pw-document-heading{position:sticky;top:0;z-index:2;background:var(--studio-surface);padding:4px 0 8px}
#posterWorkspace .pw-library-tools{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,.95fr);gap:8px}
#posterWorkspace .pw-template-search{position:relative;min-width:0}
#posterWorkspace #pwTemplateSearch,#posterWorkspace #pwTemplateCategory{width:100%;min-width:0;min-height:44px;height:44px;border-radius:6px;background:var(--studio-rail);color:var(--studio-copy);border:1px solid var(--studio-edge);font:400 12px/1.4 var(--ui-font);margin:0;padding:8px 30px 8px 10px;text-overflow:ellipsis}
#posterWorkspace #pwClearTemplateSearch{position:absolute;right:2px;top:2px;width:30px;min-height:40px!important;height:40px;border:0;background:transparent;padding:0;font-size:18px}
#posterWorkspace .pw-library-meta{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:28px;color:var(--studio-muted);font:400 12px/1.4 var(--ui-font);font-variant-numeric:tabular-nums}
#posterWorkspace .pw-template-note{font:400 12px/1.5 var(--ui-font);margin:8px 0 16px;color:var(--studio-muted)}
#posterWorkspace :is(#pwTemplateSearch,#pwTemplateCategory,#pwResetTemplateFilters,#pwClearTemplateSearch,.pw-template):focus-visible{outline:2px solid var(--ux-action);outline-offset:2px}
#posterWorkspace :is(.pw-template-section,#pwTemplateEmpty,#pwResetTemplateFilters,#pwClearTemplateSearch)[hidden]{display:none!important}
@media(max-width:680px){
 #posterWorkspace .pw-library-tools{grid-template-columns:1fr}
 #posterWorkspace :is(#pwTemplateSearch,#pwTemplateCategory){font-size:16px}
 #posterWorkspace #pwResetTemplateFilters{min-height:44px!important}
}
@media(max-width:700px){#posterWorkspace .pw-toolbar button{width:44px;min-height:44px}}
@media(max-width:680px){#posterWorkspace #pwLayerEditor .pw-field-heading input[type="number"]{min-height:44px;font-size:16px}#posterWorkspace #pwLayerEditor input[type="range"]{min-height:36px;height:36px}}
/* Poster needs room for its layer inspector, not the compact style tray. */
@media(min-width:681px) and (max-width:980px) and (max-height:600px){
 body[data-ux-step="poster"]{height:100dvh;min-height:0;overflow:hidden;display:flex;flex-direction:column}
 body[data-ux-step="poster"] header{flex:none}
 body[data-ux-step="poster"] main{flex:1;min-height:0;height:0;overflow:hidden;grid-template-columns:minmax(0,1fr) 320px}
 body[data-ux-step="poster"] :is(.stage,aside){height:100%;min-height:0;overflow:hidden}
 body[data-ux-step="poster"] footer{display:none}
 body[data-ux-step="poster"] aside>.inspectorBody{overflow-y:auto;min-height:0}
}
@media(max-width:680px){
 body[data-ux-step="poster"]:not(.source-empty):not(.mobile-sheet-collapsed){--mobile-sheet-h:clamp(240px,46dvh,460px)}
 body[data-ux-step="poster"] .stage{padding:0!important}
 body[data-ux-step="poster"] #pwCanvas{touch-action:none!important;user-select:none;-webkit-user-select:none}
 body[data-ux-step="poster"] aside>.inspectorBody{scrollbar-gutter:auto;overscroll-behavior:contain;scroll-padding:64px 0 20px}
 body[data-ux-step="poster"] #posterWorkspace{padding-bottom:calc(16px + env(safe-area-inset-bottom))!important}
 body[data-ux-step="poster"] aside #posterWorkspace :is(button,#pwTemplates,#pwCanvasSettings,.pw-toolbar button,.pw-export button){min-height:44px!important}
 body[data-ux-step="poster"] aside #posterWorkspace .pw-toolbar button{width:44px!important}
 #posterWorkspace :is(select,input,textarea){max-width:100%;min-width:0}
 #posterWorkspace .pw-template canvas{max-height:180px;object-fit:contain}
}
@media(max-width:680px) and (max-height:520px){
 body[data-ux-step="poster"]:not(.source-empty):not(.mobile-sheet-collapsed){--mobile-sheet-h:clamp(150px,43dvh,220px)}
}
/* Browsing a library is a different task from editing a layer: give cards the
   phone workspace, then restore the canvas/tools split on Back or Apply. */
@media(max-width:680px){
 body[data-ux-step="poster"]:not(.source-empty):has(#posterWorkspace[data-inspector="templates"]){--mobile-sheet-h:calc(100dvh - var(--mobile-header-h,62px) - var(--mobile-nav-h,64px))}
 body[data-ux-step="poster"]:has(#posterWorkspace[data-inspector="templates"]) #mobileSheetToggle{display:none!important}
 body[data-ux-step="poster"]:has(#posterWorkspace[data-inspector="templates"]) .stage{visibility:hidden}
 body[data-ux-step="poster"]:has(#posterWorkspace[data-inspector="templates"]) aside{border-radius:0}
}
