/* Learning notes share the Learn theme; resource visibility stays with the editor. */
body[data-hypatia-design="modern"] #exampleModal .modal-dialog {
  width: calc(100% - 48px);
  max-width: 840px !important;
  min-height: 0 !important;
  margin: 24px auto;
}

body[data-hypatia-design="modern"] #exampleModal .modal-content {
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  border: 1px solid var(--ht-line) !important;
  box-shadow: 0 18px 60px #172f4220;
}

body[data-hypatia-design="modern"] #exampleModal :is(.modal-header,.modal-footer) {
  flex-shrink: 0;
  background: var(--ht-paper) !important;
}

body[data-hypatia-design="modern"] #exampleModal .modal-header {
  align-items: center;
  padding: 17px 24px;
  border-bottom: 1px solid var(--ht-line) !important;
}

body[data-hypatia-design="modern"] #exampleModal .modal-title {
  font-size: 1.125rem;
  font-weight: 650;
  text-transform: none !important;
}

body[data-hypatia-design="modern"] #exampleModal .modal-header .close {
  display: grid;
  place-items: center;
  min-width: 40px;
  min-height: 40px;
  margin: -8px -8px -8px auto;
  padding: 4px;
  border-radius: 8px;
  opacity: 1;
  color: var(--ht-muted);
  text-shadow: none;
}

body[data-hypatia-design="modern"] #exampleModal .modal-header .close:hover {
  color: var(--ht-blue);
  background: var(--ht-selected);
}

body[data-hypatia-design="modern"] #exampleModal .modal-body {
  min-height: 0;
  padding: 24px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  color: var(--ht-ink);
  font-size: var(--ht-text-sm);
  line-height: 1.65;
}

body[data-hypatia-design="modern"] #exampleModal .modal-body > .px-3,
body[data-hypatia-design="modern"] #exampleModal .modal-body > .px-3 > .container {
  width: 100%;
  max-width: none;
  padding: 0 !important;
}

body[data-hypatia-design="modern"] #exampleModal .modal-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--ht-line);
}

body[data-hypatia-design="modern"] #exampleModal #question-resources-content > :is(.mb-5,.mb-3) {
  margin: 0 0 24px !important;
}

body[data-hypatia-design="modern"] #exampleModal #question-resources-content > :last-child {
  margin-bottom: 0 !important;
}

body[data-hypatia-design="modern"] #exampleModal :is(#useful-facts-top,#key-concepts-top,#exampleQuestionTitle,#example,#questionAndSolution,#learning-resources-top) {
  min-width: 0;
  margin-left: 0;
  margin-right: 0;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

body[data-hypatia-design="modern"] #exampleModal :is(#useful-facts-top,#key-concepts-top,#exampleQuestionTitle,#questionAndSolution,#learning-resources-top) > :is(.col,.col-lg-12) {
  min-width: 0;
  padding-left: 0;
  padding-right: 0;
}

body[data-hypatia-design="modern"] #exampleModal :is(#useful-facts-section,#key-concepts-section) {
  padding: 18px 20px !important;
  border: 1px solid var(--ht-line);
  border-radius: 11px;
  background: var(--ht-soft) !important;
}

body[data-hypatia-design="modern"] #exampleModal #useful-facts-section {
  border-left: 3px solid var(--ht-light);
}

body[data-hypatia-design="modern"] #exampleModal :is(#useful-facts-section,#key-concepts-section,#exampleQuestionContent,#exampleSolution,#recommendation,#external) > :is(h5,.h5),
body[data-hypatia-design="modern"] #exampleModal :is(#exampleQuestionTitle,#questionAndSolution) > :is(.col,.col-lg-12) > h5 {
  margin: 0 0 12px;
  font-size: var(--ht-text-sm);
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none !important;
  color: var(--ht-ink) !important;
}

body[data-hypatia-design="modern"] #exampleModal :is(#exampleQuestionTitle,#questionAndSolution) > :is(.col,.col-lg-12) > h5 {
  font-size: 1rem;
}

body[data-hypatia-design="modern"] #exampleModal #example {
  margin-bottom: 0 !important;
}

body[data-hypatia-design="modern"] #exampleModal #exampleQuestionContent {
  min-width: 0;
  margin-bottom: 0 !important;
  padding: 18px 20px !important;
  border: 1px solid var(--ht-line);
  border-bottom: 0;
  border-radius: 11px 11px 0 0;
  background: var(--ht-soft) !important;
}

body[data-hypatia-design="modern"] #exampleModal #exampleSolution {
  min-width: 0;
  padding: 18px 20px !important;
  border: 1px solid var(--ht-line);
  border-radius: 0 0 11px 11px;
  background: var(--ht-paper);
}

body[data-hypatia-design="modern"] #exampleModal #actualProblemAccordion {
  overflow: hidden;
  border: 1px solid var(--ht-line);
  border-radius: 11px;
}

body[data-hypatia-design="modern"] #exampleModal #actualProblemAccordion > .card {
  margin: 0;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none;
}

body[data-hypatia-design="modern"] #exampleModal #solutionQuestionCard {
  background: var(--ht-soft) !important;
}

