/* --------------------------------------------------------------------------
   Responsive Adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 680px) {
  #app {
    padding: 0;
    height: 100dvh;
  }

  .scroll-container {
    padding-top: 0;
  }

  .top-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 6px 10px;
    background: transparent !important;
    border-bottom: none !important;
    box-shadow: none !important;
    gap: 6px;
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .brand h1 {
    font-size: 1.15rem;
  }

  .device-selectors {
    width: 100%;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
    margin-left: 0;
  }

  .header-controls-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }

  .header-playback-bar {
    position: relative;
    top: auto;
    left: auto;
    align-self: flex-start;
    margin-top: 14px;
    margin-left: 2px;
    flex-wrap: wrap;
    max-width: 100%;
  }

  .header-pro-row {
    flex-wrap: wrap;
    gap: 6px;
    max-width: 100%;
  }

  .device-group {
    flex: 0 0 auto;
    padding: 2px 6px;
    min-height: 25px;
  }

  .audio-device-group {
    position: relative;
    width: 30px;
    height: 27px;
    padding: 0;
    justify-content: center;
  }

  .audio-device-group .device-select {
    position: absolute;
    inset: 0;
    width: 100%;
    max-width: none;
    opacity: 0;
    padding: 0;
    cursor: pointer;
  }

  .device-select {
    width: 80px;
    max-width: 80px;
    flex: 0 0 auto;
    font-size: 0.72rem;
  }

  .stage-center {
    flex: 1;
    padding: 4px 6px;
    min-height: 0;
    width: 100%;
  }

  .looper-grid {
    width: 100%;
    min-height: 480px;
    position: relative;
    overflow: visible;
  }

  .track-controls {
    margin-top: 4px;
    gap: 6px;
    padding: 0;
  }

  .track-pill-btn {
    min-width: 26px;
    height: 22px;
    padding: 0 5px;
    font-size: 0.68rem;
  }

  .bottom-bar {
    height: 56px;
    padding: 6px 10px;
    gap: 8px;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: transparent;
    border-top: none;
    flex-shrink: 0;
    z-index: 20;
    box-shadow: none;
  }

  /* Mobile floating Download WAV container (Aligned to left above timeline start) */
  .export-container {
    position: absolute;
    bottom: 60px;
    left: var(--timeline-start, 14px);
    right: auto;
    transform: none;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 6px;
    width: auto;
    max-width: calc(100vw - 28px);
  }

  .export-banner {
    padding: 5px 10px;
    font-size: 0.72rem;
  }

  .export-banner.visible {
    animation: popUpWavElastic 1.92s cubic-bezier(0.25, 1.25, 0.5, 1) forwards;
  }

  .btn-master-rec {
    height: 32px;
    padding: 0 10px;
    font-size: 0.74rem;
  }

  .btn-master-aux {
    width: 32px;
    height: 32px;
  }

  .master-visualizer-container {
    height: 36px;
  }

  #master-idle-waveform {
    height: 36px;
  }

  .latency-card,
  .reverb-card,
  .settings-card {
    padding: 16px 14px;
    max-width: 95vw;
  }
}

@media (max-height: 520px), (orientation: landscape) and (max-width: 950px) {
  .top-bar {
    flex-wrap: wrap;
    gap: 6px 12px;
  }

  .latency-label-prefix,
  .align-btn-label,
  .tools-btn-label,
  .voicings-btn-label {
    display: none !important;
  }

  .brand {
    min-width: 200px;
    flex-shrink: 0;
    white-space: nowrap;
  }

  .device-selectors {
    flex: 1 1 auto;
  }

  .header-controls-row {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .header-playback-bar {
    position: relative;
    top: auto;
    left: auto;
    align-self: flex-start;
    margin-top: 12px;
    margin-left: 2px;
    flex-wrap: wrap;
    max-width: 100%;
  }
}
