/* ---------- 첫 화면~분석 중(index.html) ----------
   색·글꼴·바탕·로고·단추는 theme.css(먼저 불러옴)에 있고, 여기에는 이 화면들의 모양만 둡니다.
   밝은 미색 한지 화면: 글은 먹색, 주 단추는 다홍, 그림 위에 글을 올릴 때는 한지 막을 깝니다. */

.page { min-height: 100svh; overflow: hidden; }

/* ---------- 위 로고·뒤로 ---------- */
.top {
  position: absolute; inset: 0 0 auto 0; z-index: 3;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 13px) 20px 13px;   /* 홈페이지 머리 줄과 같은 자리(위 13px·왼쪽 20px) */
}
.back {
  display: grid; place-items: center; width: 36px; height: 36px; margin-left: -8px;
  border: 0; border-radius: 50%; background: none; color: var(--ink);
  transition: transform 0.16s var(--ease-out), opacity 0.16s ease;
}
.back:active { transform: scale(0.88); opacity: 0.6; }

/* ---------- 첫 화면 ----------
   겨울 대청마루 아씨 그림(2:3)이 화면을 채우고(긴 휴대폰에서는 양옆이 잘림), 아래 한지 막 위에 글과 시작 단추를 둡니다.
   인생손금 첫 화면과 같은 짜임입니다: 위 문구는 송명체 먹색, 제목은 송명체 먹 글씨를 구운 그림, 보조 문구는 한 줄, 단추 끝에 꺾쇠. */
.hero { position: relative; min-height: 100svh; }
.hero-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.hero-copy {
  position: absolute; inset: auto 0 0 0; z-index: 1;
  padding: 0 24px max(34px, calc(env(safe-area-inset-bottom) + 20px));
  text-align: center;
}
.hero-copy::before {
  content: ""; position: absolute; inset: -120px 0 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(245, 238, 227, 0), rgba(245, 238, 227, 0.7) 30%, rgba(245, 238, 227, 0.92) 50%, rgba(245, 238, 227, 0.97));
}
.kicker {
  margin: 0; color: var(--ink); font-family: "Song Myung", serif; font-size: 20px; font-weight: 400; line-height: 1.25; letter-spacing: 0.06em;
  text-shadow: 0 0 8px rgba(245, 238, 227, 0.95), 0 0 18px rgba(245, 238, 227, 0.9);
}
/* 제목 '신년손금' 글자 그림(1078×363을 359.3px로, 획 끝 바램과 옅은 그림자를 구움). 글자 위아래의 빛 번짐 자리(22px)만큼 당겨
   위 문구와 글자 사이를 5px, 글자와 보조 문구 사이를 17px로 둡니다(궁합손금·인생손금 첫 화면과 같은 간격). */
.hero h1 { margin: 0; line-height: 0; }
.title-art {
  --tw: min(359.3px, calc((100vw - 8px) * 359.3 / 360.3));   /* 좁은 폰에서는 세 상품 제목이 같은 비율로 줄게 가장 넓은 궁합손금(360.3px)에 맞춤 */
  display: block; width: var(--tw); max-width: none; height: auto;
  margin: calc(var(--tw) * -17 / 359.3) 0 calc(var(--tw) * -5.5 / 359.3) calc((100% - var(--tw)) / 2);
}
.sub { margin: 0 0 12px; font-size: 15px; font-weight: 400; line-height: 1.2; letter-spacing: -0.4px; color: var(--ink-2); white-space: nowrap; }
.sub em { font-style: normal; color: var(--red); font-weight: 700; }
.hero .cta svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* 첫 화면 글은 위에서부터 차례로 떠오름 */
.rise > * { animation: rise-in 0.6s var(--ease-out) both; }
.rise > :nth-child(2) { animation-delay: 0.08s; }
.rise > :nth-child(3) { animation-delay: 0.16s; }
.rise > :nth-child(4) { animation-delay: 0.24s; }
.rise > :nth-child(5) { animation-delay: 0.32s; }
.rise > :nth-child(6) { animation-delay: 0.4s; }
@keyframes rise-in { from { opacity: 0; transform: translateY(12px); } }

/* ---------- 인사부터: 대청마루에 앉은 아씨 그림 한 장 위에 대사와 입력 ----------
   그림(아래 30%는 빈 마루)이 첫 화면처럼 화면을 채우고, 빈 마루 위에 대사와 단추가 올라옵니다. */
