/* 「동영이」 플로팅 상담 버튼 + 대화 창 (js/dongyeong-bot.js) */
.dy-bot {
  --dy-blue: var(--blue, #697deb);
  --dy-ink: var(--ink, #111413);
  position: fixed;
  right: 24px;
  bottom: calc(24px + var(--dy-lift, 0px));
  z-index: 1200;
  font-family: inherit;
  transition: bottom 0.2s ease;
}

/* ---------- 버튼 ---------- */
.dy-fab {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 64px;
  padding: 0 20px 0 8px;
  border: 0;
  border-radius: 999px;
  background: var(--dy-ink);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(17, 20, 19, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.dy-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(17, 20, 19, 0.34);
}
.dy-fab:focus-visible {
  outline: 3px solid var(--lime, #baf20f);
  outline-offset: 3px;
}
.dy-fab-face {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
}
.dy-fab-face svg {
  width: 40px;
  height: 40px;
  animation: dy-bob 2.8s ease-in-out infinite;
}
.dy-bot .dy-eye {
  transform-origin: center;
  transform-box: fill-box;
  animation: dy-blink 4.5s infinite;
}
.dy-bot.is-open .dy-fab-label::before {
  content: '닫기 · ';
  font-weight: 500;
  opacity: 0.7;
}

@keyframes dy-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
@keyframes dy-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.1); }
}

/* ---------- 말풍선 ---------- */
/* 버튼 바로 위엔 「맨 위로」(bottom +80px · 높이 48) — 그보다 위에 띄워야 가리지 않는다. */
.dy-teaser {
  position: absolute;
  right: 0;
  bottom: 136px;
  width: 248px;
  padding: 14px 32px 14px 16px;
  border-radius: 16px 16px 4px 16px;
  background: #fff;
  color: var(--dy-ink);
  box-shadow: 0 10px 30px rgba(17, 20, 19, 0.16);
  font-size: 14px;
  line-height: 1.45;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.dy-teaser.is-on {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
/* 메인 히어로가 화면 아래를 덮는 동안은 숨김 — 내려가면 다시 뜬다(js 의 dy-on-hero). */
.dy-bot.dy-on-hero .dy-teaser {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}
.dy-teaser strong {
  display: block;
  margin-bottom: 2px;
}
.dy-teaser span {
  color: var(--body, #676d69);
  font-size: 13px;
}
.dy-teaser-close {
  position: absolute;
  top: 6px;
  right: 8px;
  border: 0;
  background: none;
  color: var(--muted, #898e8b);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- 대화 창 ---------- */
.dy-panel {
  position: absolute;
  right: 0;
  bottom: 80px;
  width: 400px;
  height: min(680px, calc(100dvh - 120px - var(--dy-lift, 0px)));
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 20px 60px rgba(17, 20, 19, 0.28);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.dy-panel[hidden] {
  display: none;
}
.dy-bot.is-open .dy-panel {
  opacity: 1;
  transform: none;
}
.dy-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  background: var(--dy-blue);
  color: #fff;
}
.dy-panel-face {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  flex: none;
}
.dy-panel-face svg {
  width: 32px;
  height: 32px;
}
.dy-panel-title {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  flex: 1;
}
.dy-panel-title small {
  font-size: 12px;
  opacity: 0.85;
}
.dy-panel-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.dy-panel-close svg {
  width: 18px;
  height: 18px;
}
.dy-panel-body {
  flex: 1;
  position: relative;
  background: var(--soft, #f5f7f5);
}
.dy-panel-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.dy-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted, #898e8b);
  font-size: 14px;
}

/* ---------- 모바일 ---------- */
@media (max-width: 760px) {
  .dy-bot {
    right: 16px;
    bottom: 16px;
  }
  .dy-fab {
    height: 58px;
    padding: 0 6px;
  }
  .dy-fab-label {
    display: none;
  }
  .dy-fab-face {
    width: 46px;
    height: 46px;
  }
  .dy-teaser {
    bottom: 122px;
  }
  /* 폰에선 전체 화면 시트 — 입력칸이 작으면 견적 폼을 못 쓴다. */
  .dy-bot.is-open {
    inset: 0;
    right: 0;
    bottom: 0;
  }
  .dy-bot.is-open .dy-fab {
    display: none;
  }
  .dy-panel {
    position: fixed;
    inset: 0;
    width: auto;
    height: 100dvh;
    border-radius: 0;
  }
  html.dy-lock,
  html.dy-lock body {
    overflow: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dy-fab-face svg,
  .dy-bot .dy-eye {
    animation: none;
  }
  .dy-panel,
  .dy-teaser,
  .dy-fab {
    transition: none;
  }
}

/* 「맨 위로」(common.css .back-to-top) 와 같은 모서리 — 동영이 위로 올린다. */
.back-to-top {
  bottom: calc(max(24px, env(safe-area-inset-bottom)) + 80px + var(--dy-lift, 0px));
  transition: background-color 0.2s ease, color 0.2s ease, bottom 0.2s ease;
}
@media (max-width: 760px) {
  .back-to-top {
    bottom: calc(max(16px, env(safe-area-inset-bottom)) + 70px);
  }
}
