/* NovaAI V70 — existing-capability hardening only. No new product features. */
:root{--v70-vh:100dvh;--v70-vw:100dvw;--v70-vtop:0px;--v70-vleft:0px}

/* Prevent user-generated text, URLs and labels from widening the application. */
:where(.message-content,.tool-result,.nova-v4-status,.nova-v4-source,.privacy-note,.conversation-item,.source-link,.v40-ws-file,.nova-context-messages){overflow-wrap:anywhere}
:where(button,[role="button"],a,input,textarea,select){-webkit-tap-highlight-color:transparent}

@media(max-width:820px){
  body:has(.app-shell),body:has(.app-shell) .app-shell,body:has(.app-shell) .chat-main{height:var(--v70-vh)!important;max-height:var(--v70-vh)!important}
  body:has(.app-shell) .sidebar{height:var(--v70-vh)!important;max-height:var(--v70-vh)!important}
  body:has(.app-shell) .chat-scroll{overscroll-behavior-y:contain!important;scroll-padding-bottom:140px!important}
  body:has(.app-shell) .composer-wrap{max-width:100vw!important}
  body:has(.app-shell) .composer{max-height:min(360px,48dvh,calc(var(--v70-vh) - 126px))!important}
  body:has(.app-shell) #promptInput{max-height:min(180px,22dvh,calc(var(--v70-vh) - 184px))!important}

  /* Existing fixed jump buttons must not compete with the keyboard/composer. */
  .v70-keyboard-open .chat-jump-controls,.v69-keyboard-open .chat-jump-controls{display:none!important}

  /* Keep existing dialogs entirely inside the visible phone viewport. */
  .nova-v4-modal,.settings-dialog,.v40-workspace-dialog{max-height:calc(var(--v70-vh) - 12px)!important;max-width:calc(var(--v70-vw) - 12px)!important}
  .nova-v4-modal .nova-v4-body{max-height:calc(var(--v70-vh) - 72px)!important}
  .v40-workspace-dialog{width:calc(var(--v70-vw) - 16px)!important;margin:auto!important;overflow:hidden!important}
  .v40-ws-list{max-height:calc(var(--v70-vh) - 150px)!important;-webkit-overflow-scrolling:touch!important}

  /* Existing Ask NovaAI bubble remains reachable above browser chrome/keyboard. */
  .v63-ask-selection,.v40-ask-selection{max-width:calc(var(--v70-vw) - 16px)!important;white-space:normal!important;line-height:1.25!important;touch-action:manipulation!important}

  /* Existing contextual NovaAI stays inside the visible viewport, including keyboard resize. */
  .nova-context-panel{top:calc(var(--v70-vtop) + max(6px,env(safe-area-inset-top,0px)))!important;bottom:auto!important;height:calc(var(--v70-vh) - 12px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px))!important;max-height:calc(var(--v70-vh) - 12px)!important}
  .nova-context-messages{overscroll-behavior:contain!important}

  /* Do not leave a mobile drawer transform/state affecting desktop after resize. */
  #sidebar:not(.open){pointer-events:none}
  #sidebar.open{pointer-events:auto}
}

@media(min-width:821px){#sidebar{pointer-events:auto!important}}

/* Very short mobile/landscape viewports: preserve a usable message area. */
@media(max-height:430px) and (max-width:920px){
  body:has(.app-shell) .chat-header{min-height:44px!important;padding-top:4px!important;padding-bottom:4px!important}
  body:has(.app-shell) .composer-wrap{padding-top:4px!important;padding-bottom:max(4px,env(safe-area-inset-bottom,0px))!important}
  body:has(.app-shell) .composer{max-height:min(190px,46dvh)!important;padding:7px!important}
  body:has(.app-shell) #promptInput{min-height:38px!important;max-height:80px!important}
  body:has(.app-shell) .composer-tools .tool-chip{min-height:36px!important;padding:.38rem .5rem!important}
}

@media(hover:none) and (pointer:coarse){
  .conversation-item:hover,.side-action:hover,.message-action:hover,.source-link:hover{transform:none!important}
  :where(button,.conversation-item,.side-action,.message-action,.source-link){touch-action:manipulation}
}
