@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;1,500&family=Gowun+Batang:wght@400;700&display=swap');
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');

:root {
  --ivory: #F6F1E8;
  --paper: #FFFDF9;
  --sand: #ECE2D3;
  --oak: #C9A47E;
  --oak-soft: #E3CDB3;
  --walnut: #6B4E37;
  --walnut-deep: #4A3526;
  --ink: #33281F;
  --muted: #8B7B6B;
  --line: #D9CBB8;
  --serif: 'Gowun Batang', 'Cormorant Garamond', serif;
  --latin: 'Cormorant Garamond', 'Gowun Batang', serif;
  --sans: 'Pretendard', -apple-system, 'Apple SD Gothic Neo', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--ivory); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
img, svg { display: block; }

/* 나뭇결 띠: 아주 옅은 세로 결 */
.grain {
  background:
    repeating-linear-gradient(90deg, rgba(107, 78, 55, .045) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(90deg, rgba(107, 78, 55, .03) 0 2px, transparent 2px 19px),
    linear-gradient(180deg, var(--oak-soft), #D9BC9C);
}

.wrap { max-width: 480px; margin: 0 auto; padding: 0 22px; }

.eyebrow { font-family: var(--sans); font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: var(--walnut); }
.title { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.42; letter-spacing: -.01em; }
.title em { font-family: var(--latin); font-style: italic; font-weight: 500; color: var(--walnut); }
.lead { font-size: 15px; line-height: 1.75; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 52px; padding: 0 30px; border-radius: 999px;
  background: var(--walnut); color: var(--paper);
  font-size: 15px; font-weight: 600; letter-spacing: .02em;
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset;
  transition: transform .15s ease, background .2s ease;
  text-decoration: none;
}
.btn:active { transform: scale(.98); background: var(--walnut-deep); }
.btn.ghost { background: transparent; color: var(--walnut); border: 1px solid var(--walnut); }
.btn.block { width: 100%; }

/* 아치 프레임 */
.arch {
  border-radius: 999px 999px 0 0;
  overflow: hidden;
  border: 1px solid var(--walnut);
}

/* ---------- 첫 화면 ---------- */
.hero { padding: 34px 0 30px; text-align: center; }
.brand { font-family: var(--latin); font-size: 22px; letter-spacing: .06em; color: var(--walnut-deep); }
.brand small { display: block; font-family: var(--sans); font-size: 10px; letter-spacing: .32em; color: var(--muted); margin-top: 4px; }
.hero .arch { width: 74%; max-width: 300px; aspect-ratio: 3 / 4; margin: 30px auto 0; position: relative; background: var(--paper); }
.hero .arch .grain { position: absolute; inset: 0; }
.hero .arch svg { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: 82%; }
.hero .title { margin-top: 30px; }
.hero .lead { margin-top: 14px; }
.hero .btn { margin-top: 28px; min-width: 220px; }
.hero .meta { margin-top: 14px; font-size: 12px; color: var(--muted); letter-spacing: .04em; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding-top: 8px; padding-bottom: 44px; }
.step { background: var(--sand); border-radius: 999px 999px 10px 10px; padding: 26px 8px 18px; text-align: center; }
.step b { display: block; font-family: var(--latin); font-size: 26px; font-weight: 500; color: var(--walnut); line-height: 1; }
.step span { display: block; margin-top: 10px; font-size: 12.5px; line-height: 1.5; color: var(--ink); }

.foot { text-align: center; font-size: 11px; color: var(--muted); padding: 0 0 28px; letter-spacing: .04em; }

/* ---------- 채팅 ---------- */
.chat { display: none; flex-direction: column; height: 100dvh; max-width: 520px; margin: 0 auto; background: var(--paper); }
.chat.on { display: flex; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--paper); }
.avatar { width: 38px; height: 46px; border-radius: 999px 999px 4px 4px; border: 1px solid var(--walnut); overflow: hidden; flex: none; position: relative; }
.avatar .grain { position: absolute; inset: 0; }
.avatar svg { position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%); width: 26px; }
.chat-head .who b { display: block; font-family: var(--serif); font-size: 16px; font-weight: 700; }
.chat-head .who span { font-size: 11.5px; color: var(--muted); }
.progress { height: 2px; background: var(--sand); }
.progress i { display: block; height: 100%; width: 0; background: var(--oak); transition: width .4s ease; }

