:root {
  --bg: #060304;
  --panel: #150a0d;
  --wine: #5c1220;
  --red: #9c1c2e;
  --red-hi: #c22b41;
  --gold: #c9a86a;
  --ivory: #f2eadc;
  --dim: #a59a8f;
  --faint: #6f655d;
  --line: rgba(242, 234, 220, 0.16);
  --accent: var(--gold);
  --serif: "Hahmlet", "Nanum Myeongjo", "Apple SD Gothic Neo", serif;
  --sans: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  /* 첫 화면이 폰의 보이는 높이 한 화면에 들어오도록, 카드 높이는 화면 높이에서 나머지 요소 높이(--home-rest)를 뺀 만큼만 쓴다 */
  --home-rest: 156px;
  --card-w: max(180px, min(78vw, 336px, calc((100vh - var(--home-rest)) * 0.68)));
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
}

@supports (height: 100svh) {
  :root { --card-w: max(180px, min(78vw, 336px, calc((100svh - var(--home-rest)) * 0.68))); }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); }
body {
  color: var(--ivory);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: break-word;
  overflow-x: hidden;
}
html.locked, html.locked body { overflow: hidden; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p, ul, ol, figure, blockquote { margin: 0; padding: 0; }
ul, ol { list-style: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.shell {
  position: relative;
  max-width: 430px;
  min-height: 100svh;
  margin: 0 auto;
  overflow-x: clip;
  background:
    radial-gradient(120% 400px at 50% 0%, rgba(92, 18, 32, 0.42), transparent 70%),
    var(--bg);
}
.view { animation: view-in 0.36s ease both; }
@keyframes view-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 첫 화면 ---------- */
.home { display: flex; flex-direction: column; justify-content: center; min-height: min(100svh, 225vw, 968px); padding: 20px 0 14px; text-align: center; overflow: clip; }
.headline {
  margin: 0 20px;
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.34;
}
.headline .row { display: block; white-space: nowrap; }
.headline .row-1 { font-size: clamp(17px, 4.9vw, 20px); color: var(--gold); font-weight: 400; }
.headline .row-2 { font-size: clamp(22px, 7vw, 29px); margin-top: 2px; }
.headline .ch { position: relative; opacity: 0; }
.headline .ch.on { opacity: 1; }
.headline .ch.cur::after {
  content: ""; position: absolute; right: -5px; top: 12%;
  width: 2px; height: 78%; background: var(--red-hi);
  animation: caret 0.9s steps(1) infinite;
}
.headline.done .ch.cur::after { animation: caret 0.9s steps(1) 3, caret-out 0.3s 2.7s forwards; }
@keyframes caret { 50% { opacity: 0; } }
@keyframes caret-out { to { opacity: 0; } }

.fan { position: relative; margin-top: 54px; }
/* 문구는 기울어진 옆 카드 아래 모서리가 내려오는 구간 안쪽, 가운데 카드 바로 밑에 둔다 */
.hint { position: relative; z-index: 9; margin-top: calc(var(--card-w) * -0.135 + 24px); font-size: 12px; line-height: 1.5; color: #80766d; }
.fan-stage {
  touch-action: pan-y pinch-zoom;
  position: relative;
  height: calc(var(--card-w) * 4 / 3 + var(--card-w) * 0.135);
}
.card {
  position: absolute; left: 50%; top: 0;
  width: var(--card-w); aspect-ratio: 3 / 4;
  margin-left: calc(var(--card-w) / -2);
  padding: 0; border: 0; border-radius: 14px;
  background: #120a0c;
  overflow: hidden;
  transform-origin: 50% 100%;
  transition: transform 0.7s var(--ease), opacity 0.5s ease, box-shadow 0.5s ease;
  will-change: transform;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}
.card img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; user-select: none; }
.card .shade { position: absolute; inset: 0; background: #060304; opacity: 0; transition: opacity 0.6s ease; pointer-events: none; }
.card .orn { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; fill: none; stroke: var(--gold); stroke-width: 1.5; stroke-linecap: round; opacity: 0.9; }
.card .orn circle { fill: var(--gold); stroke: none; }

.card[data-pos="0"]  { transform: translateX(0) translateY(0) rotate(0deg) scale(1); z-index: 6; box-shadow: 0 26px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(201, 168, 106, 0.35); }
.card[data-pos="1"]  { transform: translateX(56%) translateY(5%) rotate(9deg) scale(0.82); z-index: 5; }
.card[data-pos="-1"] { transform: translateX(-56%) translateY(5%) rotate(-9deg) scale(0.82); z-index: 5; }
.card[data-pos="2"]  { transform: translateX(100%) translateY(14%) rotate(18deg) scale(0.68); z-index: 4; }
.card[data-pos="-2"] { transform: translateX(-100%) translateY(14%) rotate(-18deg) scale(0.68); z-index: 4; }
.card[data-pos="-3"] { transform: translateX(0) translateY(6%) rotate(0deg) scale(0.6); z-index: 1; opacity: 0; pointer-events: none; }
.card[data-pos="3"]  { transform: translateX(0) translateY(6%) rotate(0deg) scale(0.6); z-index: 1; opacity: 0; pointer-events: none; }
.card[data-pos="1"] .shade, .card[data-pos="-1"] .shade { opacity: 0.34; }
.card[data-pos="2"] .shade, .card[data-pos="-2"] .shade { opacity: 0.68; }
@media (hover: hover) { .card[data-pos="0"]:hover { transform: translateY(-4px) scale(1.015); } }
.card[data-pos="0"]:active { transform: scale(0.985); }
.card.picked { transform: scale(1.05) !important; transition-duration: 0.28s; }

.arrow {
  position: absolute; top: calc(var(--card-w) * 2 / 3 - 28px); z-index: 10;
  width: 48px; height: 56px; padding: 0;
  display: grid; place-items: center;
  border: 0; background: none;
}
.arrow svg {
  width: 30px; height: 30px; fill: none; stroke: var(--ivory); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 1px 5px rgba(0, 0, 0, 0.9));
  transition: stroke 0.18s ease, transform 0.18s var(--ease);
}
.arrow-prev { left: 0; }
.arrow-next { right: 0; }
@media (hover: hover) { .arrow:hover svg { stroke: var(--gold); transform: scale(1.25); } }
.arrow:active svg { stroke: var(--red-hi); transform: scale(0.88); }

/* 분야·이름·한 줄 소개는 카드 안 아래쪽에 얹는다. 아래 .who는 화면 읽기 도구에 바뀐 인물을 알려 주는 용도로만 남긴다. */
.who { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.card::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 60%; background: linear-gradient(180deg, transparent 0, rgba(6, 3, 4, 0.62) 46%, rgba(6, 3, 4, 0.95) 100%); pointer-events: none; }
.cap {
  position: absolute; z-index: 2; left: 0; right: 0; bottom: 16px; padding: 0 12px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  opacity: 0; transition: opacity 0.4s ease; pointer-events: none;
}
.card[data-pos="0"] .cap { opacity: 1; }
.cap-field { padding: 3px 10px 4px; border: 1px solid rgba(201, 168, 106, 0.6); border-radius: 999px; font-size: 10.5px; line-height: 1.5; color: var(--gold); }
.cap-name { font-family: var(--serif); font-weight: 500; font-size: 19px; letter-spacing: -0.02em; line-height: 1.35; color: var(--ivory); text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); }
.cap-intro { font-size: min(12.5px, 3.3vw); line-height: 1.5; letter-spacing: -0.01em; color: rgba(242, 234, 220, 0.78); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8); }
.textlink {
  background: none; border: 0; padding: 8px 6px;
  font-size: 12.5px; color: var(--faint); text-decoration: underline; text-underline-offset: 3px;
}
@media (hover: hover) { .textlink:hover { color: var(--ivory); } }