.flow { position: relative; min-height: 100svh; overflow: hidden; }
.flow-art {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top;
  transition: filter 0.5s ease, transform 0.5s ease, opacity 0.45s ease;
}
/* 입력 단계(이름·연애 상태·손·촬영·사진 확인)는 그림을 흐리게 하고 그 위에 한지 막을 깝니다. 분석 중은 분석 그림으로 바뀝니다. */
.flow::after {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: var(--veil); opacity: 0; transition: opacity 0.45s ease;
}
.page[data-step="name"] .flow-art,
.page[data-step="love"] .flow-art,
.page[data-step="hand"] .flow-art,
.page[data-step="shoot"] .flow-art,
.page[data-step="confirm"] .flow-art { filter: blur(14px); transform: scale(1.08); }
.page[data-step="name"] .flow::after,
.page[data-step="love"] .flow::after,
.page[data-step="hand"] .flow::after,
.page[data-step="shoot"] .flow::after,
.page[data-step="confirm"] .flow::after { opacity: 1; }
.page[data-step="reading"] .flow-art { opacity: 0; }
/* 시작 단추를 누르면 첫 화면이 인사 그림 위에 그대로 있다가 사라집니다(내손내운과 같음). */
.page.fading .flow { z-index: 0; }
.page.fading .hero { position: absolute; inset: 0; z-index: 1; min-height: 0; pointer-events: none; }
.page.fading .back { opacity: 0; }
.page.fade-go .hero { opacity: 0; transition: opacity 0.52s ease; }
.page.fade-go .back { opacity: 1; transition: opacity 0.52s ease; }

.step {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  min-height: 100svh;
  padding: 76px 24px max(28px, calc(env(safe-area-inset-bottom) + 20px));
}
/* 단계 안 조각은 위에서부터 차례로 올라옵니다(제목 → 칸이나 고르기 → 단추). */
.step > * { animation: rise-in 0.5s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--n, 0) * 70ms); }
.step > :nth-child(2) { --n: 1; }
.step > :nth-child(3) { --n: 2; }
.step > :nth-child(4) { --n: 3; }
.step > :nth-child(5) { --n: 4; }
.step > :nth-child(6) { --n: 5; }
.step > :nth-child(n+7) { --n: 6; }

