/* NO KEN BURNS. No zoom, pan, drift, scale, translate, rotate or size change on any image, on any container of an image, or on any overlay drawn over an image — ever. Pictures may only fade (opacity). Nothing inside `.stage` may animate or transition `transform`, `scale`, `translate`, `rotate`, `width`, `height`, `inset`, `object-position`, `background-position` or `filter`. */
/* PrimerEDU additions: field-journal tutor */
.opt { text-transform: none; letter-spacing: 0; font-size: 0.8rem; color: var(--muted); }
.age-pills { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.pill { border: 1px solid var(--rule); background: rgba(255,252,245,.8); border-radius: 999px; padding: 10px 18px; font-family: Fraunces, serif; font-size: 1.02rem; }
.pill.on { background: var(--moss); color: #f7f3ea; border-color: var(--moss-deep); }
.topic-row { margin-bottom: 4px; align-items: stretch; }
.topic-row input { flex: 1; min-width: 0; border: 1px solid var(--rule); border-radius: 10px; background: #fffaf1; padding: 10px 12px; }
.topic-row .secondary { flex: 0 0 auto; white-space: nowrap; }
#suggestStatus { margin: 4px 0 18px; min-height: 1em; }
.age-tag { font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--rule); border-radius: 999px; padding: 3px 10px; }

.lesson { margin: 10px 0 4px; padding: 10px 14px; border-left: 3px solid var(--moss); background: linear-gradient(90deg, rgba(201,215,196,.45), transparent); border-radius: 0 10px 10px 0; }
.lesson-label { display: block; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.lesson p { margin: 0 0 8px; font-family: Fraunces, serif; font-size: 1.05rem; }
.progress { display: flex; gap: 6px; flex-wrap: wrap; }
.progress .step { font-size: .74rem; padding: 2px 9px; border-radius: 999px; border: 1px dashed var(--rule); color: var(--muted); }
.progress .step.on { border-style: solid; border-color: var(--moss); color: var(--moss-deep); background: rgba(201,215,196,.5); }

.tutor { position: relative; padding-top: 16px; }
.move-tag { display: inline-block; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--moss-deep); background: rgba(201,215,196,.6); border-radius: 999px; padding: 2px 9px; margin-bottom: 8px; }
.answer .you { display: block; font-size: .9rem; color: var(--muted); font-style: italic; margin-bottom: 6px; }
.answer .thinking { color: var(--muted); animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .35; } }

.storyboard.n3 { grid-template-columns: 1fr; }
@media (min-width: 640px) { .storyboard.n3 { grid-template-columns: repeat(3, 1fr); } .storyboard.n1 { grid-template-columns: minmax(0, 420px); justify-content: center; } }
.frame { box-shadow: 0 1px 0 var(--shadow), 0 8px 18px -12px var(--shadow); transform: rotate(-.3deg); }
.frame:nth-child(2) { transform: rotate(.4deg); }
.frame .art { overflow: hidden; }
.frame .art img.layer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--paper); opacity: 0; transition: opacity .35s ease; }
.frame .art img.layer.shown { opacity: 1; }
.frame .art img.layer-sketch { filter: grayscale(.2) contrast(1.05); }
.frame .role { position: absolute; top: 8px; right: 8px; z-index: 3; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; background: var(--moss); color: #f7f3ea; border-radius: 999px; padding: 2px 8px; }
.frame .stage { z-index: 3; }
.frame figcaption { font-size: .95rem; color: var(--ink); }
.pending { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pencil { width: 46px; height: 2px; background: var(--ink-soft); border-radius: 2px; animation: scribble 1.1s ease-in-out infinite alternate; transform-origin: left; }
@keyframes scribble { from { transform: scaleX(.2) rotate(-4deg); } to { transform: scaleX(1) rotate(3deg); } }
.frame .cover { display: none; }
.frame.covered .cover { display: grid; place-items: center; position: absolute; inset: 0; z-index: 4; border: 0; background:
  repeating-linear-gradient(-35deg, rgba(122,109,92,.08) 0 2px, transparent 2px 9px), #efe4cd; color: var(--ink-soft); font-family: Fraunces, serif; font-size: 1.05rem; line-height: 1.5; padding: 12px; }
.frame.covered .stage, .frame.covered .role { z-index: 5; }
@media (prefers-reduced-motion: reduce) { .frame .art img.layer, .pencil, .answer .thinking { transition: none; animation: none; } }

.wonder { margin: 6px 0 10px; }
.wonder-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wonder-chip { border: 1px solid var(--rule); background: #fffaf1; border-radius: 14px; padding: 8px 12px; text-align: left; max-width: 100%; font-size: .98rem; }
.wonder-chip::before { content: "✦ "; color: var(--moss); }
.wonder-chip:hover { background: rgba(201,215,196,.4); }
.restyle { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .88rem; color: var(--ink-soft); margin: 4px 0; }
.small { padding: 5px 12px; font-size: .85rem; }

.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.ghost-chip { border: 1px dashed var(--rule); background: rgba(255,252,245,.7); border-radius: 999px; padding: 5px 12px; font-size: .86rem; color: var(--ink-soft); }
.composer.voice-only .row { justify-content: center; }
.composer.voice-only .mic-big { width: 72px; height: 72px; flex-basis: 72px; }

.dev-panel { width: min(640px, 100%); max-height: min(86vh, 900px); overflow-y: auto; overflow-x: hidden; }
.dev-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dev-h { font-family: Fraunces, serif; font-weight: 500; font-size: 1rem; margin: 18px 0 6px; padding-top: 12px; border-top: 1px solid var(--rule); }
.pedagogy { display: grid; gap: 10px; margin-top: 8px; }
.ped-turn { border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; background: rgb(from var(--paper) r g b / .5); font-size: .9rem; overflow-wrap: anywhere; }
.ped-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ped-read { color: var(--muted); font-size: .8rem; }
.ped-q { margin: 4px 0; font-style: italic; color: var(--ink-soft); }
.ped-turn ul { margin: 6px 0; padding-left: 18px; }
.ped-small { margin: 3px 0; font-size: .8rem; color: var(--muted); }
#devModels p { margin: 3px 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { .dev-panel { max-height: 88vh; } }
.masthead { flex-wrap: nowrap; }
.masthead > div { min-width: 0; }
.frame.covered figcaption { color: transparent; position: relative; }
.frame.covered figcaption::after { content: "What do you think?"; color: var(--muted); font-style: italic; position: absolute; left: 10px; top: 8px; }
#answer, #storyboard .frame, #storyboard figcaption, #picks .chip, #styleMenu .title, #restyle, #pedagogy, #styleCardText, .wonder-chip, #lessonGoal { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
@media (max-width: 480px) { .storyboard, .storyboard.n3 { grid-template-columns: minmax(0, 1fr); } }

/* The stage owns the device bounds. Only the overlaid controls have safe-area insets. */
html, body, #session { overflow-x: hidden; }
body { display: grid; place-items: center; width: 100%; min-height: 100vh; min-height: 100dvh; margin: 0; padding: 0; background-color: var(--paper); }
#session, #session * { box-sizing: border-box; }
#session {
  --edge: clamp(6px, 1.5vmin, 14px);
  --gap: clamp(6px, 1.4vmin, 12px);
  --top-edge: max(var(--edge), env(safe-area-inset-top));
  --right-edge: max(var(--edge), env(safe-area-inset-right));
  --bottom-edge: max(var(--edge), env(safe-area-inset-bottom));
  --left-edge: max(var(--edge), env(safe-area-inset-left));
  --mic-size: clamp(58px, 9.4vmin, 68px);
  --chrome-opacity: 0; --chrome-hit: none; --travel: 6px;
  position: relative; isolation: isolate;
  display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  width: 100%; max-width: 100%; min-width: 0; height: 100vh; height: 100dvh; min-height: 0;
  padding: 0; overflow: hidden; border: 0; border-radius: 0;
  background: var(--paper);
}
#session:is(.show-chrome, .is-listening, .speaking, .replaying, .show-filters, .settings-open,
    :has(#composer:focus-within), :has(#typed:not(:placeholder-shown)),
    :has(.chrome-group:focus-within):not(:has(#micBtn:focus))),
html:has(dialog[open], #devModal.open) #session,
html:has(.pf-overlay.pf-open) #session {
  --chrome-opacity: 1; --chrome-hit: auto; --travel: 0px;
}
#session::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to bottom, rgb(33 37 27 / .16), transparent 17%, transparent 70%, rgb(33 37 27 / .24));
  opacity: var(--chrome-opacity); transition: opacity 220ms ease-out;
}
.chrome-group {
  position: absolute; z-index: 3; pointer-events: none; opacity: var(--chrome-opacity);
  transform: translate(var(--chrome-x, 0px), var(--chrome-y, 0px));
  transition: opacity 220ms ease-out, transform 220ms ease-out;
}
.ask-dock.chrome-group { opacity: 1; transform: none; }
.chrome-group :is(button, #composer, #filterMenu) { pointer-events: var(--chrome-hit); }
.chrome-group #micBtn { pointer-events: auto; transition-duration: 220ms; transition-timing-function: ease-out; }
/* The filter fades and slides with its corner group, like Settings; don't fade it twice. */
#replayBtn, #composer, #filterMenu {
  opacity: var(--chrome-opacity);
  transition: opacity 220ms ease-out, border-color 220ms ease-out, background-color 220ms ease-out, box-shadow 220ms ease-out, color 220ms ease-out;
}
.chrome-top { --chrome-y: calc(0px - var(--travel)); top: var(--top-edge); right: var(--right-edge); }
.filter-corner { left: var(--left-edge); right: auto; }
.transcript-tool { right: calc(var(--right-edge) + 48px); }
.device-bar { display: flex; justify-content: flex-end; align-items: center; }
#devBtn { position: static; }
#filterBtn { position: relative; margin: 0; }
#devBtn, #filterBtn {
  display: grid; place-items: center; width: 42px; height: 42px; padding: 0;
  background: rgb(255 250 241 / .92); color: var(--ink-soft); border: 1px solid var(--rule); border-radius: 11px;
}
.device-bar svg, .filter-corner svg, .mic-dock svg { display: block; width: 24px; height: 24px; }
.chrome-arrow { top: 0; bottom: 0; margin-block: auto; width: 40px; height: 44px; }
.chrome-prev { left: var(--left-edge); --chrome-x: calc(0px - var(--travel)); }
.chrome-next { right: var(--right-edge); --chrome-x: var(--travel); }
.slide-step { display: grid; place-items: center; width: 100%; height: 44px; padding: 0; color: var(--moss-deep); background: rgb(255 250 241 / .92); border: 1px solid var(--rule); border-radius: 10px; }
.slide-step svg { width: 20px; height: 20px; }
.slide-step:disabled { opacity: .5; cursor: default; }
#askPrompt { position: relative; z-index: 2; grid-area: 1 / 1; place-self: center; max-width: min(16ch, 74%); margin: 0; text-align: center; font: 500 clamp(1.45rem, 5vmin, 2.2rem)/1.15 Fraunces, serif; color: var(--ink); letter-spacing: -.03em; text-wrap: balance; overflow-wrap: anywhere; pointer-events: none; }
#session.is-empty::after { background: none; }
#session:has(> .forming:not(.over):not(.resolve))::after { opacity: 0; }
#session.is-empty #stage { opacity: 0; }
#session.is-empty .chrome-arrow { visibility: hidden; }
#session:not(.is-empty) #askPrompt { display: none; }
@media (prefers-reduced-motion: reduce) {
  .chrome-group, #session::after,
  #filterBtn, #replayBtn, #composer, #filterMenu, #micBtn { transition: none; }
  .chrome-group { transform: none; }
}
#devModal, #eduLanguagePicker {
  --sheet-tap-space: 88px;
}
#devModal.modal, #eduLanguagePicker[open] {
  box-sizing: border-box;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  background: rgb(96 80 56 / .24);
}
#eduLanguagePicker {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: auto;
  border: 0;
}
#eduLanguagePicker[open] { display: flex; }
#eduLanguagePicker::backdrop { background: transparent; }

#devModal .modal-panel.dev-panel, #eduLanguagePicker .settings-picker-panel {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  min-height: 0;
  max-height: calc(100% - max(var(--sheet-tap-space), env(safe-area-inset-top) + 72px));
  margin: 0;
  padding: .75rem 1rem max(.75rem, env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--paper);
  color: #2a2118;
  border: 1px solid #cbbba0;
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  font-family: "Source Serif 4", Georgia, serif;
}
#devModal .modal-panel.dev-panel { display: block; }
#devModal .dev-panel .dev-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--paper);
}
#devModal .dev-panel::before, #eduLanguagePicker .settings-picker-panel::before {
  content: "";
  display: block;
  width: 2.25rem;
  height: 4px;
  margin: 0 auto .5rem;
  border-radius: 4px;
  background: #cbbba0;
}
@media (min-width: 700px) and (min-height: 560px), (min-width: 1100px) {
  /* Phone-preview card: settings and the language picker are the same bottom
     sheet as on a phone, not a centered desktop modal (t376u). */
  #devModal.modal, #eduLanguagePicker[open] {
    position: fixed;
    inset: 0;
    width: var(--card-width);
    height: var(--card-height);
    margin: auto;
    padding: 0;
    align-items: flex-end;
    justify-content: center;
    border-radius: var(--card-radius);
    overflow: hidden;
  }
  #devModal .modal-panel.dev-panel, #eduLanguagePicker .settings-picker-panel {
    width: 100%;
    max-width: none;
    max-height: calc(100% - max(var(--sheet-tap-space), env(safe-area-inset-top) + 72px));
    padding: .75rem 1rem max(.75rem, env(safe-area-inset-bottom));
    border: 1px solid #cbbba0;
    border-bottom: 0;
    border-radius: 26px 26px 0 0;
  }
}

