/* LU-CHILD-01 — presentation only, loaded AFTER styles.css by the integrator.
   The native learning shell and direct treasure/reward children are the scope.
   No global tokens, DOM changes, hidden controls, content or reward rules.
   Keep colour-coded graphemes and the native reward-before-next DOM order. */
:is(body.learning-focus, body:has(#stage > .treasure-cover), body:has(#stage > .mission-reward-card)):not(.b4-surface) {
  background: #fffcf5;
}
:is(:where(body.learning-focus) #stage, #stage:where(:has(> .treasure-cover), :has(> .mission-reward-card))) {
  --child-ink: #12384a;
  --child-muted: #526777;
  --child-teal: #087e8b;
  --child-deep: #066572;
  --child-line: #d9e2df;
  --muted: var(--child-muted);
  color: var(--child-ink);
  font-family: "Trebuchet MS", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #fffcf5;
  border: 1px solid var(--child-line);
  box-shadow: none;
  overflow: visible;
}
:is(:where(body.learning-focus) #stage, #stage:where(:has(> .treasure-cover), :has(> .mission-reward-card))) :is(.card, .instruction-audio) {
  border: 1px solid var(--child-line);
  background: #fff;
  box-shadow: none;
  border-radius: 22px;
}
:is(:where(body.learning-focus) #stage, #stage:where(:has(> .treasure-cover), :has(> .mission-reward-card))) .titlebar {
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 18px;
}
:is(:where(body.learning-focus) #stage, #stage:where(:has(> .treasure-cover), :has(> .mission-reward-card))) .titlebar h2 {
  color: var(--child-ink);
  letter-spacing: -.025em;
  line-height: 1.15;
}
:is(:where(body.learning-focus) #stage, #stage:where(:has(> .treasure-cover), :has(> .mission-reward-card))) .titlebar p {
  color: var(--child-muted);
  line-height: 1.5;
}
:is(:where(body.learning-focus) #stage, #stage:where(:has(> .treasure-cover), :has(> .mission-reward-card))) :is(.pill, .quest-kicker) {
  background: #eef5ee;
  color: var(--child-deep);
  border-color: var(--child-line);
  box-shadow: none;
}
:is(:where(body.learning-focus) #stage, #stage:where(:has(> .treasure-cover), :has(> .mission-reward-card))) .btn {
  min-height: 48px;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.4;
  border-radius: 15px;
  font-weight: 700;
}
:is(:where(body.learning-focus) #stage, #stage:where(:has(> .treasure-cover), :has(> .mission-reward-card))) .btn.primary {
  background: var(--child-teal);
  color: #fff;
  border: 2px solid transparent;
  box-shadow: 0 3px 0 var(--child-deep);
}
:is(:where(body.learning-focus) #stage, #stage:where(:has(> .treasure-cover), :has(> .mission-reward-card))) .btn.primary:hover:not(:disabled) {
  background: var(--child-deep);
}
:is(:where(body.learning-focus) #stage, #stage:where(:has(> .treasure-cover), :has(> .mission-reward-card))) :is(.btn.gray, .btn.yellow, .comprehension-scene-inspect) {
  background: #fff;
  color: var(--child-deep);
  border: 1px solid #718890;
  box-shadow: none;
}
:is(:where(body.learning-focus) #stage, #stage:where(:has(> .treasure-cover), :has(> .mission-reward-card))) :is(button, summary, a):focus-visible {
  outline: 3px solid var(--child-ink);
  outline-offset: 4px;
  scroll-margin-block: 84px;
}
body.learning-focus #stage .instruction-audio {
  padding: 12px;
  color: var(--child-muted);
  background: #eef5ee;
  line-height: 1.5;
}
body.learning-focus #stage .choice {
  border-color: #c9d7d7;
  box-shadow: 0 3px 0 #e3eae7;
  border-radius: 17px;
}
body.learning-focus #stage .choice.correct {
  background: #e9f5eb;
  border-color: #287346;
  box-shadow: 0 3px 0 #bddbc5;
}
body.learning-focus #stage .choice.wrong {
  background: #fff3da;
  border-color: #a16616;
}
/* Inline <b> remains inline. Flex fragments formerly broke long feedback text. */
body.learning-focus #stage .feedback :is(.ok, .no) {
  display: block;
  position: relative;
  padding: 14px 14px 14px 60px;
  min-height: 64px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  font-weight: 700;
  border: 1px solid #c2ddc9;
  background: #e9f5eb;
  color: #205d38;
}
body.learning-focus #stage .feedback .no {
  border-color: #e2c58a;
  background: #fff4dc;
  color: #795017;
}
body.learning-focus #stage .feedback :is(.ok, .no)::before {
  position: absolute;
  left: 12px;
  top: 14px;
  width: 34px;
  height: 34px;
  box-shadow: none;
}
body.learning-focus #stage .nextbar {
  gap: 12px;
  padding-block: 6px;
}
body.learning-focus #stage .nextbar > .btn { min-width: 0; }
body.learning-focus #stage .comprehension-scene-inspect {
  min-height: 48px;
  line-height: 1.4;
  white-space: normal;
}
#stage:has(> .treasure-cover) :is(.treasure-cover, .treasure-showcase),
#stage > .mission-reward-card {
  background: #eef5ee;
  border-color: #c9dcd1;
}
#stage:has(> .treasure-cover) :is(.treasure-card, .badge-card) {
  border: 1px solid #cbdad1;
  border-radius: 18px;
  background: #fff;
  box-shadow: none;
  padding: 14px 10px;
  min-width: 0;
  overflow: visible;
}
#stage:has(> .treasure-cover) :is(.treasure-card, .badge-card).locked {
  border: 1px dashed #8a9b96;
  background: #fafbf8;
}
#stage:has(> .treasure-cover) :is(.treasure-card, .badge-card) b {
  color: var(--child-ink);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
