/* a-me — 「내가 주인공」(2026-12-01). js/a-me.js 가 그리는 무대 하나만 꾸민다.
   상영관 컨셉(a-recap.css 와 같은 결): 먹색 무대 한 덩어리(.me), 색은 먹색 단계(--night · --night-2 · --night-3)와 불빛(--lamp) 하나.
   무대(.me-stage) = 영상 + 바로 아래 대사 띠(.me-sub: 안내 · 말하는 사람 · 영어) + 불빛 단추 줄(.me-act).
     자막은 영상 위에 얹지 않는다(얼굴이 가리지 않게). 영상 위에는 내 차례일 때만 작은 '내 차례' 표 하나와 불빛 테두리.
   옆(.me-side) = 고르기(누가 될까요?) · 진행(내 줄 몇 번째) · 끝(내 줄마다 점수) 셋 중 하나.
   진한 단추는 불빛 동그라미(.btn-hero) 하나 — 끝나면 .me-quiet 로 테두리만 남겨 again.js 의 '다음 단계'에 자리를 넘긴다.
   글자 3단: ① 무대 제목(고운바탕 30px · 휴대폰 24px) ② 대사 영어(18~24px) ③ 안내·목록(16px). 누르는 곳은 모두 44px 이상.
   간격은 8의 배수. 움직임은 이즈 아웃 0.4초 하나(--motion-t · --motion-e)와 말할 시간 막대, 움직임 줄이기를 켜면 끈다. */

.me { --me-line: var(--night-line); max-width: var(--stage-w); margin: 0 auto; padding: 32px; border-radius: 24px; background: var(--night); color: var(--on-night); font-family: var(--font-ko); }
.me :focus-visible { outline: 2px solid var(--lamp); outline-offset: 3px; }
.me .en { font-family: var(--font-en); }
.me-loading { min-height: 240px; display: grid; place-items: center; }
.me-wait { margin: 0; font-size: 16px; line-height: 1.5; color: var(--on-night-sub); text-align: center; }
.me .i { flex: none; }

/* 머리 */
.me-head { margin: 0 0 24px; padding: 0 0 24px; border-bottom: 1px solid var(--me-line); }
.me-k { margin: 0; font-size: 16px; font-weight: 500; line-height: 1.5; color: var(--lamp); }
.me-t { margin: 8px 0 0; font-family: var(--font-title); font-size: 30px; font-weight: 400; line-height: 1.3; letter-spacing: var(--title-track, -.01em);
  -webkit-text-stroke: var(--title-stroke, 0) currentColor; paint-order: stroke fill; color: var(--on-night); }
.me-meta { margin: 8px 0 0; font-size: 16px; line-height: 1.6; color: var(--on-night-sub); }

.me-main { display: grid; gap: 24px; }
.me-stage { min-width: 0; }
.me-side { min-width: 0; }

/* 영상: 위만 둥글게, 아래로 대사 띠. 내 차례면 불빛 테두리 + 작은 표 */
.me-frame { position: relative; margin: 0; overflow: hidden; border-radius: 12px 12px 0 0; background: var(--night-2); }
.me-frame video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--night-2); }
/* 내 차례 움직임(a-me.js breathOn · levelOn): 영상 층(.me-zoom)은 transform 으로만 아주 느리게 다가가고,
   그 위 같은 영상(.me-loop)은 투명도로만 나타났다 사라진다. 고리(.me-lv)는 녹음 중 소리 크기에 맞춰 크기 · 투명도만 바뀐다 */
.me-zoom { position: relative; transform-origin: 50% 40%; will-change: transform; }
.me-frame video.me-loop { position: absolute; inset: 0; height: 100%; opacity: 0; pointer-events: none; transition: opacity .4s var(--motion-e); }
.me-frame video.me-loop.on { opacity: 1; }
.me-snap { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.me-snap.on { opacity: 1; }
.me-snap.fade { transition: opacity .45s var(--motion-e); }
.me-act .hero-act { position: relative; }
.me-lv { position: absolute; left: -10px; top: 50%; width: 96px; height: 96px; margin-top: -48px; border: 2px solid var(--rec); border-radius: 50%; opacity: 0; pointer-events: none;
  will-change: transform, opacity; }
.me-lv:not(.on) { display: none; }
.me .btn-hero.rec.on.lv { animation: none; } /* 고리가 소리 크기를 보여 주는 동안 단추 자체의 맥박은 쉰다 */
.me-frame::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255, 244, 228, .07); pointer-events: none;
  transition: box-shadow var(--motion-t) var(--motion-e); }
