/* ============================================================
   스페이스라사 채팅 위젯
   ------------------------------------------------------------
   디자인 원칙 하나만 기억하면 됩니다.

     "진단실 벽은 회색이다."

   퍼스널컬러 진단은 색이 정확히 보이도록 중성 회색 배경 앞에서 합니다.
   그래서 이 화면도 배경·글자·버튼에는 색을 쓰지 않고 회색만 씁니다.
   색은 오직 사계절 스와치(봄·여름·가을·겨울)에만 나타납니다.

   색을 바꾸고 싶으면 아래 :root 의 값만 고치면 됩니다.
   ============================================================ */

:root {
  /* --- 중성 회색 (진단실 벽) --- */
  --ground:   #E9E7E5;   /* 페이지 바탕 */
  --surface:  #FFFFFF;   /* 카드 · 말풍선 */
  --sunken:   #DEDBD8;   /* 입력창처럼 한 겹 들어간 면 */
  --ink:      #23201E;   /* 본문 글자 */
  --ink-soft: #6D6761;   /* 4.52:1 on --ground. 이전 #6E6862는 4.46:1로 AA(4.5)에 0.04 미달 (axe) */
  --ink-note: #514B46;   /* 6.96:1 on --ground. 12px 작은 안내문용 — 작은 글씨는 4.5 턱걸이로 두지 않는다 */
  --line:     #CFCBC7;   /* 실선 */

  /* --- 사계절 드레이프 (이 화면에서 색이 허용된 유일한 자리) --- */
  --spring: #EFA286;
  --summer: #A6B7D6;
  --autumn: #B3813F;
  --winter: #5D4B7C;

  /* 강조색은 겨울 드레이프에서 가져옵니다 */
  --accent:    var(--winter);
  --accent-in: #FFFFFF;

  --radius:    14px;
  --radius-sm: 9px;
  --tap:       44px;      /* 최소 터치 영역 */

  /* 화면별 위젯 크기 */
  --w: 400px;
  --h: 600px;

  /* --- 움직임 (D-123) — 속도는 이 네 가지만 씁니다 --- */
  --dur-fast:   120ms;   /* 버튼 눌림 · 칩 */
  --dur-normal: 200ms;   /* 말풍선 등장 */
  --dur-slow:   350ms;   /* 홈 → 대화 전환 */
  --dur-spring: 420ms;   /* 캐릭터 자세 바꾸기 */
  --ease-out:    cubic-bezier(0.2, 0, 0, 1);
  --ease-slow:   cubic-bezier(0.3, 0, 0, 1);
  --ease-spring: cubic-bezier(0.32, 0.94, 0.6, 1);   /* 살짝 넘쳤다 돌아옵니다 */

  /* --- 안내 캐릭터 크기 --- */
  --rasa-head: 40px;     /* 대화 중 머리 자리 */
  --rasa-hero: 96px;     /* 홈 화면 */

  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
          "Apple SD Gothic Neo", "Hiragino Sans", "Yu Gothic", "Noto Sans JP",
          "PingFang SC", "Microsoft YaHei", "Noto Sans KR", "Segoe UI", sans-serif;
}

/* 다크 모드 — theme.js 가 <html data-theme> 를 정한다 (시스템 · 라이트 · 다크) */
  :root[data-theme="dark"] {
    --ground:   #1B1918;
    --surface:  #262322;
    --sunken:   #322E2C;
    --ink:      #EDE9E5;
    --ink-soft: #A39C95;
    --ink-note: #B3ACA5;   /* 7.81:1 on dark --ground */
    --line:     #3D3835;
    /* 어두운 배경에서는 겨울색이 가라앉아 여름색을 강조로 씁니다 */
    --accent:    #8E9FC4;
    --accent-in: #171514;
  }


* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-underline-offset: 3px; }

