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

/* 결과 화면 큰 글씨는 여기어때 잘난체, 결과 글은 나눔스퀘어라운드(내손내운 결과 화면과 같음) */
@font-face { font-family: "Jalnan"; src: url("https://fastly.jsdelivr.net/gh/projectnoonnu/noonfonts_four@1.2/JalnanOTF00.woff") format("woff"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "NanumSquareRound"; src: url("https://hangeul.pstatic.net/hangeul_static/webfont/NanumSquareRound/NanumSquareRoundR.woff2") format("woff2"); font-weight: 100 500; font-display: swap; }
@font-face { font-family: "NanumSquareRound"; src: url("https://hangeul.pstatic.net/hangeul_static/webfont/NanumSquareRound/NanumSquareRoundB.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "NanumSquareRound"; src: url("https://hangeul.pstatic.net/hangeul_static/webfont/NanumSquareRound/NanumSquareRoundEB.woff2") format("woff2"); font-weight: 800 900; font-display: swap; }
@font-face { font-family: "Paperlogy"; src: url("https://fastly.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-6SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Paperlogy"; src: url("https://fastly.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-7Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  /* 밝은 한지빛 바탕에 먹색 글씨, 주요 단추는 인주색(내손내운 인생손금 첫 화면과 같은 #c8402f) */
  --paper: #fbf6ee;
  --paper-2: #f4ece1;
  --line-b: #e8dccd;
  --meok: #26211e;
  --meok-2: #3a322d;
  --meok-3: #5b524c;
  --meok-4: #8a7f76;
  --acc: #c8402f;
  --acc-text: #b8392a;
  --acc-soft: rgba(200, 64, 47, 0.09);
  --acc-line: rgba(200, 64, 47, 0.42);
  --acc-shadow: rgba(200, 64, 47, 0.28);
  /* 두 사람 색: 앞사람은 금빛, 뒷사람은 분홍 */
  --pa: #c4952f; --pa-text: #8f6620; --pa-soft: #fbf0d9; --pa-line: rgba(196, 149, 47, 0.45);
  --pb: #d0587a; --pb-text: #ad3d5d; --pb-soft: #fbe5eb; --pb-line: rgba(208, 88, 122, 0.42);
  --gold: #f3cf86;   /* 분석 중 렌즈 고리의 빛 */
  --font-body: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --font-say: "Gowun Batang", serif;
  --font-name: "Song Myung", serif;
  --font-ui: "NanumSquareRound", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --font-title: "Jalnan", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html, body { margin: 0; height: 100%; }
html { scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }
body {
  background: #fff;
  color: var(--meok);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }

.page {
  position: relative;
  max-width: 480px;
  min-height: 100svh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--paper);
}

/* ---------- 위 로고 ---------- */
.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) */
  background: linear-gradient(rgba(251, 246, 238, 0.62), rgba(251, 246, 238, 0));
}
.brand { display: inline-flex; align-items: center; gap: 4.4px; height: 30px; color: var(--meok); text-decoration: none; }
/* 로고: 갓 쓴 까치 + 내손내운 글자 + 手相 인장을 한 장으로 구운 그림(인생손금·신년손금과 같은 brand-kkachi.webp), 글자 높이로 씀 */
.logo { display: block; flex: none; width: auto; height: 30px; }   /* 홈페이지 로고와 같은 높이(사용자 2026-10-24) */
.back {
  display: grid; place-items: center; width: 36px; height: 36px; margin-left: -8px;
  border: 0; border-radius: 50%; background: none; color: var(--meok);
  transition: transform 0.16s var(--ease-out), opacity 0.16s ease;
}
.back:active { transform: scale(0.88); opacity: 0.6; }

/* ---------- 단추(내손내운 인생손금 첫 화면과 같은 인주색 단추) ---------- */
.cta {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 54px; padding: 0 20px;
  border: 0; border-radius: 14px;
  background: var(--acc); box-shadow: 0 6px 16px var(--acc-shadow);
  color: #fff; font-size: 17px; font-weight: 700; letter-spacing: -0.3px; text-decoration: none;
  transition: transform 0.12s var(--ease-out), filter 0.15s ease, opacity 0.2s;
}
.cta:active { transform: scale(0.97); filter: brightness(0.95); }
.cta:disabled { opacity: 0.45; cursor: default; }
/* 가끔 지나가는 빛(첫 화면 시작 단추·사진 확인 단추·링크 보내기) */
.cta.shine::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.3) 50%, transparent 65%);
  translate: -120% 0;
  animation: cta-sheen 4.2s ease-in-out 1.4s infinite;
}
@keyframes cta-sheen { 0% { translate: -120% 0; } 28%, 100% { translate: 120% 0; } }
.cta-sub { border: 1px solid rgba(38, 33, 30, 0.28); background: rgba(255, 255, 255, 0.72); color: var(--meok); box-shadow: none; }

