/* Stable feedback for standard choice questions in Student Mode.
   Builders and teacher layouts retain their existing response behaviour. */
.practice-primary-action-reserve {
  display: none;
}

html.dmr-student-app-mode.dmr-practice-active .practice-stage.has-stable-choice-feedback:has(> .practice-answer-pane:not(.practice-hidden)) {
  grid-template-rows: auto;
  align-content: start;
  align-items: start;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-anchor: none;
  scrollbar-gutter: stable;
}

html.dmr-student-app-mode.dmr-practice-active .practice-stage.has-stable-choice-feedback .practice-question-pane,
html.dmr-student-app-mode.dmr-practice-active .practice-stage.has-stable-choice-feedback .practice-answer-pane {
  align-self: start;
  height: auto;
  max-height: none;
  overflow: visible;
}

/* A natural minimum keeps short equations readable without clipping longer
   prompts or recentering them when the other column's feedback grows. */
html.dmr-student-app-mode.dmr-practice-active .practice-stage.has-stable-choice-feedback .practice-question-pane > .practice-question-body {
  height: auto;
  min-height: clamp(150px, 26vh, 230px);
  max-height: none;
  overflow: visible;
}

html.dmr-student-app-mode.dmr-practice-active .practice-stage.has-stable-choice-feedback .practice-answer-pane {
  grid-template-rows: auto auto;
  align-content: start;
  align-items: start;
}

html.dmr-student-app-mode.dmr-practice-active .practice-stage.has-stable-choice-feedback .practice-answer-pane > .practice-answer-options {
  align-content: start;
  height: auto;
  max-height: none;
  overflow: visible;
}

/* Compact source layouts hide answered choices. Keep the same disabled
   controls in place here so the action row does not jump after checking. */
html.dmr-student-app-mode.dmr-practice-active .practice-stage.has-stable-choice-feedback .practice-answer-pane > .practice-answer-options.is-answered:not(.practice-hidden) {
  display: grid;
}

html.dmr-student-app-mode.dmr-practice-active .practice-stage.has-stable-choice-feedback .practice-answer-pane > .practice-response-strip {
  position: static;
  bottom: auto;
  z-index: auto;
  align-items: start;
}

html.dmr-student-app-mode.dmr-practice-active .practice-stage.has-stable-choice-feedback .practice-response-copy {
  box-sizing: border-box;
  min-height: max(5.5rem, var(--dmr-feedback-min-height, 0px));
  align-content: start;
  overflow: visible;
}

html.dmr-student-app-mode.dmr-practice-active .practice-stage.has-stable-choice-feedback .practice-feedback {
  box-sizing: border-box;
  min-height: calc(2.7em + 20px);
  padding: 8px 12px;
  border: 4px solid transparent;
  font-size: clamp(15px, 1.6vw, 20px);
  line-height: 1.35;
  overflow: visible;
  overflow-wrap: anywhere;
}

html.dmr-student-app-mode.dmr-practice-active .practice-stage.has-stable-choice-feedback .practice-feedback:is(.is-correct, .is-incorrect) {
  border-color: var(--dmr-ink);
}

html.dmr-student-app-mode.dmr-practice-active .practice-stage.has-stable-choice-feedback .practice-answer {
  max-height: none;
  overflow: visible;
}

/* Only the normal Enter/Next pair overlaps. Recovery actions can coexist with
   Next and therefore stay in separate, automatically sized grid rows. */
html.dmr-student-app-mode.dmr-practice-active .practice-stage.has-stable-choice-feedback .practice-response-actions__primary > .practice-actions:last-child {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  justify-items: end;
}

html.dmr-student-app-mode.dmr-practice-active .practice-stage.has-stable-choice-feedback .practice-response-actions__primary > .practice-actions:last-child > * {
  grid-column: 1;
}

html.dmr-student-app-mode.dmr-practice-active .practice-stage.has-stable-choice-feedback :is(#enterPracticeAnswerButton, #nextPracticeQuestionButton, .practice-primary-action-reserve) {
  grid-row: 1;
  align-self: stretch;
  min-height: 44px;
}

html.dmr-student-app-mode.dmr-practice-active .practice-stage.has-stable-choice-feedback .practice-primary-action-reserve,
html.dmr-student-app-mode.dmr-practice-active .practice-stage.has-stable-choice-feedback :is(#enterPracticeAnswerButton, #nextPracticeQuestionButton, #dontKnowPracticeButton).practice-hidden {
  display: flex !important;
  visibility: hidden;
  pointer-events: none;
}

html.dmr-student-app-mode.dmr-practice-active .practice-stage.has-stable-choice-feedback .practice-primary-action-reserve {
  align-items: center;
  justify-content: center;
}

@media (max-width: 719px), (max-height: 599px) {
  html.dmr-student-app-mode.dmr-practice-active .practice-stage.has-stable-choice-feedback:has(> .practice-answer-pane:not(.practice-hidden)) {
    grid-template-rows: auto auto;
  }
}
