/* NAGHMA V205 — responsive-only, non-invasive layout fixes.
   Loaded LAST from the shared footer so legacy !important declarations cannot mask it.
   Does not change form events, names, endpoints, credentials or generation flow. */
:root{--ng205-bottom-clearance:calc(64px + env(safe-area-inset-bottom,0px))}
html{max-width:100%;overflow-x:clip;-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{max-width:100%;overflow-x:clip}
:where(.app-shell,.main-content,.admin-shell,.admin-main,.daw,.daw-workspace,.v14-create,.v14-creator,.v14-library,.ws-page,.billing-shell,.track-page,.ng196-page){min-width:0;max-width:100%;box-sizing:border-box}
:where(.main-content,.admin-main,.ng196-page) :where(img,video,canvas){max-width:100%}
:where(.main-content,.admin-main,.ng196-page) :where(input,textarea,select){box-sizing:border-box;max-width:100%}
:where(.main-content,.admin-main,.ng196-page) :where(h1,h2,h3,p,small,b,strong){overflow-wrap:break-word}
:where(.main-content,.admin-main) :where(pre,code){max-width:100%;overflow-wrap:anywhere}
:where(.main-content,.admin-main) :where(table){max-width:100%}
:where(.main-content,.admin-main) :where(a,button,select){touch-action:manipulation}
:where(.app-shell,.admin-shell) :where(.table-wrap,.table-responsive,.table-card,.data-table-wrap){max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
:where(.main-content,.admin-main) :where(dialog,.modal-card,.v80-input-card){max-width:min(96vw,680px);max-height:calc(100dvh - 32px);overflow-y:auto}
/* Keep access to fixed global player on phones, without covering the mobile nav. */
@media (max-width:900px){
  .main-content{width:100%!important;max-width:100vw!important;margin-inline:0!important;min-width:0!important}
  .mobile-top{min-width:0;padding-inline:10px!important;padding-top:max(7px,env(safe-area-inset-top,0px))!important}
  .mobile-bottom-nav{width:100%;min-width:0;box-sizing:border-box}
  .mobile-bottom-nav a{min-width:0!important;max-width:100%;overflow:hidden}
  .mobile-bottom-nav a span{font-size:clamp(9px,2.5vw,11px);max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  body:not([data-page="studio"]) .global-player:not([hidden]){
    bottom:calc(64px + env(safe-area-inset-bottom,0px))!important;
    left:0!important;right:0!important;max-width:100%!important;
    height:auto!important;min-height:65px;max-height:148px;overflow:auto;
    display:flex!important;flex-wrap:wrap;gap:7px!important;
    padding:8px 10px!important;box-sizing:border-box;
  }
  .global-player:not([hidden]) .gp-song{min-width:0;flex:1 1 125px}
  .global-player:not([hidden]) .gp-transport{min-width:0;flex:1 1 160px}
  .global-player:not([hidden]) .gp-tools{flex:0 1 auto;min-width:0}
  body.has-global-player:not([data-page="create"]):not([data-page="studio"]) .main-content{padding-bottom:210px!important}
  :where(.main-content,.admin-main,.ng196-page) :where(input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),select,textarea){font-size:16px!important}
  :where(.main-content,.admin-main,.ng196-page) :where(.modal-card,.v80-input-card){width:min(94vw,660px)!important;max-width:94vw!important}
  :where(.main-content,.admin-main) :where(.grid3,.plans-grid,.ws-grid){grid-template-columns:repeat(2,minmax(0,1fr))!important}
  :where(.main-content) :where(.library-list,.song-grid,.studio-project-grid){grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
  .track-page{grid-template-columns:minmax(0,1fr)!important;gap:16px!important;padding:16px 14px 120px!important}
  .track-page>.track-cover{width:min(360px,100%)!important;justify-self:center}
  .ws-page,.billing-shell{padding:16px 12px 110px!important;width:100%!important}
  .ng196-page{padding-inline:12px!important}
  .hero{grid-template-columns:minmax(0,1fr)!important;gap:12px!important;padding:18px 14px!important}
  .hero-copy h1{font-size:clamp(26px,6vw,48px)!important}
}
/* Native composer on mobile: unlock nested clipping and always show the EXISTING submit. */
@media (max-width:900px){
  body[data-page="create"]{overflow-x:clip!important;overflow-y:auto!important}
  body[data-page="create"] .main-content{
    height:auto!important;min-height:100dvh!important;overflow:visible!important;
    padding-top:58px!important;padding-bottom:calc(166px + env(safe-area-inset-bottom,0px))!important;
  }
  body[data-page="create"] #v14Create{
    display:block!important;width:100%!important;height:auto!important;min-height:calc(100dvh - 124px)!important;
    max-width:100%!important;overflow:visible!important;grid-template-columns:none!important;
  }
  body[data-page="create"] #v14Create>.v14-creator{
    width:100%!important;max-width:100%!important;min-width:0!important;height:auto!important;
    min-height:0!important;max-height:none!important;overflow:visible!important;
    padding:12px 12px 24px!important;box-sizing:border-box!important;
  }
  body[data-page="create"] #v14Create:not(.mobile-results-open)>.v14-library{display:none!important}
  body[data-page="create"] #v14Create.mobile-results-open>.v14-library{
    display:flex!important;width:100%!important;height:auto!important;min-height:calc(100dvh - 150px)!important;
    max-height:none!important;overflow:visible!important;padding-bottom:18px!important;
  }
  body[data-page="create"] #v14Create.mobile-results-open>.v14-creator{display:none!important}
  body[data-page="create"] #createForm{height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important}
  body[data-page="create"] #v75CreateScroll{
    height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important;
    overscroll-behavior:auto!important;padding-bottom:16px!important;
  }
  body[data-page="create"] #v14Create .v75-create-footer{
    position:fixed!important;top:auto!important;
    left:8px!important;right:8px!important;bottom:calc(var(--ng205-bottom-clearance) + 6px)!important;
    width:calc(100% - 16px)!important;max-width:560px!important;min-width:0!important;
    height:auto!important;margin:0 auto!important;padding:9px 10px!important;
    border-radius:15px!important;border:1px solid rgba(131,124,239,.55)!important;
    background:#101a36!important;box-shadow:0 7px 30px rgba(0,0,0,.55)!important;
    display:block!important;visibility:visible!important;opacity:1!important;
    z-index:1780!important;transform:none!important;box-sizing:border-box!important;
  }
  body[data-page="create"] #v14Create .v75-create-footer .generate-dock{
    display:flex!important;width:100%!important;gap:10px!important;margin:0!important;
    min-width:0!important;align-items:center!important;justify-content:space-between!important;
    flex-direction:row!important;flex-wrap:nowrap!important;
  }
  body[data-page="create"] #v14Create #engineReadiness{flex:1 1 0!important;min-width:0!important;max-width:100%!important}
  body[data-page="create"] #v14Create #engineReadiness small{display:none!important}
  body[data-page="create"] #v14Create #generateMusicBtn{
    display:flex!important;flex:0 0 auto!important;position:relative!important;
    min-width:155px!important;max-width:70%!important;width:auto!important;
    min-height:48px!important;height:auto!important;margin:0!important;
    padding:11px 14px!important;white-space:normal!important;overflow-wrap:anywhere!important;
    font-size:14px!important;line-height:1.3!important;opacity:1!important;visibility:visible!important;
    touch-action:manipulation!important;
  }
  body[data-page="create"] #v14Create.mobile-results-open .v75-create-footer{display:none!important}
  #mobileResultsToggle{top:66px!important;min-height:42px!important;z-index:1400!important}
  #v14Create :where(.composer-card,.source-launcher,.audio-workflow,.v19-production-hub,.advanced-box){max-width:100%!important;min-width:0!important;box-sizing:border-box!important}
  #v14Create :where(.source-launcher,.mode-cards,.style-presets,.v19-style-presets){max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
  #v14Create :where(textarea,input,select){max-width:100%!important}
  #v14Create :where(.track-copy,.v14-track,.track-main){min-width:0!important}
  #v14Create .v14-track .track-copy :where(b,small){overflow-wrap:anywhere}
  /* Editing text on iPhone/Android: return dock to document flow to avoid keyboard overlay. */
  body.ng205-editing[data-page="create"] #v14Create .v75-create-footer{
    position:relative!important;inset:auto!important;bottom:auto!important;left:auto!important;right:auto!important;
    width:100%!important;max-width:100%!important;margin:12px 0 0!important;
  }
}
@media (max-width:420px){
  body[data-page="create"] #v14Create .v75-create-footer{padding:8px!important}
  body[data-page="create"] #v14Create .v75-create-footer .generate-dock{display:block!important}
  body[data-page="create"] #v14Create #engineReadiness{display:none!important}
  body[data-page="create"] #v14Create #generateMusicBtn{
    width:100%!important;min-width:0!important;max-width:100%!important;min-height:52px!important;
    font-size:15px!important;padding:11px 12px!important;
  }
  #v14Create :where(.control-strip,.control-grid,.advanced-grid,.grid3,.v80-lyrics-compare){grid-template-columns:minmax(0,1fr)!important}
  #v14Create .creator-hero{padding-inline:8px!important}
}
@media(max-width:600px){
  :where(.main-content,.admin-main) :where(.grid3,.plans-grid,.ws-grid,.song-grid,.studio-project-grid){grid-template-columns:minmax(0,1fr)!important}
  :where(.main-content) :where(.library-list,.studio-project-grid){padding-inline:12px!important}
  :where(.main-content) :where(.library-row,.studio-project-card){max-width:100%;min-width:0;overflow-wrap:anywhere}
  .billing-hero,.page-head,.section-head,.studio-list-head{padding-inline:12px!important}
  .ng196-page{padding:10px!important}
  .mobile-brand{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
}
@media(max-width:900px) and (max-height:480px){
  body[data-page="create"] #v14Create .v75-create-footer{
    position:relative!important;inset:auto!important;width:100%!important;max-width:100%!important;margin:10px 0!important;
  }
}
/* Admin: expose every category via a scrollable navigation strip on mobile. */
@media(max-width:950px){
  .admin-shell{display:block!important;width:100%!important;grid-template-columns:none!important;overflow-x:clip}
  .admin-sidebar{display:flex!important;position:relative!important;inset:auto!important;transform:none!important;
    flex-direction:column!important;width:100%!important;height:auto!important;max-height:none!important;
    padding:10px 12px!important;box-sizing:border-box!important;overflow:visible!important}
  .admin-sidebar .brand{padding-block:8px!important}
  .admin-sidebar nav{display:flex!important;flex-flow:row nowrap!important;max-width:100%!important;overflow-x:auto!important;
    overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch;gap:7px!important;padding-bottom:6px}
  .admin-sidebar nav a{flex:0 0 auto!important;white-space:nowrap!important;min-height:42px!important;display:flex!important;align-items:center}
  .admin-sidebar .side-spacer{display:none!important}
  .admin-main{width:100%!important;max-width:100vw!important;padding:14px 12px 26px!important;min-width:0!important;overflow-x:clip}
  .admin-top{gap:12px;flex-wrap:wrap}
  .admin-main :where(.stats-grid,.stat-grid,.cards-grid){grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .admin-main :where(table){display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
  .admin-main :where(input:not([type="checkbox"]),select,textarea){max-width:100%;min-width:0!important}
}
@media(max-width:560px){.admin-main :where(.stats-grid,.stat-grid,.cards-grid){grid-template-columns:minmax(0,1fr)!important}}
/* DAW is a desktop-style multitrack timeline: scroll within tracks, never squish waveforms. */
@media(max-width:900px){
  body[data-page="studio"] .main-content{width:100%!important;min-width:0!important;overflow-x:hidden!important}
  .daw,.daw-v3,.daw-v9{max-width:100vw!important;width:100%!important;margin-inline:0!important;
    border-radius:9px!important;min-width:0!important;overflow:hidden!important}
  .daw :where(.daw-topbar,.transport,.daw-actions,.session-controls,.daw-toolbar-groups){max-width:100%!important;min-width:0!important}
  .daw :where(.daw-actions,.session-controls,.daw-toolbar-groups){overflow-x:auto!important;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}
  .daw :where(.arrangement,.ruler-wrap,.ruler-wrapper,.arrangement-scroll,.track-scroll,.tracks-scroll){min-width:0!important;max-width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch}
  .daw :where(.daw-workspace-v3,.daw-workspace){width:100%!important;min-width:0!important;grid-template-columns:minmax(0,1fr)!important}
  .daw :where(.track-lane,.timeline-canvas,.track-waveform){touch-action:pan-x pan-y}
}
@media(prefers-reduced-motion:reduce){.mobile-top,.mobile-bottom-nav,#v14Create .v75-create-footer{transition:none!important}}
