/* 현월당 — 심플 · 힐링
   cream paper + sage ink, generous whitespace */

:root {
  --bg: #F3F0E8;
  --bg-soft: #EAE6DC;
  --paper: #FBF9F4;
  --ink: #2E2B27;
  --ink-soft: #6B6560;
  --ink-faint: #9A948C;
  --sage: #6E8B74;
  --sage-deep: #54705B;
  --sage-soft: #D7E2D8;
  --sand: #C4B49A;
  --line: rgba(46, 43, 39, 0.08);
  --line-strong: rgba(46, 43, 39, 0.14);
  --kakao: #FEE500;
  --kakao-ink: #191919;
  --danger: #B45A4A;
  --shadow: 0 18px 50px rgba(46, 43, 39, 0.06);
  --radius: 18px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --serif: "YeolrinMyeongjo", "Apple Myungjo", "Nanum Myeongjo", serif;
}

@font-face {
  font-family: "YeolrinMyeongjo";
  src: url("../font/YeolrinMyeongjo-Light.woff2") format("woff2");
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: "YeolrinMyeongjo";
  src: url("../font/YeolrinMyeongjo-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "YeolrinMyeongjo";
  src: url("../font/YeolrinMyeongjo-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--bg); }
body {
  font-family: Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img { max-width: 100%; display: block; }
a { color: inherit; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── layout ── */
.site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), opacity .4s var(--ease);
}
body.is-scrolled .site-nav { border-bottom-color: var(--line); }
body.screen-intro .site-nav,
body.screen-loading .site-nav { opacity: 0; pointer-events: none; }
.nav-brand { display: flex; align-items: baseline; gap: 8px; letter-spacing: 0.04em; }
.nav-brand-mark { font-size: 13px; color: var(--sage); font-weight: 500; }
.nav-brand-name { font-size: 16px; font-weight: 600; }
.nav-link {
  font-size: 13px; color: var(--ink-soft); padding: 8px 10px; border-radius: 999px;
}
.nav-link:hover, .nav-link.is-active { color: var(--ink); background: var(--sage-soft); }

.screen {
  min-height: 100svh;
  display: none;
  padding-top: var(--nav-h);
}
.screen.active { display: block; }
body.screen-survey .screen#screenSurvey,
body.screen-existing .screen#screenExisting,
body.screen-loading .screen#screenLoading,
body.screen-mypage .screen#screenMypage { display: block; }

body.screen-loading .screen#screenLoading { padding-top: 0; }
html:has(body.screen-result),
body.screen-result {
  height: 100%;
  height: 100svh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

/* ── intro ── */
body.screen-intro .screen#screenIntro {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  height: 100svh;
  padding: 0 20px;
  box-sizing: border-box;
}

.intro-stage {
  width: 100%;
  max-width: 640px;
  text-align: center;
  margin: 0 auto;
}
.intro-kicker {
  font-size: 12px; letter-spacing: 0.28em; color: var(--sage);
  margin: 0 0 28px; text-transform: uppercase;
  opacity: 0; animation: fadeUp .8s var(--ease) .2s forwards;
}
.intro-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 4em;
  font-family: var(--serif);
  font-size: clamp(15px, 5.4vw, 23px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.75;
  color: var(--ink);
  margin: 0;
  opacity: 0;
  transform: translateY(7px);
  transition:
    opacity .9s var(--ease),
    transform .9s var(--ease);
}
.intro-line {
  display: block;
  white-space: nowrap;
  min-height: 1.75em;
}
.intro-text.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.intro-text.is-leaving {
  opacity: 0;
  transform: translateY(-7px);
}
.intro-caret {
  display: inline-block;
  width: 1px; height: 1.05em;
  margin-left: 2px; vertical-align: -2px;
  background: var(--sage);
  animation: blink 1s steps(1) infinite;
}
.intro-caret.is-done { opacity: 0; animation: none; }
.intro-actions {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  height: 0; overflow: hidden; margin-top: 0;
  opacity: 0; pointer-events: none;
  transform: translateY(8px);
  transition: opacity .6s var(--ease), transform .6s var(--ease), margin-top .4s var(--ease);
}
.intro-actions.is-ready {
  height: auto; overflow: visible; margin-top: 36px;
  opacity: 1; pointer-events: auto; transform: none;
}
.intro-skip {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 5;
}
.intro-actions.is-ready ~ .intro-skip { display: none; }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 180px; height: 50px; padding: 0 28px;
  border-radius: 999px;
  background: var(--ink); color: #FBF9F4;
  font-size: 15px; font-weight: 600; letter-spacing: -0.02em;
  transition: transform .2s var(--ease), background .2s;
}
.btn-primary:hover { background: #1c1a18; transform: translateY(-1px); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-ghost {
  font-size: 13px; color: var(--ink-faint);
  padding: 6px 10px;
}
.btn-ghost:hover { color: var(--ink-soft); }

@keyframes blink { 50% { opacity: 0; } }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ── survey ── */
.survey-wrap {
  width: min(560px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 120px;
}
.survey-progress {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 36px;
}
.survey-bar {
  flex: 1; height: 2px; background: var(--line-strong); border-radius: 99px; overflow: hidden;
}
.survey-bar > i {
  display: block; height: 100%; width: 0;
  background: var(--sage);
  transition: width .45s var(--ease);
}
.survey-count { font-size: 12px; color: var(--ink-faint); letter-spacing: 0.04em; }
.survey-step { display: none; }
.survey-step.active { display: block; animation: fadeUp .45s var(--ease); }
.survey-q {
  font-family: var(--serif);
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.5;
  margin: 0 0 10px;
}
.survey-hint {
  margin: 0 0 32px;
  color: var(--ink-soft);
  font-size: 15px;
}
.field {
  width: 100%;
  height: 52px;
  padding: 0 2px 10px;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  font-size: 20px;
  letter-spacing: -0.02em;
  text-align: center;
  outline: none;
  box-shadow: none;
  transition: border-color .2s;
}
.field::placeholder { color: var(--ink-faint); font-weight: 400; }
.field:focus { border-color: var(--ink); box-shadow: none; }
.field:focus-visible { border-color: var(--ink); }
textarea.field {
  height: 120px;
  padding: 4px 2px 10px;
  resize: none;
  line-height: 1.7;
  text-align: left;
  font-size: 16px;
}
.choice-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 28px;
}
.choice-grid.cols-2 { gap: 6px 48px; }
.choice-grid.cols-4 { gap: 4px 22px; }
.choice-grid.choice-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.choice {
  position: relative;
  cursor: pointer;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: block;
  padding: 10px 4px;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  text-align: center;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  transition: color .2s;
}
.choice span em {
  display: block;
  font-style: normal;
  font-size: 15px;
}
.choice span small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
  opacity: .7;
}
.choice:hover span,
.choice input:focus-visible + span {
  color: var(--ink);
}
.choice input:checked + span {
  color: var(--ink);
  font-weight: 600;
}
.leap-wrap { margin-top: 28px; }
.leap-wrap.is-hidden { display: none; }
.leap-hint { margin: 0 0 8px; }
.survey-error {
  min-height: 22px; margin: 12px 0 0;
  font-size: 13px; color: var(--danger);
}
.survey-nav {
  display: flex; gap: 10px; margin-top: 28px;
}
.btn-secondary {
  height: 50px; padding: 0 20px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  font-size: 14px; color: var(--ink-soft);
}
.btn-secondary:hover { border-color: var(--ink-faint); color: var(--ink); }
.survey-nav .btn-primary { flex: 1; }

.kakao-login-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 54px; border-radius: 12px;
  background: var(--kakao); color: var(--kakao-ink);
  font-size: 15px; font-weight: 700;
}
.kakao-login-btn:hover { filter: brightness(0.97); }
.login-note { margin-top: 16px; font-size: 13px; color: var(--ink-faint); text-align: center; }