#stage:has(> .treasure-cover) :is(.treasure-more, .badge-more) > summary {
  min-height: 48px;
  padding-block: 14px;
  line-height: 1.5;
  color: var(--child-deep);
  border-radius: 10px;
}
:is(#stage:has(> .treasure-cover), #stage:has(> .mission-reward-card)) .collection-reward-progress {
  background: #fffcf5;
  border-color: #d8e1d6;
  box-shadow: none;
}
:is(#stage:has(> .treasure-cover), #stage:has(> .mission-reward-card)) .collection-reward-caption {
  gap: 8px;
  line-height: 1.5;
}
body.large-text #stage:has(> .treasure-cover) :is(.treasure-card, .badge-card) small,
body.large-text #stage:has(> .treasure-cover) .treasure-cover > p,
body.large-text :is(#stage:has(> .treasure-cover), #stage:has(> .mission-reward-card)) .collection-reward-caption small {
  font-size: 16px !important; /* Native treasure descriptions use inline 13px. */
  line-height: 1.5;
}
@media (max-width: 360px) {
  body.learning-focus #stage .nextbar { flex-direction: column; align-items: stretch; }
  body.learning-focus #stage .nextbar > .btn { width: 100%; flex: 0 0 auto; }
  body.learning-focus #stage .feedback :is(.ok, .no) { padding-left: 52px; }
  body.learning-focus #stage .feedback :is(.ok, .no)::before { left: 9px; width: 30px; height: 30px; }
}

/* Tiny 320px Aa+ mini-text: keep the first reading line above mobile navigation.
   This compacts decoration and spacing only: audio/replay, words and buttons stay. */
@media (max-width: 360px) {
  body.learning-focus.large-text #stage:has(.mini-text-reading) .titlebar {
    margin-bottom: 8px;
  }
  body.learning-focus.large-text #stage:has(.mini-text-reading) .instruction-audio {
    padding-block: 8px;
  }
  body.learning-focus.large-text #stage:has(.mini-text-reading) .exercise-leo {
    width: 48px;
    height: 48px;
    margin-bottom: 6px;
  }
  body.learning-focus.large-text #stage:has(.mini-text-reading) .readaloud-sentence {
    margin-top: 10px;
  }
}

/* Keep native keyboard scrolling clear of the fixed child navigation. */
html:has(body.learning-focus), html:has(#stage > .treasure-cover), html:has(#stage > .mission-reward-card) { scroll-padding-block: 84px 100px; }
body.learning-focus .top { background: #fffcf5; }

/* LUMA 320px UX: preserve the full “Aventure” bottom-tab label in Aa+.
   Redistribute existing space; keep font size, tap target and 4-tab grid. */
@media (max-width: 360px) {
  body.b4-surface #nav { gap: 3px; padding-left: 8px; padding-right: 8px; }
  body.b4-surface #nav > .nav-btn { padding-left: 2px; padding-right: 2px; }
}

/* Frame the existing celebration portrait with LUMA's archipelago. Keep the
   result and actions on a solid background as text grows or wraps. */
#syllableQuizResult {
  --archipelago-band: clamp(72px, 16vw, 108px);
  position: relative;
  isolation: isolate;
  padding: 0 12px 12px;
  border: 1px solid #cbdad1;
  border-radius: 18px;
  background: #fff;
}
#syllableQuizResult::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  height: var(--archipelago-band);
  border-radius: 17px 17px 0 0;
  background: #e6f1ec url("assets/leo-archipel.png") center 48% / cover no-repeat;
}
#syllableQuizResult > .activity-finish-leo {
  width: var(--archipelago-band);
  height: var(--archipelago-band);
  margin: 0 auto;
}
#syllableQuizResult > h3 {
  padding-top: 10px;
}
/* LU-CHILD-B-FINISH-02 — quiet B4 celebration for the existing Bulles express
   result. Reuse the approved local archipelago; preserve scores, bubbles and
   accessible actions on opaque white. Presentation only, no new reward. */
#bubbleRoundResult.bubble-finish {
  --bubble-archipelago-band: clamp(72px, 16vw, 108px);
  position: relative;
  isolation: isolate;
  padding: 0 12px 12px;
  border: 1px solid #cbdad1;
  border-radius: 18px;
  background: #fff;
  box-shadow: none;
}
#bubbleRoundResult.bubble-finish::before {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  inset: 0 0 auto;
  height: var(--bubble-archipelago-band);
  border-radius: 17px 17px 0 0;
  background: #e6f1ec url("assets/leo-archipel.png") center 48% / cover no-repeat;
}
#bubbleRoundResult > .activity-finish-leo {
  width: var(--bubble-archipelago-band);
  height: var(--bubble-archipelago-band);
  margin: 0 auto;
}
#bubbleRoundResult > h3 {
  padding-top: 10px;
  color: #12384a;
}
#bubbleRoundResult .bubble-finish-total {
  color: #066572;
}
