/* 복도령의 사주카페 - 사주 페이지 공통 디자인 */
:root {
  --night: #1C2142;
  --night-2: #252C56;
  --night-line: #3A4274;
  --moon: #E7C26B;
  --moon-soft: #F3DFA6;
  --hanji: #F6F1E7;
  --hanji-2: #EFE7D6;
  --ink: #1E1C24;
  --seal: #B8352B;
  --on-night: #EEE8DA;
  --on-night-muted: #A9A8C4;
  --muted: #6B6577;
  --line: #DDD3C0;
  --wood: #3F8F5E;
  --fire: #C9473C;
  --earth: #C1922B;
  --metal: #9C9FAD;
  --water: #2F3A5E;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--night);
  color: var(--on-night);
  font: 400 16px/1.7 "IBM Plex Sans KR", system-ui, sans-serif;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
button, input, select { font: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--moon); outline-offset: 3px; }
.serif { font-family: "Song Myung", serif; font-weight: 400; }

/* 머리 */
.site-top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 16px; width: 100%; max-width: 1040px; margin: 0 auto; padding: 14px 20px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-seal {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 4px;
  background: var(--seal); color: var(--hanji); font-family: "Song Myung", serif; font-size: 1.05rem; line-height: 1;
}
.brand-name { font-family: "Song Myung", serif; font-size: 1.2rem; color: var(--on-night); }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .9375rem; font-weight: 600; }
.site-nav a { text-decoration: none; color: var(--on-night-muted); }
.site-nav a[aria-current="page"] { color: var(--moon); }
.site-nav a:hover { color: var(--on-night); }

.wrap { flex: 1; width: 100%; max-width: 880px; margin: 0 auto; padding: 8px 20px 40px; }

/* 첫 화면 */
.hero { display: grid; justify-items: center; text-align: center; gap: 6px; }
.hero img { width: min(70vw, 300px); height: auto; margin-bottom: -10px; }
h1 { margin: 0; font-family: "Song Myung", serif; font-weight: 400; font-size: clamp(2.1rem, 8.5vw, 3.3rem); line-height: 1.2; color: var(--moon-soft); }
.lede { margin: 0 auto; max-width: 32em; color: var(--on-night-muted); font-size: 1.0625rem; }

/* 카드 */
.card { background: var(--hanji); color: var(--ink); border-radius: 8px; padding: 22px 18px; }
@media (min-width: 640px) { .card { padding: 28px 28px; } }
.card + .card, .card + .section-title, .section-title + .card { margin-top: 18px; }
.card h2, .section-title {
  margin: 0 0 12px; font-family: "Song Myung", serif; font-weight: 400; font-size: 1.55rem; line-height: 1.3;
}
.section-title { margin-top: 40px; color: var(--moon-soft); }
.card h3 { margin: 22px 0 6px; font-size: 1.0625rem; font-weight: 600; }
.card p { margin: 0 0 12px; max-width: 42em; }
.card p:last-child { margin-bottom: 0; }
.muted { color: var(--muted); }
.note { font-size: .875rem; color: var(--muted); }

