/* The conversation shares the viewport with the reader. Its measured height
   reserves enough scroll space to bring the last line above the mobile dock. */
body:has(#ana-avda-mini:not([hidden])) {
  padding-bottom: var(--ana-avda-height, 6rem);
}
html:has(#ana-avda-mini:not([hidden])) {
  scroll-padding-bottom: calc(var(--ana-avda-height, 6rem) + 1rem);
}
#ana-avda-mini {
  max-height: min(56dvh, 38rem, calc(var(--ana-avda-viewport-height, 100dvh) - 1rem));
  bottom: var(--ana-avda-keyboard, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
#ana-avda-mini[data-min] header[data-mini-chrome] {
  display: none;
}
#ana-avda-mini[data-min] form {
  margin-top: 0;
  margin-bottom: 0.75rem;
}
#persistent-audio-player:not([hidden]) ~ #ana-avda-mini {
  bottom: calc(5rem + var(--ana-avda-keyboard, 0px));
  max-height: min(56dvh, calc(var(--ana-avda-viewport-height, 100dvh) - 6rem));
}
body:has(#ana-avda-mini:not([hidden])):has(#persistent-audio-player:not([hidden])) {
  padding-bottom: calc(var(--ana-avda-height, 6rem) + 5rem);
}

@media (min-width: 1024px) {
  body:has(#ana-avda-mini:not([hidden])) {
    padding-right: 24rem;
    padding-bottom: 0;
  }
  html:has(#ana-avda-mini:not([hidden])) {
    scroll-padding-bottom: 1rem;
  }
  #ana-avda-mini,
  #persistent-audio-player:not([hidden]) ~ #ana-avda-mini {
    top: 0;
    bottom: 0;
    left: auto;
    right: 0;
    width: 24rem;
    height: 100dvh;
    max-height: none;
  }
  body:has(#ana-avda-mini:not([hidden])) #persistent-audio-player {
    right: 24rem;
  }
  body:has(#ana-avda-mini:not([hidden])):has(#persistent-audio-player:not([hidden])) {
    padding-bottom: 5rem;
  }
  #ana-avda-mini[data-min] header[data-mini-chrome] {
    display: flex;
  }
  #ana-avda-mini[data-min] form {
    margin-top: auto;
  }
}

@media print {
  #ana-avda-mini { display: none !important; }
  body:has(#ana-avda-mini:not([hidden])) {
    padding: 0 !important;
  }
}
