/* 사주팔레트 스타일
   본문: Pretendard / 제목·강조: 마루부리(얇은 세리프)
   레이아웃: 앱처럼 한 줄 기둥(최대 560px), 카드는 꼭 필요한 곳에만 */
:root {
  --bg: #ffffff;
  --soft: #f4f5f7;
  --soft-2: #eceef1;
  --line: #e6e8eb;
  --text: #191f28;
  --sub: #6b7684;
  --faint: #a2a9b3;
  --primary: #191f28;
  --on-primary: #ffffff;
  --accent: #e8573c;          /* 2027 정미년(丁火)의 불빛 */
  --accent-soft: #fdeee9;
  --error: #e5484d;
  --wood: #2f9e6e;
  --fire: #e5533d;
  --earth: #c99a2e;
  --metal: #8a94a3;
  --water: #2d4a86;
  --radius: 18px;
  --sans: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --serif: "MaruBuri", "Noto Serif KR", "Nanum Myeongjo", serif;
  --serif-light: "MaruBuriLight", "MaruBuri", "Noto Serif KR", "Nanum Myeongjo", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --soft: #1b1e24;
    --soft-2: #23272e;
    --line: #2a2f37;
    --text: #eef0f3;
    --sub: #9aa3ae;
    --faint: #6b737e;
    --primary: #eef0f3;
    --on-primary: #111317;
    --accent: #ff7a5c;
    --accent-soft: #2e1d19;
    --water: #6f8fd6;
    --metal: #a7b0bd;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: -0.01em;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

/* 헤더 */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.top.scrolled { border-bottom-color: var(--line); }
.top .wrap { height: 56px; display: flex; align-items: center; justify-content: space-between; }
.logo { font-family: var(--serif); font-size: 20px; font-weight: 400; text-decoration: none; letter-spacing: -0.03em; display: inline-flex; align-items: center; gap: 7px; }
.logo .dots { display: inline-flex; gap: 3px; }
.logo .dots i { width: 5px; height: 5px; border-radius: 50%; }
.logo .dots i:nth-child(1) { background: var(--wood); } .logo .dots i:nth-child(2) { background: var(--fire); } .logo .dots i:nth-child(3) { background: var(--earth); } .logo .dots i:nth-child(4) { background: var(--metal); } .logo .dots i:nth-child(5) { background: var(--water); }
.top nav a { font-size: 14px; color: var(--sub); text-decoration: none; }

/* 첫 화면 */
.hero { padding-top: 40px; padding-bottom: 8px; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--accent); margin: 0 0 14px; }
.hero h1 {
  font-family: var(--serif-light); font-weight: normal;
  font-size: clamp(30px, 8.2vw, 40px); line-height: 1.32; letter-spacing: -0.035em;
  margin: 0 0 14px;
}
.hero p.lede { color: var(--sub); margin: 0; font-size: 15px; }

/* 입력 */
.form { padding-top: 28px; padding-bottom: 32px; display: flex; flex-direction: column; gap: 26px; }
.field { display: flex; flex-direction: column; gap: 10px; border: 0; padding: 0; margin: 0; min-width: 0; }
.label { font-size: 14px; font-weight: 600; color: var(--sub); }
.row { display: grid; gap: 8px; }
.row.date { grid-template-columns: 1.3fr 1fr 1fr; }
.row.time { grid-template-columns: 1fr 1fr; }

