.reference-panel{position:absolute;right:14px;top:116px;bottom:90px;width:min(354px,calc(100% - 28px));z-index:26;background:#102632f7;border:1px solid #496b7a;border-radius:14px;box-shadow:0 12px 36px #0007;color:#e7f2f7;display:flex;flex-direction:column;overflow:hidden;font-size:12px}
.reference-panel[hidden]{display:none!important}
#reference-gallery-open[hidden]{display:none!important}
.model-first #workspace-frame.studio-workspace.reference-is-open>#viewer-main{right:380px}
.model-first #workspace-frame.studio-workspace.reference-is-open>.presentation-dock{right:382px;width:min(390px,calc(100% - 410px))}
.reference-panel header{display:flex;align-items:center;gap:4px;padding:6px 10px;border-bottom:1px solid #365562}
.reference-panel header h2{font-size:14px;line-height:1.25;margin:0;flex:1;min-width:0}
.reference-panel button,.reference-panel a{min-height:44px;min-width:44px;font-size:12px}
.reference-panel button{border:1px solid #496b7a;border-radius:8px;background:#163847;color:#e7f2f7;padding:6px 10px}
.reference-panel button:disabled{opacity:.45}
.reference-panel [hidden]{display:none!important}
.reference-panel-body{overflow:auto;min-height:0;padding:8px 10px;overscroll-behavior:contain}
.reference-panel figure{margin:0}
.reference-panel figure>img{display:block;width:100%;height:clamp(130px,23vh,230px);object-fit:contain;background:#06151c;border-radius:7px}
.reference-panel figure>img[hidden]{display:none}
.reference-panel figcaption{font-size:11px;line-height:1.4;color:#b9ced8;margin:7px 0;overflow-wrap:anywhere}
.reference-panel-actions{display:flex;flex-wrap:wrap;gap:5px;align-items:center}
.reference-panel-actions span{margin-right:auto;font-variant-numeric:tabular-nums}
.reference-panel-actions a{display:flex;align-items:center;color:#a4e8f4;text-decoration:underline;padding:0 5px}
.reference-thumbnails{display:flex;overflow:auto;gap:6px;margin-top:8px;padding-bottom:5px;overscroll-behavior:contain}
.reference-thumbnails button{flex:none;width:106px;min-height:78px;padding:3px;display:flex;flex-direction:column;align-items:center;justify-content:center}
.reference-thumbnails button[aria-pressed=true]{outline:2px solid #64d6f2;outline-offset:-2px;background:#234d5e}
.reference-thumbnails img{display:block;width:100px;height:66px;object-fit:contain;border-radius:4px}
.reference-thumbnails span{font-size:10px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.reference-status:empty{display:none}.reference-status{margin:8px 0;overflow-wrap:anywhere}
.reference-help{font-size:11px;line-height:1.5;color:#c3d9e2}
#reference-image-dialog{max-width:96vw;width:1100px;max-height:94dvh;padding:12px;background:#0b202a;color:#e7f2f7;border:1px solid #587786;border-radius:12px;overflow:auto}
#reference-image-dialog header{display:flex;align-items:center;justify-content:space-between;gap:10px;position:sticky;top:0;background:#0b202a;padding:4px;z-index:1}
#reference-image-dialog img{display:block;width:100%;height:auto;object-fit:contain;background:white}
#reference-image-dialog::backdrop{background:#020a10d9}
.reference-panel :focus-visible,#reference-image-dialog :focus-visible{outline:2px solid #99e9ff;outline-offset:2px}
@media(max-width:760px){
 .reference-panel{top:auto;bottom:calc(81px + env(safe-area-inset-bottom));left:10px;right:10px;width:auto;height:min(330px,44dvh);max-height:none}
 .model-first #workspace-frame.studio-workspace.reference-is-open>#viewer-main{top:116px;right:0;bottom:calc(min(330px,44dvh) + 88px + env(safe-area-inset-bottom))}
 .model-first #workspace-frame.studio-workspace.reference-is-open .studio-recenter{display:none}
 .model-first #workspace-frame.studio-workspace.reference-is-open>.presentation-dock{top:auto;bottom:calc(min(330px,44dvh) + 90px + env(safe-area-inset-bottom));left:10px;right:10px;width:auto;max-height:60px}
 .model-first #workspace-frame.studio-workspace>.canvas-tools{display:grid;grid-template-columns:repeat(6,minmax(44px,1fr));width:min(400px,calc(100% - 20px));box-sizing:border-box}
 .model-first #workspace-frame.studio-workspace>.canvas-tools>button,.model-first #workspace-frame.studio-workspace>.canvas-tools>.workspace-popover>summary{min-width:0!important;max-width:100%;padding-left:3px;padding-right:3px;overflow:hidden;text-overflow:ellipsis}
 .reference-panel figure>img{height:150px}
 .reference-thumbnails button{width:80px;min-height:65px}.reference-thumbnails img{width:74px;height:48px}
 .model-first #workspace-frame.studio-workspace>.canvas-tools>button,.model-first #workspace-frame.studio-workspace>.canvas-tools>.workspace-popover>summary{min-width:44px;padding-left:8px;padding-right:8px;font-size:11px}
}
@media(max-height:520px) and (orientation:landscape){.reference-panel{top:12px;bottom:80px;height:auto;max-height:none;width:320px;left:auto}.reference-panel figure>img{height:110px}.model-first #workspace-frame.studio-workspace.reference-is-open>#viewer-main{top:0;bottom:0;right:344px}}
