/* ============================================
   test.css — HSP 심리테스트 UI
   ============================================ */

/* ══════════════════════════════════════════
   래퍼 & 스크린 시스템
   ══════════════════════════════════════════ */
.test-wrapper {
  width: 100%;
  min-height: calc(100vh - var(--header-height));
  position: relative;
  background: var(--color-white);
  display: flex;
  flex-direction: column;
}

/* 모든 스크린 기본 상태: 숨김 & 초기화 상태 */
.test-screen {
  width: 100%;
  display: none;
  flex-direction: column;
  flex: 1;                 /* 부모 높이를 가득 채우도록 */
  opacity: 0;
  transform: translateY(18px);
  pointer-events: none;
  transition:
    opacity 300ms var(--ease-out),
    transform 300ms var(--ease-out);
}

/* 1단계: 디스플레이 활성화 (DOM에 보이지만 아직 투명) */
.test-screen.is-active {
  display: flex;
}

/* 2단계: 시각적 활성화 (페이드인 완료) */
.test-screen.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

/* 퇴장 애니메이션 상태 */
.test-screen.is-leaving {
  opacity: 0;
  transform: translateY(-14px);
  pointer-events: none;
  transition:
    opacity 240ms var(--ease-smooth),
    transform 240ms var(--ease-smooth);
}




/* ══════════════════════════════════════════
   1. 인트로 화면
   ══════════════════════════════════════════ */
.intro-screen {
  padding: var(--space-6) var(--space-6) var(--space-8);
  align-items: center;
  justify-content: center;  /* 수직 정중앙 정렬 */
  gap: var(--space-5);
  text-align: center;
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* 줌인 시네마틱 배경 비디오 (색 필터 없이 맑고 선명하게) */
.intro-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* 비디오 비율을 유지하며 가득 채움 */
  object-position: center 74%; /* 캐릭터 얼굴 높이가 타이틀에 가리지 않게 수직 중심축을 74%로 하향 */
  z-index: 1;
  transform: scale(1.0); /* 1배율에서 시작 */
}

/* 인트로 진입 시 만화처럼 빠르고 긴박하게 턱! 확대되는 줌인 애니메이션 실행 */
.intro-screen.is-visible .intro-bg {
  animation: hspBgZoomIn 0.72s cubic-bezier(0.25, 1.45, 0.45, 1.05) forwards;
}

@keyframes hspBgZoomIn {
  0% {
    transform: scale(1.0);
  }
  100% {
    transform: scale(1.58); /* 1.58배로 순식간에 확 줌인되며 바운싱 안착 */
  }
}

/* 말풍선 플로팅 모션 */
.bubble-sticker {
  animation: floatingSticker 3s ease-in-out infinite alternate;
}
.bubble-sticker--left { animation-delay: 0.1s; }
.bubble-sticker--right { animation-delay: 0.5s; }
.bubble-sticker--bottom { animation-delay: 0.9s; }

@keyframes floatingSticker {
  0% {
    transform: translateY(0px) rotate(-1deg);
  }
  100% {
    transform: translateY(-8px) rotate(1deg);
  }
}
/* 중앙 하단 말풍선 전용 (translateX 보존 필요) */
.bubble-sticker--bottom {
  animation: floatingStickerBottom 2.8s ease-in-out infinite alternate;
}
@keyframes floatingStickerBottom {
  0% {
    transform: translateX(-50%) translateY(0px);
  }
  100% {
    transform: translateX(-50%) translateY(-6px);
  }
}




/* 배지 */
.intro-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(45,223,200,0.15) 0%, rgba(45,223,200,0.08) 100%);
  border: 1px solid var(--color-border-strong);
  color: var(--color-primary-deeper);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: var(--radius-full);
}

/* 제목 */
.intro-title {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 5.5vw, 1.75rem);
  font-weight: var(--weight-extrabold);
  color: #ffffff;             /* 어두운 배경에 맞는 화이트 텍스트 */
  line-height: 1.3;
  letter-spacing: -0.025em;
  word-break: keep-all;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5); /* 텍스트 섀도로 가독성 극대화 */
}
.intro-title .highlight {
  position: relative;
  display: inline-block;
  color: var(--color-primary-deeper);
}
.intro-title .highlight::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 2px;
  height: 8px;
  background: rgba(45, 223, 200, 0.30);
  border-radius: 4px;
  z-index: -1;
}

/* 캐릭터 이미지 영역 */
.intro-char-wrap {
  width: 200px;
  height: 200px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
  box-shadow:
    0 0 0 4px rgba(45,223,200,0.20),
    0 20px 56px rgba(45,223,200,0.25),
    0 8px 24px rgba(13,43,39,0.10);
  animation: introFloat 4s ease-in-out infinite;
  flex-shrink: 0;
}
.intro-char-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
@keyframes introFloat {
  0%, 100% { transform: translateY(0px) rotate(-1deg); }
  50%       { transform: translateY(-10px) rotate(1deg); }
}

/* 설명 텍스트 */
.intro-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.75;
  word-break: keep-all;
  max-width: 300px;
}