button { font: inherit; color: inherit; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ============================================================
   시그니처 — 드레이프 스트립
   진단 때 얼굴 아래에 대보는 사계절 천 조각을 그대로 옮겼습니다.
   ============================================================ */

.drape { display: flex; gap: 4px; }
.drape__chip { height: 8px; flex: 1; border-radius: 2px; }
.drape__chip[data-season="spring"] { background: var(--spring); }
.drape__chip[data-season="summer"] { background: var(--summer); }
.drape__chip[data-season="autumn"] { background: var(--autumn); }
.drape__chip[data-season="winter"] { background: var(--winter); }

/* ============================================================
   안내 페이지
   ============================================================ */

.page {
  max-width: 34rem;
  margin: 0 auto;
  padding: clamp(48px, 12vh, 120px) 24px 160px;
}

/* 전시장 벽면 라벨처럼 — 작게, 넓게 띄워서 */
.wordmark {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}
.wordmark--sm { font-size: 11px; letter-spacing: 0.22em; }

/* 스페이스라사 로고의 글자 부분 (원본 spacerasa_logo.svg 에서 무늬를 빼고 글자만 땄습니다).
   그림을 마스크로 쓰고 글자색(currentColor)으로 칠합니다 — 다크모드에서 저절로 밝은 글자가 됩니다. */
.logo {
  display: block;
  width: var(--logo-w, 168px);
  aspect-ratio: 540 / 48.6;
  background: currentColor;
  -webkit-mask: url("/img/wordmark.svg") center / contain no-repeat;
          mask: url("/img/wordmark.svg") center / contain no-repeat;
}
.wordmark--sm .logo { --logo-w: 108px; }
/* 로고 그림이 없는 사이트(마망루즈 등) — 관리 화면 「채팅창 이름」을 적은 그대로 (대소문자 유지) */
.wordmark--text { text-transform: none; letter-spacing: 0.04em; }
.wordmark--text .logo { display: none; }

.wordmark-ko {
  margin: 6px 0 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page__head { margin-bottom: 28px; }
.page .drape { margin-bottom: 28px; max-width: 220px; }

.page__lead {
  margin: 0 0 40px;
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 30rem;
}

.facts { margin: 0 0 40px; border-top: 1px solid var(--line); }
.facts__row {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.facts dt {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-top: 3px;
}
.facts dd { margin: 0; }

.page__hint { margin: 0; font-size: 14px; color: var(--ink-soft); }

/* ============================================================
   열기 버튼
   ============================================================ */

.launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 8px 18px 8px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.13);
  transition: transform var(--dur-normal) var(--ease-out), box-shadow var(--dur-normal) var(--ease-out);
}
.launcher:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgb(0 0 0 / 0.17); }

/* 스와치 네 장을 2×2 로 쌓은 정사각형 */
.launcher__swatches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  width: 28px; height: 28px;
  border-radius: 7px;
  overflow: hidden;
  flex: none;
}
.launcher__swatches span[data-season="spring"] { background: var(--spring); }
.launcher__swatches span[data-season="summer"] { background: var(--summer); }
.launcher__swatches span[data-season="autumn"] { background: var(--autumn); }
.launcher__swatches span[data-season="winter"] { background: var(--winter); }

.launcher__label { font-size: 14px; font-weight: 600; }

.launcher[hidden] { display: none; }

/* ============================================================
   위젯 본체
   ============================================================ */

.widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  width: var(--w);
  height: min(var(--h), calc(100dvh - 40px));
  display: flex;
  flex-direction: column;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgb(0 0 0 / 0.22);
}
.widget[hidden] { display: none; }

.widget__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 12px 12px 18px;
  background: var(--surface);
}
.widget__title p { margin: 0; }
.widget__status { font-size: 12px; color: var(--ink-soft); margin-top: 2px !important; }

.iconbtn {
  width: var(--tap); height: var(--tap);
  display: grid; place-items: center;
  background: none; border: none;
  border-radius: 50%;
  font-size: 15px;
  color: var(--ink-soft);
  flex: none;
}
.iconbtn:hover { background: var(--sunken); color: var(--ink); }