#devModal .dev-head, #eduLanguagePicker .picker-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: #fffaf1;
}
#devTitle, #eduPickerTitle {
  margin: 0;
  margin-inline-end: auto;
  font: 550 1.55rem/1.2 Fraunces, Georgia, serif;
}
#devModal :is(#startOverBtn, #devClose, #eduPickLanguage, #eduPickerBack, #pfManageBtn) {
  min-height: 44px;
  padding: 0 .25rem;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #3a4a33;
  font-family: inherit;
  cursor: pointer;
}
#devModal :is(#startOverBtn, #pfManageBtn), #devModal .dev-shortcuts a {
  font-size: .87rem;
  text-decoration: underline;
  text-underline-offset: .18em;
}
#devModal #devClose { min-width: 44px; font-size: 1.65rem; line-height: 1; }
#eduLanguagePicker #eduPickerBack { min-width: 44px; min-height: 44px; padding: 0; border: 0; background: transparent; color: #3a4a33; cursor: pointer; }
#eduLanguagePicker #eduPickerBack svg { width: 18px; height: 18px; }

/* The existing localizer can write the translated Close text to this button. */
#devModal #devClose { font-size: 0; }
#devModal #devClose::after { content: "×"; font-size: 1.65rem; }

#devModal #profileSection {
  position: relative;
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem 0;
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}
#profileSection :is(.pf-heading, .pf-note) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
#profileSection .pf-header { order: 1; flex: none; margin: 0; }
#profileSection #pfManageBtn { white-space: nowrap; line-height: 1.15; }
#profileSection .pf-tiles {
  display: flex;
  align-items: flex-start;
  gap: .35rem;
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  padding: .3rem;
  list-style: none;
  overflow-x: auto;
}
#profileSection .pf-tile-wrap { flex: 0 0 4rem; min-width: 0; }
#profileSection .pf-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  width: 100%;
  min-height: 44px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: #2a2118;
  font: inherit;
}
#profileSection .pf-portrait {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: #c9d7c4;
}
#profileSection .pf-portrait img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
#profileSection .pf-tile[aria-current="true"] .pf-portrait { outline: 1.5px solid #4d6244; outline-offset: 2px; }
#profileSection .pf-add .pf-portrait { border: 1px dashed #4d6244; color: #3a4a33; background: transparent; font-size: 1.5rem; }
#profileSection .pf-tile-name { max-width: 100%; font-size: .84rem; overflow-wrap: anywhere; }

