/* Pronunciation check under the "따라 말하기" spots (web/js/pron-slot.js). The record button is a light (ghost) button,
   so each screen keeps its one strong button. The result itself is drawn by web/shared/pron.css (theme 'kisskiss',
   compact). While recording, the button itself shows everything (no line appears below it, so nothing jumps): a
   loudness meter in place of the mic, the seconds left, and a time-left bar along its bottom edge. */
.kk-pron { display: grid; justify-items: center; gap: var(--s-2); width: 100%; margin: var(--s-3) 0 0; }
body:not([data-part="0"]) #app .kk-pron .kk-pron-rec { position: relative; overflow: hidden; min-height: 48px; min-width: 210px; padding: 0 22px; gap: 10px; font-size: var(--t-sm); font-weight: 500; }
.kk-pron-rec .kk-pron-mic { flex: none; }
.kk-pron-rec[aria-disabled="true"] { cursor: progress; }
.kk-pron-left { font-variant-numeric: tabular-nums; }
.kk-pron-left:empty { display: none; }

/* loudness meter: three bars that grow with the voice (--lv 0..1) */
.kk-pron-lv { display: none; align-items: center; gap: 3px; width: 22px; height: 22px; flex: none; }
.kk-pron-lv i { display: block; width: 4px; border-radius: 2px; background: currentColor; height: calc(5px + 17px * var(--lv, 0)); transition: height .08s linear; }
.kk-pron-lv i:nth-child(2) { height: calc(7px + 15px * var(--lv, 0) * 1.15); }
.kk-pron-lv i:nth-child(3) { height: calc(5px + 17px * var(--lv, 0) * .75); }
/* time left: shrinks from full to empty over 8 seconds */
.kk-pron-bar { display: none; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: color-mix(in srgb, var(--terracotta) 22%, transparent); }
.kk-pron-bar i { display: block; height: 100%; background: var(--terracotta); transform-origin: left center; }

.kk-pron[data-state="recording"] .kk-pron-mic { display: none; }
.kk-pron[data-state="recording"] .kk-pron-lv, .kk-pron[data-state="recording"] .kk-pron-bar { display: flex; }
.kk-pron[data-state="recording"] .kk-pron-bar { display: block; }
body:not([data-part="0"]) #app .kk-pron[data-state="recording"] .kk-pron-rec { background: var(--terracotta-light); box-shadow: inset 0 0 0 2px var(--terracotta); color: color-mix(in srgb, var(--terracotta) 78%, var(--ink)); }
body:not([data-part="0"]) #app .kk-pron.is-ending .kk-pron-left { color: color-mix(in srgb, var(--terracotta) 78%, var(--ink)); font-weight: 600; }

.kk-pron-tip { margin: 0; font-size: var(--t-sm); font-weight: 500; line-height: 1.4; color: var(--text-sub, var(--ink)); text-align: center; word-break: keep-all; }
.kk-pron-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; }
.kk-pron-out { width: 100%; max-width: 480px; text-align: left; }
.kk-pron-out:empty { display: none; }
.kk-pron-fail { margin: 0; padding: var(--s-3) var(--s-4); border-radius: var(--r-sm); background: var(--white); color: var(--ink); font-size: var(--t-sm); line-height: 1.5; word-break: keep-all; }
@media (prefers-reduced-motion: reduce) { .kk-pron-lv i { transition: none; } }
.kk-pron[hidden] { display: none; }
/* Parts 4·5 on wide screens: the picture column was centred against the right column, so a result appearing on the
   right pushed the picture down. Keep both columns top-aligned on screens that have the record button. */
@media (min-width: 900px) { body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) { align-items: start; } }

/* Small screens (2026-12-01): '내 발음 녹음하기' must sit on the first view, above the nav pill (fixed, bottom 18px +
   48px), on 320×640 · 360×740 · 390×844 · 768×1024. Only screens that carry the record button change; 900px and up is
   untouched. Pictures follow the screen height (svh = height with the browser bars shown) but never go under a floor:
   - Part 1 word picture: 160px. The picture IS the word's meaning; at 160px (about 2.5 cm on a phone, a flash-card
     thumbnail) a child still names a pizza or a bus at a glance. Below that the drawings' details blur together.
   - Part 5 Emma: 112px. She is the speaker, not the meaning (the card carries the words); 112px keeps her face and
     moving mouth readable for 'watch and say'.
   - Part 4 wall: keeps its full width (the framed picture is the meaning and is already the smallest picture here);
     only the empty wall above/below it is trimmed.
   Text that is not needed to start (Part 5 situation line, Part 4 picture credit) moves under the practice block,
   still on the same page. */