/* --- 언어 스위처 (항상 보입니다). 담당자 연결은 머리줄이 아니라 막혔을 때 연락 카드로 (D-124) --- */
.langbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px 10px;
  background: var(--surface);
  overflow-x: auto;
  scrollbar-width: none;
}
.langbar::-webkit-scrollbar { display: none; }

.langbar button {
  flex: none;
  min-height: 32px;
  padding: 5px 11px;
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.langbar button:hover { background: var(--sunken); }
.langbar button[aria-pressed="true"] {
  color: var(--ink);
  font-weight: 600;
  border-color: var(--line);
  background: var(--ground);
}

.drape--rail { padding: 0; }
.drape--rail .drape__chip { height: 3px; border-radius: 0; }
.drape--rail { gap: 0; }

/* --- 대화 --- */
.log {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;   /* 위젯 안에서 스크롤이 페이지로 새지 않게 */
  padding: 18px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* flex: none 이 없으면 대화가 길어질 때 말풍선과 카드가 눌려 찌그러집니다.
   세로 flex 컨테이너의 흔한 함정입니다. */
.msg { max-width: 86%; flex: none; }
.msg__body {
  padding: 11px 14px;
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-break: break-word;
}
.msg--bot { align-self: flex-start; }
.msg--bot .msg__body {
  background: var(--surface);
  border-bottom-left-radius: 5px;
}
.msg--user { align-self: flex-end; }
.msg--user .msg__body {
  background: var(--ink);
  color: var(--ground);
  border-bottom-right-radius: 5px;
}
.msg--note {
  align-self: center;
  max-width: 100%;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
  padding: 2px 8px;
}

/* 첫 화면 개인정보 안내 (D-110). 인사말 아래 작은 글씨로. 색은 --ink-soft 라 AA 대비를 지킨다.
   배경을 위젯과 같은 --ground 로 명시한다 — 보기엔 차이가 없지만, 태블릿 폭에서 위젯이 랜딩 페이지
   본문 위에 반쯤 걸치면 axe 가 "뒤 요소와 부분적으로 겹쳐 배경을 알 수 없다"며 대비 판정을 포기한다.
   자기 배경이 있으면 그 자리에서 판정이 끝난다. */
.msg--privacy {
  font-size: 12px;
  line-height: 1.5;
  max-width: 92%;
  color: var(--ink-note);
  background: var(--ground);
  border-radius: var(--radius-sm);
}

/* --- 입력 중 표시 — 드레이프가 차례로 숨을 쉽니다 --- */
.typing { display: flex; align-items: center; gap: 9px; }
.typing__drape { display: flex; gap: 3px; }
.typing__drape span {
  width: 7px; height: 14px; border-radius: 2px;
  animation: breathe 1.5s ease-in-out infinite;
}
.typing__drape span[data-season="spring"] { background: var(--spring); animation-delay: 0s; }
.typing__drape span[data-season="summer"] { background: var(--summer); animation-delay: .15s; }
.typing__drape span[data-season="autumn"] { background: var(--autumn); animation-delay: .3s; }
.typing__drape span[data-season="winter"] { background: var(--winter); animation-delay: .45s; }
.typing__label { font-size: 13px; color: var(--ink-soft); }

@keyframes breathe {
  0%, 100% { transform: scaleY(0.62); opacity: .5; }
  50%      { transform: scaleY(1);    opacity: 1; }
}

/* --- 프로그램 카드 --- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 4px 0;
  align-self: stretch;
  flex: none;
  max-width: 100%;
  overflow: hidden;
}

.card__group + .card__group { border-top: 1px solid var(--line); }

.card__eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 13px 15px 7px;
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
/* 카테고리마다 드레이프 한 조각을 색인처럼 답니다 */
.card__eyebrow::before {
  content: "";
  width: 3px; height: 13px;
  border-radius: 2px;
  background: var(--chip, var(--line));
  flex: none;
}

.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 15px;
}
.item + .item { border-top: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }

.item__text { min-width: 0; }
.item__name {
  margin: 0;
  font-weight: 600;
  line-height: 1.4;
}
.item__meta {
  margin: 1px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.4;
}
.item__price {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* 금액이 아직 정해지지 않은 프로그램 — 숫자처럼 보이면 안 됩니다. */
.item__price--ask { color: var(--ink-soft); font-style: italic; }

.item__ask {
  flex: none;
  min-height: 32px;
  padding: 5px 12px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
}
.item__ask:hover { background: var(--sunken); }

/* 바로 예약할 수 있는 프로그램은 버튼을 채워서 눈에 띄게 합니다. */
.item__ask--book {
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-in);
  font-weight: 600;
  text-decoration: none;
}
.item__ask--book:hover { background: var(--accent); filter: brightness(1.1); }

.card__foot {
  margin: 0;
  padding: 11px 15px 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-soft);
}

