/* ============================================================
   살풀이 : 천기 — PDF 리포트 (오프스크린 렌더 스테이지)
   실제 .pdf 파일을 만들기 위해 8쪽을 A4(96dpi 794×1123) 크기로
   인쇄용 밝은 테마로 다시 그립니다. 화면(DOM)에는 보이지 않습니다.
   ============================================================ */

.pdf-stage {
  position: fixed;
  left: -20000px;
  top: 0;
  width: 794px;
  z-index: -1;
  pointer-events: none;
  background: #ffffff;
  /* 앱의 다크 테마 변수 영향을 끊는다 */
  --gold: #8a6a24;
  --gold-2: #6f5316;
  --muted: #5b5345;
  --text: #14100a;
  --serif: 'Noto Serif KR', 'Gowun Batang', serif;
  --sans: 'Noto Sans KR', system-ui, -apple-system, sans-serif;
  /* 웹 화면의 '가 / 가 / 가' 선택이 PDF 글자 크기에도 반영된다 */
  --pdf-fs: 1;
}
.pdf-stage.fs-lg { --pdf-fs: 1.07; }
.pdf-stage.fs-xl { --pdf-fs: 1.15; }

.pdf-sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  width: 794px;
  min-height: 1123px;
  padding: 62px 58px 82px;
  background: #ffffff;
  color: #14100a;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.9;
  letter-spacing: -0.005em;
  box-sizing: border-box;
  overflow: hidden;
}
.pdf-sheet + .pdf-sheet { margin-top: 24px; }

/* ------------------------------------------------------------
   표지
   ------------------------------------------------------------ */