/* 입력 양식 */
.form { margin-top: 26px; }
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field > label, .field > .label { font-weight: 600; font-size: .9375rem; }
.input, .select {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1.5px solid #CFC6B5; border-radius: 10px;
  background: #fff; color: var(--ink); font-size: 1.0625rem;
}
.date-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; }
.seg { display: inline-flex; padding: 3px; border: 1.5px solid #CFC6B5; border-radius: 10px; background: #fff; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; min-width: 72px; padding: 9px 16px; border-radius: 7px; text-align: center; cursor: pointer; }
.seg input:checked + span { background: var(--night); color: var(--on-night); font-weight: 600; }
.seg input:focus-visible + span { outline: 3px solid var(--moon); outline-offset: 2px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .9375rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--night); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
details.advanced { margin: 4px 0 18px; }
details.advanced summary { cursor: pointer; font-weight: 600; color: var(--muted); }
details.advanced .field { margin-top: 12px; }
.error { min-height: 1.5em; margin: 0 0 10px; color: var(--seal); font-weight: 600; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 54px; padding: 14px 22px;
  border: 1.5px solid var(--night-line); border-radius: 12px; background: var(--night-2); color: var(--on-night);
  font-weight: 600; font-size: 1.0625rem; text-decoration: none; cursor: pointer;
}
.btn.primary { width: 100%; border-color: var(--moon); background: var(--moon); color: var(--night); font-family: "Song Myung", serif; font-weight: 400; font-size: 1.45rem; }
.btn.dark { background: var(--night); border-color: var(--night); color: var(--moon-soft); }
.btn:active { transform: translateY(1px); }

/* 사주 원국 */
.person { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.chip { display: inline-block; padding: 4px 10px; border: 1px solid var(--night-line); border-radius: 999px; color: var(--on-night-muted); font-size: .875rem; }
.card .chip { border-color: var(--line); color: var(--ink); background: #fff; }
.chart { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.chart .col { display: grid; gap: 6px; justify-items: center; }
.chart .head { font-size: .875rem; color: var(--muted); font-weight: 600; }
.chart .god { font-size: .8125rem; color: var(--ink); min-height: 1.4em; }
.chart .god.me { color: var(--seal); font-weight: 600; }
.tile {
  display: grid; place-items: center; width: 100%; max-width: 92px; aspect-ratio: 1; border-radius: 10px;
  color: #fff; font-family: "Song Myung", serif; line-height: 1;
}
.tile b { font-weight: 400; font-size: clamp(1.9rem, 9vw, 2.9rem); }
.tile small { font-family: "IBM Plex Sans KR", sans-serif; font-size: .75rem; opacity: .9; margin-top: -8px; }
.tile.unknown { background: var(--hanji-2); color: var(--muted); border: 1.5px dashed #CFC6B5; }
.tile.unknown b { font-size: 1.1rem; font-family: "IBM Plex Sans KR", sans-serif; font-weight: 600; }
.el-0 { background: var(--wood); }
.el-1 { background: var(--fire); }
.el-2 { background: var(--earth); }
.el-3 { background: var(--metal); color: #1E1C24; }
.el-4 { background: var(--water); }
.chart .hidden { font-size: .75rem; color: var(--muted); line-height: 1.4; }
.chart .stage { font-size: .8125rem; color: var(--ink); }
.chart-legend { margin-top: 14px; font-size: .8125rem; color: var(--muted); }

/* 오행 막대 */
.bars { display: grid; gap: 8px; margin: 6px 0 16px; }
.bar-row { display: grid; grid-template-columns: 52px 1fr 3em; align-items: center; gap: 10px; }
.bar-row .name { font-weight: 600; }
.bar-row .name span { color: var(--muted); font-weight: 400; margin-left: 2px; }
.bar-track { height: 16px; border-left: 1px solid #CFC6B5; }
.bar-fill { height: 100%; border-radius: 0 4px 4px 0; min-width: 0; }
.bar-row .count { text-align: right; font-variant-numeric: tabular-nums; }

/* 일간 */
.daymaster { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; margin-bottom: 14px; }
.daymaster .tile { width: 84px; }
.daymaster .title { font-family: "Song Myung", serif; font-size: 1.6rem; line-height: 1.25; }
.daymaster .image { color: var(--muted); }
.keywords { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; }

/* 강약 눈금 */
.meter { position: relative; margin: 8px 0 30px; }
.meter-track { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; height: 10px; }
.meter-track span { background: #E2D8C3; }
.meter-track span:first-child { border-radius: 5px 0 0 5px; }
.meter-track span:last-child { border-radius: 0 5px 5px 0; }
.meter-track span.on { background: var(--night); }
.meter-labels { display: grid; grid-template-columns: repeat(5, 1fr); margin-top: 6px; font-size: .75rem; color: var(--muted); text-align: center; }
.meter-labels .on { color: var(--ink); font-weight: 600; }

.lucky { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 8px 0 14px; }
.lucky div { padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.lucky dt { font-size: .8125rem; color: var(--muted); }
.lucky dd { margin: 2px 0 0; font-weight: 600; }
.link-arrowless { color: var(--seal); font-weight: 600; }

.sinsal { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.sinsal li { padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.sinsal b { display: block; margin-bottom: 2px; }

/* 상세 풀이 목록 */
.topics { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.topics a {
  display: grid; gap: 4px; height: 100%; padding: 18px; border: 1.5px solid var(--night-line); border-radius: 10px;
  background: var(--night-2); text-decoration: none;
}
.topics a:hover { border-color: var(--moon); }
.topics b { font-family: "Song Myung", serif; font-weight: 400; font-size: 1.3rem; color: var(--moon-soft); }
.topics span { color: var(--on-night-muted); font-size: .9375rem; }
.topics .current { border-color: var(--moon); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.actions .btn { flex: 1 1 200px; }

/* 상세 페이지 */
.detail-head { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
.detail-head img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; object-position: 50% 20%; background: var(--night-2); border: 2px solid var(--moon); }
.detail-head h1 { font-size: clamp(1.8rem, 7vw, 2.6rem); }
.detail-head p { margin: 2px 0 0; color: var(--on-night-muted); }
.say {
  position: relative; margin: 0 0 14px; padding: 14px 16px; border-left: 3px solid var(--seal);
  background: #fff; border-radius: 0 8px 8px 0;
}
.timeline { display: grid; gap: 8px; margin: 6px 0 16px; padding: 0; list-style: none; }
.timeline li {
  display: grid; grid-template-columns: 4.6em 1fr; gap: 12px; align-items: center; padding: 10px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
}
.timeline li.now { border: 2px solid var(--night); }
.timeline .gz { font-family: "Song Myung", serif; font-size: 1.35rem; text-align: center; }
.timeline .meta { font-size: .875rem; color: var(--muted); }
.timeline .gods { font-weight: 600; }
.pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; }
.pager a { color: var(--moon-soft); font-weight: 600; text-decoration: none; }
.pager a:hover { text-decoration: underline; }

/* 간단 입력 양식 */
.person-box { margin: 0 0 18px; padding: 16px 14px 4px; border: 1.5px solid var(--line); border-radius: 10px; background: #FBF8F1; }
.person-box legend { padding: 0 6px; font-family: "Song Myung", serif; font-size: 1.25rem; }
@media (min-width: 760px) { .people { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; } .people .person-box { margin: 0 0 18px; } }

/* 별점 */
.stars { color: var(--earth); letter-spacing: 1px; white-space: nowrap; }
.stars .off { color: #DDD3C0; }
.big-stars { margin: 0 0 10px; font-size: 1.9rem; line-height: 1.2; }
.areas { display: grid; gap: 10px; margin: 0; }
.areas div { padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.areas dt { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.areas dd { margin: 4px 0 0; }
.saying { font-size: 1.25rem; line-height: 1.6; }
.part-sub { margin-top: -6px !important; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }

/* 궁합 점수 */
.score-card { text-align: center; }
.score-card p { margin-left: auto; margin-right: auto; }
.pair { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; margin-bottom: 8px; }
@media (min-width: 520px) { .pair { flex-direction: row; gap: 16px; } }
.pair-person { display: flex; align-items: center; gap: 10px; text-align: left; }
.pair-person .tile { width: 56px; }
.pair-person .tile b { font-size: 1.9rem; }
.pair-and { color: var(--muted); }
.score { margin: 10px 0 0 !important; font-family: "Song Myung", serif; font-size: 1.4rem; color: var(--seal); }
.score b { font-weight: 400; font-size: clamp(3.6rem, 18vw, 5rem); line-height: 1; }
.score-card h2 { margin: 4px 0 6px; font-size: 1.9rem; }

/* 사주 기초 설명 */
.learn h2 { color: var(--ink); }
.learn dl { display: grid; gap: 10px; margin: 0; }
.learn dt { font-weight: 600; }
.learn dd { margin: 0; color: var(--ink); }

footer { padding: 8px 20px 32px; text-align: center; font-size: .875rem; color: var(--on-night-muted); }
footer p { margin: 4px auto; max-width: 38em; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin: 8px 0 12px; font-weight: 600; }
.foot-links a { color: var(--on-night); text-decoration: none; }
.foot-links a:hover { text-decoration: underline; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 30; padding: 12px 20px;
  border-radius: 999px; background: var(--hanji); color: var(--ink); font-weight: 600; opacity: 0; pointer-events: none;
  transform: translate(-50%, 10px); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
