*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --text-xs: clamp(0.75rem, 0.9vw, 0.875rem);
  --text-body: clamp(0.9rem, 1.2vw, 1.05rem);
  --text-lg: clamp(1rem, 1.4vw, 1.3rem);
  --text-head: clamp(1.6rem, 2.8vw, 2.6rem);
}

html {
  background: #1c1c1e;
  overscroll-behavior: none;
}
html,
body {
  overscroll-behavior: none;
}

@property --o {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}

@keyframes ripple {
  from {
    --o: 0%;
  }
  to {
    --o: 80%;
  }
}

body {
  color: #e8e8e8;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* 물결 배경 — 예전에는 body의 background였다. body에 두면 8초짜리 --o
 * 애니메이션이 매 프레임 body 전체의 페인트를 무효화한다(이 페이지는 유리 블러가
 * 여럿이라 그 뒤 픽셀이 바뀔 때마다 블러도 다시 계산된다).
 * 이 페이지는 스크롤이 없어(body 높이 = 뷰포트) 뷰포트 크기의 고정 레이어가
 * 기존 body 배경과 정확히 같은 영역을 칠한다. */
#bg-ripple {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  animation: ripple 8s linear infinite;
  background: repeating-radial-gradient(
    ellipse 130vw 130vw at 50% 120%,
    #1c1c1e calc(0% + var(--o)),
    #2a2826 calc(20% + var(--o)),
    #1c1c1e calc(40% + var(--o)),
    #2a2826 calc(60% + var(--o)),
    #1c1c1e calc(80% + var(--o))
  );
  contain: paint;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    circle 300px at var(--mx, -9999px) var(--my, -9999px),
    #2a2826,
    transparent 70%
  );
}

.step {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 600ms ease;
}

.step.active {
  pointer-events: auto;
}

.step.visible {
  opacity: 1;
}

h1 {
  font-family: "PretendardNum", "ogg-text", "Pretendard", sans-serif;
  font-weight: 300;
  font-style: normal;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1.2;
  margin-bottom: 2.5rem;
}

.body-text {
  font-family: "PretendardNum", "ogg-text", "Pretendard", sans-serif;
  font-weight: 300;
  font-style: normal;
  font-size: var(--text-lg);
  line-height: 1.7;
  margin-bottom: 2.5rem;
}

/* 태블릿 (641~1024) — 본문 폭·여백 */
@media (max-width: 1024px) and (min-width: 641px) {
  .body-text {
    max-width: 40rem;
    margin-left: auto;
    margin-right: auto;
  }
  #step-7 input[type="text"] {
    width: min(28rem, 70vw) !important;
  }
}

.anonymous {
  font-family: "PretendardNum", "ogg-text", "Pretendard", sans-serif;
  font-weight: 300;
  font-style: normal;
  font-size: 0.78rem;
  opacity: 0.45;
  margin-bottom: 1rem;
}

/* step-7 "이 설문은 완전히 익명입니다" — 기본(데스크탑) 크기 */
#step-7 .anonymous {
  font-size: 1.3rem;
}

#answer {
  width: 100%;
  padding: 1.1rem 2rem;
  border-radius: 999px;
  border: none;
  background: rgba(140, 140, 140, 0.38);
  color: #e8e8e8;
  font-family: "PretendardNum", "ogg-text", "Pretendard", sans-serif;
  font-weight: 300;
  font-style: normal;
  font-size: 1rem;
  outline: none;
  margin-bottom: 1.5rem;
  text-align: left;
}

#answer::placeholder {
  color: rgba(232, 232, 232, 0.5);
}

button {
  font-family: "PretendardNum", "ogg-text", "Pretendard", sans-serif;
  font-weight: 300;
  font-style: normal;
  font-size: 1rem;
  padding: 0.75rem 2rem;
  border-radius: 999px;
  border: none;
  background: rgba(0, 0, 0, 0.15);
  color: #f0f0f0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition:
    background 200ms ease,
    transform 200ms ease;
}

button:hover {
  background: rgba(0, 0, 0, 0.22);
}

button:active {
  transform: translateY(1px);
  background: rgba(0, 0, 0, 0.28);
}

button:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* 3D model loading dots */
.model-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.model-loader.hidden {
  opacity: 0;
}
.model-loader span {
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: rgba(28, 28, 30, 0.4);
  animation: dot-pulse 1.2s ease-in-out infinite;
}
.model-loader span:nth-child(2) {
  animation-delay: 0.2s;
}
.model-loader span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes dot-pulse {
  0%,
  80%,
  100% {
    transform: scale(0.7);
    opacity: 0.3;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}
.canvas-wrap {
  position: relative;
}

/* info 버튼 — 글로벌 button 스타일 재정의 */
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50% !important;
  border: 1px solid rgba(232, 232, 232, 0.45) !important;
  background: transparent !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
  color: rgba(232, 232, 232, 0.6);
  font-size: 0.72rem;
  font-style: italic;
  line-height: 1;
  cursor: help;
  padding: 0 !important;
  margin-left: 0.45rem;
  flex-shrink: 0;
  position: relative;
  transition:
    border-color 150ms,
    color 150ms !important;
  transform: none !important;
  padding-right: 0.1em !important;
}
.info-btn:hover {
  background: transparent !important;
  border-color: rgba(232, 232, 232, 0.8) !important;
  color: #e8e8e8;
  transform: none !important;
}
.info-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 0.6rem);
  left: 50%;
  transform: translateX(-50%);
  width: 16rem;
  background: rgba(18, 18, 20, 0.94);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(232, 232, 232, 0.88);
  font-family: "PretendardNum", "ogg-text", "Pretendard", sans-serif;
  font-weight: 300;
  font-size: 0.8125rem;
  line-height: 1.55;
  padding: 0.8rem 1rem;
  border-radius: 0.875rem;
  pointer-events: none;
  text-align: left;
  white-space: normal;
  z-index: 20;
}
/* 실제 마우스 호버 기기에서만 :hover로 노출 — 터치 기기는 JS의 .open
   토글로만 제어해, 탭 후 :hover가 눌어붙어 안 닫히는 문제를 피한다 */
