/* Mobile adaptation follows WebKit safe areas / visual viewport and Ionic's
   content + tab bar + sheet patterns. No framework or remote runtime required. */
:root { --mobile-height:100dvh; --mobile-top:0px; --mobile-safe-bottom:env(safe-area-inset-bottom,0px); }
.mobile-only { display:none; }
.mobile-sheet { color:var(--ink,#edf0f3); background:var(--surface,#171b1f); border:0; border-radius:16px; padding:0; width:min(440px,calc(100% - 24px)); max-height:calc(var(--mobile-height) - 24px); }
.mobile-sheet::backdrop { background:#0009; }
.mobile-sheet>header { display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid var(--line,#ffffff18); }
.mobile-sheet>header h2 { margin:0;font-size:18px; }
.mobile-sheet button { cursor:pointer;font:inherit;color:inherit;min-height:44px;border:0;background:transparent;padding:10px 12px;border-radius:8px; }
.mobile-sheet button:focus-visible { outline:2px solid var(--accent,#b7f34a);outline-offset:-2px; }
.mobile-sheet>header button { min-width:44px; }
.mobile-sheet-body { padding:12px 16px;overflow:auto;overscroll-behavior:contain; }
.mobile-sheet-body>p { line-height:1.7; }
.mobile-nav-grid { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px; }
.mobile-nav-grid button { display:flex;flex-direction:column;align-items:center;gap:8px;background:var(--surface-soft,#101316);font-size:13px; }
.mobile-nav-grid button[aria-current=page] { color:var(--accent,#b7f34a); }
.mobile-nav-grid svg { width:24px;height:24px; }
.mobile-menu-actions { display:flex;flex-wrap:wrap;gap:6px;padding-top:14px;margin-top:14px;border-top:1px solid var(--line,#ffffff18); }
.mobile-menu-actions button { flex:1 0 40%;text-align:left; }
.mobile-install-steps { padding-left:24px;line-height:1.8; }
.mobile-install-steps li { margin:10px 0; }
.mobile-menu-note { color:var(--muted,#a8b0ba);font-size:12px;line-height:1.7; }
@media (max-width:760px), (max-width:960px) and (max-height:500px) {
  html { -webkit-text-size-adjust:100%;text-size-adjust:100%; }
  html.mobile-screen body { margin:0; }
  html.mobile-screen input:not([type=range]):not([type=checkbox]):not([type=radio]),
  html.mobile-screen textarea,html.mobile-screen select { font-size:16px!important; }
  html.mobile-screen button,html.mobile-screen summary,html.mobile-screen [role=button] { touch-action:manipulation; }
  html.mobile-screen button { min-height:44px; }
  html.mobile-screen .voice-input-button { width:44px;flex-basis:44px; }
  html.mobile-screen .canvas-voice-button { width:44px;height:44px; }
  html.mobile-screen .chat-composer footer { grid-template-columns:minmax(0,1fr) 44px 44px; }
  html.mobile-screen input,html.mobile-screen select { min-height:44px; }
  html.mobile-screen input[type=checkbox],html.mobile-screen input[type=radio] { min-height:20px;width:20px;height:20px; }
  html.mobile-screen [hidden] { display:none!important; }
  html.mobile-screen .mobile-only { display:inline-flex; }
  html.mobile-screen[data-ui-skin] .app {
    position:fixed;inset:auto 0 auto;top:var(--mobile-top);width:100%;height:var(--mobile-height);min-height:0!important;
    display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto;
    padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) 0 env(safe-area-inset-left,0px);overflow:hidden;
  }
  html.mobile-screen[data-ui-skin] .app.hidden { display:none; }
  html.mobile-screen[data-ui-skin] .main { grid-column:1;grid-row:1;grid-template-rows:52px minmax(0,1fr);padding:0;min-height:0;height:100%; }
  html.mobile-screen[data-ui-skin] .side {
    position:relative;inset:auto;grid-column:1;grid-row:2;width:100%;height:auto;min-height:0;
    padding:4px 6px max(4px,var(--mobile-safe-bottom));border:0;border-top:1px solid var(--line);border-radius:0;box-shadow:none;background:var(--page);z-index:50;
  }
  html.mobile-screen[data-ui-skin] .side-head { display:none!important; }
  html.mobile-screen[data-ui-skin] .nav { display:grid;grid-template-columns:repeat(5,minmax(0,1fr));grid-auto-flow:row;gap:2px;height:auto;overflow:visible; }
  html.mobile-screen[data-ui-skin] .nav button { width:100%;height:54px;min-width:0;min-height:44px;grid-template-rows:24px 16px;gap:2px;padding:4px 0; }
  html.mobile-screen[data-ui-skin] .nav button:not([data-nav=agent]):not([data-nav=img]):not([data-nav=infinite]):not([data-nav=assets]):not([data-mobile-menu]) { display:none; }
  html.mobile-screen[data-ui-skin] .nav b { display:block;font-size:11px;font-weight:500;line-height:16px;max-width:100%; }
  html.mobile-screen[data-ui-skin] .nav-icon { width:24px;height:24px; }
  html.mobile-screen[data-ui-skin] .app-legal-footer { display:none; }
  html.mobile-screen[data-ui-skin] .topbar { min-height:52px;gap:6px;padding:0 10px;overflow:hidden;backdrop-filter:none; }
  html.mobile-screen[data-ui-skin] .topbar .title { display:block;flex:1;min-width:0; }
  html.mobile-screen[data-ui-skin] .topbar h2 { font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
  html.mobile-screen[data-ui-skin] .topbar .status { width:auto;margin:0;gap:4px;flex:0 1 auto;min-width:0; }
  html.mobile-screen[data-ui-skin] .topbar .status>#feedbackTrigger,
  html.mobile-screen[data-ui-skin] .topbar .status>#themeToggleBtn,
  html.mobile-screen[data-ui-skin] .topbar .status>#licenseLogoutBtn,
  html.mobile-screen[data-ui-skin] .topbar .status>#welcomeAgain { display:none!important; }
  html.mobile-screen[data-ui-skin] #licenseStatusPill { flex:0 1 auto;max-width:95px;font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0 4px; }
  html.mobile-screen[data-ui-skin] .announcement-trigger { width:44px;min-width:44px;height:44px; }
  html.mobile-screen[data-ui-skin] .mobile-projects-button { align-items:center;justify-content:center;min-width:44px;padding:0 8px;color:var(--muted);border:0;background:transparent;font-size:13px; }
  html.mobile-screen[data-ui-skin] .panel { min-height:0;min-width:0;overflow:hidden;height:100%; }
  html.mobile-screen[data-ui-skin] .view { height:100%;min-height:0;min-width:0;padding:12px;overflow:auto!important;overscroll-behavior:contain;scroll-padding-bottom:16px; }
  html.mobile-screen[data-ui-skin] .view[data-view=agent] { padding:0;overflow:hidden!important; }
  html.mobile-screen[data-ui-skin] .agent-layout { height:100%;min-height:0;display:grid;grid-template-columns:minmax(0,1fr);gap:0; }
  html.mobile-screen[data-ui-skin] .agent-layout>.agent-side { display:none; }
  html.mobile-screen[data-ui-skin] .chat { min-height:0;height:100%;display:flex;flex-direction:column;overflow:hidden; }
  html.mobile-screen[data-ui-skin] .chat-feed { flex:1 1 0;min-height:0;overflow:auto;padding:12px 10px;overscroll-behavior:contain; }
  html.mobile-screen[data-ui-skin] .bubble { gap:7px;max-width:100%; }
  html.mobile-screen[data-ui-skin] .agent-message-shell { min-width:0;max-width:100%;padding:12px; }
  html.mobile-screen[data-ui-skin] .agent-message-body { font-size:14px;overflow-wrap:anywhere; }
  html.mobile-screen[data-ui-skin] .agent-message-body pre { max-width:100%; }
  html.mobile-screen[data-ui-skin] .composer { flex:0 0 auto;margin:4px 8px 8px;min-height:0;max-height:55%;overflow:visible;border-radius:12px;box-shadow:none!important; }
  html.mobile-screen[data-ui-skin] .composer textarea { height:66px;min-height:56px;max-height:100px;resize:none;padding:10px 12px; }
  html.mobile-screen[data-ui-skin] .composer-top { min-height:0;padding:0 8px; }
  html.mobile-screen[data-ui-skin] .ref-strip { max-height:70px;overflow:auto; }
  html.mobile-screen[data-ui-skin] .agent-tool-row { display:flex;flex-wrap:wrap;gap:4px;padding:4px 6px 6px;min-width:0; }
  html.mobile-screen[data-ui-skin] .agent-setting-strip { display:flex;flex:1 0 100%;min-width:0;gap:5px;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none; }
  html.mobile-screen[data-ui-skin] .agent-setting-strip .agent-tool { min-width:0;flex:0 0 auto;max-width:210px; }
  html.mobile-screen[data-ui-skin] .agent-setting-strip .agent-tool>span { display:none; }
  html.mobile-screen[data-ui-skin] .agent-choice-trigger { min-height:44px;font-size:12px;max-width:205px; }
  html.mobile-screen[data-ui-skin] .agent-output-summary { min-width:max-content;font-size:12px; }
  html.mobile-screen[data-ui-skin] .agent-action-strip { display:flex;width:100%;align-items:center;gap:6px; }
  html.mobile-screen[data-ui-skin] .agent-media-trigger { width:44px;height:44px; }
  html.mobile-screen[data-ui-skin] .agent-send { margin-left:auto;min-width:112px;min-height:44px;font-size:14px; }
  html.mobile-screen[data-ui-skin] .agent-tool-action { font-size:12px; }
  html.mobile-screen[data-ui-skin] .agent-advanced-panel { max-height:25dvh;overflow:auto;width:100%;grid-template-columns:repeat(2,minmax(0,1fr)); }
  html.mobile-screen[data-ui-skin] .img-workspace,html.mobile-screen[data-ui-skin] .img-three-column,
  html.mobile-screen[data-ui-skin] .txt-workspace,html.mobile-screen[data-ui-skin] .video-quick-grid,
  html.mobile-screen[data-ui-skin] .video-remake-grid,html.mobile-screen[data-ui-skin] .service-grid,
  html.mobile-screen[data-ui-skin] .editor-layout,html.mobile-screen[data-ui-skin] .three-col { height:auto;min-height:0;display:grid;grid-template-columns:minmax(0,1fr);gap:12px; }
  html.mobile-screen[data-ui-skin] .card { min-width:0;min-height:0; }
  html.mobile-screen[data-ui-skin] .card-title { min-height:48px;flex-wrap:wrap;gap:4px;padding:8px 12px; }
  html.mobile-screen[data-ui-skin] .card-body { max-height:none;min-height:0;padding:12px; }
  html.mobile-screen[data-ui-skin] .control-grid,html.mobile-screen[data-ui-skin] .img-control-grid { grid-template-columns:repeat(2,minmax(0,1fr));gap:12px; }
  html.mobile-screen[data-ui-skin] .field { min-width:0; }
  html.mobile-screen[data-ui-skin] .field label { font-size:13px; }
  html.mobile-screen[data-ui-skin] .field textarea { min-height:110px;max-height:260px; }
  html.mobile-screen[data-ui-skin] .quick-row { display:flex;flex-wrap:wrap; }
  html.mobile-screen[data-ui-skin] .img-material-panel .card-title .quick-row { flex:1;justify-content:flex-end;gap:0; }
  html.mobile-screen[data-ui-skin] .card-title .quick-row>.btn { flex:0 0 auto;padding-inline:8px; }
  html.mobile-screen[data-ui-skin] .slot-grid:not(.mobile-slots-expanded) .slot:nth-child(n+3) { display:none; }
  html.mobile-screen[data-ui-skin] .mobile-slots-toggle { display:flex;width:100%;align-items:center;justify-content:center;color:var(--muted);background:transparent;border:0;margin-top:6px;font-size:13px; }
  html.mobile-screen[data-ui-skin] .btn { min-height:44px;font-size:13px; }
  html.mobile-screen[data-ui-skin] .action-chip { min-height:44px;font-size:12px; }
  html.mobile-screen[data-ui-skin] .slot-grid { grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:auto; }
  html.mobile-screen[data-ui-skin] .slot .drop { min-height:112px; }
  html.mobile-screen[data-ui-skin] .img-prompt-field textarea { height:180px!important;min-height:110px!important; }
  html.mobile-screen[data-ui-skin] .result-grid.auto-layout { grid-template-columns:repeat(2,minmax(0,1fr)); }
  html.mobile-screen[data-ui-skin] .result { min-width:0; }
  html.mobile-screen[data-ui-skin] .result .actions { flex-wrap:wrap; }
  html.mobile-screen[data-ui-skin] .head { height:auto;min-height:44px;flex-wrap:wrap; }
  html.mobile-screen[data-ui-skin] .workflow-shell { height:auto;grid-template-columns:minmax(0,1fr);gap:10px; }
  html.mobile-screen[data-ui-skin] .workflow-canvas { min-height:0;height:auto;overflow:visible;touch-action:pan-y;background:transparent; }
  html.mobile-screen[data-ui-skin] .workflow-stage,html.mobile-screen[data-ui-skin] .zoom-layer { position:relative;inset:auto;width:100%!important;height:auto!important;transform:none!important; }
  html.mobile-screen[data-ui-skin] #nodes { display:grid;gap:12px; }
  html.mobile-screen[data-ui-skin] #nodes>.node { position:relative;inset:auto!important;width:100%!important;height:auto!important;min-width:0!important;min-height:0!important; }
  html.mobile-screen[data-ui-skin] .node .node-body { height:auto!important;max-height:none;overflow:visible; }
  html.mobile-screen[data-ui-skin] .node .node-head { touch-action:pan-y; }
  html.mobile-screen[data-ui-skin] .node.mobile-node-collapsed .node-body { display:none; }
  html.mobile-screen[data-ui-skin] .mobile-node-toggle { margin-left:auto;flex:none;padding:4px 8px;background:transparent;border:0;color:var(--muted);font-size:12px; }
  html.mobile-screen[data-ui-skin] .node-delete { margin-left:0;min-width:44px; }
  html.mobile-screen[data-ui-skin] .workflow-canvas .lines,html.mobile-screen[data-ui-skin] .node-resize-handle,
  html.mobile-screen[data-ui-skin] .workflow-zoom-controls,html.mobile-screen[data-ui-skin] .workflow-zoom-status { display:none; }
  html.mobile-screen[data-ui-skin] .workflow-shell>aside .card-body { display:flex!important;flex-wrap:wrap;align-items:center; }
  html.mobile-screen[data-ui-skin] .workflow-tool-group { display:flex;flex-wrap:wrap;gap:6px; }
  html.mobile-screen[data-ui-skin] .editor-stage { min-height:320px;height:50dvh;overflow:auto; }
  html.mobile-screen[data-ui-skin] .nas-toolbar { flex-wrap:wrap; }
  html.mobile-screen[data-ui-skin] .nas-search-wrap { min-width:0;flex:1 0 100%; }
  html.mobile-screen[data-ui-skin] .popover { padding:0;align-items:end;top:var(--mobile-top);height:var(--mobile-height);bottom:auto; }
  html.mobile-screen[data-ui-skin] .popover-card,html.mobile-screen[data-ui-skin] .legal-popover .popover-card {
    width:100%;max-width:100%;max-height:calc(var(--mobile-height) - 12px);min-height:0;
    border-radius:16px 16px 0 0;display:flex;flex-direction:column;margin:0;padding-bottom:var(--mobile-safe-bottom);
  }
  html.mobile-screen[data-ui-skin] .popover-head { flex:0 0 auto;padding:16px 56px 12px 16px; }
  html.mobile-screen[data-ui-skin] .popover-body { overflow:auto;min-height:0;padding:16px;overscroll-behavior:contain; }
  html.mobile-screen[data-ui-skin] .pop-close { width:44px;height:44px;top:6px;right:6px; }
  html.mobile-screen[data-ui-skin] .agent-choice-popover:not([hidden]),
  html.mobile-screen[data-ui-skin] .agent-output-popover:popover-open,
  html.mobile-screen[data-ui-skin] #agentMentionMenu:popover-open {
    position:fixed!important;inset:auto 8px calc(var(--mobile-bottom,0px) + 8px)!important;
    margin:0!important;width:calc(100% - 16px)!important;max-width:none!important;
    max-height:min(60dvh,calc(var(--mobile-height) - 24px))!important;overflow:auto;
    padding:12px!important;background:var(--surface,#171b1f);border:1px solid var(--line);border-radius:14px;
  }
  html.mobile-screen .mobile-popover-done { display:flex;justify-content:center;align-items:center;width:100%;margin-top:8px;background:var(--surface-strong,#22272c);border:0;border-radius:8px;color:var(--ink); }
  html.mobile-screen[data-ui-skin] .agent-choice-menu button,
  html.mobile-screen[data-ui-skin] .agent-output-popover button,
  html.mobile-screen[data-ui-skin] #agentMentionMenu button { min-height:44px; }
  html.mobile-screen[data-ui-skin] .agent-media-menu { bottom:50px;max-height:40dvh;overflow:auto; }
  html.mobile-screen[data-ui-skin] .announcement-drawer,html.mobile-screen[data-ui-skin] .feedback-panel {
    position:fixed;inset:auto 8px calc(var(--mobile-bottom,0px) + 8px);width:calc(100% - 16px);max-height:calc(var(--mobile-height) - 24px);padding:16px;overflow:auto;
  }
  html.mobile-screen .mobile-sheet[open] { display:flex;flex-direction:column;position:fixed;inset:auto 0 calc(var(--mobile-bottom,0px));margin:0;width:100%;max-width:100%;max-height:calc(var(--mobile-height) - 12px);border-radius:16px 16px 0 0;padding-bottom:var(--mobile-safe-bottom); }
  html.mobile-screen .mobile-sheet-body { min-height:0; }
  html.mobile-screen .mobile-sheet .agent-side { display:grid;grid-template-columns:minmax(0,1fr);gap:12px; }
  html.mobile-screen .mobile-sheet .directory-list { max-height:35dvh;overflow:auto; }
  html.mobile-screen .mobile-sheet .asset-list { max-height:25dvh;overflow:auto; }
  html.mobile-screen.keyboard-open .side { display:none!important; }
  html.mobile-screen.keyboard-open .app { grid-template-rows:minmax(0,1fr); }
  html.mobile-screen.keyboard-open .composer textarea { height:52px;min-height:44px; }
  html.mobile-screen.keyboard-open .chat-feed { padding-block:4px; }
  html.mobile-screen.keyboard-open .agent-setting-strip { display:none; }
  html.mobile-screen .auth-overlay { top:var(--mobile-top);height:var(--mobile-height);padding:12px;overflow:auto; }
  html.mobile-screen .auth-card { width:100%;max-height:none;grid-template-columns:minmax(0,1fr); }
  html.mobile-screen .auth-visual { display:none; }
  html.mobile-screen .auth-content { padding:22px 18px; }
  /* Infinite canvas is also served independently and inside the workbench. */
  html.mobile-screen #root { position:fixed;top:var(--mobile-top);height:var(--mobile-height);width:100%;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px); }
  html.mobile-screen .view[data-view=infinite] { padding:0;overflow:hidden!important; }
  html.mobile-screen .canvas-app { grid-template-rows:52px minmax(0,1fr); }
  /* Embedded canvas has no top bar. Its stage must use the full iframe height. */
  html.mobile-screen.embedded-canvas #root { position:absolute;inset:0;height:100%;padding:0; }
  /* The workbench already owns the home-indicator inset. Do not apply it again in its iframe. */
  html.mobile-screen.embedded-canvas { --mobile-safe-bottom:0px; }
  html.mobile-screen .canvas-app.is-embedded { grid-template-rows:minmax(0,1fr); }
  html.mobile-screen .canvas-app.is-embedded .canvas-tools { top:auto; }
  html.mobile-screen .canvas-topbar { padding:4px 8px;gap:4px;min-width:0; }
  html.mobile-screen .canvas-title-wrap { min-width:0; }
  html.mobile-screen .topbar-back,html.mobile-screen .topbar-actions>button { width:44px;height:44px;min-width:44px; }
  html.mobile-screen .topbar-actions>button:nth-child(-n+2) { display:grid; }
  html.mobile-screen .canvas-tools { position:fixed;left:6px;right:6px;bottom:calc(var(--mobile-safe-bottom,env(safe-area-inset-bottom,0px)) + 6px);top:auto;width:auto;display:flex;max-width:calc(100% - 12px);overflow-x:auto;justify-content:flex-start;gap:3px; }
  html.mobile-screen .canvas-tools>span { display:none; }
  html.mobile-screen .editing-layers .canvas-tools { display:none; }
  html.mobile-screen .canvas-tools button { width:44px;height:44px;flex:0 0 44px; }
  html.mobile-screen .canvas-tools button:nth-of-type(7),html.mobile-screen .canvas-tools button:nth-of-type(8) { display:grid; }
  html.mobile-screen .canvas-tools button span { display:none; }
  html.mobile-screen .zoom-toolbar { margin-bottom:calc(66px + var(--mobile-safe-bottom))!important; }
  html.mobile-screen .zoom-toolbar button { height:44px;min-width:44px; }
  html.mobile-screen .zoom-toolbar .fit-button { display:inline-grid; }
  html.mobile-screen .selection-toolbar { width:max-content;max-width:calc(100% - 16px);box-sizing:border-box;overflow:hidden;gap:4px; }
  html.mobile-screen .selection-actions-scroll { flex:1 1 auto;overflow-x:auto;overscroll-behavior-x:contain;touch-action:pan-x;scrollbar-width:none; }
  html.mobile-screen .selection-actions-scroll::-webkit-scrollbar { display:none; }
  html.mobile-screen .selection-actions-scroll>span { flex:0 0 1px; }
  html.mobile-screen .selection-toolbar button { flex:0 0 auto;width:auto;min-width:44px;height:44px;font-size:12px;padding:0 10px;white-space:nowrap;word-break:keep-all;line-height:1; }
  html.mobile-screen .selection-toolbar button svg { flex:none; }
  html.mobile-screen .selection-toolbar .selection-delete { flex:0 0 auto;min-width:68px;border-left:1px solid rgba(255,255,255,.18);border-radius:0 7px 7px 0;color:#ffb5bb;background:rgba(255,100,110,.08); }
  html.mobile-screen .zoom-toolbar .mobile-canvas-undo { display:inline-flex;align-items:center;justify-content:center; }
  html.mobile-screen .canvas-chat { position:absolute;inset:8px;max-height:100%;min-height:0; }
  html.mobile-screen .project-drawer,html.mobile-screen .canvas-assets-drawer,html.mobile-screen .layers-popover { left:8px;right:8px;top:8px;width:auto;max-height:calc(100% - 16px); }
  html.mobile-screen .chat-toggle { right:12px;bottom:calc(68px + var(--mobile-safe-bottom));min-width:44px; }
  html.mobile-screen .canvas-chat .chat-messages { min-height:0;overscroll-behavior:contain; }
  html.mobile-screen .composer-footer { flex-wrap:wrap; }
  html.mobile-screen .generation-pills { flex-wrap:wrap;min-width:0; }
  html.mobile-screen .editing-layers .canvas-stage { display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(100px,1fr) minmax(0,48%); }
  html.mobile-screen .editing-layers #layer-inspector-host { grid-row:2;grid-column:1; }
  html.mobile-screen .editing-layers .flow-surface { height:100%;padding-left:0; }
  html.mobile-screen .editing-layers .zoom-toolbar { margin:0 0 6px 6px!important; }
  html.mobile-screen .layer-inspector { border-left:0;border-top:1px solid var(--line,#ffffff18); }
  html.mobile-screen .layer-inspector>header { padding:3px 10px; }
  html.mobile-screen .layer-inspector>header button { min-width:44px;min-height:44px;flex-shrink:0; }
  html.mobile-screen .layer-panel-tabs { padding:0 8px 4px; }
  html.mobile-screen .layer-inspector-body { padding:8px 12px; }
  html.mobile-screen .layer-inspector footer { padding:4px 8px; }
  html.mobile-screen .layer-inspector footer { display:flex;flex-wrap:wrap;align-items:center;gap:4px;position:relative; }
  html.mobile-screen .layer-inspector footer .layer-row-actions { flex:0 0 100%;margin:0;padding:0; }
  html.mobile-screen .layer-row-actions button { min-width:44px; }
  html.mobile-screen .layer-footer-actions button { white-space:nowrap; }
  html.mobile-screen .layer-inspector footer .layer-footer-actions { flex:1;min-width:0; }
  html.mobile-screen .layer-inspector footer .layer-shortcuts { display:block;flex:0 0 44px;margin:0; }
  html.mobile-screen .layer-shortcuts summary { min-height:44px;display:flex;align-items:center;justify-content:center; }
  html.mobile-screen .layer-shortcuts p { display:none; }
  html.mobile-screen .layer-shortcuts[open]>button { position:absolute;right:8px;bottom:52px;width:190px;min-height:48px;background:var(--surface-strong,#22272c);border:1px solid var(--line,#ffffff18);border-radius:10px;box-shadow:0 8px 30px #0008; }
  html.mobile-screen .layer-tree-row button { min-height:44px;min-width:44px; }
  html.mobile-screen .layer-tree-row .layer-fold { min-width:44px; }
  html.mobile-screen .layer-tree-row .layer-select { min-width:0; }
  html.mobile-screen .layer-field-row { gap:8px; }
  html.mobile-screen .image-studio-shell { height:var(--mobile-height);max-height:100%;min-height:0; }
  html.mobile-screen .image-studio-backdrop { top:var(--mobile-top);height:var(--mobile-height);bottom:auto;padding:0; }
  html.mobile-screen .image-studio-shell>header { padding:6px 10px; }
  html.mobile-screen .mask-controls { max-height:42dvh;overflow:auto;flex-direction:row;flex-wrap:wrap;gap:8px; }
  html.mobile-screen .mask-instruction { min-width:0;flex-basis:100%; }
  html.mobile-screen .mask-controls>div { display:flex;flex-wrap:wrap;gap:4px; }
  html.mobile-screen .mask-guide { min-height:44px; }
  html.mobile-screen .layer-tools-popover { max-height:calc(var(--mobile-height) - 20px); }
  /* Standalone image/video editors reuse the same touch and viewport contract. */
  html.mobile-screen body:has(>.shell) { padding:8px;overflow:auto; }
  html.mobile-screen body>.shell { height:auto;min-height:0;grid-template-columns:minmax(0,1fr);gap:10px; }
  html.mobile-screen .shell .canvas { min-height:320px; }
  html.mobile-screen .shell .canvas-wrap { min-height:400px;padding:8px; }
  html.mobile-screen .shell .toolbar { flex-wrap:wrap; }
}
@media (max-height:500px) and (max-width:960px) {
  html.mobile-screen .editing-layers .canvas-stage { grid-template-columns:minmax(0,1fr) 300px;grid-template-rows:minmax(0,1fr); }
  html.mobile-screen .editing-layers #layer-inspector-host { grid-column:2;grid-row:1; }
  html.mobile-screen[data-ui-skin] .composer textarea { height:48px;min-height:44px; }
  html.mobile-screen[data-ui-skin] .agent-setting-strip { display:none; }
  html.mobile-screen[data-ui-skin] .nav button { height:44px;grid-template-rows:20px 12px; }
}
