/* Copyright (c) 2026 VoxVain. All rights reserved. Proprietary and confidential. */
/* Phone layout for the Pro Studio booth (2026-11-02).
   Landscape phones (~844x390, 932x430) and portrait phones: the one-screen desktop grid
   becomes a vertically scrolling, full-width stack. No horizontal scroll, nothing clipped,
   every control at least 44px. Desktop is untouched. */
@media (max-width: 1024px) and (max-height: 540px), (max-width: 760px) {
  html, body { overflow-x: hidden !important; max-width: 100vw; }
  html body .booth-stage {
    overflow-x: hidden !important; overflow-y: auto !important;
    -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  }
  html body .shell, html body .shell.has-transport {
    display: flex !important; flex-direction: column; gap: 8px;
    width: 100% !important; min-width: 0 !important; max-width: 100% !important;
    height: auto !important; min-height: 100%;
    padding: 8px max(8px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)) !important;
  }
  html body .shell > * { min-width: 0 !important; max-width: 100% !important; width: 100% !important; flex: 0 0 auto; }

  /* Header: wrap, keep every button reachable */
  html body .top { flex-wrap: wrap !important; height: auto !important; padding: 6px 8px !important; gap: 6px !important; overflow: visible !important; }
  html body .top .mesh-live, html body .top .subject-bar, html body .top .badge-chip, html body .top .booth-tag { display: none !important; }
  html body .top .brand { flex: 1 1 auto; min-width: 0; }
  html body .top .brand h1 { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html body .top .top-right {
    margin-left: auto; display: flex !important; flex-wrap: wrap !important; gap: 6px !important;
    overflow: visible !important; flex-shrink: 1 !important; min-width: 0; justify-content: flex-end; max-width: 100%;
  }
  html body .top .top-right > * { flex-shrink: 1 !important; min-width: 0; max-width: 100%; }
  html body #sampleSelect { max-width: 100%; width: auto; }

  /* Upper panes: 6-col grid in landscape, real heights instead of fr rows */
  html body .upper {
    display: grid !important; grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    grid-template-rows: none !important; grid-auto-rows: auto; gap: 8px !important; height: auto !important;
  }
  html body #pane-spectrum  { grid-column: 1 / span 3 !important; grid-row: auto !important; height: 170px; }
  html body #pane-waveform  { grid-column: 4 / span 3 !important; grid-row: auto !important; height: 170px; }
  html body #pane-meters    { grid-column: 1 / span 2 !important; grid-row: auto !important; min-height: 150px; }
  html body #pane-school    { grid-column: 3 / span 2 !important; grid-row: auto !important; min-height: 150px; }
  html body #pane-compare   { grid-column: 5 / span 2 !important; grid-row: auto !important; min-height: 150px; }
  html body #pane-character { grid-column: 1 / span 6 !important; grid-row: auto !important; min-height: 220px; }
  html body .upper .pane { min-width: 0; overflow: hidden; }

  /* Knob dock: knobs wrap, master rail moves below */
  html body .dock { display: flex !important; flex-direction: column; height: auto !important; gap: 8px !important; }
  html body .dock-main { width: 100%; }
  html body .dock-head { flex-wrap: wrap; }
  html body .strips { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)) !important; grid-auto-rows: auto; height: auto !important; }
  html body .strip { min-height: 150px; }
  html body .master { width: 100% !important; display: grid !important; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: center; gap: 8px !important; }

  /* Transport */
  html body .vv-transport { flex-wrap: wrap !important; height: auto !important; }
  html body .vv-transport .vt-mid { min-width: 0 !important; flex: 1 1 240px !important; }

  /* Footer machine row */
  html body .bottom { flex-wrap: wrap !important; height: auto !important; padding: 8px !important; gap: 8px !important; }
  html body .mach-row { flex-wrap: wrap !important; margin-left: 0 !important; width: 100%; }
  html body .mach { flex: 1 1 140px; min-height: 44px; flex-wrap: wrap; }
  html body .bottom-meta, html body .wer-chip { margin-left: 0 !important; }

  /* Touch targets: at least 44px */
  html body .booth-stage :is(button, select, .btn, [role="button"], summary, input:not([type="range"]):not([type="hidden"]):not([type="checkbox"]):not([type="radio"])) {
    min-height: 44px !important; min-width: 44px !important;
  }
  html body .booth-stage input[type="range"] { min-height: 44px !important; }
  html body .booth-stage :is(input[type="checkbox"], input[type="radio"]) { width: 24px; height: 24px; margin: 10px; }
  html body .mode-btn, html body .theme-toggle { height: 44px !important; padding: 0 12px !important; font-size: 12px !important; }

  /* Guide panel never wider than the screen */
  html body .booth-guide-panel { max-width: 100vw !important; }
  html body .booth-guide-panel button { min-height: 44px; min-width: 44px; }
}
/* Portrait phones: single column panes */
@media (max-width: 600px) {
  html body .upper { grid-template-columns: minmax(0, 1fr) !important; }
  html body .upper > .pane,
  html body #pane-spectrum, html body #pane-waveform, html body #pane-meters,
  html body #pane-school, html body #pane-compare, html body #pane-character { grid-column: 1 / -1 !important; }
  html body #pane-meters { min-height: 300px; }
}
@media (max-width: 760px) {
  /* keep room for the fixed bottom transport bar */
  html body .shell.has-transport { padding-bottom: calc(140px + env(safe-area-inset-bottom)) !important; }
  html body .strips { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 1024px) and (max-height: 540px), (max-width: 760px) {
  html body .compare-body, html body .compare-card, html body .compare-body > * { min-width: 0 !important; max-width: 100% !important; box-sizing: border-box; }
  html body .compare-body .c-bars, html body .compare-body .c-bar-row, html body .compare-body .who-row, html body .compare-body .score { min-width: 0 !important; max-width: 100% !important; }
}
