/**
 * /ege-22/ — закрепить #task-answer-section внизу правой колонки.
 * Скролл только у условия; кнопки не уезжают.
 * Грузить после variant_exam_answer_row_parity.css (там position: relative).
 */

body.libreoffice-page-task22 .libreoffice-task3-page.task-solve-page .task-solve__right {
  display: flex !important;
  flex-direction: column !important;
  align-self: stretch !important;
  min-height: 0 !important;
  overflow: hidden !important;
  gap: 0 !important;
}

body.libreoffice-page-task22
  .libreoffice-task3-page.task-solve-page
  .task-solve__right
  > #libreoffice-task9-statement-wrap.task-solve__statement {
  flex: 1 1 0% !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* Не даём game-hub / intro раздувать колонку вместо условия */
body.libreoffice-page-task22
  .libreoffice-task3-page.task-solve-page
  .task-solve__right
  > .hf-variants-shell,
body.libreoffice-page-task22
  .libreoffice-task3-page.task-solve-page
  .task-solve__right
  > .neuroege-hf-trainer-intro {
  flex: 0 0 auto !important;
}

body.libreoffice-page-task22
  .libreoffice-task3-page.task-solve-page
  .task-solve__right
  > #hf-game-hub {
  flex: 0 0 auto !important;
  min-height: 0 !important;
}

body.libreoffice-page-task22
  .libreoffice-task3-page.task-solve-page
  .task-solve__right
  > #task-answer-section,
html.has-answer-row-parity
  body.libreoffice-page-task22
  .libreoffice-task3-page.task-solve-page
  .task-solve__right
  > #task-answer-section:not([hidden]) {
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
  margin-top: auto !important;
  align-self: stretch !important;
  /* sticky + relative: sticky побеждает relative из parity, ::before/::after остаются ок */
  position: sticky !important;
  bottom: 0 !important;
  z-index: 30 !important;
}

/* Мобильный statement-pane: колонка не скроллится целиком */
@media (max-width: 768px) {
  body.libreoffice-page-task22.task-mobile-mode.task-mobile-pane-statement
    .task-solve__right {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    min-height: 0 !important;
    height: 100% !important;
  }

  body.libreoffice-page-task22.task-mobile-mode.task-mobile-pane-statement
    .task-solve__right
    > #libreoffice-task9-statement-wrap.task-solve__statement:not([hidden]) {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  body.libreoffice-page-task22.task-mobile-mode.task-mobile-pane-statement
    .task-solve__right
    > #task-answer-section:not([hidden]),
  html.has-answer-row-parity
    body.libreoffice-page-task22.task-mobile-mode.task-mobile-pane-statement
    .task-solve__right
    > #task-answer-section:not([hidden]) {
    display: flex !important;
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    margin-top: auto !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 30 !important;
  }
}