@media (max-width: 899px) {
  /* Part 1 '그림 보고 말하기': picture follows the height; tighter steps between picture, word, controls and record */
  html body:not([data-part="0"]) #app .v3-focus:has(.kk-pron) .v3-where { margin-bottom: 6px; }
  html body:not([data-part="0"]) #app .v3-focus:has(.kk-pron) .v3-pic { width: max(160px, min(80vw, 440px, calc(100svh - 494px))); }
  html body:not([data-part="0"]) #app .v3-focus:has(.kk-pron) .v3-word { margin-top: 10px; }
  html body:not([data-part="0"]) #app .v3-focus:has(.kk-pron) .v3-dots { margin-top: 10px; }
  html body:not([data-part="0"]) #app .v3-focus:has(.kk-pron) .v3-ctl { margin: 10px 0 0; }
  html body:not([data-part="0"]) #app .v3-focus .kk-pron { margin-top: var(--s-2); }

  /* Parts 4 · 5: card, controls and record button closer together; the card keeps its big word */
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p4-side,
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-side { gap: var(--s-2); margin-top: 10px; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-card { padding: 12px 16px 14px; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-card .p5-en { margin-top: 4px; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-card .p5-ko { margin-top: 4px; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-card .p5-note:empty { display: none; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-dots { margin-top: 10px; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-ctl { margin: 0; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one) .kk-pron { margin-top: 0; }
  html body:not([data-part="0"]) #app .part-body:has(.kk-pron) :is(.p4-set, .p5-set) { margin: 0 0 8px; }

  /* Part 4: picture credit under the practice block; less empty wall above the docent and under the frame */
  html body:not([data-part="0"]) #app .p4-one:has(.kk-pron) { display: flex; flex-direction: column; }
  html body:not([data-part="0"]) #app .p4-one:has(.kk-pron) .p4-stage { display: contents; }
  html body:not([data-part="0"]) #app .p4-one:has(.kk-pron) .p4-credit { order: 1; margin: 12px 2px 0; padding: 0; }
  html body:not([data-part="0"]) #app .p4-one:has(.kk-pron) .p4-wall { padding-top: 10px; }
  html body:not([data-part="0"]) #app .p4-one:has(.kk-pron) .p4-frame { margin-bottom: 20px; }

  /* Part 5: Emma follows the height (floor 112px) */
  html body:not([data-part="0"]) #app .p5-one:has(.kk-pron) .p5-stage { padding: 0 0 2px; }
  html body:not([data-part="0"]) #app .p5-one:has(.kk-pron) .p5-booth { width: max(112px, min(62%, 260px, calc(100svh - 524px))); }
}
/* Part 4 · 5 situation line (2026-12-01, fix 2). Wider screens show it under the set title as before. Phones fold it:
   the set title already names the situation, so the title row itself is the switch (a small chevron after the title,
   the whole row is a 44px-tall tap target) and the line opens right under the title. Folded, it adds no height, so
   '내 발음 녹음하기' stays on the first view; earlier it sat under '다음 묶음', below the nav pill. */
.set-sit-more { display: none; }
@media (max-width: 599px) {
  html body:not([data-part="0"]) #app :is(.p4-set, .p5-set):has(> .set-sit-more) { position: relative; }
  html body:not([data-part="0"]) #app :is(.p4-set, .p5-set) > .set-sit-more { display: block; position: absolute; inset: 50% 0 auto; min-height: 44px; height: 100%; transform: translateY(-50%);
    margin: 0; padding: 0; border: 0; border-radius: var(--r-sm); background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  html body:not([data-part="0"]) #app :is(.p4-set, .p5-set) > .set-sit-more:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  html body:not([data-part="0"]) #app :is(.p4-set, .p5-set):has(> .set-sit-more) h2::after {
    content: ''; display: inline-block; width: 16px; height: 16px; margin-left: 4px; vertical-align: -1px; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    transition: transform var(--dur-1, .15s) ease; }
  html body:not([data-part="0"]) #app :is(.p4-set, .p5-set):has(> .set-sit-more[aria-expanded="true"]) h2::after { transform: rotate(180deg); }
  html body:not([data-part="0"]) #app .part-body:has(.set-sit-more) > .p5-situation { display: none; margin: 0 0 10px; padding: 10px 14px; font-size: var(--t-sm); line-height: 1.55; word-break: keep-all; }
  html body:not([data-part="0"]) #app .part-body:has(.set-sit-more[aria-expanded="true"]) > .p5-situation { display: block; }
}
/* '▶ 차례로 듣기' on one line on the narrowest phones (320 · 360): its column takes the label's width, '다음 묶음' the rest */
@media (max-width: 389px) {
  html body:not([data-part="0"]) #app :is(.p4-actions, .p5-actions) { grid-template-columns: auto minmax(0, 1fr); }
  html body:not([data-part="0"]) #app :is(.p4-actions, .p5-actions) > .btn { padding: 0 16px; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { html body:not([data-part="0"]) #app :is(.p4-set, .p5-set) h2::after { transition: none; } }
/* Short phones (≤599 wide and ≤800 tall: 320×640, 360×740): the longest cards (three-line sentences, two-line notes)
   still pushed the record button under the nav pill. Same buttons, one row fewer:
   - '‹' and '›' sit on the card's left and right edges (a card you flip through), still 44px round;
   - '다시 듣기' and '내 발음 녹음하기' share one row;
   - the card's '1 / 10' moves to the right end of its dot row (same information, no line of its own). */
@media (max-width: 599px) and (max-height: 800px) {
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) :is(.p4-side, .p5-side) {
    display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: 8px; row-gap: 8px; align-items: start; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-ctl { display: contents; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-card { grid-column: 1 / -1; grid-row: 1; padding: 10px 24px 12px;
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto minmax(0, 1fr); align-items: center; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-card > :is(.p5-en, .p5-ko, .p5-note) { grid-column: 1 / -1; }
  /* dots and '1 / 10' are one group centred under the words (two auto columns), so they can never overlap; longer
     sets get smaller dots so the group still fits (fix 2: 10 dots overlapped by 18px and 12 dots by 32px at 320) */
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-card > .p5-dots { grid-column: 2; grid-row: 5; margin-top: 8px; flex-wrap: nowrap; min-width: 0; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-card > .p5-where { grid-column: 3; grid-row: 5; justify-self: start; margin-top: 8px; line-height: 1; white-space: nowrap; padding-left: 10px; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-card .p5-dot { flex: 0 1 auto; min-width: 3px; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-dots:has(> .p5-dot:nth-child(9)) { gap: 4px; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-dots:has(> .p5-dot:nth-child(9)) > .p5-dot { width: 6px; height: 6px; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-dots:has(> .p5-dot:nth-child(9)) > .p5-dot.on { width: 16px; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-dots:has(> .p5-dot:nth-child(15)) { gap: 3px; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-dots:has(> .p5-dot:nth-child(15)) > .p5-dot { width: 5px; height: 5px; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-dots:has(> .p5-dot:nth-child(15)) > .p5-dot.on { width: 12px; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-card .p5-en { margin-top: 0; }
  html body:not([data-part="0"]) #app .p5-one:has(.kk-pron) .p5-card .p5-en { font-size: clamp(28px, 8vw, 34px); }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-ctl > .v3-round { width: 44px; height: 44px; position: relative; z-index: 1; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-ctl > :is(.p4-prev, .p5-prev) { grid-column: 1; grid-row: 1; align-self: center; margin-left: -22px; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-ctl > :is(.p4-fwd, .p5-fwd) { grid-column: 2; grid-row: 1; align-self: center; justify-self: end; margin-right: -22px; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) .p5-ctl > :is(.p4-play, .p5-play) { grid-column: 1; grid-row: 2; margin-top: 2px; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one) .kk-pron { grid-column: 1 / -1; grid-row: 2; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one) .kk-pron .kk-pron-rec { justify-self: stretch; min-width: 0; margin-left: 52px; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) :is(.p4-actions, .p5-actions) { grid-column: 1 / -1; grid-row: 3; }
  /* autoplay blocked: '눌러서 들어 보세요' (say.js hintTap, put right after the card) gets its own full-width row, one line,
     just above '다시 듣기' (it was auto-placed in the 44px column: three lines, under the nav pill). The rows below move
     down one and the gaps shrink to 6px, so the record button still clears the nav pill on the longest cards. */
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) :is(.p4-side, .p5-side):has(> .tap-note) { row-gap: 6px; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) :is(.p4-side, .p5-side) > .tap-note { grid-column: 1 / -1; grid-row: 2; margin: -2px 0 -2px 2px; line-height: 18px; text-align: left; white-space: nowrap; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) :is(.p4-side, .p5-side):has(> .tap-note) .p5-ctl > :is(.p4-play, .p5-play) { grid-row: 3; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) :is(.p4-side, .p5-side):has(> .tap-note) > .kk-pron { grid-row: 3; }
  html body:not([data-part="0"]) #app :is(.p4-one, .p5-one):has(.kk-pron) :is(.p4-side, .p5-side):has(> .tap-note) > :is(.p4-actions, .p5-actions) { grid-row: 4; }
  html body:not([data-part="0"]) #app .p4-one:has(.kk-pron) .p4-set h2 { font-size: var(--t-md); }
  html body:not([data-part="0"]) #app .p5-one:has(.kk-pron) .p5-booth { width: max(112px, min(62%, 260px, calc(100svh - 530px))); }
  html body:not([data-part="0"]) #app .p5-one:has(.kk-pron) .p5-side { margin-top: 6px; }
}
/* the shortest phones (≤700 tall): every part screen starts a little higher (same on every step, so nothing jumps) */
@media (max-width: 599px) and (max-height: 700px) {
  body:not([data-part="0"]) #app { margin-top: 8px; padding-top: 12px; }
  body:not([data-part="0"]) #app .steps { margin-bottom: 10px; }
}
