/* =========================================================
   V49 — DEPLOYMENT / MOBILE SHELL CORRECTION
   Surgical layer loaded last.
   - Keeps the V48 desktop design intact.
   - Keeps the browser-model machinery in the DOM, but removes
     its public welcome-screen selector from the deployed UI.
   - Makes the NovaAI shell authoritative on narrow Safari/iOS
     without depending on :has() selector support.
   ========================================================= */

/* The deployed interface must not expose the browser model picker.
   Do not remove #modelSelect: novaai.js still uses it internally. */
#modelSetup.auto-model-setup {
  display: none !important;
}

@media (max-width: 820px) {
  html,
  body {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    margin: 0 !important;
    overflow: hidden !important;
  }

  body > .app-shell,
  .app-shell {
    position: relative !important;
    z-index: 1 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
    height: var(--v69-vh, var(--rd-vv-height, 100dvh)) !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .app-shell > .chat-main,
  .chat-main {
    position: relative !important;
    z-index: 1 !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    grid-column: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: var(--v69-vh, var(--rd-vv-height, 100dvh)) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .chat-header {
    position: relative !important;
    z-index: 5 !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex: 0 0 auto !important;
  }

  .chat-scroll {
    position: relative !important;
    z-index: 1 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  #welcome.welcome {
    position: relative !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: min(100%, 760px) !important;
    max-width: 100% !important;
    min-height: 0 !important;
    margin: 0 auto !important;
    padding-top: clamp(24px, 7vh, 64px) !important;
    padding-bottom: 28px !important;
  }

  #welcome .compass-logo-wrap {
    position: relative !important;
    display: grid !important;
    visibility: visible !important;
    opacity: 1 !important;
    place-items: center !important;
    width: 112px !important;
    height: 112px !important;
    margin: 0 auto 12px !important;
  }

  #welcome h2 {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin: 8px auto 12px !important;
    font-size: clamp(32px, 9vw, 42px) !important;
    line-height: 1.06 !important;
  }

  #welcome .v12-status-row {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin: 0 auto 14px !important;
  }

  .composer-wrap {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 6 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
  }

  .composer {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  /* Preserve V48's drawer behaviour: present, but off-canvas until opened. */
  .app-shell > .sidebar,
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 30 !important;
  }
}