.select {
  position: relative;
}
.select select {
  appearance: none; -webkit-appearance: none;
  width: 100%; height: 54px; padding: 0 36px 0 16px;
  background: var(--soft); border: 1.5px solid transparent; border-radius: 14px;
  font-size: 17px; font-weight: 500; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.select select:focus { outline: none; border-color: var(--text); background: var(--bg); }
.select select:disabled { color: var(--faint); cursor: not-allowed; }
.select::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px;
  border-right: 1.5px solid var(--sub); border-bottom: 1.5px solid var(--sub);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
.field.invalid .select select { border-color: var(--error); }

.segment {
  display: grid; grid-template-columns: 1fr 1fr; padding: 4px; gap: 4px;
  background: var(--soft); border-radius: 14px;
}
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment label {
  height: 44px; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; font-weight: 600; color: var(--sub); cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.segment input:checked + label { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.segment input:focus-visible + label { outline: 2px solid var(--accent); }

.check { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; user-select: none; width: fit-content; }
.check input { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; margin: 0; border-radius: 7px; border: 1.5px solid var(--faint); display: grid; place-content: center; cursor: pointer; transition: background .15s, border-color .15s; }
.check input::after { content: ""; width: 6px; height: 11px; border: solid var(--on-primary); border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); opacity: 0; }
.check input:checked { background: var(--primary); border-color: var(--primary); }
.check input:checked::after { opacity: 1; }
.hint { font-size: 13px; color: var(--faint); margin: -2px 0 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips label {
  height: 40px; padding: 0 16px; display: inline-flex; align-items: center;
  border-radius: 999px; border: 1.5px solid var(--line); font-size: 15px; font-weight: 500; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.chips input:checked + label { border-color: var(--text); background: var(--text); color: var(--bg); }
.chips input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn {
  height: 56px; border: 0; border-radius: 16px; padding: 0 20px;
  background: var(--primary); color: var(--on-primary);
  font-size: 17px; font-weight: 700; cursor: pointer; width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  transition: transform .08s, opacity .15s;
}
.btn:active { transform: scale(.985); }
.btn.secondary { background: var(--soft); color: var(--text); font-weight: 600; }
.btn.accent { background: var(--accent); color: #fff; }
.btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.error { color: var(--error); font-size: 14px; font-weight: 500; margin: -10px 0 0; min-height: 0; }
.privacy-note { font-size: 13px; color: var(--faint); text-align: center; margin: -12px 0 0; }

/* 결과 */
.divider { height: 10px; background: var(--soft); border: 0; margin: 0; }
.result { padding-top: 36px; padding-bottom: 24px; scroll-margin-top: 56px; }
.result-meta { font-size: 14px; color: var(--sub); margin: 0 0 8px; }
.result h2 { font-family: var(--serif-light); font-weight: normal; font-size: 32px; line-height: 1.3; margin: 0 0 6px; letter-spacing: -0.03em; }
.result h2 em { font-style: normal; font-family: var(--serif); }
.result .image-line { color: var(--sub); margin: 0 0 16px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 28px; }
.tag { font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 8px; background: var(--soft); color: var(--sub); }

.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.pillar { text-align: center; border-radius: 14px; padding: 12px 4px 12px; background: var(--soft); min-width: 0; }
.pillar.me { background: var(--text); color: var(--bg); }
.pillar.me .pillar-label, .pillar.me .ko { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.pillar-label { font-size: 12px; font-weight: 600; color: var(--sub); margin-bottom: 8px; }
.char { font-family: var(--serif); font-size: 30px; line-height: 1.15; display: flex; align-items: center; justify-content: center; gap: 5px; }
.char + .char { margin-top: 4px; }
.dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.ko { font-size: 12px; color: var(--sub); margin-top: 8px; }
.pillar.empty .char { color: var(--faint); font-family: var(--sans); font-size: 15px; height: 69px; }
.legend { font-size: 12px; color: var(--faint); margin: 0 0 28px; }

.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); }

.elements { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.el-row { display: grid; grid-template-columns: 42px 1fr 26px; align-items: center; gap: 10px; font-size: 14px; }
.el-name { font-weight: 600; }
.bar { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 99px; transition: width .5s ease; }
.el-count { text-align: right; color: var(--sub); font-variant-numeric: tabular-nums; }

/* 탭 */
.tabs {
  position: sticky; top: 56px; z-index: 10; background: var(--bg);
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line); margin: 32px calc(-1 * max(20px, env(safe-area-inset-left))) 0;
  padding: 0 max(20px, env(safe-area-inset-left));
}
.tab {
  height: 50px; background: none; border: 0; font-size: 15px; font-weight: 600; color: var(--faint);
  cursor: pointer; position: relative;
}
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 18%; right: 18%; bottom: -1px; height: 2px; background: var(--text); border-radius: 2px; }

.panel { padding-top: 24px; display: flex; flex-direction: column; gap: 24px; }
.period-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.period-nav .when { font-size: 15px; font-weight: 600; text-align: center; flex: 1; }
.period-nav .when small { display: block; font-size: 13px; color: var(--sub); font-weight: 500; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--soft); cursor: pointer; display: grid; place-items: center; flex: none; }
.icon-btn svg { width: 18px; height: 18px; stroke: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: default; }

.headline { font-family: var(--serif-light); font-weight: normal; font-size: 27px; line-height: 1.35; letter-spacing: -0.03em; margin: 0; }
.headline-sub { color: var(--sub); margin: 6px 0 0; }
.body-text { margin: 0; font-size: 16px; }

.section { display: flex; flex-direction: column; gap: 6px; }
.section h3 { font-size: 15px; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 8px; }
.section h3 .focus { font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 2px 7px; border-radius: 6px; }
.section p { margin: 0; color: var(--text); }
.list { display: flex; flex-direction: column; gap: 20px; }

.todo { background: var(--soft); border-radius: var(--radius); padding: 18px 18px; display: flex; gap: 12px; align-items: flex-start; }
.todo .num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--text); color: var(--bg); font-size: 13px; font-weight: 700; display: grid; place-items: center; margin-top: 1px; }
.todo p { margin: 0; }
.todo small { display: block; font-size: 13px; color: var(--sub); font-weight: 600; margin-bottom: 2px; }
.sub-note { font-size: 14px; color: var(--sub); margin: 0; }
.notice { font-size: 14px; color: var(--sub); background: var(--soft); border-radius: 14px; padding: 14px 16px; margin: 0; }