/* 인사: 아씨 아래 한지 위에 대사가 한 줄씩 써지고 단추가 올라옵니다. */
.step-greet { justify-content: flex-end; }
.step-greet > .talk { animation: none; }
.step-greet > .cta { animation-delay: 1.2s; }
.talk { position: relative; margin-bottom: 30px; text-align: center; }
/* 대사 뒤 한지 막(그림이 대사 자리에 걸쳐도 글이 또렷하게) */
.talk::before {
  content: ""; position: absolute; inset: -56px -24px -400px; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(245, 238, 227, 0), var(--veil) 40%, var(--paper) 72%);
}
.line {
  margin: 0; color: var(--ink); font-family: var(--font-say); font-size: 17px; font-weight: 700; line-height: 1.65;
  letter-spacing: -0.2px; word-break: keep-all;
}
.line + .line { margin-top: 14px; }
.line .say-in { display: inline-block; }
.say-in, .reading-line.swap {
  -webkit-mask-image: linear-gradient(90deg, #000 45%, transparent 55%); mask-image: linear-gradient(90deg, #000 45%, transparent 55%);
  -webkit-mask-size: 260% 100%; mask-size: 260% 100%;
}
.say-in { animation: write-in 0.6s ease both; animation-delay: calc(0.12s + var(--i, 0) * 0.26s); }
@keyframes write-in {
  from { opacity: 0.2; transform: translateY(4px); -webkit-mask-position: 100% 0; mask-position: 100% 0; }
  to { opacity: 1; transform: none; -webkit-mask-position: 0 0; mask-position: 0 0; }
}

.step-title {
  margin: 0; color: var(--ink); font-family: var(--font-say); font-size: 21px; font-weight: 700; line-height: 1.45;
  letter-spacing: -0.3px; word-break: keep-all;
}

/* 이름 · 성별 · 생년월일 */
.step-form .step-title { margin: 18px 0 30px; }
.field { margin-bottom: 16px; }
.field label, .field .field-label { display: block; margin: 0 0 4px; color: var(--ink); font-size: 15px; font-weight: 700; }
/* 성별: 손 고르기와 같은 단추를 낮게 둘 */
.sex-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.field input {
  display: block; width: 100%; height: 46px; padding: 0 2px;
  border: 0; border-bottom: 1.5px solid rgba(43, 29, 18, 0.28); border-radius: 0;
  background: transparent; color: var(--ink); font: inherit; font-size: 17px; outline: none;
  transition: border-color 0.2s ease;
}
.field input::placeholder { color: var(--ink-3); }
.field input:focus { border-bottom-color: var(--red); }
.field input[aria-invalid="true"] { border-bottom-color: var(--red); }
.field-error { min-height: 20px; margin: 6px 0 0; color: var(--red); font-size: 13px; font-weight: 600; line-height: 20px; }
.shake { animation: shake 0.42s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }
.step-form .cta { margin-top: auto; }

/* 손 고르기: 고르면 찍을 손이 그림과 함께 나옵니다 */
.hand-name { margin: 8px 0 4px; color: var(--red); font-size: 15px; font-weight: 700; word-break: break-all; }
.hand-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 22px 0 14px; }
.hand-choice, .sex-choice {
  min-height: 64px; padding: 8px;
  border: 1px solid rgba(43, 29, 18, 0.16); border-radius: 12px; background: var(--card); box-shadow: var(--shadow-sm);
  color: var(--ink); font-size: 17px; font-weight: 700;
  transition: transform 0.15s ease, border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
.sex-choice { min-height: 46px; font-size: 16px; }
.hand-choice:active, .sex-choice:active { transform: scale(0.97); }
.hand-choice[aria-pressed="true"], .sex-choice[aria-pressed="true"] { border-color: var(--red); background: var(--red-soft); color: var(--red-2); box-shadow: inset 0 0 0 1px var(--red); }
.step-love { padding-bottom: 24px; }
.love-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.love-choices .hand-choice { padding-inline: 4px; }
.love-period { margin-top: 4px; }
.love-prompt { margin: 0 0 10px; font: 700 17px/1.4 var(--sans); color: var(--ink); }
.love-period-choices { margin: 0 0 18px; gap: 8px 10px; }
.love-period-choices .hand-choice { min-height: 52px; }
.love-next { margin-top: auto; }
.sex-choices[aria-invalid="true"] .sex-choice { border-color: var(--red); }
.hand-pick {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px 12px 12px;
  border: 1px solid rgba(183, 134, 44, 0.45); border-radius: 14px; background: var(--card); box-shadow: var(--shadow-sm);
  animation: pick-in 0.35s ease both;
}
@keyframes pick-in { from { opacity: 0; transform: translateY(8px); } }
.hand-pic { position: relative; flex: none; width: 64px; height: 80px; border-radius: 10px; background: linear-gradient(180deg, #f7ecdf, #e6d3bd); overflow: hidden; }
.hand-pic img { position: absolute; left: 50%; top: 56%; width: 92%; height: auto; translate: -50% -50%; transition: transform 0.4s ease; }
.hand-pick[data-hand="right"] .hand-pic img { transform: scaleX(-1); }
.hand-shoot { margin: 0; color: var(--ink); font-size: 17px; font-weight: 700; line-height: 1.4; word-break: keep-all; }
.hand-shoot b { color: var(--red); }
.hand-why { margin: 14px 4px 0; color: var(--ink-2); font-size: 14.5px; font-weight: 500; line-height: 1.5; word-break: keep-all; animation: pick-in 0.35s ease both; }
.hand-pick[hidden] + .hand-why { display: none; }
.hand-next { margin-top: auto; }

/* 촬영 안내: 좋은 손바닥 사진 예시(오른손이면 좌우로 뒤집음), 그 아래 세 가지 */
.step-camera { padding-bottom: max(20px, calc(env(safe-area-inset-bottom) + 16px)); }
.cam-title { font-size: 18px; }
.cam-frame {
  position: relative; flex: 1; min-height: 220px; margin-top: 12px;
  border-radius: 14px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--rule); overflow: hidden;
}
.shot-example { position: absolute; inset: 14px; margin: 0; display: flex; align-items: center; justify-content: center; }
.shot-phone {
  position: relative; height: 100%; max-width: 100%; aspect-ratio: 9 / 16;
  border: 3px solid rgba(43, 29, 18, 0.82); border-radius: 22px;
  background: linear-gradient(180deg, #f7ecdf, #e6d3bd); overflow: hidden; box-shadow: var(--shadow);
}
.shot-phone img {
  position: absolute; left: 50%; top: 52%; width: 80%; height: auto; transform: translate(-50%, -50%);
  -webkit-mask-image: linear-gradient(to bottom, #000 74%, transparent 94%); mask-image: linear-gradient(to bottom, #000 74%, transparent 94%);
}
.step-camera[data-hand="right"] .shot-phone img { transform: translate(-50%, -50%) scaleX(-1); }
.shot-ok { position: absolute; top: 10px; left: 10px; padding: 3px 9px; border-radius: 999px; background: var(--green); color: #fff; font-size: 12px; font-weight: 800; animation: ok-pop 0.5s cubic-bezier(.2, .8, .2, 1.4) 0.45s both; }
@keyframes ok-pop { from { opacity: 0; transform: scale(0.4); } }
.shot-tips { display: grid; gap: 5px; margin: 12px 2px 14px; padding: 0; list-style: none; }
.shot-tips li { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14.5px; line-height: 1.4; animation: rise-in 0.45s ease both; }
.shot-tips li::before { content: "✓"; color: var(--red); font-weight: 800; }
.shot-tips li:nth-child(1) { animation-delay: 0.3s; }
.shot-tips li:nth-child(2) { animation-delay: 0.42s; }
.shot-tips li:nth-child(3) { animation-delay: 0.54s; }
.cam-actions { display: grid; gap: 8px; }
/* 사진 확인의 두 단추는 한 줄에 놓고(글은 한 줄로), 너무 좁을 때만 두 줄로 내립니다(내손내운 첫 화면과 같음). */
.cam-actions.two { display: flex; flex-wrap: wrap; }
.cam-actions.two .cta { flex: 1 1 auto; width: auto; padding: 0 14px; white-space: nowrap; }
.cam-actions.two .cta.shine { flex-grow: 2; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* 사진 확인: 금박 모서리가 사진을 조준하듯 좁혀 옵니다(다음 화면의 금빛 고리) */
.cam-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; animation: photo-in 0.5s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes photo-in { from { opacity: 0; transform: scale(1.06); } }
.step-confirm .cam-frame::after {
  content: ""; position: absolute; pointer-events: none;
  top: calc(var(--py, 0px) + 10px); bottom: calc(var(--py, 0px) + 10px); left: calc(var(--px, 0px) + 10px); right: calc(var(--px, 0px) + 10px);
  --c: linear-gradient(var(--gold), var(--gold));
  background: var(--c) left top / 26px 3px, var(--c) left top / 3px 26px, var(--c) right top / 26px 3px, var(--c) right top / 3px 26px,
    var(--c) left bottom / 26px 3px, var(--c) left bottom / 3px 26px, var(--c) right bottom / 26px 3px, var(--c) right bottom / 3px 26px;
  background-repeat: no-repeat;
  filter: drop-shadow(0 0 3px rgba(255, 230, 170, 0.9));
  animation: lock-on 0.6s cubic-bezier(.2, .8, .2, 1.25) 0.3s both;
}
@keyframes lock-on { from { opacity: 0; transform: scale(1.14); } }
.cam-status { margin: 10px 0 0; color: var(--ink-2); font-size: 14px; line-height: 1.5; text-align: center; word-break: keep-all; text-wrap: balance; }
.cam-status span { display: block; }
.photo-error { margin: 2px 0 8px; text-align: center; word-break: keep-all; text-wrap: balance; }
/* 만 14세 이상에게만: 손바닥을 남긴다는 한 줄(인생손금과 같음), 누르면 처리방침의 손바닥 사진 항목 */
.cam-note { margin: 10px 0 0; color: var(--ink-3); font-size: 12px; line-height: 1.45; text-align: center; word-break: keep-all; }
.cam-note a { color: inherit; text-underline-offset: 3px; }

/* 결제 뒤 다른 손 찍기(index.html?other, data-other, 인생손금과 같은 짜임): 처음 손 찍는 화면과 헷갈리지 않게 맨 위에 결제 완료 띠를
   늘 두고, 처음 찍은 손(작게, 체크)과 지금 찍을 손 예시(크게)를 화살표로 이어 나란히 보여 줍니다. */
.paid-band, .shot-done, .shot-arrow, .shot-label { display: none; }
/* 띠가 맨 앞에 끼어도 처음 손 찍는 화면의 차례로 올라오는 때는 그대로 */
.step-camera[data-step="shoot"]:not([data-other]) > * { animation-delay: calc((var(--n, 0) - 1) * 70ms); }
.step-camera[data-other] .paid-band {
  display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 12px 14px;
  border: 1px solid rgba(183, 134, 44, 0.45); border-radius: 14px; background: var(--card); box-shadow: var(--shadow-sm);
}
.paid-face { flex: none; width: 46px; height: 46px; border: 1.5px solid var(--gold); border-radius: 50%; background: var(--paper-2) 50% 6% / auto 240% no-repeat; }
.paid-text { display: grid; gap: 3px; min-width: 0; margin: 0; }
.paid-text b { display: flex; align-items: center; gap: 6px; color: var(--ink); font-size: 16px; font-weight: 800; letter-spacing: -0.3px; }
.paid-text span { color: var(--ink-2); font-size: 14px; line-height: 1.4; letter-spacing: -0.2px; word-break: keep-all; }
/* 흰 체크를 얹은 연두 동그라미(띠 제목 앞과 처음 찍은 손 위) */
.paid-text b::before, .done-check {
  content: ""; flex: none; border-radius: 50%;
  background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5.5 12.5l4 4L18.5 7.5' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 64% no-repeat;
}
.paid-text b::before { width: 18px; height: 18px; }
.done-pic {
  position: relative; width: 100%; margin: auto 0; aspect-ratio: 9 / 16;
  border: 2px solid rgba(43, 29, 18, 0.55); border-radius: 14px;
  background: linear-gradient(180deg, #f7ecdf, #e6d3bd); overflow: hidden; box-shadow: var(--shadow-sm);
}
.done-pic img {
  position: absolute; left: 50%; top: 52%; width: 80%; height: auto; translate: -50% -50%; opacity: 0.45;
  -webkit-mask-image: linear-gradient(to bottom, #000 74%, transparent 94%); mask-image: linear-gradient(to bottom, #000 74%, transparent 94%);
}
/* 처음 찍은 손은 지금 찍을 손의 반대쪽(그림은 왼손이라 오른손일 때 뒤집음) */
.step-camera[data-hand="left"] .done-pic img { transform: scaleX(-1); }
.done-check { position: absolute; left: 50%; top: 50%; width: clamp(20px, 36%, 34px); aspect-ratio: 1; translate: -50% -50%; box-shadow: 0 2px 8px rgba(74, 46, 24, 0.25); }
.shot-label b { display: block; color: var(--ink); font-size: 15px; font-weight: 800; }
/* 두 그림은 틀 안에 절대 위치로 놓인 예시 칸(.shot-example)을 크기 기준(container)으로 삼아, 키가 작은 화면(앱 안 브라우저 등)에서도
   처음 찍은 손이 지금 찍을 손의 절반이고 둘이 가운데에 모입니다(남는 높이를 나눠 받는 틀은 기준으로 쓰면 높이가 0으로 셈).
   --pw는 지금 찍을 손 예시의 폭: 이름표 줄(약 46px)을 뺀 높이의 9/16, 폭이 모자라면 두 그림(1 + 1/2)과 화살표·틈 34px이 들어가는 만큼.
   이 단위를 모르는 오래된 브라우저에서는 처음 찍은 손·화살표·이름표 없이 예시만 보입니다. */
@supports (width: 1cqh) {
  .step-camera[data-other] .shot-example {
    --pw: min((100cqh - 46px) * 9 / 16, (100cqw - 34px) / 1.5); inset: 16px 12px 12px; container-type: size;
    display: grid; grid-template-columns: auto auto auto; grid-template-rows: minmax(0, 1fr) auto; justify-content: center; align-items: center; column-gap: 8px;
  }
  .step-camera[data-other] .shot-done { display: flex; grid-area: 1 / 1 / 3 / 2; align-self: stretch; flex-direction: column; align-items: center; width: calc(var(--pw) / 2); margin: 0; }
  .step-camera[data-other] .shot-arrow {
    display: block; grid-area: 1 / 2; width: 18px; height: 18px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 5l7 7-7 7' fill='none' stroke='%238c7763' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  .step-camera[data-other] .shot-phone { grid-area: 1 / 3; width: var(--pw); height: auto; max-height: 100%; }
  .step-camera[data-other] .shot-label { display: block; margin: 8px 0 0; color: var(--ink-2); font-size: 13px; line-height: 1.35; text-align: center; white-space: nowrap; }
  .step-camera[data-other] .shot-example > .shot-label { grid-area: 2 / 3; }
}

/* 분석 중: 대청마루에 앉은 아씨가 두 손 사이에 띄운 빛 구슬 위에 렌즈. 그림 자리와 렌즈 자리는 flow.js(placeReading)가 화면에 맞춰 잡습니다.
   그림 아래 끝(치마)은 한지로 흐려지고 그 위에 대사가 올라옵니다. */
.reading-art {
  position: absolute; left: 0; top: 0; opacity: 0; pointer-events: none; transition: opacity 0.5s ease;
  -webkit-mask-image: linear-gradient(#000 84%, transparent); mask-image: linear-gradient(#000 84%, transparent);
}
.page[data-step="reading"] .reading-art { opacity: 1; }
.reading-art img, .reading-art video { position: absolute; inset: 0; width: 100%; height: 100%; }
.reading-art video { opacity: 0; transition: opacity 0.25s ease; }   /* 영상이 실제로 재생될 때만 그림 위로 나타남(flow.js) */
.reading-art.playing video { opacity: 1; }
.step-reading { justify-content: flex-end; }
.reading-lens { position: absolute; z-index: 1; width: 156px; height: 156px; animation: lens-in 0.6s cubic-bezier(.2, .8, .2, 1.15) both; }
@keyframes lens-in { from { opacity: 0; transform: scale(0.7); } }
.lens-ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; transform: rotate(-90deg); }
.lens-ring circle { fill: none; }
.ring-ticks { stroke: rgba(255, 232, 170, 0.85); stroke-width: 1.3; stroke-dasharray: 0.9 4.2; transform-origin: 60px 60px; animation: ring-turn 24s linear infinite; }
.ring-track { stroke: rgba(255, 250, 243, 0.45); stroke-width: 3; }
.ring-fill { stroke: #f4c55c; stroke-width: 3.4; stroke-linecap: round; stroke-dasharray: 0 100; filter: drop-shadow(0 0 3px rgba(255, 214, 120, 0.95)); }
@keyframes ring-turn { to { transform: rotate(360deg); } }
.reading-palm {
  position: absolute; inset: 9%; border-radius: 50%; background: var(--paper-2); overflow: hidden;
  box-shadow: 0 0 0 1px rgba(244, 197, 92, 0.7), 0 0 26px rgba(255, 214, 130, 0.5), inset 0 0 18px rgba(74, 46, 24, 0.3);
  animation: palm-glow 1.6s ease-in-out infinite alternate;
}
.reading-palm img { display: block; width: 100%; height: 100%; object-fit: cover; animation: lens-lean 7s ease-out both; }
@keyframes lens-lean { from { transform: scale(1.02); } to { transform: scale(1.2); } }
.reading-palm::after {
  content: ""; position: absolute; inset: -40% 0;
  background: linear-gradient(to bottom, rgba(255, 236, 190, 0) 30%, rgba(255, 236, 190, 0.22) 47%, rgba(255, 248, 228, 0.85) 50%, rgba(255, 236, 190, 0) 52%);
  animation: palm-scan 2.2s cubic-bezier(.45, 0, .35, 1) infinite;
}
@keyframes palm-glow {
  from { box-shadow: 0 0 0 1px rgba(244, 197, 92, 0.55), 0 0 16px rgba(255, 214, 130, 0.35), inset 0 0 18px rgba(74, 46, 24, 0.3); }
  to { box-shadow: 0 0 0 1px rgba(244, 197, 92, 0.9), 0 0 32px rgba(255, 214, 130, 0.65), inset 0 0 18px rgba(74, 46, 24, 0.3); }
}
@keyframes palm-scan { from { transform: translateY(-62%); } to { transform: translateY(62%); } }
.spark {
  position: absolute; left: var(--x); top: var(--y); z-index: 1; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px;
  background: radial-gradient(circle, #fff 0 22%, #ffe9b0 40%, rgba(255, 220, 140, 0) 70%);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  opacity: 0; animation: twinkle 2.6s ease-in-out var(--d) infinite;
}
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(0.2) rotate(0deg); } 18% { opacity: 1; transform: scale(1.15) rotate(45deg); } 36% { opacity: 0; transform: scale(0.3) rotate(90deg); } }
.reading-pct {
  position: absolute; left: 50%; bottom: -11px; translate: -50% 0; min-width: 46px; padding: 2px 9px 3px;
  border: 1px solid rgba(183, 134, 44, 0.6); border-radius: 999px; background: var(--card); color: var(--ink);
  font-size: 13px; font-weight: 800; line-height: 1.3; letter-spacing: 0.2px; text-align: center; font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-sm);
}
.burst { position: absolute; left: 50%; top: 50%; pointer-events: none; }
.burst i { position: absolute; left: -3.5px; top: -3.5px; width: 7px; height: 7px; border-radius: 50%; background: #fff3d1; box-shadow: 0 0 10px 3px rgba(255, 220, 140, 0.85); opacity: 0; }
.reading-lens::after { content: ""; position: absolute; inset: 4px; border: 2px solid rgba(255, 226, 160, 0.9); border-radius: 50%; opacity: 0; pointer-events: none; }
.step-reading.done .reading-lens::after { animation: ripple 0.9s cubic-bezier(.2, .7, .3, 1) both; }
@keyframes ripple { 0% { opacity: 0.9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.7); } }
.step-reading.done .reading-lens { animation: lens-pop 0.62s cubic-bezier(.2, .8, .2, 1) both; }
.step-reading.done .reading-palm { animation: palm-flash 0.7s ease both; }
.step-reading.done .burst i { animation: burst 0.8s cubic-bezier(.15, .7, .3, 1) both; }
.step-reading.done .reading-pct { background: var(--red); border-color: var(--red); color: #fff; transition: background-color .2s ease, color .2s ease; }
@keyframes lens-pop { 0% { transform: scale(1); } 35% { transform: scale(1.09); } 100% { transform: scale(1); } }
@keyframes palm-flash {
  0% { box-shadow: 0 0 0 1px rgba(244, 197, 92, 0.9), 0 0 32px rgba(255, 214, 130, 0.65), inset 0 0 18px rgba(74, 46, 24, 0.3); }
  30% { box-shadow: 0 0 0 3px rgba(255, 236, 190, 1), 0 0 60px rgba(255, 220, 140, 0.95), inset 0 0 40px rgba(255, 236, 190, 0.6); }
  100% { box-shadow: 0 0 0 1px rgba(244, 197, 92, 0.9), 0 0 36px rgba(255, 214, 130, 0.7), inset 0 0 18px rgba(74, 46, 24, 0.25); }
}
@keyframes burst { 0% { opacity: 1; transform: rotate(var(--a)) translateY(-66px) scale(1.2); } 100% { opacity: 0; transform: rotate(var(--a)) translateY(-132px) scale(0.3); } }
/* 대사는 두 줄 자리를 잡아 두어 줄이 바뀌어도 흔들리지 않습니다. 한지 막은 감싼 .talk가 깝니다(대사에는 써지는 가림이 있어 막이 잘림). */
.reading-talk { margin-bottom: 6px; }
.reading-line { display: grid; place-items: center; min-height: 3.3em; text-wrap: balance; }
.reading-line.swap { animation: write-in 0.6s ease both; }
/* 다 읽으면 한지 색으로 바랜 뒤 결과 화면으로 넘어갑니다 */
.page::after { content: ""; position: absolute; inset: 0; z-index: 5; background: var(--paper); opacity: 0; pointer-events: none; }
.page.leaving::after { opacity: 1; transition: opacity 0.28s ease; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 90px); z-index: 20; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 48px); padding: 10px 16px; border-radius: 18px;
  border: 1px solid var(--rule); background: var(--card); box-shadow: var(--shadow);
  color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.45; text-align: center; word-break: keep-all;
  animation: rise-in 0.3s var(--ease-out) both;
}

/* 짧은 화면(아이폰 SE 등) */
@media (max-height: 700px) {
  .title-art { margin-bottom: calc(var(--tw) * -9.5 / 359.3); }   /* 글자와 보조 문구 사이 13px */
  .step { padding-top: 66px; }
  .step-form .step-title { margin: 10px 0 22px; }
  .hand-choices { margin: 16px 0 12px; }
  .hand-choice { min-height: 56px; }
  .cam-frame { min-height: 180px; }
  .shot-tips li { font-size: 14px; }
  .talk { margin-bottom: 22px; }
  .line + .line { margin-top: 10px; }
}

/* 넓은 화면(601px 이상): 인생손금·신년손금 첫 화면처럼 480px 기둥 안에서 393px 폰 배치를 그대로 키웁니다(글자·제목·단추 1.22배).
   창이 낮아도 첫 화면은 540px 아래로 줄지 않습니다. */
@media (min-width: 601px) {
  .hero { --cw: 480px; min-height: max(100svh, 540px); }
  .hero-copy { padding: 0 calc(var(--cw) * 24 / 393) calc(var(--cw) * 34 / 393); }
  .hero-copy::before { top: calc(var(--cw) * -120 / 393); }
  .kicker { font-size: calc(var(--cw) * 20 / 393); }
  .title-art { --tw: calc(var(--cw) * 359.3 / 393); margin-bottom: calc(var(--tw) * -5.5 / 359.3); }
  .sub { margin-bottom: calc(var(--cw) * 12 / 393); font-size: calc(var(--cw) * 15 / 393); letter-spacing: calc(var(--cw) * -0.4 / 393); }
  .hero .cta {
    gap: calc(var(--cw) * 8 / 393);
    height: calc(var(--cw) * 54 / 393);
    border-radius: calc(var(--cw) * 14 / 393);
    font-size: calc(var(--cw) * 17 / 393);
  }
  .hero .cta svg { width: calc(var(--cw) * 18 / 393); height: calc(var(--cw) * 18 / 393); }
}

/* ---------- 가운데 뜨는 창(이어 보기·반대 손 알림·갤럭시 울트라 안내) ----------
   인생손금 첫 화면 창(site/styles.css .again-dim)과 같은 틀이고 색만 한지·다홍으로 맞췄습니다. 뒤 화면은 어둡게 덮습니다. */
.again-dim {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(43, 29, 18, 0.42);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.again-dim.open { opacity: 1; }
.again-box {
  width: min(100%, 304px);
  /* 저장한 손금 다섯 장처럼 길어도 낮은 화면(앱 안 브라우저 등)에서 위아래 단추가 잘리지 않게 창 안에서 굴립니다(2026-10-26 리뷰). */
  box-sizing: border-box; max-height: 100%; overflow-y: auto; overscroll-behavior: contain;
  padding: 26px 20px 18px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 18px 48px rgba(43, 29, 18, 0.2);
  text-align: center;
  transform: translateY(10px) scale(0.96);
  transition: transform 0.3s cubic-bezier(.2, .7, .2, 1);
}
.again-dim.open .again-box { transform: none; }
.again-box img { display: block; width: auto; height: 40px; margin: 0 auto 12px; }
.again-title { margin: 0; color: var(--ink); font-size: 19px; font-weight: 700; letter-spacing: -0.4px; word-break: keep-all; }
.again-sub { margin: 8px 0 22px; color: var(--ink-2); font-size: 14.5px; letter-spacing: -0.2px; word-break: keep-all; }
.again-row { display: flex; gap: 8px; }
.again-row > * {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  height: 50px;
  border: 0; border-radius: 12px;
  font: inherit; font-size: 16px; font-weight: 700;
  text-decoration: none;
  transition: transform 0.12s ease;
}
.again-no { background: var(--paper-2); color: var(--ink-2); }
.again-go { background: var(--red); color: #fff; }
.again-row > *:active { transform: scale(0.97); }

/* 갤럭시 울트라만: 2배 줌한 폰을 손에서 40cm 떨어뜨린 그림과 그 말(인생손금과 같은 그림) */
.ultra-art { display: flex; align-items: center; gap: 6px; height: 122px; margin: -8px -4px 18px; padding: 0 18px; border-radius: 14px; background: var(--paper-2); }
.ultra-phone { flex: none; display: flex; align-items: center; justify-content: center; width: 50px; height: 94px; border-radius: 11px; background: var(--ink); box-shadow: inset 0 0 0 3px #4a3a2c; }
.ultra-phone span { padding: 3px 8px; border-radius: 999px; background: var(--red-soft); color: var(--red-2); font-size: 13px; font-weight: 800; }
.ultra-gap { flex: 1; text-align: center; }
.ultra-gap b { display: block; margin-bottom: 8px; color: var(--red-2); font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }
.ultra-gap i { position: relative; display: block; margin: 0 4px; border-top: 2px dashed var(--ink-3); }
.ultra-gap i::before, .ultra-gap i::after { content: ""; position: absolute; top: -6px; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.ultra-gap i::before { left: -4px; border-right: 8px solid var(--ink-3); }
.ultra-gap i::after { right: -4px; border-left: 8px solid var(--ink-3); }
.again-box .ultra-hand { flex: none; width: 64px; height: auto; margin: 0; }   /* 위 도장 크기가 아님 */
.ultra .again-title { line-height: 1.45; }
.ultra .again-row { margin-top: 22px; }