.me.my-turn .me-frame::after { box-shadow: inset 0 0 0 3px var(--lamp); }
/* '내 차례' 표는 영상 아래 왼쪽(얼굴 · 머리는 위쪽에 있어 가리지 않게) */
.me-tag { position: absolute; bottom: 12px; left: 12px; display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 6px 14px 6px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--night) 82%, transparent); color: var(--lamp); font-size: 16px; font-weight: 500; line-height: 1.3; }
.me-tag .i { width: 18px; height: 18px; }
.me-tag b { font-weight: 600; color: var(--on-night); }
.me-tag[hidden] { display: none; }

/* 대사 띠: 안내 한 줄 + (말하는 사람 · 영어) + 말할 시간 막대 + 점수 */
.me-sub { position: relative; margin: 0; padding: 12px 24px 16px; border: 1.5px solid transparent; border-top: 0; border-radius: 0 0 12px 12px; background: var(--night-2); text-align: center;
  transition: border-color var(--motion-t) var(--motion-e); }
.me.running .me-sub, .me[data-phase="play"] .me-sub { min-height: 132px; }
.me.my-turn .me-sub { border-style: dashed; border-color: var(--lamp); }
.me-cue { margin: 0; font-size: 16px; line-height: 1.5; color: var(--on-night-sub); }
.me-cue:empty { display: none; }
.me-cue[data-m="say"], .me-cue[data-m="end"] { color: var(--lamp); }
.me-line { margin: 8px 0 0; font-size: clamp(1.125rem, 1.7vw, 1.5rem); font-weight: 500; line-height: 1.4; color: var(--on-night); }
.me-sub:not(.show) .me-line { display: none; }
.me-who { margin-right: .45em; font-size: .8em; font-weight: 600; color: var(--lamp); }
.me-who:empty { display: none; }
.me-en .w { --rest: var(--on-night); --fill: var(--lamp); }
/* 힌트 가림: 낱말 길이만 점선 빈칸으로(첫 모습), '힌트 보기'를 누르면 글자가 보인다 */
.me-en.veil .w { color: transparent; border-bottom: 3px solid color-mix(in srgb, var(--on-night) 30%, transparent); border-radius: 2px; user-select: none; transition: none; }
.me-en.veil { word-spacing: .25em; }
.me-meter { display: block; width: min(320px, 70%); height: 4px; margin: 12px auto 0; overflow: hidden; border-radius: 999px; background: var(--night-3); }
.me-meter[hidden] { display: none; }
.me-meter i { display: block; width: 100%; height: 100%; background: var(--lamp); transform: scaleX(0); transform-origin: left center; }
.me-meter.run i { animation: me-fill var(--sec, 4s) linear forwards; }
@keyframes me-fill { to { transform: scaleX(1); } }
.me-score { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 4px 12px; margin: 8px 0 0; font-size: 16px; line-height: 1.4; color: var(--on-night-sub); }
.me-score[hidden] { display: none; }
.me-score-v { font-size: 32px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--on-night); }
.me-score-v small { margin-left: 2px; font-size: 16px; font-weight: 500; }
.me-score[data-m="good"] .me-score-t, .me-score[data-m="good"] .me-score-v { color: var(--lamp); }
.me-score-t { color: var(--on-night); }

/* 불빛 단추 줄: 동그라미와 이름표, 내 차례면 오른쪽에 힌트 · 건너뛰고 듣기 */
.me-act { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 16px 0 0; }
.me-act .hero-act { flex-direction: row; gap: 16px; margin-left: 6px; }
.me-go-lab { font-size: 16px; font-weight: 500; line-height: 1.3; color: var(--on-night); cursor: pointer; }
.me .btn-hero:focus-visible { outline-color: var(--lamp); }
.me .btn-hero.me-quiet { background: transparent; color: var(--lamp); box-shadow: inset 0 0 0 1.5px var(--lamp); outline: 0; }
.me .btn-hero.me-quiet:hover { background: color-mix(in srgb, var(--lamp) 10%, transparent); }
/* 채점 중 · 이어 가는 중: 누를 수 없음을 모양으로(불빛을 낮추고 점 세 개) */
.me .btn-hero.me-busy, .me .btn-hero.me-busy:hover { background: var(--night-3); color: var(--lamp); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--lamp) 45%, transparent); cursor: default; animation: none; }
.me .btn-hero.me-busy .i circle { fill: currentColor; }
.me-go-lab.me-busy { color: var(--on-night-sub); cursor: default; }
.me-tools { justify-content: flex-end; }
.me-tools[hidden] { display: none; }
.me-tools > button { min-height: 44px; font-size: 16px; }
.me-tools > button:disabled { opacity: 1; color: var(--lamp); cursor: default; }

