/* SENSIK AUDIO LIST FOUR ROWS PATCH START
   Additive-only patch: desktop library shows four complete tracks, not two.
   Does not modify the generator form, player logic, payment, or worker code.
*/
@media (min-width: 1051px) {
  #studio-workspace .generator-layout {
    align-items: stretch !important;
  }

  #studio-workspace .music-panel {
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    align-self: stretch !important;
    height: min(800px, calc(100dvh - 42px)) !important;
    min-height: 680px !important;
    max-height: 860px !important;
    overflow: hidden !important;
  }

  #studio-workspace .music-panel > .music-header {
    flex: 0 0 auto !important;
  }

  #studio-workspace .music-panel > .hero-player-area {
    box-sizing: border-box !important;
    flex: 1 1 310px !important;
    min-height: 310px !important;
    padding: 10px 14px !important;
    gap: 6px !important;
  }

  #studio-workspace .music-panel .cf-carousel {
    flex: 0 0 170px !important;
    height: 170px !important;
  }

  #studio-workspace .music-panel .cf-card {
    width: clamp(126px, 12vw, 170px) !important;
    height: clamp(140px, 12vw, 170px) !important;
    border-radius: 15px !important;
  }

  #studio-workspace .music-panel .hero-title {
    margin: 0 0 4px !important;
    font-size: 15px !important;
  }

  #studio-workspace .music-panel .hero-tags {
    gap: 5px !important;
    margin-bottom: 6px !important;
  }

  #studio-workspace .music-panel .hero-progress-bar {
    margin: 5px 0 !important;
  }

  #studio-workspace .music-panel .hero-buttons {
    gap: 12px !important;
  }

  #studio-workspace .music-panel .h-play-btn {
    width: 38px !important;
    height: 38px !important;
    font-size: 15px !important;
  }

  #studio-workspace .music-panel > .music-feed {
    box-sizing: border-box !important;
    flex: 0 0 304px !important;
    height: 304px !important;
    min-height: 0 !important;
    max-height: 304px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    scrollbar-gutter: stable !important;
  }

  #studio-workspace .music-panel .list-item {
    grid-template-columns: 54px minmax(0, 1fr) 0 104px !important;
    grid-template-areas: "thumb info equalizer actions" !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 7px 10px !important;
    margin: 0 0 6px !important;
    min-height: 0 !important;
  }

  #studio-workspace .music-panel .li-thumb-play {
    width: 54px !important;
    height: 54px !important;
    border-radius: 12px !important;
  }

  #studio-workspace .music-panel .li-icon-btn {
    width: 29px !important;
    height: 29px !important;
  }

  #studio-workspace .music-panel .li-actions-right {
    gap: 4px !important;
    flex-wrap: nowrap !important;
  }

  #studio-workspace .music-panel > .music-pagination {
    flex: 0 0 auto !important;
  }

  /* Keep the empty-library state spacious when there is no selected history. */
  #studio-workspace .music-panel > #heroPlayerArea[style*="display:none"] + .music-feed {
    flex: 1 1 auto !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
  }
}
/* SENSIK AUDIO LIST FOUR ROWS PATCH END */

/* SENSIK VIEWPORT FIT PATCH: prevent panel clipping and keep the form scroll clear of the action bar. */
@media (min-width: 1051px) {
  #studio-workspace .generator-layout {
    height: calc(100dvh - 18px) !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 18px) !important;
    box-sizing: border-box !important;
    align-items: stretch !important;
    padding-top: 8px !important;
    padding-bottom: 8px !important;
  }

  #studio-workspace .control-console,
  #studio-workspace .music-panel {
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    box-sizing: border-box !important;
  }

  #studio-workspace .control-console {
    padding: 14px !important;
    gap: 0 !important;
  }

  #studio-workspace #mainFormContainer:not([style*="display: none"]) {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    padding: 0 5px 18px 0 !important;
    scroll-padding-bottom: 18px !important;
    overscroll-behavior-y: contain !important;
  }

  #studio-workspace #mainFormContainer .ace-card {
    margin-bottom: 10px !important;
    padding: 12px !important;
  }

  #studio-workspace #mainFormContainer textarea.rcs-textarea {
    min-height: 86px !important;
  }

  #studio-workspace .action-row {
    position: relative !important;
    bottom: auto !important;
    margin-top: 8px !important;
    padding: 8px !important;
    box-shadow: 0 -5px 18px rgba(0,0,0,.16) !important;
  }

  #studio-workspace .action-row #btnGenerate {
    min-height: 44px !important;
  }

  #studio-workspace .music-panel > .hero-player-area {
    flex: 1 1 0% !important;
    min-height: 250px !important;
    max-height: none !important;
    overflow: hidden !important;
  }

  #studio-workspace .music-panel .cf-carousel {
    flex-basis: 145px !important;
    height: 145px !important;
  }

  #studio-workspace .music-panel .cf-card {
    height: clamp(122px, 10.5vw, 158px) !important;
  }

  #studio-workspace .music-panel > .music-feed {
    flex: 0 1 304px !important;
    min-height: 180px !important;
    max-height: 304px !important;
  }
}

@media (min-width: 1051px) and (max-height: 850px) {
  #studio-workspace .music-panel > .hero-player-area {
    min-height: 230px !important;
  }
  #studio-workspace .music-panel .cf-carousel {
    flex-basis: 128px !important;
    height: 128px !important;
  }
  #studio-workspace .music-panel .hero-controls-area {
    gap: 2px !important;
  }
  #studio-workspace .music-panel .hero-tags {
    margin-bottom: 3px !important;
  }
  #studio-workspace .music-panel .hero-progress-bar {
    margin: 3px 0 !important;
  }
}
