/* Shared small-screen controls without changing document language direction. */
html { -webkit-text-size-adjust:100%; }
img { max-width:100%; }
.mobile-editor-nav { display:none; }
@media(max-width:700px) {
    html[data-theme] :is(input,textarea,select) { font-size:16px;max-width:100%; }
    html[data-theme] :is(button,.ui-primary,.ui-secondary,.account-button,.contact-email-button) { min-height:44px; }
    html[data-theme] :is(.topbar,.navbar,.policy-topbar) { gap:10px;padding:12px 16px;justify-content:space-between; }
    .policy-topbar nav { display:flex;flex-wrap:wrap;gap:10px; }
    .policy-main { width:100%;padding:24px 16px;overflow-wrap:anywhere; }
    .policy-table-wrap { max-width:100%;overflow-x:auto; }
    .auth-layout { padding:24px 16px;max-width:100%; }
    .auth-card { min-width:0;padding:22px 18px; }
    .verification-actions,.billing-actions,.profile-actions { flex-wrap:wrap;gap:12px; }
    .plans-grid,.billing-plans,.credit-packages,.projects-grid { grid-template-columns:minmax(0,1fr); }
    .project-list { grid-template-columns:minmax(0,1fr); }
    .container { padding:28px 16px; }
    .top-actions,.top-right,.nav-buttons { flex-wrap:wrap;max-width:100%; }
    .legal-links { display:flex;flex-wrap:wrap;gap:8px 16px; }
    .legal-links a { display:inline-flex;align-items:center;min-height:40px; }
    .account-credit-offer,.account-credit-heading { align-items:stretch;flex-direction:column;gap:12px; }
    .profile { flex-wrap:wrap;min-width:0; }
    .modal,.project-modal,.rename-modal,.delete-modal { width:min(94vw,520px);max-height:85dvh;overflow-y:auto; }
    .admin-layout { grid-template-columns:minmax(0,1fr); }
    .admin-tools { display:grid;grid-template-columns:minmax(0,1fr); }
    .support-toolbar { align-items:stretch; }
    .support-toolbar button { flex:1 1 140px; }
    .support-notifications { bottom:calc(12px + env(safe-area-inset-bottom));right:12px;width:min(350px,calc(100vw - 24px)); }
    body.mobile-editor .topbar { height:auto;min-height:100px;flex-wrap:wrap;gap:8px;padding:8px 12px; }
    body.mobile-editor .topbar .logo { font-size:18px;white-space:nowrap; }
    body.mobile-editor .top-right { margin-left:auto;gap:6px;min-width:0; }
    body.mobile-editor .topbar .toolbar { display:flex;flex-wrap:wrap;order:3;flex:1 1 100%;gap:6px;overflow:visible; }
    body.mobile-editor .topbar .toolbar .tool-btn { padding:8px 10px;font-size:12px;min-height:44px; }
    body.mobile-editor .workspace { height:calc(100dvh - var(--mobile-header-height,160px) - 62px - env(safe-area-inset-bottom));position:relative; }
    body.mobile-editor .workspace > :is(.left-panel,.right-panel) { display:none;position:absolute;inset:0 auto 0 0;width:min(88vw,360px);min-width:0;max-width:100%;z-index:80;box-shadow:0 8px 24px #0004; }
    body.mobile-editor .workspace.mobile-properties > .right-panel { display:flex;left:auto;right:0; }
    body.mobile-editor .workspace.mobile-parts > .left-panel { display:flex; }
    body.mobile-editor .workspace.ai-full-screen > .right-panel { display:flex;position:fixed;top:var(--mobile-header-height,160px);bottom:calc(62px + env(safe-area-inset-bottom));left:0;right:0;width:100%;height:auto;max-width:none; }
    body.mobile-editor .component-manager-backdrop { top:var(--mobile-header-height,160px);bottom:calc(62px + env(safe-area-inset-bottom));height:auto; }
    body.mobile-editor :is(.cm-layout,.component-manager-layout,.component-manager-workspace) { grid-template-columns:minmax(0,1fr); }
    body.mobile-editor .cm-side-panel { max-height:30dvh;overflow:auto; }
    body.mobile-editor .panel-resizer { display:none; }
    body.mobile-editor #canvas { touch-action:none; }
    body.mobile-editor .canvas-toolbar { max-width:calc(100% - 16px);overflow-x:auto; }
    body.mobile-editor .canvas-tool { min-width:44px;min-height:44px; }
    body.mobile-editor .workspace-tool-strip { max-width:100%;overflow-x:auto; }
    body.mobile-editor .workspace-tool-strip .tool-group { flex-shrink:0; }
    body.mobile-editor .statusbar { bottom:calc(62px + env(safe-area-inset-bottom));font-size:10px; }
    .mobile-editor-nav { display:flex;position:fixed;bottom:0;left:0;right:0;gap:6px;padding:8px 10px calc(8px + env(safe-area-inset-bottom));background:var(--ui-panel,#fff);border-top:1px solid var(--ui-border,#ccc);z-index:300; }
    .mobile-editor-nav button { flex:1;min-width:0;min-height:44px;border:1px solid var(--ui-border,#ccc);border-radius:7px;background:var(--ui-card,#fff);color:var(--ui-text,#222);font-size:12px;cursor:pointer; }
    body[data-daily-circuit] .mobile-editor-nav :is([data-panel="parts"], [data-panel="properties"], [data-panel="save"]) { display:none; }
    body.shared-project-preview .mobile-editor-nav :is([data-panel="save"], [data-panel="parts"]) { display:none; }
    .mobile-editor-nav button[aria-pressed="true"] { border-color:var(--ui-accent);background:var(--ui-hover); }
    body.mobile-editor .support-notifications { bottom:calc(74px + env(safe-area-inset-bottom)); }
    .mobile-menu-open > :is(.file-menu-dropdown,.settings-dropdown,.account-dropdown) { display:block!important;max-width:calc(100vw - 24px);max-height:65dvh;overflow-y:auto; }
}
