.s2d {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px) 300px; gap: 12px;
  padding: 12px; max-width: 1700px; margin: 0 auto; align-items: start;
}
.view-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; position: sticky; top: 56px; }
.view-wrap { width: 100%; max-width: calc(100vh - 110px); aspect-ratio: 1; margin: 0 auto; background: #000; border-radius: var(--radius); overflow: hidden; }
.view-wrap canvas { width: 100%; height: 100%; }
/* The one-line hint under the picture, as wide as the picture. */
.view-col .hint { max-width: calc(100vh - 110px); margin: 0 auto; width: 100%; }
.readouts { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--ink-2); max-width: calc(100vh - 110px); margin: 0 auto; width: 100%; }
.readouts b { color: var(--ink); }
/* Fixed slots (widths in ch, set with the numbers' fixed decimals): nothing moves as they change. */
.readouts .ro { white-space: nowrap; }
.readouts .ro b { display: inline-block; text-align: right; }
.readouts .status { min-width: 26ch; }
/* A gloss under a panel's title. */
.panel-gloss { color: var(--ink-3); font-size: 12px; margin-top: -2px; }
.readouts .warning { flex-basis: 100%; color: var(--warn); }
.analysis { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.analysis .panel { display: flex; flex-direction: column; gap: 4px; padding: 8px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.mom-wrap { aspect-ratio: 1; background: #000; border-radius: 6px; overflow: hidden; }
.mom-wrap canvas, .xs-wrap canvas, .pw-wrap canvas { width: 100%; height: 100%; }
.mom-wrap canvas { cursor: crosshair; }
/* The momentum transfer at the chosen angle: fixed slots, wrapping only between groups. */
#q-readout { color: var(--ink-2); line-height: 1.35; }
.xs-wrap { height: 230px; }
.pw-wrap { height: 120px; }
#xs-legend { gap: 10px; }
#xs-legend span { white-space: nowrap; }
#xs-legend i { display: inline-block; width: 16px; border-top: 2px solid; vertical-align: middle; margin-right: 3px; }
.sigmas { width: 100%; border-collapse: collapse; }
.sigmas td { padding: 1px 4px; }
.sigmas td:nth-child(2) { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; width: 11ch; white-space: nowrap; }
.controls { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.controls .panel { display: flex; flex-direction: column; gap: 6px; }
.button-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.button-grid button { padding: 3px 4px; font-size: 13px; }
details.panel summary { cursor: pointer; }
@media (max-width: 1300px) {
  .s2d { grid-template-columns: minmax(0, 1fr) 320px; }
  .analysis { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
  .view-col { position: static; }
}
@media (max-width: 800px) {
  .s2d { grid-template-columns: minmax(0, 1fr); }
  .view-wrap, .readouts, .view-col .hint { max-width: 100%; }
}