/* 넓은 화면에서는 옆 카드가 기둥 끝에서 뚝 끊기지 않게 좌우 가장자리만 어둡게 덮는다.
   카드 자체는 자르지 않는다. */
@media (min-width: 431px) {
  .fan::before, .fan::after {
    content: ""; position: absolute; z-index: 8; top: -12px; bottom: -70px; width: 46px; pointer-events: none;
  }
  .fan::before { left: 0; background: linear-gradient(90deg, var(--bg), transparent); }
  .fan::after { right: 0; background: linear-gradient(270deg, var(--bg), transparent); }
}

/* ---------- 대화형 입력·풀이 공통 ---------- */
.flow { padding-bottom: 36px; }
.topbar {
  position: absolute; z-index: 5; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
}
.back {
  display: inline-flex; align-items: center; gap: 2px;
  height: 44px; padding: 0 10px 0 2px;
  border: 0; background: none; font-size: 15px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
  transition: color 0.18s ease, transform 0.18s var(--ease);
}
.back svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 5px rgba(0, 0, 0, 0.9)); }
@media (hover: hover) { .back:hover { color: var(--gold); transform: scale(1.06); } }
.back:active { color: var(--red-hi); transform: scale(0.95); }
.steps { display: flex; gap: 5px; padding-right: 6px; }
.steps li { width: 22px; height: 3px; border-radius: 2px; background: rgba(242, 234, 220, 0.3); box-shadow: 0 0 6px rgba(0, 0, 0, 0.6); }
.steps li.on { background: var(--gold); }
.stage-note { font-size: 12.5px; color: var(--ivory); padding: 5px 12px; border-radius: 999px; background: rgba(6, 3, 4, 0.6); border: 1px solid var(--line); }

.portrait {
  position: relative;
  height: clamp(210px, 40svh, 360px);
  overflow: hidden;
  transition: height 0.7s var(--ease);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portrait::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(6, 3, 4, 0.5) 0, transparent 22%, transparent 48%, var(--bg) 97%);
}
.portrait.small { height: clamp(170px, 27svh, 240px); }
.portrait.tall { height: min(133.33vw, 573px, 66svh); }
.portrait.tall img { object-position: 50% 0 !important; }
.portrait.tall::after { background: linear-gradient(180deg, rgba(6, 3, 4, 0.45) 0, transparent 16%, transparent 58%, rgba(6, 3, 4, 0.8) 86%, var(--bg) 100%); }