#devModal .compact-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: .65rem;
  min-height: 52px;
  padding: .15rem 0;
  margin: 0;
  border: 0;
  border-top: 1px solid #ded2be;
  background: transparent;
}
#devModal .compact-row :is(label, strong) { margin: 0; font: 550 1rem/1.25 "Source Serif 4", Georgia, serif; }
#devModal .settings-icon {
  flex: none;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #4d6244;
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}
#devModal .compact-row .switch {
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  height: 26px;
  margin-inline-start: auto;
}
#devModal .compact-row .switch.on { background-color: #4d6244; }
#devModal .compact-row .switch::after { content: ""; position: absolute; inset: -9px 0; }
#devModal #eduRead { min-height: 44px; }
#devModal #eduLanguage { display: none; }
#devModal #eduPickLanguage {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-inline-start: auto;
  color: #5a4c3d;
  font-size: 1rem;
}
#eduPickLanguage::after { content: ""; position: absolute; inset: 0; }
#devModal #eduPickLanguage svg { width: 14px; height: 14px; }

#agePills {
  position: relative;
  flex: 1;
  max-width: 15rem;
  min-width: 0;
  height: 44px;
  margin-inline-start: auto;
}
#devModal #eduAgeYears {
  appearance: none;
  box-sizing: border-box;
  display: block;
  width: 100%;
  height: 44px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  accent-color: #4d6244;
  cursor: pointer;
}
#eduAgeYears::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: #c9d7c4; }
#eduAgeYears::-moz-range-track { height: 4px; border-radius: 4px; background: #c9d7c4; }
#eduAgeYears::-webkit-slider-thumb {
  appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -12px;
  border: 0;
  border-radius: 50%;
  background: #4d6244;
}
#eduAgeYears::-moz-range-thumb { width: 28px; height: 28px; border: 0; border-radius: 50%; background: #4d6244; }
.age-thumb-path { position: absolute; inset: 0 14px; pointer-events: none; }
#eduAgeNumber {
  position: absolute;
  inset-inline-start: var(--age-position, 50%);
  margin-inline-start: -14px;
  width: 28px;
  text-align: center;
  color: #fffaf1;
  font: 600 .95rem/44px "Source Serif 4", Georgia, serif;
}