/* 정보 칩 행 */
.intro-chips {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: center;
}
.info-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.08); /* 글래스모피즘 반투명 배경 */
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 시작 버튼 */
.intro-start-btn {
  width: 100%;
  max-width: 320px;
  height: 58px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-dark);
  font-size: var(--text-lg);
  font-weight: var(--weight-extrabold);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(45,223,200,0.50);
  transition:
    transform var(--duration-fast) var(--ease-spring),
    box-shadow var(--duration-base) var(--ease-smooth),
    background var(--duration-fast);
  position: relative;
  overflow: hidden;
}
.intro-start-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 60%);
  pointer-events: none;
}
.intro-start-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(45,223,200,0.65);
  background: var(--color-primary-dark);
  color: #fff;
}
.intro-start-btn:active {
  transform: translateY(0) scale(0.97);
}
.intro-start-btn svg { flex-shrink: 0; }

/* ══════════════════════════════════════════
   2. 질문 화면
   ══════════════════════════════════════════ */
.question-screen {
  padding: var(--space-5) var(--space-5) var(--space-8);
  justify-content: flex-start; /* 자연스럽게 위에서부터 쌓이게 함 */
  gap: var(--space-4);
  flex: 1;
}


#questionBody {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}


/* 헤더 영역 */
.q-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-shrink: 0;
  position: relative;
  z-index: 10; /* 최상단 레이어 보장 */
}
.q-counter {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--color-primary-deeper);
  white-space: nowrap;
  min-width: 36px;
}

/* 이전 버튼 인터랙티브 스타일 */
.q-prev-btn {
  transition: all var(--duration-fast) var(--ease-smooth) !important;
  position: relative;
  z-index: 12;
}
.q-prev-btn:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  color: var(--color-text-primary) !important;
  transform: scale(1.05);
}
.q-prev-btn:active {
  transform: scale(0.92);
}


/* 프로그레스 바 */
.progress-track {
  flex: 1;
  height: 6px;
  background: var(--color-surface-2);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
  border-radius: var(--radius-full);
  transition: width 500ms var(--ease-smooth);
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 12px;
  background: rgba(255,255,255,0.45);
  border-radius: var(--radius-full);
  filter: blur(2px);
}

/* 질문 번호 이모지 */
.q-emoji {
  font-size: 20px;
  line-height: 1;
}

/* 질문 카드 */
.q-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6) var(--space-5);
  margin-bottom: var(--space-6);
}
.q-situation-label {
  font-size: 11px;
  font-weight: var(--weight-bold);
  color: var(--color-primary-deeper);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.q-text {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  line-height: 1.7;
  word-break: keep-all;
}

/* 선택지 레이블 */
.choices-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--color-text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: var(--space-3);
}

/* 선택지 버튼 컨테이너 */
.choices {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  flex: 1;
}

/* 선택지 버튼 */
.choice-btn {
  width: 100%;
  min-height: 72px;
  border-radius: var(--radius-xl);
  border: 2px solid var(--color-border-gray);
  background: var(--color-white);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 180ms var(--ease-smooth),
    background 180ms var(--ease-smooth),
    transform 180ms var(--ease-spring),
    box-shadow 180ms var(--ease-smooth);
  position: relative;
  overflow: hidden;
}
.choice-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(45,223,200,0) 0%, rgba(45,223,200,0) 100%);
  transition: background 200ms;
}
.choice-btn:hover {
  border-color: var(--color-primary);
  background: var(--color-surface);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(45,223,200,0.18);
}
.choice-btn:hover::before {
  background: linear-gradient(135deg, rgba(45,223,200,0.06) 0%, rgba(45,223,200,0) 100%);
}
.choice-btn:active {
  transform: scale(0.98) translateY(0);
  box-shadow: none;
}

/* 선택됨 상태 */
.choice-btn.is-selected {
  border-color: var(--color-primary);
  background: rgba(45,223,200,0.08);
  box-shadow: 0 0 0 3px rgba(45,223,200,0.20);
  transform: scale(1);
}

/* 선택지 알파벳 뱃지 */
.choice-badge {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  border: 1.5px solid var(--color-border-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-extrabold);
  color: var(--color-text-secondary);
  flex-shrink: 0;
  transition: background 180ms, border-color 180ms, color 180ms;
  font-family: var(--font-display);
}
.choice-btn:hover .choice-badge,
.choice-btn.is-selected .choice-badge {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-dark);
}

/* 선택지 텍스트 */
.choice-text {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  line-height: 1.6;
  word-break: keep-all;
  flex: 1;
}
.choice-btn.is-selected .choice-text {
  font-weight: var(--weight-semibold);
  color: var(--color-primary-deeper);
}


/* ══════════════════════════════════════════
   3. 결과 화면
   ══════════════════════════════════════════ */
.result-screen {
  padding: var(--space-4) 0 var(--space-10);
  justify-content: flex-start;
  flex: 1;
}


/* 결과 히어로 배너 */
.result-hero {
  position: relative;
  padding: var(--space-6) var(--space-6) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
  overflow: hidden;
}
.result-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.08;
  background-size: 20px 20px;
  background-image: radial-gradient(circle, var(--result-color, var(--color-primary)) 1.5px, transparent 1.5px);
}

