/* =========================================================
 * 최애사주 스타일
 * 글자 크기·색은 아래 :root 변수만 바꾸면 전체에 적용돼요.
 * ========================================================= */
@font-face { font-family: 'Presentation'; src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2404@1.0/Freesentation-3Light.woff2') format('woff2'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'Presentation'; src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2404@1.0/Freesentation-4Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Presentation'; src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2404@1.0/Freesentation-5Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Presentation'; src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2404@1.0/Freesentation-6SemiBold.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Presentation'; src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2404@1.0/Freesentation-7Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'OwnglyphYuntaeng'; src: url('https://cdn.jsdelivr.net/gh/Project-Noonnu/2608211801@font-160/font-160/%EC%98%A8%EA%B8%80%EC%9E%8E%20%EC%9C%A4%ED%83%B1%EC%B2%B4.woff2') format('woff2'); font-weight: 400; font-display: swap; }

:root {
  /* 색 */
  --c-text: #151515;
  --c-sub: #757575;
  --c-dummy: #999999;      /* 입력칸 안내 글씨 */
  --c-line: #d9d9d9;
  --c-graybox: #f5f5f5;
  --c-bg: #fefefe;
  --c-bg-pink: #fff9fb;
  --c-pill: #ffe3ec;
  --c-footer-line: #ffc4d6;
  --c-point: #ff8fb1;       /* 테스트별 포인트 색 */
  --c-disabled: #d9d9d9;
  --c-disabled-text: #9a9a9a;

  /* 글자 크기 */
  --fs-body: 15px;          /* 결과 본문 */
  --lh-body: 1.75;
  --fs-small: 12px;
  --fs-sec-title: 24px;     /* 윤탱체 섹션 제목 */
  --fs-btn: 17px;

  /* 글꼴 */
  --ff: 'Presentation', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  --ff-hand: 'OwnglyphYuntaeng', 'Presentation', sans-serif;

  --app-w: 430px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #f3eff0;
  color: var(--c-text);
  font-family: var(--ff);
  font-weight: 400;
  /* 글자가 단어 단위로 줄바꿈되게 */
  word-break: keep-all;
  overflow-wrap: break-word;
}
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#app {
  position: relative;
  max-width: var(--app-w);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--c-bg);
  box-shadow: 0 0 40px rgba(0, 0, 0, .04);
}

.screen { display: none; min-height: 100vh; min-height: 100dvh; }
.screen.is-active { display: flex; flex-direction: column; }

/* 흰 테두리 손글씨 제목 */
.outline-white {
  text-shadow:
    -2px -2px 0 #fff, 0 -2px 0 #fff, 2px -2px 0 #fff, 2px 0 0 #fff,
     2px  2px 0 #fff, 0  2px 0 #fff, -2px 2px 0 #fff, -2px 0 0 #fff,
     0 0 6px rgba(255, 255, 255, .9);
}

/* 공통 버튼 */
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 10px;
  font-size: var(--fs-btn);
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.98); }
.btn-pink { background: var(--c-point); }

/* 상단 로고 바 */
.top-bar {
  display: flex; align-items: center; justify-content: center;
  height: 53px;
  border-bottom: 1px solid var(--c-line);
  background: var(--c-bg);
  flex-shrink: 0;
}
.logo-btn { border: 0; background: none; padding: 8px; }
.logo-btn img { width: 70px; height: auto; }

/* ---------- 1. 메인 ---------- */
.screen-main { background: var(--c-bg-pink); }
.main-body {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  padding: 52px 26px 40px;
  text-align: center;
}
.pill {
  margin: 0;
  padding: 7px 18px;
  border-radius: 999px;
  background: var(--c-pill);
  font-size: 13px;
}
.main-title {
  margin: 12px 0 0;
  font-family: var(--ff-hand);
  font-weight: 400;
  font-size: 32px;
  line-height: 1.3;
  white-space: pre-line;
}
.main-char {
  margin-top: 52px;
  height: 200px;
  display: flex; align-items: center; justify-content: center;
}
.main-char img { width: auto; height: 200px; }
.btn-main { margin-top: 50px; }
.main-count { margin: 13px 0 0; font-size: 13px; }
.main-logo { margin-top: 40px; width: 70px; height: auto; }
.main-footer {
  display: flex; justify-content: space-between;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--c-footer-line);
  font-size: var(--fs-small);
}
.main-footer a { color: var(--c-text); }

