.edit-layout{position:relative;min-height:0;flex:1;display:grid;grid-template-columns:minmax(0,1fr)}
.edit-layout>.stage{min-width:0;min-height:320px;height:100%}
#viewer.editing .edit-layout{grid-template-columns:minmax(0,1fr) minmax(240px,285px);gap:12px}
#edit-tools{overflow:auto;min-height:0;max-height:70vh}
#edit-head{margin-left:auto}
#edit-handles{position:absolute;inset:0;pointer-events:none;z-index:3;overflow:hidden}
#edit-tools[hidden],#edit-head[hidden],#edit-handles[hidden],#edit-handles .tuner-dot[hidden]{display:none}
#viewer:not(.editing) #edit-handles{display:none}
@media(max-width:850px){#viewer.editing .edit-layout{display:flex;flex-direction:column}#viewer.editing .stage{height:clamp(300px,52vh,520px)}#edit-tools{max-height:44vh}}
.tuner-dot{position:absolute;width:13px;height:13px;margin:-6.5px 0 0 -6.5px;border-radius:50%;border:2px solid var(--c);background:#111a;pointer-events:auto;cursor:grab;padding:0;box-shadow:0 0 0 1px #0008;transition:transform .08s}
.tuner-dot:hover,.tuner-dot.active{transform:scale(1.45);background:var(--c)}
.tuner-dot.edited{background:var(--c)}.tuner-dot.off{opacity:.25!important;border-style:dashed}
.tuner-dot:active{cursor:grabbing}
#tuner-panel{position:relative;background:#141412f2;border:1px solid #3a3732;border-radius:10px;padding:10px;font:12px Geist,system-ui,sans-serif;color:#d8d2c8;display:flex;flex-direction:column;gap:8px}
#tuner-panel .tuner-head{display:flex;justify-content:space-between;align-items:baseline}#tuner-panel .tuner-head span{font:10px 'Geist Mono',monospace;color:#8a847a}
#tuner-panel .tuner-row{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
#tuner-panel button{background:#24221f;border:1px solid #3a3732;color:#d8d2c8;border-radius:6px;padding:4px 8px;font:inherit;cursor:pointer}#tuner-panel button[aria-pressed=true]{background:#e8b04a;color:#111}
#tuner-panel .tuner-region{display:flex;align-items:center;gap:6px}#tuner-panel .tuner-region label{flex:1;display:flex;align-items:center;gap:6px}#tuner-panel .tuner-region i{width:9px;height:9px;border-radius:50%;display:inline-block}
#tuner-panel .tuner-region small{color:#8a847a}#tuner-panel .tuner-region button{padding:0 6px}
#tuner-panel .tuner-info,#tuner-panel .tuner-stats{font-size:11px;color:#aaa398;line-height:1.45}#tuner-panel .warn{color:#e8b04a}
#tuner-panel .tuner-tabs{display:flex;gap:2px;background:#0e0e0d;border-radius:7px;padding:2px}#tuner-panel .tuner-tabs button{flex:1;border:0;background:transparent}#tuner-panel .tuner-tabs button[aria-selected=true]{background:#2e2b27;color:#fff}
#tuner-panel details{border-top:1px solid #2a2825;padding-top:4px}#tuner-panel summary{cursor:pointer;display:flex;align-items:center;gap:6px;color:#d8d2c8;padding:2px 0}#tuner-panel summary i,#tuner-panel .tuner-slider i{width:8px;height:8px;border-radius:50%;display:inline-block;margin-right:4px}
#tuner-panel .tuner-slider{display:grid;grid-template-columns:92px 1fr;grid-template-rows:auto auto;column-gap:6px;align-items:center;padding:2px 0}
#tuner-panel .tuner-slider span{font-size:11px;color:#aaa398;cursor:default;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#tuner-panel .tuner-slider.edited span{color:#f0e6d6}
#tuner-panel .tuner-slider input{width:100%;accent-color:#e8b04a;margin:0}#tuner-panel .tuner-slider output{grid-column:2;font:10px 'Geist Mono',monospace;color:#8a847a;text-align:right;min-height:12px}
#tuner-panel .tuner-blend-from{display:flex;gap:6px;align-items:center}#tuner-panel select{flex:1;background:#24221f;color:#d8d2c8;border:1px solid #3a3732;border-radius:6px;padding:3px}
#tuner-panel .tuner-note{font-size:10.5px;color:#8a847a;line-height:1.4;margin:4px 0 0}

.library .head-tile .tile-main{padding:0;border:0;border-radius:0;background:transparent}
.library .head-tile .tile-actions{pointer-events:none}
.library .head-tile .tile-action{box-sizing:border-box;width:25px;height:25px;padding:0;border:1px solid #ffffff22;background:#151511dc;pointer-events:none}
.library .head-tile:hover .tile-action,.library .head-tile:focus-within .tile-action{pointer-events:auto}
@media(hover:none){.library .head-tile .tile-action{pointer-events:auto}}

@media(max-width:850px){
  #viewer.editing{overflow:visible;height:auto}
  #viewer.editing .edit-layout{flex:none;display:grid;grid-template-columns:minmax(0,1fr);gap:12px}
  #viewer.editing .edit-layout>.stage{min-height:300px;height:clamp(300px,48svh,480px)}
  #viewer.editing #edit-tools{max-height:none;overflow:visible}
}
@media(max-width:700px){
  body:has(.work-preview){overflow-y:auto;height:auto}
  main.workspace{display:flex;flex-direction:column;height:auto;min-height:calc(100svh - 56px);overflow:visible}
  main.workspace .library{flex:none;max-height:none;overflow:visible}
  .workspace .head-grid{display:grid;grid-template-columns:none;grid-auto-flow:column;grid-auto-columns:76px;overflow-x:auto;overscroll-behavior-x:contain;gap:8px;padding-bottom:3px}
  #viewer{flex:none;overflow:visible;height:auto;min-height:0}
  #viewer .edit-layout{flex:none}
  #viewer .edit-layout>.stage{height:clamp(320px,52svh,520px)}
  #viewer .viewer-bottom{position:relative;flex:none;padding-block:8px}
  .library .head-history{min-height:0}
}
#viewer .web-download{align-self:flex-start;background:transparent;border:0;padding:0 0 8px;color:var(--accent);font:12px Geist,system-ui,sans-serif;cursor:pointer}
#viewer .web-download:hover{text-decoration:underline}