#devModal .settings-developer { display: none; position: relative; border-top: 1px solid #cbbba0; }
html:has(meta[name="primer-output-log"][content="on"]) #devModal .settings-developer { display: block; }
#devModal .dev-heading-row { display: flex; align-items: center; min-height: 44px; gap: .5rem; }
#devModal .developer-heading { margin: 0; margin-inline-end: auto; font: 550 1rem/1.25 "Source Serif 4", Georgia, serif; }
#devModal .dev-shortcuts { display: flex; gap: .5rem; }
#devModal .settings-developer .compact-row p.quiet { display: none; }
#devModal .dev-shortcuts a { display: grid; place-items: center; min-width: 44px; min-height: 44px; color: #3a4a33; }

#eduLanguagePicker .settings-picker-panel { display: flex; flex-direction: column; overflow: hidden; }
#eduLanguagePicker .picker-head { flex: none; }
#eduLanguagePicker #eduPickerTitle { margin-inline-start: 0; }
#eduLanguagePicker .picker-search { flex: none; padding: .15rem 0 .35rem; }
#eduLanguageSearch {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: .4rem .75rem;
  border: 1px solid #ded2be;
  border-radius: .7rem;
  background: #fffaf1;
  color: #2a2118;
  font: inherit;
}
#eduLanguageSearch:focus-visible { outline: 2px solid #4d6244; outline-offset: 1px; }
#eduLanguageEmpty { margin: 0; padding: 1.1rem .55rem; color: #5a4c3d; text-align: center; }
#eduLanguageOptions [role="option"][hidden], #eduLanguageOptions [role="group"][hidden], #eduLanguageEmpty[hidden] { display: none; }
#eduLanguageOptions { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: .25rem; }
#eduLanguageOptions [role="group"] { display: flex; align-items: center; gap: .2rem; flex-wrap: wrap; padding: .25rem 0; }
#eduLanguageOptions .region-heading { flex: 1 0 100%; padding-inline: .5rem; color: #5a4c3d; }
#eduLanguageOptions [role="option"] {
  display: block;
  width: 100%;
  min-width: 44px;
  min-height: 44px;
  padding: .35rem .55rem;
  border: 0;
  border-radius: .55rem;
  background: transparent;
  color: #2a2118;
  direction: ltr;
  text-align: start;
  font: inherit;
  cursor: pointer;
}
#eduLanguageOptions [role="option"] > span { unicode-bidi: isolate; }
#eduLanguageOptions [role="group"] [role="option"] { width: auto; }
#eduLanguageOptions [aria-selected="true"] { background: #c9d7c4; color: #3a4a33; }
#eduLanguageOptions [aria-selected="true"]::after { content: "✓"; margin-inline-start: .45rem; }
#devModal :is(button, a, summary, input):focus-visible { outline: 2px solid #4d6244; outline-offset: 1px; }
#devModal #eduPickLanguage:focus:not(:focus-visible),
#devModal #eduPickLanguage[data-hide-focus]:focus {
  outline: none;
  box-shadow: none;
}
:is(#session, #devModal) button { transition-property: color, background-color, border-color, box-shadow, opacity; }
:is(#session, #devModal) button:is(:hover, :focus, :active) { transform: none; scale: none; }
#session button:enabled:hover { border-color: var(--moss); }
#session button:focus-visible { outline: 2px solid var(--moss-deep); outline-offset: -2px; }

.age-field {
  padding: 12px 0;
  border-top: 1px solid var(--rule);
  margin-top: 8px;
}
.age-field .age-pills {
  justify-content: flex-start;
  margin: 10px 0 0;
  gap: 8px;
}
.age-field .pill {
  padding: 8px 16px;
  font-size: 0.98rem;
  min-height: 40px;
}

.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }

#stage { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; min-height: 0; min-width: 0; margin: 0; padding: 0; border: 0; border-radius: inherit; overflow: hidden; background: var(--paper); touch-action: pan-y pinch-zoom; user-select: none; }
#stageBleed { position: absolute; inset: 0; z-index: 0; pointer-events: none; background: var(--paper); }
.stage .slide {
  position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none;
  object-fit: cover; object-position: center; background: transparent; opacity: 0;
  transition: opacity .35s ease;
}
.stage .slide.on { opacity: 1; }
.forming { --orb: min(64vw, 48vh, 360px, 100%); position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; pointer-events: none; background: var(--paper); transition: opacity .35s ease; }
.forming > .pe-sunrise {
  position: relative;
  width: var(--orb);
  height: var(--orb);
}
.forming-caption {
  position: absolute;
  top: calc(50% + var(--orb) / 2 + 22px);
  left: 0;
  right: 0;
  margin: 0 auto;
  width: min(350px, calc(100% - 40px));
  max-height: 72px;
  font: italic 400 16px/24px "Source Serif 4", serif;
  color: var(--muted);
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.forming.over .forming-caption { display: none; }
@keyframes forming-caption-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: no-preference) {
  .forming-caption { animation: forming-caption-in 480ms cubic-bezier(.4,0,.2,1) 120ms both; }
}
.forming > .pe-sunrise > svg,
.forming > .pe-sunrise > canvas {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
}
.forming .arm { fill: none; stroke: var(--ink-soft); stroke-width: 1.6; stroke-linecap: round; opacity: .65; }
.forming .core { opacity: .85; animation: breathe 3.6s ease-in-out infinite; }
.forming .spark { cx: 82px; transform-box: view-box; transform-origin: center; transform: rotate(var(--a)); fill: var(--ink-soft); opacity: .7; animation: breathe 3s ease-in-out infinite; animation-delay: calc(var(--k) * -.26s); }
.forming.over { inset: auto 2% 2% auto; width: min(44px, 20%); height: min(44px, 25%); background: none; }
.forming.over > .pe-sunrise { width: 100%; height: 100%; }
.forming.resolve { opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility 0s linear .3s; }
@media (prefers-reduced-motion: reduce) {
  .stage .slide, .forming { transition: none; }
  .forming .core, .forming .spark { animation: none; }
}

.ask-dock { left: var(--left-edge); right: var(--right-edge); bottom: var(--bottom-edge); margin-inline: auto; display: grid; gap: var(--gap); width: auto; max-width: 26rem; min-width: 0; }
.mic-dock {
  position: relative; isolation: isolate; justify-self: center; display: grid;
  /* Leave air between the (now 10px) recording halo and both the replay button and the field. */
  grid-template-columns: 1fr auto 1fr; column-gap: 20px; align-items: end; justify-items: center;
  width: min(17rem, 100%);
  margin-bottom: 12px;
}
#composer.dev-bar, #devBtn, #filterBtn, #eduTranscriptBtn, #micBtn, #replayBtn { -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
#replayBtn, #micBtn { display: grid; place-items: center; margin: 0; padding: 0; width: 42px; height: 42px; border: 1px solid var(--rule); border-radius: 50%; color: var(--ink); }
#session #micBtn {
  grid-column: 2;
  position: relative;
  width: var(--mic-size);
  height: var(--mic-size);
  overflow: visible;
  background: rgb(239 231 215 / .94);
  color: var(--moss);
  box-shadow: none;
  animation: none;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
  --mic-ring-max: 10px;
}

