/* ════════════════════════════════════════════════════════════════
 * dentpt.ai — 온보딩 투어 (말풍선 가이드)
 *   디자인 톤은 design-tokens.css 의 cream + accent 그린.
 *   가독성 우선 — 큰 폰트, 넓은 패딩, 진한 텍스트.
 * ════════════════════════════════════════════════════════════════ */

/* 하이라이트 — 페이지 전체 어둠(box-shadow 9999px 트릭) + 대상 영역 outline + 그린 글로우 */
#tour-highlight {
  position: fixed;
  z-index: 2147483646;  /* 거의 최대 — 다른 stacking context 보다 항상 위 */
  border-radius: 12px;
  pointer-events: none;
  box-shadow:
    0 0 0 9999px rgba(14,13,11,0.55),
    0 0 0 4px var(--accent),
    0 0 22px rgba(26,107,74,0.55);
  transition: top 280ms cubic-bezier(0.4,0,0.2,1),
              left 280ms cubic-bezier(0.4,0,0.2,1),
              width 280ms cubic-bezier(0.4,0,0.2,1),
              height 280ms cubic-bezier(0.4,0,0.2,1);
}

/* 말풍선 본체 — viewport 비례 (작은 화면에서 그리드 등 본문을 덜 가림) */
#tour-bubble {
  position: fixed;
  z-index: 2147483647;  /* max int — stacking context 충돌 무관하게 항상 최상단 */
  isolation: isolate;
  width: clamp(360px, 32vw, 560px);
  max-width: calc(100vw - 32px);
  background: #fff;
  border: 2px solid var(--accent);
  border-radius: 18px;
  padding: clamp(18px, 1.6vw, 30px) clamp(20px, 1.8vw, 34px) clamp(14px, 1.2vw, 22px);
  box-shadow: 0 20px 60px rgba(14,13,11,0.35), 0 0 0 1px rgba(26,107,74,0.1);
  font-family: var(--sans);
  color: var(--ink);
  transition: top 280ms cubic-bezier(0.4,0,0.2,1),
              left 280ms cubic-bezier(0.4,0,0.2,1),
              opacity 180ms ease;
  opacity: 1;
  animation: tour-bubble-in 280ms ease-out;
}
@keyframes tour-bubble-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 말풍선 꼬리 — placement 에 따라 회전 */
#tour-bubble::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  background: #fff;
  border: 2px solid var(--accent);
  transform: rotate(45deg);
}
#tour-bubble[data-placement="top"]::before    { left: 50%; bottom: -10px; margin-left: -8px; border-top: none; border-left: none; }
#tour-bubble[data-placement="bottom"]::before { left: 50%; top: -10px; margin-left: -8px; border-bottom: none; border-right: none; }
#tour-bubble[data-placement="left"]::before   { top: 50%; right: -10px; margin-top: -8px; border-left: none; border-bottom: none; }
#tour-bubble[data-placement="right"]::before  { top: 50%; left: -10px; margin-top: -8px; border-right: none; border-top: none; }
#tour-bubble[data-placement="center"]::before { display: none; }

/* 헤더: 단계 표시 + 닫기 */
.tour-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent);
}
.tour-meta .tour-step {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-light);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
}
.tour-close {
  background: none; border: none;
  color: var(--ink3);
  font-size: 22px; line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.tour-close:hover { background: var(--cream2); color: var(--ink); }

/* 제목 — 크게 */
.tour-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--ink);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

/* 본문 — 가독성 우선 큰 폰트 */
.tour-body {
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink2);
  margin-bottom: 20px;
  word-break: keep-all;
}
.tour-body strong { color: var(--ink); font-weight: 700; }
.tour-body em { color: var(--accent); font-style: normal; font-weight: 700; }
.tour-body code {
  background: var(--accent-light);
  color: var(--accent);
  padding: 1px 8px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 14px;
  font-weight: 700;
}

/* 버튼 영역 — 두 줄 레이아웃: (1) 진행도 점 가운데  (2) 건너뛰기 좌 + [이전][다음] 우 */
.tour-actions {
  padding-top: 14px;
  border-top: 1px solid var(--cream2);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tour-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
}
.tour-actions-row.center { justify-content: center; }

.tour-actions .tour-skip {
  background: none; border: none;
  color: var(--ink3);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  padding: 8px 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-family: var(--sans);
  white-space: nowrap;
}
.tour-actions .tour-skip:hover { color: var(--ink); }
.tour-nav-buttons { display: inline-flex; gap: 8px; flex-shrink: 0; }

.tour-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--sans);
  border: none;
  transition: all .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.tour-btn--prev {
  background: var(--cream2);
  color: var(--ink2);
  border: 1px solid var(--cream3);
}
.tour-btn--prev:hover { background: var(--cream3); color: var(--ink); }
.tour-btn--prev:disabled { opacity: 0.4; cursor: not-allowed; }

.tour-btn--next {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(26,107,74,0.3);
}
.tour-btn--next:hover { background: #155a3c; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(26,107,74,0.4); }

/* 진행도 점 */
.tour-progress { display: inline-flex; gap: 6px; align-items: center; }
.tour-progress .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--cream3);
  transition: background .2s, width .2s;
}
.tour-progress .dot.active { background: var(--accent); width: 22px; border-radius: 4px; }
.tour-progress .dot.done { background: var(--accent2); }

/* 우하단 ? 도움말 버튼 (페이지 하단 고정) — viewport 비례 */
#tour-help-btn {
  position: fixed;
  bottom: clamp(16px, 1.6vw, 32px); right: clamp(16px, 1.6vw, 32px);
  z-index: 9000;
  width: clamp(42px, 3vw, 64px); height: clamp(42px, 3vw, 64px);
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: clamp(18px, 1.4vw, 28px);
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(14,13,11,0.18);
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
  font-family: var(--sans);
}
#tour-help-btn:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(26,107,74,0.4);
}

/* ? 클릭 시 노출되는 투어 선택 메뉴 */
#tour-help-menu {
  position: fixed;
  bottom: 88px; right: 24px;
  z-index: 9001;
  background: #fff;
  border: 1px solid var(--cream3);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(14,13,11,0.22);
  padding: 10px;
  min-width: 240px;
  max-width: calc(100vw - 32px);
  font-family: var(--sans);
  animation: tour-bubble-in 200ms ease-out;
}
.tour-help-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 6px 12px 8px;
  border-bottom: 1px solid var(--cream2);
  margin-bottom: 6px;
}
.tour-help-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  background: none;
  border: none;
  font-size: 14.5px;
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  transition: background .12s, color .12s;
  font-family: var(--sans);
}
.tour-help-item i { color: var(--accent); font-size: 16px; }
.tour-help-item:hover {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 700;
}
.tour-help-item:hover i { color: var(--accent); }

/* 모바일 — 말풍선 폭 좁히고 폰트 약간 축소 */
@media (max-width: 720px) {
  #tour-bubble { width: calc(100vw - 32px); padding: 20px 22px 16px; border-radius: 14px; }
  .tour-title { font-size: 19px; }
  .tour-body  { font-size: 15px; }
  .tour-btn { padding: 9px 16px; font-size: 14px; }
  #tour-restart-btn { width: 44px; height: 44px; font-size: 20px; bottom: 16px; right: 16px; }
}
