/* Preview-only LithoBulb workspace organization.
   Existing geometry, editor selection, STL and account modules are unchanged. */
#app .lb-workspace-layers{
  display:flex!important;flex-direction:column;gap:0;min-height:0;
  overflow:visible!important;padding:12px 10px 8px;background:#101e2d
}
#app .lb-layout.left-collapsed .lb-workspace-layers{display:none!important}
#app .lb-asset-toolbar{
  position:relative;display:grid;grid-template-columns:minmax(0,1fr);
  gap:7px;padding-bottom:14px;
}
#app .lb-asset-toolbar>button{
  width:100%;border:1px solid #32c6df;border-radius:10px;min-height:43px;
  display:inline-flex;justify-content:center;align-items:center;gap:8px;
  padding:8px 10px;color:#dffbff;font-size:12px;font-weight:750;
  white-space:nowrap;background:linear-gradient(145deg,#116879,#0b425c);
  box-shadow:0 3px 12px #0003;
  transition:border-color .15s,background .15s,transform .15s;
}
#app .lb-asset-toolbar>button:hover{border-color:#61e6f4;transform:translateY(-1px)}
#app .lb-asset-toolbar>button:focus-visible{outline:2px solid #61e6f4;outline-offset:2px}
#app .lb-layer-section-head{display:flex;align-items:center;justify-content:space-between;gap:7px;margin:2px 0 8px;padding:9px 4px 11px;border-bottom:1px solid #30495e}
#app .lb-layer-section-head strong{font-size:13px;color:#eaf8ff;letter-spacing:.01em}
#app #lb-layer-count{font-size:10px;color:#abc5d4;font-variant-numeric:tabular-nums}
#app .lb-workspace-layers .lb-layer-host{flex:1;min-height:0;overflow-y:auto!important;overflow-x:hidden!important;scrollbar-width:thin;scrollbar-color:#3a6174 transparent;margin:0 -3px;padding:2px 3px}
#app .lb-workspace-layers #layer-panel{min-height:100px!important}
#app .lb-layer-footer{flex-shrink:0;font-size:10px;color:#7798ae;border-top:1px solid #2a4558;margin:8px -3px 0;padding:9px 3px 2px;line-height:1.4}
#app .lb-toolbar-host{height:81px!important;min-height:81px!important;border-bottom:1px solid #304b60}
#app .lb-toolbar-host .toolbar{
  height:81px!important;min-height:81px!important;padding:8px 13px!important;
  align-items:center!important;gap:12px!important;overflow-x:auto!important
}
#app .lb-tool-strip-label{color:#80a5bb;font-size:9px;letter-spacing:.12em;font-weight:850;flex:0 0 auto}
/* Compact artwork history is shared by toolbar clicks and canvas right-click.
   Avoid a second tool strip or changing the established desktop layout. */