#session #micBtn.listening {
  background-color: var(--moss);
  border-color: var(--moss-deep);
  color: var(--paper);
}

#micBtn svg { width: 48%; height: 48%; color: inherit; }

/* PRI-mic-rings: recording only, max 10px beyond the button edge. */
#micBtn::before, #micBtn::after { content: none; }

#micBtn.listening::before {
  --edu-ring-rest: 3px;
  --edu-ring-peak: 6px;
  --edu-ring-stroke: rgb(from var(--moss) r g b / .38);
  --edu-ring-low: .14;
  --edu-ring-high: .22;
}

#micBtn.listening::after {
  --edu-ring-rest: 7px;
  --edu-ring-peak: var(--mic-ring-max);
  --edu-ring-stroke: rgb(from var(--moss) r g b / .22);
  --edu-ring-low: .08;
  --edu-ring-high: .12;
}

#micBtn.listening:not([data-mic-state="speaking"])::before,
#micBtn.listening:not([data-mic-state="speaking"])::after {
  content: "";
  position: absolute;
  inset: -1px; /* Start the scale at the outer edge of the button's 1px border. */
  box-sizing: border-box;
  pointer-events: none;
  border: 1px solid var(--edu-ring-stroke);
  border-radius: inherit;
  opacity: var(--edu-ring-low);
  transform: scale(calc(1 + 2 * tan(atan2(var(--edu-ring-rest), var(--mic-size)))));
}