.pdf-sheet.pdf-cover { padding-top: 74px; text-align: center; justify-content: center; }
.pdf-sheet.pdf-cover .report-brand { color: #7a5c1e; }
.pdf-sheet.pdf-cover .report-brand span { color: #9a7c33; opacity: .8; }
.pdf-sheet.pdf-cover .report-brand-sub { color: #9a7c33; opacity: .85; }
.pdf-sheet.pdf-cover .report-seal { border-color: #9a7c33; color: #7a5c1e; box-shadow: none; }
.pdf-sheet.pdf-cover .report-title { color: #14100b; }
.pdf-sheet.pdf-cover .report-meta { color: #6f6553; }

/* ------------------------------------------------------------
   공통 문서 요소
   ------------------------------------------------------------ */
.pdf-sheet .report-head {
  text-align: center;
  padding: 0;
  margin: 0;
  border-bottom: 0;
}
.pdf-sheet .report-brand {
  font-family: var(--serif);
  font-size: calc(26px * var(--pdf-fs));
  color: #7a5c1e;
  letter-spacing: .2em;
  text-indent: .2em;
  line-height: 1.4;
}
.pdf-sheet .report-brand span { color: #9a7c33; opacity: .7; margin: 0 .3em; }
.pdf-sheet .report-brand-sub {
  font-size: calc(11.5px * var(--pdf-fs));
  letter-spacing: .4em;
  text-indent: .4em;
  color: #8a6a24;
  opacity: .9;
  margin: 10px 0 22px;
}
.pdf-sheet .report-seal {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid #b79b5e;
  color: #6f5316;
  font-size: 27px;
  box-shadow: none;
}
.pdf-sheet .report-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: calc(32px * var(--pdf-fs));
  color: #0f0c06;
  letter-spacing: .02em;
  margin-bottom: 14px;
}
.pdf-sheet .report-meta {
  font-size: calc(14px * var(--pdf-fs));
  color: #4f4739;
  letter-spacing: .04em;
  margin: 0;
}
.pdf-sheet .report-pillars { display: flex; justify-content: center; gap: 12px; margin: 28px 0 26px; }
.pdf-sheet .report-pillars .rp {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 64px; padding: 10px 8px 8px;
  border-radius: 8px;
  border: 1px solid #c8bba0;
  background: #faf7f0;
}
.pdf-sheet .report-pillars .rp b { font-size: calc(10.5px * var(--pdf-fs)); color: #6d6350; font-weight: 400; letter-spacing: .1em; }
.pdf-sheet .report-pillars .rp i {
  font-style: normal; font-family: var(--serif);
  font-size: calc(23px * var(--pdf-fs)); line-height: 1.25; color: #1f1910;
}
.pdf-sheet .report-pillars .rp .g { color: #7a5c1e; }
.pdf-sheet .report-pillars .rp.empty i { color: #b9b0a0; }

.pdf-sheet .rep-page { position: relative; }
.pdf-sheet .rep-page-tag {
  display: block;
  font-size: calc(12px * var(--pdf-fs));
  letter-spacing: .18em;
  color: #8a6a24;
  margin-bottom: 9px;
}
/* 다른 장이 끝난 같은 쪽에서 새 장이 시작될 때 — 경계를 보이게 */
.pdf-sheet .rep-page-tag.chap-new {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e0d6c0;
}
/* 이어지는 쪽 — 같은 장이 다음 쪽으로 넘어간다는 표시 */
.pdf-sheet .rep-cont {
  display: block;
  font-size: calc(11.5px * var(--pdf-fs));
  letter-spacing: .16em;
  color: #8a6a24;
  padding-bottom: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid #e0d6c0;
}
.pdf-sheet .rep-page-lead {
  font-size: calc(15.5px * var(--pdf-fs));
  line-height: 1.75;
  color: #463e2e;
  margin-bottom: 16px;
  padding-left: 14px;
  border-left: 3px solid #d9cdb4;
}
.pdf-sheet h3 {
  font-family: var(--serif);
  font-size: calc(25px * var(--pdf-fs));
  font-weight: 700;
  color: #14100a;
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #cfc2a6;
  letter-spacing: .005em;
  word-break: keep-all;
}
.pdf-sheet p {
  font-size: calc(18px * var(--pdf-fs));
  line-height: 1.9;
  color: #1a150e;
  margin: 0 0 16px;
  word-break: keep-all;
  orphans: 2;
  widows: 2;
}
.pdf-sheet p strong, .pdf-sheet strong {
  color: #5b3a06;
  font-weight: 700;
}
.pdf-sheet p strong strong, .pdf-sheet strong strong { color: #5b3a06; }

.pdf-sheet .rep-quote {
  margin: 28px 0 6px;
  padding: 17px 20px;
  border: 1px solid #d9cdb4;
  border-left: 3px solid #b79b5e;
  border-radius: 6px;
  background: #faf7f0;
  font-family: var(--serif);
  font-size: calc(17.5px * var(--pdf-fs));
  line-height: 1.85;
  color: #1c1710;
  text-align: left;
}
.pdf-sheet .rep-quote small {
  display: block;
  font-family: var(--sans);
  font-size: calc(11.5px * var(--pdf-fs));
  color: #8a6a24;
  letter-spacing: .12em;
  margin-bottom: 9px;
}
.pdf-sheet .rep-quote .rep-sign {
  margin: 14px 0 0;
  font-family: var(--serif);
  font-size: calc(15px * var(--pdf-fs));
  line-height: 1.7;
  color: #6f5316;
  text-align: right;
  letter-spacing: .01em;
}
/* 서버가 넣은 옅은 회색 캡션(한 문장 설명) — 인쇄에서도 읽히게 진하게 */
.pdf-sheet .rep-quote span[style] {
  color: #4a4234 !important;
  font-size: calc(13.5px * var(--pdf-fs)) !important;
  line-height: 1.7;
}
.pdf-sheet .rep-cover-note {
  font-size: calc(14.5px * var(--pdf-fs));
  line-height: 1.85;
  color: #4b4335;
  margin-top: 28px;
  text-align: center;
}

/* 표지 액자 */
.pdf-sheet.pdf-cover::before {
  content: '';
  position: absolute;
  inset: 24px;
  border: 1px solid #ddd0b1;
  border-radius: 2px;
  pointer-events: none;
}
.pdf-sheet.pdf-cover::after {
  content: '';
  position: absolute;
  inset: 31px;
  border: 1px solid #f0e8d6;
  border-radius: 1px;
  pointer-events: none;
}

/* 장 끝 표식 — 남는 여백이 '책의 장 끝'으로 읽히게 */
.pdf-sheet:not(.pdf-cover) .rep-page::after {
  content: '';
  display: block;
  width: 34px;
  height: 1px;
  margin: 22px auto 0;
  background: #cbbd9b;
}

/* 표 */
.pdf-sheet .m-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 16px;
  font-size: calc(13px * var(--pdf-fs));
  line-height: 1.55;
}
.pdf-sheet .m-table th {
  text-align: left;
  font-weight: 700;
  color: #5f5240;
  font-size: calc(12px * var(--pdf-fs));
  padding: 8px 6px;
  border-bottom: 1px solid #c8bba0;
  letter-spacing: .02em;
  background: #f7f2e7;
}
.pdf-sheet .m-table td {
  padding: 7px 6px;
  border-bottom: 1px solid #e4dbca;
  color: #1c1710;
  vertical-align: top;
  word-break: keep-all;
}
.pdf-sheet .m-table tr.cur td { background: #f4edde; color: #14100b; font-weight: 600; }
.pdf-sheet .m-table tr.row-good td { background: #f3f8f2; }

.pdf-sheet .tag {
  display: inline-block;
  font-size: calc(11px * var(--pdf-fs));
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid #c9bda6;
  color: #3d352a;
  background: #f6f2e9;
  white-space: nowrap;
}
.pdf-sheet .tag.good { border-color: #a9c9b4; color: #276749; background: #eef6f0; }
.pdf-sheet .tag.mid { border-color: #cfc3aa; color: #5d5346; background: #f6f2e9; }
.pdf-sheet .tag.bad { border-color: #dcb3ae; color: #9b3a32; background: #fbefed; }

/* 페이지 하단 각주 */
.pdf-foot {
  position: absolute;
  left: 58px; right: 58px; bottom: 34px;
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: .12em;
  color: #8c8266;
  border-top: 1px solid #e4dbca;
  padding-top: 9px;
}
.pdf-foot .pdf-foot-brand { font-family: var(--serif); letter-spacing: .18em; color: #8a6a24; }
.pdf-foot .pdf-foot-num { letter-spacing: .08em; }

/* 인쇄로 저장(보조 수단)에서도 이 스테이지는 출력되지 않게 */
@media print {
  .pdf-stage { display: none !important; }
}

/* ============================================================
   PDF 저장 진행/안내 오버레이
   ============================================================ */
.pdf-ui {
  position: fixed; inset: 0; z-index: 9600;
  display: none; align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(3, 2, 6, .8);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.pdf-ui.show { display: flex; }
@keyframes pdfUiIn { from { transform: translateY(14px) scale(.985); opacity: .4; } }
.pdf-ui-card {
  position: relative;
  width: 100%; max-width: 420px; max-height: 88vh; overflow-y: auto;
  padding: 24px 18px 16px;
  border-radius: 22px;
  border: 1px solid rgba(217, 185, 120, .35);
  background: linear-gradient(180deg, #1a1224 0%, #120d1a 46%, #09060e 100%);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .72), inset 0 1px 0 rgba(246, 227, 173, .1);
  animation: pdfUiIn .22s ease both;
  color: #ece6da;
  font-family: 'Noto Sans KR', system-ui, -apple-system, sans-serif;
}
.pdf-ui-x {
  position: absolute; top: 8px; right: 8px;
  width: 34px; height: 34px; padding: 0;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: transparent; color: #b7aa96;
  font-size: 15px; line-height: 1; cursor: pointer;
  transition: .16s ease;
}
.pdf-ui-x:hover { background: rgba(255, 255, 255, .08); color: #f6e3ad; }
.pdf-ui-x:focus-visible { outline: 1px solid rgba(246, 227, 173, .7); outline-offset: 2px; }
.pdf-ui-head { text-align: center; }
.pdf-ui-kicker { display: block; font-size: 9.5px; letter-spacing: .24em; color: #d9b978; margin-bottom: 8px; }
.pdf-ui-title { font-family: 'Noto Serif KR', 'Gowun Batang', serif; font-size: 18px; font-weight: 600; line-height: 1.45; color: #fff3d6; word-break: keep-all; }
.pdf-ui-sub { margin-top: 7px; font-size: 12px; line-height: 1.7; color: #b7aa96; word-break: keep-all; }
.pdf-ui-bar { height: 4px; border-radius: 999px; background: rgba(217, 185, 120, .16); margin: 16px 2px 8px; overflow: hidden; }
.pdf-ui-bar i { display: block; height: 100%; width: 4%; border-radius: 999px; background: linear-gradient(90deg, #8d6f3c, #f6e3ad); transition: width .28s ease; }
.pdf-ui-prog { text-align: center; font-size: 11px; letter-spacing: .08em; color: #9c9488; min-height: 16px; }
.pdf-ui-actions { display: grid; gap: 8px; margin-top: 16px; }
.pdf-ui-btn {
  display: block; width: 100%; padding: 13px 14px;
  border-radius: 14px; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 500;
  color: #f0e6d2;
  border: 1px solid rgba(217, 185, 120, .3);
  background: rgba(255, 255, 255, .05);
  transition: .16s ease;
}
.pdf-ui-btn:hover { border-color: rgba(217, 185, 120, .6); background: rgba(217, 185, 120, .12); }
.pdf-ui-btn.primary {
  border-color: rgba(217, 185, 120, .62);
  background: linear-gradient(150deg, #f6e3ad, #d9b978 70%, #c3a469);
  color: #221a0d; font-weight: 700;
}
.pdf-ui-help {
  margin-top: 14px; padding: 13px 14px;
  border-radius: 14px;
  border: 1px dashed rgba(217, 185, 120, .4);
  background: rgba(0, 0, 0, .34);
  font-size: 11.5px; line-height: 1.75; color: #cfc6b6;
  word-break: keep-all;
}
.pdf-ui-help b { color: #f6e3ad; }
.pdf-ui-help ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 7px; }
.pdf-ui-help li { list-style: decimal outside; padding-left: 3px; }

/* ------------------------------------------------------------
   2026 월별 운세 표 (9쪽)
   ------------------------------------------------------------ */
.pdf-sheet .month-table { font-size: calc(12.2px * var(--pdf-fs)); line-height: 1.45; margin: 6px 0 12px; }
.pdf-sheet .month-table th { padding: 7px 6px; font-size: calc(11.5px * var(--pdf-fs)); }
.pdf-sheet .month-table td { padding: 6px 6px; vertical-align: top; }
.pdf-sheet .month-table .mo-when { width: 96px; white-space: nowrap; }
.pdf-sheet .month-table .mo-when b { display: inline; font-size: calc(13px * var(--pdf-fs)); color: #5b3a06; font-weight: 700; }
.pdf-sheet .month-table .mo-when span { font-size: calc(10.5px * var(--pdf-fs)); color: #6d6350; }
.pdf-sheet .month-table .mo-flow { width: 110px; }
.pdf-sheet .month-table .mo-tg { font-size: calc(10.5px * var(--pdf-fs)); color: #5b5345; }
.pdf-sheet .month-table .mo-vibe { color: #1c1710; }
.pdf-sheet .month-table .mo-watch { color: #8a3a26; }
.pdf-sheet .m-note { font-size: calc(12px * var(--pdf-fs)); line-height: 1.7; color: #5b5345; margin-top: 6px; }

/* ------------------------------------------------------------
   v11 — 두 해 달력 · 배지 · 쉬운 말 (인쇄용 밝은 테마)
   ------------------------------------------------------------ */
.pdf-sheet .pbadge {
  display: inline-block; font-size: calc(11px * var(--pdf-fs)); font-weight: 700; line-height: 1.4;
  padding: 3px 7px; border-radius: 999px; white-space: nowrap;
  border: 0.9px solid #c4b79e; color: #3d3324; background: #f6f1e6;
}
.pdf-sheet .pbadge.jackpot { color: #6b4d12; background: #fbf0cf; border-color: #c9a24d; }
.pdf-sheet .pbadge.good { color: #21614a; background: #e8f6ee; border-color: #7ab89a; }
.pdf-sheet .pbadge.calm { color: #4a5540; background: #f1f4ea; border-color: #b9c3ab; }
.pdf-sheet .pbadge.warn { color: #8a4a17; background: #fbeee0; border-color: #d99b5e; }
.pdf-sheet .pbadge.bad { color: #8d2f28; background: #fbe9e7; border-color: #d08a84; }

.pdf-sheet .cal-table { font-size: calc(12.4px * var(--pdf-fs)); line-height: 1.5; }
.pdf-sheet .cal-table td { padding: 6px 6px; vertical-align: top; }
.pdf-sheet .cal-table .mo-when { width: 90px; white-space: nowrap; }
.pdf-sheet .cal-table .mo-flow { width: 116px; white-space: nowrap; }
.pdf-sheet .cal-table .mo-tg { font-size: calc(10px * var(--pdf-fs)); color: #6d6350; }
.pdf-sheet .cal-table .mo-keep { color: #1c1710; }
.pdf-sheet .cal-table .mo-watch { color: #8a3a26; }
.pdf-sheet .cal-table tr.row-good td { background: #fdf8ea; }

.pdf-sheet .rep-gloss {
  margin-top: 18px; padding: 14px 18px; border-radius: 8px;
  border: 1px solid #d8cbaa; background: #faf6ec; break-inside: avoid;
}
.pdf-sheet .rep-gloss > b { display: block; font-size: calc(13px * var(--pdf-fs)); color: #5b3a06; margin-bottom: 8px; letter-spacing: .02em; }
.pdf-sheet .rep-gloss ul { list-style: none; display: grid; gap: 6px; }
.pdf-sheet .rep-gloss li { font-size: calc(12.5px * var(--pdf-fs)); line-height: 1.65; color: #1c1710; word-break: keep-all; }
.pdf-sheet .rep-gloss li strong { color: #6f5316; font-weight: 700; margin-right: 4px; }
.pdf-sheet .rep-gloss p { margin-top: 8px; font-size: calc(11px * var(--pdf-fs)); color: #5b5345; }

/* 여러 쪽을 한 번에 캡처하기 위한 덩어리 래퍼 — 쪽 사이 여백 0 */
.pdf-chunk { width: 794px; background: #ffffff; }
.pdf-chunk .pdf-sheet + .pdf-sheet { margin-top: 0; }
.pdf-chunk + .pdf-chunk { margin-top: 0; }

/* 마지막 장(인생 총평) 아래 — 다른 곳과 오행 풀이가 다를 때의 근거 박스 */
.pdf-sheet .rep-trust {
  margin: 16px 0 0;
  padding: 11px 13px;
  border: 1px solid #ddd2bb;
  border-left: 3px solid #b79b5e;
  border-radius: 6px;
  background: #faf7f0;
}
.pdf-sheet .rep-trust b {
  display: block;
  font-size: calc(12px * var(--pdf-fs));
  color: #5b3a06;
  letter-spacing: .02em;
  margin-bottom: 5px;
}
.pdf-sheet .rep-trust span {
  display: block;
  font-size: calc(12px * var(--pdf-fs));
  line-height: 1.7;
  color: #1c1710;
  word-break: keep-all;
}