#app .lb-history-controls{
  display:flex;align-items:center;gap:5px;flex:0 0 auto;padding:0 9px 0 0;
  border-right:1px solid #345169;
}
#app .lb-history-controls button{
  display:inline-flex;flex-direction:column;align-items:center;justify-content:center;
  gap:1px;min-width:56px;height:53px;padding:4px 8px;border:1px solid #41657c;
  border-radius:9px;background:linear-gradient(155deg,#1b3649,#122639);
  box-shadow:0 2px 7px #0003;color:#d4edf8;font-size:11px;font-weight:750;line-height:1.2;font-family:inherit;
}
#app .lb-history-controls button>span:first-child{font-size:22px;line-height:1}
#app .lb-history-controls button:hover:not(:disabled){
  border-color:#54ddec;background:#214a60;color:white;
}
#app .lb-history-controls button:focus-visible{outline:2px solid #62e6ed;outline-offset:2px}
#app .lb-history-controls button:disabled{opacity:.36;cursor:default;box-shadow:none}
#app .lb-toolbar-host .tool-group{display:flex!important;gap:7px!important;flex-shrink:0}
#app .lb-toolbar-host .tool-group>.tool-btn{
  position:relative;display:flex!important;flex-direction:column;align-items:center;justify-content:center;
  gap:3px;min-width:65px!important;width:65px;height:62px!important;padding:6px 4px 7px!important;
  color:#d8e7f2!important;background:linear-gradient(155deg,#1c364b,#152a3e)!important;
  border:1px solid #47677f!important;border-radius:11px!important;box-shadow:0 2px 8px #0005
}
#app .lb-toolbar-host .tool-group>.tool-btn:hover{border-color:#57dfee!important;background:#234a60!important}
#app .lb-toolbar-host .tool-group>.tool-btn.active{
  color:#f2fdff!important;border-color:#39d6e8!important;background:linear-gradient(145deg,#145f75,#104354)!important;
  box-shadow:inset 0 0 0 1px #77e8f033,0 0 0 2px #32d7eb28!important
}
#app .lb-toolbar-host .tool-group>.tool-btn svg{width:23px!important;height:23px!important;flex:none;stroke-width:2.3}
#app .lb-toolbar-host .tool-group .lb-tool-name{font-size:11px;line-height:1.1;font-weight:750;letter-spacing:.01em}
#app .lb-toolbar-host .tool-group .lb-tool-shortcut{position:absolute;right:4px;top:3px;color:#8faebe;font-size:8px}
#app .lb-toolbar-host .tool-group>.tool-btn.active .lb-tool-shortcut{color:#d3f7ff}
#app .lb-toolbar-host .alignment-group{flex:0 0 auto}
#app .lb-toolbar-host .rotation-note{display:none!important}
#app .lb-shape-picker{border-color:#34607a;background:#102334}
#app .lb-shape-picker>summary{color:#8de4f0}
#app .lb-shape-catalog{padding:4px 0 0;display:flex;flex-direction:column}
#app .lb-shape-catalog .lb-pane-copy{padding:2px 3px 12px;font-size:11px}
#app .lb-shape-catalog .lb-profile-manager{margin:0 0 12px}
#app .lb-shape-catalog .design-meta{display:grid;grid-template-columns:1fr 1fr;gap:5px;margin-top:10px}
#app .lb-shape-catalog .design-meta span{font-size:10px}
#app .lb-right-inner>#lb-selected-properties{border-color:#34576b}
#app #lb-preset-details{background:linear-gradient(150deg,#102438,#0d1d2c);border-color:#386077}
#app .lb-layout-preview-tag{flex:0 0 auto;padding:5px 8px;border:1px solid #315b70;border-radius:6px;background:#142c3d;color:#87e6f3;font-weight:850;letter-spacing:.08em;font-size:9px}
/* Gallery is a centered browser dialog; never inserts a fifth tab into the layer stack. */
#app .lb-gallery-modal{position:fixed;inset:0;z-index:12000;display:grid;place-items:center;padding:24px;background:rgba(3,10,19,.78);backdrop-filter:blur(7px)}
#app .lb-gallery-modal[hidden]{display:none!important}
#app .lb-gallery-dialog{
  display:flex;flex-direction:column;width:min(1040px,100%);max-height:min(90dvh,900px);min-height:0;
  overflow:hidden;border:1px solid #456c83;border-radius:17px;
  background:linear-gradient(155deg,#162b3e,#0b1929 60%);
  box-shadow:0 32px 100px #000c
}
#app .lb-gallery-modal-head{
  flex:0 0 auto;display:flex;align-items:center;justify-content:space-between;gap:14px;
  padding:18px 23px;border-bottom:1px solid #335166
}
#app .lb-gallery-modal-head small{color:#65dcef;font-weight:850;font-size:10px;letter-spacing:.13em}
#app .lb-gallery-modal-head h2{margin:3px 0 2px;color:#f0fcff;font-size:22px;line-height:1.2}
#app .lb-gallery-modal-head p{margin:0;color:#a7c3d5;font-size:12px}
#app #lb-gallery-close{align-self:start;flex:0 0 41px;height:41px;border:1px solid #4c7389;border-radius:10px;background:#213b4f;color:#d5ecf8;font-size:21px}
#app #lb-gallery-close:hover{background:#2c566e;border-color:#66deed}
#app .lb-gallery-page{
  overflow-y:auto;overflow-x:hidden;min-height:0;flex:1;padding:18px 23px 24px;
  scrollbar-color:#3f647a transparent;scrollbar-width:thin
}
#app .lb-gallery-page .lb-gallery-intro{margin-bottom:12px}
#app .lb-gallery-page .lb-gallery-intro strong{display:none}
#app .lb-gallery-page .lb-gallery-intro small{margin:0}
#app .lb-gallery-page #lb-gallery-category{width:100%;max-width:400px;min-height:38px;padding:6px 9px;border-radius:8px;border:1px solid #3d667d;background:#122b3b;color:#e9faff}
#app .lb-gallery-page .lb-gallery-grid{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:12px!important}
#app .lb-gallery-page .lb-gallery-group-title{grid-column:1/-1;margin:12px 0 0}
#app .lb-gallery-page .lb-gallery-item{min-width:0;align-self:stretch;display:flex;flex-direction:column}
#app .lb-gallery-page .lb-gallery-item>.lb-gallery-card{height:100%;grid-template-columns:95px minmax(0,1fr)!important;min-height:100px!important}
#app .lb-gallery-page .lb-gallery-item .lb-gallery-preview{width:95px;height:86px}
#app .lb-gallery-page .lb-gallery-item .lb-gallery-copy b{font-size:12px}
#app .lb-gallery-page .lb-gallery-item .lb-gallery-add{font-size:10px}
#app .lb-gallery-page .lb-gallery-item .lb-gallery-source{font-size:9px}
@media(max-width:1180px){
  #app .lb-gallery-page .lb-gallery-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
@media(max-width:830px){
  #app .lb-layout.mobile-left-open .lb-workspace-layers{display:flex!important;padding:10px 8px 8px}
  #app .lb-layout:not(.mobile-left-open) .lb-workspace-layers{display:none!important}
  #app .lb-toolbar-host{height:76px!important;min-height:76px!important}
  #app .lb-toolbar-host .toolbar{height:76px!important;min-height:76px!important;padding:7px!important}
  #app .lb-toolbar-host .tool-group>.tool-btn{height:59px!important;min-width:58px!important;width:58px;padding:5px 3px!important}
  #app .lb-tool-strip-label{display:none}
  #app .lb-toolbar-host .tool-group>.tool-btn svg{width:21px!important;height:21px!important}
  #app .lb-gallery-modal{padding:8px}
  #app .lb-gallery-dialog{max-height:calc(100dvh - 16px);border-radius:11px}
  #app .lb-gallery-modal-head{padding:12px 14px}
  #app .lb-gallery-modal-head h2{font-size:18px}
  #app .lb-gallery-page{padding:12px}
  #app .lb-gallery-page .lb-gallery-grid{grid-template-columns:minmax(0,1fr)!important}
  #app .lb-gallery-page .lb-gallery-item>.lb-gallery-card{grid-template-columns:78px minmax(0,1fr)!important}
  #app .lb-gallery-page .lb-gallery-item .lb-gallery-preview{width:78px;height:76px}
}
@media(max-width:420px){
  #app .lb-asset-toolbar{grid-template-columns:minmax(0,1fr);gap:5px}
  #app .lb-asset-toolbar>button{padding:7px 5px;font-size:11px}
  #app .lb-toolbar-host .tool-group>.tool-btn{width:53px!important;min-width:53px!important}
  #app .lb-gallery-modal-head p{display:none}
}

#app .lb-inspector-divider{margin:15px 2px 5px;padding:7px 2px 6px;border-bottom:1px solid #2b485c;font-size:9px;letter-spacing:.14em;font-weight:850;color:#79abc2}
#app .lb-right-inner>.lb-inspector-divider:first-child{margin-top:3px}
#app .lb-right-inner>#lb-selected-properties{margin-top:8px}
#app .lb-right-inner>#lb-preset-details{margin-top:8px}
@media(max-width:940px){#app .lb-layout-preview-tag{display:none}}

/* 360° curated relief gallery — full-width preview art and searchable style collection. */
#app .lb-relief-gallery-intro{grid-column:1/-1;display:flex;flex-direction:column;gap:7px;
  border:1px solid #326377;border-radius:11px;padding:13px 16px;margin:6px 0 2px;
  background:linear-gradient(112deg,#10364b,#112839);color:#d8edf6}
#app .lb-relief-gallery-intro b{color:#73e2f1;font-size:12px;letter-spacing:.09em}
#app .lb-relief-gallery-intro span{font-size:11px;line-height:1.5;color:#a9ccda}
#app .lb-gallery-style-filter{display:flex;align-items:center;gap:12px;margin-top:12px;
  padding:10px 12px;border:1px solid #2f5065;background:#0d2332;border-radius:9px}
#app .lb-gallery-style-filter[hidden]{display:none!important}
#app .lb-gallery-style-filter label{font-size:10px;letter-spacing:.08em;white-space:nowrap;
  font-weight:800;color:#aad5e3}
#app .lb-gallery-style-filter select{width:min(100%,280px);min-width:0;height:36px;padding:6px 9px;
  border:1px solid #476f83;border-radius:8px;background:#112c3d;color:#eefbff;cursor:pointer}
#app .lb-gallery-page:has(#lb-gallery-style-filter:not([hidden])) .lb-gallery-grid{
  grid-template-columns:repeat(2,minmax(0,1fr))!important}
#app .lb-gallery-page .lb-gallery-item>.lb-gallery-card[data-relief]{
  display:flex!important;flex-direction:column!important;align-items:stretch!important;
  min-height:0!important;padding:11px!important;gap:8px!important;
  background:linear-gradient(145deg,#183447,#102638)!important;border:1px solid #42687c!important}
#app .lb-gallery-page .lb-gallery-item>.lb-gallery-card[data-relief]:hover{
  border-color:#64d9e6!important;background:#1d4157!important}
#app .lb-gallery-page .lb-gallery-card[data-relief] .lb-gallery-preview{
  display:block!important;width:100%!important;height:auto!important;aspect-ratio:4/1!important;
  grid-column:auto!important;grid-row:auto!important;overflow:hidden;border-radius:7px!important;background:#e2e5e6}
#app .lb-gallery-page .lb-gallery-card[data-relief] .lb-gallery-preview img{
  display:block!important;width:100%!important;height:100%!important;max-width:none!important;
  max-height:none!important;object-fit:fill!important;aspect-ratio:4/1!important}
#app .lb-gallery-page .lb-gallery-card[data-relief] .lb-gallery-copy{
  display:flex!important;flex-direction:column!important;gap:3px;min-height:0;grid-column:auto!important;
  grid-row:auto!important;align-self:stretch!important}
#app .lb-gallery-page .lb-gallery-card[data-relief] .lb-gallery-copy b{font-size:13px;line-height:1.2}
#app .lb-gallery-page .lb-gallery-card[data-relief] .lb-gallery-copy small{font-size:10px;line-height:1.5}
#app .lb-gallery-page .lb-gallery-card[data-relief] .lb-gallery-add{
  align-self:start!important;grid-column:auto!important;grid-row:auto!important;
  color:#76f0f8;font-size:11px;font-weight:800}
@media(max-width:830px){
 #app .lb-gallery-page:has(#lb-gallery-style-filter:not([hidden])) .lb-gallery-grid{grid-template-columns:minmax(0,1fr)!important}
 #app .lb-gallery-style-filter{align-items:stretch;flex-direction:column;gap:6px}
 #app .lb-gallery-style-filter select{width:100%;max-width:none}
}

/* Shape-dependent fit hardware must truly disappear when not applicable. */
#app .lb-metrics[hidden],#app #lb-fit-status[hidden],#app #lb-fit-coupon[hidden]{display:none!important}


/* Mobile workspace: keep the established 42px rails and sliding inspectors.
   A separate scrollable tool row prevents Open/Save from pushing Select/Text/
   Crop/Rotate off-screen. Desktop styling and editor touch handling are intact. */
#app .lb-mobile-tools-strip{display:contents}
@media(max-width:610px){
  #app .lb-canvas-head{padding:0 7px;gap:5px}
  #app .lb-canvas-head>div:first-child{min-width:0;flex:1 1 auto;gap:0}
  #app .lb-canvas-head b{font-size:11px;line-height:1.2;white-space:nowrap}
  #app .lb-canvas-head #lb-design-label{display:none}
  #app .lb-canvas-head-actions{flex:0 0 auto;gap:5px}
  #app .lb-canvas-head-actions button{min-height:33px;padding:5px 7px;font-size:10px}
  #app .lb-toolbar-host{height:114px!important;min-height:114px!important}
  #app .lb-toolbar-host .toolbar{
    height:114px!important;min-height:114px!important;display:flex!important;
    flex-direction:column!important;align-items:stretch!important;
    justify-content:flex-start!important;gap:5px!important;
    padding:6px 7px!important;overflow:hidden!important;white-space:normal!important
  }
  #app .lb-near-tools-project{
    width:100%;min-width:0;min-height:34px;flex:0 0 34px;gap:6px;
    padding:0;border-right:0;justify-content:flex-start
  }
  #app .lb-near-tools-project button{
    width:auto;min-width:0;height:34px;min-height:34px;
    padding:5px 9px;font-size:11px;white-space:nowrap
  }
  #app .lb-mobile-tools-strip{
    display:flex!important;align-items:center;justify-content:flex-start;
    gap:9px;width:100%;min-width:0;flex:1 1 auto;
    overflow-x:auto!important;overflow-y:hidden!important;scrollbar-width:none;
    overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;touch-action:pan-x
  }
  #app .lb-mobile-tools-strip::-webkit-scrollbar{display:none}
  /* Keep Select/Text/Crop/Rotate initially visible, as before. History
     follows the tools in the same horizontal scroll row on small phones. */
  #app .lb-mobile-tools-strip .lb-history-controls{order:2;flex:0 0 auto;gap:5px;padding:0 0 0 8px;border-right:0;border-left:1px solid #345169}
  #app .lb-mobile-tools-strip .lb-history-controls button{
    min-width:49px;height:54px;padding:3px 5px;font-size:10px
  }
  #app .lb-mobile-tools-strip .lb-history-controls button>span:first-child{font-size:20px}
  #app .lb-mobile-tools-strip .tool-group{
    flex:0 0 auto!important;min-width:max-content;gap:6px!important;
    white-space:nowrap!important
  }
  #app .lb-mobile-tools-strip .alignment-group{flex:0 0 auto!important}
  #app .lb-toolbar-host .tool-group>.tool-btn{
    width:53px!important;min-width:53px!important;height:59px!important;
    flex:0 0 53px;padding:5px 3px!important
  }
  #app .lb-canvas-host{padding:6px!important}
  #app .lb-app-footer{padding:0 7px!important}
  #app .lb-footer-actions{gap:5px!important;min-width:0;width:100%}
  #app .lb-footer-actions button{
    min-width:0;min-height:39px;padding:7px 6px!important;
    font-size:10px!important;text-overflow:ellipsis;overflow:hidden
  }
  #app #lb-footer-generate{flex:1 1 auto}
  #app #lb-footer-open,#app #lb-footer-export{flex:0 1 auto}
}
@media(max-width:360px){
  #app .lb-near-tools-project button{font-size:10px;padding:5px 7px}
  #app .lb-toolbar-host .tool-group>.tool-btn{
    width:51px!important;min-width:51px!important;flex-basis:51px
  }
  #app .lb-app-footer{height:89px!important;min-height:89px!important;padding:5px 7px!important}
  #app .lb-footer-actions{
    display:grid!important;grid-template-columns:minmax(0,1fr) minmax(0,1fr);
    grid-template-rows:36px 36px;gap:5px!important
  }
  #app .lb-footer-actions #lb-footer-generate{grid-column:1/-1;grid-row:2}
  #app .lb-footer-actions button{width:100%;min-height:36px;height:36px;padding:5px!important}
}
/* Landscape phones have room horizontally but not vertically: one scrollable
   toolbar row restores additional canvas height without changing the rails. */
