/* Shared ordinary / experiment / tutorial Book controls. DOM and transports stay intact. */
.learning-screen {container-type:inline-size;container-name:wwi-learning;}
.learning-screen .book-word {max-width:100%;overflow-wrap:anywhere;}
/* Keep the established word-navigation hit areas; common 48px is a floor only. */
:root body .learning-screen :is(.learning-word-button,.learning-word-nav a) {min-height:240px;}
@media (max-width:900px) {
 :root body .learning-screen :is(.learning-word-button,.learning-word-nav a) {min-height:72px;}
}
.learning-screen .book-page-right:has(#image-area) .book-page-inner {
 display:grid;grid-template-columns:48px minmax(0,1fr) 48px;
 column-gap:8px;row-gap:16px;align-content:center;align-items:stretch;
}
.learning-screen .book-page-right:has(#image-area) #image-area,
.learning-screen .book-page-right:has(#image-area) .book-image-box,
.learning-screen .book-page-right:has(#image-area) .image-nav,
.learning-screen .book-page-right:has(#image-area) .book-actions {display:contents;}
.learning-screen .book-page-right:has(#image-area) .book-image-box>img,
.learning-screen .book-page-right:has(#image-area) .book-image-box>p {
 grid-column:2;grid-row:2;width:100%;min-width:0;max-width:100%;
 height:auto;max-height:none;aspect-ratio:1;object-fit:contain;
 margin:0;box-sizing:border-box;border:1px dashed #a9b3bf;border-radius:12px;background:#fafafa;
}
.learning-screen .book-page-right:has(#image-area) .book-image-box>p {display:grid;place-items:center;padding:8px;overflow-wrap:anywhere;}
.learning-screen .book-page-right:has(#image-area) .wwi-gallery-trigger {
 grid-column:2;grid-row:1;width:100%;min-width:0;max-width:100%;min-height:48px;
 margin:0;box-sizing:border-box;padding:10px 6px;white-space:normal;overflow-wrap:anywhere;
}
.learning-screen .book-page-right:has(#image-area) .image-nav-arrow {
 align-self:stretch;width:48px;height:auto;min-width:0;min-height:48px;
 margin:0;box-sizing:border-box;padding:4px;display:flex;align-items:center;justify-content:center;
}
.learning-screen .book-page-right:has(#image-area) .image-nav-prev {grid-column:1;grid-row:2;}
.learning-screen .book-page-right:has(#image-area) .image-nav-next {grid-column:3;grid-row:2;}
.learning-screen .book-page-right:has(#image-area) .image-nav-arrow::after {content:none;}
.learning-screen .book-page-right:has(#image-area) .wwi-image-position {grid-column:2;grid-row:3;align-self:center;min-width:0;margin:0;padding:0;}
.learning-screen .book-page-right:has(#image-area) #generate-button {
 grid-column:2;grid-row:4;width:100%;min-width:0;max-width:100%;min-height:48px;
 margin:0;box-sizing:border-box;padding:10px 6px;white-space:normal;overflow-wrap:anywhere;
}
.learning-screen .book-page-right:has(#image-area) .book-rating {grid-column:1/-1;grid-row:5;min-width:0;width:100%;margin:0;}
.learning-screen .book-page-right:has(#image-area) .book-actions>:not(#generate-button) {grid-column:1/-1;min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere;}
.learning-screen .book-page-right:has(#image-area) #study-generation-save-status:empty {display:none;}
/* Query the whole learning screen, not the narrow right page of a desktop spread. */
@container wwi-learning (max-width:479px) {
 .learning-screen .book-page-right:has(#image-area) .book-page-inner {grid-template-columns:repeat(3,minmax(0,1fr));}
 .learning-screen .book-page-right:has(#image-area) .book-image-box>img,
 .learning-screen .book-page-right:has(#image-area) .book-image-box>p {grid-column:1/-1;grid-row:1;}
 .learning-screen .book-page-right:has(#image-area) .wwi-gallery-trigger {grid-column:2;grid-row:2;min-height:52px;font-size:13px;line-height:1.4;padding:7px 4px;}
 .learning-screen .book-page-right:has(#image-area) .image-nav-arrow {width:100%;min-height:52px;font-size:24px;}
 .learning-screen .book-page-right:has(#image-area) .image-nav-prev {grid-column:1;grid-row:3;}
 .learning-screen .book-page-right:has(#image-area) .image-nav-next {grid-column:3;grid-row:3;}
 .learning-screen .book-page-right:has(#image-area) .wwi-image-position {grid-column:2;grid-row:3;}
 .learning-screen .book-page-right:has(#image-area) #generate-button {grid-column:2;grid-row:4;min-height:52px;font-size:13px;line-height:1.4;padding:7px 4px;}
}

/* Book is the primary content. Keep the title hook for guidance/resource notices,
   and put the real word position below the spread and its navigation. */
:root body .learning-screen .book-title {display:none;}
:root body .learning-screen > .book-topbar:not(:has(.button,.study-resource-issues)) {margin:0;min-height:0;}
:root body .learning-screen > .book-topbar:has(.button) {justify-content:flex-end;margin-bottom:8px;}
:root body .learning-screen > .book-word-position {
 grid-column:1;grid-row:3;margin:10px 0 4px;text-align:center;
 color:#334155;font-size:20px;font-weight:700;line-height:1.3;
}
/* Reserve the same space in both experiment Books when a comment is edited,
   saved or rejected. Longer issue lists scroll inside the left page. */
:root body .learning-screen [data-experiment-wwi-book] .book-notice-slot {
 block-size:4.75rem;min-block-size:0;overflow:auto;scrollbar-gutter:stable;
 overscroll-behavior:contain;font-size:16px;line-height:1.4;
}
:root body .learning-screen [data-experiment-wwi-book] .book-notice-slot .study-draft-status {
 font-size:inherit;line-height:inherit;
}
:root body .learning-screen [data-experiment-wwi-book] .book-notice-slot button {
 max-inline-size:100%;min-block-size:44px;font-size:16px;white-space:normal;
}
:root body .learning-screen .rating-comment-send {font-size:16px;}
@media(max-width:900px) {
 :root body .learning-screen > .book-word-position {grid-row:4;margin-block:0 12px;}
}
@media(max-width:900px),(max-height:599.99px) {
 /* Preserve touch-target heights on mobile and short desktop windows; longer
    labels wrap and grow with the document instead of shrinking text. */
 :root body .learning-screen :is(.book-meta,.word-response-question,.rating-comment-label,.rating-comment,.wwi-image-position,.learning-word-button,.learning-word-nav a,.book-topbar .button),
 :root body .learning-screen .rating-dimension[data-rating-dimension] > p,
 :root body .learning-screen .word-response-box > .rating-options > .rating-option,
 :root body .learning-screen .rating-dimension[data-rating-dimension] > .rating-options > .rating-option,
 :root body .learning-screen .book-page-right:has(#image-area) :is(.wwi-gallery-trigger,#generate-button) {font-size:16px;}
}

/* Use actual viewport height without scaling text or controls. The content's
   intrinsic minimum wins: long instructions/errors and short windows scroll
   the document naturally, never a clipped or internally scrolling Book. */
@media(min-width:901px) and (min-height:600px) {
 body.experiment-learning-active,
 body:has(>main.learning-screen) {
  height:100vh;height:100dvh;display:flex;flex-direction:column;
 }
 body.experiment-learning-active > main,
 body:has(>main.learning-screen) > main {
  flex:1;min-height:0;
 }
 body.experiment-learning-active > main {
  display:flex;flex-direction:column;
 }
 body.experiment-learning-active > .site-nav.ui-banner {margin-block-end:4px;}
 body.experiment-learning-active > main > :is(#assessment-app,#experiment-tutorial-app).learning-screen,
 body:has(>main.learning-screen) > main.learning-screen,
 body.experiment-learning-active [data-preview-learning]:not([hidden]) {
  flex:1;min-height:0;
 }
 body.experiment-learning-active [data-preview-learning]:not([hidden]) {
  display:flex;flex-direction:column;
 }
 body.experiment-learning-active [data-preview-learning] > .learning-screen {flex:1;min-height:0;}
 :root body .learning-screen {
  box-sizing:border-box;width:100%;max-width:1200px;margin:0 auto;
  padding:8px clamp(100px,7.5vw,110px) 32px;max-block-size:680px;
  grid-template-rows:auto minmax(min-content,1fr) auto;
 }
 :root body .learning-screen > .book-spread-frame {
  min-width:0;min-height:min-content;aspect-ratio:auto;padding:8px;
 }
 /* The assessment shell adds section margins even when the Book is a grid
    item. The Book grid already separates the guidance and the word position. */
 :root body .learning-screen.experiment-book > .book-spread-frame {margin-block:0;}
 :root body .learning-screen .book-page {min-height:0;}
 :root body .learning-screen .book-page-inner {padding:10px;gap:8px;}
 :root body .learning-screen .book-word {font-size:40px;line-height:1.15;}
 :root body .learning-screen .book-meta {font-size:16px;line-height:1.25;}
 :root body .learning-screen .word-response-box {margin-top:8px;gap:8px;}
 :root body .learning-screen .word-response-question,
 :root body .learning-screen .rating-comment-label {font-size:16px;line-height:1.3;}
 :root body .learning-screen .rating-comment {min-height:64px;font-size:16px;line-height:1.4;}
 :root body .learning-screen .rating-comment-meta {min-block-size:20px;margin-top:0;}
 :root body .learning-screen .book-page-right:has(#image-area) .book-page-inner {
  grid-template-columns:48px minmax(0,1fr) 48px;
  grid-template-rows:minmax(44px,auto) minmax(100px,1fr) auto minmax(44px,auto) auto;
  column-gap:6px;row-gap:6px;align-content:stretch;
 }
 :root body .learning-screen .book-page-right:has(#image-area) .book-image-box > :is(img,p) {
  width:100%;height:100%;min-height:0;max-height:100%;aspect-ratio:auto;
  object-fit:contain;align-self:stretch;
 }
 :root body .learning-screen .book-page-right:has(#image-area) .book-image-box > img {
  contain:size;contain-intrinsic-size:100px 100px;
 }
 :root body .learning-screen .book-page-right:has(#image-area) :is(.wwi-gallery-trigger,#generate-button) {
  min-height:44px;padding:6px;font-size:16px;line-height:1.25;
 }
 :root body .learning-screen .book-page-right:has(#image-area) .wwi-image-position {
  font-size:16px;line-height:1.25;
 }
 :root body .learning-screen .rating-box {width:100%;gap:6px;}
 :root body .learning-screen .rating-dimension[data-rating-dimension] {
  display:grid;grid-template-columns:minmax(74px,.65fr) minmax(0,2fr);
  align-items:center;gap:6px;margin:0;width:100%;text-align:left;
 }
 :root body .learning-screen .rating-dimension[data-rating-dimension] > p {
  margin:0;font-size:16px;line-height:1.25;
 }
 :root body .learning-screen .rating-options,
 :root body .learning-screen .rating-dimension[data-rating-dimension] > .rating-options {gap:6px;}
 :root body .learning-screen .word-response-box > .rating-options > .rating-option,
 :root body .learning-screen .rating-dimension[data-rating-dimension] > .rating-options > .rating-option {
  min-height:44px;min-width:44px;padding:5px 6px;font-size:16px;line-height:1.2;
 }
 :root body .learning-screen :is(.learning-word-button,.learning-word-nav a) {
  width:90px;min-height:160px;font-size:16px;line-height:1.3;
 }
 :root body .learning-screen > .learning-word-nav {width:calc(100% + 196px);margin-inline:-98px;}
 :root body .learning-screen > .book-word-position {margin:8px 0 0;}
}

/* A static, layout-neutral cue for the existing missing-rating notice. */
.learning-screen .study-guidance-highlight{outline:3px solid #b45309;outline-offset:4px;border-radius:4px}
.learning-screen .book-notice-slot .study-guidance-highlight{outline-offset:-3px;padding:4px}

/* Keep the language label in its existing row so POS and word stay in place. */
.learning-screen .book-page-left .book-meta[data-learning-language] {
 align-self:stretch;
 text-align:start;
 overflow-wrap:anywhere;
}
.learning-screen .book-meta[data-learning-language] > span {
 font-size:.875em;
 font-weight:700;
}

/* An unmet requirement must not take height away from the image row. */
.experiment-book.learning-screen :is(.rating-box,.rating-dimension,.word-response-box).rating-required-highlight {
 border:0;
 padding:0;
 outline:2px solid #b42318;
 outline-offset:-2px;
 animation:none;
}
