/* TifMrcView Pro: Thermo red instead of the standard blue for everything active. */
:root[data-edition="pro"] {
  --accent: #e71316;
  --accent-hover: #c81013;
}
:root[data-edition="pro"] input[type="number"]:focus,
:root[data-edition="pro"] select:focus { outline-color: rgba(231, 19, 22, 0.3); }
:root[data-edition="pro"] #toolbar { box-shadow: inset 0 2px 0 var(--accent); }

/* 3D view: covers the 2D view inside the stage. */
#vol3d { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; background: #000; cursor: grab; touch-action: none; }
#vol3d:active { cursor: grabbing; }
#vol-panel {
  position: absolute; top: 10px; right: 10px; z-index: 6;
  display: flex; flex-direction: column; gap: 8px;
  width: 210px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
}
/* Figure mode (figure.js) keeps only the picked object's box, moved into its own panel. */
#vol-panel.vp-figure { display: none; }
#vol-panel .vp-title { font-weight: 700; color: var(--accent); }
#vol-panel label { display: flex; flex-direction: column; gap: 3px; color: var(--dim); font-size: 12px; }
#vol-panel select, #vol-panel input[type="range"] { width: 100%; }
#vol-panel .vp-row { display: flex; gap: 6px; }
#vol-panel .vp-row button { flex: 1; justify-content: center; border: 1px solid var(--line-strong); }
#vol-panel .vp-status { color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; min-height: 1.4em; }
#vol-panel label.vp-check { flex-direction: row; align-items: center; gap: 6px; }
#vol-panel .vp-obj { display: flex; flex-direction: column; gap: 5px; padding: 6px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 12px; }
#vol-panel .vp-obj .dim { color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
#vol-panel .vp-obj-name { display: flex; align-items: center; gap: 6px; font-weight: 600; }
#vol-panel .vp-classes { display: flex; flex-wrap: wrap; gap: 4px; }
#vol-panel .vp-class { padding: 2px 6px 2px 4px; font-size: 11px; border: 1px solid var(--line-strong); border-radius: 5px; display: inline-flex; align-items: center; gap: 4px; }
#vol-panel .vp-class::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--c); }
#vol-panel .vp-class.on { border-color: var(--accent); color: var(--accent); }
#vol-panel .vp-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }

/* Segmentation labels (labels.js). */
#lab-tools { gap: 4px; }
#lab-tools button { width: 30px; padding: 0; justify-content: center; }
#lab-tools button.on { background: var(--muted); color: var(--accent); border-color: var(--accent); }
#lab-hint { margin: 4px 0 6px; line-height: 1.5; }
#lab-ves-hist { display: block; width: 100%; height: 90px; margin-top: 4px; }
/* One colour input for all rows, moved next to the swatch that was clicked,
   so re-drawing the list does not close the colour picker. */
#lab-color { position: fixed; width: 12px; height: 12px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
/* The labels as rows of the Layers panel. */
#label-layers { padding: 2px 0 6px; }
#label-layers .ll-head { display: flex; align-items: center; gap: 4px; height: 30px; color: var(--dim); font-size: 11px; }
#label-layers .ll-space { flex: 1; }
#label-layers #lab-op { flex: 0 1 70px; min-width: 30px; width: 70px; }
#label-layers .ll-btn { flex: none; width: 22px; height: 22px; padding: 0; justify-content: center; border: 0; background: none; box-shadow: none; color: var(--dim); font-size: 15px; line-height: 1; }
#label-layers .ll-btn:hover { color: var(--accent); }
#label-layers .ll-btn svg, #lab-list .eye svg, #lab-list .lock svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; vertical-align: middle; }
#label-layers .ll-btn.off { opacity: 0.4; }
#lab-list { display: flex; flex-direction: column; max-height: 40vh; overflow-y: auto; overflow-x: hidden; border-top: 1px solid var(--line); }
#lab-list .lab-row { position: relative; display: flex; align-items: center; gap: 3px; min-height: 30px; padding: 0 2px 0 0; border: 1px solid transparent; border-bottom-color: var(--line); cursor: pointer; font-size: 12px; min-width: 0; }
#lab-list .lab-row:hover { background: var(--muted); }
#lab-list .lab-row.on { background: var(--subtle); border-color: var(--line-strong); box-shadow: inset 2px 0 0 var(--accent); }
/* One row is selected in the Layers panel: a label row or an image row. The
   active label keeps only its accent bar while an image row is selected. */
body:not([data-layer-focus="label"]) #lab-list .lab-row.on { background: none; border-color: transparent; border-bottom-color: var(--line); }
body[data-layer-focus="label"] .merge-layer-row.selected { background: none; border-color: transparent; border-bottom-color: var(--line); }
#lab-list .grip { flex: none; display: flex; align-items: center; width: 14px; height: 26px; cursor: grab; color: var(--faint); touch-action: none; }
#lab-list .grip svg { width: 14px; height: 14px; fill: currentColor; stroke: none; }
#lab-list .lab-row.dragging { opacity: 0.45; }
#lab-list .lab-row.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
#lab-list .lab-row.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
#lab-list .lab-row.drop-into { background: var(--muted); border-color: var(--accent); }
#lab-list .sw { flex: none; width: 14px; height: 14px; min-height: 0; border-radius: 3px; cursor: pointer; padding: 0; border: 1px solid rgba(0, 0, 0, 0.2); margin: 0 4px 0 2px; box-shadow: none; }
#lab-list .name { flex: 1 1 4em; min-width: 3em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lab-list .name-edit { flex: 1 1 auto; min-width: 0; width: 0; font-size: 12px; padding: 1px 4px; }
#lab-list .n { flex: none; min-width: 0; padding: 0 2px; text-align: right; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#lab-list .del, #lab-list .eye, #lab-list .lock { flex: none; width: 20px; height: 22px; padding: 0; justify-content: center; font-size: 11px; color: var(--faint); background: none; border: 0; box-shadow: none; }
#lab-list .del, #lab-list .lock { visibility: hidden; }
#lab-list .lab-row:hover .del, #lab-list .lab-row:hover .lock, #lab-list .lab-row.locked .lock { visibility: visible; }
#lab-list .del:hover, #lab-list .eye:hover, #lab-list .lock:hover { color: var(--accent); }
#lab-list .lab-row.off .name, #lab-list .lab-row.off .sw { opacity: 0.4; }
#lab-list .lab-row.off .eye, #lab-list .lab-row.locked .lock { color: var(--fg, #1f2328); }
#lab-list .eye { color: var(--dim); }
/* The bar beside the selected object and the bar of "find similar". */
#lab-chips, #lab-cand { position: absolute; z-index: 6; display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22); font-size: 12px; white-space: nowrap; }
#lab-chips[hidden], #lab-cand[hidden] { display: none; }
/* The bars belong to the 2D slice: none over the 3D view. */
#stage:has(#vol3d:not([hidden])) :is(#lab-chips, #lab-cand) { display: none; }
#lab-chips > button { height: 24px; padding: 0 8px; font-size: 12px; border: 0; box-shadow: none; background: none; border-radius: 5px; }
#lab-chips > button:hover:not(:disabled) { background: var(--muted); }
#lab-chips > button.primary { background: var(--accent); color: #fff; }
#lab-chips > button.primary:hover:not(:disabled) { background: var(--accent-hover); }
#lab-chips > button[data-act="less"], #lab-chips > button[data-act="more"] { width: 24px; padding: 0; justify-content: center; font-size: 15px; }
#lab-chips-menu { position: absolute; top: calc(100% + 4px); right: 0; display: flex; flex-direction: column; min-width: 130px; max-height: 240px; overflow-y: auto; padding: 3px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22); }
#lab-chips-menu[hidden] { display: none; }
#lab-chips-menu button { display: flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; font-size: 12px; border: 0; box-shadow: none; background: none; border-radius: 5px; justify-content: flex-start; }
#lab-chips-menu button:hover { background: var(--muted); }
#lab-chips-menu i { flex: none; width: 10px; height: 10px; border-radius: 2px; }
/* Structure types for the last stroke, under the label tools. */
#lab-types { flex-wrap: wrap; gap: 4px; }
#lab-types[hidden] { display: none; }
#lab-types > button { padding: 0 7px; }
#lab-types > button.on { background: var(--accent); color: #fff; }
#lab-types > button[data-type=""]:not(.on) { color: var(--dim); }
#lab-types-note { flex-basis: 100%; }
#lab-types-note:empty { display: none; }
#lab-side { gap: 4px; flex-wrap: wrap; }
#lab-side[hidden] { display: none; }
#lab-side > button.on { background: var(--accent); color: #fff; }
#lab-list select.ty { flex: none; width: auto; max-width: 70px; height: 20px; padding: 0 2px; font-size: 11px; border: 0; background: none; color: var(--dim); box-shadow: none; }
#lab-list select.ty.unset { opacity: 0; }
#lab-list .lab-row:hover select.ty.unset { opacity: 1; }
#lab-cand { left: 50%; bottom: 18px; transform: translateX(-50%); gap: 8px; padding: 6px 8px 6px 12px; }
#lab-cand label { display: flex; align-items: center; gap: 5px; color: var(--dim); }
#lab-cand input[type="range"] { width: 120px; }
#lab-cand-text { min-width: 5em; font-variant-numeric: tabular-nums; }
#view.lab-wait { cursor: progress; }
#sec-labels details { margin: 6px 0; }
#sec-labels summary { cursor: pointer; font-size: 12px; color: var(--dim); }
#sec-labels input[type="number"] { width: 84px; }
#vp-levels { display: flex; flex-direction: column; gap: 4px; }
#vp-hist { width: 100%; height: 64px; background: var(--muted); border-radius: 6px; cursor: ew-resize; touch-action: none; }
#vol-panel .vp-nums { align-items: center; color: var(--dim); font-size: 12px; }
#vol-panel .vp-nums input { flex: 1; min-width: 0; width: 60px; }
#vol-panel .vp-sigma { color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
/* The tools panel stays usable over the 3D view. */
#tools { z-index: 7; }
#tools-resizer { z-index: 8; }
/* Slices with segmentation labels: a band under the Z slider (annotation marks sit above it). */
#zlabels { position: absolute; left: 8px; right: 8px; bottom: -6px; height: 6px; pointer-events: none; }
#zlabels i { position: absolute; top: 0; height: 6px; min-width: 6px; margin-left: -3px; border-radius: 1px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3); }
#vol-panel .vp-pre { align-items: center; justify-content: space-between; }
#vol-panel label.vp-inline { flex-direction: row; align-items: center; gap: 6px; }
#vol-panel label.vp-inline select { width: auto; }