/* ---------- 첫 화면 ---------- */
.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(251, 246, 238, 0), rgba(251, 246, 238, 0.68) 30%, rgba(251, 246, 238, 0.9) 52%, rgba(251, 246, 238, 0.97));
}
.kicker {
  margin: 0; color: var(--meok-2); font-family: var(--font-name); font-size: 20px; line-height: 1.25; letter-spacing: 0.06em;
  text-shadow: 0 0 8px rgba(251, 246, 238, 0.95), 0 0 18px rgba(251, 246, 238, 0.9);
}
/* 제목 '궁합손금'은 송명체 먹 글씨를 구운 그림입니다(flow.js renderHome, 1081×363을 360.3px로). 글자 위아래의 빛 번짐 자리(22px)만큼
   당겨 위 문구와 글자 사이를 5px, 글자와 보조 문구 사이를 17px로 둡니다. 인생손금·신년손금 첫 화면도 같은 간격입니다. */
.hero h1 { margin: 0; line-height: 0; }
.title-img {
  --tw: min(360.3px, calc(100vw - 8px));
  display: block; width: var(--tw); max-width: none; height: auto;
  margin: calc(var(--tw) * -17 / 360.3) 0 calc(var(--tw) * -5.5 / 360.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(--meok-3); }
.sub em { font-style: normal; color: var(--acc-text); 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); } }

/* ---------- 인사부터: 언니 그림 한 장 위에 대사와 입력 ---------- */
.flow { position: relative; min-height: 100svh; overflow: hidden; background: var(--paper); }
/* 그림이 화면을 꽉 채웁니다(내손내운 단계 화면과 같음). 대사 아래에는 글이 잘 읽히게 옅은 한지빛을 깝니다. */
.flow-art, .turn-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;
}
/* 시작 단추를 누르면 첫 화면이 인사 그림 위에 그대로 있다가 사라집니다(내손내운과 같음). */
.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; }
.turn-art { opacity: 0; }
.page[data-step="name"] .flow-art,
.page[data-step="relation"] .flow-art,
.page[data-step="hand"] .flow-art,
.page[data-step="shoot"] .flow-art,
.page[data-step="confirm"] .flow-art,
.page[data-step="reading"] .flow-art { opacity: 0; transform: scale(1.04); }   /* 입력 단계는 그림을 감추고 밝은 바탕만 */
.page[data-step="turn"] .flow-art { opacity: 0; }
.page[data-step="turn"] .turn-art { opacity: 1; }

.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, .step-turn { justify-content: flex-end; }
.step-greet > .talk, .step-turn > .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: -80px -24px -400px; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(251, 246, 238, 0), rgba(251, 246, 238, 0.8) 30%, rgba(251, 246, 238, 0.95) 55%);
}
.line {
  margin: 0; color: var(--meok); 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; text-wrap: balance; }   /* 긴 대사가 두 줄이 되면 끝말 하나만 내려가지 않게 */
