:root {
  --bg: #f3efe8;
  --paper: #fffaf1;
  --ink: #1a1a1a;
  --muted: #5c5a55;
  --line: #e4ddd0;
  --green: #1f4d3a;
  --green-soft: #e3ece6;
  --gold: #c9a96a;
  --moon: #6f86a6;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }

/* 한국어 줄바꿈: 어절 단위로 끊고, 긴 단어만 넘칠 때 끊고, 문장부호가 줄 머리에 오지 않게 */
body { word-break: keep-all; overflow-wrap: break-word; line-break: strict; white-space: normal; }
h1, h2, h3, #qText, .r-title, .trip h2, .shuffle-text, .share-text { text-wrap: balance; }
p, li, .choice .txt, .match p, .dest p, .letter p, .foot p { text-wrap: pretty; }
.item b, .tarot .label b, .flight b { overflow-wrap: anywhere; }
.hint, .price, .flight .go, .tarot .no, .progress-text, #progressText, .r-eyebrow { white-space: nowrap; }
img { display: block; max-width: 100%; }

#app, .foot { max-width: 480px; margin: 0 auto; padding: 0 20px; }
.screen { min-height: 100svh; padding: 40px 0 32px; display: flex; flex-direction: column; }
.screen[hidden] { display: none; }

/* 시작 */
#start { align-items: center; text-align: center; justify-content: center; }
.eyebrow { color: var(--green); font-weight: 700; font-size: 13px; letter-spacing: .04em; margin: 0 0 10px; }
h1 { font-family: "Gowun Batang", serif; font-size: 34px; line-height: 1.3; margin: 0 0 28px; letter-spacing: -.01em; }
.fan { position: relative; width: 240px; height: 210px; margin: 0 auto 28px; }
.fan img { position: absolute; left: 50%; top: 0; width: 120px; border-radius: 10px; box-shadow: 0 10px 24px rgba(31,77,58,.25);
           transform-origin: 50% 120%; animation: fanIn .9s cubic-bezier(.2,.8,.2,1) both; }
.fan img:nth-child(1) { --r: -16deg; margin-left: -60px; animation-delay: .05s; }
.fan img:nth-child(2) { --r: 0deg; margin-left: -60px; animation-delay: .15s; z-index: 1; }
.fan img:nth-child(3) { --r: 16deg; margin-left: -60px; animation-delay: .25s; }
@keyframes fanIn { from { transform: rotate(0) translateY(20px); opacity: 0; } to { transform: rotate(var(--r)); opacity: 1; } }
.lead { color: var(--muted); margin: 0 0 24px; font-size: 16px; }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }

.btn { display: block; width: 100%; border: 0; border-radius: 14px; padding: 16px; font-weight: 700; font-size: 17px; text-align: center; text-decoration: none; }
.btn.primary { background: var(--green); color: #fff; box-shadow: 0 8px 20px rgba(31,77,58,.25); }
.btn.line { background: var(--paper); color: var(--green); border: 1.5px solid var(--green); }
.btn:active { transform: translateY(1px); }
.ghost { border: 0; background: none; color: var(--muted); padding: 6px 0; font-size: 15px; }
.ghost:disabled { visibility: hidden; }

/* 질문 */
.quiz-top { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); }
.progress { height: 6px; background: var(--line); border-radius: 99px; margin: 10px 0 28px; overflow: hidden; }
.progress .bar { height: 100%; width: 0; background: var(--green); border-radius: 99px; transition: width .4s ease; }
#qText { font-family: "Gowun Batang", serif; font-size: 23px; line-height: 1.45; margin: 0 0 6px; min-height: 3em; }
.pick-hint { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.choices { display: grid; gap: 12px; }

.choice { display: block; width: 100%; perspective: 900px; border: 0; padding: 0; background: none; text-align: left; height: 104px; color: inherit; }
.choice .inner { display: block; position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.2,.8,.2,1); transform: rotateY(180deg); }
.choice.open .inner { transform: rotateY(0); }
.choice .face { display: block; position: absolute; inset: 0; border-radius: 14px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.choice .back { transform: rotateY(180deg); background: var(--green) url("/img/cards/card-back.jpg") center/cover; }
.choice .front { background: var(--paper); border: 1.5px solid var(--gold); display: flex; align-items: center; gap: 14px; padding: 0 18px;
                 box-shadow: 0 6px 16px rgba(31,77,58,.10); }
.choice .mark { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--green-soft);
                color: var(--green); font-weight: 800; font-size: 14px; }