/* CTF fitting, in the FFT panel. */
#ctf-wrap { position: relative; }
#ctf-over { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#ctf-box { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12px; }
.ctf-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.ctf-head b { flex: 1; font-size: 13px; }
#ctf-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; margin-bottom: 6px; }
#ctf-opts label { display: flex; flex-direction: column; gap: 2px; color: var(--dim); font-size: 11px; }
#ctf-opts input[type="number"], #ctf-opts select { width: 100%; box-sizing: border-box; }
#ctf-opts .ctf-wide { grid-column: 1 / -1; }
#ctf-opts .ctf-check { flex-direction: row; align-items: center; gap: 6px; }
#ctf-out { line-height: 1.5; font-variant-numeric: tabular-nums; }
#ctf-series { margin-top: 8px; }
#ctf-series .ctf-head span { flex: 1; font-size: 11px; }
#ctf-trend { width: 100%; height: 110px; display: block; background: var(--subtle); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
#ctf-table { max-height: 180px; overflow-y: auto; margin-top: 6px; }
#ctf-table table { width: 100%; border-collapse: collapse; font-size: 11px; font-variant-numeric: tabular-nums; }
#ctf-table th { position: sticky; top: 0; background: var(--bg, #fff); color: var(--dim); font-weight: 500; text-align: right; padding: 1px 4px; }
#ctf-table td { text-align: right; padding: 1px 4px; border-top: 1px solid var(--line); }
#ctf-table tbody tr { cursor: pointer; }
#ctf-table tbody tr:hover { background: var(--subtle); }
#ctf-table tr.low td { color: var(--dim); }
#ctf-plot { width: 100%; height: 90px; display: block; margin-top: 6px; background: var(--subtle); border: 1px solid var(--line); border-radius: 6px; }
#fft-panel { max-height: calc(100% - 20px); overflow-y: auto; overflow-x: hidden; box-sizing: border-box; }

#align-panel, #diff-panel, #denoise-panel, #wedge-panel, #stem-panel, #part-panel {
  position: absolute; top: 10px; right: 10px; z-index: 6;
  width: 290px; max-height: calc(100% - 20px); overflow-y: auto; box-sizing: border-box;
  padding: 8px 10px 10px; font-size: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.al-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.al-head b { flex: 1; }
.al-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; margin-bottom: 8px; }
.al-opts label { display: flex; flex-direction: column; gap: 2px; color: var(--dim); font-size: 11px; }
.al-opts select, .al-opts input[type="number"] { width: 100%; box-sizing: border-box; }
.al-opts .al-wide { grid-column: 1 / -1; }
.al-opts .al-check { flex-direction: row; align-items: center; gap: 6px; }
.al-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.al-row #al-status, .al-row #al-saved-name { flex: 1; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#al-plot { width: 100%; height: 170px; display: block; margin-top: 8px; background: var(--subtle); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
#al-sum { margin-top: 4px; line-height: 1.4; }
#al-table { max-height: 160px; overflow-y: auto; margin-top: 6px; }
#al-table table { width: 100%; border-collapse: collapse; font-size: 11px; font-variant-numeric: tabular-nums; }
#al-table th { position: sticky; top: 0; background: var(--surface); color: var(--dim); font-weight: 500; text-align: right; padding: 1px 4px; }
#al-table td { text-align: right; padding: 1px 4px; border-top: 1px solid var(--line); }
#al-table tbody tr { cursor: pointer; }
#al-table tbody tr:hover { background: var(--subtle); }
#al-table tr.low td { color: var(--dim); }

