/* 만세력 앱 스타일 — IMG_5805 톤 (라이트, 카드, 오행 컬러 타일) */
:root {
  --bg: #f5f7fa; --card: #ffffff; --ink: #2b3038; --dim: #8a93a0; --line: #e6eaf0;
  --accent: #3b82f6;
  --el-목: #2fb586; --el-화: #ef4b60; --el-토: #f6c445; --el-금: #e9edee; --el-수: #3a3f47;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Noto Sans KR', sans-serif; background: var(--bg); color: var(--ink); }
main { max-width: 880px; margin: 0 auto; padding: 16px; }

.site-header { display: flex; align-items: center; justify-content: space-between;
  max-width: 880px; margin: 0 auto; padding: 18px 16px 4px; }
.site-header h1 { font-family: 'Noto Serif KR', serif; font-size: 24px; margin: 0; }
.site-header h1 small { font-size: 13px; color: var(--dim); font-weight: 600; margin-left: 6px; }
.api-status { font-size: 12px; color: var(--dim); background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px; }
.api-status.on { color: #0a7d4f; border-color: #bfe8d6; background: #eefaf4; }
.api-status.off { color: #a06010; border-color: #f2ddb8; background: #fdf6e8; }
.api-status.busy { color: #b03636; border-color: #f2c5c5; background: #fdeeee; animation: pulse 2s ease-in-out infinite; }
.status-group { display: flex; gap: 6px; }
.site-nav { display: flex; gap: 4px; margin: 0 auto 0 24px; }
.site-nav a { text-decoration: none; color: var(--dim); font-size: 14px; font-weight: 700;
  padding: 6px 14px; border-radius: 999px; }
.site-nav a:hover { background: #eef2f7; }
.site-nav a.active { background: var(--accent); color: #fff; }
@media (max-width: 640px) { .site-header { flex-wrap: wrap; } .site-nav { margin: 8px 0 0; width: 100%; } .status-group { display: none; } }

/* 용어집 */
.gloss-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.gloss-tools input { flex: 1; min-width: 200px; }
.gloss-tools select { min-width: 130px; }
.gloss-table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--card); }
.gloss-table th, .gloss-table td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; vertical-align: top; }
.gloss-table th { background: #f6f8fb; position: sticky; top: 0; }
.gloss-table td.term { font-weight: 800; white-space: nowrap; }
.gloss-table td.hanja { color: var(--dim); white-space: nowrap; font-family: 'Noto Serif KR', serif; }
.gloss-table td.cat { white-space: nowrap; }
.gloss-table .cat-badge { font-size: 11.5px; font-weight: 700; background: #eef2f7; color: #55606e;
  border-radius: 999px; padding: 2px 9px; }
.gloss-count { color: var(--dim); font-size: 13px; margin: 8px 0; }

/* 큰 글씨 모드 — 용어집·명리학 개론 페이지 */
body.big-text { font-size: 17px; }
body.big-text .gloss-table { font-size: 16.5px; line-height: 1.65; }
body.big-text .gloss-table th, body.big-text .gloss-table td { padding: 12px 14px; }
body.big-text .gloss-table td.term { font-size: 17px; }
body.big-text .gloss-tools input, body.big-text .gloss-tools select { font-size: 16px; padding: 10px 12px; }
body.big-text .gloss-count { font-size: 15px; }
body.big-text .form-card > p { font-size: 16px !important; }
body.big-text .report { font-size: 17.5px; line-height: 1.9; }
body.big-text .report h2 { font-size: 27px; }
body.big-text .report h3 { font-size: 21px; margin-top: 34px; }
body.big-text .report h4 { font-size: 18.5px; margin-top: 26px; }
.report table.char-table th:nth-child(-n+3), .report table.char-table td:nth-child(-n+3) { white-space: nowrap; }

/* 책 목차·장 내비게이션 */
.breadcrumb { font-size: 14px; color: var(--dim); margin: 6px 4px; }
.breadcrumb a { color: var(--accent); text-decoration: none; font-weight: 700; }
.toc-part { font-weight: 900; font-size: 17px; margin: 26px 0 8px; padding-left: 10px; border-left: 4px solid var(--accent); }
.toc-list { list-style: none; margin: 0; padding: 0 0 0 14px; }
.toc-list li { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 16.5px; }
.toc-num { flex: 0 0 auto; min-width: 3.1em; color: var(--dim); font-weight: 800; font-size: 14.5px; }
.toc-list a { color: var(--ink); text-decoration: none; font-weight: 700; }
.toc-list a:hover { color: var(--accent); }
.toc-list li.todo { color: #a7afba; font-weight: 500; }
.badge { font-size: 11.5px; font-weight: 800; color: #a06010; background: #fdf6e8; border: 1px solid #f2ddb8;
  border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.badge.done { color: #0a7d4f; background: #eefaf4; border-color: #bfe8d6; }
.book-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; margin-top: 16px; }
.book-nav a { text-decoration: none; font-weight: 800; font-size: 15px; color: var(--accent); }
.book-nav .bn-toc { color: var(--dim); }

/* 초심자용 보조 박스 */
.box-try, .box-key { border-radius: 14px; padding: 16px 20px; margin: 18px 0; font-size: 0.95em; }
.box-try { background: #eefaf4; border: 1.5px solid #bfe8d6; }
.box-key { background: #f2f6fd; border: 1.5px solid #c9dcf8; }
.box-try > b:first-child, .box-key > b:first-child { display: block; margin-bottom: 6px; font-size: 1.02em; }
.box-try > b:first-child::before { content: '✏️ '; }
.box-key > b:first-child::before { content: '📌 '; }
.box-key ul, .box-try ul, .box-key ol, .box-try ol { margin: 6px 0 0; padding-left: 22px; }
.box-key li, .box-try li { margin: 4px 0; }
body.big-text .report table { font-size: 16px; }
body.big-text .report th, body.big-text .report td { padding: 10px 12px; }
body.big-text footer { font-size: 14px; }
@keyframes pulse { 50% { opacity: .55; } }

/* 상담 대기실 */
.waiting-room { text-align: center; padding: 42px 20px; }
.wr-lamp { font-size: 44px; animation: sway 3s ease-in-out infinite; display: inline-block; transform-origin: top center; }
@keyframes sway { 0%,100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
.report .waiting-room h3 { font-family: 'Noto Serif KR', serif; font-size: 20px; margin: 12px 0 6px; border: 0; padding: 0; }
.wr-pos { font-size: 16px; font-weight: 800; color: #2857b8; margin: 6px 0; }
.wr-flavor { color: var(--dim); font-size: 14px; min-height: 1.5em; transition: opacity .4s; }
.wr-note { font-size: 12px; color: var(--dim); margin-top: 18px; }

/* 폼 */
.form-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: #55606e; }
.field .opt { font-weight: 400; color: var(--dim); }
.inline { display: flex; gap: 8px; align-items: center; }
input, select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe; }
input:focus, select:focus { outline: 2px solid #bfd7fe; }
#birthYear { width: 90px; } #longitude { width: 110px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { font: inherit; font-weight: 600; padding: 8px 16px; border: 0; background: #fbfcfe; color: var(--dim); cursor: pointer; }
.seg button.active { background: var(--accent); color: #fff; }
.check { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; color: var(--dim); font-size: 12.5px; }
.submit { width: 100%; font: inherit; font-size: 16px; font-weight: 800; color: #fff; background: var(--accent);
  border: 0; border-radius: 12px; padding: 14px; cursor: pointer; margin-top: 4px; }
.submit:hover { filter: brightness(1.05); }
.privacy { font-size: 12px; color: var(--dim); text-align: center; margin: 10px 0 0; }

/* 차트 */
.chart-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-top: 20px; }
.chart-head h2 { margin: 0 0 4px; font-size: 20px; }
.chart-head h2 small { color: var(--dim); font-size: 13px; font-weight: 600; }
.chart-head p { margin: 2px 0; font-size: 14px; }
.chart-head .red { color: #e0455c; } .chart-head .blue { color: #3b82f6; }
.chart-head .dim { color: var(--dim); font-size: 12px; }

.pillar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0 6px; }
.pillar { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.p-label { font-size: 12px; color: var(--dim); font-weight: 700; }
.p-god { font-size: 14px; font-weight: 800; }
.p-god2 { font-size: 13px; font-weight: 700; border-top: 1px solid var(--line); padding-top: 6px; width: 100%; text-align: center; }
.p-stage { font-size: 13px; font-weight: 700; color: #8a5db0; }
.p-extra { font-size: 11.5px; color: var(--dim); }
.unknown-box { border: 1.5px dashed var(--line); border-radius: 16px; width: 100%; min-height: 150px;
  display: flex; align-items: center; justify-content: center; text-align: center; color: var(--dim); font-size: 13px; }
.unknown-pillar { justify-content: flex-start; }

.tile { width: 100%; max-width: 84px; aspect-ratio: 1; border-radius: 20px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; line-height: 1.05; }
.tile b { font-family: 'Noto Serif KR', serif; font-size: 34px; font-weight: 900; }
.tile small { font-size: 12px; font-weight: 700; margin-top: 2px; }
.tile.sm { max-width: 44px; border-radius: 12px; }
.tile.sm b { font-size: 19px; } .tile.sm small { display: none; }
.el-목 { background: var(--el-목); color: #fff; }
.el-화 { background: var(--el-화); color: #fff; }
.el-토 { background: var(--el-토); color: #5c4a12; }
.el-금 { background: var(--el-금); color: #3d454d; }
.el-수 { background: var(--el-수); color: #fff; }

.hidden-row { display: flex; gap: 5px; justify-content: center; min-height: 30px; }
.hid { display: flex; flex-direction: column; align-items: center; font-family: 'Noto Serif KR', serif;
  font-weight: 900; font-size: 15px; }
.hid i { font-style: normal; font-family: 'Noto Sans KR'; font-weight: 500; font-size: 9.5px; color: var(--dim); }
.el-t-목 { color: var(--el-목); } .el-t-화 { color: var(--el-화); } .el-t-토 { color: #d8a512; }
.el-t-금 { color: #7d8892; } .el-t-수 { color: #4a90d9; }
span.chip.el-t-토 { color: #a87c00; }

.summary-rows { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.summary-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.s-label { font-size: 12px; font-weight: 800; color: var(--dim); min-width: 34px; }
.chip { font-size: 12.5px; font-weight: 700; background: #f1f4f8; border-radius: 999px; padding: 4px 10px; }
.chip.strong { background: #eaf1ff; color: #2857b8; }

.luck-title { font-size: 15px; margin: 20px 0 8px; }
.luck-title small { color: var(--dim); font-weight: 500; font-size: 12px; }
.luck-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.luck-cell { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 52px;
  padding: 8px 4px; border-radius: 12px; }
.luck-cell.current { background: #eaf1ff; outline: 1.5px solid #bcd3fb; }
.lc-age { font-size: 12px; color: var(--dim); font-weight: 700; }
.lc-god { font-size: 11px; font-weight: 700; }
.lc-stage { font-size: 11px; color: #8a5db0; font-weight: 700; }

/* 해설 */
.report { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px; margin-top: 20px;
  line-height: 1.75; font-size: 15px; }
.report h2 { font-family: 'Noto Serif KR', serif; font-size: 22px; margin: 8px 0 14px; }
.report h3 { font-size: 17px; margin: 26px 0 8px; padding-left: 10px; border-left: 4px solid var(--accent); }
.report h4 { font-size: 15px; margin: 18px 0 6px; }
.report p { margin: 8px 0; }
.report table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13.5px; }
.report th, .report td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.report th { background: #f6f8fb; }
.report blockquote { margin: 10px 0; padding: 10px 14px; background: #fdf6e8; border-radius: 10px; color: #7a5c14; font-size: 13.5px; }
.report code { background: #f1f4f8; border-radius: 6px; padding: 1px 6px; font-size: 13px; }
.report hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.loading { color: var(--dim); text-align: center; padding: 24px 0; }
/* 저장된 해설을 다시 보여줄 때의 안내 — 새로 지은 것과 헷갈리지 않게 */
.cached-notice { background: #fdf6e8; border: 1px solid #f2ddb8; color: #7a5a1e;
  border-radius: 10px; padding: 10px 14px; margin: 0 0 16px; font-size: 14.5px; }
.error { color: #d33; }
footer { text-align: center; color: var(--dim); font-size: 12px; padding: 30px 0 40px; }

@media (max-width: 640px) {
  .tile b { font-size: 26px; }
  .pillar-grid { gap: 6px; }
  .report { padding: 18px; }
}