/* 입력 화면: 인물이 화면을 가득 채우고, 대사와 입력칸은 아래에 놓인다 */
/* 세로로 아주 긴 미리보기 창에서도 대사와 입력칸이 인물에서 멀어지지 않게 높이에 상한을 둔다 */
.talk { position: relative; display: flex; flex-direction: column; min-height: min(100svh, 225vw, 968px); padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
.talk .portrait { position: absolute; top: 0; left: 0; right: 0; height: min(133.33vw, 573px, 70svh); }
.talk .portrait img { object-position: 50% 0 !important; }
.talk .portrait::after { background: linear-gradient(180deg, rgba(6, 3, 4, 0.45) 0, transparent 16%, transparent 62%, rgba(6, 3, 4, 0.7) 88%, var(--bg) 100%); }
.talk-space { flex: 1 0 min(64vw, 276px, 34svh); }
/* 세로로 긴 전용 그림이 있는 인물: 그림이 화면 아래 끝까지 깔리고, 아래쪽은 어둡게 눌러 글자가 읽히게 한다 */
.talk.full .portrait { height: 100%; }
.talk.full .portrait::after { background: linear-gradient(180deg, rgba(6, 3, 4, 0.45) 0, transparent 14%, transparent 38%, rgba(6, 3, 4, 0.74) 66%, rgba(6, 3, 4, 0.94) 100%); }
.talk.full .talk-body::before { top: -70px; background: linear-gradient(180deg, transparent 0, rgba(6, 3, 4, 0.74) 86px, rgba(6, 3, 4, 0.88) 100%); }
.talk-body { position: relative; z-index: 1; }
.talk-body::before { content: ""; position: absolute; z-index: -1; left: 0; right: 0; top: -90px; bottom: 0; background: linear-gradient(180deg, transparent 0, rgba(6, 3, 4, 0.8) 90px, var(--bg) 190px); pointer-events: none; }
.talk .say { margin-top: 0; }
.talk .answer { margin-top: 24px; }
.talk .answer .input-actions { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 7fr); gap: 10px; margin-top: 22px; }
.talk .answer .input-actions > .btn { margin: 0; min-width: 0; padding-inline: 8px; }
.talk .answer .input-actions > [data-back] { font-size: 15px; }

