/* Mobile refinements only: retain every control and its existing order. */
.compare-page .vehicle-picker-scroll { display: contents; }
.compare-page .vehicle-picker-scroll > .legend {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 5px; margin: 0; font-size: 10px; color: var(--ink);
}
.compare-page .vehicle-specs { padding: 0; border: 0; }
.compare-page .vehicle-specs > summary { display: none; }
@media (max-width: 760px) {
  /* Expand the whole picker in page flow; no nested scroll region. */
  .compare-page .workspace { min-width: 0; max-width: 100%; }
  .compare-page .mobile-controls-toggle { width: 100%; min-width: 0; }
  .compare-page .workspace > .comparison-sidebar {
    /* Keep both cards and Randomize in one full-height column. */
    flex-direction: column; flex-wrap: nowrap; align-items: stretch;
    position: static; top: auto; height: auto; flex: none;
    left: 0; right: 0; transform: none; width: 100%; max-width: 100%; min-width: 0;
    max-height: none; overflow: visible;
    contain: inline-size; overflow-anchor: none;
  }
  .compare-page .workspace > .comparison-sidebar > * { flex-shrink: 0; min-width: 0; max-width: 100%; }
  .compare-page .workspace > .comparison-sidebar > .vehicle-picker-scroll {
    display: contents; max-height: none; overflow: visible;
  }
  .compare-page .comparison-sidebar > .randomize-vehicles {
    position: static; align-self: stretch; width: 100%; min-height: 44px;
    margin: 0; flex: 0 0 auto;
  }
  /* Keep the important fields visible; optional notes expand on request. */
  .compare-page .workspace > .comparison-sidebar { padding: 8px; gap: 6px; }
  .compare-page .selection-topline { margin-bottom: 6px; font-size: 10px; }
  .compare-page .selection-topline button { min-height: 28px; padding: 2px 4px; }
  .compare-page .selector { gap: 6px; }
  .compare-page .vehicle-card { padding: 7px 8px; }
  .compare-page .card-head { margin-bottom: 4px; }
  .compare-page .card-head b { font-size: 12px; }
  .compare-page .card-head .tag { font-size: 9px; padding: 3px 5px; }
  .compare-page .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 7px; }
  .compare-page .filters .field { font-size: 10px; gap: 2px; }
  .compare-page .filters .field:first-child { grid-column: auto; }
  .compare-page .filters .version-field { grid-column: 1 / -1; }
  .compare-page .filters select { min-height: 44px; padding: 4px 6px; }
  .compare-page .selector .swap { padding: 3px 10px; min-height: 30px; font-size: 12px; }
  .compare-page .vehicle-specs { margin-top: 2px; }
  .compare-page .vehicle-specs > summary {
    display: list-item; min-height: 28px; padding: 5px 0;
    font-size: 11px; line-height: 18px; color: var(--green);
  }
  .compare-page .vehicle-specs .card-meta { font-size: 11px; line-height: 1.4; margin: 3px 0 5px; }
  .compare-page .selection-actions { margin-top: 0; }
  .compare-page .selection-actions button { min-height: 28px; font-size: 11px; padding: 2px 3px; }
  .compare-page .vehicle-picker-scroll > .legend, .compare-page .comparison-sidebar > .sidebar-note { display: none; }
  .compare-page .filters .field { min-width: 0; }
  .compare-page .filters select { min-width: 0; max-width: 100%; font-size: 16px; }
  /* Avoid filtering the complete SVG/image layer whenever the picker opens. */
  .compare-page .workspace.mobile-controls-open .square-canvas { filter: none; }
  .compare-page .drawing.square-canvas { width: 100%; max-width: none; height: auto; aspect-ratio: auto; }
  .compare-page .stage-area { flex: none; height: clamp(300px, calc(100vw - 24px), 520px); width: 100%; }
  /* Reserve a strip for units/status, rather than placing them over the cars. */
  .compare-page .square-canvas .stage-scroll { inset: 34px 0 25px; width: 100%; max-width: none; min-height: 0; height: auto; margin: 0; padding: 0; }
  .compare-page .square-canvas #stage { width: 100%; height: 100%; }
  .compare-page .canvas-meta { top: 5px; left: 7px; right: 75px; max-width: none; width: auto; height: 24px; display: flex; align-items: center; gap: 6px; }
  .compare-page .stage-units.units { order: 0; flex: none; width: 49px; height: 24px; padding: 0; border-radius: 5px; }
  .compare-page .stage-units.units select { width: 47px; max-width: 47px; height: 22px; padding: 0 2px; font-size: 10px; }
  .compare-page .square-canvas .layer-status { order: 1; flex: 1; min-width: 0; width: auto; height: auto; padding: 0; border: 0; background: none; color: var(--canvas-ink); font-size: 8px; line-height: 1.25; white-space: normal; }
  .compare-page .square-canvas .stage-heading { top: 11px; right: 7px; font-size: 8px; }
  .compare-page .canvas-footer { inset: auto 7px 7px; font-size: 8px; line-height: 1.3; }
  .compare-page .canvas-top-controls { padding: 5px 7px; gap: 3px 5px; }
  .compare-page .canvas-top-controls .views button { min-height: 28px; padding: 3px 5px; font-size: 10px; }
  .compare-page .canvas-display-tools .tools { gap: 3px 6px; }
  .compare-page .canvas-display-tools .tools > label { min-height: 28px; padding: 3px 4px; }
  .compare-page .position-controls { gap: 4px; }
  .compare-page .position-buttons button { min-height: 28px; padding: 3px 4px; }
  .compare-page .spacing-control { gap: 4px; font-size: 9px; }
  .compare-page .spacing-control button { min-height: 28px; padding: 3px 6px; }
  .compare-page .scene-controls, .compare-page .zoom-controls { align-self: center; }
  .compare-page .creator-note { margin-top: 10px; padding: 10px 12px; }
}