body[data-hypatia-design="modern"] #exampleModal #actualProblemAccordion .card-header {
  padding: 14px 20px !important;
  border-radius: 0;
}

body[data-hypatia-design="modern"] #exampleModal #actualProblemAccordion .card-header h6 {
  font-size: var(--ht-text-sm);
  font-weight: 650;
  text-transform: none !important;
  color: var(--ht-ink) !important;
}

body[data-hypatia-design="modern"] #exampleModal #actualProblemAccordion .card-body {
  min-width: 0;
  padding: 0 20px 18px;
}

body[data-hypatia-design="modern"] #exampleModal #solutionCard {
  border-top: 1px solid var(--ht-line) !important;
  background: var(--ht-paper) !important;
}

body[data-hypatia-design="modern"] #exampleModal #solutionCard .card-header {
  padding: 0 !important;
}

body[data-hypatia-design="modern"] #exampleModal #solutionCard [data-toggle="collapse"] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 12px 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ht-blue) !important;
  font-family: inherit;
  font-size: var(--ht-text-sm);
  font-weight: 600;
  line-height: 1.5;
  text-align: left;
  text-transform: none !important;
  cursor: pointer;
}

body[data-hypatia-design="modern"] #exampleModal #solutionCard [data-toggle="collapse"]:hover {
  background: var(--ht-selected);
}

body[data-hypatia-design="modern"] #exampleModal #solutionCard [data-toggle="collapse"]:focus-visible {
  outline-offset: -4px;
}

body[data-hypatia-design="modern"] #exampleModal #learning-resources-top > .col > .border {
  padding: 18px 20px !important;
  border-color: var(--ht-line) !important;
  border-radius: 11px !important;
  background: var(--ht-soft);
}

body[data-hypatia-design="modern"] #exampleModal #learning-resources-links {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
}

body[data-hypatia-design="modern"] #exampleModal #learning-resources-links li::marker {
  color: var(--ht-muted);
}

body[data-hypatia-design="modern"] #exampleModal :is(.recipe-content,.keyConcepts-content,.question-content,.solution-content,.currQuestion-content,.currQuestion-math-content,.currQuestion-recommendations) {
  min-width: 0;
  max-width: 100%;
  padding-left: 0 !important;
  padding-right: 0 !important;
  overflow-x: auto;
  overflow-wrap: anywhere;
  overscroll-behavior-x: contain;
}

body[data-hypatia-design="modern"] #exampleModal :is(.recipe-content,.keyConcepts-content,.question-content,.solution-content,.currQuestion-content,.currQuestion-recommendations) > :last-child {
  margin-bottom: 0;
}

body[data-hypatia-design="modern"] #exampleModal #question-resources-content :is(p,ul,ol,blockquote) {
  margin-bottom: 12px;
}

body[data-hypatia-design="modern"] #exampleModal #question-resources-content :is(ul,ol) {
  padding-left: 22px;
}

body[data-hypatia-design="modern"] #exampleModal #question-resources-content li + li {
  margin-top: 6px;
}

body[data-hypatia-design="modern"] #exampleModal #question-resources-content a {
  color: var(--ht-blue);
  text-decoration: underline;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

body[data-hypatia-design="modern"] #exampleModal #question-resources-content :is(img,video) {
  max-width: 100%;
  height: auto;
}

/* Wide equations retain their readable size and scroll within their own section. */
body[data-hypatia-design="modern"] #exampleModal mjx-container[display="true"] {
  max-width: 100%;
  padding: 4px 0;
  overflow-x: auto;
  overflow-y: hidden;
}

body[data-hypatia-design="modern"] #exampleModal mjx-container > svg {
  max-width: none;
}

body[data-hypatia-design="modern"] #exampleModal #no-content {
  margin: 0;
  color: var(--ht-muted);
  font-size: var(--ht-text-sm);
  text-transform: none !important;
}

@media (max-width: 575.98px) {
  body[data-hypatia-design="modern"] #exampleModal .modal-dialog {
    width: calc(100% - 16px);
    margin: 8px auto;
  }

  body[data-hypatia-design="modern"] #exampleModal .modal-content {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }

  body[data-hypatia-design="modern"] #exampleModal :is(.modal-header,.modal-footer) {
    padding: 12px 16px;
  }

  body[data-hypatia-design="modern"] #exampleModal .modal-body {
    padding: 16px;
    scrollbar-gutter: auto;
  }

  body[data-hypatia-design="modern"] #exampleModal :is(#useful-facts-section,#key-concepts-section,#exampleQuestionContent,#exampleSolution),
  body[data-hypatia-design="modern"] #exampleModal #learning-resources-top > .col > .border {
    padding: 14px !important;
  }

  body[data-hypatia-design="modern"] #exampleModal #actualProblemAccordion .card-header {
    padding: 14px !important;
  }

  body[data-hypatia-design="modern"] #exampleModal #solutionCard .card-header {
    padding: 0 !important;
  }

  body[data-hypatia-design="modern"] #exampleModal #actualProblemAccordion .card-body {
    padding: 0 14px 14px;
  }

  body[data-hypatia-design="modern"] #exampleModal #solutionCard [data-toggle="collapse"] {
    padding: 12px 14px;
  }
}