/* 옆: 고르기 */
.me-ask { margin: 0 0 12px; font-size: 16px; font-weight: 500; line-height: 1.5; color: var(--on-night); }
.me-roles { display: grid; gap: 8px; }
.me-role { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 16px; width: 100%; min-height: 72px; margin: 0; padding: 8px 16px 8px 8px;
  border: 1.5px solid var(--me-line); border-radius: 16px; background: transparent; color: var(--on-night); font: inherit; text-align: left; cursor: pointer;
  transition: border-color var(--motion-t) var(--motion-e), background-color var(--motion-t) var(--motion-e); }
.me-role:hover { background: var(--night-2); }
.me-role[aria-pressed="true"] { border-color: var(--lamp); background: var(--night-2); }
.me-role img { display: block; width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--night-3); }
.me-role-tx { display: flex; flex-direction: column; min-width: 0; }
.me-role-n { font-size: 18px; font-weight: 500; line-height: 1.35; }
.me-role-c { font-size: 16px; line-height: 1.4; color: var(--on-night-sub); }
.me-role[aria-pressed="true"] .me-role-c { color: var(--lamp); }
.me-role-st .i { width: 20px; height: 20px; color: var(--lamp); }
.me-role-was { font-size: 16px; line-height: 1.4; color: var(--lamp); }
.me-role-was:empty { display: none; }

/* 옆: 진행 */
.me-prog-k { display: flex; justify-content: space-between; gap: 8px 16px; margin: 0; font-size: 16px; line-height: 1.5; color: var(--on-night-sub); }
.me-prog-who { font-weight: 500; color: var(--lamp); }
.me-prog-n { font-variant-numeric: tabular-nums; }
.me-dots { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.me-dots li { width: 28px; height: 6px; border-radius: 999px; background: var(--night-3); transition: background-color var(--motion-t) var(--motion-e); }
.me-dots li.now { background: color-mix(in srgb, var(--lamp) 45%, var(--night-3)); }
.me-dots li.done { background: var(--lamp); }
.me-dots li.skip { background: var(--on-night-dim); }

/* 옆: 끝 — 내 줄마다 점수 */
.me-end-k { margin: 0; font-size: 16px; font-weight: 500; line-height: 1.5; color: var(--lamp); }
.me-avg { margin: 4px 0 16px; font-size: 16px; line-height: 1.5; color: var(--on-night-sub); }
.me-avg b { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--on-night); }
.me-res { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.me-res li { display: grid; grid-template-columns: minmax(0, 1fr); padding: 4px; border-radius: 12px; background: var(--night-2); }
.me-res-sum { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; min-height: 56px; margin: 0; padding: 8px 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--on-night); font: inherit; text-align: left; cursor: pointer; }
.me-res-sum:disabled { cursor: default; }
.me-res-sum:not(:disabled):hover { background: var(--night-3); }
.me-res-sum > .i { grid-column: 3; grid-row: 1 / span 2; align-self: center; justify-self: end; width: 18px; height: 18px; color: var(--on-night-sub); transition: transform var(--motion-t) var(--motion-e); }
.me-res-sum[aria-expanded="true"] > .i { transform: rotate(180deg); }
.me-res-no { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--me-line); border-radius: 50%; font-size: 16px; font-variant-numeric: tabular-nums; color: var(--on-night-sub); }
.me-res-en { font-size: 18px; font-weight: 500; line-height: 1.4; }
.me-res-st { grid-column: 2; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; font-size: 16px; line-height: 1.4; color: var(--on-night-sub); }
.me-res-v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--on-night); }
.me-res-v small { font-size: 16px; font-weight: 500; }
.me-res li[data-st="ok"] .me-res-t { color: var(--on-night); }
.me-res-h { padding-left: 8px; border-left: 1px solid var(--me-line); }
.me-res-play { justify-self: start; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 0 0 4px 40px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent;
  color: var(--on-night-sub); font: inherit; font-size: 16px; cursor: pointer; }
.me-res-play:hover { background: var(--night-3); color: var(--on-night); }
.me-res-play .i { width: 16px; height: 16px; }
.me-res-play .i path { fill: currentColor; }
.me-res-out { grid-column: 1 / -1; min-width: 0; padding: 0 8px 8px; }
.me-res-out[hidden] { display: none; }
/* 펼친 점수(web/shared/pron.js 결과): 옆 칸이 좁아 네 칸 한 줄이면 숫자 · 글자가 세로로 쪼개진다 —
   종합은 한 줄을 다 쓰고, 나머지 셋은 '이름 · 점수 · 막대 · 등급'을 가로 한 줄씩. 숫자는 절대 끊지 않는다 */
