:root {
  --bg: #120f1c;
  --bg-2: #1b1729;
  --card: #221d33;
  --line: #352e4d;
  --text: #f1ecfa;
  --muted: #a69fbd;
  --accent: #e8b86a;
  --accent-ink: #2a1d05;
  --danger: #ff8a8a;
  --wood: #5fbf7f;
  --fire: #ef6a5b;
  --earth: #d6a557;
  --metal: #c9ccd6;
  --water: #5a8fe0;
  --radius: 16px;
  --serif: 'Noto Serif KR', serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -200px, #2d2448 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font-family: Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  line-height: 1.6;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 480px; margin: 0 auto; padding: 32px 16px 80px; }

.hero { text-align: center; }
.eyebrow { color: var(--accent); font-size: 13px; letter-spacing: .12em; margin: 0 0 8px; }
h1 { font-family: var(--serif); font-size: 30px; line-height: 1.3; margin: 0 0 10px; }
h1 em { font-style: normal; color: var(--accent); }
h2 { font-family: var(--serif); font-size: 20px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 24px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  text-align: left;
}

.form { display: grid; gap: 18px; }
.field { display: grid; gap: 8px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--muted); }
input, select {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 12px;
  font: inherit;
  font-size: 16px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.row3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; }
.row2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.seg-sm { width: 60%; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 8px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.check { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.check input { width: auto; }
.hint, .fine { color: var(--muted); font-size: 12px; margin: 0; }
.fine { text-align: center; }
.error { color: var(--danger); font-size: 14px; margin: 0; min-height: 1em; }

.btn {
  display: block; width: 100%;
  border: 0; border-radius: 12px;
  padding: 15px;
  font: inherit; font-size: 16px; font-weight: 700;
  cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:disabled { opacity: .6; cursor: wait; }
.btn.ghost { background: transparent; color: var(--muted); margin-top: 6px; }

/* 결과 */
.result-head { text-align: center; margin: 8px 0 20px; }
.result-head .who { color: var(--muted); margin: 0; }
.result-head h1 { font-size: 26px; }

.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.pillar .pos { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.glyph {
  font-family: var(--serif);
  font-size: 26px; font-weight: 700;
  border-radius: 10px;
  padding: 8px 0 4px;
  margin-bottom: 6px;
  color: #15121f;
}
.glyph small { display: block; font-family: Pretendard, sans-serif; font-size: 12px; font-weight: 600; opacity: .75; }
.glyph.unknown { background: var(--bg-2); color: var(--muted); }
.el-wood { background: var(--wood); }
.el-fire { background: var(--fire); }
.el-earth { background: var(--earth); }
.el-metal { background: var(--metal); }
.el-water { background: var(--water); }
.note { font-size: 12px; color: var(--muted); margin: 12px 0 0; }

.bars { display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: 56px 1fr 24px; align-items: center; gap: 10px; font-size: 14px; }
.bar .track { height: 10px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 99px; }
.bar b { text-align: right; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { font-size: 13px; padding: 4px 10px; border-radius: 99px; background: var(--bg-2); border: 1px solid var(--line); }
.tag.good { border-color: var(--wood); }
.tag.warn { border-color: var(--fire); }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); margin: 0 0 10px; }
.badge.test { background: #3b3357; color: var(--accent); }

.share { text-align: center; }
.share .note { margin: 0 0 4px; }
.share img { display: block; width: 62%; max-width: 260px; aspect-ratio: 9 / 16; margin: 12px auto 16px; border-radius: 14px; background: var(--bg-2); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.share-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.share-actions .btn { margin: 0; }
.btn.line { background: transparent; color: var(--accent); border: 1px solid var(--accent); }

.teaser { border-color: var(--accent); }
.teaser .kw { font-family: var(--serif); font-size: 22px; color: var(--accent); margin: 4px 0; }

.locked { position: relative; overflow: hidden; }
.locked .blur { filter: blur(6px); user-select: none; pointer-events: none; color: var(--muted); }
.locked .lock-cover {
  position: absolute; inset: 0;
  display: grid; place-content: center; gap: 4px; text-align: center;
  background: linear-gradient(180deg, rgba(34,29,51,.2), rgba(34,29,51,.92) 60%);
}
.lock-cover .lock-title { font-weight: 700; }
.lock-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; }

.sticky-cta {
  position: sticky; bottom: 12px;
  margin-top: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.price-line { text-align: center; font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.price-line s { margin-right: 6px; }

/* 리포트 */
.report-section h3 { color: var(--accent); }
.report-section p { margin: 0 0 10px; white-space: pre-line; }
.loading { text-align: center; color: var(--muted); padding: 40px 0; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; margin: 0 auto 12px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 결제 시트 */
.sheet { border: 0; padding: 0; background: transparent; width: 100%; max-width: 480px; margin: auto auto 0; }
.sheet::backdrop { background: rgba(0,0,0,.6); }
.sheet-inner { background: var(--card); border: 1px solid var(--line); border-radius: 20px 20px 0 0; padding: 24px 20px 20px; color: var(--text); }
.co-list { padding-left: 18px; color: var(--muted); }
.co-price { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); padding: 14px 0; margin-bottom: 8px; }
.co-price strong { font-size: 22px; color: var(--accent); }
.sheet .fine { margin-bottom: 14px; }
.check.agree { align-items: flex-start; margin-bottom: 12px; line-height: 1.5; }
.check.agree input { margin-top: 4px; }

@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* 결제 동의 */
.check.agree.sub { padding-left: 12px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.sheet a, .fine a, .legal a { color: var(--accent); }
.sheet .error { margin: 4px 0 10px; }

/* 리포트 링크 저장 */
.save-link { border-color: var(--accent); }
.save-link p { margin: 0 0 10px; }
.row-copy { display: flex; gap: 8px; margin-bottom: 6px; }
.row-copy input { flex: 1; min-width: 0; font-size: 13px; padding: 10px; }
.btn.small { width: auto; padding: 10px 16px; font-size: 14px; }
a.btn { display: block; text-align: center; text-decoration: none; }

/* 사업자 정보 푸터 */
.site-footer { max-width: 480px; margin: 0 auto; padding: 24px 16px 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.7; }
.site-footer p { margin: 0 0 8px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 10px; }
.footer-links a { color: var(--text); text-decoration: none; }

/* 약관 페이지 */
.legal { text-align: left; }
.legal h1 { font-size: 24px; }
.legal h2 { font-size: 17px; margin: 28px 0 8px; }
.legal p, .legal li { font-size: 14px; color: var(--text); }
.legal ol, .legal ul { padding-left: 20px; }
.legal table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.legal th, .legal td { border: 1px solid var(--line); padding: 8px; vertical-align: top; text-align: left; }
.legal th { background: var(--bg-2); }
.legal .draft { background: var(--bg-2); border: 1px dashed var(--accent); border-radius: 10px; padding: 10px 12px; color: var(--accent); font-size: 13px; }
.legal .back { display: inline-block; margin-bottom: 16px; color: var(--muted); text-decoration: none; font-size: 14px; }
