:root {
  --bg: #FBF7F2;
  --card: #FFFFFF;
  --ink: #2B2522;
  --muted: #8A817A;
  --line: #EDE6DE;
  --accent: #F0641E;
  --accent-soft: #FDEBDF;
  --ok: #2E8B57;
  --ok-soft: #E3F3EA;
  --warn: #C2541B;
  --warn-soft: #FBE9DD;
  --wood: #3FA66B;
  --fire: #E5533D;
  --earth: #D9A62E;
  --metal: #9AA0A6;
  --water: #2F4A8A;
  --radius: 20px;
  --tab-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  line-height: 1.6;
  word-break: keep-all;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: inherit; }

.page { max-width: 480px; margin: 0 auto; padding: 20px 16px calc(var(--tab-h) + 32px); display: flex; flex-direction: column; gap: 14px; }
.screen[data-screen=setup] .page { padding-bottom: 40px; }

.h-lg { font-size: 23px; line-height: 1.35; font-weight: 750; margin: 0; letter-spacing: -0.02em; }
.h-md { font-size: 19px; line-height: 1.4; font-weight: 700; margin: 0; }
.h-sm { font-size: 15px; font-weight: 700; margin: 0; }
.body { margin: 0; font-size: 15.5px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.normal { font-weight: 400; }
.center { text-align: center; }
.eyebrow { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: 0.02em; }

.card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: 0 1px 2px rgba(60, 40, 20, .05), 0 4px 16px rgba(60, 40, 20, .04); display: flex; flex-direction: column; gap: 8px; }
#today-body, #match-body, #match-extra { display: flex; flex-direction: column; gap: 14px; }
#match-extra:empty { display: none; }
.empty { text-align: center; color: var(--muted); padding: 28px 18px; }

.top { display: flex; justify-content: space-between; align-items: flex-end; padding: 4px 2px 0; }
.brand { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.top .muted { margin: 2px 0 0; }

/* 사람 고르기 */
.people { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; }
.people::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip[aria-pressed=true] { border-color: var(--ink); background: var(--ink); color: #fff; }
.chip.add { color: var(--muted); border-style: dashed; }

/* 점수 링 */
.hero { align-items: center; text-align: center; padding: 24px 20px 22px; gap: 10px; }
.ring { position: relative; width: 120px; height: 120px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring-bg { stroke: var(--accent-soft); }
.ring-fg { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset .9s cubic-bezier(.2, .8, .2, 1); }
.ring-num { position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center; padding-top: 38px; }
.ring-num span { font-size: 36px; font-weight: 800; letter-spacing: -0.03em; }
.ring-num small { font-size: 14px; color: var(--muted); margin-left: 2px; }
.hero .body { text-align: left; }

.grid4 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini { padding: 14px; gap: 4px; }
.mini p { margin: 0; font-size: 14px; }
.mini-icon { font-size: 18px; }

.todo { gap: 14px; }
.todo-row { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.todo-row p { margin: 0; font-size: 15px; }
.badge { font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

.lucky { flex-direction: row; justify-content: space-between; text-align: center; }
.lucky > div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; }
.lucky > div + div { border-left: 1px solid var(--line); }
.lucky strong { font-size: 17px; }
.dot { width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .12); }

.tomorrow { border: 1.5px dashed var(--line); box-shadow: none; }

.hnj { text-decoration: none; background: var(--ink); color: #fff; gap: 6px; }
.hnj .eyebrow { color: #FFB38A; }
.hnj strong { font-size: 15.5px; line-height: 1.45; }
.hnj .muted { color: #CFC6BF; }
.foot { text-align: center; padding: 6px 0; }

/* 버튼 */
.btn { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 52px; border-radius: 16px; border: 0; font-size: 16px; font-weight: 700; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:disabled { opacity: .5; }
.btn-line { background: var(--card); border: 1.5px solid var(--line); }
.btn-ghost { background: transparent; color: var(--muted); min-height: 44px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two .btn { font-size: 14.5px; }
.link-btn { background: none; border: 0; padding: 8px; color: var(--muted); font-size: 14px; text-decoration: underline; }
.link-btn.inline { padding: 0; color: var(--accent); font-weight: 700; text-decoration: none; }
.link-btn.danger { color: var(--warn); }

/* 입력 */
.setup-head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 0 6px; }
.setup-head p { margin: 0; }
.logo { width: 72px; height: 72px; border-radius: 18px; }
.form { gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.label { font-size: 14px; font-weight: 700; }
input:not([type=checkbox]) { width: 100%; min-height: 50px; border: 1.5px solid var(--line); border-radius: 14px; padding: 0 14px; background: #fff; font-size: 16px; }
input:focus { outline: none; border-color: var(--accent); }
.ymd { display: grid; grid-template-columns: 2fr auto 1fr auto 1fr auto; gap: 6px; align-items: center; }
.ymd input { text-align: center; padding: 0 6px; }
.ymd span { font-size: 15px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: #F3EDE6; border-radius: 12px; padding: 4px; }
.seg button { border: 0; background: transparent; border-radius: 9px; min-height: 40px; font-weight: 600; color: var(--muted); }
.seg button[aria-checked=true] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.error { margin: 0; color: var(--warn); font-size: 14px; }

/* 내 사주 */
.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.pillar { display: flex; flex-direction: column; gap: 6px; text-align: center; }
.pillar .plabel { font-size: 12px; color: var(--muted); }
.ch { border-radius: 12px; padding: 8px 0 6px; color: #fff; display: flex; flex-direction: column; line-height: 1.2; }
.ch b { font-size: 24px; font-weight: 600; font-family: "Noto Serif KR", "Batang", serif; }
.ch small { font-size: 12px; opacity: .9; }
.ch.none { background: #F3EDE6; color: var(--muted); padding: 16px 0; font-size: 12px; }
.oh-목 { background: var(--wood); } .oh-화 { background: var(--fire); } .oh-토 { background: var(--earth); }
.oh-금 { background: var(--metal); } .oh-수 { background: var(--water); }
.pillar.me .ch { box-shadow: 0 0 0 2.5px var(--card), 0 0 0 4.5px var(--accent); }
.bars { display: flex; flex-direction: column; gap: 8px; margin: 4px 0; }
.bar-row { display: grid; grid-template-columns: 32px 1fr 24px; gap: 10px; align-items: center; font-size: 14px; }
.bar-track { height: 10px; background: #F3EDE6; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 6px 0 0; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

/* 광고 자리 — 광고 코드가 없으면 숨김, 로컬에서만 자리 표시 */
.ad-slot { display: none; }
.ad-slot.preview { display: flex; align-items: center; justify-content: center; min-height: 100px; border: 1.5px dashed var(--line); border-radius: var(--radius); color: var(--muted); font-size: 13px; }
.ad-slot.preview::after { content: "광고 자리"; }
.ad-slot.live { display: block; min-height: 100px; }

/* 아래 탭 */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, 1fr); z-index: 5; }
.tabbar button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tabbar button span { font-size: 20px; filter: grayscale(1); opacity: .6; }
.tabbar button[aria-current=page] { color: var(--ink); }
.tabbar button[aria-current=page] span { filter: none; opacity: 1; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 20px); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 10; max-width: calc(100% - 32px); text-align: center; }
