/*
 * 도경 명리연구소 공통 스타일
 * 디자인 토큰과 명식표·운 카드 스타일은 기존 만세력(C:\_DEV\Saju\pro.html)에서 옮겼다.
 */

/* ---------- 토큰 ---------- */
:root {
  --bg: #f4f0e6;
  --surface: #fffdf8;
  --surface-2: #f9f5ec;
  --ink: #1d1b18;
  --ink-2: #3a362f;
  --muted: #6f685d;
  --line: #ddd5c4;
  --line-strong: #bfb4a0;
  --accent: #a3392b;
  --accent-tint: #f7e9e4;
  --gold: #8c6d2f;
  --gold-tint: #f5ecd8;
  --on-accent: #ffffff;
  --on-gold: #ffffff;
  --shadow: 0 1px 2px rgba(60, 45, 20, .05), 0 6px 20px rgba(60, 45, 20, .04);

  --wood-bg: #e2eee6;  --wood-fg: #1f5e45;  --wood-bar: #3f8a69;
  --fire-bg: #f6e2dd;  --fire-fg: #9c3024;  --fire-bar: #c0503f;
  --earth-bg: #f2e8d2; --earth-fg: #7d5a14; --earth-bar: #b58a33;
  --metal-bg: #ecebe6; --metal-fg: #4d4a44; --metal-bar: #9d988d;
  --water-bg: #e0e5ee; --water-fg: #1f3150; --water-bar: #3d5a8a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131210;
    --surface: #1c1a17;
    --surface-2: #23201c;
    --ink: #ece6da;
    --ink-2: #d6cfc1;
    --muted: #a39b8d;
    --line: #36322b;
    --line-strong: #4f493f;
    --accent: #d9735f;
    --accent-tint: #33201b;
    --gold: #c9a55e;
    --gold-tint: #2c2416;
    --on-accent: #1c1a17;
    --on-gold: #1c1a17;
    --shadow: none;
    --wood-bg: #1d2e26;  --wood-fg: #8fd1b2;  --wood-bar: #5fae8a;
    --fire-bg: #35201c;  --fire-fg: #f0a090;  --fire-bar: #d9735f;
    --earth-bg: #322916; --earth-fg: #e2c27c; --earth-bar: #c9a55e;
    --metal-bg: #2a2925; --metal-fg: #d6d2c8; --metal-bar: #a8a397;
    --water-bg: #1c2433; --water-fg: #9fb8e6; --water-bar: #6f8fc7;
  }
}
:root[data-theme="dark"] {
  --bg: #131210;
  --surface: #1c1a17;
  --surface-2: #23201c;
  --ink: #ece6da;
  --ink-2: #d6cfc1;
  --muted: #a39b8d;
  --line: #36322b;
  --line-strong: #4f493f;
  --accent: #d9735f;
  --accent-tint: #33201b;
  --gold: #c9a55e;
  --gold-tint: #2c2416;
  --on-accent: #1c1a17;
  --on-gold: #1c1a17;
  --shadow: none;
  --wood-bg: #1d2e26;  --wood-fg: #8fd1b2;  --wood-bar: #5fae8a;
  --fire-bg: #35201c;  --fire-fg: #f0a090;  --fire-bar: #d9735f;
  --earth-bg: #322916; --earth-fg: #e2c27c; --earth-bar: #c9a55e;
  --metal-bg: #2a2925; --metal-fg: #d6d2c8; --metal-bar: #a8a397;
  --water-bg: #1c2433; --water-fg: #9fb8e6; --water-bar: #6f8fc7;
}

/* ---------- 기본 ---------- */
/* 입력칸·스크롤바 같은 브라우저 기본 요소도 고른 모드를 따르게 한다 */
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* hidden 속성은 .btn 처럼 display 를 정한 클래스보다 앞선다 (자바스크립트가 상황에 따라 보이고 숨기는 버튼) */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.65 'Noto Sans KR', system-ui, sans-serif;
  word-break: keep-all;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; }