@media (prefers-reduced-motion: no-preference) {
  #micBtn.listening:not([data-mic-state="speaking"])::before,
  #micBtn.listening:not([data-mic-state="speaking"])::after {
    animation: edu-mic-halo-listen 2.2s ease-in-out infinite;
  }
}

@keyframes edu-mic-halo-listen {
  65% {
    opacity: var(--edu-ring-high);
    transform: scale(calc(1 + 2 * tan(atan2(var(--edu-ring-peak), var(--mic-size)))));
  }
}

@media (prefers-reduced-motion: reduce) {
  #session #micBtn { transition: none; }
}

#micBtn[data-mic-state="speaking"] svg { display: none; }
#micBtn[data-mic-state="speaking"]::after {
  content: "";
  position: static;
  width: 29%;
  aspect-ratio: 1;
  pointer-events: none;
  border: 0;
  border-radius: 22%;
  background: currentColor;
  transform: none;
  opacity: 1;
}
/* End PRI-mic-rings. */


#replayBtn {
  grid-column: 3;
  justify-self: start;
  background: rgb(255 250 241 / .96);
  box-shadow: 0 2px 8px rgb(33 37 27 / .2);
}

#replayBtn:disabled {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  cursor: default;
}

@media (prefers-reduced-motion: no-preference) {
  #replayBtn { transition: opacity 180ms ease, visibility 0s linear; }
  #replayBtn:disabled { transition-delay: 0s, 180ms; }
}

/* The open picker is a dock row; only its strip has lateral overflow. */
html, body, #session { overflow-x: hidden; }
.ask-dock { grid-template-columns: minmax(0,1fr); }
#session.show-filters .ask-dock { align-content: end; }
#filterMenu[hidden] { display: none; }
#filterMenu { box-sizing: border-box; justify-self: center; min-width: 0; width: min(24rem,100%); padding: 3px; border: 1px solid var(--rule); border-radius: 12px; background: #fffaf1; }
#filterStrip { box-sizing: border-box; width: 100%; min-width: 0; display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 18px) / 4); gap: 6px; padding: 4px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; touch-action: pan-x; scrollbar-width: thin; }
#filterStrip .filter-tile { position: relative; box-sizing: border-box; width: 100%; min-width: 0; aspect-ratio: 1; padding: 0; overflow: hidden; border-radius: 9px; border: 1px solid var(--rule); background: var(--paper); }
#session #filterBtn { position: relative; box-sizing: border-box; overflow: hidden; padding: 0; }
.filter-art { position: absolute; inset: 0; display: block; overflow: hidden; background: var(--paper); pointer-events: none; }
#filterStrip .filter-art img, #filterBtn .filter-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.filter-art.auto-swatch { background: radial-gradient(ellipse at 20% 10%, #fffdf6, transparent 72%), linear-gradient(145deg, #eee8d7, #e2e7d9); }
.filter-art.auto-swatch { display: grid; place-items: center; color: var(--moss-deep); }
.filter-art.auto-swatch svg { display: block; width: 78%; height: 78%; }
/* Colour only: the two original sparkle paths never move. Without the
   no-preference query the three SVG stop-color attributes are the artwork. */