@media (hover: hover) {
  .info-btn:hover .info-tooltip {
    display: block;
  }
}
.info-btn.open .info-tooltip {
  display: block;
}

/* kit card: 3D 오브제 + 토글 그룹 */
.kit-card {
  background: rgba(255, 255, 255, 0.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  border-radius: 1.5rem;
  padding: 1.25rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

#three-canvas {
  border-radius: 1rem;
  display: block;
  opacity: 0;
  transition: opacity 0.8s ease;
}
#three-canvas.loaded {
  opacity: 1;
}

/* pill 슬라이드 토글 */
.kit-toggle {
  position: relative;
  display: inline-flex;
  background: rgba(12, 12, 14, 0.88);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 4px;
  gap: 0;
}
.kit-toggle-slider {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  background: rgba(240, 240, 240, 0.96);
  border-radius: 999px;
  transition: transform 260ms cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 0;
}
.kit-toggle[data-selected="no"] .kit-toggle-slider {
  transform: translateX(100%);
}
.kit-opt {
  position: relative;
  z-index: 1;
  /* 예/아니오 라벨 폭 차이 보정 — flex 균등폭으로 50% 슬라이더 정렬 유지 (EN과 동일 비례) */
  flex: 1;
  min-width: 4.5rem;
  padding: 0.65rem 2.4rem;
  border-radius: 999px;
  border: none;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.4);
  font-family: "Pretendard", sans-serif;
  font-weight: 400;
  font-size: 1rem;
  cursor: pointer;
  transition: color 200ms;
  white-space: nowrap;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  text-align: center;
}
.kit-opt:hover {
  background: transparent !important;
}
.kit-opt.selected {
  color: #1c1c1e;
}
/* 슬라이더는 선택 전에도 기본으로 "yes" 자리에 있으므로, 라벨 색도
   .selected 클래스가 붙기 전부터 슬라이더 위치를 따라가야 흰 배경에
   흰 텍스트가 겹치지 않는다. */
.kit-toggle:not([data-selected="no"]) .kit-opt[data-kit="yes"],
.kit-toggle[data-selected="no"] .kit-opt[data-kit="no"] {
  color: #1c1c1e;
}

.step-container {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* step-6: 카드를 버튼 위 공간에 배치 */
#step-6 {
  justify-content: center;
  padding-bottom: 6rem;
}

.btn-wrapper {
  position: fixed;
  bottom: 13.65rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 0.625rem;
  justify-content: center;
}

.kit-nav {
  display: flex;
  gap: 0.625rem;
  justify-content: center;
}

.dots {
  position: fixed;
  bottom: 3.75rem;
  left: 50%;
  transform: translateX(-50%);
}

.btn-wrapper button {
  /* 그리드 한 컬럼 너비 (입력창과 동일한 12컬럼 기준) */
  width: max(
    5rem,
    calc((100vw - 2 * clamp(1rem, 3vw, 2.5rem) - 6.875rem) / 12)
  );
  padding-left: 0;
  padding-right: 0;
  flex: none;
}

#btn-next.is-submit {
  background: rgba(255, 255, 255, 0.18);
  border: none;
  color: #ffffff;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

#btn-next.is-submit:hover {
  background: rgba(255, 255, 255, 0.26);
  border: none;
  color: #ffffff;
}

.btn-prev {
  display: none;
}

.btn-prev.visible {
  display: inline-block;
}

.btn-wrapper button {
  font-family: "Pretendard", sans-serif;
}

.dots {
  display: flex;
  gap: 0.5rem;
}

/* dots position override above; keeping flex display */

.dot {
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: rgba(232, 232, 232, 0.25);
  transition: background 300ms;
  cursor: pointer;
}

.dot.active {
  background: rgba(232, 232, 232, 0.85);
}

/* 모바일 오버라이드 — .btn-wrapper/.dots/#step-6 기본 규칙보다 뒤에 와야
   동일 우선순위에서 실제로 적용된다 (앞에 있으면 아래 기본 규칙에 덮임) */
@media (max-width: 640px) {
  .body-text {
    max-width: 34rem;
    text-wrap: balance;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
  .body-text br {
    display: none;
  }
  /* step-7 anonymous 문구 — 모바일에서 데스크탑의 절반 크기로 */
  #step-7 .anonymous {
    font-size: 0.65rem;
  }
  /* 버튼/dots 위치 — 모바일에서 아래쪽으로 내려 콘텐츠 공간 확보 */
  .btn-wrapper {
    bottom: 6rem;
  }
  .dots {
    bottom: 2.5rem;
  }
  #step-6 {
    padding-bottom: 9rem;
  }
  /* 입력창 너비 — 모바일에서 90vw 고정 */
  #step-7 input[type="text"] {
    width: 90vw !important;
  }
  /* step-6 캔버스 크기 — JS에서도 제어하지만 CSS로도 제약 */
  #three-canvas {
    max-width: calc(100vw - 4rem);
  }
  /* info tooltip 방향 — 폰에서 화면 밖으로 안 나가도록.
     "i" 버튼이 화면 위쪽에 있어 위로 열면 상단이 잘리므로 아래로 연다. */
  .info-tooltip {
    left: auto;
    right: 0;
    transform: none;
    bottom: auto;
    top: calc(100% + 0.6rem);
  }
}