img { max-width: 100%; }
h1, h2, h3, h4 { font-family: 'Noto Serif KR', serif; }
.hj { font-family: 'Noto Serif KR', serif; }
.muted { color: var(--muted); }
.hint { font-size: 12.5px; color: var(--muted); }
.hint:empty { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
select:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 상단 바 ---------- */
.topbar { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1080px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.seal {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent);
  font: 700 22px/1 'Noto Serif KR', serif;
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px var(--accent), inset 0 0 0 3px rgba(255, 255, 255, .35);
}
.brand b { display: block; font: 700 16.5px/1.2 'Noto Serif KR', serif; letter-spacing: .01em; white-space: nowrap; }
.brand small { display: block; font-size: 11.5px; color: var(--muted); letter-spacing: .04em; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav a, .nav button { white-space: nowrap; font-size: 14px; text-decoration: none; padding: 6px 10px; border-radius: 6px; color: var(--ink-2); background: none; border: 0; cursor: pointer; font-family: inherit; }
.nav a:hover, .nav button:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--accent); font-weight: 700; }
.pouch-badge { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--gold) !important; }
.pouch-icon { display: inline-block; width: 1.05em; height: 1.05em; vertical-align: -0.15em; }

/* 화이트/나이트 전환 버튼: 밝은 화면엔 달, 어두운 화면엔 해 (다크 토큰과 같은 조건) */
.nav .theme-toggle {
  flex: 0 0 auto;
  width: 36px; height: 36px; padding: 0; margin-left: 4px;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--ink-2);
}
.nav .theme-toggle:hover { background: var(--surface-2); border-color: var(--line-strong); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; color: var(--gold); }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
}

.brand > span:last-child { min-width: 0; }
.brand b { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) {
  .topbar-inner { gap: 8px; }
  .brand small { display: none; }
  .brand b { font-size: 15px; }
  .seal { width: 34px; height: 34px; font-size: 20px; }
}

/* 휴대폰: 하단 탭 메뉴 */
.tabbar { display: none; }
@media (max-width: 720px) {
  .nav .wide { display: none; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); /* 탭은 5개까지 (iOS·Android 하단 탭 권장 최대) */
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { text-align: center; padding: 8px 0 7px; font-size: 11.5px; text-decoration: none; color: var(--muted); }
  .tabbar a .ti { display: block; font: 700 18px/1.2 'Noto Serif KR', serif; color: var(--ink-2); }
  .tabbar a[aria-current="page"], .tabbar a[aria-current="page"] .ti { color: var(--accent); }
  body.has-tabbar { padding-bottom: 64px; }
}

/* ---------- 레이아웃 ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 22px 16px 64px; }
.page.narrow { max-width: 720px; }
.page-title { margin: 4px 0 18px; font: 700 23px/1.35 'Noto Serif KR', serif; }
.page-title .hj { color: var(--accent); margin-right: 8px; }
.page-lead { margin: -10px 0 20px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 860px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.stack > * + * { margin-top: 18px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; padding: 15px 20px 11px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font: 700 17px/1.3 'Noto Serif KR', serif; }
.panel-head h2 .hj { color: var(--accent); margin-right: 6px; }
.panel-head .sub { color: var(--muted); font-size: 13px; }
.panel-head .right { margin-left: auto; color: var(--muted); font-size: 13px; text-align: right; }
.panel-body { padding: 18px 20px 20px; }
@media (max-width: 640px) { .panel-head, .panel-body { padding-left: 16px; padding-right: 16px; } }

/* ---------- 알림 ---------- */
.flash { max-width: 1080px; margin: 14px auto 0; padding: 0 16px; }
.flash p { margin: 0; padding: 10px 14px; border-left: 3px solid var(--gold); background: var(--gold-tint); font-size: 14px; border-radius: 0 6px 6px 0; }
.flash p.alert { border-left-color: var(--accent); background: var(--accent-tint); }
.warn { margin: 14px 0 0; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--accent-tint); font-size: 14px; }
.notice-box { padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: 6px; font-size: 13.5px; color: var(--ink-2); background: var(--surface-2); }

/* ---------- 버튼 ---------- */
.btn, .btn-primary, .btn-gold {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface); color: var(--ink);
  font: 500 14px 'Noto Sans KR', sans-serif; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--on-gold); font-weight: 700; }
