/* Sound sheet v1 - the open sound library on landscape screens (Tesla browser,
   desktop). Before: the library opened inside the fixed bottom HUD, which
   became one scrolling box with the speedometer and RPM panel in it, so the
   gauges were clipped and the list ran off the bottom of the screen.
   Now: a tall sheet between the scene picker and the screen edge, scrolling on
   its own with the heading pinned, 3-4 sounds per row; the gauges step aside
   while choosing. Phones and the iOS app (.native-cockpit) are untouched. */
@media (orientation: landscape) and (min-width: 760px) and (min-height: 520px) {
  body.sound-library-open:not(.native-cockpit) .speed-hud {
    top: 88px !important; bottom: 16px !important; height: auto !important; max-height: none !important;
    width: min(1060px, calc(100vw - 40px)) !important; max-width: none !important;
    display: flex !important; flex-direction: column !important;
    overflow: hidden !important; z-index: 45 !important; padding: 0 !important;
  }
  /* the gauges step aside while choosing */
  body.sound-library-open:not(.native-cockpit) .speed-hud .drive-center-stack,
  body.sound-library-open:not(.native-cockpit) .speed-hud .rpm-panel,
  body.sound-library-open:not(.native-cockpit) .speed-hud .racing-signature,
  body.sound-library-open:not(.native-cockpit) .speed-hud .speed-hud-side:not(.soundboard) { display: none !important; }

  body.sound-library-open:not(.native-cockpit) .speed-hud .soundboard {
    flex: 1 1 auto !important; min-height: 0 !important; width: 100% !important;
    overflow-y: auto !important; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding: 0 24px 22px !important; border-radius: 24px !important;
    background: rgba(10, 15, 22, .94) !important;
    border: 1px solid rgba(170, 200, 230, .16) !important;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .55) !important;
    scrollbar-width: thin; scrollbar-color: rgba(170, 200, 230, .3) transparent;
  }
  body.sound-library-open:not(.native-cockpit) .speed-hud .soundboard > .hud-side-title,
  body.sound-library-open:not(.native-cockpit) .speed-hud .soundboard > .voice-row { display: none !important; }

  /* heading stays put while the list scrolls */
  body.sound-library-open:not(.native-cockpit) #soundLibrary .sl-heading {
    position: sticky; top: 0; z-index: 3;
    margin: 0 -24px 6px; padding: 18px 24px 14px;
    background: linear-gradient(rgba(10, 15, 22, .98) 80%, rgba(10, 15, 22, 0));
  }
  body.sound-library-open:not(.native-cockpit) #soundLibrary .sl-grid {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)) !important;
  }
  /* dim the scene behind the sheet so the list is the focus */
  body.sound-library-open:not(.native-cockpit)::after {
    content: ''; position: fixed; inset: 0; z-index: 44; pointer-events: none;
    background: rgba(3, 6, 10, .5);
  }
}
/* shorter in-car windows: start the sheet a little higher */
@media (orientation: landscape) and (min-width: 760px) and (min-height: 520px) and (max-height: 680px) {
  body.sound-library-open:not(.native-cockpit) .speed-hud { top: 76px !important; bottom: 10px !important; }
}
/* Model 3/Y-sized windows: the closed HUD's left card sat over the sidebar's
   "© · Terms" line. Nudge the HUD right just at these widths. */
@media (orientation: landscape) and (min-width: 1100px) and (max-width: 1260px) and (min-height: 520px) {
  body:not(.sound-library-open):not(.native-cockpit) .speed-hud { margin-left: 40px !important; }
}
