/* Full image proportions, shared by student tasks and teacher trial pages. */
.student-main .exercise-card img.learning-image{display:block;width:auto;height:auto;max-width:min(100%,420px);max-height:300px;object-fit:contain;margin:16px auto;border-radius:10px;background:transparent}
.student-main .grammar-choice-illustrated img.learning-image[width][height]{
  --grammar-image-height:300px;
  width:min(100%,var(--learning-image-width),calc(var(--grammar-image-height) * var(--learning-image-ratio)));
  aspect-ratio:var(--learning-image-ratio)
}
.student-main .reading-card img.learning-image{max-width:min(100%,360px)}
.preview-body img.learning-image{width:auto;height:auto;max-width:min(100%,220px);max-height:180px;object-fit:contain}
.student-main .anagram-card img.learning-image{max-height:200px}
@media(max-width:600px){
  .student-main .exercise-card img.learning-image{max-width:min(100%,300px);max-height:240px;margin:12px auto}
  .student-main .grammar-choice-illustrated img.learning-image[width][height]{--grammar-image-height:240px}
  .student-main .vocabulary-card img.learning-image{max-height:260px}
  .student-main .anagram-card img.learning-image{max-height:180px}
}
@media(max-width:480px) and (max-height:560px){
  .student-main .grammar-choice-illustrated img.learning-image{max-height:156px;max-height:min(156px,35svh);margin:0 auto 8px}
  .student-main .grammar-choice-illustrated img.learning-image[width][height]{--grammar-image-height:156px}
  @supports(height:1svh){
    .student-main .grammar-choice-illustrated img.learning-image[width][height]{--grammar-image-height:min(156px,35svh)}
  }
}

/* Compact two-column board for unit-review meanings. */
.review-match { max-width: 38rem; }
.review-match .exercise-meta { margin-bottom: .45rem; }
.review-match h1 { margin-block: .3rem; }
.review-match .helper { margin-block: 0 .75rem; }
.review-match-board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.review-match-column { display: grid; gap: .45rem; grid-auto-rows: 3.55rem; }
.review-match-card {
  display: flex; align-items: center; gap: .35rem; position: relative;
  min-width: 0; padding: .2rem .5rem; text-align: left; font: inherit; font-weight: 700;
  border: 1px solid #d5e0df; border-radius: .7rem; background: #fff;
  color: #183936; cursor: pointer; overflow-wrap: anywhere;
}
.review-match-card[data-action="lesson-match-word"] { justify-content: space-between; }
.review-match .review-match-column { grid-auto-rows: minmax(3.55rem, auto); }
.review-phrase-frame { margin: .35rem 0; text-align: center; font-weight: 700; }
.review-blocks .word-token { white-space: pre-wrap; overflow-wrap: anywhere; }
.review-match-card svg { flex: none; color: #356764; }
.review-match-card:hover:not(:disabled), .review-match-card[aria-pressed="true"]:not(:disabled) {
  border-color: #227974; background: #eaf6f3;
}
.review-match-card[data-match-wrong]:not(:disabled) { border-color: #ab5140; background: #fff3ed; }
.review-match-card:focus-visible { outline: 2px solid #227974; outline-offset: 2px; }
.review-match-card[data-matched] { border-color: #b9d4c6; background: #edf6ed; color: #35664e; cursor: default; padding-right: 1.35rem; }
.review-match-card[data-matched] svg { visibility: hidden; }
.review-match-ring { position: absolute; width: 36px; height: 36px; border: 3px solid #39c6a1; border-radius: 50%; }
.review-match-spark { position: absolute; font: 800 18px/1 system-ui,sans-serif; text-shadow: 0 1px 3px #fff9; }
.review-match-check { position: absolute; right: .35rem; font-weight: 800; }
.student-main .exercise-card .review-match-board .review-match-image {
  display: block; flex: none; width: clamp(34px, 9vw, 48px); height: clamp(34px, 9vw, 48px);
  max-width: none; max-height: none; object-fit: contain; margin: 0; border-radius: .35rem; background: #fff;
}
.student-main .exercise-card .prestudy-context-image img.learning-image {
  max-height: clamp(120px, 27svh, 180px);
  margin: .5rem auto;
}
.review-match-status { min-height: 1.4em; margin: .45rem 0 0; color: #35645b; font-size: .9rem; }
.review-start-dialog { width: min(25rem, calc(100% - 2rem)); border: 1px solid #decdbb; border-radius: 1rem; padding: 1.25rem; background: #fffaf5; color: #28312d; }
.review-start-dialog::backdrop { background: #21332b66; }
.review-start-dialog h2 { margin-top: 0; }
@media (max-height: 700px) {
  .review-match .lesson-stages { margin-bottom: .4rem; }
  .review-match-column { grid-auto-rows: 3.35rem; }
}
