/* 分子窗口（molecule-windows.js）：右侧面板 3D 页里的 chemkit 壳（iframe）与窗口的标签。只用 theme.css 的变量。
   版面：3D 页是纵向 flex；浏览器端是窗口区（当前窗口的 iframe），窗口的标签在面板顶栏的标签条里（见下）；桌面端是原生画面的占位区域（#scene）。
   没有面板时（单元测试）标签条 .mol-strip 留在页的最上面。没有分子窗口时标签条与窗口区都是 hidden：桌面端 #scene 占满整个页，浏览器端 #scene 藏着、页里写一句说明（.pane-empty）。 */
.pane[data-pane="view3d"] #scene { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.pane[data-pane="view3d"] #scene[hidden] { display: none; }

.mol-strip { flex: none; display: flex; align-items: center; gap: var(--sp-1); min-width: 0; overflow-x: auto; scrollbar-width: none; }
.mol-strip[hidden], .mol-stage[hidden] { display: none; }
.mol-chip { flex: none; display: inline-flex; align-items: center; max-width: 220px; min-height: var(--ctl-sm); border-radius: var(--r-pill); background: var(--seg-track); color: var(--dim); }
.mol-chip:hover { color: var(--fg); }
.mol-chip.on { background: var(--seg-on); color: var(--fg); box-shadow: var(--shadow-seg); }
.mol-tab, .mol-close { display: inline-flex; align-items: center; gap: var(--sp-1); min-width: 0; border: 0; background: transparent; color: inherit; font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.mol-tab { min-height: var(--ctl-sm); padding: 0 var(--sp-3); border-radius: var(--r-pill); }
.mol-tab span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 带关闭按钮的芯片：标签右边不再留大空，关闭按钮是个小圆。 */
.mol-chip:has(.mol-close) .mol-tab { padding-right: var(--sp-1); }
.mol-close { flex: none; width: var(--ctl-xs); height: var(--ctl-xs); justify-content: center; border-radius: 50%; color: var(--faint); margin-right: var(--sp-1); }
.mol-close:hover { color: var(--fg); background: var(--hover); }
.mol-chip[data-state="starting"] .mol-tab .icon { animation: mol-pulse 1.2s ease-in-out infinite; }
@keyframes mol-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .mol-chip[data-state="starting"] .mol-tab .icon { animation: none; } }

/* 窗口的标签放进面板顶栏的标签条（.panel-tabs，style.css）时：strip 自己不占盒子（display: contents），芯片就是标签条里的标签，
   外观与“文件”“图表”这些标签一致——平着、悬停有底色、选中的浮起（--shadow-tab）；关闭按钮是标签右边的小圆。 */
.panel-tabs .mol-strip { display: contents; }
.panel-tabs .mol-strip[hidden] { display: none; }
.panel-tabs .mol-chip { position: relative; flex: 1 1 0; min-width: 96px; max-width: 240px; min-height: var(--ctl-sm); border-radius: var(--r-sm); background: transparent; justify-content: center; }
.panel-tabs .mol-chip:hover:not(.on) { background: var(--hover); color: var(--fg); }
.panel-tabs .mol-chip.on { background: var(--seg-on); color: var(--fg); box-shadow: var(--shadow-tab); }
.panel-tabs .mol-tab { flex: 1 1 auto; justify-content: center; border-radius: var(--r-sm); }

/* 窗口区：所有壳叠在同一块里，当前的可见；别的用 visibility 藏起来而不是 display:none——
   壳里的画布和 wgpu 面不能变成 0×0，切回来时才不会重建。 */
.mol-stage { flex: 1; min-width: 0; min-height: 0; position: relative; border-radius: var(--r-view); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-view); }
.mol-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--surface); }
.mol-frame[data-active="false"] { visibility: hidden; pointer-events: none; }
.mol-loading { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; background: var(--surface); color: var(--faint); font-size: var(--fs-sm); }
.mol-loading[hidden] { display: none; }