.msgs { flex: 1; overflow-y: auto; padding: 22px 16px 12px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.msg { max-width: 82%; padding: 12px 15px; font-size: 15px; line-height: 1.65; white-space: pre-line; animation: rise .35s ease both; }
.msg.ai { align-self: flex-start; background: var(--ivory); border: 1px solid var(--line); border-radius: 4px 18px 18px 18px; }
.msg.me { align-self: flex-end; background: var(--walnut); color: var(--paper); border-radius: 18px 4px 18px 18px; }
.msg.typing { color: var(--muted); }
.typing i { display: inline-block; width: 6px; height: 6px; margin: 0 2px; border-radius: 50%; background: var(--oak); animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }

.answer { padding: 12px 14px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--paper); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 11px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper);
  font-size: 14.5px; color: var(--ink); transition: transform .12s ease;
}
.chip:active { transform: scale(.97); }
.chip.sel { background: var(--walnut); border-color: var(--walnut); color: var(--paper); }
.answer .row { display: flex; gap: 8px; margin-top: 10px; }
.answer .hint { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.input { flex: 1; height: 48px; border-radius: 999px; border: 1px solid var(--line); background: var(--ivory); padding: 0 18px; font: inherit; font-size: 15px; color: var(--ink); outline: none; }
.input:focus { border-color: var(--oak); }
.answer .btn { height: 48px; padding: 0 20px; font-size: 14px; }

/* ---------- 조합 중 ---------- */
.mixing { display: none; position: fixed; inset: 0; background: var(--ivory); z-index: 10; align-items: center; justify-content: center; flex-direction: column; text-align: center; padding: 30px; }
.mixing.on { display: flex; }
.mixing .arch { width: 170px; height: 220px; position: relative; background: var(--paper); }
.drop { position: absolute; left: 50%; top: 30px; width: 10px; height: 14px; margin-left: -5px; background: var(--oak); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; animation: fall 1.4s ease-in infinite; }
.drop:nth-child(2) { animation-delay: .45s; left: 42%; background: var(--walnut); }
.drop:nth-child(3) { animation-delay: .9s; left: 58%; background: #B9A58C; }
.vial { position: absolute; left: 50%; bottom: 26px; width: 36px; height: 84px; margin-left: -18px; border: 1.5px solid var(--walnut); border-radius: 6px 6px 10px 10px; overflow: hidden; background: rgba(255,255,255,.6); }
.vial i { position: absolute; left: 0; right: 0; bottom: 0; height: 10%; background: linear-gradient(180deg, #E8D3B5, var(--oak)); animation: fill 4s ease-out forwards; }
.mixing p { margin-top: 26px; font-family: var(--serif); font-size: 19px; line-height: 1.6; }
.mixing small { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* ---------- 결과 ---------- */
.result { padding: 30px 0 40px; text-align: center; }
.result .name { font-family: var(--serif); font-size: 29px; line-height: 1.4; margin-top: 12px; }
.result .mood { font-size: 15px; color: var(--muted); margin-top: 8px; line-height: 1.6; }
.card {
  margin: 26px auto 0; background: var(--paper); border: 1px solid var(--walnut);
  border-radius: 999px 999px 14px 14px; padding: 58px 22px 26px; position: relative;
}
.notes { display: grid; gap: 14px; }
.note .role { font-family: var(--latin); font-style: italic; font-size: 16px; color: var(--walnut); }
.note .names { font-family: var(--serif); font-size: 17px; margin-top: 2px; line-height: 1.5; }
.divider { width: 36px; height: 1px; background: var(--oak); margin: 20px auto; }
.reason { font-size: 14.5px; line-height: 1.75; color: var(--ink); }
.ticket { margin-top: 22px; background: var(--sand); border-radius: 14px; padding: 20px 18px 18px; }
.ticket .label { font-size: 11px; letter-spacing: .24em; color: var(--walnut); }
.code { font-family: var(--latin); font-size: 52px; font-weight: 600; letter-spacing: .14em; color: var(--walnut-deep); line-height: 1.1; margin-top: 6px; padding-left: .14em; }
.qr { width: 168px; height: 168px; margin: 14px auto 0; background: var(--paper); border-radius: 10px; padding: 10px; }
.qr img { width: 100%; height: 100%; }
.ticket p { font-size: 13px; line-height: 1.6; color: var(--ink); margin-top: 12px; }
.badge { display: inline-block; margin-top: 10px; padding: 5px 12px; border-radius: 999px; font-size: 12px; background: var(--paper); color: var(--walnut); border: 1px solid var(--oak); }
.again { margin-top: 26px; }

.notfound { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes blink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes fall { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 80% { opacity: 1; } 100% { transform: translateY(100px); opacity: 0; } }
@keyframes fill { to { height: 78%; } }

@media (min-width: 700px) {
  .title { font-size: 36px; }
  .hero { padding-top: 56px; }
}