.say { position: relative; margin: -30px 24px 0; }
.portrait.tall + .say { margin-top: -58px; }
.bubble {
  color: var(--gold);
  font-family: var(--serif); font-size: 19px; line-height: 1.6; letter-spacing: -0.01em;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 2px 16px rgba(0, 0, 0, 0.9);
}
.bubble p { text-wrap: balance; }
.bubble.waiting p { animation: waiting 1.8s ease-in-out infinite; }
@keyframes waiting { 50% { opacity: 0.55; } }
.bubble .seg { display: inline-block; }
.bubble.swap p { animation: line-in 0.7s ease both; }
@keyframes line-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.answer { margin: 22px 20px 0; }
.field { display: block; }
.field + .field, .field + .choice, .choice + .field, .field-row + .field, .reveal + .field { margin-top: 20px; }
.field-label { display: block; font-size: 16.5px; font-weight: 600; color: var(--ivory); margin-bottom: 2px; }
.input, .select, .textarea {
  width: 100%;
  background: transparent;
  border: 0; border-bottom: 1px solid rgba(242, 234, 220, 0.38);
  border-radius: 0;
  padding: 10px 2px 11px;
  font-size: 19px; color: var(--ivory);
  outline: none;
  transition: border-color 0.18s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { border-bottom-color: var(--gold); box-shadow: 0 1px 0 var(--gold); }
.select {
  -webkit-appearance: none; appearance: none;
  padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c9a86a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 2px center; background-size: 18px;
}
.select:invalid, .select.empty { color: var(--faint); }
.select option { color: #1a1012; background: #f2eadc; }
/* 생년월일: 왼쪽에 제목, 오른쪽에 양력/음력, 그 아래 한 줄 입력 */
.birth-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.birth-label { font-size: 16.5px; font-weight: 600; color: var(--ivory); }
.cal { display: flex; align-items: center; gap: 16px; }
.cal label, label.cal { position: relative; cursor: pointer; }
.cal input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.cal span { display: inline-flex; align-items: center; gap: 7px; padding: 6px 0; font-size: 15.5px; color: var(--faint); transition: color 0.18s ease; }
.cal span::before {
  content: ""; width: 20px; height: 20px; flex: none; border-radius: 50%;
  border: 2px solid var(--faint); background: transparent center / 12px no-repeat;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s var(--ease);
}
.cal input:checked + span { color: var(--ivory); font-weight: 600; }
.cal input:checked + span::before {
  border-color: var(--ivory); background-color: var(--ivory);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23060304' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
.cal label:active span::before { transform: scale(0.88); }
.cal input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
.birth-input { margin-top: 4px; font-size: 21px; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.q-gap { margin-top: 20px; }
.birth-head + .select { margin-top: 2px; }
.talk .reveal { margin-top: 2px; }
.note.bad { color: #d98a8a; }
.textarea { min-height: 112px; resize: vertical; border: 1px solid rgba(242, 234, 220, 0.3); border-radius: 12px; padding: 13px 14px; font-size: 17px; line-height: 1.6; }
.textarea:focus { border-color: var(--gold); box-shadow: none; }
.note { margin-top: 8px; font-size: 12.5px; color: var(--faint); }
.count { text-align: right; }

.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; border: 0; padding: 0; margin: 0; }
.choice legend { font-size: 13px; color: var(--dim); margin-bottom: 8px; padding: 0; }
.choice label { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice span {
  display: block; text-align: center; padding: 13px 8px;
  border: 1px solid rgba(242, 234, 220, 0.3); border-radius: 12px;
  font-size: 16.5px;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
@media (hover: hover) { .choice label:hover span { border-color: var(--gold); } }
.choice label:active span { transform: scale(0.97); }
.choice input:checked + span { background: var(--wine); border-color: var(--red-hi); }
.choice input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 3px; }
.reveal { margin-top: 20px; animation: line-in 0.3s ease both; }

/* 버튼: 색과 크기로 반응한다 */
.btn {
  display: block; width: 100%;
  min-height: 56px; padding: 14px 20px;
  border: 1px solid var(--red); border-radius: 14px;
  background: var(--red); color: var(--ivory);
  font-size: 17px; font-weight: 600; letter-spacing: -0.01em;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s var(--ease), color 0.2s ease;
}
@media (hover: hover) { .btn:hover { background: var(--red-hi); border-color: var(--red-hi); transform: scale(1.025); } }
.btn:active { background: var(--wine); border-color: var(--wine); transform: scale(0.97); }
.btn:disabled { background: transparent; border-color: rgba(242, 234, 220, 0.2); color: var(--faint); transform: none; cursor: default; }
.btn-line { background: transparent; border-color: rgba(242, 234, 220, 0.34); font-weight: 500; }
@media (hover: hover) { .btn-line:hover { background: rgba(242, 234, 220, 0.08); border-color: var(--ivory); } }
.btn-line:active { background: rgba(242, 234, 220, 0.14); border-color: var(--ivory); }
.actions { margin: 28px 20px 0; display: grid; gap: 10px; }
.answer .btn { margin-top: 28px; }

/* ---------- 풀이 ---------- */
.reading { margin: 26px 20px 0; animation: line-in 0.6s ease both; }
.loading .reading, .loading .actions { display: none; }
.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pillar { padding: 10px 4px 11px; border: 1px solid var(--line); border-radius: 12px; text-align: center; }
.pillar.me { border-color: rgba(201, 168, 106, 0.7); background: rgba(201, 168, 106, 0.06); }
.pillar-name { font-size: 12px; color: var(--dim); }
.pillar-han { margin-top: 3px; font-family: var(--serif); font-size: 25px; line-height: 1.22; }
.pillar-ko { margin-top: 3px; font-size: 12px; color: var(--dim); }
.pillar.me .pillar-name { color: var(--gold); }
.pillar.none .pillar-han { color: var(--faint); }
.elements { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 10px; }
.elements li { display: flex; align-items: baseline; justify-content: center; gap: 5px; padding: 6px 0; font-size: 13px; color: var(--dim); border-bottom: 1px solid var(--line); }
.elements b { font-family: var(--serif); font-weight: 500; font-size: 16px; color: var(--ivory); }
.elements li.zero b { color: var(--faint); }
.elements li.top { border-bottom-color: var(--gold); }
.elements li.top b { color: var(--gold); }

.reading-title { margin-top: 30px; font-family: var(--serif); font-weight: 500; font-size: 25px; line-height: 1.36; letter-spacing: -0.02em; }
.reading-sub { margin-top: 6px; font-size: 13.5px; color: var(--gold); }
.reading-body { margin-top: 18px; }
.reading-body p { font-size: 16.5px; line-height: 1.86; letter-spacing: -0.005em; color: #e9e0d2; }
.reading-body p + p { margin-top: 16px; }
.aside-line {
  margin-top: 26px; padding: 0;
  border: 0; color: var(--gold);
  font-family: var(--serif); font-size: 18px; font-weight: 500; line-height: 1.75;
}
.mine { margin-top: 26px; padding: 14px 16px; border-radius: 12px; background: rgba(242, 234, 220, 0.05); }
.mine-label { font-size: 12.5px; color: var(--dim); }
.mine-text { margin-top: 4px; font-size: 15.5px; line-height: 1.66; color: var(--ivory); white-space: pre-wrap; overflow-wrap: anywhere; }
.next-line { margin-top: 30px; font-family: var(--serif); font-size: 17px; line-height: 1.66; }

.period { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.period:first-of-type { margin-top: 26px; }
.period-when { font-size: 13.5px; color: var(--gold); }
.period-title { margin-top: 4px; font-family: var(--serif); font-weight: 500; font-size: 21px; line-height: 1.4; letter-spacing: -0.02em; }
.todo { margin-top: 16px; padding: 14px 16px 15px; border-radius: 12px; background: rgba(92, 18, 32, 0.36); border: 1px solid rgba(156, 28, 46, 0.5); }
.todo-label { font-size: 12.5px; color: var(--gold); }
.todo p { margin-top: 4px; font-size: 16px; line-height: 1.76; }
.proto-tag { display: inline-block; margin-top: 18px; padding: 3px 10px 4px; border: 1px dashed rgba(242, 234, 220, 0.36); border-radius: 999px; font-size: 12px; color: var(--dim); }

.plain { margin: 26px 20px 0; }
.plain h2 { font-family: var(--serif); font-weight: 500; font-size: 24px; line-height: 1.4; letter-spacing: -0.02em; }
.plain p { margin-top: 12px; font-size: 16px; line-height: 1.8; color: #e9e0d2; }

/* ---------- 팝업 ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: grid; align-items: end; justify-items: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.72); animation: view-in 0.24s ease both; }
.sheet {
  position: relative; width: 100%; max-width: 430px; max-height: 88svh; overflow-y: auto;
  padding: 26px 22px calc(24px + env(safe-area-inset-bottom));
  border: 1px solid rgba(201, 168, 106, 0.3); border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: #140a0d;
  animation: sheet-in 0.36s var(--ease) both;
  outline: none;
}
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-close {
  position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; background: transparent;
  transition: background-color 0.18s ease, transform 0.18s ease;
}
.sheet-close svg { width: 18px; height: 18px; fill: none; stroke: var(--ivory); stroke-width: 1.8; stroke-linecap: round; }
@media (hover: hover) { .sheet-close:hover { background: var(--wine); transform: scale(1.08); } }
.sheet-close:active { transform: scale(0.94); }
.sheet-head { display: flex; align-items: center; gap: 14px; padding-right: 46px; }
.sheet-face { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; border: 1px solid rgba(201, 168, 106, 0.6); flex: none; }
.sheet-who { font-size: 13px; color: var(--gold); }
.sheet h2 { font-family: var(--serif); font-weight: 500; font-size: 22px; line-height: 1.36; letter-spacing: -0.02em; }
.scope { margin-top: 20px; border-top: 1px solid var(--line); }
.scope li { position: relative; padding: 13px 0 13px 22px; border-bottom: 1px solid var(--line); font-size: 15.5px; line-height: 1.56; }
.scope li::before { content: ""; position: absolute; left: 3px; top: 21px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.price { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 20px; }
.price-num { font-family: var(--serif); font-weight: 500; font-size: 30px; letter-spacing: -0.01em; }
.price-note { font-size: 12.5px; color: var(--dim); text-align: right; }
.sheet .btn { margin-top: 18px; }
.sheet-list { margin-top: 16px; }
.sheet-list li { position: relative; padding: 9px 0 9px 16px; font-size: 14.5px; line-height: 1.62; color: #e9e0d2; }
.sheet-list li::before { content: ""; position: absolute; left: 2px; top: 19px; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }
.sheet-text { margin-top: 12px; font-size: 14.5px; line-height: 1.7; color: var(--dim); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- 선택형 질문 ---------- */
.opts { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.opts legend { padding: 0; margin-bottom: 10px; }
.opts label { position: relative; display: block; cursor: pointer; }
.opts input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.opts span { display: block; padding: 12px 14px; border: 1px solid rgba(242, 234, 220, 0.28); border-radius: 12px; background: rgba(6, 3, 4, 0.5); font-size: 15.5px; line-height: 1.45; transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease; }
@media (hover: hover) { .opts label:hover span { border-color: var(--gold); } }
.opts label:active span { transform: scale(0.98); }
.opts input:checked + span { background: var(--wine); border-color: var(--red-hi); }
.opts input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 3px; }
.cal { flex-wrap: wrap; justify-content: flex-end; }

/* ---------- 개발용 A/B 전환 ---------- */
.ab { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; padding: 8px 10px; border: 1px dashed rgba(242, 234, 220, 0.3); border-radius: 12px; }
.ab span { font-size: 11.5px; color: var(--faint); margin-right: 2px; }
.ab button { padding: 6px 10px; border: 1px solid rgba(242, 234, 220, 0.24); border-radius: 999px; background: transparent; font-size: 12.5px; color: var(--dim); }
.ab button[aria-pressed="true"] { background: var(--ivory); border-color: var(--ivory); color: #140a0d; font-weight: 600; }
.wait { font-size: 14.5px !important; color: var(--faint) !important; }

/* ---------- 유료 풀이 ---------- */
.psec { margin-top: 34px; padding-top: 26px; border-top: 1px solid var(--line); }
.psec-title { font-family: var(--serif); font-weight: 500; font-size: 22px; line-height: 1.4; letter-spacing: -0.02em; color: var(--gold); }
.psec-body { margin-top: 6px; }
.pitem { margin-top: 22px; }
.pitem-head { margin: 4px 0 0; font-family: var(--serif); font-weight: 500; font-size: 18px; line-height: 1.45; letter-spacing: -0.02em; }
.pitem .reading-body { margin-top: 10px; }
.pitem .period-when { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.tone { padding: 1px 8px 2px; border-radius: 999px; font-size: 11.5px; border: 1px solid currentColor; }
.tone-up { color: #8fc3a0; } .tone-mid { color: var(--dim); } .tone-care { color: #d98a8a; }
.psec .btn { margin-top: 12px; }
.calc-note { margin-top: 12px; font-size: 12.5px; line-height: 1.6; color: var(--faint); }
.mine-text + .mine-text { margin-top: 2px; }

/* ---------- 2026-11-19 모바일 배치·대화 안내·날짜 오류 ---------- */
@media (max-width: 767px) {
  /* 기존 가운데 정렬은 유지하되 393×697에서 제목 16px, 카드는 30px 위로 올린다. */
  .home { padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: 48px; }
  .fan { margin-top: 40px; }
}
.talk .bubble { text-align: center; color: var(--gold); text-shadow: 0 2px 8px #060304, 0 0 24px #060304; }
.dialogue-tap { display: block; width: 100%; position: relative; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: inherit; text-shadow: inherit; }
.dialogue-cue { position: absolute; top: 100%; left: 0; right: 0; display: flex; justify-content: center; align-items: center; gap: 5px; margin-top: 3px; font-family: var(--sans); font-size: 11px; font-weight: 400; letter-spacing: 0.03em; color: #bcb0a2; }
.dialogue-cue svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.3; }
#birthNote { color: var(--dim); }
#birthNote.bad { color: #f1a0a0; }
.birth-input[aria-invalid="true"] { border-bottom-color: #f1a0a0; box-shadow: 0 1px 0 #f1a0a0; }

/* 비교용 자동 전환안: 기존 tap 안의 디자인과 동작은 바꾸지 않는다. */
.typing-mode { position: relative; }
.dialogue-typing { position: absolute; top: 100%; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 5px; height: 12px; margin-top: 3px; opacity: 0; }
.dialogue-typing.is-typing { opacity: 1; }
.dialogue-typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }
.dialogue-typing.is-typing i { animation: dialogue-dot 0.8s ease-in-out infinite; }
.dialogue-typing i:nth-child(2) { animation-delay: 0.13s; }
.dialogue-typing i:nth-child(3) { animation-delay: 0.26s; }
@keyframes dialogue-dot { 0%, 65%, 100% { opacity: 0.4; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .dialogue-typing.is-typing i { animation: none; opacity: 0.8; } }

/* BEGIN READING CLOSING: isolated from input/card layout */
.closing-scene { position: relative; isolation: isolate; min-height: 100vh; min-height: 100dvh; margin-top: 32px; padding: min(101vw, 434px) 20px 24px; }
.closing-scene[hidden], .loading .closing-scene { display: none; }
.closing-scene > .portrait { position: absolute; inset: 0 0 auto; height: min(133.33vw, 573px); z-index: -1; transition: none; }
.closing-scene > .portrait img { object-position: 50% 0 !important; }
.closing-scene > .portrait::after { background: linear-gradient(180deg, var(--bg) 0, transparent 9%, transparent 58%, rgba(6,3,4,.75) 81%, var(--bg) 100%); }
.closing-summary, .closing-guide { margin: 0; font-family: var(--serif); font-size: 18px; font-weight: 500; line-height: 1.75; color: var(--gold); text-align: center; white-space: pre-line; overflow-wrap: anywhere; }
.closing-guide-slot { position: relative; margin-top: 18px; }
.closing-reserve { visibility: hidden; display: grid; }
.closing-reserve > span { grid-area: 1 / 1; }
.closing-guide-layer { position: absolute; inset: 0; }
.closing-guide.bubble { color: var(--gold); text-shadow: 0 2px 8px #060304, 0 0 24px #060304; }
.closing-guide.bubble p { margin: 0; }
.closing-line { display: block; white-space: pre; }
.closing-tap { display: block; margin: 0 auto; padding: 8px 12px; background: transparent; border: 0; color: var(--gold); font: inherit; cursor: pointer; }
.closing-scene .closing-actions { margin: 24px 0 0; visibility: hidden; }
.closing-scene[data-phase="complete"] .closing-actions { visibility: visible; }
/* END READING CLOSING */

/* BEGIN PARAGRAPH TERM NOTES */
.term-star { margin: 0; color: var(--gold); font-size: .68em; line-height: 0; vertical-align: super; }
.reading-paragraph + .reading-paragraph { margin-top: 20px; }
.term-notes { display: block; margin-top: 7px; color: #b7ac9f; font-family: var(--sans); font-size: 11px; font-weight: 400; line-height: 1.6; letter-spacing: 0; word-break: keep-all; overflow-wrap: anywhere; }
.term-note { display: block; }
.term-note + .term-note { margin-top: 3px; }
.reading-meta .term-notes { margin-top: 5px; }
/* END PARAGRAPH TERM NOTES */

/* 승인된 단일 무료 화면: 본문 길이를 유지하고 연도 해석만 추가 */
.year-review { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.year-review-lead { margin: 0 0 9px; font-size: 12px; color: var(--dim); }
.year-review h3 { margin: 0 0 16px; font-family: var(--serif); font-size: 20px; line-height: 1.5; font-weight: 500; color: var(--gold); }
.year-review .reading-body p { white-space: normal; }
.closing-speech > .closing-guide-slot { margin-top: 0; }
.paid-cta-label { margin-left: 8px; font-size: 11px; font-weight: 400; opacity: .8; }

.reading-progress { color: var(--dim); font-size: 13px; margin: 12px 0 24px; }
.score-pending { color: var(--dim); font-size: 14px; }

/* 상세 안내는 모달이 아닌 문서 전체를 스크롤하는 독립 화면이다. */
.detail-page { padding: 12px 22px 36px; }
.detail-head { display: flex; align-items: center; gap: 14px; margin: 18px 0 24px; }
.detail-head h1 { font-family: var(--serif); font-size: 25px; font-weight: 500; line-height: 1.4; }
.detail-summary { padding: 22px 18px; border: 1px solid rgba(201,168,106,.4); border-radius: 14px; background: rgba(201,168,106,.035); }
.detail-eyebrow { color: var(--dim); font-size: 12px; margin-bottom: 9px; }
.detail-summary h2 { font-family: var(--serif); color: var(--gold); font-size: 21px; line-height: 1.5; font-weight: 500; }
.detail-summary .reading-body { margin-top: 14px; }
.detail-summary .reading-body p { font-size: 16px; line-height: 1.8; }
.detail-contents { margin-top: 34px; }
.detail-contents h2 { font-family: var(--serif); font-size: 22px; color: var(--gold); font-weight: 500; }
.detail-questions { margin: 18px 0 0; padding: 0; list-style: none; counter-reset: detail-question; border-top: 1px solid var(--line); }
.detail-questions li { counter-increment: detail-question; position: relative; padding: 17px 0 17px 34px; border-bottom: 1px solid var(--line); font-size: 15.5px; line-height: 1.65; }
.detail-questions li::before { content: counter(detail-question) "."; position: absolute; left: 0; top: 17px; color: var(--gold); }
.detail-invite { margin: 30px -22px 0; }
.detail-invite .bubble { position: relative; margin: -42px 24px 26px; }
.detail-page > .btn { margin-top: 20px; width: 100%; }

.life-detail-chapter h3{margin:1.15rem 0 .4rem;font-size:1rem}.life-detail-chapter .detail-questions{counter-reset:none}.life-detail-chapter ol.detail-questions li::before{content:attr(value)}
.life-detail-chapter{border-bottom:1px solid var(--line)}.life-detail-chapter>summary{cursor:pointer;list-style:none;display:flex;align-items:center;justify-content:space-between;padding:17px 2px;font-weight:650;line-height:1.5}.life-detail-chapter>summary::-webkit-details-marker{display:none}.life-detail-chapter>summary:after{content:'';border:solid currentColor;border-width:0 1.5px 1.5px 0;padding:3px;transform:rotate(45deg);margin:0 8px}.life-detail-chapter[open]>summary:after{transform:rotate(225deg)}.life-detail-chapter .detail-questions{margin:0 0 12px}.detail-line{color:#a7a5a2;font-size:13px;line-height:1.6;margin:5px 0 0;font-weight:400;word-break:keep-all;overflow-wrap:anywhere}.concern-tag{display:inline-block;margin-top:6px;font-size:12px;color:var(--gold)}.life-detail-chapter>summary:focus-visible{outline:2px solid var(--gold);outline-offset:2px}
/* Free-reading end card: append after the existing closing-scene rules. */
.closing-scene[data-phase="complete"] {
  min-height: auto;
  margin-top: 28px;
  padding: 28px 20px 24px;
  overflow: hidden;
  border: 1px solid rgba(201, 168, 106, .34);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(201, 168, 106, .12), rgba(28, 19, 18, .88));
}
.closing-scene[data-phase="complete"] > .portrait {
  display: none;
}
.closing-scene[data-phase="complete"] .closing-speech {
  position: relative;
}
.closing-scene[data-phase="complete"] .closing-guide-slot {
  margin: 0;
}
.closing-scene[data-phase="complete"] .closing-guide-layer {
  position: static;
}
.closing-scene[data-phase="complete"] .closing-guide.bubble {
  color: var(--gold);
  text-shadow: none;
}
.closing-scene[data-phase="complete"] .closing-guide.bubble p {
  margin: 0;
}
.closing-scene[data-phase="complete"] .free-card-promise {
  margin-top: 10px !important;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.65;
}
.closing-scene[data-phase="complete"] .closing-actions {
  margin: 20px 0 0;
  visibility: visible;
}
.closing-scene[data-phase="complete"]>.portrait{display:block;position:relative;inset:auto;z-index:0;height:74px;width:74px;border-radius:50%;overflow:hidden;margin:0 auto 12px}.closing-scene[data-phase="complete"]>.portrait:after{display:none}.closing-scene[data-phase="complete"]>.portrait img{object-position:50% 20% !important}.closing-scene[data-phase="complete"] .closing-reserve{display:none}.closing-scene[data-phase="complete"] .free-card-name{font-family:var(--sans);font-size:12px;letter-spacing:.05em;color:var(--gold);margin-bottom:6px}
.life-format{margin:18px 0 12px;padding:17px 0;border-top:1px solid var(--line);border-bottom:1px solid var(--line)}.life-format .detail-eyebrow,.life-sample .detail-eyebrow{margin:0}.life-count{margin:8px 0;color:var(--gold);font-size:17px}.life-concern{margin-top:16px;padding-left:14px;border-left:2px solid var(--gold);overflow-wrap:anywhere}.life-concern small,.life-sample small,.chapter-count{color:#b5aca4;font-size:12px;font-weight:400}.life-concern blockquote{margin:6px 0;font-size:16px;white-space:pre-line}.life-concern p{font-size:13px;color:#b5aca4;margin:5px 0}.chapter-count{margin-left:auto;padding:0 7px}.life-sample{margin:32px 0 24px;padding:22px 0;border-block:1px solid var(--line)}.life-sample h2{font:500 22px/1.45 var(--serif);margin:8px 0;color:var(--gold)}.sample-lead{line-height:1.75;word-break:keep-all;margin:15px 0 7px}.life-sample summary{width:fit-content;padding:10px 0;color:var(--gold);cursor:pointer;font-size:14px}.life-sample details:not([open]) summary span+span,.life-sample details[open] summary span:first-child{display:none}

.life-sample:has(details[open]) .sample-lead{display:none}
.life-cover{isolation:isolate;position:relative;overflow:hidden;display:flex;align-items:center;min-height:178px;margin:18px 0 0;background:#252522;border:1px solid #514735;border-radius:8px}.life-cover img{position:absolute;inset:0 0 0 auto;width:47%;height:100%;object-fit:cover;z-index:-1;mask-image:linear-gradient(to right,transparent,#000 34%)}.life-cover>div{padding:19px 16px;width:69%}.life-cover p{margin:0 0 10px;color:#dfc492;font-size:12px;line-height:1.5}.life-cover h1{margin:0;font:500 clamp(25px,6vw,36px)/1.35 var(--serif);color:#f3e9d9;overflow-wrap:anywhere}.book-size{padding:19px 0 14px;border-bottom:1px solid var(--line)}.book-size p{margin:0 0 11px}.book-size>div{display:grid;grid-template-columns:repeat(3,1fr)}.book-size span{padding:0 7px;text-align:center;font-size:13px;color:#e2d6bd;white-space:nowrap}.book-size span+span{border-left:1px solid var(--line)}.book-size b{font:27px Georgia,serif;color:var(--gold);margin-right:3px}.book-size small{font-size:11px}.toc-concern{margin:10px 0 0;padding:9px 12px;border-left:2px solid #a88b5d;background:#241e1f;color:#eee2d2;font-weight:400}.toc-concern small{color:var(--gold);font-size:11px}.toc-concern p{margin:3px 0 0;white-space:pre-line;overflow-wrap:anywhere;font-size:14px}.book-size+.detail-contents{margin-top:20px}
.book-size>div{gap:0}.book-size span{display:flex;flex-direction:column;align-items:center;gap:5px}.book-size span b{margin:0;font:500 29px/1.2 var(--serif);color:var(--gold)}.book-size span small{font-size:13px;line-height:1.45;color:#c5bab0}.toc-bonus{display:flex;align-items:baseline;gap:10px;margin:1px 0 15px;padding:10px 0 0;border-top:1px solid var(--line);color:var(--gold);font-size:14px}.toc-bonus b{width:1.5rem;text-align:center;font-weight:500}

.life-detail-chapter ol.detail-questions li.concern-fourth::before{content:"+"}

.book-size .size-plus{font-size:.5em;vertical-align:super;line-height:0}

.life-sample .gold-excerpt{margin:16px 0 0;max-width:32ch;font-size:16px;line-height:1.7;height:5.6lh;overflow:hidden;color:var(--text);-webkit-mask-image:linear-gradient(to bottom,#000 0 4lh,transparent 5.6lh);mask-image:linear-gradient(to bottom,#000 0 4lh,transparent 5.6lh)}

.book-score{padding:12px 0 14px;border-bottom:1px solid var(--line)}.book-score p{margin:4px 0}.book-score p+p{font-size:14px;color:#c5bab0}

/* 2026-11-29 주의사항 */
.detail-link-note { margin:18px 2px 0; color:#a59a8f; font-size:13px; line-height:1.6; text-align:center; word-break:keep-all; }
.detail-link-note + .btn { margin-top:10px; }
.book-score .score-note { margin-top:4px; color:#a59a8f; font-size:12.5px; line-height:1.6; word-break:keep-all; }
