/* 천문 개인 해설서 — 화면 + A4 인쇄 공용 스타일 */
.rp-book {
  --ink: #2a2622;
  --ink-soft: #5a524a;
  --paper: #fbf8f2;
  --line: #e4dccd;
  --accent: #8a5a2b;
  --indigo: #2f3b63;
  --sage: #6c8a6a;
  font-family: 'Pretendard', 'Noto Sans KR', system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 22px 60px;
  font-size: 16.5px;
  line-height: 1.85;
  word-break: keep-all;
  overflow-wrap: anywhere;
  border-radius: 14px;
}
body.rp-standalone { background: #e9e3d8; margin: 0; padding: 24px 0; }
.rp-book h1, .rp-book h2, .rp-book h3, .rp-book h4 { font-family: 'Gowun Batang', 'Noto Serif KR', serif; color: var(--ink); line-height: 1.4; }
.rp-book p { margin: 0 0 1em; }

.rp-cover { text-align: center; padding: 24px 0 30px; border-bottom: 1px solid var(--line); position: relative; }
.rp-brand { letter-spacing: 0.16em; font-size: 0.8rem; color: var(--accent); margin-bottom: 6px; }
.rp-drawer-tag { display: inline-block; font-size: 0.78rem; font-weight: 700; color: var(--indigo); background: #eaeff8; border: 1px solid #c9d5ea; border-radius: 999px; padding: 2px 12px; margin: 0 0 8px; }
.rp-cover h1 { font-size: 2rem; margin: 4px 0 6px; }
.rp-for { color: var(--ink-soft); margin-bottom: 18px; }
.rp-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 16px; text-align: left; margin: 18px 0 0; font-size: 0.88rem; }
.rp-meta div { border-top: 1px solid var(--line); padding-top: 6px; }
.rp-meta dt { color: var(--ink-soft); font-size: 0.78rem; }
.rp-meta dd { margin: 0; font-weight: 600; }
.rp-stamp { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; margin-bottom: 10px; }
.rp-stamp.test { background: #fde2dd; color: #9b2c1c; border: 1px solid #f2b3a6; }
.rp-stamp.sample { background: #e6edf7; color: #2f3b63; border: 1px solid #b9c7e0; }

.rp-summary, .rp-chapter, .rp-toc, .rp-divider { padding: 30px 0 10px; border-bottom: 1px solid var(--line); }
.rp-ch-head { margin-bottom: 16px; }
.rp-kicker { display: inline-block; font-size: 0.78rem; letter-spacing: 0.08em; color: var(--accent); font-weight: 700; margin-bottom: 4px; }
.rp-ch-head h3 { font-size: 1.45rem; margin: 0; }
.rp-headline { font-family: 'Gowun Batang', serif; font-size: 1.22rem; line-height: 1.6; color: var(--indigo); margin: 4px 0 14px; }
.rp-keeper-card { background: #f4f1ea; border: 1px solid #dfd6c4; border-left: 3px solid var(--indigo); border-radius: 10px; padding: 14px 18px; margin: 0 0 18px; }
.rp-keeper-card.is-compact { padding: 12px 15px; margin: 10px 0 14px; }
.rp-keeper-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.rp-keeper-head strong { font-family: 'Gowun Batang', 'Noto Serif KR', serif; font-size: 0.95rem; color: var(--indigo); }
.rp-keeper-head span { font-size: 0.74rem; color: var(--ink-soft); background: #ebe4d6; border-radius: 999px; padding: 1px 9px; }
.rp-keeper-body { font-size: 0.95rem; line-height: 1.78; color: var(--ink); }
.sample-drawer-tag { font-size: 0.78rem; font-weight: 700; color: var(--accent); letter-spacing: 0.04em; margin: 0 0 4px; }
.rp-points { padding-left: 1.1em; }
.rp-points li { margin-bottom: 8px; }
.rp-sum-block { margin-bottom: 22px; }
.rp-sum-block h4 { margin: 0 0 4px; font-size: 1.1rem; color: var(--accent); }
.rp-sum-q, .rp-guide { background: #f3eee4; border-radius: 10px; padding: 12px 16px; margin-top: 10px; }
.rp-sum-q h5, .rp-guide h5 { margin: 0 0 6px; font-size: 0.9rem; }
.rp-sum-q ul, .rp-guide ul { margin: 0; padding-left: 1.1em; font-size: 0.94rem; }
.rp-guide a { color: var(--indigo); font-weight: 600; }

.rp-toc ol { list-style: none; padding: 0; margin: 0; columns: 1; }
.rp-toc li { padding: 5px 0; border-bottom: 1px dotted var(--line); font-size: 0.95rem; }
.rp-toc li a { color: var(--ink); text-decoration: none; }
.rp-toc li a:hover { color: var(--accent); }
.rp-toc .toc-div { font-weight: 700; color: var(--accent); border-bottom: none; padding-top: 12px; }

.rp-lead { font-size: 1.08rem; color: var(--ink); }
.rp-quote { margin: 18px 0; padding: 14px 18px; border-left: 3px solid var(--accent); background: #f5efe3; font-family: 'Gowun Batang', serif; font-size: 1.06rem; border-radius: 0 10px 10px 0; }
.rp-basis, .rp-case, .rp-cond, .rp-ask { border-radius: 12px; padding: 14px 18px; margin: 16px 0; }
.rp-basis h5, .rp-case h5, .rp-cond h5, .rp-ask h5 { margin: 0 0 6px; font-size: 0.92rem; }
.rp-basis p, .rp-case p { margin: 0; font-size: 0.97rem; }
.rp-basis { background: #eef1ea; border: 1px solid #d6dfd2; }
.rp-case { background: #fffaf0; border: 1px dashed #d9c39b; }
.rp-case h5 span { font-weight: 500; font-size: 0.75rem; color: #8b7348; margin-left: 6px; border: 1px solid #d9c39b; border-radius: 999px; padding: 1px 8px; }
.rp-cond { background: #f4f2f7; border: 1px solid #ddd8e8; }
.rp-cond ul, .rp-ask ol { margin: 0; padding-left: 1.2em; font-size: 0.96rem; }
.rp-ask { background: #eaf0f7; border: 1px solid #ccd8e8; }
.rp-list h5 { margin: 12px 0 6px; font-size: 0.98rem; }
.rp-list ul { padding-left: 1.2em; }
.rp-list.is-check ul { list-style: none; padding-left: 0; }
.rp-list.is-check li { padding-left: 1.6em; position: relative; margin-bottom: 6px; }
.rp-list.is-check li::before { content: ''; position: absolute; left: 0; top: 0.45em; width: 0.95em; height: 0.95em; border: 1.5px solid var(--accent); border-radius: 3px; }
.rp-note { font-size: 0.82rem; color: var(--ink-soft); background: #f1ece2; border-radius: 8px; padding: 10px 14px; }

.rp-table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 0.94rem; }
.rp-table th, .rp-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.rp-table th { background: #f1ebdf; font-weight: 700; }

.rp-fig { margin: 20px 0; text-align: center; break-inside: avoid; page-break-inside: avoid; }
.rp-fig img { width: 100%; max-width: 560px; height: auto; border-radius: 10px; display: block; margin: 0 auto; aspect-ratio: 1200 / 896; object-fit: cover; }
.rp-fig figcaption { font-family: 'Gowun Batang', serif; font-size: 0.98rem; color: var(--ink-soft); margin-top: 8px; }

.rp-chart { margin: 18px 0; break-inside: avoid; page-break-inside: avoid; }
.rp-chart figcaption { font-weight: 700; font-size: 0.92rem; margin-bottom: 8px; }
.rp-chart svg { width: 100%; height: auto; max-width: 560px; }
.svg-l { font-size: 14px; fill: #2a2622; }
.svg-v { font-size: 13px; fill: #5a524a; }
.rp-ms { width: 100%; border-collapse: collapse; text-align: center; font-size: 0.9rem; }
.rp-ms th, .rp-ms td { border: 1px solid var(--line); padding: 6px 4px; }
.rp-ms thead th { background: #f1ebdf; }
.rp-ms tbody th { background: #f7f2e8; font-weight: 600; width: 64px; }
.ms-char { display: block; font-family: 'Noto Serif KR', serif; font-size: 1.9rem; line-height: 1.2; }
.ms-ko { font-size: 0.75rem; color: var(--ink-soft); }
.ms-god { font-size: 0.82rem; color: var(--ink-soft); }
.ms-empty { color: #aaa; }
.rp-dw { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.dw-cell { border: 1px solid var(--line); border-radius: 8px; padding: 6px 4px; text-align: center; display: flex; flex-direction: column; font-size: 0.78rem; position: relative; background: #fff; }
.dw-gz { font-family: 'Noto Serif KR', serif; font-size: 1.2rem; }
.dw-age, .dw-yr, .dw-ko { color: var(--ink-soft); }
.dw-g { font-weight: 700; }
.dw-cell.is-now { outline: 2px solid var(--accent); }
.dw-now { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; font-size: 0.66rem; padding: 0 6px; border-radius: 999px; }
.tone3 .dw-g, .tone3 .tl-label, tr.tone3 td:last-child { color: #2f6b3a; }
.tone2 .dw-g, .tone2 .tl-label, tr.tone2 td:last-child { color: #4d7c45; }
.tone1 .dw-g, .tone1 .tl-label, tr.tone1 td:last-child { color: #7b7a3a; }
.tone-1 .dw-g, .tone-1 .tl-label, tr.tone-1 td:last-child { color: #9a6a2a; }
.tone-2 .dw-g, .tone-2 .tl-label, tr.tone-2 td:last-child { color: #8f4a3a; }
.rp-legend { font-size: 0.78rem; color: var(--ink-soft); margin-top: 6px; }
.rp-cal { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.rp-cal th, .rp-cal td { border: 1px solid var(--line); padding: 6px 8px; }
.rp-cal th { background: #f1ebdf; }

.rp-care30 { background: #f8f4eb; border: 1px solid #dfd6c4; border-radius: 12px; padding: 16px; margin-top: 22px; }
.care30-head-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.care30-head-row figcaption { margin-bottom: 0; }
.care30-progress { font-size: 0.78rem; font-weight: 700; color: var(--indigo); background: #eaeff8; border: 1px solid #c9d5ea; border-radius: 999px; padding: 2px 10px; }
.care30-meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin-bottom: 12px; }
.care30-meta-grid div { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 0.85rem; }
.care30-meta-grid span { display: block; font-size: 0.75rem; color: var(--ink-soft); }
.care30-habits { margin: 0 0 12px; padding-left: 1.15em; font-size: 0.9rem; }
.care30-habits li { margin-bottom: 4px; }
.care30-grid th { text-align: center; font-size: 0.82rem; width: 68px; }
.care30-cell { text-align: center !important; padding: 6px 4px !important; background: #fff; }
.care30-day { display: block; font-size: 0.72rem; font-weight: 700; color: var(--indigo); }
.care30-boxes { display: flex; justify-content: center; gap: 3px; margin-top: 3px; }
.care30-chk { background: transparent; border: 1px solid #d5cbb8; border-radius: 4px; width: 20px; height: 20px; padding: 0; font-size: 0.76rem; line-height: 1; color: var(--ink-soft); cursor: pointer; }
.care30-chk.is-checked { background: var(--indigo); border-color: var(--indigo); color: #fff; font-weight: 700; }

.rp-timeline { margin: 16px 0; }
.rp-timeline h5 { margin: 0 0 8px; }
.tl-item { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 10px 0; border-top: 1px dashed var(--line); }
.tl-label { font-weight: 700; }
.tl-item p { margin: 2px 0 0; font-size: 0.95rem; }

.rp-divider { text-align: center; }
.rp-divider span { color: var(--accent); font-size: 0.8rem; letter-spacing: 0.1em; }
.rp-divider h2 { font-size: 1.7rem; margin: 4px 0 10px; }
.rp-end { text-align: center; font-size: 0.8rem; color: var(--ink-soft); padding-top: 20px; }
.rp-end p { margin: 0 0 4px; }
.rp-end-sub { font-size: 0.74rem; color: #7a7167; }
.rp-book.is-test { background-image: repeating-linear-gradient(-30deg, transparent 0 220px, rgba(155, 44, 28, 0.035) 220px 260px); }

@media (max-width: 520px) {
  .rp-book { padding: 18px 14px 40px; font-size: 16px; border-radius: 0; }
  .rp-cover h1 { font-size: 1.6rem; }
  .ms-char { font-size: 1.45rem; }
  .tl-item { grid-template-columns: 1fr; gap: 2px; }
}

@media print {
  @page { size: A4; margin: 16mm 15mm 18mm; }
  html, body { background: #fff !important; color: #2a2622 !important; margin: 0 !important; padding: 0 !important; }
  #starsCanvas, .site-header, .site-footer, #landingView, #inputView, #resultView, .rp-toolbar, .rp-drawer, .modal-backdrop, .no-print { display: none !important; }
  #reportView { display: block !important; padding: 0 !important; margin: 0 !important; background: #fff !important; }
  .rp-book { position: static !important; width: 100% !important; max-width: none !important; margin: 0 !important; padding: 0 !important; background: #fff !important; font-size: 10.5pt; line-height: 1.75; border-radius: 0; box-shadow: none; }
  .rp-cover { page-break-after: always; break-after: page; min-height: 235mm; display: flex; flex-direction: column; justify-content: center; border: none; }
  .rp-summary, .rp-toc, .rp-divider { page-break-after: always; break-after: page; border: none; }
  .rp-chapter { page-break-before: always; break-before: page; border: none; padding-top: 0; }
  .rp-ch-head, .rp-ch-head + * { break-after: avoid; page-break-after: avoid; }
  .rp-basis, .rp-case, .rp-cond, .rp-ask, .rp-keeper-card, .rp-table, .tl-item, .rp-quote, .rp-fig, .rp-chart { break-inside: avoid; page-break-inside: avoid; }
  h2, h3, h4, h5 { break-after: avoid; page-break-after: avoid; }
  .rp-fig img { max-width: 120mm; max-height: 92mm; }
  .rp-cover .rp-fig img { max-height: 82mm; }
  .rp-toc a, .rp-guide a { color: inherit; text-decoration: none; }
  .rp-book.is-test { background-image: none; }
}