.card__cta {
  display: inline-block;
  margin: 4px 15px 14px;
  min-height: var(--tap);
  padding: 11px 18px;
  background: var(--accent);
  color: var(--accent-in);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

/* --- 퀵리플라이 칩 --- */
.chips {
  display: flex;
  gap: 7px;
  padding: 4px 16px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chips:empty { display: none; }

.chips button {
  flex: none;
  min-height: 36px;
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  white-space: nowrap;
}
.chips button:hover { border-color: var(--ink-soft); }

/* --- 입력창 --- */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.composer textarea {
  flex: 1;
  min-height: var(--tap);
  max-height: 130px;
  padding: 11px 14px;
  background: var(--sunken);
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  /* 16px 아래면 아이폰 사파리 · 인스타 앱 안 브라우저가 입력창을 누를 때마다 화면을 확대합니다. */
  font-size: 16px;
  line-height: 1.5;
  resize: none;
}
.composer textarea:focus { border-color: var(--line); outline-offset: 0; }
.composer textarea::placeholder { color: var(--ink-soft); }

.send {
  width: var(--tap); height: var(--tap);
  flex: none;
  display: grid; place-items: center;
  background: var(--accent);
  color: var(--accent-in);
  border: none;
  border-radius: 50%;
  font-size: 17px;
}
.send:disabled { opacity: .35; cursor: default; }

/* §8-8: 입력 장치와 무관하게 44px. pointer:coarse로 묶으면 데스크톱(마우스·트랙패드)에서 33~39px로 떨어진다 (E2E 실측). */
.chips button,
.langbar button,
.item__ask {
  min-height: var(--tap);
  padding-left: 15px;
  padding-right: 15px;
}

/* ============================================================
   B안 「컨시어지」 (D-123 · docs/design/widget-redesign-b.md)
   ============================================================ */

/* --- 말풍선 · 카드 등장 --- */
.msg, .card { animation: m-in var(--dur-normal) var(--ease-out) both; }
/* 투명도는 바꾸지 않고 자리만 옮깁니다. 반투명한 순간에 글자 대비가 AA 아래로 떨어지기 때문입니다
   (대비 검사 axe 가 그 순간을 재서 실패했습니다). */
@keyframes m-in {
  from { transform: translateY(6px); }
  to   { transform: none; }
}

/* --- 안내 캐릭터 ---
   그림은 상태마다 한 장씩 (public/img/rasa/<상태>.webp). 상태가 바뀌면 widget.js 가 그림을 바꾸고
   is-moving 을 다시 붙여 한 번만 움직입니다. 반복 동작은 idle 의 숨쉬기 하나뿐입니다. */
.rasa {
  position: relative;
  flex: none;
  display: block;
  border-radius: 50%;
  overflow: hidden;
  background: var(--sunken);    /* 다크모드에서 검은 머리가 배경에 묻히지 않게 */
}
.rasa[hidden] { display: none; }
.rasa__img {
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 0;       /* 상반신 그림의 머리 쪽을 보여 줍니다 */
  transform-origin: 50% 100%;
}
.rasa--head { width: var(--rasa-head); height: var(--rasa-head); }
/* 40px 에서 상반신 전체를 보이면 얼굴이 점처럼 작아집니다. 머리 쪽만 확대해 보여 줍니다. */
.rasa--head .rasa__img { width: 160%; height: 160%; margin: -2% 0 0 -30%; }
.rasa--hero { width: var(--rasa-hero); height: var(--rasa-hero); }
/* 다른 브랜드 사이트의 원장 그림(D-139)은 이미 얼굴만 자른 한 장이라 확대하지 않습니다. */
.rasa--portrait.rasa--head .rasa__img { width: 100%; height: 100%; margin: 0; }

.rasa[data-state="idle"] .rasa__img { animation: r-breathe 4s ease-in-out infinite; }
.rasa.is-moving .rasa__img { animation: r-pose var(--dur-spring) var(--ease-spring) both; }
.rasa.is-moving[data-state="point"] .rasa__img { animation-name: r-point; }
/* 담당자에게 넘긴 뒤 · 오류 뒤에는 움직이지 않습니다. 계속 움직이면 "봇이 아직 대답 중"으로 읽힙니다. */
.rasa[data-state="handoff"] .rasa__img,
.rasa[data-state="sorry"] .rasa__img { animation: none; }

@keyframes r-breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.012); }
}
@keyframes r-pose {
  from { transform: translateY(4px) scale(0.96); }
  to   { transform: none; }
}
@keyframes r-point {
  from { transform: rotate(0deg); }
  50%  { transform: rotate(2deg); }
  to   { transform: rotate(0deg); }
}

