.mobile-labs-launch,.mobile-labs-close,.mobile-labs-tabs,.mobile-ai-options,.mobile-post-tabs,.type-mobile-controls{display:none;}
@media(max-width:700px){
 .mobile-labs-launch{display:flex;align-items:center;justify-content:space-between;gap:24px;position:absolute;z-index:24;right:22px;bottom:142px;min-height:44px;padding:8px 14px;border:1px solid #eeeae26b;background:#17141b66;color:var(--paper);font-size:12px;font-weight:700;letter-spacing:.14em;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);}
 .mobile-labs-launch span{font-size:19px;font-weight:400;}
 #post-panel.labs{position:fixed;z-index:110;inset:auto 0 0;width:auto!important;max-width:none;padding:12px 20px max(12px,env(safe-area-inset-bottom));border-top:1px solid #eeeae240;border-radius:18px 18px 0 0;background:linear-gradient(135deg,#25212db8,#111016b8);backdrop-filter:blur(26px) saturate(.75);-webkit-backdrop-filter:blur(26px) saturate(.75);box-shadow:0 -12px 50px #0002;transform:translateY(calc(100% + 24px));visibility:hidden;transition:transform .42s cubic-bezier(.2,.7,.2,1),visibility .42s;max-height:56svh;display:flex;flex-direction:column;text-shadow:none;}
 body[data-mobile-labs=open] #post-panel{transform:translateY(0);visibility:visible;}
 .labs-header{margin:0 0 8px;gap:12px;flex-shrink:0;}
 .labs h2{font-size:13px;font-weight:800;letter-spacing:.16em;order:-1;}
 #post-state{font-size:9px;margin-left:auto;}
 .mobile-labs-close{display:grid;place-items:center;order:2;width:44px;height:36px;background:none;border:0;padding:0;color:var(--paper);}
 .mobile-labs-close svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.5;}
 .mobile-labs-tabs{display:flex;gap:26px;border-bottom:1px solid #eeeae22b;flex-shrink:0;}
 .mobile-labs-tabs button,.mobile-ai-branches button,.mobile-post-tabs button{min-height:42px;border:0;border-bottom:1px solid transparent;background:none;color:#eeeae290;font:inherit;font-size:12px;letter-spacing:.08em;padding:6px 0;}
 .mobile-labs-tabs [aria-selected=true],.mobile-ai-branches [aria-pressed=true],.mobile-post-tabs [aria-pressed=true]{color:var(--paper);border-bottom-color:var(--coral);}
 #post-panel .labs-section{border:0;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;}
 #post-panel .labs-section>summary{display:none;}
 #post-panel .labs-section:not([open]){display:none;}
 #post-panel .labs-reveal{height:auto!important;overflow:visible;}
 #post-panel .labs-content{padding:12px 0 6px;max-height:none;overflow:visible;}
 #post-panel .labs-ai-content{min-width:0;}
 #post-panel .ai-tree,#post-panel .ai-caption{display:none;}
 .mobile-ai-options{display:block;}
 .mobile-ai-branches,.mobile-post-tabs{display:flex;gap:24px;}
 .mobile-ai-branches button,.mobile-post-tabs button{font-size:13px;letter-spacing:0;min-height:38px;}
 .mobile-ai-cards{display:flex;gap:17px;padding:18px 3px 8px;overflow:auto;overscroll-behavior-x:contain;scrollbar-width:thin;}
 .mobile-ai-cards>button{flex:0 0 80px;display:flex;align-items:center;flex-direction:column;gap:9px;min-height:100px;padding:0;border:0;background:none;font:inherit;font-size:11px;line-height:1.35;color:#eeeae29e;text-align:center;}
 .mobile-ai-cards>button[hidden]{display:none;}
 .mobile-ai-thumb{display:block;position:relative;width:72px;height:72px;border-radius:50%;border:1px solid #eeeae249;background:#17141e66;}
 .mobile-ai-thumb img{width:100%;height:100%;object-fit:contain;border-radius:50%;user-select:none;pointer-events:none;}
 [aria-pressed=true]>.mobile-ai-thumb{border-color:var(--coral);box-shadow:0 0 0 3px #f0523d24;}
 .is-pending>.mobile-ai-thumb::after{content:'';position:absolute;inset:-3px;border-radius:50%;background:conic-gradient(var(--coral) var(--choice-progress,0deg),#aaa6ac77 0);mask:radial-gradient(farthest-side,transparent calc(100% - 2px),#000 0);-webkit-mask:radial-gradient(farthest-side,transparent calc(100% - 2px),#000 0);}
 #post-fields{max-height:none;overflow:visible;padding:0;}
 #post-panel[data-post-layer=person] [data-post-group]:not([data-post-group=person]),#post-panel[data-post-layer=background] [data-post-group]:not([data-post-group=background]),#post-panel[data-post-layer=effects] [data-post-group]:not([data-post-group=effects]){display:none;}
 #post-panel .labs-fields legend{display:none;}
 .labs .post-row{margin-bottom:6px;}
 .labs .post-row-heading{font-size:12px;}
 .labs .post-row output{font-size:11px;}
 .labs .post-row input{height:40px;touch-action:none;}
 .labs .post-row input::-webkit-slider-thumb{width:12px;height:10px;}
 .labs .post-row input::-moz-range-thumb{width:12px;height:10px;}
 .labs-footer{padding-top:4px;flex-shrink:0;gap:22px;}
 .labs-footer button{min-height:40px;font-size:11px;}
 #post-pause{width:44px;font-size:16px;}
 .labs-note{font-size:11px;}
 #post-panel .type-edit-controls,#post-panel .type-layout-controls,#post-panel .type-motion-controls{display:block;}
 #post-panel .type-edit-toggle,#post-panel .type-editor-actions{display:flex;}
 #post-panel .type-editor-selection{display:block;font-size:11px;min-height:0;}
 .type-editor-mobile,.type-editor-keys{display:none!important;}
 #post-panel .type-section-title,#post-panel .type-text-heading{font-size:11px;}
 #post-panel .type-layout-help,#post-panel .type-text-help,#post-panel .type-color-note{font-size:11px;}
 #post-panel .type-text{font-size:18px;min-height:44px;}
 #post-panel .type-edit-toggle,#post-panel .type-editor-actions button,#post-panel .type-motion-presets button,#post-panel #type-motion-play{font-size:12px;min-height:44px;}
 .type-mobile-controls{display:block;}
 .type-mobile-controls p{font-size:11px;color:#eeeae28c;line-height:1.5;}
 .mobile-letter-picker{display:flex;gap:5px;overflow:auto;padding:5px 1px 12px;}
 .mobile-letter-picker button{flex:0 0 36px;min-height:40px;padding:4px;border:1px solid #eeeae235;background:none;font-size:16px;color:var(--paper);}
 .mobile-letter-picker [aria-pressed=true]{border-color:var(--coral);color:var(--coral);}
 #post-panel [data-editing=off] .type-mobile-controls .post-row{opacity:.4;}
 .type-editor-done{position:absolute;left:22px;bottom:auto;top:84px;min-height:44px;font-size:12px;z-index:28;}
 body[data-mobile-labs=open] .corner-copy--intro{opacity:0;}
 body[data-mobile-labs=open] .mobile-labs-launch{visibility:hidden;}
 body[data-mobile-labs=open] .scene-jump{visibility:hidden;}
 #post-panel .type-loop{font-size:12px;min-height:44px;}
 #post-panel .type-loop input{width:20px;height:20px;}
 #post-panel .type-loop input::before{width:10px;height:10px;}
 .labs .layers-toggle{min-height:44px;font-size:12px;}
 .labs .layers-navigation{font-size:11px;}
}
@media(max-width:700px) and (max-height:500px){.mobile-labs-launch{bottom:85px;}}
@media(prefers-reduced-motion:reduce){#post-panel.labs{transition:none;}}

@media(min-width:1000px){.scene:has(.labs[data-expanded-section]:not([data-expanded-section=none])) .corner-copy--outro{right:calc(5vw + 410px);bottom:28px;max-width:270px;text-align:left;font-size:10px;}}
@media(min-width:701px) and (max-width:999px){.scene:has(.labs[data-expanded-section]:not([data-expanded-section=none])) .corner-copy--outro{display:none;}}

/* Compact mobile panel: one header row, smaller previews, unchanged touch targets. */
@media(max-width:700px){
 #post-panel.labs{padding:7px 16px max(7px,env(safe-area-inset-bottom));max-height:46svh;}
 #post-panel.labs[data-mobile-tab=ai]{max-height:min(43svh,290px);}
 #post-panel .labs-header{gap:9px;margin-bottom:2px;min-height:40px;}
 #post-panel .labs-header h2{flex-shrink:0;font-size:11px;letter-spacing:.12em;}
 #post-panel #post-state{display:none;}
 #post-panel .mobile-labs-tabs{flex:1;justify-content:flex-end;gap:14px;border:0;}
 #post-panel .mobile-labs-tabs button{min-height:40px;font-size:11px;letter-spacing:.04em;}
 #post-panel .mobile-labs-close{width:36px;min-width:36px;height:40px;}
 #post-panel .labs-content{padding:2px 0 1px;}
 #post-panel .mobile-ai-branches{gap:22px;border-top:1px solid #eeeae21d;}
 #post-panel .mobile-ai-branches button{min-height:40px;font-size:12px;}
 .mobile-ai-scope{font-size:10px;line-height:1.35;color:#eeeae28f;margin:5px 0 0;min-height:14px;}
 #post-panel .mobile-ai-cards{gap:14px;padding:8px 3px 6px;scrollbar-width:none;}
 #post-panel .mobile-ai-cards::-webkit-scrollbar{display:none;}
 #post-panel .mobile-ai-cards>button{flex-basis:72px;min-height:78px;gap:5px;font-size:10px;}
 #post-panel .mobile-ai-thumb{width:54px;height:54px;}
 #post-panel .labs-footer{padding-top:0;gap:20px;}
 #post-panel .labs-footer button{min-height:40px;}
 #post-panel .labs-note{margin:0;font-size:10px;}
}
@media(max-width:360px){#post-panel .labs-header{gap:5px;}#post-panel .mobile-labs-tabs{gap:10px;}#post-panel .labs-header h2{font-size:10px;}}

/* The keyboard changes the visible viewport, not always the page layout. */
@media(max-width:700px){
 html[data-mobile-labs-lock=true]{overflow:hidden;overscroll-behavior:none;}
 html[data-mobile-labs-lock=true] body{position:fixed;left:0;right:0;top:var(--mobile-labs-scroll-y,0px);width:100%;overflow:hidden;}
 #post-panel.labs{bottom:var(--labs-keyboard-bottom,0px);max-height:min(46svh,var(--labs-available-height,100svh));overflow-anchor:none;}
 #post-panel.labs[data-mobile-tab=ai]{max-height:min(43svh,290px,var(--labs-available-height,100svh));}
 #post-panel .labs-section{touch-action:pan-y;overflow-anchor:none;-webkit-overflow-scrolling:touch;}
 #post-panel input[type=range]{touch-action:none;user-select:none;-webkit-user-select:none;}
 #post-panel #type-text{text-transform:uppercase;user-select:text;-webkit-user-select:text;}
 #post-panel.labs[data-keyboard=true]{transition:none;max-height:min(320px,var(--labs-available-height,100svh));}
}

.mobile-range-surface,.mobile-panel-scrollbar{display:none;}
@media(max-width:700px){
 #post-panel .mobile-range-row{position:relative;}
 #post-panel .mobile-range-row input[type=range]{height:44px;opacity:0;pointer-events:none;touch-action:pan-y;}
 #post-panel .mobile-range-surface{display:block;position:absolute;left:0;right:0;bottom:0;height:44px;touch-action:pan-y;user-select:none;-webkit-user-select:none;}
 .mobile-range-track{position:absolute;left:14px;right:14px;top:21px;height:3px;border-radius:3px;background:#eeeae23b;overflow:hidden;pointer-events:none;}
 .mobile-range-fill{display:block;height:100%;width:calc(var(--range-fraction,.5)*100%);background:#eeeae2a8;}
 #post-panel .mobile-range-handle{position:absolute;left:calc(14px + var(--range-fraction,.5)*(100% - 28px));top:0;width:44px;height:44px;transform:translateX(-50%);touch-action:none;cursor:ew-resize;border-radius:50%;}
 .mobile-range-handle::before{content:'';position:absolute;inset:8px;border-radius:50%;background:var(--paper);border:1px solid #0002;box-shadow:0 2px 8px #0003;pointer-events:none;}
 .mobile-range-row:focus-within .mobile-range-handle::before{outline:1px solid var(--coral);outline-offset:3px;}
 #post-panel[data-range-dragging=true] .mobile-range-row:has(.mobile-range-handle:active) .mobile-range-handle::before{background:var(--coral);}
 .mobile-range-surface[data-disabled=true]{opacity:.35;pointer-events:none;}
 #post-panel .labs-section{scrollbar-width:none;}
 #post-panel .labs-section::-webkit-scrollbar{display:none;}
 #post-panel[data-mobile-scrollable=true] .labs-section{padding-right:40px;}
 #post-panel .mobile-panel-scrollbar{display:block;position:absolute;right:0;width:40px;touch-action:none;user-select:none;-webkit-user-select:none;}
 #post-panel .mobile-panel-scrollbar[hidden]{display:none;}
 .mobile-panel-scrollbar::before{content:'';position:absolute;left:19px;top:0;bottom:0;width:2px;border-radius:2px;background:#eeeae22b;pointer-events:none;}
 .mobile-panel-scroll-thumb{position:absolute;left:0;right:0;min-height:44px;touch-action:none;cursor:ns-resize;}
 .mobile-panel-scroll-thumb::before{content:'';position:absolute;left:15px;right:15px;top:0;bottom:0;border-radius:8px;background:#eeeae2b3;pointer-events:none;}
 .mobile-panel-scroll-thumb::after{content:'';position:absolute;left:18px;right:18px;top:50%;height:6px;border-top:1px solid #28212d;border-bottom:1px solid #28212d;transform:translateY(-50%);pointer-events:none;}
 .mobile-panel-scrollbar:focus-visible{outline:1px solid var(--coral);outline-offset:0;}
 .mobile-panel-scrollbar:active .mobile-panel-scroll-thumb::before{background:var(--coral);}
}