.me-res-out .pron { padding: 16px; }
.me-res-out .pron-scores { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.me-res-out .pron-score { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 4px 12px; padding: 12px 14px; }
.me-res-out .pron-score > * { min-width: 0; }
.me-res-out .pron-score-num { grid-column: 2; grid-row: 1; white-space: nowrap; font-size: 26px; }
.me-res-out .pron-score-label { grid-column: 1; grid-row: 1; }
.me-res-out .pron-meter { grid-column: 1 / -1; }
.me-res-out .pron-score-tier { grid-column: 1; }
.me-res-out .pron-score-hint { grid-column: 1 / -1; display: block; }
.me-res-out .pron-score--main .pron-score-num { font-size: 36px; }
.me-res-out .pron-score:not(.pron-score--main) .pron-score-hint { display: none; }
.me-res-out .pron-score:not(.pron-score--main) .pron-score-num { font-size: 22px; }
.me-end-act { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 24px; }
.me-end-act .btn { min-height: 48px; }
.me-end-act .quietbar { justify-content: flex-start; margin-left: -12px; }

/* 넓은 화면: 왼쪽 무대, 오른쪽 고르기 · 진행 · 점수 */
@media (min-width: 1024px) {
  .me-main { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); column-gap: 32px; align-items: start; }
  .me-side { position: sticky; top: 16px; }
}
/* 휴대폰·태블릿: 진행 중이면 무대가 위에 붙는다(영상 · 대사 띠 · 단추가 한 화면). 키가 낮은 가로 화면에서는 붙이지 않는다 */
@media (max-width: 1023px) {
  .me { padding: 24px; }
}
@media (max-width: 1023px) and (min-height: 560px) {
  .me.running .me-stage { position: sticky; top: 0; z-index: 3; background: var(--night); box-shadow: 0 1px 0 var(--me-line); }
}
/* 휴대폰: 위 띠에 바로 붙고 영상은 화면 끝까지 */
@media (max-width: 560px) {
  .me { margin: -16px -16px 0; padding: 16px 16px 24px; border-radius: 0 0 20px 20px; }
  .me-head { margin-bottom: 16px; padding-bottom: 16px; }
  .me-t { margin-top: 4px; font-size: 24px; }
  .me-meta { display: none; }
  .me-stage { margin: 0 -16px; padding-bottom: 8px; }
  .me-frame { border-radius: 0; }
  .me-sub { padding: 8px 16px 12px; border-radius: 0; }
  .me.running .me-sub, .me[data-phase="play"] .me-sub { min-height: 120px; }
  .me-act { padding: 12px 16px 0; }
  .me-act .hero-act { gap: 12px; margin-left: 0; }
  .me-tools { justify-content: flex-start; flex: 1 1 100%; margin-left: -8px; }
  .me-tag { bottom: 8px; left: 8px; padding: 4px 12px 4px 8px; }
  .me-lv { width: 88px; height: 88px; margin-top: -44px; }
}
@media (prefers-reduced-motion: reduce) {
  .me-frame::after, .me-sub, .me-role, .me-dots li, .me-res-sum > .i { transition: none; }
  .me-meter.run i { animation: none; transform: scaleX(1); }
  .me .btn-hero { transition: none; animation: none; }
  .me-zoom { transform: none !important; }
  .me-frame video.me-loop, .me-snap, .me-lv { display: none; }
}

/* 위 단계 띠: '내가 주인공'이 붙어 단계가 8개 이상인 날(어제 장면 보기 · 다른 상황에서도가 함께 있는 날)은 1280 이상에서도
   한 줄에 다 들어가지 않아 제목이 세로로 눌린다 — 그런 날만 1280 미만과 같이 단계 띠를 제목 아래 한 줄로 내린다(a-shared.css 의 규칙과 같은 값) */
@media (min-width: 1280px) {
  .bar-in:has(.steps > li:nth-child(8)) { grid-template-columns: auto minmax(0, 1fr); row-gap: 4px; padding-bottom: 8px; }
  .bar-in:has(.steps > li:nth-child(8)) .steps { grid-column: 1 / -1; flex-wrap: wrap; margin-left: -6px; }
}
/* 860~1279: 단계 띠가 제목 아래 한 줄을 다 쓰는 폭. 8개 이상인 날은 칸 사이 여백만 줄여(글자 16px · 누르는 높이 44px 그대로) 한 줄에 들어가게 */
@media (min-width: 860px) {
  .bar-in:has(.steps > li:nth-child(8)) .steps a { gap: 6px; padding: 0 8px 0 2px; }
}
/* 860~1099 에서 8개 이상: 이름까지 다 넣으면 두 줄이 된다 — 휴대폰처럼 지금 단계만 이름을 보이고 나머지는 번호 동그라미만(이름은 화면 읽기용으로 남김) */
@media (min-width: 860px) and (max-width: 1099px) {
  .bar-in:has(.steps > li:nth-child(8)) .steps li:not(.on) .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .bar-in:has(.steps > li:nth-child(8)) .steps li:not(.on) a { justify-content: center; min-width: 44px; padding: 0 9px; }
}
