/* B STUDIO — 삐(B) 마스코트 위젯
   stage-1-2 위젯의 디자인을 그대로 옮기고, 모든 값을 --b-* 변수로 분리했습니다.
   어느 화면에 붙여도 호스트 페이지 스타일과 충돌하지 않도록 .b-mascot 아래로만 범위를 제한합니다. */

.b-mascot{
  --b-ink:#332d29; --b-canvas:#fffdf9; --b-line:#ded3c4; --b-brown:#65483a; --b-muted:#7e746b;
  --b-shadow:0 14px 34px rgba(75,55,39,.16);
  --b-sans:Pretendard,Arial,sans-serif;
  --b-size:122px; --b-size-collapsed:56px; --b-offset:24px;
  position:fixed; right:var(--b-offset); bottom:var(--b-offset); z-index:9000;
  display:flex; align-items:flex-end; gap:8px;
  font-family:var(--b-sans); color:var(--b-ink); letter-spacing:-.02em;
}
.b-mascot *, .b-mascot *::before, .b-mascot *::after{ box-sizing:border-box }

/* 말풍선 */
.b-mascot__dialog{
  width:236px; background:var(--b-canvas); border:1px solid var(--b-line); box-shadow:var(--b-shadow);
  padding:16px; border-radius:16px 16px 4px 16px;
  opacity:0; pointer-events:none; transform:translateY(9px);
  transition:opacity .22s ease, transform .22s ease;
}
.b-mascot.is-open .b-mascot__dialog{ opacity:1; pointer-events:auto; transform:translateY(0) }
.b-mascot__message{ font-size:12px; line-height:1.6; margin:0; padding-right:14px }
.b-mascot__label{ display:block; margin-top:8px; color:var(--b-muted); font-size:10px }
.b-mascot__close{
  float:right; border:0; background:none; color:var(--b-muted);
  font-size:16px; line-height:12px; cursor:pointer; padding:2px;
}

/* 캐릭터 버튼 — 정사각 상자 + 하단 정렬로 상태별 원본 캔버스 크기 차이를 흡수 */
.b-mascot__body{ position:relative }
.b-mascot__cat{
  display:block; width:var(--b-size); height:var(--b-size);
  border:0; background:transparent; padding:0; cursor:pointer;
  filter:drop-shadow(0 9px 10px rgba(75,55,39,.18));
  transition:transform .2s ease, width .2s ease, height .2s ease;
}
.b-mascot__cat:hover{ transform:translateY(-3px) rotate(-1deg) }
.b-mascot__cat img{
  width:100%; height:100%; object-fit:contain; object-position:50% 100%;
  transform:scale(var(--b-state-scale,1)); transform-origin:50% 100%;
  animation:b-mascot-idle 4.5s ease-in-out infinite;
  transition:opacity .18s ease;
}
.b-mascot__cat img.is-swapping{ opacity:0 }

.b-mascot__minimise{
  position:absolute; right:-4px; top:-6px; width:24px; height:24px; border-radius:50%;
  border:1px solid var(--b-line); background:var(--b-canvas); color:var(--b-brown);
  cursor:pointer; font-size:15px; line-height:1; z-index:1;
}

.b-mascot__close:focus-visible,
.b-mascot__cat:focus-visible,
.b-mascot__minimise:focus-visible{ outline:2px solid var(--b-brown); outline-offset:3px }

/* 접힘 */
.b-mascot.is-collapsed{ right:18px; bottom:18px }
.b-mascot.is-collapsed .b-mascot__dialog,
.b-mascot.is-collapsed .b-mascot__minimise{ display:none }
.b-mascot.is-collapsed .b-mascot__cat{ width:var(--b-size-collapsed); height:var(--b-size-collapsed) }

@keyframes b-mascot-idle{ 0%,100%{ translate:0 0 } 50%{ translate:0 -2px } }

@media (prefers-reduced-motion:reduce){
  .b-mascot *, .b-mascot *::before, .b-mascot *::after{
    animation-duration:.01ms !important; transition-duration:.01ms !important;
  }
}

@media (max-width:680px){
  .b-mascot{ --b-size:76px; --b-offset:12px }
  .b-mascot.is-open .b-mascot__dialog{ position:absolute; right:3px; bottom:calc(var(--b-size) + 6px); width:220px }
}
