/* 별이 정한 나라 — B안 파스텔 타로카드 (design/mockups/build.mjs B안에서 가져옴) */
/* shortcut: 글꼴은 저장소 맨 위 fonts/에서 바로 읽음, 배포할 때 같이 복사해야 함 */
@font-face { font-family: Pretendard; src: url(../fonts/subset/PretendardVariable-ko.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: Fromsol; src: url(../fonts/subset/Fromsol-ko.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: Baskerville; src: url('../fonts/english/librebaskerville/LibreBaskerville[wght].ttf'); font-weight: 400 700; font-display: swap; }

:root {
  --paper: #fffaf3; --ink: #4b3a52; --soft: #6c5a74; --line: #c9a45c; --accent: #a565ad; --accent2: #d9837b; --accent3: #b08a3e; --accent-ink: #8e4f97; --gold-ink: #8a6a2a; --rose-ink: #b0564e;
  --title: Fromsol, Pretendard, sans-serif; --body: Pretendard, -apple-system, sans-serif; --latin: Baskerville, serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: #f3e7f6; }
body {
  font-family: var(--body); color: var(--ink); word-break: keep-all; min-height: 100dvh;
}
body::before { content: ''; position: fixed; inset: 0; z-index: -1; background: url(stars.svg), linear-gradient(170deg, #f6ecf8, #fdeee4); }
main { max-width: 440px; margin: 0 auto; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

.screen { min-height: 100dvh; padding: calc(28px + env(safe-area-inset-top)) 22px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.panel { background: var(--paper); border-radius: 18px; box-shadow: 0 0 0 1px var(--line) inset, 0 0 0 5px var(--paper) inset, 0 0 0 6px #e7d4a8 inset, 0 8px 24px #c9a5c040; }
.btn { background: var(--accent-ink); /* 주 버튼 = 보라 한 색 (11-29 디자인 리뷰: 번지는 색 뺌, 흰 글씨 대비 5.6:1) */  color: #fff; border: 0; border-radius: 999px; box-shadow: 0 0 0 2px #fff inset; font-weight: 700; font-size: 19px; padding: 16px; width: 100%; min-height: 56px; }
.cta-test { position: fixed; z-index: 20; left: 16px; right: 16px; bottom: max(12px, env(safe-area-inset-bottom)); max-width: 480px; margin: 0 auto; width: auto; display: block; text-align: center; text-decoration: none; padding: 10px 16px; font-size: 17px; box-shadow: 0 0 0 2px #fff inset, 0 8px 24px #4b3a5266; } /* 12-06: 결과 화면에서 언제든 누를 수 있게 아래에 고정 */
.cta-test small { display: block; font-size: var(--fs-label); font-weight: 500; margin-top: 2px; }
#result:not([hidden]) { padding-bottom: 96px; }
@media (max-width: 899px) { body:has(#result:not([hidden]))::after { content: ''; position: fixed; z-index: 19; left: 0; right: 0; bottom: 0; height: calc(84px + env(safe-area-inset-bottom)); background: linear-gradient(to top, #fbeef0f2 35%, #fbeef000); pointer-events: none; } } /* 12-06 폰 디자인 리뷰 */ /* 고정 버튼에 마지막 글이 안 가리게 */
.btn.ghost { font-size: 17px; background: var(--paper); color: var(--ink); box-shadow: 0 0 0 1px var(--line) inset; }
.btn:focus-visible, .back:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tiny { font-size: 13px; color: var(--soft); text-align: center; }

/* 첫 화면 */
.brand { font-weight: 700; font-size: 17px; letter-spacing: .04em; text-align: center; }
.brand span { font-weight: 400; }
.brand a { color: inherit; text-decoration: none; display: inline-block; padding: 10px 4px; margin: -10px -4px; } /* 누를 곳 넓게 */
/* 카드 세 장 부채꼴: 카드 폭(--cw)은 화면 폭·높이 둘 다 보고 정함 */
#landing { --cw: min(30vw, 26dvh, 240px); gap: 22px; justify-content: center; }
main:has(#landing:not([hidden])) { max-width: 720px; }
.fan { position: relative; height: calc(var(--cw) * 1.5 + 40px); margin-top: 4px; }
.fan .card { position: absolute; top: 16px; left: 50%; width: var(--cw); transform-origin: 50% 100%; }
.fan .card:nth-child(1) { transform: translateX(-118%) rotate(-12deg); }
.fan .card:nth-child(2) { top: 0; z-index: 1; transform: translateX(-50%); }
.fan .card:nth-child(3) { transform: translateX(18%) rotate(12deg); }
/* 제목 두 줄, 각 줄은 줄바꿈 없이: 첫 줄(약 12.5글자 폭)에 맞춰 글자 크기 정함 */
#landing h1 { font: 400 min(36px, calc((100vw - 44px) / 12.5)) / 1.35 var(--title); text-align: center; white-space: nowrap; }
#landing h1 em { font-style: normal; color: var(--accent3); }
.sub { font-size: 15px; line-height: 1.6; text-align: center; }
.gets { list-style: none; padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; font-weight: 600; }
.gets li { display: flex; text-wrap: pretty; } /* 두 줄이면 별 아래가 아니라 글자 줄에 맞춰 (12-03 폰 점검) */
.gets b { color: var(--line); margin-right: 8px; flex: none; }
#landing .gets { font-size: 17px; padding: 18px 22px; gap: 10px; }
#landing .gets, #landing .btn { align-self: center; width: min(100%, 480px); }
#landing .tiny { font-size: 13px; }

/* 입력 */
.top { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; text-align: center; font-size: 16px; }
.back { background: none; border: 0; font-size: 22px; min-height: 44px; }
.fields { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
fieldset { border: 0; display: flex; flex-direction: column; gap: 8px; }
legend { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
legend small { font-weight: 400; font-size: 13px; color: var(--soft); }
/* 입력 칸: 아이폰 기본 모양(시간 칸이 납작해지는 것 등)을 끄고 모두 같은 높이 52px */
input:not([type=radio]):not([type=checkbox]), select { -webkit-appearance: none; appearance: none; border: 1px solid #0002; border-radius: 10px; padding: 0 14px; font: 16px var(--body); color: var(--ink); background: #fff; width: 100%; height: 52px; display: block; text-align: left; }
input[type=time]::-webkit-date-and-time-value { text-align: left; }
.combo { position: relative; }
#places { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; right: 0; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 24px #8a5f9433; overflow: hidden; }
#places button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0 14px; min-height: 46px; font-size: 15px; }
#places li + li button { border-top: 1px solid #0000000d; }
#places button:active { background: #f6ecf8; }
.row { display: flex; gap: 8px; align-items: center; }
.row > input, .row > select { flex: 1; min-width: 0; }
.row > select { padding: 0 10px; }
.row > select[name=ampm] { flex: 2; } /* 375px 폰에서 "오전/오후"가 "오전/오"로 잘리던 것 (12-03 폰 점검) */
/* 고르는 칸 표시(▾), 시간 줄이 좁으면 '몰라요'는 다음 줄로 */
select { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236c5a74'/%3E%3C/svg%3E") no-repeat right 10px center; padding-right: 24px !important; }
select:disabled { opacity: .5; }
.row:has(select) { flex-wrap: wrap; }
.unit { font-size: 15px; margin-left: -2px; }
.row:has(select) .chk { flex-basis: 100%; }
.date { display: grid; grid-template-columns: repeat(3, 1fr); }
.date input { min-width: 0; }
.chk { font-size: 14px; white-space: nowrap; display: flex; gap: 6px; align-items: center; min-height: 44px; }
.chk input { width: 20px; height: 20px; accent-color: var(--accent); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: 11px; font-weight: 600; font-size: 15px; cursor: pointer; }
.seg input:checked + span { background: var(--accent-ink); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: -3px; }
.hint { font-size: 13px; color: var(--soft); }
[aria-invalid] { border-color: #b3261e !important; box-shadow: 0 0 0 1px #b3261e; }
.seg:has([aria-invalid]) { border-color: #b3261e; box-shadow: 0 0 0 1px #b3261e; }
.error { color: #b3261e; font-size: 14px; font-weight: 600; min-height: 1em; }
.error:empty { display: none; }

/* 로딩 */
#loading { justify-content: center; align-items: center; text-align: center; }
.orb { width: 190px; height: 190px; position: relative; margin-bottom: 20px; }
.ring { position: absolute; inset: 0; border: 1.5px solid var(--line); border-radius: 50%; border-top-color: transparent; animation: spin 2.4s linear infinite; }
.r2 { inset: 22px; border-style: dashed; opacity: .6; animation-direction: reverse; animation-duration: 4s; }
.core { position: absolute; inset: 58px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font: 700 26px var(--latin); }
#loading h2 { font: 400 24px var(--title); }
.steps { list-style: none; font-size: 15px; line-height: 2.3; }
.steps li { opacity: .45; }
.steps li::before { content: '○ '; }
.steps li.done { opacity: .6; }
.steps li.done::before { content: '● '; }
.steps li.now { opacity: 1; font-weight: 700; color: var(--gold-ink); }
.steps li.now::before { content: '✦ '; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ring { animation: none; } }

/* 결과 — 첫 화면 */
/* 결과 글씨 크기는 5단계만: 라벨 13 · 본문 15 · 강조 17 · 소제목 20(프롬솔) · 제목 24/28(프롬솔) */
#result { gap: 12px; --fs-label: 13px; --fs-body: 15px; --fs-strong: 17px; --fs-h: 20px; --fs-title: 24px; }
#result p, #result li { text-wrap: pretty; } /* 마지막 줄에 한 글자만 남지 않게 */
#result h2, #result h3, #result h4, #result .line { text-wrap: balance; }
#result .tiny { font-size: var(--fs-label); line-height: 1.6; }
#result .notes { display: flex; flex-direction: column; gap: 6px; padding: 12px 4px 0; }
#result .notes .tiny { font-size: 14px; text-align: left; margin: 0; } /* 안내 세 줄을 한 덩어리로, 13→14px (12-06 디자인 리뷰) */
.cdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: middle; box-shadow: 0 0 0 1px #0002; }
/* 폰: .rbody 상자가 없는 것처럼(지금 그대로 한 줄로 쌓임) */
.rbody, .rleft { display: contents; }
.rleft > .card { order: -1; } /* 폰: 카드가 맨 위 (지금 그대로) */
.ract { display: none; } /* 카드 아래 공유 버튼 줄은 웹에서만, 폰은 맨 아래 .actions 2×2 */
.actions .btn, .ract .btn { min-height: 48px; padding: 10px 6px; }
/* 웹 결과: 왼쪽 카드 고정, 오른쪽 설명만 스크롤 */
@media (min-width: 900px) {
  main:has(#result:not([hidden])) { max-width: 1100px; }
  /* 왼쪽(제목·버튼·카드)이 한 화면에 들어오게 카드 폭을 화면 높이로 정하고, 세로 가운데에 고정 */
  #result { --cw: min(380px, calc((100dvh - 300px) * 2 / 3)); --top: clamp(24px, calc((100dvh - var(--cw) * 1.5 - 250px) / 2), 56px);
    display: grid; grid-template-columns: var(--cw) 1fr; gap: 48px; align-items: start; padding: var(--top) 40px 40px; }
  .rleft { display: flex; flex-direction: column; gap: 10px; position: sticky; top: var(--top); }
  .rleft > .card { width: 100%; order: 0; margin-top: 6px; }
  #result { --fs-title: 28px; }
  .rleft .line { text-align: center; }
  .ract { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; order: 1; margin-top: 6px; } /* 카드 아래 */
  .ract .btn { font-size: var(--fs-body); min-height: 46px; padding: 10px 6px; }
  .cta-test { left: auto; right: max(40px, calc(50% - 510px)); margin: 0; width: calc(min(100vw, 1100px) - 128px - var(--cw)); max-width: none; } /* 웹: 왼쪽 카드·버튼을 안 가리게 오른쪽 칸 아래에 */
  .actions .sh { display: none; } /* 웹은 왼쪽 버튼 줄을 씀 */
  .rbody { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
}
/* 웹 입력: 조금 크게, 화면 가운데 */
@media (min-width: 768px) {
  #form { zoom: 1.15; min-height: calc(100dvh / 1.15); justify-content: center; }
  main:has(#form:not([hidden])) { max-width: 520px; }
}
/* 컴퓨터 화면: 첫 화면·입력이 스크롤 없이 한 화면에 (12-03 사용자) */
@media (min-width: 900px) and (orientation: landscape) {
  #landing { --cw: clamp(130px, calc((100dvh - 470px) / 1.5), 240px); gap: 14px; padding-top: 20px; padding-bottom: 16px; } /* 카드 = 화면 높이에서 글·버튼 자리를 뺀 만큼 */
  #landing .gets { font-size: 16px; padding: 12px 20px; gap: 6px; }
  #form { zoom: 1; min-height: 100dvh; padding-top: 20px; padding-bottom: 16px; gap: 12px; }
  main:has(#form:not([hidden])) { max-width: 760px; }
  .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; align-items: start; }
  .fields .error { grid-column: 1 / -1; }
  #form > .tiny, #form > .btn { align-self: center; width: min(100%, 480px); }
}
@media (min-width: 900px) and (orientation: landscape) and (min-height: 860px) {
  #form { zoom: 1.15; min-height: calc(100dvh / 1.15); }
}
.card { position: relative; align-self: center; width: min(62vw, 240px); aspect-ratio: 2 / 3; container-type: inline-size; }
.card img { width: 100%; height: 100%; border-radius: 8px; box-shadow: 0 0 0 3px #fff, 0 10px 28px #8a5f9440; display: block; }
/* 이름판: 위치는 그림마다(content/name-plates.json), 글자 크기는 40장 모두 같게(가장 좁은 이름판 기준) */
.plate { position: absolute; display: flex; align-items: center; justify-content: center; white-space: nowrap; font: 400 3.6cqw var(--latin); letter-spacing: .04em; color: #5a3d2b; }
.rt { font: 400 var(--fs-title)/1.35 var(--title); text-align: center; }
.kw { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; list-style: none; }
.kw li { font-size: var(--fs-label); border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; background: #fff8; }
.me { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.me h3 { margin: 0; }
.me p { font-size: var(--fs-body); line-height: 1.7; }.me .badge { border: 1px solid var(--accent); border-radius: 99px; padding: 2px 12px; font: 400 15px/1.5 var(--title); }
.hook { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.hook h3 { margin: 0; }
.hook .theme { border-top: 1px dashed #c9a45c66; padding-top: 8px; }
.hook h4 { font-size: var(--fs-label); font-weight: 700; color: var(--accent-ink); }
.hook .train h4 { color: var(--gold-ink); }
.hook .names { font-weight: 700; font-size: var(--fs-strong); line-height: 1.5; margin: 2px 0; }
.hook p { font-size: var(--fs-body); line-height: 1.7; color: var(--soft); }
.hook .names { color: var(--ink); }
.hook .names { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; } /* 나라 이름은 알약 칸으로 (줄바꿈해도 오른쪽이 안 비게) */
.hook .names span { white-space: nowrap; font: 400 19px/1.4 var(--title); padding: 4px 12px; border-radius: 99px; background: #f3e4f6; box-shadow: 0 0 0 1px #c9a45c88 inset; }
.compat { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.compat > .panel { display: flex; gap: 14px; padding: 12px 14px; align-items: center; }
.compat .card { width: 84px; flex: none; align-self: center; }
.compat small { font: 400 16px var(--title); color: var(--rose-ink); }
.compat .good small { color: var(--accent-ink); }
.compat b { display: block; font: 400 var(--fs-h)/1.35 var(--title); margin: 2px 0 4px; }
.compat p { font-size: var(--fs-body); line-height: 1.7; }
.dest { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; }
.dest small { font: 400 16px var(--title); color: var(--soft); }
.dest .row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.dest b { font: 400 var(--fs-title) var(--title); white-space: nowrap; }
.dest .whs { display: flex; gap: 6px; margin-left: auto; }
.dest .wh { margin-left: 0; }
.wh { margin-left: auto; font-family: var(--body); font-size: var(--fs-label); font-weight: 700; color: #fff; background: #b4544b; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.line { font-size: var(--fs-body); line-height: 1.7; }
.sub2 { font-size: var(--fs-body); line-height: 1.7; color: var(--soft); margin-top: -4px; }
h3 { font: 400 var(--fs-h, 18px)/1.35 var(--title); margin-top: 6px; }
.top3 { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.top3 .cdot { margin-right: 0; }
.top3 li { font: 400 21px/1.4 var(--title); display: flex; gap: 10px; align-items: center; }
.top3 li > b { color: var(--gold-ink); width: 16px; }
.top3 .wh { margin-left: 0; }
.wh.long { background: var(--accent-ink); }
.wh + .wh { margin-left: 4px; }

/* 결과 — 펼쳐 보기 */
details { margin-top: 4px; }
summary { list-style: none; text-align: center; font-weight: 700; font-size: 15px; padding: 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff8; cursor: pointer; min-height: 48px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: ' ▼'; font-size: 11px; }
details[open] summary::after { content: ' ▲'; }
.more { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.block { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.block h4 { font: 400 var(--fs-h)/1.35 var(--title); }
.block p, .block li { font-size: var(--fs-body); line-height: 1.7; }
.block ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.country b { font: 400 20px/1.4 var(--title); }
.badge { display: inline-block; font: 400 17px var(--title); color: var(--accent-ink); margin-right: 8px; }
.year { font-weight: 700; color: var(--accent3); margin-right: 6px; }
.figure svg { width: 100%; height: auto; display: block; }
.ad { min-height: 100px; border: 1px dashed #0002; border-radius: 12px; }
.actions { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px; margin-top: 8px; }
.shmenu { display: flex; gap: 12px; }
.shmenu button { all: unset; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink); cursor: pointer; }
.shmenu button:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 12px; }
.shmenu i { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 2px 8px #8a5f9440; }
.shmenu svg { width: 28px; height: 28px; }
.shmenu .share i { background: var(--accent-ink); }
.shmenu .save i { background: #fff; box-shadow: 0 0 0 2px #c9a45c inset, 0 2px 8px #8a5f9440; }

/* 공유 카드 미리보기 (공유 시트가 없을 때) */
.shareBox { max-height: 90dvh; overflow: auto; margin: auto; border: 0; border-radius: 18px; padding: 16px; max-width: 360px; width: calc(100% - 32px); background: var(--paper); display: flex; flex-direction: column; gap: 10px; text-align: center; font-size: 14px; }
.shareBox:not([open]) { display: none; }
.shareBox::backdrop { background: #3b2f4a99; }
.shareBox img { width: 100%; border-radius: 10px; }
.shareBox a.btn { text-decoration: none; display: block; }
/* 공유 링크로 열었을 때: 카드 한 장 + 나도 해보기 */
.sharedCard { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 28px 8px 36px; text-align: center; }
.sharedHead { font-size: var(--fs-body, 15px); color: var(--soft); }
.sharedImg { width: 100%; max-width: 480px; aspect-ratio: 1080 / 1920; border-radius: 16px; box-shadow: 0 10px 28px #8a5f9440; background: #fff8; }
.sharedCard .card { width: min(70vw, 280px); }
.sharedCard .rt { font: 400 26px/1.35 var(--title); }
.sharedCard .line { font-size: 15px; line-height: 1.7; max-width: 360px; }
.sharedCard .btn { margin-top: 8px; width: 100%; max-width: 360px; }
/* 자세히 보기 '사주로 본 성격': 일간 줄은 프롬솔, 좋아해요·싫어해요는 진한 색 라벨 */
.more .dm { font: 400 20px/1.4 var(--title); color: var(--accent-ink); }
.more .lh { font-weight: 600; }
.more .lk, .more .ht { display: inline-block; margin-right: 6px; padding: 1px 10px; border-radius: 99px; color: #fff; font-size: 14px; }
.more .lk { background: var(--accent-ink); }
.more .ht { background: #b4544b; }
@media (min-width: 900px) { .actions { display: flex; } }
.more .dm .hj { font: 500 14px var(--body); margin: 0 2px; } /* 한자는 폰 기본 한자 글꼴로 나오므로 작은 보조 글씨 */
.shareLink { width: 100%; height: 44px; border: 1px solid #0002; border-radius: 10px; padding: 0 12px; font: 14px var(--body); color: var(--ink); background: #fff; }
