/* ==========================================================================
   말랑귀 — 가로(16:9) 화면 레이어. style.css · gamify.css · growth.css · splash.css 다음에 마지막으로 읽는다.
   - 앱 전체가 가로 화면이다 (태블릿·PC 가로, 옆으로 돌린 휴대폰). 시연 페이지(별빛 망원경)처럼 장면이 크고 말은 옆에.
   - #app 은 화면 가운데 놓인 '틀'이다. 16:9 를 기준으로, 4:3(아이패드) ~ 20:9(옆으로 돌린 폰) 사이에서는 화면을 꽉 채우고,
     그보다 더 넓거나 좁으면 남는 곳을 앱 벽지 무늬로 채운다(레터박스). 틀 비율 범위는 아래 --ar-* 두 줄로 바꾼다.
     (16:9 로만 고정하려면 --ar-wide: 16 / 9; --ar-tall: 9 / 16 로 바꾸면 된다)
   - 글자 기준 크기(html font-size)도 틀 크기를 따라 13~20px 사이에서 바뀐다 (1280×720 → 16px).
   - 휴대폰 세로: 앱 대신 '옆으로 돌려 줘' 안내. 시작·보호자 로그인·아이 고르기·보호자 메뉴는 세로로도 쓴다.
   ========================================================================== */

:root {
  --ar-wide: 20 / 9;       /* 틀이 가장 넓어질 수 있는 비율 (폭 ÷ 높이) */
  --ar-tall: 3 / 4;        /* 틀이 가장 높아질 수 있는 비율 (높이 ÷ 폭) = 4:3 */
  --frame-w: min(100vw, calc(100dvh * var(--ar-wide)));
  --frame-h: min(100dvh, calc(100vw * var(--ar-tall)));
  --fs-base: clamp(13px, min(calc(var(--frame-h) / 45), calc(var(--frame-w) / 70)), 20px);
  --side-w: clamp(300px, 34%, 470px);   /* 오른쪽 이야기 판 / 홈 카드 줄 폭 */
  --pad: 12px;
}
html { font-size: var(--fs-base); }
html.big-text { font-size: calc(var(--fs-base) * 1.12); }

/* ------------------------------------------------------------------ 틀 */
html, body { height: 100%; }
body {
  font-size: 1.0625rem;
  min-height: 0; height: 100dvh; overflow: hidden;
  background-color: var(--cream);
  background-image: url("assets/wallpaper_day.webp");   /* 레터박스도 앱 벽지 무늬 */
  background-size: 700px 700px;
}
#app {
  position: absolute; inset: 0; margin: auto;
  width: var(--frame-w); height: var(--frame-h); max-width: none; min-height: 0;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(230, 211, 173, .6), 0 18px 50px var(--shadow);
}
.screen {
  min-height: 0; height: 100%;
  padding: var(--pad) max(var(--pad), env(safe-area-inset-right)) var(--pad) max(var(--pad), env(safe-area-inset-left));
}
.screen-center { overflow-y: auto; overscroll-behavior: contain; }
.screen-home, .screen-stage, .screen-chat, .screen-room { height: 100%; }
.screen-center > .back-btn { top: var(--pad); left: max(var(--pad), env(safe-area-inset-left)); }

/* 본문 화면 위에 뜨는 딤드(꼬미 인사·안내·설명·성장 앨범)는 폰 폭 520px 칸이 아니라 화면 전체를 덮는다 */
.pip-greet, .detail-veil, .coach { max-width: none; margin: 0; }

/* ------------------------------------------------------- 휴대폰 세로: 돌려 줘 */
.rotate-prompt {
  display: none;
  position: fixed; inset: 0; z-index: 2147482000;   /* 스플래시(2147483000) 바로 아래, 앱·딤드 위 */
  align-items: center; justify-content: center; padding: 24px;
  background: var(--cream) url("assets/wallpaper_day.webp") center / 700px 700px;
  color: var(--ink); font-family: var(--font-body);
}
.rotate-card {
  width: 100%; max-width: 340px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  background: var(--paper) url("assets/paper_tile.webp") center / 384px 384px;
  border: 3px solid var(--line-strong); border-radius: var(--radius-lg);
  box-shadow: 0 5px 0 var(--line-strong), 0 12px 24px var(--shadow);
  padding: 22px 18px 20px;
}
.rotate-who { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rotate-kkomi { width: 112px; height: auto; animation: chick-bob 2.6s ease-in-out infinite; }
.rotate-name {
  font-family: var(--font-display); font-size: 1rem; background: var(--sun); color: #4a3628;
  border-radius: 999px; padding: 2px 14px; box-shadow: 0 2px 0 var(--sun-deep);
}
.rotate-text { margin: 0; font-family: var(--font-display); font-size: 1.55rem; line-height: 1.3; word-break: keep-all; }
.rotate-sub { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--ink-soft); word-break: keep-all; }
.rotate-phone { font-size: 3rem; line-height: 1; height: 64px; display: flex; align-items: center; }
.rotate-phone span { display: inline-block; animation: rotate-hint 2.4s ease-in-out infinite; }
@keyframes rotate-hint { 0%, 20% { transform: rotate(0deg); } 50%, 80% { transform: rotate(-90deg); } 100% { transform: rotate(0deg); } }
#btn-rotate-full { width: 100%; }
@media (prefers-reduced-motion: reduce) { .rotate-phone span, .rotate-kkomi { animation: none; } }

