/* 아이메이드 스튜디오 v4.4 - 소리 버튼, 도트 강아지(Pup), 길잡이 말풍선(Coach), 부모 차례 카드, 음성 입력 안내 */

/* ---------- 1. 위쪽 막대 소리 켜기/끄기 버튼 ---------- */
.sound-btn{
  width:34px;height:34px;flex:none;border-radius:50%;
  display:grid;place-items:center;
  background:var(--panel);border:1px solid var(--line);color:var(--ink2);
  transition:color .15s,background .15s,border-color .15s;
}
.sound-btn:hover{color:var(--ink);background:var(--panel2)}
.sound-btn .ico{width:17px;height:17px}
.sound-btn.off{color:var(--ink3);background:var(--bg2);border-style:dashed}
[data-age="junior"] .sound-btn{width:38px;height:38px}

/* ---------- 3. 도트 강아지 (Pup) ---------- */
.pup{
  --pup:96px;--pup-row:0;
  display:inline-block;width:var(--pup);height:var(--pup);flex:none;
  background-image:url('../img/pup_sheet.webp');
  background-repeat:no-repeat;
  background-size:calc(var(--pup) * 4) calc(var(--pup) * 8);
  background-position:0 calc(var(--pup) * var(--pup-row) * -1);
  image-rendering:pixelated;
  animation:pupFrames .7s steps(4) infinite;
  vertical-align:middle;
}
.pup[data-pup="idle"]{--pup-row:0}
.pup[data-pup="talk"]{--pup-row:1}
.pup[data-pup="think"]{--pup-row:2}
.pup[data-pup="draw"]{--pup-row:3}
.pup[data-pup="fix"]{--pup-row:4}
.pup[data-pup="cheer"]{--pup-row:5}
.pup[data-pup="oops"]{--pup-row:6}
.pup[data-pup="sleep"]{--pup-row:7}

@keyframes pupFrames{
  from{background-position:0 calc(var(--pup) * var(--pup-row) * -1)}
  to{background-position:calc(var(--pup) * -4) calc(var(--pup) * var(--pup-row) * -1)}
}

/* 시트 로드 전 초기 상태에서도 첫 프레임을 고정 표시 (옛 로봇 그림 미사용) */
html.no-pup-sheet .pup{
  animation:none !important;
}

/* 홈·작품함·숙제·보호자·다른 체험 화면의 Pup 배치 */
.setup-cta>.pup,.daily>.pup,.qbubble>.pup,.talk-done-top>.pup,.talk-q-bubble>.pup{flex:none}
.charc-pup{width:100%;aspect-ratio:1;border-radius:10px;margin-bottom:6px;background:var(--bg2);display:grid;place-items:center;overflow:hidden}
.done>.pup{display:block;margin:0 auto 6px}
.det-stage>.pup{justify-self:center}
.dev-pup-host{width:44px;height:44px;border-radius:12px;background:#fff;display:inline-grid;place-items:center;flex:none;overflow:hidden}

/* 도담 대화창·버튼·말풍선·토스트의 Pup 정렬 */
.bd-h .pup{--pup:44px}
.bd-face .pup{--pup:112px}
.bd-fab .pup{--pup:42px}
.bd-bubble .pup{--pup:36px}
.bd-bubble{max-width:min(360px,calc(100vw - 32px))}
.toast-pic{display:inline-flex;align-items:center;justify-content:center;flex:none}
.toast-pic[hidden]{display:none !important}
.toast-pic img{width:38px;height:38px}
.toast-pic .pup{--pup:38px}

/* ---------- 4. 길잡이 말풍선 (Coach) ---------- */
.coach-ring{
  position:fixed;z-index:48;pointer-events:none;
  border:3px solid var(--amber);
  box-shadow:0 0 0 4px rgba(245,185,66,.26),0 0 22px rgba(245,185,66,.55);
  animation:coachGlow 1.3s ease-in-out infinite;
}
@keyframes coachGlow{
  50%{box-shadow:0 0 0 8px rgba(245,185,66,.12),0 0 30px rgba(245,185,66,.78)}
}
.coach-tip{
  position:fixed;z-index:49;pointer-events:none;
  display:flex;align-items:center;gap:8px;
  max-width:min(340px,calc(100vw - 20px));
  animation:coachPop .25s ease-out;
}
.coach-tip[data-side="left"]{flex-direction:row-reverse}
@keyframes coachPop{
  from{opacity:0;transform:translateY(6px) scale(.95)}
  to{opacity:1;transform:none}
}
.coach-bubble{
  padding:10px 14px;border-radius:16px;
  background:var(--panel);color:var(--ink);
  border:2px solid var(--amber);
  box-shadow:var(--shadow);
  font-weight:700;font-size:15px;line-height:1.4;
  word-break:keep-all;
}
[data-age="junior"] .coach-bubble{font-size:17px;padding:11px 16px}
.coach-arrow{flex:none;width:30px;height:30px;border-radius:50%;background:var(--teal,#1f8a8a);position:relative;box-shadow:0 2px 6px rgba(0,0,0,.18)}
.coach-arrow::before{content:"";position:absolute;left:8px;top:14px;width:13px;height:3px;border-radius:2px;background:#fff}
.coach-arrow::after{content:"";position:absolute;left:14px;top:9px;width:9px;height:9px;border-top:3px solid #fff;border-right:3px solid #fff;transform:rotate(45deg);box-sizing:border-box}

body.present-mode .coach-ring,
body.present-mode .coach-tip,
body.talk-live-mode .coach-ring,
body.talk-live-mode .coach-tip{display:none !important}

/* ---------- 5. 부모님 차례 카드 보강 ---------- */
.ptn>.pup{--pup:48px}
.ptn-head{display:grid;gap:3px;justify-items:start;flex:none}
.ptn-sub{font-size:11.5px;font-weight:700;color:var(--ink2);line-height:1.3;white-space:nowrap}
[data-age="junior"] .ptn-sub{font-size:12.5px}
@media (max-width:860px){
  .ptn-sub{white-space:normal}
}

/* ---------- 6. 음성 입력 진행 안내 ---------- */
.mic-live{
  display:block;margin-top:4px;
  font-size:12.5px;font-weight:700;color:var(--coral);
  line-height:1.35;
}
[data-age="junior"] .mic-live{font-size:14px}
.bd-in:has(.mic-live){flex-wrap:wrap}
.bd-in>.mic-live{flex-basis:100%;margin-top:2px}

@media print{
  .sound-btn,.coach-ring,.coach-tip,.mic-live{display:none !important}
}