.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(--meok); 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 34px; text-wrap: balance; }   /* 두 줄이 되면 줄을 고르게 */
.field { margin-bottom: 22px; }
.field label { display: block; margin-bottom: 6px; color: var(--meok-2); font-size: 15px; font-weight: 700; }
.field .field-label { display: block; margin: 0 0 6px; color: var(--meok-2); font-size: 15px; font-weight: 700; }
.sex-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.sex-choice {
  min-height: 46px; padding: 8px; border: 1px solid rgba(38, 33, 30, 0.18); border-radius: 12px; background: #fff;
  color: var(--meok); font-size: 16px; font-weight: 700; transition: transform 0.15s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.sex-choice:active { transform: scale(0.97); }
.sex-choice[aria-pressed="true"] { border-color: var(--acc); background: var(--acc-soft); color: var(--acc-text); }
.sex-choices[aria-invalid="true"] .sex-choice { border-color: #b8392a; }
.field input {
  display: block; width: 100%; height: 46px; padding: 0 2px;
  border: 0; border-bottom: 1.5px solid rgba(38, 33, 30, 0.28); border-radius: 0;
  background: transparent; color: var(--meok); font: inherit; font-size: 17px; outline: none;
}
.field input::placeholder { color: var(--meok-4); }
.field input:focus { border-bottom-color: var(--acc); }
.field input[aria-invalid="true"] { border-bottom-color: #b8392a; }
.field-error { min-height: 20px; margin: 6px 0 0; color: #b8392a; font-size: 13px; 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(--acc-text); 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 {
  min-height: 64px; padding: 8px;
  border: 1px solid rgba(38, 33, 30, 0.18); border-radius: 12px; background: #fff;
  color: var(--meok); font-size: 17px; font-weight: 700;
  transition: transform 0.15s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.hand-choice:active { transform: scale(0.97); }
.hand-choice[aria-pressed="true"] { border-color: var(--acc); background: var(--acc-soft); color: var(--acc-text); }
.hand-pick {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px 12px 12px;
  border: 1px solid var(--line-b); border-radius: 14px; background: #fff; box-shadow: 0 6px 20px rgba(60, 40, 20, 0.08);
  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(--meok); font-size: 17px; font-weight: 700; line-height: 1.4; word-break: keep-all; }
.hand-shoot b { color: var(--acc-text); }
.hand-why { margin: 14px 4px 0; color: var(--meok-3); 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; }

/* 연애 상태 장: 손 고르기와 같은 단추 모양, 기간 넷은 2×2. */
.step-relation .step-title { margin-top: 2px; }
.relation-status { margin-bottom: 20px; }
.relation-duration { animation: pick-in 0.35s ease both; }
.relation-duration h3 { margin: 0; color: var(--meok); font-family: var(--font-say); font-size: 18px; line-height: 1.45; }
.duration-choices { grid-template-columns: 1fr 1fr; margin-top: 14px; }
.duration-choices .hand-choice { min-height: 56px; font-size: 16px; }
.step-relation #relationNext { 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: 8px; background: var(--paper-2); 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 #fff; border-radius: 22px;
  background: linear-gradient(180deg, #f7ecdf, #e6d3bd); overflow: hidden; box-shadow: 0 8px 24px rgba(60, 40, 20, 0.18);
}
.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: #2f9e6e; 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(--meok-2); font-size: 14.5px; line-height: 1.4; animation: rise-in 0.45s ease both; }
.shot-tips li::before { content: "✓"; color: var(--acc-text); 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 { grid-template-columns: 1fr 2fr; }
.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(--pa), var(--pa));
  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, 255, 255, 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(--meok-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(--meok-3); font-size: 12px; line-height: 1.45; text-align: center; word-break: keep-all; }
.cam-note a { color: inherit; text-decoration-color: rgba(91, 82, 76, 0.3); text-underline-offset: 3px; }

/* 분석 중: 언니가 내려다보는 빛 동그라미 위에 렌즈. 그림 자리와 렌즈 자리는 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 86%, transparent); mask-image: linear-gradient(#000 86%, 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(243, 207, 134, 0.55); 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, 255, 255, 0.16); stroke-width: 3; }
.ring-fill { stroke: var(--gold); stroke-width: 3.4; stroke-linecap: round; stroke-dasharray: 0 100; filter: drop-shadow(0 0 3px rgba(243, 207, 134, 0.9)); }
@keyframes ring-turn { to { transform: rotate(360deg); } }
.reading-palm {
  position: absolute; inset: 9%; border-radius: 50%; background: #0d1230; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(243, 207, 134, 0.55), 0 0 26px rgba(243, 207, 134, 0.35), inset 0 0 18px rgba(8, 10, 30, 0.55);
  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(243, 207, 134, 0.45), 0 0 16px rgba(243, 207, 134, 0.22), inset 0 0 18px rgba(8, 10, 30, 0.55); }
  to { box-shadow: 0 0 0 1px rgba(243, 207, 134, 0.8), 0 0 32px rgba(243, 207, 134, 0.5), inset 0 0 18px rgba(8, 10, 30, 0.55); }
}
@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 var(--acc-line); border-radius: 999px; background: #fff; color: var(--acc-text);
  font-size: 13px; font-weight: 800; line-height: 1.3; letter-spacing: 0.2px; text-align: center; font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 12px rgba(60, 40, 20, 0.15);
}
.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(--acc); border-color: var(--acc); 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(243, 207, 134, 0.8), 0 0 32px rgba(243, 207, 134, 0.5), inset 0 0 18px rgba(8, 10, 30, 0.55); }
  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(243, 207, 134, 0.9), 0 0 36px rgba(243, 207, 134, 0.6), inset 0 0 18px rgba(8, 10, 30, 0.4); }
}
@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; }

/* 상대 차례: 대사는 한 조각씩 써지고, 아래 안내(옆에 있을 때·멀리 있을 때)가 올라온 뒤 단추가 올라옵니다. */
.turn-say { font-size: 21px; line-height: 1.45; }
.turn-note { font-family: var(--font-body); font-size: 15px; font-weight: 600; line-height: 1.55; color: var(--meok-2); animation: rise-in 0.6s var(--ease-out) 0.7s both; }
.turn-note span { display: block; word-break: keep-all; text-wrap: balance; }
.step-turn > .cta { animation-delay: 1.1s; }
/* 상대 차례의 촬영 안내: 단추 위 한 줄(멀리 있는 상대에게 받은 사진) */
.shoot-from { margin: 0 0 10px; color: var(--meok-3); font-size: 14px; line-height: 1.45; text-align: center; word-break: keep-all; animation: rise-in 0.45s ease 0.6s both; }

/* 가운데 뜨는 창(이어 보기 · 손 확인): 뒤 화면을 어둡게 덮습니다(인생손금 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(38, 30, 24, 0.45);
  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: #fff;
  box-shadow: 0 18px 48px rgba(50, 36, 26, 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(--meok); font-size: 19px; font-weight: 700; letter-spacing: -0.4px; word-break: keep-all; text-wrap: balance; }
.again-sub { margin: 8px 0 22px; color: var(--meok-3); 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: #f3eee7; color: var(--meok-3); }
.again-go { background: var(--acc); color: #fff; }
.again-row > *:active { transform: scale(0.97); }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 90px); z-index: 20; transform: translateX(-50%);
  padding: 10px 16px; border-radius: 999px; background: rgba(38, 33, 30, 0.92); border: 0;
  color: #fff; font-size: 14px; font-weight: 600; white-space: nowrap; animation: rise-in 0.3s var(--ease-out) both;
}

@media (min-width: 481px) {
  body { background: #fff; }
  .page { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04); }
}
/* 짧은 화면(아이폰 SE 등) */
@media (max-height: 700px) {
  .step { padding-top: 66px; }
  .step-form .step-title { margin: 10px 0 26px; }
  .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; }
  .title-img { margin-bottom: calc(var(--tw) * -9.5 / 360.3); }   /* 글자와 보조 문구 사이 13px */
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 넓은 화면(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-img { --tw: calc(var(--cw) * 360.3 / 393); margin-bottom: calc(var(--tw) * -5.5 / 360.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); }
}
