/* La escena y los controles comparten datos en escritorio y móvil. */
.mobile-nav,.mobile-settings,.mobile-drawer-top,.mobile-zoom,.mobile-button-label,.mobile-number-tools{display:none}
.mobile-layout{--mobile-nav-height:calc(66px + env(safe-area-inset-bottom,0px));height:100dvh;overflow:hidden;overscroll-behavior-y:none}
.mobile-layout .app-header{min-height:0;height:auto;padding:8px max(12px,env(safe-area-inset-right,0px)) 6px max(12px,env(safe-area-inset-left,0px));padding-top:max(8px,env(safe-area-inset-top,0px));gap:5px;display:flex;flex-direction:column;align-items:stretch}
.mobile-layout .brand{width:auto;gap:7px;margin:0;min-height:25px}.mobile-layout .brand-mark{font-size:21px}.mobile-layout h1{font-size:17px}.mobile-layout .brand span:not(.brand-mark){display:none}
.mobile-layout .mode-block{margin:0;min-width:0}.mobile-layout .mode-block>p{display:none}.mobile-layout .mode-switch{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none}.mobile-layout .mode-switch button{min-height:44px;flex:1;flex-shrink:0;font-size:13px;padding:7px 10px;white-space:nowrap}
.mobile-layout .workspace{display:block;grid-template:none;height:calc(100dvh - var(--mobile-header-height,90px) - var(--mobile-nav-height));min-height:0;position:relative;width:100%}
.mobile-layout .stage{height:100%;width:100%;min-height:0;border:0}.mobile-layout .stage-top{inset:12px max(14px,env(safe-area-inset-right,0px)) auto max(14px,env(safe-area-inset-left,0px));flex-direction:row}.mobile-layout .stage-top strong{font-size:19px}.mobile-layout .stage-top .eyebrow{font-size:10px}
.mobile-layout .stage-bottom{inset:auto 14px 10px;display:block;max-width:calc(100% - 82px);font-size:11px;line-height:1.4}.mobile-layout .stage-bottom #status{display:block;max-width:100%}.mobile-layout .stage-bottom>span:last-child{display:block;text-align:left;max-width:none;font-size:10px;margin-top:4px}
.mobile-layout .mobile-zoom{display:flex;flex-direction:column;gap:7px;position:absolute;right:max(12px,env(safe-area-inset-right,0px));bottom:16px}.mobile-layout .mobile-zoom button{width:44px;height:44px;padding:0;font-size:25px;background:#18242be6}
.mobile-layout .tree-panel,.mobile-layout .edit-panel,.mobile-layout .product-panel,.mobile-layout .mobile-settings{display:none;position:fixed;z-index:45;inset:auto 0 var(--mobile-nav-height);width:100%;max-height:66dvh;min-height:0;height:auto;overflow:auto;overscroll-behavior:contain;border:1px solid var(--line);border-bottom:0;border-radius:16px 16px 0 0;padding:0 0 16px;background:var(--panel);box-shadow:0 -8px 32px #0005;scroll-padding:65px 0 24px}
.mobile-layout .tree-panel.mobile-panel-open,.mobile-layout .edit-panel.mobile-panel-open,.mobile-layout .mobile-settings.mobile-panel-open{display:block}.mobile-layout .product-panel.mobile-panel-open{display:flex;flex-direction:column}
.mobile-layout .mobile-drawer-top{display:flex;position:sticky;top:0;z-index:4;background:var(--panel);align-items:center;justify-content:space-between;gap:12px;padding:8px 14px;border-bottom:1px solid var(--line);min-height:60px;flex:none}.mobile-layout .mobile-drawer-top strong{font-size:15px}.mobile-layout .mobile-drawer-top button{min-height:44px;min-width:80px;font-size:14px}
.mobile-layout .tree-panel>.panel-heading{position:static}.mobile-layout .panel-heading{padding:14px 16px}.mobile-layout .panel-heading h2{font-size:19px}.mobile-layout .panel-heading p,.mobile-layout .tree-note{font-size:13px;line-height:1.5}.mobile-layout .part-button,.mobile-layout.articulated-mode .part-button{min-height:46px;font-size:15px;padding-left:calc(12px + var(--depth,0)*12px)}.mobile-layout .part-button .branch{display:inline}.mobile-layout .part-button .count{font-size:12px}.mobile-layout .pivot-readout output{font-size:16px}.mobile-layout .pivot-readout>strong{font-size:14px}
.mobile-layout .product-heading{padding:14px 16px 4px;flex:none}.mobile-layout .product-heading h2{font-size:17px}.mobile-layout .product-heading button{min-height:44px;font-size:13px}.mobile-layout .chain{flex:none;min-height:90px;max-height:180px;margin:0 14px;padding:12px 2px;overflow:auto}.mobile-layout .factor{min-height:44px;min-width:44px;padding:8px}.mobile-layout .chain-owner{font-size:13px;min-height:35px}.mobile-layout .chain-footer{padding:10px 16px;flex:none;font-size:12px}.mobile-layout .chain-footer details{display:none}
.mobile-layout .matrix-overlay{position:static;display:grid;grid-template-columns:1fr 1fr;gap:12px;width:auto;margin:8px 16px;pointer-events:auto;flex:none}.mobile-layout.global-mode .matrix-overlay{grid-template-columns:1fr}.mobile-layout .overlay-card{padding:12px}.mobile-layout .overlay-heading{font-size:11px;letter-spacing:.5px;min-height:34px}.mobile-layout .overlay-heading>span{font-size:23px}.mobile-layout .overlay-heading .matrix-id{font-size:13px}.mobile-layout .matrix-overlay .matrix-grid{font-size:18px;max-width:none;padding:5px;gap:5px}.mobile-layout .matrix-overlay .matrix-grid>span{padding:5px 0}.mobile-layout .matrix-overlay .matrix-grid .fixed{font-size:18px}
.mobile-layout .add-row{padding:0 16px 12px}.mobile-layout .add-row select,.mobile-layout .add-row button{min-height:46px;font-size:16px}.mobile-layout .matrix-list{max-height:none;overflow:visible;padding:0 16px 14px}.mobile-layout .matrix-card{display:grid;grid-template-columns:25px minmax(0,1fr);gap:8px;padding:10px;cursor:default}.mobile-layout .matrix-card .order{font-size:12px}.mobile-layout .select-matrix{min-height:44px}.mobile-layout .select-matrix .entry-label{font-size:14px}.mobile-layout .card-tools{grid-column:1 / -1;gap:10px}.mobile-layout .card-tools button{flex:1;min-height:44px;font-size:16px;background:#1a2631;border:1px solid var(--line)}.mobile-layout .mobile-button-label{display:inline}
.mobile-layout .inspector{max-width:none;padding:16px}.mobile-layout .inspector h3{font-size:18px}.mobile-layout input,.mobile-layout select{font-size:16px}.mobile-layout input[type=number]{min-height:44px;font-size:16px}.mobile-layout .matrix-grid{max-width:480px;gap:6px;padding:8px}.mobile-layout .matrix-grid input{font-size:18px;min-height:46px}.mobile-layout .matrix-display{margin:16px 0}.mobile-layout .matrix-caption,.mobile-layout .pivot-info,.mobile-layout .pro-help,.mobile-layout .pro-info{font-size:13px;line-height:1.6}.mobile-layout .param-row{grid-template-columns:78px minmax(65px,1fr) 82px;gap:10px;margin:13px 0;font-size:14px}.mobile-layout .param-row input[type=number]{width:82px}.mobile-layout input[type=range]{min-height:44px}.mobile-layout .param-select{font-size:14px}.mobile-layout .param-select select,.mobile-layout .owner-select{font-size:16px;min-height:44px}.mobile-layout .check-row{font-size:14px;line-height:1.4;min-height:44px;margin:8px 0}.mobile-layout input[type=checkbox]{width:22px;height:22px;flex:none}.mobile-layout .entry-name{min-height:44px;font-size:16px}.mobile-layout .inspector-tools button,.mobile-layout #edit-main{min-height:44px;font-size:14px}.mobile-layout .limits-toggle{min-height:44px;font-size:12px}.mobile-layout .limit-row input{font-size:16px;min-height:44px}
.mobile-layout .mobile-number-tools:not([hidden]){display:flex;position:sticky;bottom:0;z-index:5;gap:7px;align-items:center;padding:8px 14px;background:var(--panel);border-top:1px solid var(--line)}.mobile-layout .mobile-number-tools span{font-size:12px;color:var(--gold);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mobile-layout .mobile-number-tools button{min-height:44px;min-width:48px;font-size:15px;padding:7px}.mobile-layout .mobile-number-active{outline:2px solid var(--gold);outline-offset:1px}
.mobile-layout .mobile-settings>section,.mobile-layout .mobile-help{padding:16px}.mobile-layout .mobile-settings h2{font-size:17px;margin-bottom:12px}.mobile-layout .view-tools{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));max-width:none;gap:10px;justify-content:stretch}.mobile-layout .view-tools button{min-height:44px;font-size:14px;padding:8px}.mobile-layout .header-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:10px;justify-content:stretch}.mobile-layout .header-actions button,.mobile-layout .header-actions #undo,.mobile-layout .header-actions #redo{min-height:44px;font-size:15px;padding:8px}.mobile-layout .mobile-help{font-size:13px;color:var(--muted);line-height:1.6}
.mobile-layout .mobile-nav{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;position:fixed;inset:auto 0 0;z-index:55;height:var(--mobile-nav-height);padding:7px max(12px,env(safe-area-inset-right,0px)) max(7px,env(safe-area-inset-bottom,0px)) max(12px,env(safe-area-inset-left,0px));border-top:1px solid var(--line);background:var(--panel)}.mobile-layout .mobile-nav button{min-height:48px;font-size:14px;font-weight:600}.mobile-layout .mobile-nav button[aria-expanded=true]{color:var(--gold);border-color:var(--gold);background:var(--gold-light)}
.mobile-layout .mobile-scrim:not([hidden]){display:block;position:fixed;z-index:35;inset:0 0 var(--mobile-nav-height);border:0;border-radius:0;background:#0005;width:100%;padding:0}.mobile-scrim[hidden]{display:none}.mobile-layout .reveal-articulated{bottom:calc(var(--mobile-nav-height) + 3px);right:3px;z-index:25}.mobile-layout .toast{bottom:calc(var(--mobile-nav-height) + 14px);z-index:70;font-size:13px}
@media(max-width:520px){.mobile-layout .matrix-overlay{grid-template-columns:1fr}}
@media(max-height:550px){.mobile-layout .app-header{padding-top:4px;gap:2px}.mobile-layout .brand{display:none}.mobile-layout .mode-switch button{min-height:40px}.mobile-layout .tree-panel,.mobile-layout .edit-panel,.mobile-layout .product-panel,.mobile-layout .mobile-settings{max-height:72dvh}}