.confirm-list {
  list-style: none; margin: 0; padding: 0;
  border-top: 1px solid var(--line);
}
.confirm-list li {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.confirm-list dt, .confirm-k { color: var(--ink-faint); }
.confirm-list dd, .confirm-v { margin: 0; font-weight: 600; text-align: right; }
.confirm-note {
  margin: 18px 0 0;
  font-size: 13px; color: var(--ink-faint);
}

/* ── existing result notice ── */
.notice-card {
  width: min(480px, calc(100% - 40px));
  margin: 12vh auto 0;
  text-align: center;
  padding: 48px 32px;
  background: var(--paper);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.notice-card h1 {
  font-family: var(--serif);
  font-size: 24px; font-weight: 500; letter-spacing: -0.02em; margin: 0 0 12px;
}
.notice-card p { color: var(--ink-soft); margin: 0 0 28px; }
.notice-actions { display: flex; flex-direction: column; gap: 10px; }

/* ── loading ── */
#screenLoading {
  min-height: 100svh;
  background: var(--bg);
}
.load-inner {
  width: min(680px, calc(100% - 40px));
  margin: 0 auto;
  padding: 72px 0 80px;
}
.load-head { text-align: center; margin-bottom: 36px; }
.load-kicker { font-size: 12px; letter-spacing: 0.22em; color: var(--sage); margin: 0 0 10px; }
.load-title { font-family: var(--serif); font-size: 22px; font-weight: 500; letter-spacing: -0.02em; margin: 0 0 8px; }
.load-phase { color: var(--ink-soft); margin: 0; min-height: 24px; }
.load-bar {
  width: min(280px, 70%); height: 2px; margin: 22px auto 0;
  background: var(--line-strong); border-radius: 99px; overflow: hidden;
}
.load-bar > i {
  display: block; height: 100%; width: 8%;
  background: var(--sage);
  transition: width .6s var(--ease);
}
.guide-stack { display: grid; gap: 14px; }
.guide-card {
  background: var(--paper);
  border-radius: 18px;
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
}
.guide-card h3 {
  display: flex; align-items: baseline; gap: 10px;
  margin: 0 0 10px; font-size: 16px;
}
.guide-card h3 em {
  font-style: normal; font-size: 13px; color: var(--sage); font-weight: 500;
}
.guide-card p { margin: 0 0 8px; color: var(--ink-soft); font-size: 14.5px; }
.guide-card p:last-child { margin-bottom: 0; }
.guide-pills { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.guide-pill {
  background: var(--bg); border-radius: 12px; padding: 12px;
  font-size: 13px; color: var(--ink-soft);
}
.guide-pill strong { display: block; color: var(--ink); margin-bottom: 4px; font-size: 13px; }

/* ── result book ── */
#screenResult {
  height: 100svh;
  height: 100dvh;
  max-height: 100svh;
  max-height: 100dvh;
  padding-top: var(--nav-h);
  display: none;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
body.screen-result .screen#screenResult,
body.screen-result #screenResult.screen.active {
  display: flex;
}

.res-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 8px 18px 10px;
}
.res-meta { font-size: 12px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-vp {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 8px 16px 108px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.book-page { display: none; }
.book-page.active { display: block; animation: pageIn .45s var(--ease); }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.bpi {
  width: min(720px, 100%);
  margin: 0 auto;
  background: var(--paper);
  border-radius: 22px;
  padding: 36px 28px 40px;
  box-shadow: var(--shadow);
}
.book-intro {
  text-align: center;
  margin: 0 0 32px;
}
.book-intro p {
  margin: 0;
  font-size: 16px;
  color: var(--ink-soft);
  letter-spacing: -0.02em;
}
.bm { margin: 0 0 32px; }
.bm-head {
  display: flex; align-items: baseline; gap: 10px;
  margin: 0 0 14px;
}
.bm-head em { font-style: normal; color: var(--sage); font-size: 13px; letter-spacing: 0.12em; }
.bm-head h2 { margin: 0; font-size: 18px; letter-spacing: -0.03em; }
.bm-desc { margin: 10px 0 0; color: var(--ink-soft); font-size: 14px; }

.ds-card {
  display: flex; gap: 16px; align-items: center;
  padding: 16px; border-radius: 16px; background: var(--bg);
}
.ds-han-wrap {
  width: 72px; height: 72px; border-radius: 16px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  background: var(--paper);
  flex-shrink: 0;
}
.ds-han { font-size: 34px; font-weight: 600; line-height: 1; }
.ds-ko { font-weight: 700; margin-right: 8px; }
.ds-el-badge {
  font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid;
}
.ds-trait { margin: 8px 0 0; color: var(--ink-soft); font-size: 14px; }

.pillar-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.pillar-col {
  text-align: center; padding: 12px 6px; border-radius: 14px; background: var(--bg);
}
.pillar-col--day { background: var(--sage-soft); }
.pillar-col--unknown { opacity: .55; }
.pillar-label { display: block; font-size: 11px; color: var(--ink-faint); margin-bottom: 6px; }
.pillar-han { display: block; font-size: 26px; font-weight: 600; line-height: 1.15; }
.pillar-ko { display: block; font-size: 12px; color: var(--ink-soft); }
.pillar-el-dot { display: none; }

.dw-timeline { display: grid; gap: 6px; }
.dw-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border-radius: 12px; background: var(--bg);
}
.dw-row--current { background: var(--sage-soft); }
.dw-age { font-size: 13px; color: var(--ink-soft); }
.dw-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.dw-ganzhi { font-weight: 700; font-size: 15px; }
.dw-el-tag { font-size: 11px; padding: 1px 6px; border: 1px solid; border-radius: 999px; }
.dw-now-badge { font-size: 11px; color: var(--sage-deep); font-weight: 700; }
.dw-year-range { font-size: 11px; color: var(--ink-faint); }

.five-bars { display: grid; gap: 10px; }
.five-row { display: grid; grid-template-columns: 52px 1fr 88px; gap: 10px; align-items: center; }
.five-label { display: flex; gap: 6px; align-items: baseline; }
.five-han { font-weight: 700; }
.five-ko { font-size: 12px; color: var(--ink-soft); }
.five-track { height: 8px; background: var(--bg-soft); border-radius: 99px; overflow: hidden; }
.five-fill { height: 100%; border-radius: 99px; }
.five-meta { display: flex; justify-content: flex-end; gap: 8px; font-size: 12px; }
.five-status { color: var(--ink-faint); }

.s-gauge-wrap { padding: 8px 0; }
.sg-track-row { display: grid; grid-template-columns: 36px 1fr 36px; gap: 10px; align-items: center; }
.sg-lbl { font-size: 11px; color: var(--ink-faint); }
.sg-track { position: relative; height: 8px; background: linear-gradient(90deg, #8aa9c8, var(--sand), #d08980); border-radius: 99px; }
.sg-track-fill { display: none; }
.sg-thumb {
  position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px var(--paper);
}
.sg-center-tick { text-align: center; font-size: 11px; color: var(--ink-faint); margin-top: 6px; }
.sg-result { display: flex; justify-content: center; gap: 10px; align-items: baseline; margin-top: 10px; }
.sg-type { font-weight: 700; }
.sg-score { color: var(--ink-soft); font-size: 13px; }

.wealth-canvas-wrap { height: 180px; }
.bpage-foot { text-align: center; margin-top: 12px; }

.bchap-header { margin-bottom: 18px; }
.bchap-num { display: block; font-size: 12px; letter-spacing: 0.16em; color: var(--sage); margin-bottom: 6px; }
.bchap-title { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 500; letter-spacing: -0.02em; }
.bchap-guide { margin: 10px 0 0; color: var(--ink-soft); font-size: 14px; }
.chapter-body { font-size: 15.5px; line-height: 1.85; color: var(--ink); }
.chapter-body h4 {
  margin: 28px 0 10px; font-size: 16px; letter-spacing: -0.02em;
}
.chapter-body p { margin: 0 0 14px; }
.chapter-body strong { font-weight: 650; }
.chapter-body table {
  width: 100%; border-collapse: collapse; margin: 12px 0 20px;
  font-size: 13px;
}
.chapter-body th, .chapter-body td {
  border: 1px solid var(--line-strong); padding: 8px 10px; text-align: center;
}
.chapter-body th { background: var(--bg); font-weight: 600; }

.soju-board { margin: 8px 0 22px; }
.soju-board-simple { display: flex; gap: 8px; }
.soju-row-labels-simple { display: grid; grid-template-rows: 42px 56px 56px; gap: 6px; width: 42px; }
.soju-rl-s { display: grid; place-items: center; font-size: 12px; color: var(--ink-faint); }
.soju-cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; flex: 1; }
.soju-col { text-align: center; }
.soju-col-head { height: 42px; display: grid; place-items: center; }
.soju-pillar-han { display: block; font-size: 12px; color: var(--sage); }
.soju-pillar-ko { font-size: 11px; color: var(--ink-faint); }
.soju-cell {
  height: 56px; display: grid; place-items: center;
  background: var(--bg); border-radius: 12px; font-size: 22px; font-weight: 600;
  margin-bottom: 6px;
}
.soju-day-col .soju-cell { background: var(--sage-soft); }
.soju-missing-col { opacity: .5; }

.lifemap-section { margin: 18px 0; }
.lifemap-cat-row { display: flex; gap: 8px; align-items: baseline; margin-bottom: 10px; }
.lifemap-cat-han { color: var(--sage); font-weight: 600; }
.lifemap-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lifemap-card { padding: 14px; border-radius: 14px; background: var(--bg); }
.lifemap-card--near { background: var(--sage-soft); }
.lifemap-card-tag { display: block; font-size: 11px; color: var(--ink-faint); margin-bottom: 6px; }
.lifemap-card-items { margin: 0 0 8px; font-weight: 600; }
.lifemap-card-note { margin: 0; font-size: 13px; color: var(--ink-soft); }

.book-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: 56px 1fr 56px 56px;
  gap: 6px; align-items: center;
  padding: 10px 14px calc(12px + var(--safe-b));
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.barrow {
  width: 44px; height: 44px; border-radius: 50%;
  color: var(--ink);
}
.barrow:disabled { opacity: .28; cursor: default; }
.bnav-mid { text-align: center; }
.bnav-label { display: block; font-size: 13px; font-weight: 600; }
.bnav-total { font-size: 11px; color: var(--ink-faint); }
.bnav-prog { height: 2px; background: var(--line-strong); border-radius: 99px; margin: 6px 0; }
.bnav-progbar { height: 100%; width: 0; background: var(--sage); border-radius: 99px; transition: width .3s var(--ease); }
.toc-toggle-btn { font-size: 12px; color: var(--sage-deep); }

.toc-backdrop {
  position: fixed; inset: 0; background: rgba(46,43,39,.28);
  opacity: 0; pointer-events: none; transition: opacity .25s;
  z-index: 50;
}
.toc-drawer {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-height: 72vh;
  background: var(--paper);
  border-radius: 22px 22px 0 0;
  transform: translateY(110%);
  transition: transform .35s var(--ease);
  z-index: 51;
  padding-bottom: var(--safe-b);
}
.toc-drawer.is-open { transform: none; }
.toc-backdrop.is-open { opacity: 1; pointer-events: auto; }
.toc-handle { display: flex; justify-content: center; padding: 10px 0 4px; }
.toc-handle-bar { width: 42px; height: 4px; border-radius: 99px; background: var(--line-strong); }
.toc-drawer-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 22px 14px;
}
.toc-head-han { color: var(--sage); margin-right: 8px; font-weight: 600; }
.toc-head-ko { font-weight: 700; }
.toc-head-sub { display: block; font-size: 12px; color: var(--ink-faint); }
.toc-list { overflow: auto; max-height: 52vh; padding: 0 12px 20px; }
.toc-item {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 12px; text-align: left;
}
.toc-item:hover, .toc-item--active { background: var(--bg); }
.toc-item-han { width: 28px; color: var(--sage); font-size: 13px; }
.toc-item-num { display: block; font-size: 11px; color: var(--ink-faint); }
.toc-item-name { font-size: 14px; }
.toc-item-arrow { margin-left: auto; color: var(--ink-faint); }

/* ── mypage ── */
.mp-wrap {
  width: min(560px, calc(100% - 40px));
  margin: 0 auto;
  padding: 40px 0 80px;
}
.mp-gate, .mp-body { }
.mp-gate { text-align: center; padding: 48px 0; }
.mp-gate-label { font-size: 12px; letter-spacing: 0.2em; color: var(--sage); }
.mp-gate-title { font-size: 26px; margin: 8px 0 10px; letter-spacing: -0.03em; }
.mp-gate-desc { color: var(--ink-soft); margin: 0 0 24px; }
.mp-profile {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; background: var(--paper); border-radius: 18px;
  margin-bottom: 22px;
}
.mp-profile img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--bg-soft); }
.mp-profile-info { flex: 1; min-width: 0; }
.mp-profile-eyebrow { display: block; font-size: 11px; color: var(--ink-faint); }
.mp-profile-name { font-size: 16px; }
.mp-logout-btn { font-size: 12px; color: var(--ink-faint); }
.mp-records-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mp-rc {
  width: 100%; text-align: left;
  padding: 16px 18px; border-radius: 16px; background: var(--paper);
  border: 1px solid var(--line);
}
.mp-rc-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-faint); margin-bottom: 6px; }
.mp-rc-name { font-weight: 700; margin-right: 8px; }
.mp-rc-birth { color: var(--ink-soft); font-size: 13px; }
.mp-rc-arrow { display: block; margin-top: 10px; font-size: 13px; color: var(--sage-deep); }
.mp-records-empty, .mp-error { color: var(--ink-soft); text-align: center; padding: 24px 0; }
.mp-new { margin-top: 18px; text-align: center; }