@media(max-width:830px) and (max-height:520px) and (orientation:landscape){
  #app .lb-toolbar-host{height:64px!important;min-height:64px!important}
  #app .lb-toolbar-host .toolbar{
    height:64px!important;min-height:64px!important;display:flex!important;
    flex-direction:row!important;align-items:center!important;gap:7px!important;
    padding:3px 7px!important;overflow:hidden!important
  }
  #app .lb-near-tools-project{width:auto;flex:0 0 auto;min-height:34px}
  #app .lb-near-tools-project button{padding:5px 6px;font-size:10px}
  #app .lb-mobile-tools-strip{display:flex!important;flex:1 1 auto;width:auto;min-width:0;overflow-x:auto!important}
  #app .lb-toolbar-host .tool-group>.tool-btn{height:52px!important;width:50px!important;min-width:50px!important;flex-basis:50px}
}


/* Mobile inspector and layers must NOT shrink the canvas to 50-100px when
   expanded. Preserve the existing collapsible side rails and panel controls;
   expand the original panes OVER the middle workspace instead of reflowing
   the grid. This is not a new fullscreen modal or desktop layout. */
@media(max-width:830px){
  #app .lb-layout{position:relative!important;--left-display-w:42px;--right-display-w:42px}
  #app .lb-layout.mobile-right-open{--right-display-w:42px!important;--left-display-w:42px!important}
  #app .lb-layout.mobile-left-open{--left-display-w:42px!important;--right-display-w:42px!important}
  #app .lb-layout.mobile-right-open .lb-right,
  #app .lb-layout.mobile-left-open .lb-left{
    position:absolute!important;top:0;bottom:0;z-index:15;
    min-height:0!important;height:100%!important;max-height:100%!important;
    background:#122132!important;box-shadow:0 12px 32px #020812b0!important
  }
  #app .lb-layout.mobile-right-open .lb-right{
    right:0!important;left:auto!important;
    width:min(300px,calc(100% - 42px))!important;
    border-left:1px solid #41647a!important;
  }
  #app .lb-layout.mobile-left-open .lb-left{
    left:0!important;right:auto!important;
    width:min(260px,calc(100% - 42px))!important;
    border-right:1px solid #41647a!important;
  }
  #app .lb-layout.mobile-left-open .lb-left-inner,
  #app .lb-layout.mobile-right-open .lb-right-inner{
    display:block!important;min-height:0!important;overflow-y:auto!important;
    overflow-x:hidden!important;overscroll-behavior:contain
  }
  #app .lb-layout.mobile-left-open .lb-left .lb-pane-heading,
  #app .lb-layout.mobile-right-open .lb-right .lb-pane-heading{
    writing-mode:horizontal-tb!important;height:43px!important;min-height:43px!important;
    flex:0 0 43px!important;padding:0 11px!important;gap:8px!important;
    justify-content:space-between!important;align-items:center!important
  }
  #app .lb-layout .lb-center{min-width:0!important}
}
