/* 채널톡 런처 + 기기 연결 모달 (static/js/chat.js) */
:root {
  --cl-primary: #7b61ff;
  --cl-primary-dark: #6a4ff0;
  --cl-text: #111827;
  --cl-muted: #6b7280;
  --cl-border: #e5e7eb;
  --cl-error: #b71c1c;
  --cl-surface: #ffffff;
  --cl-subtle: #f9fafb;
}

.cl-dock {
  position: fixed;
  right: 16px;
  /* 하단 고정 바(카운트다운 + 신청 버튼, 약 95px) 위에 배치 */
  bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, sans-serif;
}

.cl-launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: 26px;
  background: var(--cl-primary);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  cursor: pointer;
}
.cl-launcher:hover { background: var(--cl-primary-dark); }
.cl-launcher-icon { font-size: 20px; line-height: 1; }

.cl-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #ff3b30;
  color: #fff;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
}
.cl-badge[hidden] { display: none; }

.cl-chip {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--cl-border);
  border-radius: 16px;
  background: var(--cl-surface);
  color: var(--cl-muted);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}
.cl-chip:hover { color: var(--cl-text); }

.cl-launcher:focus-visible,
.cl-chip:focus-visible,
.cl-overlay button:focus-visible,
.cl-input:focus-visible {
  outline: 3px solid #a99bff;
  outline-offset: 2px;
}

/* ── 모달 ── */
.cl-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.55);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, sans-serif;
}
.cl-overlay[hidden] { display: none; }

.cl-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 28px 24px 24px;
  border-radius: 20px;
  background: var(--cl-surface);
  color: var(--cl-text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.cl-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--cl-muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.cl-title { margin: 0 32px 10px 0; font-size: 19px; font-weight: 700; }
.cl-section { margin: 22px 0 4px; font-size: 16px; font-weight: 700; }
.cl-desc { margin: 0 0 14px; font-size: 14px; line-height: 1.5; color: var(--cl-muted); }
.cl-label { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.cl-hint { margin: 10px 0 0; font-size: 12px; line-height: 1.5; color: var(--cl-muted); }

.cl-status {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--cl-border);
  border-radius: 12px;
  background: var(--cl-subtle);
}
.cl-status-label { font-size: 12px; color: var(--cl-muted); }

.cl-row { display: flex; gap: 8px; }
.cl-input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 20px;
  letter-spacing: 6px;
  color: var(--cl-text);
}
.cl-error { min-height: 0; margin: 8px 0 0; font-size: 13px; color: var(--cl-error); }
.cl-error:empty { display: none; }

.cl-primary,
.cl-danger,
.cl-text-button {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.cl-primary { border: 0; background: var(--cl-primary); color: #fff; }
.cl-primary:hover:not(:disabled) { background: var(--cl-primary-dark); }
.cl-primary:disabled { opacity: 0.4; cursor: default; }
.cl-submit { width: auto; min-width: 76px; padding: 0 16px; }
.cl-text-button { margin-top: 6px; border: 0; background: transparent; color: var(--cl-muted); font-size: 14px; font-weight: 500; }
.cl-danger { margin-top: 22px; border: 0; background: transparent; color: var(--cl-error); font-size: 15px; font-weight: 600; }

.cl-issue:empty { display: none; }
.cl-code-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 12px;
  padding: 18px 12px;
  border: 1px solid var(--cl-border);
  border-radius: 12px;
}
.cl-qr { padding: 10px; background: #fff; }
.cl-qr img, .cl-qr canvas { display: block; }
.cl-code { margin-top: 10px; font-size: 32px; font-weight: 700; letter-spacing: 4px; font-variant-numeric: tabular-nums; }
.cl-remaining { margin: 4px 0 0; font-size: 13px; color: var(--cl-muted); font-variant-numeric: tabular-nums; }
.cl-done { margin: 0; font-size: 16px; font-weight: 700; color: var(--cl-primary); }

@media (max-width: 480px) {
  .cl-launcher-label { display: none; }
  .cl-launcher { width: 52px; padding: 0; justify-content: center; }
}

/* ── PC 메신저 이동 손잡이 ──
   메신저 바로 아래 층에 두고 메신저 뒤까지 늘려(JS에서 높이·반경·z-index 계산),
   메신저의 둥근 모서리 바깥을 보라색으로 채워 한 덩어리처럼 보이게 한다. */
.cl-grip {
  position: fixed;
  z-index: 9999999;
  display: flex;
  align-items: flex-start;
  box-sizing: border-box;
  border-radius: 16px 16px 0 0;
  background: var(--cl-primary);
  color: #fff;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, sans-serif;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.14);
}
.cl-grip[hidden] { display: none; }
.cl-grip-handle {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding-left: 40px; /* 오른쪽 닫기 버튼과 균형을 맞춰 글자를 가운데로 */
  font-size: 12px;
  font-weight: 600;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.cl-grip-handle:focus-visible,
.cl-grip-close:focus-visible { outline: 3px solid #fff; outline-offset: -4px; border-radius: 10px; }
.cl-grip-dots {
  width: 18px;
  height: 8px;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.9) 1.5px, transparent 1.6px);
  background-size: 6px 4px;
}
.cl-grip-close {
  width: 40px;
  height: 36px;
  margin-right: 4px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.cl-grip-close:hover { background: rgba(255, 255, 255, 0.18); border-radius: 10px; }
.cl-dragging, .cl-dragging * { cursor: grabbing !important; user-select: none !important; }

/* ── "코드는 앱 어디서 찾나요?" 접이식 안내 ── */
.cl-guide { margin-top: 12px; border-radius: 10px; background: #f3f4f6; }
.cl-guide-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--cl-text);
  cursor: pointer;
  list-style: none;
}
.cl-guide-summary::-webkit-details-marker { display: none; }
.cl-guide-summary::after { content: "▾"; color: var(--cl-muted); }
.cl-guide[open] .cl-guide-summary::after { content: "▴"; }
.cl-guide-summary:focus-visible { outline: 3px solid #a99bff; outline-offset: -3px; border-radius: 10px; }
.cl-steps {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0 12px 4px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 12px; /* 스냅 시에도 좌우 여백 유지 */
}
.cl-step {
  flex: 0 0 150px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--cl-surface);
  scroll-snap-align: start;
}
.cl-step-img { display: block; width: 100%; height: 96px; object-fit: contain; background: #e5e7eb; }
.cl-step-text { display: flex; gap: 6px; margin: 0; padding: 10px; font-size: 12px; line-height: 1.45; color: #444; }
.cl-step-num {
  flex: 0 0 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--cl-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
/* PC: 2×2 격자로 한눈에 (가로 스크롤은 넘길 수 있는지 알기 어려움). 모바일: 옆으로 넘기기 */
@media (min-width: 481px) {
  .cl-steps { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; padding-bottom: 0; }
  .cl-step { flex: none; }
  .cl-step-img { height: 120px; }
}
.cl-guide-note { margin: 0; padding: 8px 12px 12px; font-size: 12px; line-height: 1.5; color: var(--cl-muted); }

/* ── 연결 창: 새 기기 / 기존 기기 카드 ── */
.cl-card-section { margin-top: 14px; padding: 16px; border: 1px solid var(--cl-border); border-radius: 14px; }
.cl-card-section .cl-section { margin-top: 0; }
.cl-eyebrow { margin: 0 0 2px; font-size: 12px; font-weight: 700; color: var(--cl-primary); }
/* 숫자 사이 간격은 입력값에만 적용 (placeholder 글자가 벌어지지 않게) */
.cl-input::placeholder { letter-spacing: normal; font-size: 16px; }