/* ── footer ── */
.site-footer {
  padding: 32px 20px calc(28px + var(--safe-b));
  color: var(--ink-faint); font-size: 12px; line-height: 1.7;
  text-align: center;
}
body.screen-intro .site-footer,
body.screen-loading .site-footer,
body.screen-result .site-footer { display: none; }
.site-footer a { text-decoration: underline; text-underline-offset: 2px; }

/* ── modal / toast ── */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(46,43,39,.32); }
.modal-card {
  position: relative; width: min(400px, calc(100% - 32px));
  background: var(--paper); border-radius: 20px; padding: 28px 24px 24px;
  box-shadow: var(--shadow);
}
.modal-close { position: absolute; top: 10px; right: 12px; font-size: 22px; color: var(--ink-faint); }
.modal-card h3 { margin: 0 0 8px; font-size: 18px; }
.modal-card p { margin: 0 0 18px; color: var(--ink-soft); font-size: 14px; }
.review-stars { display: flex; justify-content: center; gap: 6px; margin: 8px 0 16px; }
.review-star { font-size: 28px; color: var(--line-strong); }
.review-star.active { color: #D4A017; }
.review-textarea {
  width: 100%; min-height: 96px; border: 1px solid var(--line-strong);
  border-radius: 12px; padding: 12px; resize: vertical; margin-bottom: 10px;
}
.review-error { min-height: 18px; color: var(--danger); font-size: 13px; }
.review-actions { display: flex; gap: 8px; justify-content: flex-end; }
.app-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px);
  background: var(--ink); color: #FBF9F4; padding: 10px 16px; border-radius: 999px;
  font-size: 13px; opacity: 0; pointer-events: none; z-index: 90;
  transition: opacity .25s, transform .25s;
}
.app-toast.is-visible { opacity: 1; transform: translateX(-50%); }