/* ---------- 2. 입력 ---------- */
.input-body { display: flex; flex-direction: column; padding: 0 20px 48px; }
.input-title {
  margin: 47px 0 0;
  font-family: var(--ff-hand);
  font-weight: 400;
  font-size: 26px;
}
.input-sub { margin: 8px 0 0; font-size: 13px; color: var(--c-text); font-weight: 300; }
.field-label { margin: 32px 0 10px; font-size: 15px; font-weight: 600; display: block; }
.field {
  width: 100%;
  height: 52px;
  padding: 0 15px;
  border: 1px solid var(--c-line);
  border-radius: 12px;
  background: #fff;
  font-size: 16px; /* 16px보다 작으면 아이폰에서 확대됨 */
  color: var(--c-text);
  outline: none;
  -webkit-appearance: none; appearance: none;
}
.field::placeholder { color: var(--c-dummy); }
.field:focus { border-color: var(--c-point); }
.birth-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.field-error { margin: 8px 0 0; font-size: 13px; color: #e5486e; }

.mbti-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mbti-btn, .mbti-unknown {
  height: 46px;
  border: 1px solid var(--c-line);
  border-radius: 12px;
  background: #fff;
  font-size: 15px;
}
.mbti-unknown { margin-top: 8px; width: 100%; font-size: 14px; color: var(--c-sub); }
.mbti-btn[aria-pressed="true"], .mbti-unknown[aria-pressed="true"] {
  background: var(--c-point); border-color: var(--c-point); color: #fff; font-weight: 700;
}
.btn-submit {
  margin: 46px 6px 0;
  width: auto;
  background: var(--c-point);
}
.btn-submit:disabled { background: var(--c-disabled); color: var(--c-disabled-text); cursor: default; transform: none; }

/* ---------- 3. 로딩 ---------- */
.screen-loading { background: var(--c-bg-pink); }
.loading-body {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding-bottom: 40px;
}
.loading-body img { width: 192px; height: auto; }
.loading-text {
  margin: 36px 0 0;
  font-family: var(--ff-hand);
  font-size: 18px;
  letter-spacing: .04em;
}
.loading-text .dots { display: inline-block; width: 1.2em; text-align: left; }

/* ---------- 4. 결과 ---------- */
.result-card-wrap { padding: 40px 20px 0; }
.result-card {
  width: 100%;
  aspect-ratio: 1080 / 860;
  border-radius: 12px;
  background: var(--c-bg-pink);
  -webkit-touch-callout: default; /* 꾹 눌러 저장 허용 */
}
.result-card.is-ready { aspect-ratio: auto; background: none; border-radius: 0; }
.result-card[hidden] { display: none; }
/* 이미지 생성이 안 될 때 보이는 글자 카드 */
.result-card-html {
  padding: 26px 18px 30px;
  border: 1px solid var(--c-point); border-radius: 12px;
  background: var(--c-bg-pink);
  text-align: center;
}
.result-card-html[hidden] { display: none; }
.result-card-html p { margin: 0; }
.rc-title { font-size: 16px; font-weight: 700; }
.rc-title em { font-style: normal; color: var(--c-point); }
.rc-label { margin-top: 18px !important; font-size: 10px; color: var(--c-sub); }
.rc-score { font-family: var(--ff-hand); font-size: 30px; color: var(--c-point); }
.rc-body { margin-top: 16px !important; font-size: 13.5px; line-height: 1.7; white-space: pre-line; }
.save-btn {
  display: block;
  margin: 24px auto 0;
  width: 200px; height: 36px;
  border: 0; border-radius: 18px;
  background: var(--c-point); color: #fff;
  font-size: 14px; font-weight: 700;
}

.result-band { margin-top: 24px; padding: 40px 0 48px; background: var(--c-bg-pink); }
.result-sec { padding: 0 34px; text-align: center; }
.sec-title {
  margin: 0;
  font-family: var(--ff-hand);
  font-weight: 400;
  font-size: var(--fs-sec-title);
  text-align: center;
}
.sec-body {
  margin: 16px 0 0;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  white-space: pre-line;
}
.sec-divider { margin: 44px 32px; border: 0; border-top: 1px solid var(--c-point); }

.runner-wrap { padding: 40px 20px 0; }
.runner-wrap .sec-title { margin-bottom: 20px; }
.runner {
  margin-top: 12px;
  padding: 20px 18px 22px;
  background: var(--c-graybox);
}
.runner-head { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.runner-head img { width: 16px; height: auto; }
.runner-head strong { font-weight: 700; }
.runner-body { margin: 12px 0 0; font-size: var(--fs-body); line-height: var(--lh-body); }

.result-btns { display: flex; flex-direction: column; gap: 10px; padding: 24px 26px 0; }

.coupang { padding: 44px 20px 0; }
.coupang-title { margin: 0; font-family: var(--ff-hand); font-weight: 400; font-size: var(--fs-sec-title); }
.coupang-notice { margin: 8px 0 0; font-size: var(--fs-small); color: var(--c-sub); line-height: 1.5; }
.coupang-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.coupang-item { display: flex; flex-direction: column; gap: 8px; color: var(--c-text); text-decoration: none; }
.coupang-thumb {
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background: var(--c-line);
  overflow: hidden;
}
/* 쿠팡 배너(세로 1:2)에서 상품 사진 부분만 정사각으로 보이게 */
.coupang-thumb { background: #fff; border: 1px solid #eee; }
.coupang-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; }
.coupang-name {
  font-size: 13px; line-height: 1.4; text-align: center;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.result-bottom { padding: 40px 26px calc(40px + env(safe-area-inset-bottom)); }
.fun-note { margin: 20px 0 0; font-size: 11px; color: var(--c-dummy); text-align: center; }

/* ---------- 5. 다른 테스트 ---------- */
.others-char { display: flex; justify-content: center; padding: 20px 0 32px; }
.others-char img { width: 268px; height: auto; }
.others-list { display: flex; flex-direction: column; gap: 12px; padding: 0 20px 56px; }
.screen-others .main-footer { margin-top: auto; }
.main-logo-link { margin-top: 40px; display: block; }
.main-logo-link .main-logo { margin-top: 0; }
.other-card {
  display: flex; align-items: center; justify-content: center;
  height: 128px;
  border: 0;
  font-family: var(--ff-hand);
  font-size: 24px;
  line-height: 1.35;
  color: #fff;
  text-align: center;
  white-space: pre-line;
  text-decoration: none;
  transition: transform .12s ease;
}
.other-card:active { transform: scale(.98); }

/* 토스트 */
.toast {
  position: fixed; left: 50%; bottom: calc(32px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(21, 21, 21, .88); color: #fff;
  font-size: 14px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  white-space: nowrap;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .btn, .other-card, .toast { transition: none; }
}