/* Diffraction indexing */
#df-sum { margin: 2px 0 6px; line-height: 1.5; font-variant-numeric: tabular-nums; }
#diff-panel .al-check { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 11px; }
#diff-panel .pro-table { max-height: 180px; overflow-y: auto; margin-top: 6px; }
#diff-panel .pro-table table { width: 100%; border-collapse: collapse; font-size: 11px; font-variant-numeric: tabular-nums; }
#diff-panel .pro-table th { position: sticky; top: 0; background: var(--surface); color: var(--dim); font-weight: 500; text-align: right; padding: 1px 4px; }
#diff-panel .pro-table td { text-align: right; padding: 1px 4px; border-top: 1px solid var(--line); white-space: nowrap; }
#diff-panel .pro-table tbody tr { cursor: pointer; }
#diff-panel .pro-table tbody tr:hover { background: var(--subtle); }
#diff-panel .pro-table tr.on td { background: #ffebe9; }
#diff-panel .pro-table tr.low td { color: var(--dim); }
#df-zone { margin-top: 8px; }
#df-zone summary { cursor: pointer; font-size: 12px; margin-bottom: 6px; }
.df-cell { grid-template-columns: 1fr 1fr 1fr; }
.ctf-warn { margin-top: 4px; color: #9a6700; line-height: 1.4; }
/* Right-hand panels move left of the show-sidebar button while the sidebar is folded. */
#stage:has(#btn-show-sidebar:not([hidden])) :is(#fft-panel, #align-panel, #diff-panel, #denoise-panel, #wedge-panel, #stem-panel, #part-panel) { right: 40px; }
#df-zones { overflow-x: auto; }
#df-zones table { table-layout: auto; }
#df-zones td, #df-zones th { padding: 1px 3px; }
#ctf-table tr.edge td { background: #fff8c5; }

/* Spectrum quantification beside the spectrum plot. */
.sq-body { flex: 1; display: flex; gap: 10px; min-height: 0; }
.sq-body #spec-plot { flex: 1; min-width: 0; width: auto; }
#spec-panel.sq-open { height: 340px; }
#sq-side { width: 340px; flex: none; overflow-y: auto; font-size: 12px; border-left: 1px solid var(--line); padding-left: 10px; }
#sq-side .sq-top { margin-top: 0; margin-bottom: 6px; }
#sq-side .sq-top #sq-status { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sq-side .al-opts input[type="text"] { width: 100%; box-sizing: border-box; }
#sq-side .al-check { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 11px; flex: 1; }
#sq-side .pro-table { margin-top: 4px; }
#sq-side .pro-table table { width: 100%; border-collapse: collapse; font-size: 11px; font-variant-numeric: tabular-nums; }
#sq-side .pro-table th { position: sticky; top: 0; background: var(--surface); color: var(--dim); font-weight: 500; text-align: right; padding: 1px 4px; }
#sq-side .pro-table th:first-child, #sq-side .pro-table td:first-child { text-align: left; }
#sq-side .pro-table td { text-align: right; padding: 1px 4px; border-top: 1px solid var(--line); white-space: nowrap; }
#sq-side .pro-table tr.edge td { background: #fff8c5; }
#sq-note { margin-top: 6px; font-size: 11px; line-height: 1.4; }
#sq-sum { margin-top: 2px; }
@media (max-width: 720px) {
  .sq-body { flex-direction: column; }
  #spec-panel.sq-open { height: 70vh; }
  #sq-side { width: auto; border-left: 0; padding-left: 0; }
}

/* Denoising */
#denoise-panel .al-check { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 11px; }
.dn-slider { display: flex; align-items: center; gap: 6px; }
.dn-slider input { flex: 1; min-width: 0; }
.dn-slider output { width: 36px; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.dn-split { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--dim); font-size: 11px; }
.dn-split input { flex: 1; min-width: 0; }
#dn-status { flex: 1; font-variant-numeric: tabular-nums; }
#dn-saved-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#denoise-panel [hidden] { display: none; }

/* 4D-STEM maps. */
#stem-panel { width: 300px; }
#stem-panel select { flex: 1; min-width: 0; }
#st-canvas, #st-dp { display: block; width: 100%; height: auto; margin-top: 6px; image-rendering: pixelated; border-radius: 6px; background: #000; cursor: crosshair; }
#st-dp { width: 60%; margin: 6px auto 8px; }
#st-pick { margin-top: 4px; font-variant-numeric: tabular-nums; min-height: 1.3em; }
#st-det, #st-rot { margin-top: 8px; }
#st-det summary, #st-rot summary { cursor: pointer; font-size: 12px; margin-bottom: 4px; }
.st-det3 { grid-template-columns: 1fr 1fr 1fr; }
#stem-panel .al-check { display: flex; flex-direction: row; align-items: center; gap: 6px; color: var(--dim); font-size: 11px; }
#st-rotnote { line-height: 1.4; }

/* Particle statistics. */
#part-panel { width: 300px; }
#part-panel select { flex: 1; min-width: 0; }
#part-panel .al-check { display: flex; flex-direction: row; align-items: center; gap: 6px; color: var(--dim); font-size: 11px; }
#part-panel .al-row label { display: flex; align-items: center; gap: 4px; color: var(--dim); font-size: 11px; }
#pa-t { width: 80px; }
#pa-thr { margin-bottom: 6px; }
#pa-thr summary { cursor: pointer; font-size: 12px; margin-bottom: 4px; }
#pa-hist, #pa-dist { display: block; width: 100%; height: auto; margin: 4px 0; background: var(--subtle); border: 1px solid var(--line); border-radius: 6px; }
#pa-hist { aspect-ratio: 280 / 70; cursor: crosshair; }
#pa-dist { aspect-ratio: 280 / 150; }
.pa-sum { display: grid; gap: 2px; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.pa-sum div { display: flex; justify-content: space-between; gap: 8px; }
.pa-sum span { color: var(--dim); }
.pa-sum b { font-weight: 600; text-align: right; }
#pa-fit { margin-bottom: 6px; line-height: 1.4; }
.pa-table-wrap { max-height: 180px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; }
#pa-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 11px; }
#pa-table th { position: sticky; top: 0; background: var(--subtle); font-weight: 600; text-align: right; padding: 3px 4px; }
#pa-table td { text-align: right; padding: 2px 4px; border-top: 1px solid var(--line); cursor: pointer; }
#pa-table td:first-child, #pa-table th:first-child { text-align: center; width: 18px; }
#pa-table tr.sel td { background: rgba(207, 34, 46, 0.12); }
#pa-table tr.off td { color: var(--dim); text-decoration: line-through; }
#pa-table tr.off td:first-child { text-decoration: none; }
.dn-trainrow { display: flex; align-items: flex-end; }
#dn-model { font-size: 11px; line-height: 1.4; white-space: pre-line; }

/* Missing-wedge correction */
#wedge-panel .al-check { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 11px; }
#wedge-panel [hidden] { display: none; }
#wg-status, #wg-saved-name { flex: 1; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#wg-model, #wg-detected { font-size: 11px; line-height: 1.4; white-space: pre-line; }
.wg-range { display: flex; align-items: center; gap: 4px; }
.wg-range input { width: 52px; }

/* Cryo-ET workspace, with the viewer left visible beside it. */
#cryoet-workspace { position:absolute; top:10px; bottom:10px; right:10px; z-index:9; width:min(660px, calc(100% - 20px)); display:flex; flex-direction:column; overflow:auto; padding:12px; box-sizing:border-box; border:1px solid var(--line); border-radius:12px; background:var(--surface); box-shadow:var(--shadow); font-size:12px; }
#cryoet-workspace[hidden], #cryoet-workspace [hidden] { display:none; }
#cryo-dataset { display:flex; align-items:center; gap:8px; padding-bottom:8px; }
#cryo-export-box { padding-bottom:8px; }
#cryo-advanced { margin-top:8px; display:flex; flex-direction:column; min-height:0; }
#cryo-advanced > summary { cursor:pointer; color:var(--dim); padding:4px 0 8px; }
#cryo-dataset-name { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#cryo-steps { display:grid; grid-template-columns:repeat(5,1fr); gap:4px; padding-bottom:10px; border-bottom:1px solid var(--line); }
#cryo-steps button { padding:6px 3px; justify-content:center; font-size:11px; }
#cryo-steps button.on { background:var(--muted); color:var(--accent); border-color:var(--accent); }
#cryo-body { flex:1; min-height:0; overflow:auto; padding-top:10px; }
#cryo-body p { line-height:1.6; }
/* The progress line and its cancel button stay in sight however long the panel is. */
#cryo-foot { position:sticky; bottom:-12px; z-index:2; display:flex; align-items:center; gap:8px; margin-top:auto; padding:8px 0 12px; border-top:1px solid var(--line); background:var(--surface); }
#cryo-status { flex:1; min-height:1.5em; font-variant-numeric:tabular-nums; }
#quickbar #btn-cryoet { width:auto; padding:0 8px; gap:5px; }
#ta-summary, #ct-summary { margin:6px 0; line-height:1.5; font-variant-numeric:tabular-nums; }
#ta-plot, #ct-plot { width:100%; height:110px; background:var(--subtle); border:1px solid var(--line); border-radius:6px; }
#ta-table { max-height:220px; overflow:auto; }
#ta-table table { width:100%; border-collapse:collapse; font-size:11px; text-align:right; font-variant-numeric:tabular-nums; }
#ta-table th { position:sticky; top:0; background:var(--surface); }
#ta-table td { padding:2px 3px; border-top:1px solid var(--line); cursor:pointer; }
#ta-table tr.flagged { background:rgba(231,19,22,.12); }
#ta-table tr:hover { background:var(--muted); }
#rc-list .al-row span { flex:1; min-width:0; overflow-wrap:anywhere; }
.ct-range { display:flex; align-items:center; gap:4px; }
.ct-range input { width:56px; }

#mo-trajectory, #mo-vectors { width:100%; height:160px; display:block; background:var(--subtle); border:1px solid var(--line); border-radius:6px; margin:8px 0; }
#mo-table { max-height:190px; overflow:auto; margin:8px 0; }
#mo-table table { width:100%; border-collapse:collapse; font-size:11px; font-variant-numeric:tabular-nums; }
#mo-table th { position:sticky; top:0; background:var(--surface); text-align:left; }
#mo-table td { padding:3px; border-top:1px solid var(--line); cursor:pointer; }
#mo-table .missing td { color:var(--dim); }
#mo-movie-name, #mo-mdoc-name, #mo-gain-name, #mo-folder-name { overflow-wrap:anywhere; min-width:0; }

/* Single-particle workspace (same frame as the Cryo-ET one). */
#spa-workspace { position:absolute; top:10px; bottom:10px; right:10px; z-index:9; width:min(660px, calc(100% - 20px)); display:flex; flex-direction:column; overflow:auto; padding:12px; box-sizing:border-box; border:1px solid var(--line); border-radius:12px; background:var(--surface); box-shadow:var(--shadow); font-size:12px; }
#spa-workspace[hidden], #spa-workspace [hidden] { display:none; }
#spa-auto { padding:4px 0 10px; border-bottom:1px solid var(--line); }
#spa-auto p { line-height:1.6; }
#spa-a-start, #spa-a-go { font-size:13px; padding:6px 18px; }
#spa-advanced { margin-top:8px; display:flex; flex-direction:column; min-height:0; }
#spa-advanced > summary { cursor:pointer; color:var(--dim); padding:4px 0 8px; }
#spa-workspace .ws-dataset { display:flex; align-items:center; gap:8px; padding-bottom:8px; }
#spa-name { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#spa-workspace .ws-steps { display:grid; grid-template-columns:repeat(6,1fr); gap:4px; padding-bottom:10px; border-bottom:1px solid var(--line); }
#spa-workspace .ws-steps button { padding:6px 3px; justify-content:center; font-size:11px; }
#spa-workspace .ws-steps button.on { background:var(--muted); color:var(--accent); border-color:var(--accent); }
#spa-workspace .ws-body { flex:1; min-height:0; overflow:auto; padding-top:10px; }
#spa-workspace .ws-body p { line-height:1.6; }
#spa-workspace .ws-foot { display:flex; align-items:center; gap:8px; padding-top:8px; border-top:1px solid var(--line); }
#spa-status { flex:1; min-height:1.5em; font-variant-numeric:tabular-nums; }
#quickbar #btn-spa { width:auto; padding:0 8px; gap:5px; }
#spa-mic-name { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#spa-workspace .ws-img { display:block; width:100%; margin-top:8px; border:1px solid var(--line); border-radius:6px; image-rendering:auto; }
#spa-workspace .ws-table { max-height:260px; overflow:auto; margin-top:8px; }
#spa-workspace .ws-table table { width:100%; border-collapse:collapse; font-size:11px; text-align:right; font-variant-numeric:tabular-nums; }
#spa-workspace .ws-table th { position:sticky; top:0; background:var(--surface); color:var(--dim); font-weight:500; }
#spa-workspace .ws-table td { padding:2px 4px; border-top:1px solid var(--line); cursor:pointer; }
#spa-workspace .ws-table td:first-child, #spa-workspace .ws-table th:first-child { text-align:left; }
#spa-workspace .ws-table tr.missing td { color:var(--dim); text-decoration:line-through; }
#spa-workspace .ws-table tbody tr:hover { background:var(--muted); }
#spa-workspace .ws-gallery { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; }
#spa-workspace .ws-gallery figure { margin:0; padding:2px; border:2px solid transparent; border-radius:6px; cursor:pointer; text-align:center; }
#spa-workspace .ws-gallery figure.on { border-color:var(--accent); }
#spa-workspace .ws-gallery canvas { display:block; width:72px; height:72px; border-radius:4px; }
#spa-workspace .ws-gallery figcaption { font-size:10px; color:var(--dim); font-variant-numeric:tabular-nums; }
#spa-workspace .ws-kinds { display:flex; flex-direction:column; gap:6px; margin-top:8px; }
#spa-workspace .ws-kinds figure { margin:0; padding:3px; border:2px solid var(--line); border-radius:8px; cursor:pointer; }
#spa-workspace .ws-kinds figure.on { border-color:var(--accent); background:color-mix(in srgb, var(--accent) 8%, transparent); }
#spa-workspace .ws-kinds img { display:block; width:100%; max-width:576px; image-rendering:auto; border-radius:4px; }
#spa-workspace .ws-kinds figcaption { font-size:12px; margin-top:2px; font-variant-numeric:tabular-nums; }
#spa-fsc { width:100%; height:auto; margin-top:6px; background:var(--subtle); border:1px solid var(--line); border-radius:6px; }
#spa-workspace input[type="text"] { width:100%; box-sizing:border-box; }

/* One-time hint when Pro found no GPU (pro.js). */
.pro-gpu-hint {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 50;
  max-width: min(640px, calc(100vw - 32px)); padding: 10px 36px 10px 14px;
  background: #fff8c5; color: #3b2300; border: 1px solid #d4a72c; border-radius: 6px;
  font-size: 13px; line-height: 1.5; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.pro-gpu-hint a { color: #0969da; }
.pro-gpu-hint button {
  position: absolute; top: 4px; right: 6px; border: 0; background: none; font-size: 16px; cursor: pointer; color: inherit;
}

/* MemBrain-seg model picker (membrane.js): centred, above the panels. */
.dialog.mem-model { top: 25%; left: 50%; right: auto; transform: translateX(-50%); width: 380px; z-index: 30; }

/* Subtomogram-averaging workspace (same frame as the single-particle one). */
#sta-workspace { position:absolute; top:10px; bottom:10px; right:10px; z-index:9; width:min(660px, calc(100% - 20px)); display:flex; flex-direction:column; overflow:auto; padding:12px; box-sizing:border-box; border:1px solid var(--line); border-radius:12px; background:var(--surface); box-shadow:var(--shadow); font-size:12px; }
#sta-workspace[hidden], #sta-workspace [hidden] { display:none; }
/* Inside the Cryo-ET panel: the host gives the place and the size. */
#sta-workspace.hosted, #sta-workspace.hosted.marking, #sta-workspace.hosted.reviewing, #sta-workspace.hosted.reviewing-shapes { position:static; z-index:auto; width:auto; flex:none; overflow:visible; min-height:0; padding:0; border:0; border-radius:0; background:none; box-shadow:none; }
#sta-workspace.hosted > .al-head { display:none; }
#sta-workspace .ws-img { display:block; width:100%; max-width:480px; margin-top:8px; border:1px solid var(--line); border-radius:6px; }
#sta-workspace.marking, #sta-workspace.reviewing, #sta-workspace.reviewing-shapes { width:min(360px, calc(100% - 20px)); }
@media (max-width:700px) { #sta-workspace.marking { top:auto; height:48%; } }
#sta-workspace .sta-head-btns { display:flex; gap:4px; }
#sta-workspace.folded { bottom:auto; width:min(360px, calc(100% - 20px)); overflow:hidden; }
#sta-workspace.folded > :not(.al-head) { display:none; }
#sta-workspace.folded .al-head { margin-bottom:0; }
#sta-fold svg { display:block; transition:transform .15s; }
#sta-workspace.folded #sta-fold svg { transform:rotate(180deg); }
#sta-workspace .sta-old { display:inline-block; margin:0 0 4px; padding:1px 8px; border-radius:8px; background:var(--muted); border:1px solid var(--line); color:var(--dim); font-size:12px; }
#sta-workspace .sta-old[hidden] { display:none; }
#sta-workspace .sta-which { gap:4px; }
#sta-workspace .sta-which button.on { background:var(--accent); color:#fff; border-color:var(--accent); }
#sta-workspace .al-row { flex-wrap:wrap; }
#sta-workspace p { line-height:1.6; }
#sta-workspace h4 { margin:12px 0 2px; font-size:12px; }
#sta-run { font-size:13px; padding:6px 18px; }
#sta-again { font-size:13px; padding:6px 18px; }
#sta-again:disabled { opacity:.5; cursor:not-allowed; }
#sta-workspace #sta-mark-head { margin-top:14px; }
#sta-draw > h4:first-child { display:none; }
#sta-lookhint { margin:2px 0; }
#quickbar #btn-sta { width:auto; padding:0 8px; gap:5px; }
/* The wall of tomograms: three tiles per row, scrolling by itself beyond about two and a half rows. */
#sta-workspace .sta-wall { position:relative; display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:8px; margin:4px 0 2px; padding:2px; overflow-y:auto; align-content:start; }
#sta-workspace .sta-tile { position:relative; min-width:0; }
#sta-workspace .sta-tile .pic { position:relative; display:block; aspect-ratio:1; overflow:hidden; border-radius:8px; border:1px solid var(--line); background:var(--muted); }
#sta-workspace .sta-tile .pic.clickable { cursor:pointer; }
#sta-workspace .sta-tile .pic img { display:block; width:100%; height:100%; object-fit:contain; background:#222; }
#sta-workspace .sta-tile.open .pic { outline:3px solid var(--accent); outline-offset:1px; }
#sta-workspace .sta-tile .ph { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:var(--dim); font-size:11px; }
#sta-workspace .sta-tile .ph.wait { background:linear-gradient(100deg, var(--muted) 30%, color-mix(in srgb, var(--muted) 60%, var(--surface)) 50%, var(--muted) 70%); background-size:300% 100%; animation:sta-shimmer 1.8s ease-in-out infinite; }
@keyframes sta-shimmer { from { background-position:100% 0; } to { background-position:0 0; } }
@media (prefers-reduced-motion:reduce) { #sta-workspace .sta-tile .ph.wait { animation:none; } }
#sta-workspace .sta-tile .tick { position:absolute; top:5px; left:5px; display:flex; padding:3px; border-radius:6px; background:color-mix(in srgb, var(--surface) 88%, transparent); box-shadow:0 0 0 1px var(--line); line-height:0; }
#sta-workspace .sta-tile .tick input { margin:0; width:15px; height:15px; }
#sta-workspace .sta-tile .marks { position:absolute; left:4px; right:4px; bottom:4px; display:flex; flex-wrap:wrap; gap:3px; }
#sta-workspace .sta-tile .marks span { padding:0 6px; border-radius:8px; font-size:10px; line-height:16px; color:#fff; background:rgba(0,0,0,.62); }
#sta-workspace .sta-tile .marks .fd { background:var(--accent); }
#sta-workspace .sta-tile .nm { display:flex; margin-top:3px; white-space:pre; }
#sta-workspace .sta-tile .nm .a { min-width:0; overflow:hidden; text-overflow:ellipsis; }
#sta-workspace .sta-tile .nm .b { flex:none; }
#sta-workspace .sta-tile .note { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11px; color:var(--dim); min-height:15px; }
#sta-workspace .sta-tile.off .pic, #sta-workspace .sta-tile.off .nm { opacity:.5; }
#sta-workspace .sta-tile.off .pic img { filter:grayscale(1); }
#sta-workspace .sta-pixel { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin:6px 0; padding:6px 8px; border-radius:8px; border:1px solid var(--line); background:var(--muted); font-size:12px; }
#sta-workspace .sta-pixel[hidden] { display:none; }
#sta-workspace .sta-pixel input { width:80px; }
#sta-workspace .sta-tile.off .tick { opacity:.5; }
#sta-workspace .sta-tile:not(.ticked):not(.off) .pic img { opacity:.72; }
#sta-workspace .sta-tile.plus { align-self:start; width:100%; box-sizing:border-box; padding:0; aspect-ratio:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; border:1.5px dashed var(--line); border-radius:8px; background:transparent; color:var(--dim); cursor:pointer; font:inherit; }
#sta-workspace .sta-tile.plus b { font-size:22px; font-weight:400; line-height:1; }
#sta-workspace .sta-tile.plus:hover { border-color:var(--accent); color:var(--accent); }
#sta-workspace #sta-wall-count { margin:2px 0 6px; }
#sta-workspace .sta-live { margin:6px 0 0; }
#sta-workspace .sta-live img { display:block; width:100%; max-width:360px; border:1px solid var(--line); border-radius:6px; }
#sta-workspace .sta-cards { display:flex; gap:6px; overflow-x:auto; padding-bottom:4px; }
#sta-workspace .sta-cards figure { flex:none; width:192px; margin:0; padding:3px; border:2px solid var(--line); border-radius:8px; cursor:pointer; }
#sta-workspace .sta-cards figure.chosen { border-color:var(--accent); }
#sta-workspace .sta-cards figure.on { background:color-mix(in srgb, var(--accent) 10%, transparent); }
#sta-workspace .sta-cards img { display:block; width:100%; border-radius:4px; }
#sta-workspace .sta-cards figcaption { margin-top:2px; font-variant-numeric:tabular-nums; }
#sta-workspace .sta-badge { display:inline-block; margin:2px 3px 0 0; padding:0 6px; border-radius:8px; font-size:10px; background:var(--muted); color:var(--dim); }
#sta-workspace .sta-badge.pick { background:var(--accent); color:#fff; }
#sta-workspace .sta-badge.runs { background:#fff8c5; color:#3b2300; }
#sta-workspace .sta-fsc { display:block; width:100%; max-width:360px; margin-top:6px; background:var(--subtle); border:1px solid var(--line); border-radius:6px; font-size:9px; fill:var(--dim); }
#sta-status { flex:1; min-height:1.5em; font-variant-numeric:tabular-nums; }
#sta-draw-tools button { display:inline-flex; align-items:center; gap:4px; }
#sta-draw-hint:empty { display:none; }
#sta-draw .sta-marks { display:flex; flex-direction:column; gap:2px; margin-top:6px; }
#sta-draw .sta-mark { padding:4px 8px; border:1px solid var(--line); border-left:3px solid var(--mark); border-radius:6px; cursor:pointer; }
#sta-draw .sta-mark .warn { color:#cf222e; font-size:12px; }
#sta-draw-membrane:empty { display:none; }
#sta-draw .sta-mark-ends { font-size:12px; margin-top:2px; }
#sta-draw .sta-mark-side { display:block; margin-top:4px; max-width:160px; max-height:120px; image-rendering:pixelated; border:1px solid var(--line); border-radius:4px; }
#sta-draw-deep.on { background:var(--muted); color:var(--accent); border-color:var(--accent); }
#sta-draw .sta-mark.on { background:var(--muted); border-color:var(--accent); border-left-color:var(--mark); }
#sta-found { margin-top:10px; padding:8px 10px; border:1px solid var(--accent); border-radius:8px; background:color-mix(in srgb, var(--accent) 5%, transparent); }
#sta-workspace #sta-found h4 { margin:0 0 2px; font-size:14px; }
#sta-found .sta-found-per { margin:0 0 4px; padding:0; list-style:none; display:flex; flex-wrap:wrap; gap:2px 12px; color:var(--dim); font-variant-numeric:tabular-nums; }
#sta-found .warn { color:#9a6700; margin:2px 0; }
#sta-found .sta-found-slider { display:flex; align-items:center; gap:8px; margin-top:4px; }
#sta-found .sta-found-slider input { flex:1; min-width:0; }
#sta-found-curve { display:block; width:100%; height:44px; margin-top:2px; border:1px solid var(--line); border-radius:6px; background:var(--subtle); }
#sta-found .sta-found-legend { margin:4px 0; }
#sta-found-add.on { background:var(--accent); color:#fff; border-color:var(--accent); }
#sta-found-msg:empty { display:none; }
#sta-found-go { font-size:13px; padding:6px 18px; }
#sta-found-go:disabled { opacity:.5; cursor:not-allowed; }
#sta-shapes { margin-top:10px; padding:8px 10px; border:1px solid var(--accent); border-radius:8px; background:color-mix(in srgb, var(--accent) 5%, transparent); }
#sta-workspace #sta-shapes h4 { margin:0 0 2px; font-size:14px; }
#sta-shapes .sta-found-per { margin:0 0 4px; padding:0; list-style:none; display:flex; flex-wrap:wrap; gap:2px 12px; color:var(--dim); font-variant-numeric:tabular-nums; }
#sta-shapes .warn { color:#9a6700; margin:2px 0; }
#sta-shapes .sta-found-legend { margin:4px 0; }
#sta-shapes .sta-shapes-sel { align-items:center; padding:4px 6px; border-radius:6px; background:var(--muted); }
/* 圈例子: the strip of pictures of the places found, best first, scrolling sideways */
#sta-circled-groups { margin:4px 0; }
#sta-circled-groups label { display:flex; align-items:center; gap:6px; padding:1px 0; cursor:pointer; }
#sta-circled-groups label.off { color:var(--dim); }
#sta-circled-strip { display:flex; gap:4px; overflow-x:auto; padding:4px 2px 6px; margin:4px 0 2px; }
#sta-circled-strip .sta-tile { position:relative; flex:none; width:96px; height:96px; padding:0; border:1px solid var(--line); border-radius:6px; background:#222; overflow:hidden; cursor:pointer; }
#sta-circled-strip .sta-tile::before { content:""; display:none; position:absolute; left:50%; top:50%; width:var(--ring, 0); aspect-ratio:1; transform:translate(-50%, -50%); box-sizing:border-box; border:1px dashed #fff; border-radius:50%; box-shadow:0 0 0 1px rgba(0,0,0,.7), inset 0 0 0 1px rgba(0,0,0,.7); pointer-events:none; z-index:1; }
#sta-circled-strip[style*="--ring"] .sta-tile::before { display:block; }
#sta-circled-strip .sta-tile img { display:block; width:100%; height:100%; object-fit:contain; }
#sta-circled-strip .sta-tile img:not([src]) { visibility:hidden; }
#sta-circled-strip .sta-tile.ex { border-color:var(--accent); box-shadow:0 0 0 1px var(--accent); }
#sta-circled-strip .sta-tile.off img { filter:grayscale(1); opacity:.28; }
#sta-circled-strip .sta-tile.off::after { content:"\00d7"; position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:34px; line-height:1; color:#fff; text-shadow:0 0 3px #000; }
#sta-circled-strip .sta-tile:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
#sta-circled-strip .sta-tile i { position:absolute; font-style:normal; font-size:10px; line-height:14px; padding:0 4px; border-radius:7px; color:#fff; }
#sta-circled-strip .sta-tile i.ex { left:2px; bottom:2px; background:var(--accent); }
#sta-circled-strip .sta-more { flex:none; align-self:center; }
#sta-shapes-flip.on { background:var(--accent); color:#fff; border-color:var(--accent); }
#sta-shapes-msg:empty { display:none; }
#sta-shapes-go { font-size:13px; padding:6px 18px; }
#sta-shapes-go:disabled { opacity:.5; cursor:not-allowed; }
/* 「用现成的密度图」: the last tile of the cards */
#sta-workspace .sta-more { margin-top:4px; }
#sta-workspace .sta-kinds, #sta-workspace .sta-placed { margin-top:8px; padding:8px 10px; border:1px solid var(--line); border-radius:8px; }
#sta-workspace .sta-kinds p { margin:0 0 6px; }
#sta-workspace .sta-kinds .sta-cards figure.off { opacity:.5; }
#sta-workspace .sta-kinds .sta-cards figure:focus-visible { outline:2px solid var(--accent); }
#sta-workspace .sta-kinds-keep:disabled, #sta-kinds-keep:disabled { opacity:.5; cursor:not-allowed; }
#sta-workspace .sta-placed .sta-placed-legend { display:flex; flex-wrap:wrap; gap:2px 12px; color:var(--dim); font-variant-numeric:tabular-nums; }
#sta-workspace .sta-placed-legend i { display:inline-block; width:10px; height:10px; margin-right:4px; border-radius:50%; vertical-align:-1px; }
#sta-workspace .sta-placed p { margin:0 0 4px; }
#sta-placed.on { background:var(--accent); color:#fff; border-color:var(--accent); }
#sta-workspace .sta-cards figure.own { position:relative; }
#sta-workspace .sta-cards .own-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11px; color:var(--dim); }
#sta-workspace .sta-cards .own-swap { margin-left:6px; padding:0 8px; font-size:11px; line-height:18px; }
#sta-workspace .sta-cards .own-note { margin:2px 0 0; font-size:11px; line-height:1.35; }
#sta-workspace .sta-cards .sta-own-add { flex:none; width:192px; min-height:96px; box-sizing:border-box; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; padding:6px; border:1.5px dashed var(--line); border-radius:8px; background:transparent; color:var(--dim); cursor:pointer; font:inherit; }
#sta-workspace .sta-cards .sta-own-add b { font-size:22px; font-weight:400; line-height:1; }
#sta-workspace .sta-cards .sta-own-add:hover:not(:disabled) { border-color:var(--accent); color:var(--accent); }
#sta-workspace .sta-cards .sta-own-add:disabled { opacity:.5; cursor:not-allowed; }
/* the wall folded to one line while a review shows */
#sta-workspace .sta-wall-fold { display:block; width:100%; margin:4px 0 2px; padding:5px 8px; text-align:left; border:1px solid var(--line); border-radius:6px; background:var(--subtle); color:inherit; cursor:pointer; font:inherit; }
#sta-workspace .sta-wall-fold:hover { border-color:var(--accent); }
/* the particle review: only-on-shapes tick box and 再找一次 */
#sta-found .sta-found-shapes { display:flex; align-items:center; gap:6px; margin:6px 0 2px; cursor:pointer; }
#sta-found .sta-found-shapes[hidden] { display:none; }
#sta-found .sta-found-shapes input { margin:0; }
#sta-found .sta-found-again { align-items:baseline; flex-wrap:wrap; gap:4px 8px; }
#sta-found .link { padding:0; border:0; background:none; color:var(--accent); text-decoration:underline; cursor:pointer; font:inherit; }
#sta-found .link:disabled { opacity:.5; cursor:not-allowed; }
#sta-found .link[hidden] { display:none; }
#sta-workspace .sta-wall[hidden], #sta-workspace #sta-wall-count[hidden], #sta-workspace .sta-wall-fold[hidden] { display:none; }

/* Cryo-ET folder flow: the wall of series and the review of one. */
#cryo-session { padding:4px 0 10px; border-bottom:1px solid var(--line); }
#cryo-session .cs-folder .cs-path { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#cryo-session .cs-controls { flex-wrap:wrap; }
#cryo-session .cs-controls label { display:flex; align-items:center; gap:4px; color:var(--dim); font-size:11px; flex:1; min-width:0; }
#cryo-session .cs-controls select { flex:1; min-width:0; }
#cryo-session .cs-help { margin:8px 0; line-height:1.5; }
.cs-wall { display:grid; grid-template-columns:repeat(auto-fill, minmax(148px, 1fr)); gap:8px; margin-top:6px; }
.cs-wall > p { grid-column:1 / -1; line-height:1.6; }
.cs-tile { position:relative; display:flex; flex-direction:column; gap:3px; padding:6px; border:1px solid var(--line); border-radius:8px; background:var(--surface); cursor:pointer; min-width:0; font-size:11px; }
.cs-tile:hover { border-color:var(--line-strong); box-shadow:var(--shadow-sm); }
.cs-tile:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
.cs-tile.attn { border-color:#d4a72c; box-shadow:inset 3px 0 0 #d4a72c; }
.cs-tile.off .cs-pic { opacity:.5; }
.cs-pic { position:relative; aspect-ratio:1; border-radius:5px; background:#2a2d31; overflow:hidden; display:flex; align-items:center; justify-content:center; }
.cs-pic canvas, .cs-pic img { width:100%; height:100%; object-fit:contain; display:block; }
.cs-none { font-size:11px; }
.cs-pic .cs-none { color:#aab1b8; }
.cs-pic .cs-wait { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; pointer-events:none; }
.cs-take { position:absolute; left:4px; top:4px; display:flex; padding:2px; background:rgba(255,255,255,.9); border-radius:4px; cursor:pointer; }
.cs-take input { margin:0; cursor:pointer; }
.cs-nm { font-weight:600; font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cs-meta { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.cs-chip { padding:0 6px; border-radius:9px; background:var(--muted); color:var(--dim); line-height:16px; font-size:10.5px; white-space:nowrap; }
.cs-chip.run { background:#ddf4ff; color:#0550ae; }
.cs-chip.ok { background:#dafbe1; color:#1a7f37; }
.cs-verdict.ok { color:#1a7f37; } .cs-verdict.warn { color:#9a6700; } .cs-verdict.bad { color:#cf222e; }
.cs-err { color:#cf222e; overflow-wrap:anywhere; max-height:4.2em; overflow:hidden; }
.cs-tile .cs-reset { align-self:flex-start; margin-top:2px; }
.cs-rv-info { display:flex; flex-wrap:wrap; gap:4px 12px; margin:-2px 0 8px; }
.cs-tabs { display:flex; gap:2px; border-bottom:1px solid var(--line); margin-bottom:8px; }
.cs-tab { border-radius:6px 6px 0 0; border-color:transparent; }
.cs-tab.on { color:var(--accent); border-color:var(--line); border-bottom-color:var(--surface); background:var(--surface); margin-bottom:-1px; font-weight:600; }
.cs-tabbody p { line-height:1.6; margin:6px 0; }
.cs-summary { font-weight:600; font-variant-numeric:tabular-nums; }
.cs-views { display:grid; grid-template-columns:repeat(auto-fill, minmax(104px, 1fr)); gap:8px; }
.cs-view { display:flex; flex-direction:column; gap:2px; min-width:0; font-size:11px; padding:3px; border-radius:6px; border:1.5px solid transparent; }
.cs-vpic { position:relative; aspect-ratio:1; border-radius:4px; background:#2a2d31; overflow:hidden; display:flex; align-items:center; justify-content:center; cursor:pointer; }
.cs-vpic canvas { width:100%; height:100%; object-fit:contain; display:block; }
.cs-vpic .cs-none { color:#aab1b8; }
.cs-zoom { position:absolute; right:3px; top:3px; height:20px; padding:0 5px; }
.cs-vlab { display:flex; justify-content:space-between; gap:4px; font-variant-numeric:tabular-nums; }
.cs-vwhy { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-height:1.4em; }
.cs-vgive { align-self:flex-start; height:20px; font-size:11px; }
.cs-view.suggested { border-color:#cf222e; } .cs-view.suggested .cs-vpic { opacity:.45; } .cs-view.suggested .cs-vst, .cs-view.suggested .cs-vwhy { color:#cf222e; }
.cs-view.dropped { border-color:var(--line-strong); } .cs-view.dropped .cs-vpic { opacity:.3; } .cs-view.dropped .cs-vst { color:var(--dim); }
.cs-view.kept { border-color:#d4a72c; } .cs-view.kept .cs-vst, .cs-view.kept .cs-vwhy { color:#9a6700; }
.cs-view.used .cs-vst { color:#1a7f37; }
.cs-film { display:block; width:auto; max-width:100%; max-height:38vh; margin-left:auto; margin-right:auto; object-fit:contain; background:#000; border-radius:4px; margin-top:6px; }
.cs-filmctl { margin-top:6px; }
.cs-slider { flex:1; min-width:0; }
.cs-framelab { min-width:9em; text-align:right; font-variant-numeric:tabular-nums; }
.cs-aligntext { flex:1; font-variant-numeric:tabular-nums; }
.cs-bars { margin-top:10px; }
.cs-bars svg { display:block; width:100%; height:90px; background:var(--subtle); border:1px solid var(--line); border-radius:6px; }
.cs-bars rect { fill:#0969da; }
.cs-bars rect.ex { fill:#c4c9cf; }
.cs-bars rect.cur { fill:#cf222e; }
.cs-axis { display:flex; justify-content:space-between; gap:8px; font-size:11px; margin-top:2px; }
.cs-lightbox { position:fixed; inset:0; z-index:60; display:flex; align-items:center; justify-content:center; background:rgba(31,35,40,.55); }
.cs-lb-card { background:var(--surface); border-radius:10px; padding:10px; box-shadow:var(--shadow); max-width:min(820px, 94vw); max-height:94vh; display:flex; flex-direction:column; gap:6px; }
.cs-lb-card canvas { display:block; max-width:100%; max-height:74vh; object-fit:contain; background:#000; margin:0 auto; }

/* The docked 「正在处理」 pane: what is being processed, beside the image being looked at. */
#live-dock { position:absolute; left:10px; top:10px; z-index:8; width:300px; max-height:calc(100% - 20px); display:flex; flex-direction:column; gap:6px; padding:8px; box-sizing:border-box; border:1px solid var(--line); border-radius:10px; background:var(--surface); box-shadow:var(--shadow); font-size:12px; overflow:hidden; }
#stage:has(#tools:not([hidden])) #live-dock { left:calc(var(--tools-w, 288px) + 22px); }
#live-dock .ld-head { display:flex; align-items:center; gap:8px; }
#live-dock .ld-head b { white-space:nowrap; }
#live-dock .ld-text { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-variant-numeric:tabular-nums; }
#live-dock .ld-pic { margin:0; min-height:0; }
#live-dock canvas { display:block; width:100%; height:auto; max-height:46vh; object-fit:contain; background:#000; border-radius:4px; image-rendering:pixelated; }
#live-dock figcaption { margin-top:2px; font-size:11px; overflow-wrap:anywhere; }
#live-dock.folded .ld-pic { display:none; }
#live-dock.folded .ld-text { max-width:200px; }

/* The three jobs of the Cryo-ET panel (cryoet/jobs.js): tabs under its title. */
.ws-jobs { display:flex; gap:2px; margin:2px 0 10px; border-bottom:1px solid var(--line); }
.ws-jobs button { height:30px; padding:0 14px; border:0; border-bottom:2px solid transparent; border-radius:6px 6px 0 0; background:none; font-size:13px; color:var(--dim); }
.ws-jobs button:hover { background:var(--muted); }
.ws-jobs button.on { color:var(--accent); border-bottom-color:var(--accent); font-weight:600; }
#cryoet-workspace[data-job="recon"] #cryo-sta,
#cryoet-workspace[data-job="sta"] :is(#cryo-dataset, #cryo-export-box, #cryo-advanced, #cryo-session, #cryo-foot) { display:none; }
/* The 子断层平均 part scrolls with the whole panel, as 三维重构 does (no box of its own that scrolls). */
#cryo-sta { flex:none; display:flex; flex-direction:column; }
#sta-workspace.hosted .sta-wall { max-height:none !important; overflow:visible; }
#sta-workspace.hosted .ws-foot { position:sticky; bottom:-12px; z-index:2; display:flex; align-items:center; gap:8px; margin-top:8px; padding:8px 0 12px; border-top:1px solid var(--line); background:var(--surface); }
/* It floats: moved by its title, resized by its corners. */
#spa-workspace > .al-head { cursor:move; user-select:none; touch-action:none; }
#cryoet-workspace > .al-head { position:sticky; top:-12px; z-index:3; margin:-12px -12px 0; padding:12px 12px 6px; background:var(--surface); cursor:move; user-select:none; touch-action:none; }
#cryoet-workspace.narrow { width:min(360px, calc(100% - 20px)) !important; }
.ws-corner { position:fixed; z-index:61; width:16px; height:16px; touch-action:none; }
.ws-corner[hidden] { display:none; }
.ws-nw, .ws-se { cursor:nwse-resize; }
.ws-ne, .ws-sw { cursor:nesw-resize; }
.ws-corner::after { content:""; position:absolute; inset:4px; border:2px solid transparent; border-radius:3px; }
.ws-corner:hover::after, .ws-corner:active::after { border-color:var(--accent); }
/* What the reconstruction is for: three choices side by side. */
#cryo-session .cs-purpose-box { flex:1 1 100%; display:grid; grid-template-columns:repeat(2, 1fr); gap:6px; }
@media (max-width:520px) { #cryo-session .cs-purpose-box { grid-template-columns:1fr; } }
#cryo-session .cs-use { border:1px solid var(--line); border-radius:8px; background:var(--surface); display:flex; align-items:flex-start; gap:8px; padding:8px 10px; text-align:left; white-space:normal; line-height:1.4; cursor:pointer; }
#cryo-session .cs-use input { margin:2px 0 0; flex:none; }
#cryo-session .cs-use > span { display:flex; flex-direction:column; gap:3px; }
#cryo-session .cs-use > span > span { color:var(--dim); font-size:11px; font-weight:normal; }
#cryo-session .cs-use:has(input:checked) { border-color:var(--accent); background:color-mix(in srgb, var(--accent) 8%, var(--surface)); }
#cryo-session .cs-use:has(input:checked) b { color:var(--accent); }
#cryo-session .cs-steps-line { flex:1 1 100%; margin:0; }
#cryo-session .cs-bin { flex:1 1 100%; display:flex; align-items:center; gap:6px; font-size:13px; }
#cryo-session .cs-bin select { width:auto; flex:0 1 auto; max-width:100%; }
#live-dock.right, #stage:has(#tools:not([hidden])) #live-dock.right { left:auto; right:10px; }
/* Figure flow (figure.js): one panel on the right, over the 2D and the 3D view. */
#quickbar #btn-figure { width: auto; padding: 0 8px; gap: 5px; }
#fig-panel {
  position: absolute; top: 10px; bottom: 10px; right: 10px; z-index: 8; width: 300px;
  display: flex; flex-direction: column; gap: 10px; overflow: auto; padding: 12px; box-sizing: border-box;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); font-size: 12px;
}
#fig-panel[hidden], #fig-panel [hidden] { display: none; }
#fig-panel .fig-head { display: flex; align-items: center; justify-content: space-between; color: var(--accent); font-size: 13px; }
#fig-panel .fig-step { display: flex; flex-direction: column; gap: 7px; padding-top: 10px; border-top: 1px solid var(--line); }
#fig-panel .fig-step.off { opacity: 0.45; pointer-events: none; }
#fig-panel .fig-title { display: flex; align-items: center; gap: 7px; font-weight: 600; }
#fig-panel .fig-n { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; flex: none; }
#fig-panel p { margin: 0; line-height: 1.6; }
#fig-panel .fig-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#fig-panel .fig-row > button { flex: 1; justify-content: center; border: 1px solid var(--line-strong); white-space: nowrap; }
#fig-panel .fig-row > button.primary { border-color: var(--accent); }
#fig-panel .fig-row input[type="text"] { flex: 1; min-width: 0; }
#fig-list { display: flex; flex-direction: column; gap: 3px; }
#fig-list:empty { display: none; }
#fig-panel .fig-struct { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 7px; }
#fig-panel .fig-struct.on { border-color: var(--accent); background: var(--muted); }
#fig-panel .fig-sw { width: 13px; height: 13px; border-radius: 3px; flex: none; }
#fig-panel .fig-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
#fig-panel .fig-count { font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#fig-panel .fig-eye.off { color: var(--faint); }
#fig-panel .fig-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
#fig-panel .fig-chip { padding: 2px 7px 2px 5px; font-size: 11px; border: 1px solid var(--line-strong); border-radius: 5px; display: inline-flex; align-items: center; gap: 4px; }
#fig-panel .fig-chip::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--c); }
#fig-panel .fig-chip-other::before { display: none; }
#fig-panel .fig-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
#fig-panel .fig-thumbs:empty::before { content: "生成三维图以后，这里会画出三张小图给你挑"; grid-column: 1 / -1; color: var(--faint); }
#fig-panel .fig-thumb { display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 3px; height: auto; border: 2px solid var(--line); border-radius: 7px; font-size: 11px; }
#fig-panel .fig-thumb canvas { width: 100%; height: auto; border-radius: 4px; display: block; }
#fig-panel .fig-thumb span { text-align: center; }
#fig-panel .fig-thumb.on { border-color: var(--accent); color: var(--accent); }
#fig-panel .fig-check { display: flex; align-items: center; gap: 6px; color: var(--dim); }
#fig-panel .fig-slider { display: flex; align-items: center; gap: 6px; color: var(--dim); white-space: nowrap; }
#fig-panel .fig-slider input { flex: 1; min-width: 0; }
#fig-panel input[type="range"] { width: 100%; }
#fig-obj .vp-obj { display: flex; flex-direction: column; gap: 5px; padding: 6px; border: 1px solid var(--line-strong); border-radius: 6px; }
#fig-obj .vp-obj[hidden] { display: none; }
#fig-obj .vp-obj-name { display: flex; align-items: center; gap: 6px; font-weight: 600; }
#fig-obj .vp-classes { display: flex; flex-wrap: wrap; gap: 4px; }
#fig-obj .vp-class { padding: 2px 6px 2px 4px; font-size: 11px; border: 1px solid var(--line-strong); border-radius: 5px; display: inline-flex; align-items: center; gap: 4px; }
#fig-obj .vp-class::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--c); }
#fig-obj .vp-class.on { border-color: var(--accent); color: var(--accent); }
#fig-obj .vp-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
#fig-obj .vp-row { display: flex; gap: 6px; }
#fig-obj .vp-row button { flex: 1; justify-content: center; border: 1px solid var(--line-strong); }
#fig-panel .fig-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); }
#fig-status { flex: 1; min-height: 1.5em; word-break: break-all; }
#fig-scalebar { position: absolute; bottom: 24px; z-index: 6; display: flex; flex-direction: column; align-items: center; gap: 3px; color: #000; font-size: 13px; font-weight: 600; pointer-events: none; }
#fig-scalebar[hidden] { display: none; }
#fig-scalebar i { display: block; height: 4px; background: currentColor; }
#fig-scalebar.dark { color: #fff; }

.cs-preview-box{position:relative;display:flex;justify-content:center;align-items:center;min-height:160px;border:1px solid var(--line);background:var(--subtle);border-radius:6px;margin-top:8px;overflow:hidden}.cs-preview-box .cs-film{margin:0}.cs-preview-state{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:20px;background:var(--subtle);color:var(--dim);text-align:center;overflow-wrap:anywhere}.cs-filmctl{flex-wrap:wrap;position:relative;padding:6px 0}.cs-framelab{white-space:normal;overflow-wrap:anywhere}.cs-discovery{overflow-wrap:anywhere;max-width:100%}

/* Review selection and previews retain their state while tabs are hidden. */
.cs-selection{flex-wrap:wrap;gap:6px;margin:8px 0}.cs-search{flex:1;min-width:180px}.cs-selection-count{font-variant-numeric:tabular-nums}.cs-tile.selected{border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)}.cs-tile .cs-open{align-self:flex-start;margin-top:4px}.cs-take{cursor:pointer}.cs-tabbody[hidden],.cs-lb-loading[hidden],.cs-thumb-state[hidden],.cs-lb-placeholder[hidden],.cs-vpic canvas[hidden],.cs-lb-card canvas[hidden]{display:none!important}
.cs-review-loading,.cs-thumbs-loading,.cs-lb-loading{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:10px 0}.cs-thumbs-loading progress{width:120px}.cs-thumb-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:8px;text-align:center;color:var(--dim);background:var(--subtle);position:absolute;inset:0}.cs-view.suggested .cs-vpic,.cs-view.dropped .cs-vpic{opacity:1}.cs-view.suggested .cs-vpic canvas{opacity:.45}.cs-view.dropped .cs-vpic canvas{opacity:.3}.cs-lb-placeholder{width:320px;min-height:220px;display:flex;align-items:center;justify-content:center;background:var(--subtle);color:var(--dim)}.cs-lb-loading{max-width:600px;overflow-wrap:anywhere}.cs-lb-loading progress{width:120px}
.cs-tile[hidden]{display:none!important}#cryo-session.reviewing .cs-selection{display:none}
/* 停止 is at the top (运行位置 line); 继续 and 重置 are on each series' card, 重置 asked once more there. */
#cryo-cancel { display:none !important; }
#cryo-session .cs-card-acts { display:flex; flex-wrap:wrap; gap:4px; margin-top:6px; }
#cryo-session .cs-card-acts.asking { flex-direction:column; align-items:stretch; padding:6px 8px; border:1px solid #d1242f; border-radius:8px; background:color-mix(in srgb, #d1242f 6%, var(--surface)); }
#cryo-session .cs-card-acts.asking p { margin:0 0 4px; font-size:12px; line-height:1.5; }
#cryo-session .cs-reset-go { color:#fff; background:#d1242f; border-color:#d1242f; }
/* 漂移校正 and 缺失楔补偿 are steps of the one Cryo-ET panel now: no buttons of their own in the toolbar. */
#quickbar #btn-align, #quickbar #btn-wedge { display:none !important; }
/* Series cards: one line per fact, buttons at the bottom of every card. */
#cryo-session .cs-tile .cs-line { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; line-height:1.45; }
#cryo-session .cs-tile .cs-chip.cs-verdict.ok { background:#dafbe1; color:#1a7f37; }
#cryo-session .cs-tile .cs-chip.cs-verdict.warn { background:#fff8c5; color:#9a6700; }
#cryo-session .cs-tile .cs-chip.cs-verdict.bad { background:#ffebe9; color:#cf222e; }
#cryo-session .cs-tile .cs-card-acts { margin-top:auto; padding-top:6px; display:flex; gap:4px; align-items:center; }
#cryo-session .cs-tile .cs-card-acts .cs-open { margin:0; }
#cryo-session .cs-tile .cs-card-acts .cs-reset { margin:0 0 0 auto; color:var(--dim); border-color:transparent; background:transparent; }
#cryo-session .cs-tile .cs-card-acts .cs-reset:hover { color:#cf222e; border-color:#cf222e; }
dialog.cs-ask { max-width:380px; border:1px solid var(--line); border-radius:10px; padding:16px 18px; background:var(--surface); color:var(--text, inherit); box-shadow:0 10px 30px rgba(0,0,0,.2); }
dialog.cs-ask::backdrop { background:rgba(0,0,0,.25); }
dialog.cs-ask h3 { margin:0 0 8px; font-size:15px; }
dialog.cs-ask p { margin:0 0 14px; font-size:13px; line-height:1.6; }
dialog.cs-ask .cs-ask-row { display:flex; justify-content:flex-end; gap:8px; }
dialog.cs-ask .danger { background:#cf222e; border-color:#cf222e; color:#fff; }
/* STA: label layers to tick (sta/layers.js) and the optional automatic cards. */
#sta-layers .sta-teach { margin:4px 0 8px; padding-left:18px; }
#sta-layers .sta-teach li { margin:2px 0; }
#sta-layers .sta-layers { display:flex; flex-direction:column; gap:6px; }
#sta-layers .sta-layer-item { padding:6px 8px; border:1px solid var(--line); border-radius:6px; }
#sta-layers .sta-layer-item .al-row { justify-content:space-between; margin:0 0 4px; }
#sta-layers .sta-layer { display:flex; align-items:center; gap:6px; padding:2px 0; cursor:pointer; }
#sta-layers .sta-layer-dot { width:10px; height:10px; border-radius:50%; background:var(--muted); flex:none; }
#sta-auto-box { margin-top:10px; }
#sta-auto-box > summary { cursor:pointer; color:var(--dim, inherit); }
/* SPA: picking by example (spa/examples.js). */
#spa-ex .spa-teach { margin:4px 0 8px; padding-left:18px; }
#spa-ex .spa-ex-layers { display:flex; flex-direction:column; gap:2px; margin:6px 0; }
#spa-ex .sta-layer { display:flex; align-items:center; gap:6px; cursor:pointer; }
#spa-ex .sta-layer-dot { width:10px; height:10px; border-radius:50%; background:var(--muted); flex:none; }
#spa-ex .spa-ex-view canvas { display:block; width:100%; height:auto; cursor:crosshair; border-radius:6px; }
#spa-ex .spa-ex-nav { align-items:center; gap:8px; }
#spa-ex .spa-ex-cut { display:flex; align-items:center; gap:8px; }
#spa-ex .spa-ex-cut input { flex:1; }
#spa-a-autobox { margin-top:12px; }
#spa-a-autobox > summary { cursor:pointer; }
/* The panel scrolls as a whole: its parts keep their height (a flex column shrank them and the
   advanced summary ran over the status line), and the status line stays at the bottom. */
#spa-workspace > * { flex-shrink:0; }
#spa-workspace > .ws-foot { position:sticky; bottom:-12px; margin-bottom:-12px; padding-bottom:12px; background:var(--surface); z-index:1; }