.widget__head { justify-content: flex-start; }
.widget__head .rasa--head { margin-right: -2px; }

/* --- 홈 화면: 손님이 첫 메시지를 보내기 전 --- */
.hero { display: none; }
.widget.is-home .hero {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 18px 16px 0;
  animation: m-in var(--dur-slow) var(--ease-slow) both;
}
.widget.is-home .rasa--head { display: none; }
.hero__say {
  position: relative;
  margin: 0 0 10px;
  padding: 8px 13px;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) var(--radius) 4px;
  font-size: 14px;
  font-weight: 600;
}
.widget.is-home .log { padding-top: 12px; }

/* 떠 있는 위젯(PC · 태블릿)은 높이가 560~600px 뿐이라, 홈 화면을 조금 줄여야 인사말 · 안내 · 타일이 함께 들어갑니다. */
@media (min-width: 768px) {
  .widget.is-home .hero { padding-top: 12px; }
  .widget.is-home { --rasa-hero: 72px; }
  /* 타일 3개를 세로로 쌓으면 넘칩니다. 가로 3칸으로 — 색 조각을 위에, 글자를 아래에 둡니다.
     (#chips 로 적은 이유: 아래쪽 기본 타일 규칙보다 우선해야 해서입니다.) */
  .widget.is-home #chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding-bottom: 10px; }
  .widget.is-home #chips button {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 6px;
    min-height: 60px;
    padding: 9px 6px;
    text-align: center;
    white-space: normal;
    line-height: 1.3;
    font-size: 13px;
  }
  .widget.is-home #chips button::after { display: none; }
}
/* 태블릿 위젯은 560px 로 더 낮습니다. 캐릭터를 한 단계 더 줄여 개인정보 안내(§2.5)가 첫 화면에 들어오게 합니다. */
@media (min-width: 768px) and (max-width: 1023px) {
  .widget.is-home { --rasa-hero: 52px; }
  .widget.is-home .hero { padding-top: 8px; }
  .widget.is-home .hero__say { margin-bottom: 4px; }
}

/* 홈에서는 빠른 버튼 3개가 세로 타일이 됩니다. 눌렀을 때 동작은 칩과 같습니다 (입력창에 넣기만).
   화살표는 글자가 아니라 테두리로 그립니다 — 글자로 넣으면 버튼 이름에 섞여 읽힙니다. */
