/* 평생 운명 가이드북 — 화면(조작판 + 책 미리보기)과 인쇄(A4 PDF) 서식 */
:root {
  --ink: #221a12; --muted: #6b5d4c; --paper: #fffdf7; --bg: #efe6d4; --line: #dccfb8; --soft: #f6efe0;
  --brand: #5b3fc4; --brand-soft: #ece6fb; --seal: #a3372b;
  /* 글꼴: 본문 Pretendard(OFL), 제목은 산돌 SD 고딕 Neo 가 기기에 있으면(맥·iOS 의 Apple SD Gothic Neo 등) 그것을, 없으면 Pretendard.
     Pretendard 에 없는 한자는 Noto Sans KR 로 보충한다. SD 고딕 Neo 는 상용 글꼴이라 파일을 배포하지 않는다. */
  --f-body: 'Pretendard Variable', Pretendard, 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --f-head: 'Sandoll SD Gothic Neo', 'SD Gothic Neo', 'Apple SD Gothic Neo', AppleSDGothicNeo, 'Pretendard Variable', Pretendard, 'Noto Sans KR', sans-serif;
  --e0: #1b5e20; --e1: #a0261b; --e2: #664f05; --e3: #45494e; --e4: #164c8c;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; --bg: #1f1a14; --soft: #2c251c; --ink: #efe6d4; --muted: #cbbfa9; }
  :root:not([data-theme="light"]) .bk-main, :root:not([data-theme="light"]) .bk-top { color: #efe6d4; }
  :root:not([data-theme="light"]) .bk-card { background: #2c251c; border-color: #4a3f31; }
  :root:not([data-theme="light"]) .bk-card select { background: #1f1a14; color: #efe6d4; border-color: #5c4f3d; }
  :root:not([data-theme="light"]) .bk-btn:not(.primary) { background: #3a3126; color: #efe6d4; border-color: #5c4f3d; }
  :root:not([data-theme="light"]) .lead, :root:not([data-theme="light"]) .bk-note { color: #cbbfa9; }
}
/* ◐ 버튼으로 어둡게를 고른 경우(시스템 설정과 무관) */
:root[data-theme="dark"] { color-scheme: dark; --bg: #1f1a14; --soft: #2c251c; --ink: #efe6d4; --muted: #cbbfa9; }
:root[data-theme="dark"] .bk-main, :root[data-theme="dark"] .bk-top { color: #efe6d4; }
:root[data-theme="dark"] .bk-card { background: #2c251c; border-color: #4a3f31; }
:root[data-theme="dark"] .bk-card select { background: #1f1a14; color: #efe6d4; border-color: #5c4f3d; }
:root[data-theme="dark"] .bk-btn:not(.primary) { background: #3a3126; color: #efe6d4; border-color: #5c4f3d; }
:root[data-theme="dark"] .lead, :root[data-theme="dark"] .bk-note { color: #cbbfa9; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.7 var(--f-body); }

/* 조작판 */
.bk-top { display: flex; justify-content: space-between; align-items: center; max-width: 900px; margin: 0 auto; padding: 14px 16px; }
.bk-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; font: 400 34px/1 'Nanum Brush Script', cursive; }
.bk-brand img { border-radius: 50%; }
.bk-back { color: var(--brand); font-weight: 700; text-decoration: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bk-back, :root:not([data-theme="light"]) .bk-status, :root:not([data-theme="light"]) .bk-pages, :root:not([data-theme="light"]) .bk-help a, :root:not([data-theme="light"]) .empty a { color: #c9b8ff; }
}
/* ◐ 버튼으로 어둡게를 고른 경우(시스템 설정과 무관) */
:root[data-theme="dark"] .bk-back, :root[data-theme="dark"] .bk-status, :root[data-theme="dark"] .bk-pages, :root[data-theme="dark"] .bk-help a, :root[data-theme="dark"] .empty a { color: #c9b8ff; }
.bk-main { max-width: 900px; margin: 0 auto; padding: 0 16px 24px; }
.bk-main h1 { font: 700 28px/1.3 var(--f-head); margin: 6px 0 8px; }
.lead { color: var(--muted); margin: 0 0 16px; }
.bk-card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: grid; gap: 10px; }
.bk-card[hidden] { display: none; }
/* 유료 리포트 잠금 안내 · 로컬 개발용 토큰 칸 */
.bk-locked { border-left: 4px solid #a3150c; margin-bottom: 14px; }
.bk-locked h2 { margin: 0; font-size: 1.15rem; }
.bk-locked p { margin: 0; }
.bk-dev { font-size: 14px; color: var(--ink-2, inherit); }
.bk-dev input { min-height: 40px; min-width: 0; width: min(320px, 100%); padding: 6px 10px; border-radius: 10px; border: 1.5px solid var(--field-border, var(--line)); background: var(--field-bg, #fff); font: inherit; }
.bk-row { display: flex; flex-wrap: wrap; gap: 8px; }
.bk-card select { flex: 1 1 220px; min-height: 48px; padding: 8px 12px; border-radius: 12px; border: 1.5px solid var(--line); font: inherit; background: #fff; }
.bk-btn { min-height: 48px; padding: 8px 18px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font: 700 15px/1 var(--f-body); cursor: pointer; }
.bk-btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.bk-btn:disabled { opacity: .5; cursor: not-allowed; }
.bk-status, .bk-pages { margin: 0; font-weight: 700; color: var(--brand); }
.bk-pages:empty, .bk-status:empty { display: none; }
.bk-help summary { cursor: pointer; font-weight: 700; }
.bk-help ol { margin: 8px 0 0; padding-left: 20px; }
.bk-note { margin: 0; font-size: 14px; color: var(--muted); }
.empty { margin: 0; }

/* 책 (화면 미리보기는 A4 폭의 종이 한 줄로 보여 준다) — 판형은 2026-09-30 사용자 요청으로 국판(A5) → A4 */
/* 책은 종이라서 어두운 모드에서도 항상 밝은 색을 쓴다 (조작판용으로 어둡게 바꾼 --soft 등을 되돌림) */
.book { --soft: #f6efe0; --bg: #efe6d4; --line: #dccfb8; --ink: #221a12; --muted: #6b5d4c; --paper: #fffdf7; color-scheme: light; }
.book { width: 210mm; max-width: 100%; margin: 8px auto 40px; background: #f4ecda var(--hanji, none) repeat; background-size: 384px 384px; color: var(--ink); box-shadow: 0 6px 30px rgba(60, 40, 10, .18);
  font: 400 11.2pt/1.86 var(--f-body); letter-spacing: -.005em; word-break: keep-all; overflow-wrap: anywhere; }
.book > section { padding: 21mm 22mm 22mm; border-bottom: 1px dashed var(--line); }
.book p { margin: 0 0 .7em; }
.book b { font-weight: 700; }
.book h2, .book h3, .book h4 { font-family: var(--f-head); break-after: avoid; }
.book h3 { font-size: 13pt; margin: 1.3em 0 .5em; padding-bottom: 3px; border-bottom: 1.5px solid var(--ink); }
.book h4 { font-size: 11pt; margin: 1.1em 0 .35em; color: #3d2f20; }
.book h4 small, .book h3 small { font-weight: 400; color: var(--muted); font-size: .85em; }
.e0 { color: var(--e0); } .e1 { color: var(--e1); } .e2 { color: var(--e2); } .e3 { color: var(--e3); } .e4 { color: var(--e4); }

/* 표지 */
.cover { min-height: 297mm; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px;
  border: 0; outline: 1.2px solid rgba(110, 82, 45, .55); outline-offset: -13mm; box-shadow: inset 0 0 0 15mm transparent; }
.cover::after { content: ""; position: absolute; inset: 15mm; border: .6px solid rgba(110, 82, 45, .4); pointer-events: none; }
.cover { position: relative; }
.cv-top { font: 400 42px/1 'Nanum Brush Script', cursive; color: var(--brand); }
.cv-ilju { font: 700 90px/1.1 var(--f-head); letter-spacing: .08em; color: #3d2f20; margin: 20mm 0 9mm; }
.cover h1 { font: 800 29pt/1.45 var(--f-head); margin: 0; }
.cv-name { font-size: 35pt; color: var(--seal); }
.cv-sub { color: var(--muted); font-size: 13pt; margin: 6mm 0 14mm; }
.cv-info { font-size: 12pt; color: #4d3f2e; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 5mm 9mm; }
.cv-info p { margin: 0; }
.cv-foot { margin-top: 17mm; font-size: 11pt; color: var(--muted); }

/* 머리말·차례 */
.fh { font: 800 20pt/1.3 var(--f-head); margin: 0 0 1em; text-align: center; }
.front .sign { text-align: right; color: var(--muted); margin-top: 1.4em; }
.toc { list-style: none; padding: 0; margin: 0; }
.toc li { padding: 7px 2px; border-bottom: 1px dotted var(--line); font-size: 11.5pt; }
.toc-n { display: inline-block; width: 4.4em; color: var(--brand); font-weight: 700; }
.toc-end { margin-top: 10px; font-size: 11.5pt; padding-left: 2px; }
.howto dt { font-weight: 700; margin-top: .8em; color: var(--brand); }
.howto dd { margin: .2em 0 0; }
.note { margin-top: 1.2em; padding: 8px 10px; border-radius: 6px; background: rgba(226, 211, 180, .38); font-size: 9pt; color: #5a4b39; }

/* 장 머리 */
.ch-title { min-height: 250mm; display: flex; flex-direction: column; justify-content: center; text-align: center; }
.ch-no { font: 700 16pt/1 var(--f-head); letter-spacing: .3em; color: var(--brand); }
.ch-title h2 { font: 800 30pt/1.35 var(--f-head); margin: 8mm 0 4mm; }
.ch-sub { color: var(--muted); margin-bottom: 14mm !important; }

/* 명언 */
.q { margin: 1em 0; padding: 0; text-align: center; }
.q-t { font-size: 11pt; font-weight: 600; margin-bottom: .2em !important; }
.q-o { font-size: 9pt; color: var(--muted); letter-spacing: .06em; margin-bottom: .1em !important; }
.q cite { font-style: normal; font-size: 9pt; color: var(--muted); }
.q.big .q-t { font-size: 12.5pt; line-height: 1.7; }
.qbox { margin: 1.4em 0; padding: 10px 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(255, 252, 243, .5); break-inside: avoid; }
.qbox-h { font-size: 8.5pt; color: var(--brand); letter-spacing: .1em; text-align: center; }
.qbox .q { margin: .4em 0 0; }

/* 표·막대 */
.tbl { width: 100%; border-collapse: collapse; margin: .6em 0 1em; font-size: 9.5pt; break-inside: avoid; }
.tbl th, .tbl td { border: 1px solid var(--line); padding: 4px 5px; text-align: center; vertical-align: middle; }
.tbl thead th, .tbl tbody th { background: rgba(222, 205, 170, .42); font-weight: 700; }
.tbl th small { display: block; font-weight: 400; color: #54473a; }
.tbl tr.hl td { background: rgba(214, 200, 245, .45); font-weight: 700; }
.tbl.kv td { text-align: left; }
.wonguk td.big { font-size: 20pt; line-height: 1.2; font-weight: 700; }
.wonguk td.big small { display: block; font-size: 8pt; font-weight: 400; color: var(--muted); }
.wonguk td.sm { font-size: 8.5pt; }
.cap { font-size: 8.5pt; color: var(--muted); margin-top: -.5em !important; }
.bars { display: grid; gap: 5px; margin: .6em 0 1em; break-inside: avoid; }
.bar { display: grid; grid-template-columns: 7.5em 1fr 2em; gap: 8px; align-items: center; font-size: 9.5pt; }
.bar-l small { color: var(--muted); font-size: .85em; }
.bar-t { height: 9px; border-radius: 5px; background: rgba(205, 188, 152, .45); overflow: hidden; }
.bar-t i { display: block; height: 100%; background: var(--brand); border-radius: 5px; }
.bar b { text-align: right; }
.bars.mini .bar { grid-template-columns: 3em 1fr 2em; }
.gauge { position: relative; height: 12px; border-radius: 6px; margin: .5em 0 1.8em; background: linear-gradient(90deg, #8fb3e0, #efe3b8 50%, #e59a86); }
.gauge span { position: absolute; top: -4px; width: 4px; height: 20px; margin-left: -2px; background: var(--ink); border-radius: 2px; }
.gauge em { position: absolute; top: 15px; font-style: normal; font-size: 8.5pt; color: var(--muted); }
.gauge em:nth-of-type(1) { left: 0; } .gauge em:nth-of-type(2) { left: 50%; transform: translateX(-50%); } .gauge em:nth-of-type(3) { right: 0; }
.stars { color: #7a5503; letter-spacing: 1px; white-space: nowrap; }
.tips { margin: .4em 0 1em; padding-left: 1.2em; }
.tips li { margin-bottom: .3em; }
.tip { background: rgba(226, 211, 180, .38); padding: 6px 9px; border-radius: 6px; font-size: 9.8pt; }

/* 일주 */
.ilju { text-align: center; margin: 0 0 1.2em; padding: 6mm 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ilju-h { font: 700 44pt/1.1 var(--f-head); letter-spacing: .1em; }
.ilju-n { font-weight: 700; color: var(--muted); }
.ilju-l { margin: .4em 0 0 !important; font-size: 11pt; font-weight: 600; }

/* 대운·년운 한 쪽 */
.du-h { display: flex; justify-content: space-between; align-items: center; font-size: 9.5pt; color: var(--muted); }
.du-age { font-weight: 700; }
.badge { background: var(--seal); color: #fff; border-radius: 999px; padding: 1px 9px; font-size: 8.5pt; font-weight: 700; }
.du-t { font-size: 15pt !important; border-bottom: 2px solid var(--ink) !important; margin-top: .4em !important; }
.du-sum { display: grid; grid-template-columns: 9.5em 1fr; gap: 10px; align-items: center; margin: .5em 0 .8em; }
.du-score { text-align: center; font-size: 9pt; color: var(--muted); }
.du-score .stars { display: block; font-size: 15pt; }
.du.now { outline: 2px solid var(--seal); outline-offset: -6mm; }
.months th { width: 40%; }
.mtbl { font-size: 8.8pt; }
.mtbl td, .mtbl th { padding: 2px 4px; }
.mtbl .stars { font-size: 9pt; }
.du2 h4:first-of-type { margin-top: .6em; }
.du2 h4 .stars { font-size: 10pt; margin-left: 4px; }

/* 인쇄: 책만 A4 로
 * 판형: A4 210×297mm — 이름(A4) 대신 치수로 적어 어느 브라우저에서나 같은 크기가 되게 한다.
 * 쪽 여백은 0 으로 두고, 여백은 각 구역의 안쪽 여백(padding)으로 만든다. 흐르는 본문이 여러 쪽으로 나뉠 때도
 * box-decoration-break: clone 으로 쪽마다 위아래 안쪽 여백이 반복된다.
 * 이유: 쪽 여백(@page margin) 부분의 배경은 인쇄 창의 「배경 그래픽」을 켜야만 찍히지만, 요소의 배경은
 * print-color-adjust: exact 로 강제할 수 있다. 그래서 여백까지 화선지가 늘 꽉 차게 하려면 여백을 요소 안으로 옮겨야 한다.
 * 머리글·쪽 번호는 크기 0 이 된 쪽 여백 칸(margin box)에 두되, 음수 여백으로 종이 안쪽으로 끌어와 기존 자리에 맞춘다. */
@page { size: 210mm 297mm; margin: 0; }
@media print {
  html { background: #f4ecda var(--hanji, none) repeat !important; background-size: 384px 384px !important; }
  body { background: transparent !important; }
  .no-print { display: none !important; }
  html, .book { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .book { width: auto; margin: 0; box-shadow: none; background: transparent; }
  .book > section { padding: 21mm 22mm 22mm; border: 0; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
  .book > .cover { min-height: 0; height: 297mm; padding: 0 17mm; break-after: page; }
  .book > .pg, .book > .flow { break-before: page; }
  .book > .cover { break-before: auto; }
  .ch-title { min-height: 0; height: 250mm; }
  .tbl, .bars, blockquote, .qbox, .ilju, .du-sum { break-inside: avoid; }
  .du.now { outline: 0; }
}
@media (max-width: 600px) {
  .book > section { padding: 10mm 6mm 12mm; }
  .book { font-size: 10pt; }
  .cv-ilju { font-size: 48px; }
}
/* 대운·년운 둘째 쪽은 한 쪽에 들어가도록 조금 촘촘하게 */
.du2, .yr2 { font-size: 9.8pt; line-height: 1.66; }
.du2 h4, .yr2 h4 { margin: .8em 0 .25em; }
.du2 .tips, .yr2 .tips { margin-bottom: .2em; }
/* 요약 쪽 · 기록장 */
.sum th { width: 26%; }
.sum td { font-size: 9.6pt; }
.lines { margin: .2em 0 .9em; }
.lines i { display: block; height: 7mm; border-bottom: 1px solid #cfc2aa; }
.journal h4 { margin-top: .8em; }
.jtbl td { height: 11.5mm; }
/* 고전 구절 + 사주로 읽기 */
.cl { margin: .9em 0; padding: 8px 12px 9px; border-left: 3px solid #7a5a2e; background: rgba(255, 251, 240, .5); break-inside: avoid; }
.cl-o { font-family: 'Noto Sans KR', var(--f-body); font-size: 11.5pt; font-weight: 700; letter-spacing: .08em; color: #3d2f20; margin: 0 0 .15em !important; }
.cl-t { margin: 0 !important; font-weight: 600; }
.cl-t cite { font-style: normal; font-weight: 400; font-size: 8.8pt; color: var(--muted); }
.cl-a { margin: .45em 0 0 !important; font-size: 9.8pt; }
.cl-a b { display: inline-block; margin-right: .5em; padding: 0 6px; border-radius: 4px; background: rgba(122, 90, 46, .14); color: #5a3f1b; font-size: 8.6pt; }
.du3 .cl, .yr3 .cl { margin: .6em 0; }
.du3, .yr3 { font-size: 9.8pt; line-height: 1.66; }
.du3 h4, .yr3 h4 { margin: .7em 0 .2em; }
.du3 .cl-o, .yr3 .cl-o { font-size: 10.5pt; }

/* ───── 나만의 사주 가이드북 구성 (INTRO · CHAPTER 01~06 · OUTRO) ───── */
.part .ch-no { letter-spacing: .22em; }
.ch-tag { font: 700 11pt/1.4 var(--f-head); color: var(--seal); margin-top: 4mm; letter-spacing: .08em; }
.book h3.sec { font-size: 14pt; border-bottom: 0; margin: 1.6em 0 .2em; padding: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.book section > h3.sec:first-child { margin-top: 0; }
.sec-n { font: 800 9pt/1 var(--f-head); color: #fff; background: var(--brand); border-radius: 4px; padding: 4px 7px; letter-spacing: .04em; white-space: nowrap; }
.sec-sub { color: var(--muted); font-size: 9.6pt; margin: 0 0 .6em !important; padding-bottom: 5px; border-bottom: 1.5px solid var(--ink); }
.book h4.qa { font-size: 11.2pt; color: var(--brand); margin: .9em 0 .5em; }
.book h4.qa span { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%; background: var(--brand); color: #fff; font-size: 8.5pt; margin-right: 4px; vertical-align: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: .2em 0 .4em; }
.chips span { font-size: 8.8pt; font-weight: 700; color: #4b3a8f; background: rgba(214, 200, 245, .5); border-radius: 999px; padding: 1px 9px; }
.muted { color: var(--muted); }
.tbl.vs td { text-align: left; vertical-align: top; width: 50%; font-size: 9.6pt; line-height: 1.6; }
.tbl.vs th small, .tbl.guide th small { display: block; font-weight: 400; }
.tbl.guide th { width: 18%; white-space: nowrap; }
.tbl.report th { width: 30%; white-space: nowrap; }
.tbl.turn td:last-child { width: 30%; }

.tcl { margin-top: 1.2em; padding-top: .4em; border-top: 1px dashed var(--line); }
/* 그래프 */
.chart { margin: .6em 0 .9em; break-inside: avoid; }
.chart svg { width: 100%; max-width: 142mm; height: auto; display: block; margin: 0 auto; }
.chart figcaption { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: center; font-size: 8.8pt; color: var(--muted); margin-top: 2px; }
.chart .cg { stroke: rgba(150, 128, 92, .35); stroke-width: .8; } .chart .cg.mid { stroke: rgba(120, 98, 62, .6); stroke-dasharray: 4 3; }
.chart .cy { font-size: 9px; fill: #7a6a55; text-anchor: end; }
.chart .cx { font-size: 10px; fill: #3d2f20; text-anchor: middle; font-weight: 700; }
.chart .cx2 { font-size: 9px; fill: #6b5d4c; text-anchor: middle; }
.chart .chl { fill: rgba(163, 55, 43, .1); stroke: rgba(163, 55, 43, .45); stroke-width: 1; }
.chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ln-all { stroke: #5b3fc4; stroke-width: 3 !important; } .pt-all { fill: #5b3fc4; }
.ln-wealth { stroke: #9a6b00; } .pt-wealth { fill: #9a6b00; }
.ln-love { stroke: #c0392b; } .pt-love { fill: #c0392b; }
.ln-work { stroke: #1f5fa8; } .pt-work { fill: #1f5fa8; }
.ln-health { stroke: #2e7d32; } .pt-health { fill: #2e7d32; }
.lg::before { content: ''; display: inline-block; width: 16px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; background: currentColor; }
.lg-all { color: #5b3fc4; } .lg-wealth { color: #9a6b00; } .lg-love { color: #c0392b; } .lg-work { color: #1f5fa8; } .lg-health { color: #2e7d32; }
.lg-sg { color: #3f68b8; } .lg-gk { color: #c24b40; }
.chart .br { fill: #bca8ee; } .chart .br.lv4, .chart .br.lv5 { fill: #7f63d6; } .chart .br.lv1, .chart .br.lv2 { fill: #d9cfee; } .chart .br.on { stroke: var(--seal); stroke-width: 2; }
.chart .bv { font-size: 10px; font-weight: 700; fill: #3d2f20; text-anchor: middle; }
/* 오행 오각형 */
.chart.oh svg { max-width: 400px; margin: 0 auto; }
.chart.oh .sg { stroke: #3f68b8; stroke-width: 2.6; }
.chart.oh .gk { stroke: #c24b40; stroke-width: 1.6; opacity: .85; }
.chart.oh .oc { stroke-width: 2.6; } .chart.oh .oc.zero { stroke-dasharray: 5 4; }
.chart.oh .o0 { fill: #e2efdf; stroke: var(--e0); } .chart.oh .o1 { fill: #f8e1db; stroke: var(--e1); } .chart.oh .o2 { fill: #f3e9cc; stroke: var(--e2); } .chart.oh .o3 { fill: #e7e8ea; stroke: var(--e3); } .chart.oh .o4 { fill: #dfe7f3; stroke: var(--e4); }
.chart.oh .me { fill: none; stroke: var(--brand); stroke-width: 2.6; }
.chart.oh .t1 { font: 700 17px var(--f-head); fill: #221a12; text-anchor: middle; }
.chart.oh .t2 { font: 500 12.5px var(--f-body); fill: #221a12; text-anchor: middle; }
.chart.oh .t3 { font: 700 11px var(--f-body); fill: var(--brand); text-anchor: middle; }
/* 지금의 계절 · 행운 카드 · 편지 */
.season-now { display: grid; grid-template-columns: 3em 1fr; gap: 8px; align-items: center; padding: 8px 12px; border: 1.5px solid var(--seal); border-radius: 10px; background: rgba(255, 250, 240, .6); margin: .6em 0; break-inside: avoid; }
.season-now > span { font-size: 26pt; text-align: center; }
.season-now p { margin: .2em 0 0 !important; font-size: 9.8pt; }
.luck-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: .8em 0; break-inside: avoid; }
.luck { border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; background: rgba(255, 252, 243, .6); }
.luck-h { font: 700 11pt/1.4 var(--f-head); margin-bottom: 4px; }
.luck dl { display: grid; grid-template-columns: 3em 1fr; gap: 2px 6px; margin: 0; font-size: 9.4pt; }
.luck dt { font-weight: 700; color: var(--muted); } .luck dd { margin: 0; }
.luck.o0 { border-color: var(--e0); } .luck.o1 { border-color: var(--e1); } .luck.o2 { border-color: var(--e2); } .luck.o3 { border-color: var(--e3); } .luck.o4 { border-color: var(--e4); }
.oneline { margin: 1.2em 0; padding: 10px 14px; border-left: 4px solid var(--brand); background: rgba(214, 200, 245, .3); break-inside: avoid; }
.oneline span { font-size: 8.8pt; font-weight: 700; color: var(--brand); letter-spacing: .1em; }
.oneline p { margin: .2em 0 0 !important; font: 700 12pt/1.6 var(--f-head); }
/* 차례 */
.toc-pg { font-size: 9.6pt; line-height: 1.5; }
.toc-part { margin-bottom: 7px; break-inside: avoid; }
.toc-h { font: 700 10.2pt/1.4 var(--f-head); border-bottom: 1px solid var(--line); padding-bottom: 2px; margin-bottom: 2px; }
.toc-h .toc-n { width: auto; margin-right: 4px; font-size: 8.8pt; }
.toc-pg .toc { list-style: decimal; padding-left: 2.2em; }
.toc-pg .toc li { padding: 0; border: 0; font-size: 9.2pt; }
.fh small { font-size: .6em; color: var(--muted); font-weight: 500; }
.howto-pg { font-size: 10pt; line-height: 1.7; }
.howto-pg .howto dt { margin-top: .55em; }
.tbl.turn td { height: 6.4mm; padding: 1px 4px; }

/* ───── 쪽 나눔(js paginate): 화면도 인쇄도 A4 한 쪽씩, 머리글·쪽 번호는 쪽 안에 직접 ───── */
.book.paged { width: 210mm; max-width: none; margin: 8px auto 40px; background: none; box-shadow: none; font-size: 11.2pt; }
.book.paged > section { position: relative; box-sizing: border-box; height: 297mm; overflow: hidden; padding: 21mm 22mm 22mm; margin: 0 0 8mm; border: 0;
  background: #f4ecda var(--hanji, none) repeat; background-size: 384px 384px; box-shadow: 0 6px 24px rgba(60, 40, 10, .18); }
.book.paged > .cover { padding: 0 17mm; min-height: 0; }
.book.paged > .ch-title { min-height: 0; }
.book.paged > section.cont > :first-child { margin-top: 0; }
.pg-head { position: absolute; top: 10mm; right: 22mm; font-size: 9pt; color: #a09078; }
.pg-num { position: absolute; bottom: 10mm; left: 0; right: 0; text-align: center; font-size: 9pt; color: #8a7a66; font-variant-numeric: tabular-nums; }
/* 차례의 쪽 번호 */
.toc-h, .toc li, .toc-end { display: flex; align-items: baseline; gap: 6px; }
.toc-t { flex: 1 1 auto; min-width: 0; }
.toc-p { flex: none; min-width: 2em; text-align: right; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.toc-pg .toc li { display: list-item; }
.toc-pg .toc li .toc-t { display: inline; }
.toc-pg .toc li { position: relative; padding-right: 2.4em !important; }
.toc-pg .toc li .toc-p { position: absolute; right: 0; top: 0; }
@media print {
  .book.paged { zoom: 1 !important; width: auto; margin: 0; }
  .book.paged > section { margin: 0; box-shadow: none; background: transparent; height: 296.5mm; break-before: auto !important; break-after: page; break-inside: avoid; }
  .book.paged > section:last-child { break-after: auto; }
}
@media (max-width: 600px) {
  .book.paged > section { padding: 21mm 22mm 22mm; }
  .book.paged > .cover { padding: 0 17mm; }
  .book.paged { font-size: 11.2pt; }
  .book.paged .cv-ilju { font-size: 90px; }
}

/* 화면 모드(낮/밤) 버튼 — js/theme.js */
.head-actions { display: flex; align-items: center; gap: 10px; }
.theme-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; border: 1.5px solid var(--line); background: var(--paper, var(--surface)); font-size: 20px; line-height: 1; cursor: pointer; }
.theme-btn:hover { border-color: var(--brand, var(--accent)); }
.theme-btn:focus-visible { outline: 3px solid var(--brand, var(--accent)); outline-offset: 2px; }

/* 입력칸이 배경과 뚜렷이 구분되도록 (테두리 대비 3:1 이상 · 카드와 다른 바탕) */
:root { --field-border: #8f7b58; --field-bg: #fffdf8; --field-ph: #7a6d58; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --field-border: #9c8b6f; --field-bg: #17120c; --field-ph: #a89a82; } }
:root[data-theme="dark"] { --field-border: #9c8b6f; --field-bg: #17120c; --field-ph: #a89a82; }
.bk-card select { border: 1.5px solid var(--field-border) !important; background-color: var(--field-bg) !important; color: var(--ink); }
.bk-card select::placeholder { color: var(--field-ph); opacity: 1; }

/* 점수 막대 (★ 대신) */
.book .sbar { display: inline-flex; align-items: center; width: 28mm; height: 4.6mm; border-radius: 99px; overflow: hidden; vertical-align: middle; background: #efe4cf; box-shadow: inset 0 0 0 .6px rgba(90, 70, 40, .35); }
.book .sbar i { display: flex; align-items: center; justify-content: flex-end; height: 100%; padding: 0 1.6mm; border-radius: 99px; box-sizing: border-box; min-width: 9mm; }
.book .sbar b { font: 800 8pt/1 var(--f-body); }
.book .sbar.b1 i { background: #3f6fd0; color: #fff; } .book .sbar.b2 i { background: #a9c4f2; color: #10264d; } .book .sbar.b3 i { background: #d9b43a; color: #2a2108; } .book .sbar.b4 i { background: #f4a27a; color: #4a1a08; } .book .sbar.b5 i { background: #cc2f2f; color: #fff; }
.book .du-score .sbar { width: 32mm; height: 6mm; } .book .du-score .sbar b { font-size: 10pt; }
.book .mtbl .sbar { width: 20mm; height: 3.8mm; } .book .mtbl .sbar b { font-size: 7pt; }
.book h4 .sbar { width: 24mm; margin-left: 4px; }

/* ───── 책에 넣을 장 고르기(화면) ───── */
.bk-opts { margin: 12px 0 4px; border: 1px solid var(--line, #d8c9a8); border-radius: 12px; padding: 10px 12px; }
.bk-opts summary { cursor: pointer; }
.bk-note-in { font-size: 13px; opacity: .8; }
.bk-opt-fixed { font-size: 13px; opacity: .85; margin: 8px 0; }
.bk-opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 14px; }
.bk-opt-grid label { display: flex; flex-wrap: wrap; column-gap: 6px; align-items: flex-start; line-height: 1.4; }
.bk-opt-grid label small { display: block; flex: 1 0 100%; padding-left: 24px; font-size: 12px; opacity: .75; }
.bk-opt-grid label.new { font-weight: 600; }
.bk-opt-grid input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.bk-opt-sub { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 10px 0 0; font-size: 14px; }
.bk-opt-sub select { font: inherit; padding: 2px 4px; }
.bk-opt-btns { margin: 10px 0 0; }

/* ───── 추가 장(book-plus.js) ───── */
.book .phase-card { border: .3mm solid #c8b58a; border-radius: 2mm; padding: 2mm 3mm; margin: 0 0 2.5mm; break-inside: avoid; }
.book .phase-card.now { border-color: #b3261e; background: rgba(179, 38, 30, .05); }
.book .phase-card h4 { margin: 0 0 1mm; }
.book .phase-card p { margin: 0 0 1mm; }
.book ul.chk { list-style: none; padding-left: 1mm; }
.book ul.chk li { margin: .8mm 0; }
.book ul.pv { padding-left: 4mm; font-size: 9.6pt; }
.book ul.pv li { margin: .8mm 0; }
.book .pv-c { display: inline-block; font-size: 8pt; border: .25mm solid #c8b58a; border-radius: 3mm; padding: 0 1.6mm; margin-right: 1mm; color: #5b4a33; }
.book .sw { display: inline-block; width: 3.2mm; height: 3.2mm; border-radius: 50%; border: .25mm solid #8f7b58; vertical-align: -.5mm; margin: 0 .8mm 0 .6mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.book .looks { display: flex; gap: 3mm; justify-content: center; margin: 2mm 0 3mm; break-inside: avoid; }
.book .looks figure { margin: 0; text-align: center; font-size: 8.5pt; }
.book .looks .fig svg { width: 34mm; height: auto; display: block; }
.book .amu { display: grid; grid-template-columns: 24mm 1fr; gap: 3mm; align-items: start; margin: 0 0 3mm; break-inside: avoid; }
.book .amu-svg svg { width: 24mm; height: 24mm; display: block; }
.book .amu p { margin: .6mm 0; }
.book .zds { display: flex; flex-wrap: wrap; gap: 2.5mm; margin: 1mm 0 3mm; }
.book .zd { width: 30mm; border: .3mm solid #d9b43a; border-radius: 2mm; padding: 1.5mm; text-align: center; font-size: 8.5pt; break-inside: avoid; }
.book .zd.bad { border-style: dashed; border-color: #8f7b58; }
.book .zd-svg svg { width: 16mm; height: 16mm; display: block; margin: 0 auto; }
.book .zd small { display: block; color: #5b4a33; }
.book .age-guide { border-left: 1mm solid #c8b58a; padding: .5mm 0 .5mm 3mm; margin: 0 0 3mm; break-inside: avoid; }
.book .age-guide.now { border-left-color: #b3261e; }
.book .age-guide h4 { margin: 0 0 1mm; }
.book .rx { border: .3mm solid #c8b58a; border-radius: 2mm; padding: 2.5mm 3mm; margin: 0 0 4mm; }
.book .rx h4 { margin: 0 0 1.5mm; color: #7a2e14; }
.book table.life td:last-child { width: 26%; }
.book table.life td, .book table.life th { padding: .8mm 1mm; font-size: 8.8pt; }
.book .yrchk h4 { margin: 3mm 0 1mm; }

/* ───── 종이 고르기: 다크 에디션(딥 네이비 · 금박) — book.js 가 .book.dk + html.bk-dark ─────
 * 전통 한지(기본)의 색을 토큰과 덮어쓰기로 바꾼다. 제목은 명조(Noto Serif KR), 본문은 그대로 고딕.
 * 인쇄: 여백 0 규칙은 같고, html 배경만 한지 대신 네이비로(print-color-adjust: exact 라 「배경 그래픽」을 꺼도 찍힘). */
.book .cv-sky, .book .cv-ed { display: none; }
.book.dk { --ink: #F1F5F9; --muted: #94A3B8; --line: rgba(212, 175, 55, .32); --paper: #1E293B; --soft: #1E293B; --bg: #0F172A;
  --brand: #EAB308; --brand-soft: rgba(234, 179, 8, .14); --seal: #F59E0B;
  --e0: #7ed48a; --e1: #f59b8c; --e2: #e8c766; --e3: #cbd5e1; --e4: #8cbaf2;
  --f-head: 'Noto Serif KR', 'Nanum Myeongjo', serif; color-scheme: dark; background: #0F172A; box-shadow: 0 6px 30px rgba(0, 0, 0, .45); }
.book.dk.paged { background: none; }
.book.dk.paged > section { background: #0F172A; box-shadow: 0 6px 24px rgba(0, 0, 0, .45); }
.book.dk h3, .book.dk .du-t, .book.dk .sec-sub { border-bottom-color: rgba(212, 175, 55, .55) !important; }
.book.dk h4 { color: #EAD9A6; }
.book.dk .pg-head, .book.dk .pg-num { color: #94A3B8; }
/* 표지 */
.book.dk .cover { outline-color: #D4AF37; }
.book.dk .cover::after { border-color: rgba(212, 175, 55, .45); }
.book.dk .cover > * { position: relative; z-index: 1; }
.book.dk .cover > .cv-sky { display: block; position: absolute; z-index: 0; left: 50%; top: 50%; width: 172mm; height: 172mm; transform: translate(-50%, -54%); opacity: .3; pointer-events: none; }
.book.dk .cv-ed { display: block; font: 600 12pt/1 'Cormorant Garamond', 'Noto Serif KR', serif; letter-spacing: .38em; color: #C9A46A; padding-left: .38em; }
.book.dk .cv-top { color: #D4AF37; }
.book.dk .cv-ilju { color: #D4AF37; }
.book.dk .cover h1 { color: #F8FAFC; }
.book.dk .cv-info { color: #CBD5E1; }
/* 상자·표·막대 */
.book.dk .note, .book.dk .tip { background: rgba(212, 175, 55, .08); color: #CBD5E1; }
.book.dk .qbox, .book.dk .cl, .book.dk .season-now, .book.dk .luck { background: rgba(255, 255, 255, .03); }
.book.dk .oneline { background: rgba(234, 179, 8, .08); }
.book.dk .tbl thead th, .book.dk .tbl tbody th { background: rgba(212, 175, 55, .12); }
.book.dk .tbl th small, .book.dk .zd small { color: #94A3B8; }
.book.dk .tbl tr.hl td { background: rgba(234, 179, 8, .14); }
.book.dk .bar-t { background: #334155; }
.book.dk .stars { color: #EAB308; }
.book.dk .badge, .book.dk .sec-n, .book.dk h4.qa span { color: #0F172A; }
.book.dk .chips span { color: #FDE68A; background: rgba(234, 179, 8, .15); }
.book.dk .cl { border-left-color: #D4AF37; }
.book.dk .cl-o { color: #EAD9A6; }
.book.dk .cl-a b { background: rgba(212, 175, 55, .16); color: #FDE68A; }
.book.dk .lines i { border-bottom-color: rgba(148, 163, 184, .45); }
.book.dk .sbar { background: #334155; box-shadow: inset 0 0 0 .6px rgba(148, 163, 184, .4); }
/* 그래프 */
.book.dk .chart .cg { stroke: rgba(148, 163, 184, .3); } .book.dk .chart .cg.mid { stroke: rgba(212, 175, 55, .5); }
.book.dk .chart .cy, .book.dk .chart .cx2 { fill: #94A3B8; } .book.dk .chart .cx, .book.dk .chart .bv { fill: #E2E8F0; }
.book.dk .chart .chl { fill: rgba(245, 158, 11, .1); stroke: rgba(245, 158, 11, .45); }
.book.dk .ln-all { stroke: #EAB308; } .book.dk .pt-all { fill: #EAB308; } .book.dk .lg-all { color: #EAB308; }
.book.dk .ln-wealth { stroke: #fb923c; } .book.dk .pt-wealth { fill: #fb923c; } .book.dk .lg-wealth { color: #fb923c; }
.book.dk .ln-love { stroke: #f87171; } .book.dk .pt-love { fill: #f87171; } .book.dk .lg-love { color: #f87171; }
.book.dk .ln-work { stroke: #60a5fa; } .book.dk .pt-work { fill: #60a5fa; } .book.dk .lg-work { color: #60a5fa; }
.book.dk .ln-health { stroke: #4ade80; } .book.dk .pt-health { fill: #4ade80; } .book.dk .lg-health { color: #4ade80; }
.book.dk .lg-sg { color: #8cbaf2; } .book.dk .lg-gk { color: #f59b8c; }
.book.dk .chart .br { fill: #475569; } .book.dk .chart .br.lv4, .book.dk .chart .br.lv5 { fill: #EAB308; } .book.dk .chart .br.lv1, .book.dk .chart .br.lv2 { fill: #334155; }
.book.dk .chart.oh .sg { stroke: #8cbaf2; } .book.dk .chart.oh .gk { stroke: #f59b8c; }
.book.dk .chart.oh .o0 { fill: #16382a; } .book.dk .chart.oh .o1 { fill: #47201b; } .book.dk .chart.oh .o2 { fill: #433712; } .book.dk .chart.oh .o3 { fill: #2b3340; } .book.dk .chart.oh .o4 { fill: #172e50; }
.book.dk .chart.oh .t1, .book.dk .chart.oh .t2 { fill: #F1F5F9; }
/* 추가 장 */
.book.dk .phase-card, .book.dk .rx, .book.dk .pv-c { border-color: rgba(212, 175, 55, .45); }
.book.dk .phase-card.now { border-color: #F59E0B; background: rgba(245, 158, 11, .08); }
.book.dk .pv-c { color: #CBD5E1; }
.book.dk .age-guide { border-left-color: rgba(212, 175, 55, .55); } .book.dk .age-guide.now { border-left-color: #F59E0B; }
.book.dk .rx h4 { color: #F59E0B; }
.book.dk .zd.bad { border-color: #94A3B8; }
@media print {
  html.bk-dark { background: #0F172A !important; }
  html.bk-dark .book.dk.paged > section { background: transparent; }
}
/* 종이 고르기(화면) */
.bk-paper { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 4px 0 10px; padding: 0; border: 0; }
.bk-paper legend { font-weight: 700; margin-bottom: 4px; padding: 0; }
.bk-paper label { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }
.bk-paper input { width: 18px; height: 18px; }

/* ───── A4 판형 보정 ─────
 * 한 쪽(A5) 분량으로 짠 구역은 A4 에서 반쪽만 차므로 paginate 가 이어 담는다: 대운(du → du2 → du3) · 년운(yr → yr2 → yr3)은 글을 이어 흘려 두 쪽에.
 * 이어 담긴 묶음의 머리(.du-h)는 점선으로 구분한다. 새해 점검표(yrchk)는 줄을 늘리고 넓혀 한 해가 A4 한 쪽을 채우는 적는 종이로. */
.book.paged > section > .du-h:not(:first-child) { margin-top: 1.5em; padding-top: .9em; border-top: 1px dashed var(--line); }
.book .yrchk .lines i { height: 11mm; }
.book .yrchk h4 { margin: 5mm 0 1mm; }
.du-h { font-size: 10pt; }
.lines i { height: 7.6mm; }
.jtbl td { height: 15mm; }
/* 맞춤 부적(js/talisman.js) — 09 · 2 의 맨 앞 */
.book .amu.tl { grid-template-columns: 40mm 1fr; gap: 6mm; padding: 3mm; border: .4mm solid #c89b20; border-radius: 2.5mm; }
.book .amu.tl .amu-svg svg { width: 40mm; height: auto; border-radius: 1mm; }
.book .amu.tl h4 { margin: 0 0 1mm; }
/* 대운 · 년운 묶음은 두 쪽에 담기도록 조금 촘촘하게(이어 담으면 du2·du3 의 촘촘한 서식이 풀리므로 쪽 전체에 준다) */
.book.paged > section.du, .book.paged > section.yr { font-size: 10.5pt; line-height: 1.7; }
.book.paged > section.du h4, .book.paged > section.yr h4 { margin: .8em 0 .25em; }
.book.paged > section.du .cl, .book.paged > section.yr .cl { margin: .6em 0; }

/* 신년운수 장: 월별 상세 · 5년 흐름 그래프(세운 실선 · 대운 점선) */
.book .nym { break-inside: avoid; border-top: 1px dotted var(--line); padding-top: 1mm; }
.book .nym h4 { margin: .6em 0 .2em; } .book .nym .tips { margin: .2em 0 .3em; } .book .nym .chips { display: inline-flex; margin: 0; }
.ln-se { stroke: #5b3fc4; stroke-width: 3 !important; } .pt-se { fill: #5b3fc4; } .lg-se { color: #5b3fc4; }
.ln-du { stroke: #a3372b; stroke-dasharray: 6 4; } .pt-du { fill: #a3372b; } .lg-du { color: #a3372b; }
.book.dk .ln-se { stroke: #EAB308; } .book.dk .pt-se { fill: #EAB308; } .book.dk .lg-se { color: #EAB308; }
.book.dk .ln-du { stroke: #f59b8c; } .book.dk .pt-du { fill: #f59b8c; } .book.dk .lg-du { color: #f59b8c; }

/* c11 고전으로 읽는 내 사주 */
.cm-bk .cm-bsrc { margin: 0 0 .3em !important; font-size: 9.4pt; font-weight: 700; color: #5a3f1b; }
.cm-bk .cm-bsrc small { font-weight: 400; color: var(--muted); }
.cm-bk.risk { border-left-color: #a8170f; }
.cm-bk .cap { margin: .45em 0 0 !important; }
.book.dk .cm-bk .cm-bsrc { color: #EAD9A6; }
.book.dk .cm-bk.risk { border-left-color: #F59E0B; }
