/* The supplied logo is preserved, with a neutral frame in both themes. */
.brand { display:inline-flex; align-items:center; gap:10px; min-width:0; font-size:17px; letter-spacing:0; }
.brand-logo { width:48px; height:48px; flex-shrink:0; object-fit:contain; border:1px solid #dedee3; border-radius:12px; background:#fff; }
.brand-name { display:grid; gap:4px; line-height:1.15; }
.brand-name small { font-size:11px; font-weight:600; letter-spacing:.14em; text-transform:uppercase; color:var(--muted); }
.home-footer-brand .home-brand-mark { width:40px; height:40px; flex-shrink:0; object-fit:contain; border:1px solid #dedee3; border-radius:10px; background:#fff; }
.suno-topbar-logo { display:none; }
.suno-tab-avatar .suno-avatar-circle { width:38px; height:38px; overflow:hidden; border:1px solid #dedee3; background:var(--surface-raised); color:var(--text); box-shadow:none; }
.suno-avatar-circle img { display:block; width:100%; height:100%; object-fit:cover; }
.suno-avatar-circle svg { width:22px; height:22px; }
/* La liste défile dans l’espace restant, indépendamment de ses en-têtes. */
body:is([data-library-mode="songs"],[data-library-mode="search"]) .workspace-content {
  height:100%; min-height:0; overflow:hidden !important;
}
body[data-library-mode="songs"] #tab-content-songs,
body[data-library-mode="search"] #tab-content-search {
  display:flex; flex-direction:column; height:100%; min-height:0; overflow:hidden;
}
body[data-library-mode="songs"] #tab-content-songs > :not(#song-list),
body[data-library-mode="search"] #tab-content-search > :not(#song-list) { flex-shrink:0; }
body:is([data-library-mode="songs"],[data-library-mode="search"]) #song-list {
  flex:1 1 0; min-height:0; overflow-x:hidden; overflow-y:auto;
  overscroll-behavior-y:contain; -webkit-overflow-scrolling:touch;
}
#song-list > * { flex-shrink:0; }

@media (max-width:900px) {
  html,body { min-width:0; }
  .studio-app { width:100% !important; max-width:100% !important; }
  :is(.creator-panel,.workspace-panel,.workspace-content,.account-view,.suno-form,#tab-content-songs,#tab-content-search,.song-content,.song-top,.song-title) { min-width:0; max-width:100%; }
  body:is([data-library-mode="songs"],[data-library-mode="search"]) :is(#tab-content-songs,#tab-content-search) { overflow-x:hidden; overflow-y:auto; }
  body:is([data-library-mode="songs"],[data-library-mode="search"]) #song-list { min-height:clamp(140px,32dvh,240px); }
  #song-list .song { width:100%; min-width:0; }
  #song-list .song-title-button { width:100%; }
  #song-list .song-download-cta { max-width:100%; white-space:normal; }
  #tab-content-songs .library-controls>.control-button { min-width:0; flex:1 1 0; }
  .generation-status-heading { flex-wrap:wrap; }
  #generation-overlay :is(h2,p,li) { min-width:0; overflow-wrap:anywhere; }
  .suno-topbar-logo { position:absolute; top:calc(6px + var(--safe-top)); left:calc(14px + var(--safe-left)); display:block; width:44px; height:44px; overflow:hidden; border:1px solid #dedee3; border-radius:11px; background:#fff; }
  .suno-topbar-logo img { display:block; width:100%; height:100%; object-fit:contain; }
}

/* Final mobile rules also cover dialogs inserted after the initial page load. */
@media (max-width: 900px), (pointer: coarse) {
  body input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),
  body select, body textarea, body [contenteditable="true"] { font-size: 16px !important; }
}

/* Readable creation milestones, shared with the mobile library. */
dialog[open], .auth-dialog[open] { position:fixed !important; inset:0 !important; margin:auto !important; transform:none !important; max-height:calc(var(--real-vh, 100%) - 32px); overflow-y:auto; }
.auth-social { margin-top:18px; }
.auth-oauth { display:flex; align-items:center; justify-content:center; gap:12px; min-height:48px; font-size:15px; }
.auth-oauth:disabled { opacity:.6; cursor:wait; }
.oauth-brand { display:grid; place-items:center; flex:0 0 24px; height:24px; font-size:22px; font-weight:800; }
.oauth-google { width:24px; object-fit:contain; }
#google-login { background:#fff; color:#1f1f1f; border-color:#747775; }
#google-login:hover { background:#f2f2f2; }
.oauth-facebook { border-radius:5px; background:#1877f2; color:#fff; }
.auth-or { font-size:13px; margin:16px 0; }
.auth-error { font-size:14px; line-height:1.5; }
#profile-edit-form { margin-top:20px; }
#filter-menu:not([hidden]) { position:fixed !important; left:50% !important; right:auto !important; top:calc(var(--dialog-viewport-top, 0px) + var(--real-vh, 100%) / 2) !important; transform:translate(-50%,-50%); width:min(280px,calc(100vw - 32px)); max-height:calc(var(--real-vh, 100%) - 32px); overflow-y:auto; padding:12px; z-index:75; box-shadow:0 24px 80px #0008; }
#filter-menu button { min-height:44px; font-size:15px; }
html[data-theme="light"] .account-view { --suno-dark-bg:var(--bg); --suno-card-bg:var(--panel); --suno-card-border:var(--line); --suno-text-gray:var(--muted); --suno-text-dim:var(--muted); }
html[data-theme="light"] .account-view :is(.suno-account-header h1,.suno-credits-amount,.suno-setting-label span,.suno-guest-info b) { color:var(--text); }
html[data-theme="light"] .account-view .suno-credits-card { background:var(--panel); border-color:var(--line); box-shadow:0 4px 16px #0001; }
html[data-theme="light"] .account-view .suno-credits-icon { background:var(--surface); color:#986100; }
html[data-theme="light"] .account-view .suno-setting-row-btn { border-bottom-color:var(--line-soft); }
html[data-theme="light"] .account-view .suno-setting-row-btn:hover { background:var(--surface); }
#generation-overlay:not([hidden]) { display:block; margin:0 0 20px; padding:20px; border:1px solid var(--line); border-radius:16px; background:var(--surface); color:var(--text); }
.generation-status-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; }
#generation-step-label { margin:0; font-size:14px; font-weight:800; }
#generation-dismiss { min-height:44px; padding:6px 10px; border:1px solid var(--line); border-radius:8px; background:transparent; color:var(--text); font-size:13px; }
#generation-title { margin:0 0 10px; font-size:22px; line-height:1.35; }
#generation-message { margin:0 0 18px; font-size:16px; line-height:1.6; }
.generation-status-track { height:12px; overflow:hidden; border-radius:999px; background:var(--line); }
#generation-progress-bar { height:100%; width:33.333%; border-radius:inherit; background:var(--accent); transition:width .3s; }
.generation-stages { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin:16px 0 0; padding:0; list-style:none; counter-reset:creation; }
.generation-stages li { counter-increment:creation; font-size:14px; line-height:1.5; color:var(--muted); }
.generation-stages li::before { content:counter(creation); display:grid; place-items:center; width:26px; height:26px; margin-bottom:8px; border:1px solid var(--line); border-radius:50%; font-weight:800; }
.generation-stages li:is(.is-current,.is-complete) { color:var(--text); font-weight:800; }
.generation-stages li:is(.is-current,.is-complete)::before { border-color:var(--accent); background:var(--accent); color:var(--bg); }
#generation-overlay[data-state="failed"] { border-color:var(--danger); }
.generation-elapsed { color:var(--muted); font-size:14px; font-variant-numeric:tabular-nums; }
.generation-follow:not([hidden]) { position:fixed; z-index:65; right:20px; bottom:calc(104px + var(--safe-bottom,0px)); display:flex; align-items:center; gap:10px; max-width:calc(100vw - 32px); min-height:48px; padding:12px 16px; border:1px solid var(--accent); border-radius:14px; background:var(--surface); color:var(--text); box-shadow:0 8px 28px #0003; font:inherit; font-size:14px; text-align:left; }
.generation-follow .create-spinner { flex-shrink:0; width:18px; height:18px; border:2px solid var(--line); border-top-color:var(--accent); border-radius:50%; animation:create-spin .85s linear infinite; }
.generation-follow[data-state="done"] .create-spinner,.generation-follow[data-state="failed"] .create-spinner { display:none; }
.generation-follow:focus-visible,#generation-dismiss:focus-visible { outline:2px solid var(--accent); outline-offset:4px; }
@media(max-width:600px) { .generation-follow:not([hidden]) { right:16px; bottom:calc(148px + var(--safe-bottom,0px)); } }
@media(prefers-reduced-motion:reduce) { .generation-follow .create-spinner { animation:none; } }

@media (max-width:900px) {
  body.mobile-page-fullscreen .suno-topbar { display:none !important; }
  body.mobile-page-fullscreen :is(.workspace-panel,.account-view) {
    top:0 !important; padding:calc(18px + var(--safe-top)) calc(14px + var(--safe-right)) 24px calc(14px + var(--safe-left)) !important;
    border:0 !important; border-radius:0 !important;
  }
  body.mobile-page-fullscreen .workspace-content { display:block; height:auto; max-height:none; padding:0 !important; overflow:visible; }
  body.mobile-page-fullscreen:is([data-library-mode="songs"],[data-library-mode="search"]) .workspace-content { height:100%; }
  body.mobile-page-fullscreen .suno-account-scroll { max-width:none; padding-bottom:24px; }
  .suno-account-header h1 { font-size:30px; }
  .suno-account-header p { font-size:14px; line-height:1.6; }
  .suno-setting-label small { font-size:13px; line-height:1.5; }
  .suno-setting-label { overflow-wrap:anywhere; }
  .suno-setting-right, .suno-setting-tag { flex-shrink:0; }
  .suno-credits-card { flex-wrap:wrap; }
  .suno-credits-amount { font-size:18px; overflow-wrap:anywhere; }
  .suno-setting-row-btn[aria-pressed="true"] { background:var(--surface-raised); }
  .tarifs-back-btn { min-height:44px; padding:8px 14px; border:1px solid var(--line); border-radius:999px; background:var(--surface); color:var(--text); font-size:14px; }
  #tab-content-songs { width:100%; padding:0; }
  #tab-content-songs .mobile-view-head { margin:0 0 12px; padding:0; }
  #mobile-view-title { margin:0; font-size:30px; line-height:1.25; letter-spacing:-.04em; }
  #tab-content-songs .library-workspace-context { display:none !important; }
  #tab-content-songs .library-section-header { margin-bottom:12px; }
  #tab-content-songs .search-box { display:none; }
  #tab-content-songs .filter-menu { top:48px; }
  #tab-content-songs .library-sections button { font-size:13px; min-height:44px; }
  #tab-content-songs .list-heading { padding:4px 0 12px; font-size:16px; }
  #song-list { width:100%; gap:0; padding:0 0 16px; scrollbar-gutter:auto; }
  #song-list .song { grid-template-columns:56px minmax(0,1fr) 36px; align-items:center; gap:10px; min-height:96px; padding:12px 0; border-radius:0 !important; border-bottom:1px solid var(--line-soft) !important; }
  #song-list .song-artwork { width:56px; height:56px; border-radius:9px; }
  #song-list .song-top { display:grid; grid-template-columns:minmax(0,1fr); align-items:start; gap:8px; }
  #song-list .song-title { font-size:15px !important; line-height:1.4; letter-spacing:-.02em; white-space:normal; overflow:visible; }
  #song-list .song-title-button { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; white-space:normal; overflow:hidden; overflow-wrap:anywhere; line-height:inherit; }
  #song-list .song-model, #song-list .song-quick-action { display:none !important; }
  #song-list .song-actions { display:flex !important; justify-content:center; }
  #song-list .song-menu { width:36px !important; height:44px !important; min-width:36px !important; background:transparent !important; border:0; }
  #song-list .song-menu svg { width:20px; height:20px; }
  #song-list .song-details { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; margin:4px 0 0; white-space:normal; overflow-wrap:anywhere; font-size:12px !important; line-height:1.5; }
  #song-list .song-download-cta { min-width:0; min-height:36px; margin-top:6px; padding:6px 10px; font-size:12px; border-radius:7px; }
  #song-list .song-download-cta-icon, #song-list .song-download-format { display:none; }
  #song-list .song-top .status { grid-column:1/-1; font-size:13px !important; line-height:1.5; }
  #song-list .song-duration { font-size:11px; }
  #generation-overlay:not([hidden]) { padding:18px 16px; margin-bottom:18px; }
  #generation-title { font-size:22px; }
  .generation-stages { gap:10px; }
  .generation-stages li { font-size:13px; }
}
@media (max-width:380px) {
  #song-list .song-top { grid-template-columns:minmax(0,1fr); }
}
@media (prefers-reduced-motion:reduce) { #generation-progress-bar { transition:none; } }
@media (min-width: 901px) and (max-width: 1150px) {
  .workspace-nav, .workspace-nav nav { flex-wrap: wrap; }
  .workspace-nav { gap: 12px; }
}
@media (max-width: 900px) {
  html, body { position: static; inset: auto; height:100% !important; min-height:0; margin:0; overscroll-behavior: none; scroll-behavior:auto; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  /* Le cadre fixe suit une seule fois le viewport visible, sans ajouter
     le scroll de la page. Le header reste dans le flux de ce cadre. */
  .studio-app { position:fixed !important; top:var(--app-top, 0px) !important; bottom:auto !important; height:var(--real-vh, 100%) !important; transform:none; }
  .suno-topbar { position:sticky !important; top:0 !important; flex-shrink:0; margin:0 !important; }
  :is(.suno-tab-bar,.mobile-mini-player) { position:absolute !important; }
  .creator-panel { bottom:calc(76px + var(--safe-bottom)) !important; padding-bottom:0 !important; overflow:hidden !important; }
  .suno-form { height:100%; min-height:0; gap:0; padding-bottom:0 !important; }
  .creation-fields { display:flex; flex-direction:column; gap:14px; flex:1 1 0; min-height:0; overflow-x:hidden; overflow-y:auto; padding-bottom:12px; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
  .creation-fields > * { flex-shrink:0; }
  .suno-create-container { position:sticky !important; inset:auto !important; bottom:0 !important; flex:0 0 auto; margin:0; padding:0; background:var(--panel); pointer-events:auto; }

  /* Keep text fields legible without disabling the visitor's pinch zoom. */
  body input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),
  body select, body textarea, body [contenteditable="true"] {
    min-width: 0;
    max-width: 100%;
    font-size: 16px !important;
  }
  :is(.creation-fields, .workspace-panel, .account-view, .viewport-dialog-content, dialog) {
    overscroll-behavior: contain;
    scroll-padding-block: 20px;
  }
  :is(form, label, .field-row, .tts-row, .playlist-create, .share-link-row) { min-width: 0; }

  dialog {
    max-width: calc(100% - 24px) !important;
    max-height: calc(var(--real-vh, 100%) - var(--safe-top) - var(--safe-bottom) - 24px) !important;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 20px;
    overflow-wrap: anywhere;
  }
  dialog[open], .auth-dialog[open] {
    position: fixed !important;
    inset:auto 0 !important;
    top:calc(var(--dialog-viewport-top, 0px) + var(--real-vh, 100%) / 2) !important;
    margin:0 auto !important;
    transform:translateY(-50%) !important;
  }
  :is(.feature-dialog, .auth-dialog, .song-details-dialog, .signout-dialog) h2 {
    padding-right: 28px;
    font-size: 21px;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }
  .song-info-list > div { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .song-details-header { position: sticky; top: 0; z-index: 1; background: var(--panel); padding-bottom: 8px; }
  .song-info-list dt { line-height: 1.5; }
  #song-list .song-quick-action { width: 36px !important; height: 36px !important; min-width: 36px !important; }
  #song-list .song-quick-action svg { width: 17px !important; height: 17px !important; }
  .song-details-actions, .dialog-actions { flex-wrap: wrap; }
  :is(.song-details-actions, .dialog-actions) > button { flex: 1 1 100px; min-height: 44px; white-space: normal; }
  .field-row, .tts-row { grid-template-columns: minmax(0, 1fr); }
  .playlist-create { flex-wrap: wrap; }
  .playlist-create input { flex: 1 1 150px; }
  .playlist-create button { min-height: 44px; }
  .share-link-row input { flex-basis: 100%; }
  .song-action-popover { z-index: 80; top:calc(var(--dialog-viewport-top, 0px) + var(--real-vh, 100%) / 2); max-height: calc(var(--real-vh, 100%) - 24px); }
  .song-menu-backdrop { z-index: 79; }
  .app-toast { z-index: 90; bottom: calc(148px + var(--safe-bottom)); overflow-wrap: anywhere; }

  .mobile-mini-player {
    bottom: calc(76px + var(--safe-bottom));
    height: 64px;
    overflow: hidden;
    padding-bottom: 8px;
  }
  .mini-player-tap { padding: 0; border: 0; background: transparent; color: var(--text); text-align: left; min-height: 44px; }
  .mini-player-cover { overflow: hidden; }
  .mini-player-cover > :is(img, .cover-fallback) { width: 100%; height: 100%; border: 0; border-radius: inherit; object-fit: cover; }
  .mini-player-controls button { width: 44px; height: 44px; flex-shrink: 0; }
  .mini-player-controls svg { width: 20px; height: 20px; }
  .mini-player-range { display: block; position: absolute; left: 12px; bottom: 0; width: calc(100% - 24px); height: 12px; min-height: 0; margin: 0; padding: 0; background: transparent; accent-color: var(--text); }
  body.has-mobile-player :is(.workspace-panel, .account-view) { bottom: calc(140px + var(--safe-bottom)) !important; }
  body.has-mobile-player .creator-panel { bottom:calc(148px + var(--safe-bottom)) !important; }

  /* Créer reste juste au-dessus du clavier, sans espace réservé aux onglets. */
  body.mobile-keyboard-open :is(.suno-tab-bar, .mobile-mini-player) { display: none !important; }
  body.mobile-keyboard-open .suno-create-container { display:flex !important; }
  body.mobile-keyboard-open .creator-panel { bottom:8px !important; }
  body.mobile-keyboard-open :is(.workspace-panel, .account-view) { bottom:0 !important; }
  body.mobile-keyboard-open .app-toast { bottom: 12px; }
}

/* Les messages flottants hors du cadre suivent aussi le scroll du clavier.
   Les fenêtres et menus utilisent déjà offsetTop et la hauteur visible. */
@media (max-width:900px), (pointer:coarse) {
  body.mobile-keyboard-open > :is(.app-toast,.media-feedback) { transform:translate(-50%,var(--fixed-viewport-shift, 0px)); }
  body.mobile-keyboard-open > .player-bar { transform:translateY(var(--fixed-viewport-shift, 0px)); }
}

.viewport-dialog-content { display:contents; }
.viewport-dialog-actions { display:none; }
/* La fenêtre conserve sa hauteur visible ; seul son contenu défile.
   L'action active reste dans la fenêtre et conserve son formulaire. */
body.mobile-keyboard-open dialog.keyboard-form-dialog[open] {
  display:flex !important; flex-direction:column;
  top:calc(var(--dialog-viewport-top, 0px) + 12px) !important;
  bottom:auto !important; margin:0 auto !important; transform:none !important;
  height:calc(var(--real-vh, 100%) - 24px) !important;
  max-height:calc(var(--real-vh, 100%) - 24px) !important;
  padding:16px; overflow:hidden !important;
}
body.mobile-keyboard-open .keyboard-form-dialog > .viewport-dialog-content {
  display:block; flex:1 1 0; min-height:0; overflow-x:hidden; overflow-y:auto;
  padding-bottom:12px; overscroll-behavior:contain; -webkit-overflow-scrolling:touch;
}
body.mobile-keyboard-open .keyboard-form-dialog > .viewport-dialog-actions {
  display:flex; flex:0 0 auto; padding-top:8px; background:var(--panel); z-index:2;
}
.viewport-dialog-actions > :is(button,.dialog-actions,.media-dialog-actions) { width:100%; margin:0; }
.viewport-dialog-actions :is(button,.auth-primary) { min-height:44px; }
@media (min-width:901px) and (pointer:coarse) {
  body.mobile-keyboard-open .creator-panel { display:flex; flex-direction:column; overflow:hidden; }
  body.mobile-keyboard-open .suno-form { flex:1 1 0; min-height:0; gap:0; padding-bottom:0; }
  body.mobile-keyboard-open .creation-fields { display:flex; flex-direction:column; gap:14px; flex:1 1 0; min-height:0; overflow:auto; padding-bottom:12px; }
  body.mobile-keyboard-open .creation-fields > * { flex-shrink:0; }
  body.mobile-keyboard-open .suno-create-container { position:sticky; bottom:0; flex-shrink:0; }
}