.widget.is-home .chips {
  flex-direction: column;
  gap: 8px;
  padding: 4px 16px 12px;
  overflow: visible;
}
.widget.is-home .chips button {
  display: grid;
  grid-template-columns: 10px 1fr 8px;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 16px 8px 14px;
  border-radius: var(--radius);
  border-color: transparent;
  text-align: left;
  font-weight: 600;
  transition: border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.widget.is-home .chips button::before {
  content: "";
  width: 10px; height: 10px;
  border-radius: 3px;
  background: var(--tile, var(--line));
}
.widget.is-home .chips button::after {
  content: "";
  width: 7px; height: 7px;
  border-top: 1.5px solid var(--ink-soft);
  border-right: 1.5px solid var(--ink-soft);
  transform: rotate(45deg);
}
.widget.is-home .chips button:nth-child(1) { --tile: var(--spring); }
.widget.is-home .chips button:nth-child(2) { --tile: var(--summer); }
.widget.is-home .chips button:nth-child(3) { --tile: var(--winter); }
.widget.is-home .chips button:hover { border-color: var(--line); }
.chips button:active { transform: scale(0.98); }

/* --- 예약 단계 카드 (대화창 위에 고정) --- */
.steps {
  padding: 10px 16px;
  background: var(--ground);
  border-bottom: 1px solid var(--line);
  animation: m-in var(--dur-slow) var(--ease-slow) both;
}
.steps[hidden] { display: none; }
.steps__list {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps__list li {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1.3;
  color: var(--ink-soft);
  counter-increment: step;
}
.steps__list li::before {
  content: counter(step);
  flex: none;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 11px;
  font-weight: 600;
  transition: background var(--dur-normal) var(--ease-out), color var(--dur-normal) var(--ease-out);
}
.steps__list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps__list li.is-done::before { background: var(--ink-soft); border-color: var(--ink-soft); color: var(--ground); }
.steps__list li[aria-current="step"] { color: var(--ink); font-weight: 600; }
.steps__list li[aria-current="step"]::before { background: var(--accent); border-color: var(--accent); color: var(--accent-in); }
/* 담당자에게 넘어간 뒤에는 단계 카드를 감춥니다. 「담당자 확인 중」은 머리줄(.widget__status)이 이미 말합니다. */
.steps.is-paused { display: none; }

/* --- 담당자 말풍선 (D-126) — 봇과 구분되게 이름표 + 강조색 테두리 --- */
.msg--staff { align-self: flex-start; display: grid; gap: 3px; }
.msg--staff .msg__who { font-size: 11.5px; font-weight: 600; color: var(--accent); padding-left: 4px; }
.msg--staff .msg__body {
  background: var(--surface);
  border: 1.5px solid var(--accent);
  border-bottom-left-radius: 5px;
}

/* --- 연락 안내 카드 (D-124 · D-125) --- */
.contact { padding: 14px 15px; display: grid; gap: 10px; }
.contact__title { margin: 0; font-weight: 600; }
.contact__list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.contact__item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.contact__staff {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  background: var(--accent);
  color: var(--accent-in);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  transition: transform var(--dur-fast) var(--ease-out);
}
.contact__staff:active { transform: scale(0.98); }
/* 이미 담당자에게 넘어갔으면 버튼이 아니라 상태 표시로 보입니다 */
.contact__staff:disabled { background: var(--sunken); color: var(--ink-note); cursor: default; }
.contact__label { font-size: 13px; color: var(--ink-soft); }
.contact__value { font-weight: 600; word-break: break-all; user-select: all; }
.contact__copy,
.contact__link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 8px 14px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.contact__link:hover, .contact__copy:hover { background: var(--sunken); }
.contact__note { margin: 0; font-size: 12px; line-height: 1.5; color: var(--ink-note); }

/* ============================================================
   반응형
   ============================================================ */

/* 태블릿 — 폭만 줄입니다 */
@media (max-width: 1023px) {
  :root { --w: 360px; --h: 560px; }
}

/* 모바일 — 전체화면.
   100vh 는 iOS 주소창 때문에 아래가 잘립니다. 반드시 100dvh 를 씁니다. */
@media (max-width: 767px) {
  .widget {
    inset: 0;
    width: 100%;
    height: 100dvh;
    border: none;
    border-radius: 0;
  }
  .launcher { right: 16px; bottom: 16px; }
  .page { padding-bottom: 120px; }
}

/* 다른 사이트의 패널(iframe) 안 (?embed=1 · D-119).
   안내 페이지 · 열기 버튼 · 닫기 X 는 사이트 패널이 대신하므로 숨기고, 위젯이 iframe 을 가득 채웁니다. */
html.is-embed, html.is-embed body { height: 100%; overflow: hidden; }
html.is-embed .page,
html.is-embed .launcher,
html.is-embed #close { display: none; }
html.is-embed .widget {
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 0;
  box-shadow: none;
}
/* 개인정보처리방침 링크 — 패널 안에서만, 입력창 바로 아래에 늘 (안내 페이지 .page__legal 대신).
   배경은 입력창과 같은 --surface, 글자는 작은 글씨용 --ink-note 로 AA 대비를 넉넉히 둡니다. */
.widget__legal { display: none; }
html.is-embed .widget__legal {
  display: block;
  flex: none;
  margin: 0;
  padding: 0 12px 4px;
  background: var(--surface);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}
/* 누르는 자리는 24px 이상 (WCAG 2.5.8) — 글줄 18px + 위아래 4px */
html.is-embed .widget__legal a { display: inline-block; padding: 4px 8px; color: var(--ink-note); }
html.is-embed .composer { padding-bottom: 6px; }
/* 패널이 낮으면(PC 패널 ≈ 560px) 폭이 좁아도 홈 화면을 떠 있는 위젯과 같은 압축 배치로 —
   타일 3개를 세로로 쌓으면 인사말이 가려집니다. (폭은 768px 아래라 위의 @media (min-width: 768px) 가 안 걸립니다.) */
@media (max-height: 700px) {
  html.is-embed .widget.is-home { --rasa-hero: 52px; }
  html.is-embed .widget.is-home .hero { padding-top: 8px; }
  html.is-embed .widget.is-home .hero__say { margin-bottom: 4px; }
  html.is-embed .widget.is-home #chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding-bottom: 10px; }
  html.is-embed .widget.is-home #chips button {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 6px;
    min-height: 60px;
    padding: 9px 6px;
    text-align: center;
    white-space: normal;
    line-height: 1.3;
    font-size: 13px;
  }
  html.is-embed .widget.is-home #chips button::after { display: none; }
}

/* 전체화면일 때만 페이지 스크롤을 잠급니다 */
@media (max-width: 767px) {
  body.is-locked { overflow: hidden; }
}

/* 움직임을 줄여달라고 설정한 분들 — 애니메이션을 끕니다.
   "입력 중…" 글자가 함께 나오므로 정보는 그대로 전달됩니다. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .typing__drape span { opacity: 1; transform: none; }
}

/* 화면 모드 버튼은 닫기 버튼 바로 옆에 (머리 가운데 뜨지 않게) */
.widget__head #theme { margin-left: auto; }

/* 첫 화면 아래 개인정보처리방침 링크 */
.page__legal { margin: 12px 0 0; font-size: 13px; }
.page__legal a { color: var(--ink-soft); }

/* --- 채팅 예약 요청 양식 (D-137) --- */
.booking-request { padding: 4px 15px 14px; display: flex; flex-direction: column; gap: 8px; }
.booking-request__title { margin: 10px 0 0; font-size: 15px; font-weight: 600; }
.booking-request__lead { margin: 0; font-size: 13px; color: var(--ink-soft); }
.booking-request__summary { margin: 0; font-size: 14px; }
.booking-request .card__cta { margin: 4px 0 0; align-self: flex-start; }
.booking-request__done { margin: 10px 0 0; font-size: 14px; font-weight: 600; }