.choice .txt { font-size: 16.5px; line-height: 1.45; font-weight: 600; }
.choice.picked .front { border-color: var(--green); background: #f4f8f4; box-shadow: 0 0 0 3px rgba(31,77,58,.18), 0 8px 18px rgba(31,77,58,.18); }
.choices.locked .choice:not(.picked) { opacity: .35; transition: opacity .3s; }

/* 카드 섞기 */
#shuffle { align-items: center; justify-content: center; text-align: center; }
.deck { position: relative; width: 150px; height: 225px; margin-bottom: 28px; }
.deck img { position: absolute; inset: 0; width: 100%; border-radius: 12px; box-shadow: 0 10px 24px rgba(31,77,58,.25); }
.deck img:nth-child(1) { animation: shuffleL .5s ease-in-out infinite alternate; }
.deck img:nth-child(3) { animation: shuffleR .5s ease-in-out infinite alternate; animation-delay: .25s; }
@keyframes shuffleL { to { transform: translateX(-70px) rotate(-8deg); } }
@keyframes shuffleR { to { transform: translateX(70px) rotate(8deg); } }
.shuffle-text { font-family: "Gowun Batang", serif; font-size: 18px; color: var(--green); }

/* 결과 */
#result { padding-top: 28px; }
.r-eyebrow { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.tarot { perspective: 1000px; width: min(300px, 78vw); aspect-ratio: 2/3; margin: 0 auto 22px; }
.tarot .inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; animation: reveal 1.1s .2s cubic-bezier(.2,.8,.2,1) both; }
@keyframes reveal { from { transform: rotateY(180deg) scale(.92); } to { transform: rotateY(0) scale(1); } }
.tarot .face { position: absolute; inset: 0; border-radius: 18px; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden;
               box-shadow: 0 16px 36px rgba(31,77,58,.28); }
.tarot .back { transform: rotateY(180deg); background: url("/img/cards/card-back.jpg") center/cover; }
.tarot .front img { width: 100%; height: 100%; object-fit: cover; }
.tarot .frame { position: absolute; inset: 9px; border-radius: 12px; border: 2px solid var(--gold); }
.tarot.sal .frame { border-color: var(--moon); }
.tarot .no { position: absolute; top: 18px; left: 0; right: 0; text-align: center; font-weight: 800; font-size: 13px; letter-spacing: .14em; color: var(--green);
             text-shadow: 0 1px 6px rgba(255,255,255,.8); }
.tarot .badge { position: absolute; top: 14px; right: 18px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); font-size: 16px; }
.tarot .label { position: absolute; left: 14px; right: 14px; bottom: 16px; background: rgba(255,250,241,.93); border-radius: 12px; padding: 10px 8px; text-align: center; }
.tarot .label small { display: block; font-size: 12px; color: var(--muted); }
.tarot .label b { display: block; font-size: 17px; color: var(--green); line-height: 1.35; }

.r-title { font-family: "Gowun Batang", serif; text-align: center; font-size: 22px; line-height: 1.45; margin: 0 0 28px; }
.r-title b { color: var(--green); display: block; text-wrap: balance; }
.nw { white-space: nowrap; }
.block { background: var(--paper); border-radius: 16px; padding: 20px; margin-bottom: 14px; border: 1px solid var(--line); }
.block h3 { font-size: 15px; margin: 0 0 12px; color: var(--green); }
.block ul { margin: 0; padding-left: 18px; }
.block li { margin-bottom: 6px; }
.pair + .pair { border-top: 1px dashed var(--line); margin-top: 16px; padding-top: 16px; }
.pair-label { margin: 0 0 8px; font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.pair-name { margin: 0 0 4px; font-size: 18px; font-weight: 800; color: var(--green); }
.pair-text { margin: 10px 0 0; font-size: 15px; color: var(--ink); line-height: 1.65; }
.pair-name + .pair-text { margin-top: 0; }
.match { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; background: var(--bg);
         border-radius: 12px; padding: 8px 12px 8px 8px; }
.match img { width: 48px; aspect-ratio: 2/3; object-fit: cover; border-radius: 6px; flex: none; }
.match span { display: flex; flex-direction: column; gap: 1px; }
.match small { color: var(--muted); font-size: 12px; }
.match b { color: var(--green); font-size: 16px; line-height: 1.35; }
.match em { font-style: normal; font-size: 12.5px; color: var(--green); opacity: .8; }
.letter { background: var(--green); color: #f6f1e7; border: 0; }
.letter h3 { color: #f6f1e7; opacity: .8; }
.letter p { font-family: "Gowun Batang", serif; font-size: 16.5px; line-height: 1.85; margin: 0; }
.letter p + p { margin-top: 1em; }
.letter p.tip { color: #fff; font-weight: 700; border-top: 1px solid rgba(246,241,231,.25); padding-top: 1em; }

/* 추천 상품 */
.trip { margin: 26px 0 8px; }
.trip h2 { font-family: "Gowun Batang", serif; font-size: 21px; margin: 0 0 4px; }
.trip .sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.trip h4 { font-size: 14px; color: var(--muted); margin: 18px 0 8px; }
.flight { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--paper); border: 1px solid var(--line);
          border-radius: 14px; padding: 14px 16px; text-decoration: none; color: inherit; }
.flight b { display: block; }
.flight small { color: var(--muted); font-size: 12.5px; }
.flight .go { flex: none; background: var(--green); color: #fff; border-radius: 10px; padding: 8px 12px; font-size: 14px; font-weight: 700; }
.items { display: grid; grid-auto-flow: column; grid-auto-columns: 72%; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
.item { scroll-snap-align: start; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--line); }
.item div { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.item b { font-size: 14.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item small { color: var(--muted); font-size: 12.5px; }
.item .price { margin-top: auto; font-weight: 800; font-size: 15px; }
.disclose { color: var(--muted); font-size: 12px; margin: 10px 0 0; }

/* 공유 */
.share { margin: 26px 0 0; display: grid; gap: 10px; }
.share-text { text-align: center; font-family: "Gowun Batang", serif; color: var(--green); margin: 0 0 4px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 99px;
         font-size: 14px; opacity: 0; transition: opacity .25s; pointer-events: none; }
.toast.on { opacity: .92; }

.foot { color: var(--muted); font-size: 12px; padding-bottom: 40px; }
.foot p { margin: 0 0 6px; }
.foot strong { color: var(--ink); margin-right: 4px; }
.foot a { color: inherit; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
