/* SENSIK mobile/tablet header and natural document scroll fixes.
   Loaded last so it overrides older viewport rules without changing desktop UI. */
@media (max-width: 900px) {
  .snv-nav-wrap { width: 100% !important; min-width: 0 !important; }
  .snv-container.snv-nav {
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) 84px !important;
    grid-template-areas: "menu brand actions" !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 8px 12px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }
  .snv-mobile-menu-toggle {
    grid-area: menu !important;
    display: inline-grid !important;
    place-items: center !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    border: 1px solid rgba(73, 245, 213, .32) !important;
    border-radius: 12px !important;
    background: #0b1a24 !important;
    color: #61f4df !important;
    font-size: 22px !important;
    line-height: 1 !important;
    box-shadow: none !important;
  }
  .snv-nav-links { display: none !important; }
  .snv-brand {
    grid-area: brand !important;
    justify-self: center !important;
    min-width: 0 !important;
    max-width: 100% !important;
    gap: 7px !important;
    font-size: 12px !important;
    line-height: 1.1 !important;
    letter-spacing: .04em !important;
    white-space: nowrap !important;
  }
  .snv-brand-mark {
    flex: 0 0 34px !important;
    width: 34px !important;
    height: 34px !important;
    display: grid !important;
    place-items: center !important;
  }
  .snv-brand small { font-size: 7px !important; line-height: 1.2 !important; }
  .snv-nav-actions {
    grid-area: actions !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 0 !important;
    width: 84px !important;
    min-width: 84px !important;
    max-width: 84px !important;
    margin: 0 !important;
    overflow: visible !important;
  }
  .snv-nav-actions > .snv-premium-action,
  .snv-nav-actions > .snv-premium-link { display: none !important; }
  .snv-nav-actions > button.snv-login-action {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    width: 84px !important;
    min-width: 84px !important;
    max-width: 84px !important;
    min-height: 42px !important;
    padding: 9px 8px !important;
    border-radius: 12px !important;
    font: 800 13px/1.15 Inter, system-ui, sans-serif !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
  }
  .snv-nav-actions > button.snv-login-action > i { font-size: 14px !important; }
  .snv-nav-actions .snv-nav-label-full { display: none !important; }
  .snv-nav-actions .snv-nav-label-compact {
    display: inline !important;
    font-size: 13px !important;
    line-height: 1.1 !important;
    font-weight: 800 !important;
    visibility: visible !important;
  }
  .snv-nav-actions .snv-profile-trigger {
    max-width: 84px !important;
    min-width: 84px !important;
    min-height: 42px !important;
    justify-content: center !important;
    padding: 8px !important;
    font-size: 12px !important;
  }
  .snv-nav-actions .snv-profile-trigger-label { display: none !important; }
}

@media (max-width: 420px) {
  .snv-container.snv-nav {
    grid-template-columns: 40px minmax(0, 1fr) 78px !important;
    gap: 6px !important;
    padding-inline: 10px !important;
  }
  .snv-mobile-menu-toggle { width: 40px !important; min-width: 40px !important; height: 40px !important; }
  .snv-nav-actions { width: 78px !important; min-width: 78px !important; max-width: 78px !important; }
  .snv-nav-actions > button.snv-login-action,
  .snv-nav-actions .snv-profile-trigger { width: 78px !important; min-width: 78px !important; max-width: 78px !important; }
  .snv-nav-actions > button.snv-login-action { font-size: 12.5px !important; }
  .snv-brand { gap: 5px !important; }
  .snv-brand-mark { flex-basis: 31px !important; width: 31px !important; height: 31px !important; }
}

/* Normal mobile/tablet mode: let the whole document scroll instead of trapping
   touch gestures inside a fixed-height generator form. The explicit Studio focus
   mode retains its own intentional viewport behavior. */
@media (max-width: 1050px) {
  body:not(.sensik-studio-focus-active):not(.snv-mobile-menu-open):not(.modal-open):not(.swal2-shown) {
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }
  #studio-workspace:not(.studio-focus-fallback):not(:fullscreen) {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
  #studio-workspace:not(.studio-focus-fallback):not(:fullscreen) .generator-layout {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-auto-rows: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 8px 10px 18px !important;
    gap: 12px !important;
    box-sizing: border-box !important;
  }
  #studio-workspace:not(.studio-focus-fallback):not(:fullscreen) .control-console,
  #studio-workspace:not(.studio-focus-fallback):not(:fullscreen) .music-panel {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    align-self: stretch !important;
    box-sizing: border-box !important;
  }
  #studio-workspace:not(.studio-focus-fallback):not(:fullscreen) .control-console {
    display: flex !important;
    flex: 0 0 auto !important;
    flex-direction: column !important;
    gap: 9px !important;
  }
  #studio-workspace:not(.studio-focus-fallback):not(:fullscreen) .control-console > #mainFormContainer:not([style*="display: none"]) {
    display: flex !important;
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    overflow-y: visible !important;
    overscroll-behavior: auto !important;
    -webkit-overflow-scrolling: auto !important;
    touch-action: pan-y pinch-zoom !important;
    padding: 0 0 12px !important;
  }
  #studio-workspace:not(.studio-focus-fallback):not(:fullscreen) .control-console > .action-row,
  #studio-workspace:not(.studio-focus-fallback):not(:fullscreen) .control-console > #studioActionRow {
    position: relative !important;
    inset: auto !important;
    bottom: auto !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    margin: 8px 0 0 !important;
    z-index: 4 !important;
  }
  #studio-workspace:not(.studio-focus-fallback):not(:fullscreen) .music-panel > .music-feed {
    max-height: min(54vh, 440px) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
}
