/* ───────── 토큰 ───────── */
:root {
  --bg: #F6F3EE;
  --surface: #FCFAF7;
  --ink: #24211F;
  --ink-2: #57524C;
  --ink-3: #807970;
  --line: #E2DCD3;
  --line-strong: #CFC7BC;
  --accent: #7A2433;
  --accent-hover: #651C29;
  --accent-soft: #F3E9E9;
  --accent-ink: #FFFFFF;
  --danger: #8A2A1E;
  --radius: 14px;
  --radius-sm: 10px;
  --wrap: 640px;
  --gutter: 20px;
  --bar-h: 76px;
  --serif: "Noto Serif KR", "Nanum Myeongjo", serif;
  --sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.35; }
p { margin: 0; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 50; background: var(--ink); color: #fff;
  padding: 8px 14px; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.page:focus, [tabindex="-1"]:focus { outline: none; }

/* ───────── 레이아웃 ───────── */
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.page > .content { flex: 1; }
.has-bar .content { padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom) + 24px); }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px var(--gutter); max-width: var(--wrap); margin: 0 auto; width: 100%;
}
.brand { font-family: var(--serif); font-size: 17px; text-decoration: none; letter-spacing: -0.01em; }
.topbar .link-btn { font-size: 14px; }

.eyebrow { font-size: 13px; letter-spacing: .08em; color: var(--accent); font-weight: 600; }
.serif { font-family: var(--serif); }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; color: var(--ink-3); }
.stack > * + * { margin-top: var(--gap, 16px); }
.divider { height: 1px; background: var(--line); border: 0; margin: 32px 0; }

/* ───────── 버튼 ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 24px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 16px; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover { border-color: var(--ink-2); }
.btn[disabled], .btn[aria-disabled="true"] { background: #D9D3CB; color: #7d776f; border-color: transparent; cursor: not-allowed; }
.btn-block { width: 100%; }
.link-btn {
  background: none; border: 0; padding: 6px 2px; color: var(--ink-2); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong);
}
.link-btn:hover { color: var(--ink); }

/* 하단 고정 행동 영역 — 안전 영역 고려, 본문은 .has-bar 패딩으로 가려지지 않음 */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
}
.bar-inner { max-width: calc(var(--wrap) - 2 * var(--gutter)); margin: 0 auto; display: flex; gap: 10px; }
.bar-inner .btn { flex: 1; }
.bar-inner .btn-secondary { flex: 0 0 auto; min-width: 96px; }

/* ───────── 랜딩 ───────── */
.hero { padding: 28px 0 8px; }
.hero h1 { font-family: var(--serif); font-size: clamp(30px, 8.4vw, 44px); letter-spacing: -0.02em; line-height: 1.32; }
.hero .sub { margin-top: 18px; color: var(--ink-2); font-size: 17px; }
.hero-art { margin: 28px auto 8px; width: min(280px, 78%); color: var(--accent); }
.hero-cta { margin-top: 28px; }
.hero-note { margin-top: 14px; font-size: 14px; color: var(--ink-2); text-align: center; }

.section { padding: 40px 0 0; }
.section h2 { font-family: var(--serif); font-size: 22px; letter-spacing: -0.01em; }
.domain-list { list-style: none; margin: 20px 0 0; padding: 0; border-top: 1px solid var(--line); }
.domain-list li { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.domain-list strong { font-weight: 600; }
.domain-list span { color: var(--ink-2); }
.steps { list-style: none; counter-reset: s; margin: 20px 0 0; padding: 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 18px 40px; color: var(--ink-2); }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 1px; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--accent); color: var(--accent); font-size: 13px; display: grid; place-items: center; font-weight: 600;
}
.steps strong { color: var(--ink); display: block; font-weight: 600; }