/* 가이드북 안내 */
.cta { margin-top: 36px; border: 1.5px solid var(--line); border-radius: 22px; padding: 24px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.cta .eyebrow { margin: 0; }
.cta h3 { font-family: var(--serif-light); font-weight: normal; font-size: 24px; line-height: 1.35; margin: 0; letter-spacing: -0.03em; }
.cta p { margin: 0; color: var(--sub); font-size: 15px; }
.cta ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.cta li { display: flex; gap: 8px; }
.cta li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-top: 10px; flex: none; }
.price { font-size: 14px; color: var(--sub); }
.price b { font-size: 18px; color: var(--text); }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 20px; }
.actions .btn { height: 50px; font-size: 15px; }
.actions .wide { grid-column: 1 / -1; }
.disclaimer { font-size: 13px; color: var(--faint); margin: 20px 0 0; }

/* 자주 묻는 질문 */
.faq { padding-top: 40px; padding-bottom: 40px; }
.faq h2 { font-family: var(--serif-light); font-weight: normal; font-size: 26px; margin: 0 0 12px; letter-spacing: -0.03em; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; padding: 18px 28px 18px 0; font-weight: 600; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; position: absolute; right: 4px; top: 26px; width: 8px; height: 8px; border-right: 1.5px solid var(--sub); border-bottom: 1.5px solid var(--sub); transform: rotate(45deg); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(-135deg); top: 30px; }
.faq details p { margin: 0 0 18px; color: var(--sub); font-size: 15px; }

/* 하단 */
.foot { background: var(--soft); padding-top: 28px; padding-bottom: calc(40px + env(safe-area-inset-bottom)); font-size: 13px; color: var(--sub); }
.foot p { margin: 0 0 6px; }
.foot .logo { font-size: 17px; display: inline-block; margin-bottom: 10px; }

/* 알림 */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100% - 40px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.fade-in { animation: fadeIn .35s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

@media (min-width: 720px) {
  .hero { padding-top: 64px; }
}