.btn-block { display: flex; width: 100%; height: 48px; font-size: 15.5px; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn-link { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; font-size: 13px; }
.btn-danger { color: var(--accent); border-color: var(--accent); }
button[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
form.inline { display: inline; }

/* ---------- 폼 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row > select { flex: 1 1 0; min-width: 0; }
input[type="text"], select {
  font: inherit; color: inherit;
  height: 42px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface);
  width: 100%;
}
select {
  -webkit-appearance: none; appearance: none; padding-right: 26px; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a8275' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 9px center;
}
select:disabled { opacity: .45; cursor: not-allowed; }
.seg { display: flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.seg label { position: relative; flex: 1; }
.seg label + label { border-left: 1px solid var(--line-strong); }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; text-align: center; padding: 9px 0; cursor: pointer; user-select: none; background: var(--surface); }
.seg input:checked + span { background: var(--ink); color: var(--surface); font-weight: 500; }
/* 고른 칸에 체크 표시 (글꼴마다 ✓ 모양이 달라 테두리로 그린다) */
.seg input:checked + span::before {
  content: ""; display: inline-block; width: 9px; height: 5px; margin: 0 7px 3px 0;
  border: solid currentColor; border-width: 0 0 2px 2px; transform: rotate(-45deg); vertical-align: middle;
}
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.check { display: inline-flex; gap: 7px; align-items: center; cursor: pointer; user-select: none; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
details.options { border-top: 1px solid var(--line); padding-top: 12px; margin-bottom: 16px; }
details.options summary { cursor: pointer; font-size: 13.5px; color: var(--ink-2); font-weight: 500; }
details.options[open] summary { margin-bottom: 12px; }
.errors { margin: 0 0 14px; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--accent-tint); font-size: 14px; }
.errors ul { margin: 0; padding-left: 18px; }

/* ---------- 첫 화면 (비로그인) ---------- */
.hero { text-align: center; padding: 64px 20px 40px; }
.big-seal {
  width: 96px; height: 96px; margin: 0 auto 22px;
  display: grid; place-items: center;
  border: 2px solid var(--accent); color: var(--accent);
  font: 700 30px/1 'Noto Serif KR', serif; border-radius: 6px;
  box-shadow: inset 0 0 0 4px var(--bg), inset 0 0 0 5px var(--accent);
}
.hero h1 { font: 700 30px/1.35 'Noto Serif KR', serif; margin: 0 0 12px; }
.hero p { color: var(--muted); margin: 0 auto; max-width: 520px; }
.hero .actions { justify-content: center; margin-top: 28px; }
.hero .actions .btn, .hero .actions .btn-primary { min-width: 150px; height: 48px; font-size: 15.5px; }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-width: 900px; margin: 12px auto 0; padding: 0 16px 56px; }
.feature { border-top: 2px solid var(--ink); padding-top: 10px; }
.feature b { display: block; font: 700 15px 'Noto Serif KR', serif; margin-bottom: 4px; }
.feature span { font-size: 13.5px; color: var(--muted); }
@media (max-width: 640px) { .features { grid-template-columns: minmax(0, 1fr); } .hero { padding-top: 44px; } .hero h1 { font-size: 25px; } }

/* ---------- 로그인 ---------- */
.login-box { max-width: 400px; margin: 28px auto 0; }
.login-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 50px; border-radius: 8px; border: 1px solid var(--line-strong); font: 700 15px 'Noto Sans KR', sans-serif; cursor: pointer; margin-bottom: 10px; background: var(--surface); color: var(--ink); }
.login-btn.kakao { background: #fee500; border-color: #fee500; color: rgba(0, 0, 0, .85); }
.login-btn.naver { background: #03c75a; border-color: #03c75a; color: #fff; }
.login-btn.apple { background: #000; border-color: #000; color: #fff; }
.login-btn.google_oauth2 { background: #fff; border-color: #dadce0; color: #1f1f1f; }
.login-btn .logo { font-weight: 900; width: 20px; text-align: center; }

/* ---------- 선택한 사람 요약 ---------- */
.identity { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.identity .daymaster { flex: 0 0 auto; width: 76px; height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 6px; }
.identity .daymaster .hj { font: 700 32px/1 'Noto Serif KR', serif; }
.identity .daymaster small { font-size: 11px; margin-top: 5px; opacity: .85; }
.identity h3 { margin: 0 0 4px; font: 700 21px/1.3 'Noto Serif KR', serif; }
.identity .facts { display: flex; flex-wrap: wrap; gap: 2px 16px; margin: 0; color: var(--ink-2); font-size: 14px; }
.identity .facts div { display: flex; gap: 6px; }
.identity .facts dt { flex: 0 0 auto; color: var(--muted); white-space: nowrap; }
.identity .facts dd { margin: 0; }
.identity .actions { margin-left: auto; }
@media (max-width: 640px) { .identity .actions { margin-left: 0; width: 100%; } .identity .daymaster { width: 64px; height: 64px; } .identity .daymaster .hj { font-size: 26px; } }
/* 오늘 화면 맨 위: 한 줄로 낮게 (일간 · 이름과 일주·출생 · 버튼) */
.identity.compact { gap: 12px; flex-wrap: nowrap; }
.identity.compact > div:nth-child(2) { flex: 1 1 auto; min-width: 0; }
.identity.compact .daymaster { width: 52px; height: 52px; }
.identity.compact .daymaster .hj { font-size: 22px; }
.identity.compact .daymaster small { font-size: 10px; margin-top: 3px; }
.identity.compact h3 { font-size: 17px; margin-bottom: 2px; }
.identity.compact .facts { font-size: 13px; gap: 0 12px; }
.identity.compact .actions { margin-left: auto; width: auto; flex: 0 0 auto; display: flex; gap: 6px; }
@media (max-width: 640px) { .identity.compact .actions { flex-direction: column; } }

/* ---------- 오늘의 운세 ---------- */
.fortune { position: relative; overflow: hidden; }
.fortune .panel-body { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 20px; align-items: start; }
.fortune .score { text-align: center; }
.fortune .score .stars { font-size: 20px; letter-spacing: 2px; color: var(--gold); }
.fortune .score .kw { display: inline-block; margin-top: 8px; padding: 3px 12px; border-radius: 999px; background: var(--accent-tint); color: var(--accent); font-weight: 700; font-size: 14px; }
.fortune .score .gz { font: 700 34px/1.1 'Noto Serif KR', serif; }
.fortune .summary { margin: 0 0 12px; font-size: 15.5px; color: var(--ink); }
.fortune dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; }
.fortune dl div { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 6px; font-size: 14px; }
.fortune dt { color: var(--muted); }
.fortune dd { margin: 0; color: var(--ink-2); }
.fortune .lucky { margin-top: 12px; display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.fortune .lucky b { color: var(--ink); }
.fortune .lucky .note { margin-left: auto; }
@media (max-width: 640px) {
  .fortune .panel-body { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .fortune .score { display: flex; align-items: center; gap: 12px; text-align: left; }
  .fortune .score .kw { margin-top: 0; }
  .fortune dl { grid-template-columns: minmax(0, 1fr); }
}

/* 오늘 화면 맨 아래: 풀이 목록으로 가는 한 줄 입구 */
.more-link { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); }
.more-link b { display: block; font: 700 16px/1.35 'Noto Serif KR', serif; }
.more-link small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.more-link .arrow { margin-left: auto; color: var(--accent); font-size: 18px; }
.more-link:hover { border-color: var(--accent); }

/* 휴대폰 오늘 화면: 사람 요약과 오늘의 운세가 스크롤 없이 한 화면에 들어오게 여백·글자를 줄인다 */
@media (max-width: 640px) {
  .page.home { padding-top: 12px; }
  .page.home.stack > * + * { margin-top: 10px; }
  .page.home .panel-body { padding: 12px 14px; }
  .page.home .fortune .panel-head { padding: 10px 14px 8px; }
  .page.home .fortune .panel-head h2 { font-size: 16px; }
  .page.home .fortune .panel-body { gap: 8px; padding: 12px 14px 12px; }
  .page.home .fortune .score .gz { font-size: 28px; }
  .page.home .fortune .score .stars { font-size: 17px; }
  .page.home .fortune .score .kw { font-size: 13px; padding: 2px 10px; }
  .page.home .fortune .summary { font-size: 14.5px; line-height: 1.6; margin-bottom: 8px; }
  .page.home .fortune dl { gap: 4px; }
  .page.home .fortune dl div { grid-template-columns: 34px minmax(0, 1fr); gap: 4px; font-size: 13.5px; line-height: 1.5; }
  .page.home .fortune .lucky { margin-top: 8px; flex-wrap: wrap; gap: 2px 12px; font-size: 12.5px; }
}

/* ---------- 풀이 목록 (한 줄: 이름 · 짧은 설명 · 표시 · ›) ---------- */
.menu-list { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.menu-row { display: flex; align-items: center; gap: 10px; padding: 13px 16px; text-decoration: none; color: var(--ink); }
.menu-row + .menu-row { border-top: 1px solid var(--line); }
.menu-row:hover { background: var(--surface-2); }
.menu-row .nm { flex: 0 0 auto; font-weight: 700; font-size: 15px; }
.menu-row .desc { flex: 1 1 auto; min-width: 0; color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-row .badge { flex: 0 0 auto; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 18px; }
.menu-row .arrow { flex: 0 0 auto; color: var(--muted); font-size: 18px; line-height: 1; }

/* ---------- 사람 목록: 오늘·풀이 화면의 기준 사람 고르기 ---------- */
.people-list > li.selected { background: var(--accent-tint); }
.people-list > li { flex-wrap: nowrap; padding: 10px; border-radius: 8px; }
.people-list .grow { flex: 1 1 auto; }
.people-list .row-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.people-list .row-head .title { flex: 1 1 auto; min-width: 0; }
.people-list .actions.mini { margin-left: auto; flex-wrap: nowrap; gap: 4px; }
.people-list .actions.mini .btn-sm { height: 28px; padding: 0 9px; font-size: 12.5px; }
.people-list .badge { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 18px; vertical-align: 1px; }
.pick { flex: 0 0 auto; width: 36px; height: 36px; margin: -6px -6px -6px -4px; padding: 0; border: 0; background: none; display: grid; place-items: center; cursor: pointer; }
.pick .dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); }
.pick:hover .dot { border-color: var(--accent); }
.pick.selected { cursor: default; }
.pick.selected .dot { border-color: var(--accent); box-shadow: inset 0 0 0 4px var(--surface); background: var(--accent); }
.badge-owned { background: var(--ink); color: var(--surface); }
.badge-wait { background: var(--gold-tint); color: var(--gold); }
.badge-pick { background: var(--accent); color: var(--on-accent); }

/* ---------- 카드 ---------- */
.card { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); text-decoration: none; color: inherit; box-shadow: var(--shadow); position: relative; }
a.card:hover { border-color: var(--line-strong); }
.card h3 { margin: 0; font: 700 16.5px/1.35 'Noto Serif KR', serif; }
.card p { margin: 0; font-size: 13.5px; color: var(--muted); }
.card .tag { position: absolute; top: 12px; right: 12px; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.tag-free { background: var(--wood-bg); color: var(--wood-fg); }
.tag-owned { background: var(--ink); color: var(--surface); }
.tag-wait { background: var(--gold-tint); color: var(--gold); }
.cost { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--gold); }
.group-title { margin: 26px 0 10px; font: 700 15px 'Noto Serif KR', serif; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.group-title::after { content: ''; flex: 1; border-top: 1px solid var(--line); }

/* 상품 상세 */
.points { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.points li { padding-left: 22px; position: relative; }
.points li::before { content: '✓'; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.toc { counter-reset: toc; list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; }
.toc li { counter-increment: toc; font-size: 14px; color: var(--ink-2); }
.toc li::before { content: counter(toc, decimal-leading-zero); color: var(--accent); font-weight: 700; margin-right: 8px; font-size: 12.5px; }
@media (max-width: 640px) { .toc { grid-template-columns: minmax(0, 1fr); } }
.product-layout { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
.buy-box { position: sticky; top: 76px; }
@media (max-width: 640px) {
  .product-layout { grid-template-columns: minmax(0, 1fr); }
  .buy-box { position: static; }
}
.price-line { display: flex; align-items: baseline; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.price-line b { font-size: 16px; }

/* ---------- 풀이 본문 ---------- */
.rd-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rd-tabs a { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; text-align: center; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--ink-2); background: var(--surface-2); text-decoration: none; }
.rd-tabs a span { font-size: 12.5px; }
.rd-tabs a[aria-current] { border-color: var(--accent); background: var(--accent-tint); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent); }
.rd-status { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-left: 3px solid var(--accent); background: var(--accent-tint); font-size: 14px; }
.rd-status .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: rdPulse 1.2s ease-in-out infinite; }
@keyframes rdPulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.rd-status .grow { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rd-progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.rd-progress span { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.rd-toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; padding: 0; list-style: none; }
.rd-toc a { display: inline-block; font-size: 12.5px; padding: 2px 10px; border: 1px solid var(--line-strong); border-radius: 99px; color: var(--ink-2); text-decoration: none; }
.rd-sec { padding: 24px 0; border-top: 1px solid var(--line); scroll-margin-top: 70px; }
.rd-sec:first-child { border-top: 0; padding-top: 4px; }
.rd-sec h3 { margin: 0 0 6px; font: 700 19px/1.35 'Noto Serif KR', serif; }
.rd-sec h3 .no { color: var(--accent); margin-right: 8px; font-size: 14px; }
.rd-sec .headline { margin: 0 0 12px; padding: 8px 12px; background: var(--surface-2); border-left: 3px solid var(--gold); font-weight: 700; color: var(--ink); }
.rd-body { color: var(--ink-2); line-height: 1.9; max-width: 760px; font-size: 15.5px; }
.rd-body p { margin: 0 0 12px; }
.rd-body ul { margin: 0 0 12px; padding-left: 18px; list-style: disc; }
.rd-body li { margin-bottom: 8px; }
.rd-body strong { color: var(--ink); }

/* ---------- 간지 타일 · 명식표 (pro.html) ---------- */
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 64px; height: 64px; margin: 0 auto; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); }
.tile .hj { font: 700 30px/1 'Noto Serif KR', serif; }
.tile .ko { font-size: 11px; margin-top: 5px; opacity: .8; letter-spacing: .05em; }
.tile.sm { width: 44px; height: 44px; }
.tile.sm .hj { font-size: 20px; }
.tile.sm .ko { font-size: 9.5px; margin-top: 2px; }
.tile.empty { box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--muted); font-size: 12px; background: repeating-linear-gradient(135deg, transparent 0 6px, var(--surface-2) 6px 12px); }
.el-목 { background: var(--wood-bg); color: var(--wood-fg); }
.el-화 { background: var(--fire-bg); color: var(--fire-fg); }
.el-토 { background: var(--earth-bg); color: var(--earth-fg); }
.el-금 { background: var(--metal-bg); color: var(--metal-fg); }
.el-수 { background: var(--water-bg); color: var(--water-fg); }
.t-목 { color: var(--wood-fg); }
.t-화 { color: var(--fire-fg); }
.t-토 { color: var(--earth-fg); }
.t-금 { color: var(--metal-fg); }
.t-수 { color: var(--water-fg); }

.chart { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: center; }
.chart th, .chart td { padding: 8px 4px; border-bottom: 1px solid var(--line); }
.chart thead th { padding-top: 0; font-weight: 500; }
.chart thead .hj { display: block; font: 700 16px/1.2 'Noto Serif KR', serif; }
.chart thead .ko { font-size: 12px; color: var(--muted); }
.chart thead th.me .hj { color: var(--accent); }
.chart tbody th { width: 84px; text-align: left; font-weight: 400; }
.chart tbody th .hj { display: block; font: 500 13.5px/1.2 'Noto Serif KR', serif; color: var(--ink-2); }
.chart tbody th .ko { font-size: 11.5px; color: var(--muted); }
.chart tr:last-child th, .chart tr:last-child td { border-bottom: 0; }
.chart .god { font-weight: 500; font-size: 14px; }
.chart .dm { color: var(--accent); font-weight: 700; }
.chart .hidden-stems { font-size: 13px; line-height: 1.6; }
.chart .hidden-stems .hj { font-weight: 700; margin-right: 4px; }
.chart .sal-list { display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.45; }
.chart .sal-list .good { color: var(--gold); font-weight: 700; }
.chart .napeum { font-size: 12.5px; line-height: 1.4; color: var(--ink-2); }
.chart .napeum .hj { display: block; font-size: 13.5px; font-weight: 500; color: var(--ink); }
.chart .col-me { background: var(--surface-2); }
.kong { display: inline-block; margin-top: 5px; font-size: 10.5px; padding: 0 6px; border: 1px solid var(--accent); color: var(--accent); border-radius: 3px; }

/* 일주만 네모로 강조하는 원국표 (일주로 보는 성격) */
.chart-iljoo { position: relative; }
.chart-iljoo .pillars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; text-align: center; max-width: 380px; margin: 0 auto; }
.chart-iljoo .pillar { padding: 10px 0 12px; border-radius: 8px; border: 2px solid transparent; opacity: .45; }
.chart-iljoo .pillar .head { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.chart-iljoo .pillar .tile + .tile { margin-top: 6px; }
.chart-iljoo .pillar.me { opacity: 1; border-color: var(--accent); background: var(--accent-tint); box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--accent); }
.chart-iljoo .pillar.me .head { color: var(--accent); font-weight: 700; }
.chart-iljoo .caption { text-align: center; margin: 14px 0 0; font-size: 13.5px; color: var(--ink-2); }

/* 분포 */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.stat { padding: 18px 20px 20px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat h4 { margin: 0 0 12px; font: 700 14.5px 'Noto Serif KR', serif; }
.stat h4 .hj { color: var(--accent); margin-right: 5px; }
.bar-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) 22px; gap: 8px; align-items: center; margin-bottom: 7px; font-size: 13.5px; }
.bar-row .name .hj { font-weight: 700; margin-right: 4px; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.bar i { display: block; height: 100%; border-radius: 99px; }
.bar-row b { text-align: right; font-weight: 700; }
.stat .note { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.yy { display: flex; height: 30px; border-radius: 4px; overflow: hidden; margin: 6px 0 10px; font-size: 13px; font-weight: 500; }
.yy div { display: grid; place-items: center; min-width: 0; }
.yy .yang { background: var(--ink); color: var(--surface); }
.yy .yin { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }

/* 운 */
.meta-line { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; }
.meta-line b { color: var(--ink); }
.luck-row { display: flex; gap: 6px; overflow-x: auto; padding: 10px 2px 8px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.luck { flex: 0 0 auto; min-width: 78px; padding: 10px 6px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); text-align: center; cursor: pointer; scroll-snap-align: start; position: relative; color: inherit; font: inherit; transition: border-color .15s, background .15s; }
.luck:hover { border-color: var(--line-strong); }
.luck[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.luck .top { font-weight: 700; font-size: 14px; margin: -10px -6px 6px; padding: 5px 4px 3px; border-radius: 5px 5px 0 0; }
.luck[aria-pressed="true"] .top { background: var(--ink); color: var(--surface); }
.luck[aria-pressed="true"] .sub { color: var(--ink-2); font-weight: 500; }
.luck .sub { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; white-space: nowrap; }
.luck .god { font-size: 12px; margin: 4px 0; color: var(--ink-2); }
.luck .stage { font-size: 11.5px; color: var(--muted); }
.luck .tiles { display: flex; flex-direction: column; gap: 4px; }
.luck:has(.now) { border-color: var(--gold); }
.luck .now { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); z-index: 1; background: var(--gold); color: var(--on-gold); font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 0 8px; border-radius: 999px; line-height: 16px; white-space: nowrap; box-shadow: 0 0 0 2px var(--surface); }
.luck.pre { display: flex; flex-direction: column; justify-content: center; }

/* 관계·근거 */
.rel { margin: 0; }
.rel > div { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.rel > div:first-child { padding-top: 0; }
.rel > div:last-child { border-bottom: 0; padding-bottom: 0; }
.rel dt { font: 700 15px 'Noto Serif KR', serif; color: var(--ink); }
.rel dt .hj { color: var(--accent); margin-right: 4px; }
.rel dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 8px; font-size: 14px; }
.rel .none { color: var(--muted); font-size: 13.5px; }
.rel-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); }
.rel-chip .hj { font-weight: 700; }
.rel-chip small { color: var(--muted); font-size: 12px; }
.basis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; margin: 0; }
.basis div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.basis dt { color: var(--muted); }
.basis dd { margin: 0; }
details.more summary { cursor: pointer; font-weight: 500; }
details.more[open] summary { margin-bottom: 12px; }
.notes { color: var(--muted); font-size: 13px; padding-left: 18px; margin: 0; }

@media (max-width: 640px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .stat + .stat { border-left: 0; border-top: 1px solid var(--line); }
  .stat { padding: 16px; }
  .basis { grid-template-columns: minmax(0, 1fr); }
  .basis div { grid-template-columns: 96px minmax(0, 1fr); }
  .tile { width: 52px; height: 52px; }
  .tile .hj { font-size: 24px; }
  .chart tbody th { width: 50px; }
  .chart tbody th .ko { display: none; }
  .chart .god { font-size: 12.5px; }
  .chart .sal-list { font-size: 11.5px; }
  .chart .napeum { font-size: 11px; }
  .chart .napeum .hj { font-size: 12px; }
  .chart .hidden-stems { font-size: 11.5px; }
}

/* ---------- 일주론 글 (iljoo/*.md) ---------- */
.article { line-height: 1.85; }
.article h1 { font: 700 24px/1.35 'Noto Serif KR', serif; margin: 0 0 14px; }
.article h2 { font: 700 19px/1.35 'Noto Serif KR', serif; margin: 30px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.article h2 .hj { color: var(--accent); margin-right: 8px; font-size: 15px; }
.article h3 { font: 700 16px/1.35 'Noto Serif KR', serif; margin: 18px 0 8px; }
.article p { margin: 0 0 10px; color: var(--ink-2); }
.article ul { margin: 0 0 12px; padding-left: 20px; color: var(--ink-2); }
.article li { margin-bottom: 6px; }
.article strong { color: var(--ink); }
.article blockquote { margin: 0 0 14px; padding: 12px 16px; background: var(--surface-2); border-left: 3px solid var(--gold); }
.article blockquote p { margin: 0; color: var(--ink); }
.article blockquote p + p { margin-top: 6px; }
.article hr { display: none; }
.article table { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 14px; }
.article th, .article td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.article th { background: var(--surface-2); font-weight: 500; color: var(--ink-2); }
.article td:first-child { white-space: nowrap; color: var(--muted); }
.article details summary { cursor: pointer; font: 700 16px 'Noto Serif KR', serif; margin: 26px 0 10px; }
.article .footnote { font-size: 13px; color: var(--muted); }
@media (max-width: 640px) { .article td:first-child { white-space: normal; } }

/* ---------- 복주머니 ---------- */
.packages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 860px) { .packages { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.package { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 12px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; text-align: center; font: inherit; color: inherit; }
.package:hover { border-color: var(--line-strong); }
.package input { position: absolute; opacity: 0; pointer-events: none; }
.package:has(input:checked) { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); background: var(--gold-tint); }
.package .count { font: 700 26px/1.1 'Noto Serif KR', serif; color: var(--gold); }
.package .count small { font-size: 14px; color: var(--ink-2); }
.package .price { font-weight: 700; font-size: 16px; }
.package .unit { font-size: 12.5px; color: var(--muted); }
.package .save { font-size: 12px; color: var(--accent); font-weight: 700; }
.package .badge { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); padding: 1px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; background: var(--accent); color: var(--on-accent); }
.package .badge.best { background: var(--gold); color: var(--on-gold); }
.ledger { width: 100%; border-collapse: collapse; font-size: 14px; }
.ledger th, .ledger td { padding: 9px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.ledger th { color: var(--muted); font-weight: 500; font-size: 13px; }
.ledger .num { text-align: right; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.table-scroll .ledger td, .table-scroll .ledger th { white-space: nowrap; }
.plus { color: var(--wood-fg); font-weight: 700; }

/* ---------- 확인 창 (confirm_dialog.js, 브라우저 confirm() 대신) ---------- */
.confirm-dialog { width: min(360px, calc(100vw - 32px)); padding: 22px 20px 18px; border: 0; border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.confirm-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.confirm-dialog p { margin: 0 0 18px; font-size: 15px; line-height: 1.6; }
.confirm-dialog .actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- 풀이 공유 ---------- */
.share-box input[type="text"] { width: 100%; margin-bottom: 10px; font-size: 13.5px; }
.btn.btn-kakao { background: #fee500; border-color: #fee500; color: #191919; }
.btn.btn-kakao:hover { background: #f5dc00; }

/* ---------- 관리 화면 ---------- */
.admin-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-top: -8px; }
.admin-nav a { padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); text-decoration: none; font-size: 14px; color: var(--ink-2); }
.admin-nav a[aria-current="page"] { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi b { font-size: 20px; line-height: 1.3; }
.kpi small { color: var(--muted); font-size: 12.5px; }
a.kpi:hover, .kpi.selected { border-color: var(--accent); }
.admin-cols { align-items: start; }
.admin-cols > .panel + .panel { margin-top: 0; } /* 나란히 놓인 칸은 grid 간격만 쓴다 */
.basis.one { grid-template-columns: minmax(0, 1fr); }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.minus { color: var(--accent); font-weight: 700; }

/* ---------- 목록 ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1 1 200px; min-width: 0; }
.list .title { font-weight: 700; }
.list .sub { font-size: 13px; color: var(--muted); }
.counter { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }
.counter b { color: var(--ink); font-size: 16px; }

footer.site { max-width: 1080px; margin: 0 auto; padding: 8px 16px 40px; color: var(--muted); font-size: 12.5px; }
footer.site a { color: var(--muted); }
footer.site nav { display: flex; gap: 14px; margin-bottom: 6px; }