/* 결과 유형 배지 */
.result-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--result-color, var(--color-primary));
  color: var(--result-fg, var(--color-dark));
  font-size: 11px;
  font-weight: var(--weight-extrabold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* 결과 이미지 */
.result-img-wrap {
  width: 200px;
  height: 200px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow:
    0 20px 56px rgba(0,0,0,0.15),
    0 0 0 5px rgba(255,255,255,0.8),
    0 0 0 7px var(--result-color, var(--color-primary));
  animation: resultPop 0.6s var(--ease-spring) both;
  flex-shrink: 0;
}
@keyframes resultPop {
  from { opacity: 0; transform: scale(0.7) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.result-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 결과 제목 */
.result-title {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 5vw, 1.65rem);
  font-weight: var(--weight-extrabold);
  color: var(--color-text-primary);
  line-height: 1.3;
  letter-spacing: -0.02em;
  word-break: keep-all;
}

/* 점수 표시 */
.result-score {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
}
.result-score-dots {
  display: flex;
  gap: 4px;
}
.score-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--color-surface-2);
  transition: background 300ms;
}
.score-dot.filled {
  background: var(--result-color, var(--color-primary));
}

/* 구분선 */
.result-divider {
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, var(--result-color, var(--color-primary)), transparent);
  border-radius: var(--radius-full);
  margin: var(--space-2) auto 0;
}

/* 분석 카드 */
.result-analysis {
  margin: var(--space-6) var(--space-5) 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
}
.result-analysis__title {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--result-color, var(--color-primary));
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.result-analysis__body {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.8;
  word-break: keep-all;
}

/* 특성 태그 */
.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.result-tag {
  background: rgba(255,255,255,0.8);
  border: 1.5px solid var(--result-color, var(--color-primary));
  color: var(--result-color, var(--color-primary));
  font-size: 12px;
  font-weight: var(--weight-bold);
  border-radius: var(--radius-full);
  padding: 5px 12px;
}

/* 하단 CTA 버튼 영역 */
.result-actions {
  display: flex;
  gap: var(--space-3);
  margin: var(--space-6) var(--space-5) 0;
}
.result-action-btn {
  flex: 1;
  height: 52px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  cursor: pointer;
  transition:
    transform var(--duration-fast) var(--ease-spring),
    box-shadow var(--duration-base) var(--ease-smooth);
}
.result-action-btn:hover { transform: translateY(-2px); }
.result-action-btn:active { transform: scale(0.97); }

.result-action-btn--retry {
  background: var(--color-surface);
  color: var(--color-text-primary);
  border: 1.5px solid var(--color-border-gray);
}
.result-action-btn--retry:hover {
  border-color: var(--color-primary);
  background: var(--color-surface-2);
}

.result-action-btn--share {
  background: var(--color-primary);
  color: var(--color-dark);
  box-shadow: 0 4px 16px rgba(45,223,200,0.40);
}
.result-action-btn--share:hover {
  box-shadow: 0 8px 24px rgba(45,223,200,0.55);
  background: var(--color-primary-dark);
  color: #fff;
}

/* 공유 성공 토스트 */
.share-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-dark);
  color: white;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 250ms var(--ease-smooth),
    transform 250ms var(--ease-spring);
  z-index: var(--z-toast);
  white-space: nowrap;
}
.share-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── SNS 공유 모달 ── */
.share-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: visibility 300ms;
  visibility: hidden;
}
.share-modal.is-active {
  visibility: visible;
}

.share-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 300ms ease;
}
.share-modal.is-active .share-modal__overlay {
  opacity: 1;
}

.share-modal__content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: var(--space-5) var(--space-5) calc(var(--space-6) + 12px);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  transition: transform 300ms cubic-bezier(0.25, 1, 0.5, 1);
}
.share-modal.is-active .share-modal__content {
  transform: translateY(0);
}

.share-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}
.share-modal__title {
  font-size: var(--text-md);
  font-weight: 800;
  color: var(--color-dark);
}
.share-modal__close-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}
.share-modal__close-btn:hover {
  color: var(--color-dark);
}

.share-modal__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4) 0;
  justify-items: center;
}

.share-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  width: 80px;
}
.share-item__icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s, box-shadow 0.2s;
}
.share-item:active .share-item__icon {
  transform: scale(0.92);
}

/* SNS 브랜드 컬러 적용 */
.share-item__icon--kakao {
  background: #FEE500;
  color: #3C1E1E;
}
.share-item__icon--blog {
  background: #03C75A;
  font-weight: bold;
}
.share-item__icon--band {
  background: #22C35E;
}
.share-item__icon--facebook {
  background: #1877F2;
}
.share-item__icon--twitter {
  background: #000000;
}
.share-item__icon--copy {
  background: #6B7280;
}

.share-item__icon svg {
  width: 24px;
  height: 24px;
}
.share-item__icon span {
  font-size: 19px;
  font-weight: 800;
}

.share-item__label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
}