.ajb {
  position: fixed; top: calc(var(--nav-h) + 8px); left: 50%; transform: translateX(-50%);
  width: min(480px, calc(100% - 24px));
  background: var(--paper); border-radius: 14px; padding: 12px 14px;
  box-shadow: var(--shadow); z-index: 45; font-size: 13px;
}
.ajb-close { float: right; color: var(--ink-faint); }

/* ── PC: 좁은 가운데 칼럼, 작은 스케일 ── */
@media (min-width: 900px) {
  :root {
    --nav-h: 56px;
    --col: 400px;
    --col-book: 480px;
  }

  .site-nav {
    padding: 0 max(24px, calc(50vw - (var(--col) / 2)));
  }
  body.screen-result .site-nav {
    padding: 0 max(24px, calc(50vw - (var(--col-book) / 2)));
  }
  .nav-brand-name { font-size: 14px; }
  .nav-link { font-size: 12px; padding: 6px 8px; }

  body.screen-survey .screen#screenSurvey,
  body.screen-existing .screen#screenExisting {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100svh;
    padding-top: var(--nav-h);
    box-sizing: border-box;
  }
  body.screen-mypage .screen#screenMypage {
    display: flex;
    justify-content: center;
    min-height: 100svh;
    box-sizing: border-box;
  }

  .survey-wrap,
  .notice-card,
  .load-inner,
  .mp-wrap {
    width: var(--col);
    max-width: var(--col);
    margin-left: auto;
    margin-right: auto;
  }
  .intro-stage {
    width: 520px;
    max-width: 520px;
  }

  .intro-kicker { font-size: 11px; margin-bottom: 20px; }
  .intro-text {
    font-size: 20px;
    line-height: 1.75;
  }
  .intro-actions.is-ready { margin-top: 32px; }
  .btn-primary {
    min-width: 148px;
    height: 42px;
    padding: 0 22px;
    font-size: 13px;
  }
  .btn-ghost { font-size: 12px; }

  .survey-wrap {
    padding: 0 0 24px;
    text-align: center;
  }
  .survey-progress { margin-bottom: 28px; }
  .survey-q { font-size: 22px; line-height: 1.45; }
  .survey-hint { font-size: 13px; margin-bottom: 22px; }
  .field {
    height: 44px;
    padding: 0 2px 8px;
    font-size: 18px;
  }
  textarea.field { height: 108px; padding: 4px 2px 8px; font-size: 14px; }
  .choice span { padding: 8px 4px; font-size: 14px; }
  .choice span em { font-size: 13px; }
  .choice span small { font-size: 11px; }
  .survey-nav {
    justify-content: center;
    margin-top: 22px;
  }
  .survey-nav .btn-primary { flex: 0 1 180px; }
  .btn-secondary { height: 42px; padding: 0 16px; font-size: 13px; }
  .kakao-login-btn { height: 46px; font-size: 14px; border-radius: 10px; }
  .login-note { font-size: 12px; }
  .confirm-list { text-align: left; font-size: 13px; }
  .notice-card { padding: 36px 28px; }
  .notice-card h1 { font-size: 20px; }
  .notice-card p { font-size: 13px; }

  .load-inner { padding: 80px 0 64px; }
  .load-title { font-size: 18px; }
  .load-phase { font-size: 13px; }
  .guide-card { padding: 16px 16px 14px; }
  .guide-card h3 { font-size: 14px; }
  .guide-card p { font-size: 13px; }

  .res-topbar {
    width: var(--col-book);
    margin: 0 auto;
    padding: 6px 0 8px;
  }
  .book-vp { padding: 4px 0 96px; }
  .bpi {
    width: var(--col-book);
    padding: 28px 28px 32px;
    border-radius: 18px;
  }
  .book-intro p { font-size: 14px; }
  .bm { margin: 0 0 24px; }
  .bm-head h2 { font-size: 15px; }
  .ds-han-wrap { width: 56px; height: 56px; }
  .ds-han { font-size: 26px; }
  .ds-trait { font-size: 13px; }
  .pillar-han { font-size: 20px; }
  .chapter-body { font-size: 14.5px; line-height: 1.8; }
  .bchap-title { font-size: 18px; }
  .bchap-guide { font-size: 13px; }
  .wealth-canvas-wrap { height: 150px; }

  .book-nav {
    left: 50%;
    right: auto;
    width: var(--col-book);
    transform: translateX(-50%);
    padding: 8px 10px 10px;
    border-radius: 16px 16px 0 0;
    background: var(--paper);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
  }
  .barrow { width: 36px; height: 36px; }
  .bnav-label { font-size: 12px; }

  .toc-drawer {
    left: 50%;
    right: auto;
    width: var(--col-book);
    transform: translateX(-50%) translateY(110%);
  }
  .toc-drawer.is-open { transform: translateX(-50%) translateY(0); }
  .toc-item { padding: 10px; }
  .toc-item-name { font-size: 13px; }

  .mp-wrap { padding: 36px 0 64px; }
  .mp-gate { padding: 24px 0; }
  .mp-gate-title { font-size: 22px; }
  .mp-gate-desc { font-size: 13px; }
  .site-footer { font-size: 11px; }
}

@media (max-width: 640px) {
  .choice-grid.cols-4 { gap: 2px 18px; }
  .bpi { padding: 28px 18px 32px; border-radius: 18px; }
  .lifemap-duo { grid-template-columns: 1fr; }
  .five-row { grid-template-columns: 44px 1fr 72px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
