:root {
  --bg: #ffffff;
  --sur: #f5f6f8;
  --sur-2: #eceef2;
  --ink: #17181c;
  --sub: #6b7079;
  --line: #e6e8ec;
  --accent: #6d5dfc;
  --accent-soft: #eeebff;
  --radius: 20px;
  --wood: #3fa06b; --fire: #f0565c; --earth: #e2a53a; --metal: #8e97a3; --water: #4b7be5;
  --wood-bg: #e6f5ec; --fire-bg: #feecec; --earth-bg: #fcf2dd; --metal-bg: #eef0f3; --water-bg: #e9f0fd;
  font-family: "Pretendard Variable", "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { color: var(--ink); background: var(--bg); min-height: 100vh; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
#app { max-width: 480px; margin: 0 auto; padding: 0 20px 72px; }
.screen { animation: rise .3s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }
@media (prefers-reduced-motion: reduce) { .screen, .float { animation: none !important; } }

/* 상단 바 */
.top { display: flex; align-items: center; justify-content: space-between; height: 56px; margin: 0 -4px 4px; }
.top .logo { font-weight: 800; font-size: 17px; letter-spacing: -0.3px; text-decoration: none; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.top .logo i { width: 22px; height: 22px; border-radius: 7px; background: var(--accent); display: inline-block; position: relative; }
.top .logo i::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #fff; }
.top a.sm { font-size: 13px; color: var(--sub); text-decoration: none; }

h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.6px; line-height: 1.3; margin: 6px 0 8px; }
h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.4px; margin: 0 0 8px; }
h3 { font-size: 15px; font-weight: 700; margin: 0 0 10px; letter-spacing: -0.2px; }
p { line-height: 1.65; margin: 0 0 10px; }
.lead { color: var(--sub); margin: 0 0 16px; line-height: 1.6; font-size: 15px; }
.hint { color: var(--sub); font-size: 13px; line-height: 1.6; }
.center { text-align: center; }
.eyebrow { font-size: 13px; font-weight: 700; color: var(--accent); margin: 0 0 4px; }

.card { background: var(--sur); border-radius: var(--radius); padding: 20px 18px; margin: 12px 0; }
.card.white { background: #fff; border: 1px solid var(--line); }

/* 캐릭터 */
.chars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 10px 0 4px; }
.chars img, .chars a { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; display: block; }
.chars a { border-radius: 14px; }
.chars a.on { background: var(--accent-soft); }
.float { animation: float 3.2s ease-in-out infinite; }
.chars .float:nth-child(2n) { animation-delay: -1.1s; }
.chars .float:nth-child(3n) { animation-delay: -2.2s; }
@keyframes float { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-4px) } }
.hero { display: block; width: 168px; height: 168px; margin: 8px auto 0; object-fit: contain; }
.hero-bg { background: var(--sur); border-radius: 28px; padding: 18px 16px 20px; text-align: center; margin: 4px 0 14px; }

/* 폼 */
form .row { margin: 0 0 18px; }
label.t { display: block; font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 12px 6px; border-radius: 12px; background: #fff; border: 1px solid var(--line); font-size: 15px; font-weight: 600; cursor: pointer; user-select: none; color: var(--sub); }
.seg input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.trio { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 6px; }
select, input[type=text], input[type=time] { width: 100%; font: inherit; font-size: 16px; font-weight: 600; padding: 12px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); appearance: none; -webkit-appearance: none; }
input::placeholder { font-weight: 400; color: #a9adb5; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--sub) 50%), linear-gradient(135deg, var(--sub) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 10px; color: var(--sub); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
details { margin: 4px 0 18px; }
details summary { cursor: pointer; color: var(--sub); font-size: 14px; font-weight: 600; }
details .row { margin-top: 14px; }
.err { color: #e03e3e; font-size: 14px; min-height: 20px; margin: 0 0 8px; }

.btn { display: block; width: 100%; padding: 16px; border: 0; border-radius: 14px; font: inherit; font-size: 16px; font-weight: 700; background: var(--ink); color: #fff; cursor: pointer; text-align: center; text-decoration: none; letter-spacing: -0.2px; }
.btn.accent { background: var(--accent); }
.btn.sub { background: var(--sur); color: var(--ink); }
.btn + .btn { margin-top: 8px; }
.btn:active { transform: translateY(1px); opacity: .92; }
.btns { margin-top: 18px; }

/* 사주표 */
.chart { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.chart .h { font-size: 12px; color: var(--sub); font-weight: 600; }
.chart .g { border-radius: 12px; padding: 10px 0 8px; color: #fff; font-size: 28px; line-height: 1.05; font-weight: 700; }
.chart .g small { display: block; font-size: 11px; opacity: .95; margin-top: 3px; font-weight: 600; }
.chart .tg { font-size: 11px; color: var(--sub); font-weight: 600; }
.chart .empty { background: #fff !important; color: #b5b9c0; border: 1px dashed var(--line); font-size: 13px; padding: 20px 0; font-weight: 600; }
.el-목 { background: var(--wood); } .el-화 { background: var(--fire); } .el-토 { background: var(--earth); } .el-금 { background: var(--metal); } .el-수 { background: var(--water); }
.me .g.day { box-shadow: 0 0 0 3px var(--sur), 0 0 0 5px var(--ink); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.tag.목 { background: var(--wood-bg); color: var(--wood); } .tag.화 { background: var(--fire-bg); color: var(--fire); } .tag.토 { background: var(--earth-bg); color: #b47d1f; } .tag.금 { background: var(--metal-bg); color: #5f6975; } .tag.수 { background: var(--water-bg); color: var(--water); }

/* 오행 막대 */
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 50px 1fr 22px; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.bar .track { height: 10px; background: var(--sur-2); border-radius: 5px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 5px; }
.pairbars .bar { grid-template-columns: 50px 1fr 1fr; }
.pairbars .track.l { direction: rtl; }

ul.dots { margin: 0; padding-left: 18px; line-height: 1.7; }
.kw { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 10px 0 2px; }
.kw span { background: #fff; border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 600; color: var(--sub); }

.luck { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.luck div { flex: 0 0 auto; text-align: center; border-radius: 10px; padding: 8px 10px; font-size: 14px; font-weight: 700; background: #fff; }
.luck div small { display: block; color: var(--sub); font-size: 11px; font-weight: 600; }
.luck .now { background: var(--accent); color: #fff; }
.luck .now small { color: rgba(255,255,255,.85); }

.warn { background: #fff7e6; border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.6; color: #8a5a00; margin: 0 0 12px; }

/* 궁합 */
.duo { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; text-align: center; }
.duo img { width: 118px; height: 118px; object-fit: contain; }
.duo .x { font-size: 22px; font-weight: 800; color: var(--accent); }
.duo b { display: block; font-size: 15px; }
.score { text-align: center; font-size: 60px; font-weight: 900; letter-spacing: -2px; margin: 0; color: var(--ink); line-height: 1.1; }
.score small { font-size: 22px; letter-spacing: 0; margin-left: 2px; }
.score-word { text-align: center; font-size: 18px; font-weight: 700; color: var(--accent); margin: 2px 0 14px; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 9; font-weight: 600; }
footer { margin-top: 28px; text-align: center; }