/* 세로 화면: 시작·보호자 로그인·아이 고르기·보호자 메뉴(PIN·설정·리포트)는 원래(세로) 모양으로 쓴다 */
/* 세로로 써도 되는 화면: 시작·보호자 로그인·아이 고르기·보호자 메뉴(PIN·설정·리포트)·인앱 브라우저 안내 */
@media (orientation: portrait) {
  html:is(:has(#screen-title:not([hidden])), :has(#screen-guardian-login:not([hidden])), :has(#screen-child-select:not([hidden])), :has(#overlay-guardian:not([hidden])), :has(#overlay-guardian-menu:not([hidden])), :has(#overlay-pin:not([hidden])), :has(#overlay-report:not([hidden])), :has(.inapp-guide)) { font-size: 16px; }
  html.big-text:is(:has(#screen-title:not([hidden])), :has(#screen-guardian-login:not([hidden])), :has(#screen-child-select:not([hidden])), :has(#overlay-guardian:not([hidden])), :has(#overlay-guardian-menu:not([hidden])), :has(#overlay-pin:not([hidden])), :has(#overlay-report:not([hidden])), :has(.inapp-guide)) { font-size: 112%; }
  html:is(:has(#screen-title:not([hidden])), :has(#screen-guardian-login:not([hidden])), :has(#screen-child-select:not([hidden])), :has(#overlay-guardian:not([hidden])), :has(#overlay-guardian-menu:not([hidden])), :has(#overlay-pin:not([hidden])), :has(#overlay-report:not([hidden])), :has(.inapp-guide)) body { height: auto; min-height: 100dvh; overflow-y: auto; }
  html:is(:has(#screen-title:not([hidden])), :has(#screen-guardian-login:not([hidden])), :has(#screen-child-select:not([hidden])), :has(#overlay-guardian:not([hidden])), :has(#overlay-guardian-menu:not([hidden])), :has(#overlay-pin:not([hidden])), :has(#overlay-report:not([hidden])), :has(.inapp-guide)) #app { position: relative; inset: auto; margin: 0 auto; width: 100%; max-width: 520px; height: auto; min-height: 100dvh; overflow: visible; overflow-x: clip; }
  html:is(:has(#screen-title:not([hidden])), :has(#screen-guardian-login:not([hidden])), :has(#screen-child-select:not([hidden])), :has(#overlay-guardian:not([hidden])), :has(#overlay-guardian-menu:not([hidden])), :has(#overlay-pin:not([hidden])), :has(#overlay-report:not([hidden])), :has(.inapp-guide)) .screen { height: auto; min-height: 100dvh; overflow: visible; }
  html:is(:has(#screen-title:not([hidden])), :has(#screen-guardian-login:not([hidden])), :has(#screen-child-select:not([hidden])), :has(#overlay-guardian:not([hidden])), :has(#overlay-guardian-menu:not([hidden])), :has(#overlay-pin:not([hidden])), :has(#overlay-report:not([hidden])), :has(.inapp-guide)) .overlay-panel { max-height: 88dvh; }
  html:is(:has(#screen-title:not([hidden])), :has(#screen-guardian-login:not([hidden])), :has(#screen-child-select:not([hidden])), :has(#overlay-guardian:not([hidden])), :has(#overlay-guardian-menu:not([hidden])), :has(#overlay-pin:not([hidden])), :has(#overlay-report:not([hidden])), :has(.inapp-guide)) .report-body { max-height: 70dvh; }
}
/* 휴대폰(또는 터치 태블릿)을 세워 들면: 아이 화면 대신 '옆으로 돌려 줘' */
@media (orientation: portrait) and (max-width: 600px), (orientation: portrait) and (pointer: coarse) and (max-width: 1100px) {
  html:not(:is(:has(#screen-title:not([hidden])), :has(#screen-guardian-login:not([hidden])), :has(#screen-child-select:not([hidden])), :has(#overlay-guardian:not([hidden])), :has(#overlay-guardian-menu:not([hidden])), :has(#overlay-pin:not([hidden])), :has(#overlay-report:not([hidden])), :has(.inapp-guide))) .rotate-prompt { display: flex; }
}

/* ============================================================ 시작 화면 (가로) */
@media (orientation: landscape) {
  #screen-title .title-wrap {
    max-width: 1040px; display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) repeat(8, auto) minmax(0, 1fr); height: 100%;
    column-gap: clamp(18px, 4%, 48px); row-gap: 0; align-items: center; justify-items: center;
  }
  #screen-title .title-wrap > :not(.title-hero) { margin-bottom: 12px; }
  #screen-title .title-logo { grid-row: 2; }
  #screen-title .title-tagline { grid-row: 3; }
  #screen-title .title-points { grid-row: 4; }
  #screen-title #btn-title-start { grid-row: 5; }
  #screen-title #server-waking { grid-row: 6; }
  #screen-title #server-down { grid-row: 7; }
  #screen-title .title-wrap > .hint { grid-row: 8; }
  #screen-title .consent-notice { grid-row: 9; }
  #screen-title .title-hero {
    grid-column: 1; grid-row: 1 / -1; align-self: center;
    width: auto; max-width: 100%; height: calc(var(--frame-h) - 2 * var(--pad) - 16px); max-height: 640px;
    aspect-ratio: 9 / 13; object-fit: cover; object-position: center 30%; margin: 0;
  }
  #screen-title .title-wrap > :not(.title-hero) { grid-column: 2; }
  #screen-title .title-logo { font-size: 3.4rem; }
  #screen-title .title-logo span { font-size: 1.8rem; }
  #screen-title #btn-title-start { max-width: 380px; }
  #screen-title .consent-notice { max-width: 420px; }

  /* ---- 보호자 로그인: 왼쪽 인사 · 오른쪽 입력칸 */
  #screen-guardian-login { justify-content: flex-start; }
  #screen-guardian-login .auth-card {
    max-width: 860px; margin: auto 0; display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
    column-gap: 28px; align-items: center; padding: 22px 24px;
  }
  #screen-guardian-login .auth-card > .brand { grid-column: 1; grid-row: 1 / span 3; margin: 0; }
  #screen-guardian-login .auth-card > form { grid-column: 2; }
  #screen-guardian-login .brand-emoji img { height: 76px; }
  #screen-guardian-login .brand-emoji img:nth-child(2) { height: 96px; }
  #screen-guardian-login .brand h1 { font-size: 1.8rem; }

  /* ---- 아이 고르기 */
  #screen-child-select .card { max-width: 760px; }
  #screen-child-select .child-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ============================================================ 처음 안내 (가로: 그림 왼쪽 · 글 오른쪽) */
#screen-intro .intro-card {
  max-width: 1000px; width: 100%;
  height: min(600px, calc(var(--frame-h) - 2 * var(--pad) - 40px)); min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto;
  column-gap: clamp(16px, 3%, 36px); row-gap: 14px; align-items: center; padding: 22px 26px;
}
#screen-intro .intro-visual { grid-column: 1; grid-row: 1 / span 2; height: 100%; min-height: 0; align-items: center; }
#screen-intro .intro-image { max-width: 100%; max-height: 100%; height: 100%; width: auto; object-fit: cover; }
#screen-intro .intro-text { grid-column: 2; grid-row: 1; height: auto; max-height: 100%; font-size: 1.6rem; line-height: 1.6; align-self: center; }
#screen-intro .intro-foot { grid-column: 2; grid-row: 2; margin: 0; }
#screen-intro .intro-visual .who .avatar-img { width: 92px; height: 92px; }
#screen-intro .intro-char { height: min(190px, 30vh); }

/* ============================================================ 홈 (왼쪽 마을 그림 · 오른쪽 카드 줄) */
.screen-home {
  display: grid; overflow: hidden;
  grid-template-columns: minmax(0, 1fr) var(--side-w);
  grid-template-rows: repeat(7, auto) minmax(0, 1fr);
  column-gap: 14px; row-gap: 0;
}
.screen-home > .home-topbar { grid-column: 1; grid-row: 1; margin-bottom: 10px; }
.screen-home > .home-stage { grid-column: 1; grid-row: 2 / -1; min-height: 0; }
.screen-home > :not(.home-topbar):not(.home-stage) { grid-column: 2; margin: 0 0 10px; width: 100%; max-width: none; }
.screen-home > .xp-gauge { order: 1; }
.screen-home > .home-goal-card { order: 2; }
.screen-home > .home-hint { order: 3; }
.screen-home > .next-friend-card { order: 4; }
.screen-home > .home-actions { order: 5; margin-bottom: 0; }
.home-actions { gap: 10px; }
.home-actions > .home-hint { margin-bottom: 0; }
.home-actions > .next-friend-card { width: 100%; margin: 0; max-width: none; }
.home-card-row { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.home-card:not(.home-card-primary) { flex-direction: column; gap: 3px; text-align: center; }
.home-card-label { white-space: normal; word-break: keep-all; }
.home-intro-link { min-height: 34px; }
/* 마을 그림 위 소품은 원래 세로 칸(폭 기준 %)에 맞춰져 있었다. 가로 칸에서는 높이(cqh)를 기준으로 크기를 잡아 거인이 되지 않게 */
.home-stage { container-type: size; }
.meadow-sign-town { width: 25cqh; }
.meadow-sign-play { width: 23cqh; }
.meadow-bird { width: 10cqh; }
.meadow-duck { width: 11cqh; }
.meadow-butterfly { width: 9cqh; }
.meadow-house { width: 34cqh; }
.meadow-mailbox { width: 19cqh; }
.meadow-actor { width: 27cqh; left: 34%; }
.meadow-chick { width: 15cqh; left: 18%; }

/* ============================================================ 단톡방 (가운데 넓은 대화 칸) */
.screen-chat { align-items: center; }
.screen-chat .chat-topbar { width: 100%; }
.screen-chat .chat-lines { width: 100%; max-width: 900px; }
.screen-chat .chat-cta-wrap { width: 100%; max-width: 520px; }
.bubble-row { max-width: 78%; }

/* ============================================================ 장소 (위 얇은 머리줄 · 큰 장면 · 아래 이야기 판)
   시연 페이지(별빛 망원경)처럼: 장면은 화면 폭 가득 큰 카드, 지금 대사는 장면 위쪽 어두운 자막,
   장면 아래에 '🎤 네 차례야' 한 줄과 추천 문장 카드(흰 카드 4칸 격자), 그 아래 글자 입력 한 줄.
   대화 기록은 머리줄 '대화 보기'로 장면 위에 시트로 펼친다. 연습 카드는 아래 판이 시트로 커져서 연다(장면은 위에 그대로). */
#screen-stage {
  --top-h: 46px;
  --xp-w: clamp(120px, 15%, 190px);
  --st-bg: #fff6ec;
  --st-line: #f0dcc6;
  --st-card: #ffffff;
  --sub-bg: rgba(18, 22, 54, .74);
  --sub-name: #ffd27a;
  --side-min: clamp(118px, calc(var(--frame-h) * .25), 200px);
  --side-max: calc(var(--frame-h) * .56);
  --practice-min: calc(var(--frame-h) * .42);
  --stage-wmax: 1180px;
}
.screen-stage {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto;
  row-gap: 10px; column-gap: 0;
  background: var(--st-bg);
  padding-top: 6px; padding-bottom: 10px;
}
/* 이야기 화면에서는 레터박스도 무늬 없이 같은 크림색 */
html:has(#screen-stage:not([hidden])) body { background-image: none; background-color: #fff6ec; }

.stage-main { position: relative; grid-row: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 6px; }

/* ---- 머리줄: 왼쪽 작은 이름 · 오른쪽 알약 버튼(대화 보기 · 소리 · 홈 · 뒤로) · 맨 오른쪽 경험치 */
.stage-main .stage-topbar {
  flex: none; height: var(--top-h); min-height: var(--top-h);
  display: flex; align-items: center; justify-content: flex-start; gap: 10px;
  padding: 0 calc(var(--xp-w) + 10px) 0 4px;
}
.stage-brand { flex: none; font-family: var(--font-display); font-size: 1.3rem; line-height: 1; color: #ff7a59; white-space: nowrap; letter-spacing: .5px; }
.stage-main .stage-location {
  flex: 0 1 auto; min-width: 0; text-align: left; font-size: 1rem; color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stage-main .stage-deco { display: none; }
.stage-tools { flex: none; margin-left: auto; display: flex; align-items: center; gap: 8px; }
.stage-tools .stage-pill,
.stage-tools .back-btn.stage-pill,
.stage-tools .icon-btn.stage-pill {
  width: auto; min-width: 0; height: 38px; min-height: 38px; padding: 0 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 999px; border: 2px solid var(--st-line); background: #fffdf8; color: var(--ink);
  font-family: var(--font-display); font-size: .98rem; line-height: 1; white-space: nowrap;
  box-shadow: 0 2px 0 var(--st-line); cursor: pointer;
}
.stage-tools .stage-pill:active { transform: translateY(2px); box-shadow: none; }
.stage-tools .stage-pill:focus-visible { outline: 3px solid var(--sky-deep); outline-offset: 2px; }
.stage-tools .icon-img-btn img { width: 22px; height: 22px; margin: 0; }
.stage-tools .log-all-btn { align-self: center; margin: 0; }
.stage-tools .log-all-btn[hidden] { display: none; }
.stage-tools .log-all-btn[aria-expanded="true"] { background: var(--sun); border-color: var(--sun-deep); box-shadow: 0 2px 0 var(--sun-deep); }
.stage-main .stage-xp {
  position: absolute; top: calc((var(--top-h) - 30px) / 2); right: 0; width: var(--xp-w); height: 30px;
  margin: 0; padding: 3px 10px; border: 2px solid var(--st-line); box-shadow: none; background: #fffdf8;
}

/* ---- 장면: 남는 높이를 모두 쓰는 큰 둥근 카드 */
.screen-stage .stage-floor,
.screen-stage.is-practicing .stage-floor,
.screen-stage.is-practicing.practice-folded .stage-floor,
.screen-stage.log-expanded .stage-floor,
html.mic-resting .screen-stage .stage-floor { flex: 1 1 auto; height: auto; min-height: 0; }
.stage-floor { container-type: size; container-name: floor; }
.screen-stage .stage-floor {
  border: 0; border-radius: 26px;
  box-shadow: 0 12px 30px rgba(110, 70, 30, .18), 0 0 0 1px rgba(160, 120, 80, .08);
}
.stage-backdrop img.bd-sky { object-position: center 30%; }
.stage-backdrop img.bd-mid, .stage-backdrop img.bd-front { top: -6%; bottom: auto; height: 112%; object-fit: cover; object-position: center bottom; }
.stage-backdrop.bd-v2 img.bd-mid { top: -2%; height: 104%; object-position: center 70%; }
.char-chip-avatar { width: clamp(64px, min(30cqh, 16cqw), 230px); height: clamp(64px, min(30cqh, 16cqw), 230px); }
.char-chip.is-talking .char-chip-name { background: var(--sub-name); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
.char-chip.is-talking .char-chip-img { filter: drop-shadow(0 0 10px rgba(255, 226, 140, .95)) drop-shadow(0 4px 6px rgba(60, 40, 20, .28)); }
.stage-objects { padding: 0; }
.stage-skills { margin: 0; }
/* 물건(단서) 칩은 장면 왼쪽 아래, 단계 칩은 오른쪽 아래에 얹는다 */
.stage-main > .stage-objects { position: absolute; left: 12px; bottom: 12px; z-index: 4; max-width: 55%; }
.stage-main > .stage-skills { position: absolute; right: 12px; bottom: 12px; z-index: 4; max-width: 45%; justify-content: flex-end; }
.stage-main > .stage-objects .object-chip { background: rgba(255, 253, 248, .94); border-color: var(--st-line); }
.stage-main > .stage-skills .stage-chip { background: rgba(255, 247, 224, .95); box-shadow: 0 3px 10px rgba(0, 0, 0, .18); }

/* ---- 자막: 지금 대사 · 해설 · (연습 중) 방금 친구 대사 — 장면 위쪽 가운데 어두운 반투명 띠 */
#stage-floor > .stage-subtitle,
#stage-floor > .stage-caption,
#stage-floor > .stage-lastline {
  position: absolute; z-index: 7; top: 14px; left: 50%; translate: -50% 0; transform: none;
  width: max-content; max-width: min(88%, 940px); margin: 0;
  background: var(--sub-bg); color: #fff; border: 0; border-radius: 18px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
  padding: 10px 18px; font-family: var(--font-body); font-size: 1.28rem; font-weight: 700; line-height: 1.45;
  text-align: center; word-break: keep-all; overflow-wrap: break-word;
}
#stage-floor > .stage-subtitle { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 8px 8px 18px; }
#stage-floor > .stage-subtitle[hidden], #stage-floor > .stage-lastline[hidden], #stage-floor > .stage-caption[hidden] { display: none; }
#stage-floor > .stage-subtitle.is-new { animation: sub-in .28s ease both; }
@keyframes sub-in { from { opacity: 0; translate: -50% -6px; } to { opacity: 1; translate: -50% 0; } }
.sub-who { flex: none; font-family: var(--font-display); font-weight: 400; color: var(--sub-name); white-space: nowrap; }
.sub-text { min-width: 0; }
.sub-replay {
  flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; padding: 0;
  background: rgba(255, 255, 255, .16); color: #fff; font-size: 1.05rem; cursor: pointer;
}
.sub-replay:active { transform: scale(.92); }
.sub-replay:focus-visible { outline: 3px solid var(--sub-name); outline-offset: 2px; }
#stage-floor > .stage-caption { font-style: italic; font-weight: 600; animation: none; }
#stage-floor > .stage-lastline { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
#stage-floor > .stage-lastline b { color: var(--sub-name); font-family: var(--font-display); font-weight: 400; margin-right: 8px; }
.screen-stage.is-practicing #stage-floor > .stage-subtitle { display: none; }   /* 연습 중에는 방금 친구 대사(stage-lastline)가 자막 */
/* 이야기 중에는 친구 머리 위 말풍선 대신 자막으로 (생각 중 말풍선 '...'은 그대로). 결말 하이라이트는 말풍선 */
.screen-stage:not(.is-highlight) #stage-fx > .speech-float:not(.thinking-bubble) { display: none; }
.screen-stage.is-highlight #stage-floor > .stage-subtitle,
.screen-stage.log-expanded #stage-floor > .stage-subtitle { display: none; }   /* 대화 보기를 펼치면 자막은 접는다 (같은 말이 기록에 있다) */
/* 마이크가 숨어 있는 동안(시연·대사 중)에는 '눌러서 말하기'도 같이 숨긴다 */
#btn-mic[style*="visibility: hidden"] + .mic-hint { visibility: hidden; }

/* ---- 대화 보기: 평소엔 화면에서 숨기고(읽어 주기는 그대로), 펼치면 장면 오른쪽 위에 시트로 */
#stage-floor > #stage-log:not(.is-expanded) {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
#stage-floor > #stage-log.is-expanded {
  position: absolute; z-index: 12; top: 12px; right: 12px; bottom: 12px; width: min(480px, 72%);
  max-height: none; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 16px; border-radius: 22px; color: var(--ink);
  background: #fffdf8; border: 2px solid var(--st-line);
  box-shadow: 0 16px 36px rgba(40, 24, 10, .3);
  font-size: 1.02rem; line-height: 1.5; animation: log-in .22s ease both;
}
#stage-floor > #stage-log.is-expanded::before {
  content: "💬 지금까지의 이야기"; flex: none; font-family: var(--font-display); font-size: 1.05rem; color: var(--ink-soft);
}
#stage-floor > #stage-log.is-expanded .log-line { display: flex; }
@keyframes log-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* ---- 단서 큰 말풍선: 장면 위쪽(자막 자리)에 크게, 꼬리는 왼쪽 아래 물건 칩 쪽 */
#stage-floor > .clue-bubble { top: 12px; left: 50%; right: auto; translate: -50% 0; width: min(86%, 780px); z-index: 11; }

/* ---- 아래 이야기 판 */
.stage-side {
  grid-row: 2; min-width: 0; min-height: var(--side-min); max-height: var(--side-max);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 8px;
  padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; overflow: visible;
}
.stage-side > * { flex: none; width: 100%; max-width: var(--stage-wmax); }
.stage-side > .demo-banner { margin: 0; flex-wrap: wrap; max-width: 820px; }
.stage-side > .transfer-bar, .stage-side > .stage-hint, .stage-side > .stage-examples { margin: 0; max-width: 860px; }
.stage-side .mic-rest-chip { max-width: none; }
.stage-side .mic-done-btn { max-width: 150px; }

/* 네 차례야: 가운데 한 줄 (꼬미의 질문 + 다시 듣기) */
.stage-side > .stage-prompt {
  width: auto; max-width: min(100%, 980px); align-self: center; justify-content: center;
  gap: 8px; padding: 0 2px; background: none; border: 0; border-radius: 0;
  font-family: var(--font-display); font-weight: 400; font-size: 1.12rem; line-height: 1.35; color: var(--ink);
  text-align: center; word-break: keep-all;
}
.stage-side > .stage-prompt .stage-prompt-avatar, .stage-side > .stage-prompt .stage-prompt-avatar img { width: 32px; height: 32px; }
.stage-side > .stage-prompt #stage-prompt-text { flex: 0 1 auto; }
#stage-prompt-text::before {
  content: "🎤 네 차례야"; display: inline-block; margin-right: 10px; padding: 3px 12px; vertical-align: 1px;
  border-radius: 999px; background: var(--sun); color: #4a3628; font-size: .86em; box-shadow: 0 2px 0 var(--sun-deep);
}
.stage-side > .stage-prompt .icon-btn.small { width: 36px; height: 36px; min-width: 36px; min-height: 36px; box-shadow: 0 2px 0 var(--st-line); border: 2px solid var(--st-line); }

/* 발밑: 추천 문장 카드(흰 카드 격자) → 그 아래 한 줄(마이크 상태 · 글자 입력 · 보내기) → (마이크가 되면) 큰 🎤 */
.stage-side > .stage-footer {
  margin-top: 0; padding: 0;
  display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); column-gap: 12px; row-gap: 10px; align-items: center;
}
.stage-footer > * { grid-column: 1 / -1; }
.stage-footer > .mic-rest:not([hidden]) { display: contents; }
.stage-footer .mic-rest-suggest {
  grid-column: 1 / -1; order: 1;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px;
  overflow: visible; padding: 0;
}
.stage-footer .mic-rest-suggest:empty { display: none; }
.stage-footer .mic-rest-chip {
  min-height: 66px; padding: 12px 18px; max-width: none; width: 100%;
  white-space: normal; overflow: visible; text-overflow: clip; text-align: left; word-break: keep-all;
  background: var(--st-card); color: var(--ink); border: 2px solid var(--st-line); border-radius: 20px;
  box-shadow: 0 4px 0 var(--st-line); font-family: var(--font-body); font-size: 1.22rem; font-weight: 700; line-height: 1.4;
}
.stage-footer .mic-rest-chip:hover { border-color: #ffb347; }
.stage-footer .mic-rest-chip:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--st-line); }
.stage-footer .mic-rest-chip:focus-visible { outline: 3px solid var(--sky-deep); outline-offset: 2px; }
.stage-footer .mic-rest-head {
  grid-column: 1; order: 2; display: flex; align-items: center; gap: 8px; max-width: 580px;
  padding: 4px 6px 4px 12px; border-radius: 16px; background: #fff7e0; border: 2px solid #f3d98b;
}
.stage-footer .mic-rest-text { font-size: .86rem; line-height: 1.3; }
.stage-footer .mic-rest .mic-ask-adult { flex: 0 1 auto; max-width: 180px; min-height: 38px; }
.stage-footer > .text-input-row { grid-column: 2; order: 3; margin: 0; }
.stage-footer:not(:has(> .mic-rest:not([hidden]))) > .text-input-row { grid-column: 1 / -1; width: 100%; max-width: 720px; justify-self: center; }
.stage-footer > .text-input-row input { min-height: 50px; border-color: var(--st-line); background: #fffdf8; font-size: 1.05rem; border-radius: 16px; }
.stage-footer > .text-input-row .btn { min-height: 50px; padding: 0 22px; }
.stage-footer > .mic-row { order: 4; }
.stage-footer > .mic-confirm { left: 50%; right: auto; translate: -50% 0; width: min(100%, 640px); bottom: 0; }

/* ---- 연습 카드: 아래 판이 시트로 커진다 (장면·친구 얼굴은 위에 그대로) */
.screen-stage.is-practicing .stage-side {
  max-height: var(--side-max); overflow: hidden; gap: 6px;
  padding: 8px 16px 10px; border-radius: 26px; background: var(--paper);
  border: 2px solid var(--st-line); box-shadow: 0 -10px 30px rgba(90, 60, 30, .16);
  animation: sheet-up .28s ease both;
}
.screen-stage.is-practicing .stage-side > .practice-panel {
  flex: 0 1 auto; min-height: 0; order: 5; width: 100%;
  border: 0; border-radius: 0; background: none; box-shadow: none; padding: 0; animation: none;
}
.screen-stage.is-practicing .stage-side > .practice-panel.is-folded { flex: 0 0 auto; }
.screen-stage.is-practicing .stage-side > .stage-footer { order: 6; }
.screen-stage.is-practicing .stage-side { min-height: var(--practice-min); }   /* 단계가 바뀔 때 장면 크기가 덜 출렁이게 */
.screen-stage.is-practicing.practice-folded .stage-side { min-height: 0; }
.stage-side .practice-next { min-width: min(100%, 320px); }
.stage-side .practice-top { justify-content: center; position: relative; }
.stage-side .practice-open { flex: 0 1 auto; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 10px; }
.stage-side .practice-fold { position: absolute; right: 0; top: 50%; translate: 0 -50%; }
.stage-side .practice-panel.is-folded .practice-open::after { flex-basis: auto; }
.stage-side .practice-sheet-body { gap: 8px; }
.stage-side .practice-body { justify-content: flex-start; align-items: center; gap: 8px; }
.stage-side .practice-body > * { width: 100%; max-width: 820px; }
.stage-side .practice-card { flex-direction: row; flex-wrap: wrap; justify-content: center; column-gap: 14px; row-gap: 2px; padding: 10px 18px; }
.stage-side .practice-card p:last-child { flex-basis: 100%; }
.stage-side .practice-lead { max-width: 720px; }
.stage-side .practice-body > .practice-choices { max-width: var(--stage-wmax); }
.stage-side .practice-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 12px; }
.stage-side .practice-choice .practice-bubble {
  height: 100%; min-height: 64px; background: var(--st-card); border: 2px solid var(--st-line); border-radius: 20px;
  box-shadow: 0 4px 0 var(--st-line); font-size: 1.15rem;
}
.stage-side .practice-choice[aria-pressed="true"] .practice-bubble { background: #fff7e0; border-color: var(--sun-deep); box-shadow: 0 0 0 3px var(--sun); }
.stage-side .practice-praise { align-items: center; }
.stage-side .practice-praise > .practice-bubble { max-width: 720px; width: 100%; }
.screen-stage.is-practicing .stage-side .practice-actions { padding: 6px 0 0; }
.screen-stage.is-practicing .stage-footer .mic-rest-head { max-width: 400px; }
.screen-stage.is-practicing .mic-btn { width: 64px; height: 64px; }
/* 결말 하이라이트: 아래 판 가운데 한 장 */
.stage-side > .highlight-panel { width: 100%; max-width: 760px; margin: 0; padding: 12px 18px; box-shadow: 0 6px 18px var(--shadow); animation: sheet-up .3s ease both; }
.screen-stage.is-highlight .stage-side > .stage-hint, .screen-stage.is-highlight .stage-side > .transfer-bar { display: none; }
@media (prefers-reduced-motion: reduce) {
  .screen-stage.is-practicing .stage-side, .stage-side > .highlight-panel, #stage-floor > .stage-subtitle.is-new, #stage-floor > #stage-log.is-expanded { animation: none; }
}

/* ============================================================ 마무리 (두 칸) */
.ending-card {
  max-width: 1000px; max-height: calc(var(--frame-h) - 2 * var(--pad));
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 22px; align-items: start;
  padding: 20px 22px;
}
.ending-col { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.ending-col-a .reflection-box { width: 100%; }
.ending-col-b { align-self: stretch; justify-content: center; }
/* 카드가 길어져도 '다음'·'홈으로'는 카드 아래에 붙어 늘 보인다 */
.ending-col-b > .btn-big { position: sticky; bottom: 0; z-index: 2; }
.ending-col-b > .btn-big, .ending-col-b > .ending-xp { width: 100%; max-width: 380px; }
.ending-col-b > .ending-album-card { margin: 0 0 12px; }

/* ============================================================ 시트 · 팝업 (가운데 상자) */
.overlay { align-items: center; padding: 16px; }
.overlay-panel {
  max-width: 640px; border-radius: var(--radius-lg); padding: 14px 20px 20px;
  max-height: calc(var(--frame-h) - 24px);
}
.sheet-handle { display: none; }
.overlay-panel-small { max-width: 420px; }
.overlay-panel-wide { max-width: 860px; }
#overlay-episodes .overlay-panel { max-width: 900px; }
.episode-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rewards-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
#overlay-rewards .overlay-panel, #overlay-friends .overlay-panel { max-width: 820px; }
.friends-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
/* 보호자 설정: 아이 설정 탭은 두 단으로 */
#tab-settings:not([hidden]) { display: block; columns: 2; column-gap: 24px; }
#tab-settings > * { break-inside: avoid; margin: 0 0 12px; }
#tab-settings > .btn-big { display: block; }
.mic-confirm-text { max-height: 24vh; }
.report-body { max-height: calc(var(--frame-h) - 140px); }

/* 성장 앨범 · 도감 · 앨범: 넓은 상자, 성장 앨범은 두 단 */
.detail-veil { padding: 16px; }
.growth-card, .codex-veil-card, .album-veil-card, .theme-veil-card, .storybook-veil-card {
  max-height: calc(var(--frame-h) - 32px);
}
.growth-card { max-width: 760px; display: block; columns: 2; column-gap: 24px; text-align: center; padding: 26px 20px 18px; }
.growth-card > * { break-inside: avoid; }
.growth-card > .growth-h { break-after: avoid; margin: 10px 0 6px; }
.growth-card > .popup-close { position: absolute; }
.growth-card > .growth-badge { margin: 4px auto 6px; }
.growth-card > .growth-title, .growth-card > .growth-level, .growth-card > .growth-next { margin-bottom: 6px; }
.growth-card > .xp-track.big { margin: 4px 0 6px; }
.growth-card > .growth-links, .growth-card > .streak-ladder { margin: 6px 0; }
.growth-card > .btn { display: block; width: 100%; margin-top: 10px; }
.codex-veil-card, .album-veil-card { max-width: 720px; }
.codex-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.album-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.album-eps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.storybook-veil-card { max-width: 760px; }
.storybook-frame { height: calc(var(--frame-h) * .52); }

/* ============================================================ 꼬미의 방 (세 방을 한 줄에) */
.screen-room { overflow-y: auto; justify-content: center; }
.room-stack { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.room-floor.has-art { max-height: none; }

/* ============================================================ 옆으로 돌린 휴대폰 · 낮은 화면 (높이 ≤ 520px) */
@media (max-height: 520px) {
  :root { --pad: 8px; --gutter: 8px; --side-w: clamp(260px, 40%, 360px); --touch: 46px; }
  .back-btn, .icon-btn { width: 42px; height: 42px; min-width: 42px; min-height: 42px; font-size: 1.05rem; }
  .icon-btn.small { width: 34px; height: 34px; min-width: 34px; min-height: 34px; }
  .btn { min-height: 44px; }
  .btn-primary { font-size: 1.1rem; box-shadow: 0 4px 0 var(--coral-deep); }
  .card { padding: 16px 16px; }
  .screen-title { margin: 2px 0 10px; font-size: 1.35rem; }

  /* 홈 */
  .home-topbar { gap: 6px; }
  .gear-btn { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  .gear-btn img { width: 26px; height: 26px; }
  .neighborhood-status { min-height: 40px; padding: 4px 12px 4px 8px; font-size: .9rem; }
  .ns-emoji { width: 24px; height: 24px; }
  .screen-home > .home-topbar { margin-bottom: 6px; }
  .screen-home > :not(.home-topbar):not(.home-stage) { margin-bottom: 6px; }
  .xp-gauge { padding: 5px 10px; gap: 8px; }
  .xp-badge { width: 30px; height: 30px; font-size: 1rem; }
  .home-goal-card { padding: 4px 6px; }
  .home-hint { padding: 6px 26px 6px 8px; gap: 8px; font-size: .92rem; line-height: 1.35; }
  .home-hint-avatar, .home-hint-avatar img { width: 36px; height: 36px; }
  .next-friend-card { grid-template-columns: 44px minmax(0, 1fr) 20px; padding: 6px 10px; gap: 8px; }
  .reco-art, .reco-art .avatar-ph { width: 44px; height: 44px; }
  .reco-line { display: none; }
  .home-actions { gap: 6px; }
  .home-card { min-height: 58px; padding: 4px; font-size: .98rem; }
  .home-card-emoji, .home-card:not(.home-card-primary) .home-card-emoji { width: 30px; height: 30px; }
  .home-card-emoji img, .home-card-primary .home-card-emoji img { max-width: 30px; max-height: 30px; }
  .home-intro-link { min-height: 28px; font-size: .82rem; }
  .badge { min-width: 26px; height: 26px; font-size: .9rem; top: -8px; right: -6px; }

  /* 장소: 머리줄·자막·카드를 줄이고, 추천 문장은 가로로 넘기는 한 줄 */
  #screen-stage { --top-h: 36px; --xp-w: clamp(96px, 14%, 150px); --side-min: 0px; --side-max: calc(var(--frame-h) * .58); }
  .screen-stage { row-gap: 6px; padding-top: 4px; padding-bottom: 6px; }
  .stage-main { gap: 4px; }
  .stage-brand { font-size: 1.05rem; }
  .stage-main .stage-location { font-size: .9rem; }
  .stage-tools { gap: 6px; }
  .stage-tools .stage-pill, .stage-tools .back-btn.stage-pill, .stage-tools .icon-btn.stage-pill { height: 32px; min-height: 32px; padding: 0 10px; font-size: .86rem; gap: 4px; }
  .stage-tools .icon-img-btn img { width: 18px; height: 18px; }
  .stage-main .stage-xp { top: calc((var(--top-h) - 26px) / 2); height: 26px; padding: 2px 8px; }
  .screen-stage .stage-floor { border-radius: 18px; }
  .stage-main > .stage-objects { left: 8px; bottom: 8px; }
  .stage-main > .stage-skills { right: 8px; bottom: 8px; }
  .stage-main > .stage-skills .stage-chip { min-height: 34px; font-size: .86rem; padding: 2px 10px; }
  .object-chip { min-height: 44px; min-width: 56px; padding: 2px 8px; font-size: .74rem; }
  .object-chip .oc-img { width: 28px; height: 28px; }
  .object-chip .oc-emoji { font-size: 1.15rem; }
  #stage-floor > .stage-subtitle, #stage-floor > .stage-caption, #stage-floor > .stage-lastline { top: 8px; max-width: min(92%, 760px); padding: 5px 12px; font-size: 1rem; line-height: 1.35; border-radius: 14px; }
  #stage-floor > .stage-subtitle { padding: 4px 4px 4px 12px; gap: 8px; }
  .sub-replay { width: 32px; height: 32px; font-size: .9rem; }
  #stage-floor > #stage-log.is-expanded { top: 6px; right: 6px; bottom: 6px; width: min(420px, 78%); padding: 8px 12px; font-size: .92rem; gap: 4px; border-radius: 16px; }
  #stage-floor > .clue-bubble { top: 6px; width: min(92%, 680px); padding: 8px 38px 8px 8px; }
  #stage-floor > .clue-bubble .clue-art, #stage-floor > .clue-bubble .clue-art img { width: 40px; height: 40px; }
  .clue-line { font-size: .98rem; }
  .char-chip-name { font-size: .7rem; padding: 1px 7px; }
  .stage-side { gap: 5px; }
  .stage-side > .stage-prompt { font-size: .95rem; gap: 6px; }
  .stage-side > .stage-prompt .stage-prompt-avatar, .stage-side > .stage-prompt .stage-prompt-avatar img { width: 24px; height: 24px; }
  .stage-side > .stage-prompt .icon-btn.small { width: 32px; height: 32px; min-width: 32px; min-height: 32px; }
  #stage-prompt-text::before { padding: 1px 9px; margin-right: 6px; }
  .stage-hint { padding: 4px 6px 4px 10px; font-size: .86rem; }
  .stage-hint span { -webkit-line-clamp: 2; }
  .stage-side > .stage-footer { row-gap: 6px; column-gap: 8px; }
  .stage-footer .mic-rest-suggest {
    display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; padding: 0 2px 4px; scrollbar-width: thin;
  }
  .stage-footer .mic-rest-chip { flex: 0 0 auto; width: auto; max-width: min(320px, 46%); min-height: 46px; padding: 6px 14px; font-size: 1rem; line-height: 1.3; border-radius: 16px; box-shadow: 0 3px 0 var(--st-line); }
  .stage-footer .mic-rest-head { max-width: 330px; padding: 2px 4px 2px 8px; }
  .stage-footer .mic-rest-text { font-size: .76rem; }
  .stage-footer .mic-rest .mic-ask-adult { min-height: 32px; max-width: 130px; font-size: .68rem; }
  .stage-footer > .text-input-row input, .stage-footer > .text-input-row .btn { min-height: 42px; }
  .mic-btn, .screen-stage.is-practicing .mic-btn { width: 56px; height: 56px; box-shadow: 0 5px 0 var(--coral-deep); }
  .mic-btn .mic-icon { font-size: 1.5rem; }
  .mic-wrap { padding-bottom: 18px; }
  .mic-hint { font-size: .74rem; }
  .mic-live-text { font-size: .8rem; }
  .screen-stage.is-practicing .stage-side { padding: 4px 10px 6px; border-radius: 18px; gap: 4px; }
  .stage-side .practice-sheet-body { gap: 4px; }
  .stage-side .practice-body { gap: 4px; }
  .practice-fold { min-height: 32px; }
  .practice-card { padding: 4px 10px !important; }
  .practice-card h2 { font-size: 1.1rem !important; }
  .practice-card p, .practice-bubble { font-size: .98rem; }
  .practice-bubble.is-lead { font-size: 1.05rem; }
  .practice-bubble { padding: 4px 10px; gap: 8px; }
  .practice-bubble .pb-avatar, .practice-bubble .pb-avatar .avatar-img { width: 30px; height: 30px; }
  .practice-card .teaching-emoji { display: none; }
  .practice-kicker { font-size: .9rem; }
  .practice-steps li { font-size: .72rem; padding: 1px 7px; }
  .practice-step-chip { font-size: .9rem; padding: 2px 10px; }
  .stage-side .practice-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stage-side .practice-choice .practice-bubble { min-height: 44px; font-size: .95rem; border-radius: 14px; box-shadow: 0 3px 0 var(--st-line); }
  .practice-actions .btn { min-height: 40px; }
  .stage-side > .highlight-panel { padding: 6px 10px; gap: 2px; }
  .hl-title { font-size: 1.15rem; }
  .hl-summary { font-size: .98rem; }
  .hl-next { min-height: 42px; }
  .hl-star { width: 48px; height: 48px; margin: -24px 0 0 -24px; }
  .mic-confirm { padding: 8px 10px; gap: 6px; }
  .mic-confirm-text { font-size: 1.05rem; padding: 6px 10px; }
  .mic-confirm-actions .btn { min-height: 46px; font-size: .95rem; }
  /* 낮은 화면에서 연습 카드를 펼치면: 위아래로 쌓으면 장면이 너무 얇아져 친구 얼굴이 가려진다 → 장면 왼쪽 · 연습 시트 오른쪽 */
  .screen-stage.is-practicing:not(.practice-folded) { grid-template-columns: minmax(0, 1fr) clamp(300px, 46%, 420px); grid-template-rows: minmax(0, 1fr); column-gap: 8px; }
  .screen-stage.is-practicing:not(.practice-folded) .stage-main { grid-column: 1; grid-row: 1; }
  .screen-stage.is-practicing:not(.practice-folded) .stage-side { grid-column: 2; grid-row: 1; min-height: 0; max-height: none; justify-content: flex-start; }
  .screen-stage.is-practicing:not(.practice-folded) .stage-side > .practice-panel { flex: 1 1 auto; }
  .screen-stage.is-practicing:not(.practice-folded) .stage-brand { display: none; }
  .screen-stage.is-practicing:not(.practice-folded) .stage-side .practice-choices { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .screen-stage.is-practicing:not(.practice-folded) .stage-side .practice-fold { position: static; translate: none; }
  .screen-stage.is-practicing:not(.practice-folded) .stage-side .practice-top { justify-content: space-between; }
  .screen-stage.is-practicing:not(.practice-folded) .stage-footer { grid-template-columns: minmax(0, 1fr); }
  .screen-stage.is-practicing:not(.practice-folded) .stage-footer > .text-input-row { grid-column: 1; }
  .screen-stage.is-practicing:not(.practice-folded) .stage-footer .mic-rest-head { max-width: none; }

  /* 처음 안내 · 마무리 · 시트 */
  #screen-intro .intro-card { height: calc(var(--frame-h) - 2 * var(--pad)); padding: 12px 16px; row-gap: 8px; }
  #screen-intro .intro-text { font-size: 1.2rem; line-height: 1.5; }
  .intro-foot { gap: 8px; }
  .ending-card { padding: 10px 14px; column-gap: 16px; }
  .ending-emoji img { height: 46px; }
  .ending-star { font-size: 1.3rem; }
  #ending-title { font-size: 1.3rem; margin: 2px 0 4px; }
  .reflection-box { margin: 4px 0; padding: 6px 8px; }
  .reflection-box p { font-size: .92rem; }
  .ending-learned { padding: 6px 10px; }
  .ending-learned h3 { margin: 2px 0; font-size: .9rem; }
  .learned-points { gap: 4px; }
  .learned-point { padding: 3px 8px; font-size: .9rem; }
  .learned-text { margin-top: 2px; font-size: .88rem; }
  .learned-text.next { padding: 4px 8px; }
  .ending-rewards { gap: 6px; margin-bottom: 6px; }
  .reward-card { width: 64px; padding: 6px 4px; }
  .reward-emoji.has-art img { width: 38px; height: 38px; }
  .reward-label { font-size: .66rem; }
  .ending-col-b > .ending-album-card { margin: 0 0 6px; padding: 6px 10px; }
  .ending-relationships { margin-bottom: 6px; gap: 6px 10px; }
  .rel-avatar { width: 44px; height: 44px; }
  .ending-xp { margin: 2px auto 8px; padding: 6px 10px; }
  .overlay { padding: 8px; }
  .overlay-panel { padding: 8px 14px 12px; max-height: calc(var(--frame-h) - 12px); }
  .overlay-header { margin-bottom: 6px; padding: 4px 0; }
  .overlay-header h2 { font-size: 1.3rem; }
  .ep-art { width: 88px; height: 96px; }
  .episode-card { grid-template-columns: minmax(0, 1fr) 88px; padding: 8px 8px 8px 12px; }
  .detail-veil { padding: 8px; }
  .detail-card { padding: 16px 14px 12px; }
  .growth-card, .codex-veil-card, .album-veil-card, .theme-veil-card, .storybook-veil-card { max-height: calc(var(--frame-h) - 16px); }
  .pip-greet { flex-direction: row; flex-wrap: wrap; align-content: center; gap: 10px 18px; padding: 12px; }
  .pip-greet-chick { width: 22vh; max-width: 120px; }
  .pip-greet-bubble { max-width: 380px; padding: 10px 14px; font-size: .98rem; }
  .pip-greet-bubble::before { display: none; }
  .pip-greet .btn { flex: 0 0 100%; max-width: 330px; }
  .coach { padding: 10px; }
  .coach-card { gap: 10px; padding: 14px; max-width: 420px; }
  .rotate-kkomi { width: 80px; }

  /* 시작 화면 */
  #screen-title .title-wrap > :not(.title-hero) { margin-bottom: 6px; }
  #screen-title .title-logo { font-size: 2.5rem; }
  #screen-title .title-logo span { font-size: 1.35rem; margin-top: 2px; }
  #screen-title .title-tagline { font-size: .92rem; line-height: 1.4; }
  #screen-title .title-points span { padding: 3px 10px; font-size: .84rem; }
  #screen-title .consent-notice { margin-top: 0; padding: 5px 10px; font-size: .76rem; }
}

/* ---- 꼬미 해설 자막 (꼬미 = 나레이터, 2026-10-11): 장면 위쪽 해설 띠에 "꼬미" 이름표 + 다시 듣기. 하이라이트 중에도 보인다 */
#stage-floor > .stage-caption.is-guide {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-style: normal; padding: 6px 6px 6px 14px;
}
#stage-floor > .stage-caption.is-guide[hidden] { display: none; }
#stage-floor > .stage-caption.is-guide.is-new { animation: sub-in .28s ease both; }
#stage-floor > .stage-caption.is-guide .narr-tag { background: rgba(255, 255, 255, .14); color: var(--sub-name); border-color: rgba(255, 210, 122, .55); font-size: .78em; }
#stage-floor > .stage-caption.is-guide .narr-text { min-width: 0; font-style: italic; }
@media (max-height: 500px) {
  #stage-floor > .stage-caption.is-guide { padding: 3px 3px 3px 10px; gap: 6px; }
  #stage-floor > .stage-caption.is-guide .sub-replay { width: 32px; height: 32px; font-size: .9rem; }
}


/* ============================================================ 홈 마을 그림 v2 (2026-10-11, assets/bg_v2/home.jpg)
   그림(1920×1080)을 칸에 cover 로 깔되, 그림 좌표에 맞춰 소품을 얹을 수 있게 그림 크기·위치를 변수로 둔다.
   --mw/--mh = 그려진 그림 크기, --ml/--mt = 그림 왼쪽·위 (가로 30%, 세로 55% 기준으로 잘림 → 왼쪽 빨간 지붕 집이 덜 잘린다) */
.home-stage > * {
  --mw: max(100cqw, calc(100cqh * 16 / 9));
  --mh: max(100cqh, calc(100cqw * 9 / 16));
  --ml: calc((100cqw - var(--mw)) * .3);
  --mt: calc((100cqh - var(--mh)) * .55);
}
.home-stage > .meadow-sky {
  inset: auto; left: var(--ml); top: var(--mt); width: var(--mw); height: var(--mh);
  background-size: 100% 100%; background-position: 0 0;
}
/* 꼬미네 집: 그림 속 빨간 지붕 집(x 0~405, y 200~524) 위 투명 버튼 + 글씨 그려진 팻말 그림 */
.home-stage > .meadow-house {
  right: auto; left: var(--ml); top: calc(var(--mt) + var(--mh) * .185);
  width: calc(var(--mw) * .21); height: calc(var(--mh) * .30); filter: none; border-radius: 18px;
  background: transparent; box-shadow: none; outline: none;
}
.meadow-house:focus-visible { outline: 3px solid var(--sun-deep, #f0a500); outline-offset: 2px; }
.meadow-house .meadow-house-signwrap {
  position: absolute; left: 70%; bottom: -22%; width: 60%; display: block;
  filter: drop-shadow(0 3px 4px rgba(92, 64, 30, .3));
}
.meadow-house .meadow-house-signwrap .meadow-house-sign { position: static; width: 100% !important; height: auto; display: block; filter: none; }
/* 소품 자리도 새 그림에 맞춘다: 새는 집 굴뚝 위, 오리는 연못, '우리 동네' 팻말은 놀이터 오른쪽 언덕 앞 */
.home-stage > .meadow-bird { left: calc(var(--ml) + var(--mw) * .07); top: calc(var(--mt) + var(--mh) * .12); width: calc(var(--mw) * .05); }
.home-stage > .meadow-duck { left: calc(var(--ml) + var(--mw) * .785); top: calc(var(--mt) + var(--mh) * .7); width: calc(var(--mw) * .055); }
.home-stage > .meadow-sign-town { left: calc(var(--ml) + var(--mw) * .705); top: calc(var(--mt) + var(--mh) * .2); width: calc(var(--mw) * .1); }