.callout { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.callout-accent { border-left: 3px solid var(--accent); }

/* ───────── 설문 ───────── */
.progress { height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; }
/* 진행도는 하단 버튼 영역 위에 표시 */
.has-progress { --bar-h: 104px; }
.bar-progress { max-width: calc(var(--wrap) - 2 * var(--gutter)); margin: 0 auto 10px; display: flex; align-items: center; gap: 12px; }
.bar-progress .progress { flex: 1; }
.bar-count { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-count b { color: var(--ink); font-weight: 600; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .3s var(--ease); }

.q { padding-top: 28px; }
.q fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.q legend { padding: 0; width: 100%; }
.q-title { font-family: var(--serif); font-size: clamp(21px, 5.6vw, 26px); letter-spacing: -0.015em; margin-top: 8px; line-height: 1.45; display: block; }
.q-num { color: var(--accent); margin-right: 2px; font-variant-numeric: tabular-nums; }
.q-title:focus { outline: none; }
.q-hint { margin-top: 10px; font-size: 14px; color: var(--ink-2); }
.q-hint b { color: var(--accent); font-weight: 600; }

.options { margin-top: 24px; display: grid; gap: 10px; }
.opt { position: relative; display: block; }
.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opt-box {
  display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start;
  padding: 15px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s;
  min-height: 56px;
}
.opt-box:hover { border-color: var(--ink-3); }
.opt-mark {
  width: 22px; height: 22px; margin-top: 2px; border: 1.5px solid var(--ink-3); border-radius: 50%;
  display: grid; place-items: center; background: #fff;
}
.opt.multi .opt-mark { border-radius: 6px; }
.opt-mark svg { width: 14px; height: 14px; opacity: 0; color: #fff; }
.opt input:checked + .opt-box { border: 2px solid var(--accent); padding: 14px 15px; background: var(--accent-soft); }
.opt input:checked + .opt-box .opt-mark { background: var(--accent); border-color: var(--accent); }
.opt input:checked + .opt-box .opt-mark svg { opacity: 1; }
.opt input:focus-visible + .opt-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.opt input:disabled + .opt-box { opacity: .5; cursor: not-allowed; }
.opt-text { font-size: 16px; line-height: 1.55; }
.opt-key { font-size: 12px; color: var(--ink-3); margin-right: 6px; font-variant-numeric: tabular-nums; }

.q-enter { animation: qIn .22s var(--ease) both; }
@keyframes qIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }


/* ───────── 분석 중 ───────── */
.center-state { text-align: center; padding: 72px 0; }
.center-state h1 { font-family: var(--serif); font-size: 22px; margin-top: 24px; }
.center-state p { margin-top: 10px; color: var(--ink-2); }
.pulse { width: 96px; margin: 0 auto; color: var(--accent); }
.pulse circle { transform-origin: center; animation: breathe 2.4s ease-in-out infinite; }
.pulse circle:nth-child(2) { animation-delay: .6s; }
@keyframes breathe { 0%, 100% { opacity: .35; transform: scale(.94); } 50% { opacity: 1; transform: scale(1); } }

/* ───────── 결과 ───────── */
.result-head { padding: 24px 0 8px; }
.result-head .eyebrow { display: block; }
.type-name { font-family: var(--serif); font-size: clamp(27px, 7.6vw, 38px); letter-spacing: -0.02em; line-height: 1.35; margin-top: 12px; }
.perception { margin-top: 20px; padding: 18px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.perception small { display: block; font-size: 13px; color: var(--ink-2); }
.perception p { font-family: var(--serif); font-size: 19px; line-height: 1.6; margin-top: 6px; }

.cards { display: grid; gap: 12px; margin-top: 20px; }
@media (min-width: 560px) { .cards { grid-template-columns: 1fr 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card-label { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-2); }
.card-label strong { color: var(--accent); font-weight: 600; }
.card h3 { font-family: var(--serif); font-size: 19px; margin-top: 10px; }
.card p { margin-top: 8px; color: var(--ink-2); font-size: 15px; }
.card.limited h3 { color: var(--ink-2); }
.tag-src { font-size: 12px; border: 1px solid var(--line-strong); padding: 0 8px; border-radius: 999px; white-space: nowrap; }

.evidence { margin: 12px 0 0; padding: 0; list-style: none; }
.evidence li { font-size: 13px; color: var(--ink-3); padding-left: 12px; position: relative; margin-top: 4px; line-height: 1.55; }
.evidence li::before { content: ""; position: absolute; left: 0; top: .7em; width: 5px; height: 1px; background: var(--ink-3); }
details.ev summary { font-size: 13px; color: var(--ink-2); cursor: pointer; margin-top: 12px; }

.charm { margin-top: 28px; }
.charm .card { border-color: var(--accent); }
.summary-text { margin-top: 12px; color: var(--ink); }
.notes { margin-top: 20px; }
.notes p { font-size: 13.5px; color: var(--ink-2); margin-top: 8px; padding-left: 14px; border-left: 2px solid var(--line-strong); }

.upsell { margin-top: 36px; padding: 24px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.upsell h2 { font-family: var(--serif); font-size: 20px; }
.upsell ul { margin: 14px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 15px; }
.upsell li { margin-top: 4px; }
.price-line { margin-top: 16px; font-size: 15px; }
.price-line b { font-size: 19px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--accent); color: var(--accent); font-weight: 600; vertical-align: 2px; }
.badge-warn { border-color: var(--danger); color: var(--danger); }

.actions { display: grid; gap: 10px; margin-top: 24px; }

/* 상세 결과 */
.detail-section { padding-top: 36px; }
.detail-section > h2 { font-family: var(--serif); font-size: 20px; display: flex; gap: 10px; align-items: baseline; }
.detail-section > h2 .num { font-size: 14px; color: var(--accent); font-family: var(--sans); font-weight: 600; font-variant-numeric: tabular-nums; }
.detail-section p + p { margin-top: 12px; }
.detail-section > p, .detail-section .body { margin-top: 14px; }
.item-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.item-list li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; }
.item-list b { display: block; font-size: 14px; color: var(--accent); font-weight: 600; }
.item-list span { display: block; margin-top: 4px; }
.domain-block { border-top: 1px solid var(--line); padding: 18px 0 4px; margin-top: 14px; }
.domain-block h3 { font-size: 16px; font-weight: 600; }
.domain-block h3 small { font-weight: 500; color: var(--accent); margin-right: 8px; font-size: 13px; }
.domain-block p { margin-top: 8px; color: var(--ink-2); }

/* ───────── 결제 ───────── */
.mock-banner { background: #FFF5D9; border: 1px dashed #A8892A; color: #5C4A0E; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin-top: 16px; font-size: 15px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; text-align: right; }
.code-box {
  margin-top: 16px; padding: 18px; text-align: center; border: 2px dashed var(--accent); border-radius: var(--radius);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 20px; letter-spacing: .06em; background: var(--surface);
}
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--accent); flex: 0 0 auto; }
.field { display: block; margin-top: 16px; }
.field span { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 6px; }
.field input {
  width: 100%; min-height: 52px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #fff; font-size: 17px; letter-spacing: .04em; text-transform: uppercase;
}
.error-text { color: var(--danger); font-size: 14px; margin-top: 10px; }

/* ───────── 법적 고지 / 푸터 ───────── */
.legal h1 { font-family: var(--serif); font-size: 24px; padding-top: 16px; }
.legal h2 { font-size: 17px; margin-top: 28px; }
.legal p, .legal li { color: var(--ink-2); font-size: 15px; margin-top: 8px; }
.legal ul { padding-left: 18px; }
.todo { background: #FFF5D9; color: #5C4A0E; padding: 0 6px; border-radius: 4px; font-size: .92em; }
.footer { margin-top: 56px; border-top: 1px solid var(--line); padding: 24px 0 calc(32px + env(safe-area-inset-bottom)); font-size: 13px; color: var(--ink-3); }
.footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; }
.footer a { color: var(--ink-2); text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.has-bar .footer { display: none; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--bar-h) + env(safe-area-inset-bottom) + 16px); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 40;
  max-width: calc(100% - 32px);
}

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