/* 혜택이 AI 챗봇 위젯 (회원 사이트 전 화면 오른쪽 아래) — 회원 화면 컨셉: 남색 2px 테두리 · 각진 그림자 · 노랑 버튼
   상담 화면은 /ai?embed=1 을 창 안에 띄운다. z-index: 하단 탭(200)보다 위, 요금제·설문 모달(380~500)보다 아래 */
.htw-fab, .htw-panel, .htw-tip { font-family: Pretendard, "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; box-sizing: border-box; color: #0b1223; }
.htw-fab *, .htw-panel *, .htw-tip * { box-sizing: border-box; }

.htw-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 300;
  display: inline-flex; align-items: center; gap: 6px; height: 64px; padding: 0 16px 0 4px;
  border: 2px solid #0b1223; border-radius: 0; background: #ffdc27; cursor: pointer;
  font-size: 15px; font-weight: 900; letter-spacing: -.02em;
  box-shadow: 4px 4px 0 #0b1223;
  transition: transform .08s, box-shadow .08s, bottom .2s ease;
}
.htw-fab:hover { background: #ffe761; }
.htw-fab:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 #0b1223; }
.htw-fab:focus-visible { outline: 3px solid #0754ff; outline-offset: 3px; }
/* 혜택이는 테두리 안에 다 들어오게 (머리 볏이 위쪽 테두리를 넘지 않게) */
.htw-fab img { width: 50px; height: 50px; object-fit: contain; flex: 0 0 auto; transition: transform .2s; transform-origin: 50% 90%; }
.htw-fab:hover img { transform: rotate(-6deg); }
.htw-fab[aria-expanded="true"] { background: #fff; }
.htw-fab[aria-expanded="true"] .htw-label { font-size: 0; }
.htw-fab[aria-expanded="true"] .htw-label::after { content: '닫기'; font-size: 15px; }
/* 상세 서랍의 하단 버튼 줄이 열려 있으면 그 위로 */
body:has(.n5x-dr-bar) .htw-fab { bottom: 96px; }

.htw-tip {
  position: fixed; right: 24px; bottom: 102px; z-index: 300; max-width: 270px;
  padding: 12px 38px 12px 14px; background: #fff; border: 2px solid #0b1223;
  box-shadow: 3px 3px 0 #0b1223; font-size: 14px; line-height: 1.5;
}
.htw-tip::after { content: ''; position: absolute; right: 38px; bottom: -9px; width: 14px; height: 14px; background: #fff; border-right: 2px solid #0b1223; border-bottom: 2px solid #0b1223; transform: rotate(45deg); }
.htw-tip b { background: #ffdc27; padding: 0 3px; }
.htw-tip button { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border: 0; background: none; color: #0b1223; cursor: pointer; font-size: 18px; font-weight: 900; }
body:has(.n5x-dr-bar) .htw-tip { bottom: 174px; }

.htw-panel {
  position: fixed; right: 24px; bottom: 104px; z-index: 300;
  width: 400px; height: min(680px, calc(100vh - 136px)); display: flex; flex-direction: column;
  overflow: hidden; background: #f7faff; border: 2px solid #0b1223; box-shadow: 6px 6px 0 #0b1223;
}
.htw-panel[hidden], .htw-tip[hidden] { display: none !important; }
body:has(.n5x-dr-bar) .htw-panel { bottom: 176px; height: min(640px, calc(100vh - 208px)); }
.htw-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 10px; background: #ffdc27; border-bottom: 2px solid #0b1223; }
.htw-head .htw-face { width: 42px; height: 42px; flex: 0 0 auto; border: 2px solid #0b1223; border-radius: 50%; background: #fff8d6; overflow: hidden; }
.htw-head .htw-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.htw-title { flex: 1; min-width: 0; font-size: 16px; font-weight: 900; line-height: 1.25; }
.htw-title small { display: block; font-size: 12px; font-weight: 600; color: #2b3650; }
.htw-head a, .htw-head button { min-width: 44px; height: 38px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border: 2px solid #0b1223; background: #fff; color: #0b1223; font-size: 13px; font-weight: 900; text-decoration: none; cursor: pointer; box-shadow: 2px 2px 0 #0b1223; }
.htw-head a:active, .htw-head button:active { transform: translate(2px, 2px); box-shadow: none; }
.htw-frame { flex: 1; width: 100%; border: 0; background: #f7faff; }

@media (max-width: 767px) {
  .htw-fab { right: 14px; bottom: calc(78px + env(safe-area-inset-bottom)); height: 58px; width: 58px; padding: 0; justify-content: center; }
  .htw-fab img { width: 46px; height: 46px; }
  .htw-fab .htw-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  body:has(.n5x-dr-bar) .htw-fab { bottom: calc(150px + env(safe-area-inset-bottom)); }
  .htw-tip { right: 14px; bottom: calc(148px + env(safe-area-inset-bottom)); }
  .htw-tip::after { right: 20px; }
  .htw-panel, body:has(.n5x-dr-bar) .htw-panel { inset: 0; width: 100%; height: 100%; border: 0; box-shadow: none; z-index: 450; }
  html.htw-lock, html.htw-lock body { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .htw-fab, .htw-fab img { transition: none; } }
@media print { .htw-fab, .htw-panel, .htw-tip { display: none !important; } }
.htw-fab, .htw-tip button { font-family: Pretendard, "Pretendard Variable", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; }

/* 2026-11-10 모바일: 혜택이 버튼을 작게·납작하게 (목록 카드를 덜 가리게) */
@media (max-width: 767px) {
  .htw-fab { width: 48px !important; height: 48px !important; border-radius: 50% !important; border: 0 !important; box-shadow: 0 6px 18px rgba(17, 24, 39, .18) !important; }
  .htw-fab img { width: 38px !important; height: 38px !important; }
}
/* 2026-11-10 깔끔 정리: 챗봇 창 머리·버튼의 픽셀 테두리 → 연한 선 */
.htw-panel { border: 1px solid #e6e9ef !important; border-radius: 16px; box-shadow: 0 20px 50px rgba(17, 24, 39, .18) !important; }
.htw-head { border-bottom: 1px solid #f0d76a !important; }
.htw-head .htw-face { border: 1px solid #f0d76a !important; }
.htw-head a, .htw-head button { border: 1px solid rgba(17, 24, 39, .12) !important; border-radius: 10px !important; box-shadow: none !important; background: #fff !important; }
.htw-tip::after { border-color: #e6e9ef !important; }
@media (max-width: 767px) { .htw-panel { border-radius: 0; } }