@media (prefers-reduced-motion: no-preference) {
  .auto-swatch .orb-stop { animation: edu-orb-wash 22s ease-in-out infinite; }
  .auto-swatch .orb-stop.middle { animation-delay: -8s; }
  .auto-swatch .orb-stop.last { animation-delay: -15s; }
}
@keyframes edu-orb-wash {
  0%, 100% { stop-color: #667b5d; }
  20% { stop-color: #889e84; }
  40% { stop-color: #a28e70; }
  60% { stop-color: #a77872; }
  80% { stop-color: #768f9f; }
}
.filter-art.eye-pending { background: radial-gradient(ellipse at 30% 20%, #fffdf6, transparent 70%), var(--paper); box-shadow: inset 0 0 0 1px rgba(0,0,0,.04); }
#filterStrip [aria-pressed="true"] { border-color: var(--moss-deep); box-shadow: 0 0 0 1px var(--moss-deep); }
#session #filterStrip button:focus, #session #filterBtn:focus { outline: none; }
#session #filterStrip button:focus-visible, #session #filterBtn:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }
@media (orientation: landscape) and (max-height: 559px) { #filterMenu { width: min(18rem,100%); } }

#composer.dev-bar { display: flex; position: static; align-items: center; gap: 6px; margin: 0; width: 100%; min-width: 0; padding: 4px; border: 1px solid var(--rule); border-radius: 14px; background: rgb(255 250 241 / .92); }
#composer.dev-bar textarea { display: block; flex: 1; min-width: 0; margin: 0; font-size: 16px; line-height: 1.35; padding: 8px 12px; min-height: calc(1.35em + 18px); height: calc(1.35em + 18px); max-height: calc(4.05em + 18px); overflow: hidden auto; overflow-wrap: anywhere; resize: none; }
#sendBtn { flex: 0 0 40px; width: 40px; height: 40px; padding: 0; display: grid; place-items: center; line-height: 0; }
#sendBtn svg { display: block; width: 18px; height: 18px; }
.composer.listening textarea { box-shadow: 0 0 0 2px rgba(184,80,58,.45); }
.composer.dev-bar textarea[readonly] { opacity: .8; }
#session #composer[hidden], #eduRead[hidden], #eduTranscriptBtn[hidden], #eduTranscript:not([open]) { display: none !important; }
#keyboardSwitch:disabled { opacity: .4; }
#eyeIssues { white-space: pre-line; overflow-wrap: anywhere; }
#eduTranscriptBtn { position: static; width: 42px; height: 42px; padding: 9px; border-radius: 11px; background: rgb(255 250 241 / .92); color: var(--ink); }
#eduTranscriptBtn svg { display: block; width: 100%; height: 100%; }
#eduTranscript { box-sizing: border-box; position: fixed; inset: auto 0 0; margin: 0 auto; width: min(100%, 32rem); max-width: 100%; max-height: 75vh; max-height: 75dvh; padding: 1rem 1.1rem max(1rem, env(safe-area-inset-bottom)); border: 1px solid var(--rule); border-radius: 18px 18px 0 0; background: var(--paper); color: var(--ink); box-shadow: 0 6px 36px var(--shadow); }
#eduTranscript[open] { display: flex; flex-direction: column; gap: .7rem; }
#eduTranscript::backdrop { background: rgb(24 31 23 / .38); }
#eduTranscript header { display: flex; justify-content: space-between; align-items: center; }
#eduTranscript header form { margin: 0; }
#eduLines { overflow-y: auto; overscroll-behavior: contain; min-height: 3rem; overflow-wrap: anywhere; }
#eduLines p { margin: 0 0 .8rem; white-space: pre-line; }
#eduLines strong { display: block; font-size: .82em; color: var(--moss-deep); }
/* D-08 (t376u): inside the phone-preview card the transcript is the same bottom sheet as on a phone, flush with the card bottom. */
@media (min-width: 700px) and (min-height: 560px), (min-width: 1100px) {
  #eduTranscript { inset: auto 0 calc((100dvh - var(--card-height)) / 2); margin: 0 auto; width: min(100%, var(--card-width)); max-height: calc(var(--card-height) * .75); }
}
@media (orientation: landscape) and (max-height: 559px) {
  #session { --edge: 4px; --gap: 4px; --mic-size: 56px; }
  #devBtn, #filterBtn, #replayBtn { width: 38px; height: 38px; }
  #askPrompt { font-size: clamp(1.25rem, 5vh, 1.6rem); }
}
.transcript p { margin: 4px 0; overflow-wrap: anywhere; }
.ped-segs { margin: 6px 0; padding-left: 20px; }
.ped-segs li { margin: 4px 0; }
.warn { color: #9a4a1c; }

/* Dev look picker: in-flow, scrollable, never clipped sideways */
.dev-look { margin: 8px 0 12px; max-width: 100%; }
.dev-look .dropdown-btn { margin-bottom: 8px; }
.dev-look .menu { max-height: min(40vh, 320px); position: static; width: 100%; }
.dev-look .picks { margin: 10px 0; }
.dev-look .option .title { overflow-wrap: anywhere; }
#styleModeStatus { margin: 0 0 12px; min-height: 1.2em; }
#devModal .topic-row { margin-bottom: 4px; }
#devModal .style-card { margin-top: 12px; }
#autoLookBtn { margin-bottom: 4px; }
@media (max-width: 640px) {
  .dev-look .menu { max-height: min(38vh, 260px); }
  #devModal .quiet { font-size: 0.84rem; }
}

.picture-failed {
  position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center;
  gap: 10px; background: var(--paper); color: var(--ink-soft); text-align: center;
}
.picture-failed svg { color: var(--moss); }
.picture-failed p { margin: 0; font: 1.05rem/1.4 Fraunces, serif; }
#session .picture-failed button {
  min-height: 44px; padding: 6px 16px; border: 1px solid var(--rule); border-radius: 999px;
  background: #fffaf1; color: var(--moss-deep); transition: none;
}

/* Filter control + strip tiles: locked 1:1 rounded squares (not a pill or circle).
   Radius matches the device-bar squares (11px) and sits inside the 18px device frame. */
#session { --filter-radius: 11px; --filter-btn-size: 42px; }
@media (orientation: landscape) and (max-height: 559px) {
  #session { --filter-btn-size: 38px; }
}
#session #filterBtn {
  box-sizing: border-box;
  width: var(--filter-btn-size);
  height: var(--filter-btn-size);
  min-width: var(--filter-btn-size);
  max-width: var(--filter-btn-size);
  min-height: var(--filter-btn-size);
  max-height: var(--filter-btn-size);
  aspect-ratio: 1 / 1;
  flex: 0 0 var(--filter-btn-size);
  justify-self: center;
  align-self: center;
  padding: 0;
  overflow: hidden;
  border-radius: var(--filter-radius);
}
#filterStrip .filter-tile {
  box-sizing: border-box;
  aspect-ratio: 1 / 1;
  width: 100%;
  height: auto;
  padding: 0;
  overflow: hidden;
  border-radius: var(--filter-radius);
}
/* Restyle in progress: a small static mark (no animation, no motion) while the old picture stays up. */
.restyle-mark { position: absolute; left: 8px; bottom: 8px; width: 14px; height: 14px; border-radius: 4px; background: var(--moss-deep, #4a6a55); opacity: .55; z-index: 4; pointer-events: none; }

/* Seeded ink pond generating loader (gallery 16b "Travelling pool"). Transform-only rotation of the travelling pool. */
/* .forming svg and .forming.over svg retain the app's existing box sizes. */
/* Loader lives beside #stage: above the stage (z 0, later in DOM) and below the #session::after vignette (z 1),
   the same stacking it had when it was inside #stage. */
.forming { z-index: 0; }
.pe-ink-pond {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.pe-ink-pond__orbit {
  transform-box: view-box;
  transform-origin: 50% 50%; /* (60, 60), not the pigment ellipse's centre */
  animation: pe-ink-pond-turn var(--pe-pond-period, 25s) linear infinite;
  animation-direction: var(--pe-pond-direction, normal);
}

@keyframes pe-ink-pond-turn {
  from { transform: rotate(0turn); }
  to   { transform: rotate(1turn); }
}

@media (prefers-reduced-motion: reduce) {
  .pe-ink-pond__orbit {
    animation: none;
    transform: none;
  }
}

/* Small short phones (e.g. 320x568): the square picture reaches down to where the
   bigger mic dock sits. Tighten the dock's bottom spacing there only, so the mic
   pill clears the picture. Mic size and glyph are unchanged. */
@media (orientation: portrait) and (max-width: 359px) and (max-height: 640px) {
  #session { --bottom-edge: 0px; }
  #session .ask-dock { gap: 0px; }
}

/* Visible voice-fallback marker on the Settings gear (subtle amber dot). */
.gear.voice-fallback { position: relative; }
.gear.voice-fallback::after {
  content: ""; position: absolute; top: 3px; right: 3px; width: 9px; height: 9px;
  border-radius: 50%; background: #d08a2c; border: 1.5px solid #fffaf1;
}

/* Step picture didn't arrive, but an earlier picture is held on screen: small corner chip, never covering the picture. */
.picture-miss {
  position: absolute; right: 2%; bottom: 2%; z-index: 2; display: flex; align-items: center; gap: 4px;
  padding: 4px; border-radius: 999px; background: rgb(255 250 241 / .92); border: 1px solid var(--rule);
  color: var(--ink-soft); pointer-events: none;
}
.picture-miss button { pointer-events: auto; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--moss-deep); }

