/* ============================================================
   周易 · 주역에 관한 모든 것
   한지(韓紙) · 먹(墨) · 금박(金箔) 톤 / 라이트·다크
   ============================================================ */

:root {
  --paper: #f4eddc;
  --paper-2: #ece2cb;
  --paper-3: #faf5e9;
  --ink: #221d17;
  --ink-2: #4a4036;
  --ink-3: #7a6c5b;
  --line: rgba(34, 29, 23, .16);
  --line-2: rgba(34, 29, 23, .08);
  --gold: #a8813f;
  --gold-2: #c9a45f;
  --seal: #9b3a2c;
  --seal-2: #b8503f;
  --jade: #4e6b52;
  --shadow: 0 1px 2px rgba(40, 30, 15, .06), 0 8px 24px -12px rgba(40, 30, 15, .28);
  --shadow-lg: 0 2px 4px rgba(40, 30, 15, .08), 0 24px 60px -24px rgba(40, 30, 15, .45);
  --radius: 4px;
  --serif: "Noto Serif KR", "Nanum Myeongjo", "Apple SD Gothic Neo", "Batang", "바탕", "Malgun Gothic", serif;
  --hanja: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --nav-h: 58px;
}

html[data-theme="dark"] {
  --paper: #14120f;
  --paper-2: #1b1813;
  --paper-3: #221e18;
  --ink: #ece2cd;
  --ink-2: #cbbda4;
  --ink-3: #91836d;
  --line: rgba(236, 226, 205, .16);
  --line-2: rgba(236, 226, 205, .07);
  --gold: #cfab68;
  --gold-2: #e0c489;
  --seal: #c96a56;
  --seal-2: #d9836f;
  --jade: #8fb096;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .8);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .5), 0 30px 70px -30px #000;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.72;
  background-color: var(--paper);
  background-image:
    radial-gradient(1200px 600px at 12% -10%, rgba(255, 255, 255, .5), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(201, 164, 95, .10), transparent 55%),
    repeating-linear-gradient(0deg, rgba(120, 96, 60, .028) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(120, 96, 60, .022) 0 1px, transparent 1px 4px);
  background-attachment: fixed;
  overflow-x: hidden;
}
html[data-theme="dark"] body {
  background-image:
    radial-gradient(1000px 500px at 10% -10%, rgba(201, 164, 95, .07), transparent 60%),
    radial-gradient(800px 400px at 100% 0%, rgba(155, 58, 44, .07), transparent 55%),
    repeating-linear-gradient(0deg, rgba(255, 240, 210, .012) 0 1px, transparent 1px 3px);
}
::selection { background: rgba(201, 164, 95, .35); }

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -.01em; line-height: 1.35; margin: 0; }
p { margin: 0 0 .8em; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.hanja { font-family: var(--hanja); font-weight: 400; }

/* ---------- 공통 ---------- */
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.center { text-align: center; }
.gold { color: var(--gold); }
.serif-num { font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 3px; border: 1px solid var(--line);
  background: var(--paper-3); color: var(--ink); cursor: pointer;
  transition: .18s ease; text-decoration: none; line-height: 1.3;
}
.btn:hover { border-color: var(--gold); background: var(--paper-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(180deg, #a8402f, #8d3225); color: #fdf6e8;
  border-color: #7c2b20; box-shadow: 0 6px 18px -10px rgba(120, 40, 28, .9);
}
.btn-primary:hover { background: linear-gradient(180deg, #b64a37, #96392a); border-color: #7c2b20; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; font-size: 14px; }
.btn-block { width: 100%; }

.tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; letter-spacing: .02em; border: 1px solid var(--line);
  color: var(--ink-3); background: rgba(255, 255, 255, .25);
}
html[data-theme="dark"] .tag { background: rgba(255, 255, 255, .04); }
.tag.level-대길, .tag.level-길 { color: var(--seal); border-color: rgba(155, 58, 44, .38); background: rgba(155, 58, 44, .07); }
.tag.level-평길, .tag.level-소길, .tag.level-평 { color: var(--jade); border-color: rgba(78, 107, 82, .38); background: rgba(78, 107, 82, .07); }
.tag.level-평흉 { color: #8a6a2f; border-color: rgba(160, 120, 40, .4); background: rgba(180, 140, 60, .08); }
.tag.level-흉 { color: var(--ink-3); border-color: var(--line); background: transparent; }

.card {
  background: linear-gradient(180deg, var(--paper-3), var(--paper));
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
html[data-theme="dark"] .card { background: linear-gradient(180deg, var(--paper-3), var(--paper-2)); }

.rule { height: 1px; background: linear-gradient(90deg, transparent, var(--line), transparent); border: 0; margin: 28px 0; }

/* ---------- 상단 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .topbar { background: var(--paper); }
}
.topbar-in {
  height: var(--nav-h); display: flex; align-items: center; gap: 16px;
  max-width: 1120px; margin: 0 auto; padding: 0 20px;
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; flex: 0 0 auto; }
.seal {
  width: 34px; height: 34px; border-radius: 3px; display: grid; place-items: center;
  background: linear-gradient(160deg, var(--seal-2), var(--seal)); color: #fdf3e2;
  font-family: var(--hanja); font-size: 19px; line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 240, 210, .35), 0 3px 10px -6px rgba(120, 40, 28, .9);
}
.brand-t { font-size: 17px; font-weight: 600; letter-spacing: .01em; }
.brand-s { display: block; font-size: 11.5px; color: var(--ink-3); letter-spacing: .18em; margin-top: -2px; }

.nav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav button {
  border: 0; background: transparent; cursor: pointer; white-space: nowrap;
  padding: 8px 13px; border-radius: 3px; color: var(--ink-2); font-size: 15px;
  position: relative; transition: .15s;
}
.nav button:hover { color: var(--ink); background: rgba(168, 129, 63, .08); }
.nav button.active { color: var(--ink); font-weight: 600; }
.nav button.active::after {
  content: ""; position: absolute; left: 13px; right: 13px; bottom: 1px; height: 2px;
  background: linear-gradient(90deg, var(--gold-2), var(--seal)); border-radius: 2px;
}
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line); border-radius: 3px; background: transparent; flex: 0 0 auto;
}
.icon-btn:hover { border-color: var(--gold); }

/* ---------- 괘상(卦象) 그리기 ---------- */
.hex {
  --w: 58px; --h: 6px; --gap: 5px;
  width: var(--w); display: flex; flex-direction: column; gap: var(--gap); align-items: stretch;
}
.hex .ln { height: var(--h); display: flex; gap: calc(var(--w) * .16); }
.hex .ln i { background: var(--ink); border-radius: 1px; display: block; height: 100%; }
.hex .ln.yang i { flex: 1 1 100%; }
.hex .ln.yin i { flex: 1 1 calc(50% - 4px); }
.hex .ln.moving i { background: var(--seal); box-shadow: 0 0 0 1px rgba(155, 58, 44, .18); }
.hex.lg { --w: 96px; --h: 9px; --gap: 8px; }
.hex.sm { --w: 46px; --h: 5px; --gap: 4px; }
.hex.xs { --w: 26px; --h: 3px; --gap: 2.5px; }
.hex .ln.future i { opacity: .34; }
.hex-mark { font-size: 11px; color: var(--ink-3); letter-spacing: .1em; }

/* ---------- 히어로 ---------- */
.hero { padding: 46px 0 10px; }
.hero-grid { display: grid; grid-template-columns: 1.35fr .95fr; gap: 28px; align-items: stretch; }
.hero-title { font-size: clamp(30px, 5vw, 46px); letter-spacing: -.02em; line-height: 1.2; }
.hero-title .hanja { color: var(--seal); }
.hero-lead { color: var(--ink-2); font-size: 16.5px; margin-top: 14px; max-width: 46ch; }
.hero-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.hero-side { padding: 20px 22px; display: flex; flex-direction: column; justify-content: space-between; }
.daily-mini-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.daily-mini-title { font-size: 12px; letter-spacing: .22em; color: var(--ink-3); }
.daily-mini-body { display: flex; gap: 16px; align-items: center; margin-top: 12px; }
.daily-mini-name { font-size: 22px; font-weight: 600; }
.daily-mini-sub { font-size: 13px; color: var(--ink-3); }
.daily-mini-text { font-size: 14px; color: var(--ink-2); margin-top: 8px; }

.stats { display: flex; gap: 22px; margin-top: 26px; flex-wrap: wrap; }
.stat b { font-size: 20px; font-weight: 600; }
.stat span { display: block; font-size: 12px; color: var(--ink-3); letter-spacing: .06em; }

/* ---------- 64괘 그리드 ---------- */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 34px 0 16px; flex-wrap: wrap; }
.section-head h2 { font-size: 21px; }
.section-head .sub { font-size: 13px; color: var(--ink-3); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search {
  position: relative; flex: 1 1 260px; max-width: 380px;
}
.search input {
  width: 100%; padding: 10px 14px 10px 36px; border-radius: 3px; border: 1px solid var(--line);
  background: var(--paper-3); color: var(--ink); font: inherit; font-size: 15px;
}
.search input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 164, 95, .16); }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); opacity: .5; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; cursor: pointer; font-size: 13.5px; color: var(--ink-2);
}
.chip:hover { border-color: var(--gold); }
.chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
html[data-theme="dark"] .chip.active { background: var(--gold); color: #17130e; border-color: var(--gold); }

.grid-64 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.gua-card {
  padding: 16px 16px 14px; cursor: pointer; position: relative; overflow: hidden;
  transition: .18s ease; display: flex; flex-direction: column; gap: 10px;
}
.gua-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--gold); }
.gua-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.gua-no { font-size: 12px; color: var(--ink-3); letter-spacing: .08em; }
.gua-card .hex { margin-top: 2px; }
.gua-name { font-size: 19px; font-weight: 600; display: flex; align-items: baseline; gap: 7px; }
.gua-name .hanja { font-size: 15px; color: var(--ink-3); }
.gua-sub { font-size: 12.5px; color: var(--ink-3); letter-spacing: .04em; }
.gua-core { font-size: 13.5px; color: var(--ink-2); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gua-card-mid { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gua-card-mid .gua-sub.kw { letter-spacing: .1em; opacity: .9; }
.gua-card .gua-fig { flex: 0 0 auto; opacity: .92; }
.gua-card:hover .gua-fig { opacity: 1; }

/* ---------- 상세(오버레이) ---------- */
.detail {
  position: fixed; inset: 0; z-index: 100; background: var(--paper);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.detail-head {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(10px);
}
.detail-body { max-width: 880px; margin: 0 auto; padding: 26px 20px 90px; }
.detail-title-row { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.detail-title h1 { font-size: clamp(26px, 4vw, 34px); display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.detail-title h1 .hanja { font-size: .62em; color: var(--ink-3); }
.detail-title .pinyin { font-size: 13px; color: var(--ink-3); letter-spacing: .12em; }
.trigram-pair { display: flex; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.tri-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); background: rgba(255, 255, 255, .3);
}
html[data-theme="dark"] .tri-pill { background: rgba(255, 255, 255, .03); }
.tri-pill b { font-weight: 600; }

.block { margin-top: 30px; }
.block-title {
  display: flex; align-items: center; gap: 10px; font-size: 13px; letter-spacing: .2em;
  color: var(--ink-3); margin-bottom: 12px;
}
.block-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.quote {
  font-family: var(--hanja); font-size: 19px; line-height: 2; color: var(--ink);
  letter-spacing: .03em; padding: 18px 20px; border-left: 2px solid var(--gold);
  background: linear-gradient(90deg, rgba(201, 164, 95, .08), transparent 70%);
  border-radius: 0 3px 3px 0;
}
.quote small { display: block; margin-top: 6px; font-family: var(--serif); font-size: 13px; color: var(--ink-3); letter-spacing: 0; }
.quote.kr { font-family: var(--serif); font-size: 15.5px; line-height: 1.85; color: var(--ink-2); letter-spacing: 0; border-left-color: var(--line); background: transparent; padding: 4px 0 4px 16px; }

.yao-list { display: flex; flex-direction: column; gap: 10px; }
.yao {
  border: 1px solid var(--line); border-radius: 3px; background: var(--paper-3);
  overflow: hidden; transition: border-color .15s;
}
.yao.open { border-color: var(--gold); }
.yao-head {
  display: flex; align-items: center; gap: 12px; padding: 12px 15px; cursor: pointer;
  background: transparent; border: 0; width: 100%; text-align: left;
}
.yao-head:hover { background: rgba(201, 164, 95, .06); }
.yao-line { width: 34px; height: 4px; border-radius: 1px; background: var(--ink); position: relative; flex: 0 0 auto; }
.yao-line.yin::after { content: ""; position: absolute; left: 40%; right: 40%; top: 0; bottom: 0; background: var(--paper-3); }
.yao-label { font-family: var(--hanja); font-size: 15px; color: var(--seal); flex: 0 0 auto; }
.yao-text { font-family: var(--hanja); font-size: 15.5px; color: var(--ink); flex: 1; line-height: 1.6; }
.yao-caret { color: var(--ink-3); transition: .2s; font-size: 12px; }
.yao.open .yao-caret { transform: rotate(180deg); }
.yao-body { padding: 0 15px 14px 61px; }
.yao-body .kr { font-size: 14.5px; color: var(--ink-2); }
.yao-body .xx { font-family: var(--hanja); font-size: 13.5px; color: var(--ink-3); margin-top: 8px; }
.yao.moving-badge .yao-head { background: rgba(155, 58, 44, .06); }
.yao .moving-dot { margin-left: auto; font-size: 11px; color: var(--seal); letter-spacing: .08em; }

.cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.cat { padding: 12px 14px; border: 1px solid var(--line); border-radius: 3px; background: var(--paper-3); }
.cat b { display: block; font-size: 12px; letter-spacing: .16em; color: var(--gold); margin-bottom: 5px; }
.cat p { font-size: 13.5px; color: var(--ink-2); margin: 0; line-height: 1.6; }

.rel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.rel {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 3px; cursor: pointer; background: transparent; text-align: left; transition: .15s;
}
.rel:hover { border-color: var(--gold); background: rgba(201, 164, 95, .07); }
.rel small { display: block; font-size: 11.5px; color: var(--ink-3); letter-spacing: .1em; }
.rel strong { font-weight: 600; font-size: 14.5px; }

/* ---------- 점치기 ---------- */
.divine-grid { display: grid; grid-template-columns: 340px 1fr; gap: 26px; align-items: start; margin-top: 22px; }
.panel { padding: 20px; }
.panel h3 { font-size: 16px; margin-bottom: 4px; }
.mode-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 14px 0 18px; }
.mode-tab {
  padding: 9px 6px; border: 1px solid var(--line); border-radius: 3px; background: transparent;
  cursor: pointer; font-size: 13.5px; color: var(--ink-2); text-align: center; line-height: 1.35;
}
.mode-tab small { display: block; font-size: 11px; color: var(--ink-3); }
.mode-tab.active { border-color: var(--gold); background: rgba(201, 164, 95, .12); color: var(--ink); font-weight: 600; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; letter-spacing: .1em; color: var(--ink-3); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; border-radius: 3px; border: 1px solid var(--line);
  background: var(--paper-3); color: var(--ink); font: inherit; font-size: 14.5px;
}
.field textarea { min-height: 74px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 164, 95, .14); }
.hint { font-size: 12.5px; color: var(--ink-3); line-height: 1.6; }

.coins { display: flex; gap: 8px; justify-content: center; margin: 8px 0 4px; }
.coin {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--hanja); font-size: 17px; border: 1px solid var(--line);
  background: radial-gradient(circle at 34% 28%, #f9f2df, #ddcfae);
  color: #6b5427; box-shadow: 0 2px 6px -3px rgba(60, 45, 20, .5);
}
html[data-theme="dark"] .coin { background: radial-gradient(circle at 34% 28%, #4a4032, #2a2419); color: #d9c48f; }
.coin.tail { opacity: .82; }
.coin.flip { animation: coinflip .5s ease; }
@keyframes coinflip {
  0% { transform: rotateY(0) translateY(0); }
  50% { transform: rotateY(540deg) translateY(-14px); }
  100% { transform: rotateY(1080deg) translateY(0); }
}

.stalk-viz { font-family: var(--mono); font-size: 13px; color: var(--ink-2); line-height: 1.9; min-height: 60px; }
.stalk-viz .rm { color: var(--seal); }

.toss-area { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 22px 0 4px; }
.toss-status { font-size: 13px; color: var(--ink-3); letter-spacing: .06em; min-height: 20px; }

.progress-lines { display: flex; flex-direction: column-reverse; gap: 5px; align-items: center; min-height: 96px; justify-content: center; }
.progress-lines:empty { min-height: 0; }
.pline { display: flex; align-items: center; gap: 8px; opacity: 0; transform: translateY(6px); transition: .35s ease; }
.pline.show { opacity: 1; transform: none; }
.pline .val { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; min-width: 34px; white-space: nowrap; }
.pline .bar { display: flex; gap: 6px; width: 76px; height: 7px; }
.pline .bar i { background: var(--ink); border-radius: 1px; height: 100%; }
.pline .bar i.yang { flex: 1; }
.pline .bar i.yin { flex: 1 1 42%; }
.pline .bar.moving i { background: var(--seal); }
.pline .mark { font-size: 11px; color: var(--seal); width: 34px; }

/* ---------- 결과 ---------- */
.result { margin-top: 22px; }
.result-empty { padding: 46px 20px; text-align: center; color: var(--ink-3); }
.result-empty .hanja { font-size: 40px; opacity: .3; display: block; margin-bottom: 10px; }
.res-heads { display: flex; gap: 26px; flex-wrap: wrap; align-items: flex-start; }
.res-fig { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.res-fig .cap { font-size: 12px; letter-spacing: .16em; color: var(--ink-3); }
.res-name { font-size: 20px; font-weight: 600; }
.res-name .hanja { font-size: 14px; color: var(--ink-3); margin-left: 6px; }
.res-arrow { align-self: center; font-size: 22px; color: var(--ink-3); padding: 0 2px; }
.reading-note {
  margin-top: 16px; padding: 14px 16px; border-radius: 3px;
  background: rgba(201, 164, 95, .1); border: 1px solid rgba(201, 164, 95, .3);
  font-size: 14px; color: var(--ink-2);
}
.reading-note b { color: var(--seal); }
.ai-box { margin-top: 18px; }
.ai-out { white-space: pre-wrap; font-size: 15px; line-height: 1.85; color: var(--ink-2); }
.ai-out h4 { margin: 16px 0 6px; font-size: 15.5px; color: var(--ink); }
.loader { display: inline-flex; gap: 5px; align-items: center; }
.loader i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); animation: bounce 1s infinite; }
.loader i:nth-child(2) { animation-delay: .15s; }
.loader i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5 } 30% { transform: translateY(-5px); opacity: 1 } }

/* ---------- 오늘의 괘 ---------- */
.daily-hero { display: grid; grid-template-columns: 1fr 240px; gap: 26px; padding: 28px; align-items: center; }
.daily-date { font-size: 13px; letter-spacing: .22em; color: var(--ink-3); }
.daily-name { font-size: clamp(28px, 4vw, 38px); margin: 6px 0 4px; }
.daily-name .hanja { font-size: .55em; color: var(--ink-3); margin-left: 8px; }
.daily-fig { justify-self: center; }

/* ---------- 기록 ---------- */
.rec-list { display: flex; flex-direction: column; gap: 12px; }
.rec {
  padding: 16px 18px; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center;
}
.rec-main { min-width: 0; }
.rec-q { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }
.rec-memo { font-size: 13.5px; color: var(--ink-2); margin-top: 6px; border-left: 2px solid var(--line); padding-left: 10px; }
.rec-actions { display: flex; gap: 6px; }
.empty-state { padding: 60px 20px; text-align: center; color: var(--ink-3); }

/* ---------- 백과 ---------- */
.wiki-layout { display: grid; grid-template-columns: 210px 1fr; gap: 34px; align-items: start; margin-top: 24px; }
.wiki-toc { position: sticky; top: calc(var(--nav-h) + 18px); font-size: 14px; }
.wiki-toc::-webkit-scrollbar { display: none; }
.wiki-toc { scrollbar-width: none; }
.wiki-toc a { display: block; padding: 6px 10px; color: var(--ink-3); text-decoration: none; border-left: 2px solid transparent; line-height: 1.5; }
.wiki-toc a:hover { color: var(--ink); }
.wiki-toc a.active { color: var(--ink); border-left-color: var(--gold); background: rgba(201, 164, 95, .07); }
.wiki-body { max-width: 740px; }
.wiki-body h2 { font-size: 24px; margin: 40px 0 14px; padding-top: 8px; }
.wiki-body h2:first-child { margin-top: 0; }
.wiki-body h3 { font-size: 17px; margin: 24px 0 8px; color: var(--ink); }
.wiki-body p, .wiki-body li { font-size: 15.5px; color: var(--ink-2); }
.wiki-body ul, .wiki-body ol { padding-left: 22px; margin: 0 0 14px; }
.wiki-body li { margin-bottom: 5px; }
.wiki-body table { width: 100%; border-collapse: collapse; margin: 14px 0 18px; font-size: 14px; }
.wiki-body th, .wiki-body td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.wiki-body th { background: rgba(201, 164, 95, .1); font-weight: 600; color: var(--ink); }
.wiki-body .hanja { font-size: 1.02em; }
.wiki-body blockquote {
  margin: 14px 0; padding: 14px 18px; border-left: 2px solid var(--gold);
  background: rgba(201, 164, 95, .07); border-radius: 0 3px 3px 0; font-family: var(--hanja);
  font-size: 17px; line-height: 1.9;
}
.wiki-body blockquote span { display: block; font-family: var(--serif); font-size: 14px; color: var(--ink-3); margin-top: 6px; }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 6px 12px; font-size: 14.5px; }
.kv dt { color: var(--ink-3); font-size: 13px; letter-spacing: .06em; }
.kv dd { margin: 0; }

/* ---------- 팔괘 ---------- */
.bagua-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 20px; }
.tri-card { padding: 18px 16px; text-align: center; }
.tri-sym { font-size: 34px; line-height: 1; color: var(--ink); }
.tri-name { margin-top: 8px; font-size: 18px; font-weight: 600; }
.tri-name .hanja { font-size: 14px; color: var(--ink-3); margin-left: 5px; }
.tri-nat { font-size: 13px; color: var(--gold); letter-spacing: .1em; margin-top: 2px; }
.tri-attrs { margin-top: 10px; font-size: 12.5px; color: var(--ink-3); line-height: 1.7; text-align: left; }
.tri-attrs b { color: var(--ink-2); font-weight: 600; }

