/* Mobile authoring keeps the live frame above the on-demand tool sheet. */
@media(max-width:760px){
 html{scroll-padding-bottom:90px}body{padding-bottom:calc(78px + env(safe-area-inset-bottom))}
 .topbar{min-height:54px;height:54px;padding:0 6px}.brand{flex:1;min-width:62px}
 .project-actions .studio-icon,.project-actions .upload{min-height:44px;height:44px;width:34px;min-width:34px}
 .project-actions #new-project{display:inline-flex}.project-actions #export{width:auto;min-width:44px;padding:8px;gap:4px}.project-actions #export span{display:inline;font-size:10px}
 .theme-control{margin-right:0}.viewer{height:min(54dvh,520px);min-height:285px}.preview-area{min-height:0}
 .viewer-top{flex-wrap:wrap;height:auto;min-height:36px}.viewer-top select{min-height:32px}.viewer-top #fullscreen{min-height:36px;min-width:36px}
 #media-reconnect span{flex:1 0 100%;min-width:0;max-height:2.8em;overflow:hidden}.studio-sheet-open #media-reconnect span{display:none}
 .transport{min-height:44px}.transport .studio-icon{width:40px;height:40px;padding:8px}.seek-bar{min-height:22px!important;margin:0!important;touch-action:pan-x}
 .safe-zone-notices{min-height:14px}.safe-zone-warning,.safe-zone-note{font-size:9px}
 .timeline{height:240px;min-height:240px;max-height:280px}.timeline-top{flex-wrap:nowrap;min-height:42px;height:42px;overflow-x:auto;scrollbar-width:thin}.timeline-top #timeline-duration{flex:0 0 auto;white-space:nowrap}
 .timeline-actions{height:46px;min-height:46px;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;touch-action:pan-x}.timeline-actions .timeline-icon,.timeline-top .timeline-icon{min-width:44px;width:44px;height:44px;flex-basis:44px}
 .timeline-scroll{min-height:128px;max-height:none;height:auto;flex:1;overscroll-behavior-x:contain}.timeline-zoom-tools{flex:0 0 auto}#selection-count{flex:0 0 auto}
 .studio-sheet-open .viewer{height:calc(53dvh - 150px);min-height:220px;max-height:360px}.studio-backdrop{background:transparent}.library.sheet-open,.inspector.sheet-open{height:47dvh;min-height:230px;max-height:calc(100dvh - 145px);padding:10px 12px 16px;bottom:calc(72px + env(safe-area-inset-bottom));scroll-padding-top:60px}
 .sheet-close{width:44px;height:44px;top:0}.panel-title{position:sticky;top:0;z-index:2;min-height:44px;padding:12px 48px 10px 0;background:var(--panel);margin-bottom:6px}
 #mobile-style-gallery{margin-top:4px}#mobile-style-gallery>summary{min-height:44px;padding:12px}#mobile-style-gallery .mobile-gallery-body{max-height:calc(47dvh - 115px);min-height:140px;padding:6px 8px}
 #mobile-style-gallery .gallery-jumps{grid-template-columns:repeat(4,minmax(0,1fr));gap:3px}#mobile-style-gallery .gallery-jumps button{min-height:40px;font-size:10px;padding:4px 2px}
 #mobile-style-gallery .style-card{height:126px;min-height:126px}#mobile-style-gallery .style-card canvas{height:78px}#mobile-style-gallery .style-card small{font-size:11px;line-height:1.35}
 #mobile-style-gallery .field:has(#gallery-scope){font-size:0;gap:0;margin:4px 0}#mobile-style-gallery .field select,#mobile-style-gallery .style-search input{font-size:16px;min-height:44px}#mobile-style-gallery .gallery-filters>summary{min-height:44px;padding:12px 0}
 .inspector input:not([type=range]):not([type=checkbox]):not([type=color]),.inspector textarea,.inspector select{font-size:16px;min-height:44px}.inspector textarea{min-height:84px}.inspector-group>summary{min-height:48px}
 .word-choices button,#word-choices button,.choices button{min-height:44px}.inspector .panel-action{min-height:44px}
 dialog{width:calc(100vw - 24px);max-height:calc(100dvh - 36px);overflow-y:auto;padding:16px;box-sizing:border-box}dialog select,dialog input{font-size:16px;min-height:44px}.dialog-heading button{min-width:44px;min-height:44px}.export-dialog-actions{display:flex;flex-wrap:wrap;gap:8px}.export-dialog-actions button{min-height:44px;flex:1 1 130px}
 #message{max-width:calc(100vw - 28px);bottom:calc(84px + env(safe-area-inset-bottom));font-size:12px}
}
@media(max-width:360px){.brand{font-size:8px!important;letter-spacing:.4px}.project-actions .studio-icon,.project-actions .upload{width:30px;min-width:30px}.project-actions #export span{display:none}.viewer-top #ratio{max-width:92px}.viewer-top #preview-zoom{max-width:72px}.volume{display:none}}
@media(max-width:760px) and (max-height:650px){.viewer{height:48dvh;min-height:235px}.library.sheet-open,.inspector.sheet-open{height:46dvh;min-height:180px}#mobile-style-gallery .mobile-gallery-body{max-height:calc(46dvh - 105px);min-height:95px}}
@media(min-width:761px) and (max-height:550px){.workspace{height:auto!important;min-height:calc(100dvh - 70px)}.viewer{min-height:300px}.timeline{max-height:200px}}
@media(max-width:760px){.timeline{height:260px;min-height:260px}.timeline-top{height:auto;min-height:88px;flex-wrap:wrap;overflow:visible;flex-shrink:0}.timeline-top #timeline-duration{max-width:58px;flex:0 0 58px}.timeline-top .timeline-actions{order:10;flex:1 0 100%;width:100%;min-width:0;max-width:100%;height:46px;min-height:46px}.timeline-top .timeline-zoom-tools{max-width:calc(100% - 112px);overflow-x:auto;overflow-y:hidden;scrollbar-width:thin}.timeline-scroll{min-height:128px}.studio-sheet-open .safe-zone-notices{display:none}.studio-sheet-open .viewer .seek-bar{min-height:12px!important}.studio-sheet-open .viewer .transport{height:36px;min-height:36px}}

.mobile-auto-entry{display:none}#auto-montage-dialog{width:min(620px,calc(100vw - 24px));max-height:calc(100dvh - 32px);overflow:auto}#auto-options{display:grid;gap:12px}#auto-options .check-field{min-height:36px;align-items:center;line-height:1.5}#auto-options input[type=checkbox]{width:20px;height:20px;flex-shrink:0}#auto-plan{max-height:30dvh;overflow:auto;margin:12px 0}#auto-progress{width:100%}@media(max-width:760px){.mobile-auto-entry:not([hidden]){display:block;width:100%;min-height:44px;margin:10px 0}.mobile-auto-entry[hidden]{display:none}#auto-options .check-field{min-height:44px;font-size:13px}#auto-montage-dialog .dialog-heading{position:sticky;top:0;background:var(--panel);z-index:1}#auto-montage-dialog .export-dialog-actions button{flex-basis:100%}}

#meme-library-dialog{width:min(820px,calc(100vw - 24px));max-height:calc(100dvh - 32px);overflow:auto}.meme-library-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:16px}.meme-library-grid article,.meme-proposal{border:1px solid var(--line);background:var(--panel);border-radius:10px;padding:12px}.meme-sample{display:block;width:100%;max-height:180px;background:#14151b;border-radius:8px;margin:8px 0}.meme-proposal{margin:10px 0}.meme-proposal>label{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.meme-proposal p{font-size:12px;line-height:1.5}.meme-proposal small{color:var(--muted)}.meme-library-grid h3{font-size:14px}.meme-proposals>h3{font-size:15px}@media(max-width:760px){.meme-library-grid{grid-template-columns:1fr}#meme-library-dialog .dialog-heading{position:sticky;top:0;background:var(--panel);z-index:2}.meme-proposal input[type=checkbox]{width:22px;height:22px}.meme-proposal>label{min-height:44px}}

#auto-caption-picker h3{margin:0 0 8px;font-size:15px}#auto-caption-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;max-height:320px;overflow:auto;padding:3px}#auto-caption-grid .auto-caption-card{display:flex;flex-direction:column;align-items:stretch;padding:6px;min-width:0;min-height:110px;background:#17161c;color:#f5f1ed;border:1px solid #51434d;border-radius:10px;text-align:center}#auto-caption-grid .auto-caption-card[aria-pressed=true]{border:2px solid #d5a1af;background:#32232f;padding:5px}#auto-caption-grid canvas{width:100%;height:auto;aspect-ratio:480/230}#auto-caption-grid span{font-size:11px;line-height:1.35;padding:5px 2px}#auto-caption-selected{font-size:12px;color:var(--muted);margin:8px 0}@media(max-width:760px){#auto-caption-grid{grid-template-columns:repeat(2,minmax(0,1fr));max-height:280px}#auto-caption-grid .auto-caption-card{min-height:108px}}

#auto-options .check-field{margin:0;gap:10px}#auto-options input[type=checkbox]{min-height:20px;height:20px}#auto-caption-picker>p.small{margin:6px 0 10px}

#auto-montage-dialog{width:min(860px,calc(100vw - 24px))}#auto-plan{max-height:none;overflow:visible}.auto-idea-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.auto-idea-grid button{display:grid;gap:8px;text-align:left;white-space:normal;min-width:0;min-height:120px;padding:14px;border:1px solid var(--line);background:var(--panel);border-radius:12px;color:inherit}.auto-idea-grid button[aria-pressed=true]{border:2px solid var(--accent,#d5a1af);padding:13px;background:color-mix(in srgb,var(--accent,#d5a1af) 14%,var(--panel))}.auto-idea-grid span{font-size:12px;line-height:1.5}.auto-idea-grid small{font-size:11px;color:var(--muted)}.auto-story-pages{display:flex;align-items:center;justify-content:space-between;gap:12px;position:sticky;top:0;background:var(--panel);padding:8px 0}.auto-story-pages button{min-width:44px;min-height:44px}.auto-story-rows{list-style:none;padding:0;margin:0}.auto-story-rows>li{border-bottom:1px solid var(--line);padding:12px 0;font-size:12px;line-height:1.5;overflow-wrap:anywhere}.auto-story-rows ul{padding-left:18px;margin-top:6px}.auto-idea-grid button:focus-visible{outline:2px solid var(--accent,#d5a1af);outline-offset:2px}@media(max-width:600px){.auto-idea-grid{grid-template-columns:1fr}.auto-idea-grid button{min-height:110px}}

.timeline-scroll{user-select:none;-webkit-user-select:none}#timeline-inner{position:relative}#timeline-marquee{position:absolute;pointer-events:none;z-index:20;border:1px solid #e6b5c6;background:#d5a1af33}.timeline .clip.range-selected{outline:2px solid #f0bed0;outline-offset:-2px;box-shadow:inset 0 0 0 999px #d5a1af44}.timeline .clip.range-selected::after{content:"✓";position:absolute;right:2px;top:0;color:#fff;font-size:11px;background:#57394a}
