/* ============================================
   컴포넌트 — 2단계 이후(입력 폼/결과 카드 등)에서 채워나갈 파일
   1단계에서는 화면 전환 유틸리티만 정의
   ============================================ */

.screen { display: block; }
[hidden] { display: none !important; }

.placeholder-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  color: var(--sub);
}

/* ============================================
   입력 폼 공통
   ============================================ */

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
}

.form-group { margin-bottom: 20px; }
.form-group:last-of-type { margin-bottom: 24px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-row > .form-group { min-width: 0; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

.form-hint {
  font-size: 12px;
  color: var(--sub);
  margin: 8px 0 0;
}

/* 출생 도시 자동완성 (OpenStreetMap) */
.city-autocomplete { position: relative; }
.city-suggestions {
  position: absolute;
  z-index: 10;
  left: 0;
  right: 0;
  margin: 4px 0 0;
  padding: 6px;
  list-style: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  max-height: 240px;
  overflow-y: auto;
}
.city-suggestions__item {
  padding: 10px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.city-suggestions__item:hover,
.city-suggestions__item:focus {
  background: var(--surface);
  color: var(--primary-hover);
}
.footer-attribution { font-size: 11px; color: var(--sub); opacity: .7; margin-top: 4px; }

.text-field,
.select-field {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 12px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 14px;
}
.text-field:focus,
.select-field:focus {
  outline: none;
  border-color: var(--primary);
}
.select-field {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%239B9B9B'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  padding-right: 34px;
}

/* 생년월일 입력: 연(4자리) / 월(2자리) / 일(2자리) 분리 입력 */
.date-input-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.date-field {
  width: auto;
  min-width: 0;
  text-align: center;
  letter-spacing: .04em;
}
.date-field--year { flex: 1.3; }
.date-field--month,
.date-field--day { flex: 1; }
.date-sep { color: var(--sub); font-weight: 600; }

/* 세그먼트 토글 (성별 / 양·음력 / 관계유형) */
.segmented {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.segmented__btn {
  flex: 1;
  padding: 10px 8px;
  border: none;
  border-right: 1px solid var(--border);
  background: var(--bg);
  color: var(--sub);
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.segmented__btn:last-child { border-right: none; }
.segmented__btn:hover { color: var(--text); }
.segmented__btn.is-active { background: var(--primary); color: #fff; }

/* 라디오 카드 (주손 선택) */
.radio-card-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.radio-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  font-family: 'Noto Sans KR', sans-serif;
}
.radio-card strong { color: var(--text); font-size: 14px; }
.radio-card span { color: var(--sub); font-size: 12px; line-height: 1.5; }
.radio-card:hover { border-color: var(--primary); }
.radio-card.is-active { border-color: var(--primary); background: rgba(35, 131, 226, .12); }
.radio-card.is-active strong { color: var(--primary-hover); }

/* 파일 업로드 (손 사진) */
.file-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 16px;
  color: var(--sub);
  font-size: 13px;
  cursor: pointer;
  text-align: center;
}
.file-upload:hover { border-color: var(--primary); color: var(--text); }
.file-upload .icon { width: 28px; height: 28px; color: var(--sub); }

.file-preview {
  position: relative;
  margin-top: 12px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.file-preview img { display: block; width: 100%; max-height: 240px; object-fit: cover; }
.file-preview .icon-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.file-preview .icon-btn .icon { width: 16px; height: 16px; }

/* 궁합 보기: 섹션 구분 */
.form-section {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.form-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.form-section h3 { font-size: 15px; margin: 0 0 12px; }
.form-section__header h3 { margin: 0; }

.btn--sm { padding: 8px 14px; font-size: 12px; box-shadow: none; }

.form-submit-btn { width: 100%; }

/* ============================================
   로딩 화면
   ============================================ */

.loading-screen {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 56px 20px 40px;
  text-align: center;
}

.loading-spinner {
  position: relative;
  width: 84px;
  height: 84px;
  margin: 0 auto 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.spinner-ring {
  position: absolute;
  inset: 0;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.spinner-icon .icon { width: 38px; height: 38px; color: var(--primary); }

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-message {
  min-height: 24px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 32px;
  transition: opacity .2s;
}

.ad-slot {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 16px;
  color: var(--sub);
  font-size: 12px;
  letter-spacing: .05em;
}

.result-back-btn { display: block; margin: 16px auto 0; }

/* ============================================
   결과 화면 공통
   ============================================ */

.result-panel__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 16px;
}

.result-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}
.result-section:last-of-type { margin-bottom: 0; }
.result-section__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 14px;
}
.result-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.7;
  margin: 0;
}

/* 오행 오각형(레이더) 차트 — 축구 게임 능력치 그래프 스타일 */
.five-elements__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.five-elements__header .result-section__title { margin: 0; }

.five-elements {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  transition: gap .3s ease;
}
.five-elements__chart-wrap {
  flex-shrink: 0;
  width: 100%;
  max-width: 280px;
  transition: max-width .3s ease;
}
.five-elements__radar { width: 100%; display: block; }
.radar-grid { fill: none; stroke: var(--border); stroke-width: 1; }
.radar-shape { fill: rgba(35, 131, 226, .35); stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; }
.radar-dot { fill: var(--primary); }
.radar-label { fill: var(--text); font-size: 11px; font-family: 'Noto Sans KR', sans-serif; font-weight: 500; }
.radar-value { fill: var(--sub); font-size: 10px; font-family: 'Noto Sans KR', sans-serif; }

.five-elements__detail {
  flex: 1;
  min-width: 0;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width .3s ease, opacity .25s ease;
}
.five-elements__detail.is-wrapped { white-space: normal; }
.five-elements.is-expanded { gap: 20px; }
.five-elements.is-expanded .five-elements__chart-wrap { max-width: 190px; }
.five-elements.is-expanded .five-elements__detail { max-width: 380px; opacity: 1; }

.element-detail-item { margin-bottom: 12px; }
.element-detail-item:last-child { margin-bottom: 0; }
.element-detail-item__head { display: flex; align-items: baseline; gap: 6px; margin-bottom: 2px; }
.element-detail-item__head strong { font-size: 13px; color: var(--text); }
.element-detail-item__head span { font-size: 11px; color: var(--sub); }
.element-detail-item p { font-size: 12px; color: var(--sub); margin: 0; line-height: 1.5; }

@media (max-width: 480px) {
  .five-elements.is-expanded { flex-direction: column; align-items: stretch; }
  .five-elements.is-expanded .five-elements__chart-wrap { max-width: 220px; margin: 0 auto; }
  .five-elements.is-expanded .five-elements__detail { max-width: none; }
}

/* 신살 태그 */
.sinsal-item { margin-bottom: 14px; }
.sinsal-item:last-child { margin-bottom: 0; }
.sinsal-item p { margin: 6px 0 0; font-size: 13px; color: var(--sub); line-height: 1.5; }
.tag {
  display: inline-block;
  background: rgba(35, 131, 226, .15);
  color: var(--primary-hover);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
}

/* 손가락으로 넘기는 스와이프 카드 (오늘의 운세 / 핵심 운세 공용) */
.card-carousel { position: relative; }
.card-carousel__track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 4px;
  margin: 0 -20px;
  padding-left: 20px;
  padding-right: 20px;
}
.card-carousel__track::-webkit-scrollbar { display: none; }
.card-carousel__dots { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); transition: background .15s; }
.dot.is-active { background: var(--primary); }

.card-carousel__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
.card-carousel__nav:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.card-carousel__nav:disabled { opacity: .3; cursor: not-allowed; }
.card-carousel__nav:disabled:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.card-carousel__nav .icon { width: 18px; height: 18px; }
.card-carousel__nav--prev { left: 2px; }
.card-carousel__nav--next { right: 2px; }

.daily-card {
  flex: 0 0 180px;
  scroll-snap-align: start;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.daily-card__label { font-size: 12px; color: var(--sub); }
.daily-card__score { font-size: 32px; font-weight: 700; color: var(--primary); margin: 8px 0; }
.daily-card__score small { font-size: 14px; color: var(--sub); font-weight: 500; }
.daily-card__swatch { width: 40px; height: 40px; border-radius: 50%; margin: 8px auto; }
.daily-card p { font-size: 12px; color: var(--text); margin: 8px 0 0; line-height: 1.5; }

.fortune-card {
  flex: 0 0 220px;
  scroll-snap-align: start;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.fortune-card__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.fortune-card__head .icon { width: 20px; height: 20px; color: var(--primary); }
.fortune-card__head strong { font-size: 14px; color: var(--text); }
.fortune-card p { font-size: 13px; color: var(--sub); margin: 0; line-height: 1.6; }

/* 대운 타임라인 */
.daeun-timeline { list-style: none; margin: 0; padding: 0; }
.daeun-timeline li { position: relative; padding-left: 36px; padding-bottom: 20px; }
.daeun-timeline li:last-child { padding-bottom: 0; }
.daeun-timeline li::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 26px;
  bottom: -4px;
  width: 2px;
  background: var(--border);
}
.daeun-timeline li:last-child::before { display: none; }
.daeun-age {
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.daeun-theme { display: block; font-size: 13px; color: var(--text); line-height: 1.5; padding-top: 2px; }

/* 손금 4대 분석 (아이콘 + 제목 + 설명 리스트) */
.icon-list { display: flex; flex-direction: column; gap: 16px; }
.icon-list__item { padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.icon-list__item:last-child { border-bottom: none; padding-bottom: 0; }
.icon-list__head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.icon-list__head .icon { width: 20px; height: 20px; color: var(--primary); }
.icon-list__head strong { font-size: 14px; color: var(--text); }
.icon-list__item p { font-size: 13px; color: var(--sub); margin: 0; line-height: 1.6; }

/* 손금 사진 위에 4대 선을 색깔로 겹쳐 그린 오버레이 + 아래 결과와 색을 맞추는 동그란 점 */
.palm-photo {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 16px;
  line-height: 0;
}
.palm-photo img { display: block; width: 100%; height: auto; }
.palm-photo__overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.palm-photo__note { font-size: 12px; color: var(--sub); text-align: center; margin-top: 8px; }
.palm-line-glow {
  fill: none;
  stroke-width: 4.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  opacity: .35;
  filter: blur(2.5px);
}
.palm-line-stroke {
  fill: none;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  opacity: .95;
}
.line-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* 손금 입력 탭: "이렇게 찍어주세요" 예시 일러스트 */
.palm-example {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
}
.palm-example__art { width: 76px; height: 96px; flex-shrink: 0; }
.palm-example__text { font-size: 12px; color: var(--sub); line-height: 1.6; }

/* 궁합 점수 링 */
.result-section--score { text-align: center; }
.score-ring { position: relative; width: 140px; height: 140px; margin: 0 auto 12px; }
.score-ring svg { width: 100%; height: 100%; }
.score-ring__value { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 700; color: var(--text); }

/* ============================================
   결과 공유 (카카오톡 공유 / 친구 초대) — 바이럴 요소
   ============================================ */

.share-preview { margin-bottom: 16px; }
.share-preview__label { display: block; font-size: 11px; color: var(--sub); margin-bottom: 8px; }
.share-preview__card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.share-preview__logo { flex-shrink: 0; }
.share-preview__logo .icon { width: 32px; height: 32px; color: var(--primary); }
.share-preview__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.share-preview__text strong { font-size: 13px; color: var(--text); line-height: 1.4; }
.share-preview__text span { font-size: 11px; color: var(--sub); }

.share-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.share-btn { flex: 1; min-width: 160px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.share-btn .icon { width: 18px; height: 18px; }

/* 하단 안내용 토스트 메시지 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(10px);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 13px;
  box-shadow: var(--shadow-card);
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 100;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