.bagua-map { position: relative; aspect-ratio: 1; max-width: 420px; margin: 26px auto; }
.bagua-map .cell {
  position: absolute; width: 20%; height: 20%; display: grid; place-items: center;
  font-family: var(--hanja); font-size: 22px; border: 1px solid var(--line); border-radius: 3px;
  background: var(--paper-3); transform: translate(-50%, -50%);
}
.bagua-map .cell small { display: block; font-family: var(--serif); font-size: 10.5px; color: var(--ink-3); }
.bagua-map .center {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 34%; height: 34%; border-radius: 50%; display: grid; place-items: center;
  border: 1px dashed var(--line); color: var(--ink-3); font-size: 12px; text-align: center;
}

/* ---------- 토스트 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 3px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 300;
  box-shadow: var(--shadow-lg); max-width: 88vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 푸터 ---------- */
.footer { border-top: 1px solid var(--line); margin-top: 60px; padding: 26px 0 40px; }
.footer-in { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); }

/* ---------- 반응형 ---------- */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .grid-64 { grid-template-columns: repeat(3, 1fr); }
  .divine-grid { grid-template-columns: 1fr; }
  .wiki-layout { grid-template-columns: 1fr; }
  .wiki-toc { position: static; display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; }
  .wiki-toc a { white-space: nowrap; border-left: 0; border-bottom: 2px solid transparent; }
  .wiki-toc a.active { border-left: 0; border-bottom-color: var(--gold); }
  .daily-hero { grid-template-columns: 1fr; text-align: center; }
  .daily-fig { justify-self: center; }
}
@media (max-width: 720px) {
  :root { --nav-h: 92px; }
  body { font-size: 15.5px; }
  .wrap { padding: 0 16px; }
  .topbar-in {
    flex-wrap: wrap; height: auto; padding: 8px 12px 0; gap: 6px;
  }
  .brand { order: 1; }
  .brand-s { display: none; }
  .brand-t { font-size: 15px; }
  #themeBtn { order: 2; margin-left: auto; width: 32px; height: 32px; }
  .nav {
    order: 3; width: 100%; margin: 0; gap: 0; padding: 2px 0 7px;
    justify-content: space-between;
  }
  .nav button { padding: 6px 7px; font-size: 13.5px; }
  .nav button.active::after { left: 7px; right: 7px; bottom: 0; }
  .hero { padding: 28px 0 4px; }
  .grid-64 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .gua-card { padding: 13px 12px 12px; }
  .gua-name { font-size: 17px; }
  .gua-core { font-size: 12.5px; -webkit-line-clamp: 2; }
  .detail-body { padding: 18px 16px 80px; }
  .quote { font-size: 17px; padding: 14px 16px; }
  .yao-body { padding-left: 15px; }
  .yao-text { font-size: 14.5px; }
  .bagua-grid { grid-template-columns: repeat(2, 1fr); }
  .res-heads { gap: 14px; justify-content: center; }
  .rec { grid-template-columns: auto 1fr; }
  .rec-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .stats { gap: 16px; }
  .panel { padding: 16px; }
  .mode-tab { font-size: 12.5px; padding: 8px 4px; }
  .mode-tab small { display: none; }
}
@media (max-width: 400px) {
  .grid-64 { grid-template-columns: 1fr 1fr; }
  .hex { --w: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}

@media print {
  .topbar, .nav, .footer, .hero-actions, .mode-tabs, .toss-area { display: none; }
  .detail { position: static; }
}
