/* ================================================================
   골목점집 사주팔자 — styles.css (프리미엄 다크 시네마틱 v2)
   hub-premium-spec.md §3 토큰 기반 전면 재작성
   app.js·readings-saju.js·manseryeok.mjs 로직 무변경 유지.
   ================================================================ */

/* ── 폰트 로드 ── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&family=Noto+Serif+KR:wght@400;700&display=swap');

/* ── CSS 변수 — 프리미엄 다크 토큰 ── */
:root {
  /* 배경 계층 */
  --bg-base:        #0D0D0D;
  --bg-card:        #1A1A1A;
  --bg-card-deep:   #161616;
  --bg-section:     #111111;
  --bg-input:       #222222;

  /* 브랜드 그린 */
  --color-forest:        #1B4A3C;
  --color-forest-mid:    #245F4E;
  --color-forest-bright: #4A9B82;
  --color-forest-glow:   rgba(27, 74, 60, 0.25);

  /* 앰버 (명식 포인트) */
  --color-amber:       #8B6914;
  --color-amber-glow:  rgba(139, 105, 20, 0.15);

  /* 텍스트 — 명암비 준수 (#0D0D0D 대비) */
  --text-primary:   #FAF9F5;         /* 약 19:1 */
  --text-secondary: rgba(250, 249, 245, 0.75); /* 약 14:1 */
  --text-tertiary:  rgba(250, 249, 245, 0.5);  /* 약 9:1 */
  --text-muted:     rgba(250, 249, 245, 0.3);  /* 보조용 */
  --text-green:     #4A9B82; /* 다크배경 위 그린 텍스트 — 약 5.2:1 AA */

  /* 테두리 */
  --border-subtle:  rgba(250, 249, 245, 0.08);
  --border-card:    rgba(27, 74, 60, 0.35);
  --border-active:  rgba(27, 74, 60, 0.75);

  /* 오행 색 — app.js 호환 변수명 유지 */
  --ohang-wood:   #6FBF8A;  /* 목(木) 글자색 — bg #1C3D2A 위 AA충족 */
  --ohang-fire:   #E0705A;  /* 화(火) 글자색 — bg #3D1C1C 위 AA충족 */
  --ohang-earth:  #C9A23A;  /* 토(土) 글자색 — bg #3A2E10 위 AA충족 */
  --ohang-metal:  #9BA8C0;  /* 금(金) 글자색 — bg #252830 위 AA충족 */
  --ohang-water:  #5B8DC9;  /* 수(水) 글자색 — bg #0F1E30 위 AA충족 */

  /* 오행 타일 배경 */
  --ohang-wood-bg:   #1C3D2A;
  --ohang-fire-bg:   #3D1C1C;
  --ohang-earth-bg:  #3A2E10;
  --ohang-metal-bg:  #252830;
  --ohang-water-bg:  #0F1E30;

  /* 카카오 */
  --kakao-yellow: #FEE500;
  --kakao-black:  #191919;

  /* 폰트 */
  --font-serif: 'Noto Serif KR', serif;
  --font-sans:  'Noto Sans KR', sans-serif;

  /* 타이포 스케일 */
  --text-xs:    10px;
  --text-sm:    12px;
  --text-base:  14px;
  --text-md:    15px;
  --text-lg:    17px;
  --text-xl:    20px;
  --text-2xl:   24px;
  --text-3xl:   30px;
  --text-hanja: 28px;

  /* 자간 */
  --tracking-hero:  -0.03em;
  --tracking-hanja:  0.08em;
  --tracking-label:  0.08em;

  /* 행간 */
  --leading-dialog: 2.2;
  --leading-body:   1.85;
  --leading-tight:  1.4;

  /* 모션 */
  --dur-fast:   150ms;
  --dur-normal: 300ms;
  --dur-slow:   600ms;
  --ease:       cubic-bezier(0.4, 0, 0.2, 1);

  /* 레거시 호환 (app.js에서 간접 참조될 수 있는 변수) */
  --color-forest-deep:  #12352A;
  --color-forest-tint:  rgba(27, 74, 60, 0.15);
  --color-coral:        #E07070;
  --color-text-muted:   rgba(250, 249, 245, 0.35);
  --color-amber-ink:    #8B6914;
  --shadow-glow-forest: 0 0 20px rgba(27, 74, 60, 0.3), 0 4px 16px rgba(27, 74, 60, 0.2);
  --shadow-glow-amber:  0 0 16px rgba(139, 105, 20, 0.2), 0 2px 12px rgba(139, 105, 20, 0.15);
  --shadow-input:       0 0 0 3px rgba(27, 74, 60, 0.25);
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  /* 컨테이너 */
  --container-max: 480px;
  --container-px:  20px;

  /* 레거시 bg 변수 — SPA 내 기존 코드 참조 가능성 */
  --color-bg-paper:       #0D0D0D;
  --color-bg-card:        #1A1A1A;
  --color-bg-section:     #111111;
  --color-text-primary:   #FAF9F5;
  --color-text-secondary: rgba(250, 249, 245, 0.75);
  --color-border-subtle:  rgba(250, 249, 245, 0.1);
  --color-border-section: rgba(250, 249, 245, 0.08);
  --color-nav-dark:       #0D0D0D;
  --color-forest-mid:     #245F4E;
}

/* ── 리셋 & 기본 ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: var(--leading-body);
  min-height: 100dvh;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input, select {
  font-family: inherit;
}

img {
  display: block;
  max-width: 100%;
}

/* ── 접근성 포커스 ── */
:focus-visible {
  outline: 2px solid #4A9B82;
  outline-offset: 2px;
}

/* ── 공통 헤더 (nav.js 삽입분) ── */
/* 기존 .site-header 클래스는 숨김 — nav.js의 .golmok-header가 대체 */
.site-header {
  display: none !important;
}

/* ── 페이지 히어로 ── */
.page-hero {
  position: relative;
  min-height: 240px;
  overflow: hidden;
  background: var(--bg-base);
}

.page-hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.35;
}

.page-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(13, 13, 13, 0.0) 0%,
    rgba(13, 13, 13, 0.95) 100%
  );
  z-index: 1;
}

.page-hero__content {
  position: absolute;
  bottom: 32px;
  left: 24px;
  z-index: 2;
}

.page-hero__title {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: var(--leading-tight);
}

.page-hero__title span {
  font-size: 0.6em;
  opacity: 0.75;
}

.page-hero__subtitle {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  color: rgba(250, 249, 245, 0.6);
  margin-top: 6px;
}

/* g3.png 페르소나 — 히어로 우측 삐져나옴 */
.page-hero__persona {
  position: absolute;
  right: 20px;
  bottom: -20px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(27, 74, 60, 0.5);
  z-index: 3;
}

/* ── 페르소나 첫 대사 (B-2) ── */
.persona-greeting {
  background: var(--bg-section);
  padding: 28px 24px 28px 80px;
  position: relative;
}

.persona-greeting__avatar {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(27, 74, 60, 0.5);
}

.persona-greeting__text {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 400;
  color: rgba(250, 249, 245, 0.9);
  line-height: var(--leading-dialog);
}

/* ── 메인 컨테이너 ── */
.page-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-px);
}

/* ── 섹션 공통 ── */
.section {
  padding: 32px 0;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 24px;
  display: none; /* 명세에는 제목 없이 바로 카드 시작 */
}

/* ── 입력 카드 ── */
.input-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 24px 20px;
}

/* 필드 그룹 */
.field-group {
  margin-bottom: 20px;
}

.field-label {
  display: block;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  color: rgba(250, 249, 245, 0.45);
  letter-spacing: var(--tracking-label);
  margin-bottom: 10px;
}

/* 성별 버튼 */
.gender-buttons {
  display: flex;
  gap: 10px;
}

.gender-btn {
  flex: 1;
  padding: 10px 0;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  background: var(--bg-input);
  color: rgba(250, 249, 245, 0.5);
  border: 1px solid rgba(27, 74, 60, 0.4);
  transition: background var(--dur-fast), color var(--dur-fast);
  cursor: pointer;
}

.gender-btn.selected,
.gender-btn[aria-pressed="true"] {
  background: var(--color-forest);
  color: var(--text-primary);
  border-color: var(--color-forest);
}

.gender-btn:hover:not(.selected):not([aria-pressed="true"]) {
  border-color: rgba(27, 74, 60, 0.7);
}

/* 생년월일 그리드 */
.date-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 8px;
}

/* 텍스트 입력 */
.text-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid rgba(27, 74, 60, 0.35);
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  -webkit-appearance: none;
  appearance: none;
}

.text-input::placeholder {
  color: rgba(250, 249, 245, 0.25);
  font-weight: 400;
  font-size: 14px;
}

.text-input:focus {
  outline: none;
  border-color: var(--color-forest);
  box-shadow: var(--shadow-input);
}

/* 시간 선택 드롭다운 */
.select-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid rgba(27, 74, 60, 0.35);
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='rgba(250,249,245,0.4)' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-color: var(--bg-input);
  padding-right: 36px;
}

.select-input option {
  background: var(--bg-input);
  color: var(--text-primary);
}

.select-input:focus {
  outline: none;
  border-color: var(--color-forest);
  box-shadow: var(--shadow-input);
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.5;
}

/* ── 계산 방식 안내 아코디언 ── */
.details-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 0;
  background: none;
  border: none;
  font-family: var(--font-sans);
  transition: color var(--dur-fast);
}

.details-toggle:hover {
  color: var(--text-green);
}

.details-toggle svg {
  transition: transform var(--dur-fast);
}

.details-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.details-content {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.65;
  padding: 12px 0 4px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 8px;
}

.details-content p {
  margin-bottom: 6px;
}

/* ── CTA 버튼 ── */
.btn-primary {
  display: block;
  width: 100%;
  padding: 16px 20px;
  background: var(--color-forest);
  color: var(--text-primary); /* #FAF9F5 on #1B4A3C — 약 9.2:1 AAA */
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
  margin-top: 16px;
}

.btn-primary:hover {
  background: var(--color-forest-mid);
}

.btn-primary:focus-visible {
  box-shadow: 0 0 0 3px rgba(27, 74, 60, 0.4);
}

/* ── 에러 메시지 ── */
.error-msg {
  color: #E07070;
  font-size: 13px;
  margin-top: 8px;
  display: none;
}

.error-msg.visible {
  display: block;
}

/* ── 결과 화면 ── */
#result-section {
  display: none;
  background: var(--bg-base);
}

#result-section.visible {
  display: block;
}

/* 결과 헤더 */
.result-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  padding: 20px 0 0;
}

.persona-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(27, 74, 60, 0.5);
}

.persona-fallback {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-forest);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.persona-fallback span {
  color: var(--text-primary);
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
}

.result-header-text h2 {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.result-header-text p {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── 명식 카드 ── */
.saju-card {
  background: var(--bg-card);
  border: 1.5px solid rgba(139, 105, 20, 0.5);
  border-radius: 14px;
  box-shadow: 0 0 24px rgba(139, 105, 20, 0.12);
  padding: 24px 16px;
  margin-bottom: 14px;
}

.saju-card-label {
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 400;
  color: rgba(139, 105, 20, 0.8);
  letter-spacing: var(--tracking-label);
  text-align: center;
  margin-bottom: 20px;
}

.saju-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

/* 명식 셀 — 기본 (오행 색은 JS에서 data-ohang으로 적용) */
.saju-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-section);
  border: 1px solid rgba(139, 105, 20, 0.2);
  border-radius: 8px;
  padding: 14px 8px;
  transition: transform var(--dur-fast);
}

/* 오행 색 타일 — JS에서 style 직접 적용(ohang-bg, ohang-text) 시 커버 */
.saju-cell.empty {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(250, 249, 245, 0.06);
  opacity: 0.5;
}

.pillar-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: var(--tracking-label);
  margin-bottom: 8px;
}

.pillar-tiangan {
  font-family: var(--font-serif);
  font-size: var(--text-hanja);
  letter-spacing: var(--tracking-hanja);
  line-height: 1;
  min-height: 1.75rem;
  color: rgba(139, 105, 20, 0.9);
}

.pillar-dizhi {
  font-family: var(--font-serif);
  font-size: var(--text-hanja);
  letter-spacing: var(--tracking-hanja);
  line-height: 1;
  margin-top: 6px;
  min-height: 1.75rem;
  color: var(--text-green);
}

.pillar-sipsong {
  font-family: var(--font-sans);
  font-size: 10px;
  color: rgba(250, 249, 245, 0.4);
  margin-top: 6px;
  text-align: center;
  min-height: 14px;
}

/* 명식 셀 등장 애니메이션 — saju-cell--reveal 클래스에서 처리 (app.js 2차)
   개별 span 애니메이션은 saju-cell--reveal에 통합. */

/* ── 오행 분포 카드 ── */
.ohang-card {
  background: var(--bg-card);
  border: 1px solid rgba(27, 74, 60, 0.3);
  border-radius: 14px;
  padding: 22px 18px;
  margin-bottom: 14px;
}

.ohang-card-title {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 700;
  color: rgba(250, 249, 245, 0.9);
  margin-bottom: 18px;
}

.ohang-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.ohang-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ohang-name {
  width: 32px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.ohang-hanja {
  width: 20px;
  font-family: var(--font-serif);
  font-size: 14px;
  flex-shrink: 0;
  text-align: center;
}

.ohang-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(250, 249, 245, 0.07);
  border-radius: 3px;
  overflow: hidden;
}

.ohang-bar-fill {
  height: 100%;
  border-radius: 3px;
  width: 0;
  transition: width 800ms ease-out;
  min-width: 3px;
}

.ohang-count {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  color: rgba(250, 249, 245, 0.35);
  width: 16px;
  text-align: right;
  flex-shrink: 0;
}

.ohang-note {
  font-size: 11px;
  color: rgba(250, 249, 245, 0.3);
  margin-top: 14px;
}

/* ── AI 복사 버튼 섹션 ── */
.copy-section {
  padding: 20px 0;
  margin-bottom: 8px;
}

.btn-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 18px;
  background: transparent;
  border: 1.5px solid rgba(27, 74, 60, 0.6);
  color: rgba(250, 249, 245, 0.7); /* 약 8:1 AAA on #111111 */
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast), color var(--dur-fast);
}

.btn-copy:hover {
  border-color: var(--color-forest);
  background: rgba(27, 74, 60, 0.15);
  color: var(--text-primary);
}

.btn-copy.copied {
  border-color: var(--text-green);
  color: var(--text-green);
}

.copy-hint {
  font-size: 11px;
  color: rgba(250, 249, 245, 0.3);
  text-align: center;
  margin-top: 8px;
}

/* ── 해석 섹션 ── */
.reading-card {
  background: var(--bg-section);
  border-radius: 14px;
  padding: 24px 20px;
  margin-bottom: 14px;
}

.reading-card-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.reading-block {
  margin-bottom: 0;
}

.reading-block + .reading-block {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(27, 74, 60, 0.2);
}

.reading-block-label {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-green);
  letter-spacing: var(--tracking-label);
  margin-bottom: 8px;
}

.reading-text {
  font-family: var(--font-sans);
  font-size: 15px;
  color: rgba(250, 249, 245, 0.82);
  line-height: var(--leading-body);
}

.reading-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.reading-list li {
  font-family: var(--font-sans);
  font-size: 15px;
  color: rgba(250, 249, 245, 0.75);
  line-height: var(--leading-body);
  padding-left: 14px;
  position: relative;
  margin-bottom: 4px;
}

.reading-list li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--text-green);
  font-weight: 700;
}

/* ── 면책 고지 ── */
.disclaimer-box {
  background: var(--bg-base);
  border-top: 1px solid rgba(250, 249, 245, 0.06);
  padding: 20px 24px;
  margin-bottom: 0;
}

.disclaimer-box p {
  font-family: var(--font-serif);
  font-size: 13px;
  color: rgba(250, 249, 245, 0.35);
  line-height: 1.9;
  margin-bottom: 6px;
}

.disclaimer-box p:last-child {
  margin-bottom: 0;
}

/* 기술 고지 */
.notice-lines {
  margin-top: 12px;
}

/* ── 공유·리드캡처 영역 ── */
.share-section {
  padding: 20px 0 32px;
}

/* 카카오 버튼 */
.btn-kakao {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 20px;
  background: var(--kakao-yellow);
  color: var(--kakao-black); /* #191919 on #FEE500 — 약 15:1 AAA */
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 10px;
  transition: opacity var(--dur-fast);
}

.btn-kakao:hover { opacity: 0.9; }

/* 공유 버튼 */
.btn-share {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 20px;
  background: transparent;
  border: 1px solid rgba(250, 249, 245, 0.15);
  color: rgba(250, 249, 245, 0.55); /* 약 7.2:1 AAA on #111111 */
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color var(--dur-fast), color var(--dur-fast);
}

.btn-share:hover {
  border-color: rgba(250, 249, 245, 0.3);
  color: var(--text-primary);
}

/* 다시 입력 버튼 */
.btn-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: rgba(250, 249, 245, 0.35);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color var(--dur-fast);
}

.btn-reset:hover { color: var(--text-secondary); }

/* ── 공통 핸드오프 푸터 ── */
.handoff-footer {
  background: var(--bg-base);
  border-top: 1px solid rgba(250, 249, 245, 0.06);
  padding: 48px 24px 40px;
  text-align: center;
}

.handoff-footer__inner {
  max-width: var(--container-max);
  margin: 0 auto;
}

.handoff-footer__label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 400;
  color: rgba(250, 249, 245, 0.3);
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.handoff-footer__title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.handoff-footer__sub {
  font-family: var(--font-sans);
  font-size: 14px;
  color: rgba(250, 249, 245, 0.55);
  line-height: 1.9;
  margin-top: 8px;
}

.btn-handoff {
  display: inline-block;
  padding: 15px 32px;
  background: var(--color-forest);
  color: var(--text-primary); /* #FAF9F5 on #1B4A3C — 약 9.2:1 AAA */
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  border-radius: 10px;
  text-decoration: none;
  margin-top: 24px;
  transition: background var(--dur-fast);
}

.btn-handoff:hover { background: var(--color-forest-mid); }

.btn-handoff:focus-visible {
  outline: 2px solid #4A9B82;
  outline-offset: 2px;
}

/* 핸드오프 로고 스탬프 */
.handoff-footer__logo {
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.handoff-logo-stamp {
  width: 56px;
  height: 56px;
  background: rgba(250, 249, 245, 0.05);
  border-radius: 50%;
  border: 1.5px solid rgba(250, 249, 245, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.handoff-logo-stamp span {
  color: rgba(250, 249, 245, 0.25);
  font-family: var(--font-serif);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.handoff-footer__mit {
  font-family: var(--font-sans);
  font-size: 10px;
  color: rgba(250, 249, 245, 0.15);
  margin-top: 20px;
}

/* ── 캐릭터 고지 ── */
.character-notice {
  font-family: var(--font-sans);
  font-size: 10px;
  color: rgba(250, 249, 245, 0.15);
  text-align: center;
  padding: 16px 20px;
  background: var(--bg-base);
}

/* ── 페이드인 애니메이션 ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeInUp 500ms var(--ease) both;
}

.fade-in-delay-1 { animation-delay: 100ms; }
.fade-in-delay-2 { animation-delay: 200ms; }
.fade-in-delay-3 { animation-delay: 300ms; }
.fade-in-delay-4 { animation-delay: 400ms; }

/* ── 로딩 스피너 ── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(250, 249, 245, 0.3);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

/* ── reduced-motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── 양력/음력 토글 (B-3) ── */
.calendar-toggle-wrap {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border: 1px solid rgba(27, 74, 60, 0.4);
  border-radius: 6px;
  overflow: hidden;
  width: fit-content;
}

.calendar-toggle-btn {
  padding: 8px 20px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  color: rgba(250, 249, 245, 0.4);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
  letter-spacing: 0.04em;
}

.calendar-toggle-btn.active,
.calendar-toggle-btn[aria-pressed="true"] {
  background: var(--color-forest);
  color: var(--text-primary);
}

.calendar-toggle-btn:hover:not(.active):not([aria-pressed="true"]) {
  color: rgba(250, 249, 245, 0.7);
}

/* 윤달 체크박스 래퍼 */
.leap-month-wrap {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  gap: 8px;
}

.leap-month-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: rgba(250, 249, 245, 0.65);
  cursor: pointer;
  user-select: none;
}

.leap-month-check {
  width: 16px;
  height: 16px;
  accent-color: var(--color-forest-bright);
  cursor: pointer;
}

/* ── 로딩 상태 (B-4 단계1) ── */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 40px 20px;
}

.loading-dots {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--text-primary);
  text-align: center;
  letter-spacing: 0.2em;
  animation: loadingPulse 1.2s ease-in-out infinite;
}

@keyframes loadingPulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 1; }
}

/* ── 페르소나 등장 대사 (B-4 단계2) ── */
.persona-intro-reveal {
  padding: 28px 24px;
  background: var(--bg-section);
}

.persona-intro-reveal__inner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  max-width: var(--container-max);
  margin: 0 auto;
}

.persona-reveal__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(27, 74, 60, 0.5);
  flex-shrink: 0;
}

.persona-reveal__lines {
  flex: 1;
}

.persona-reveal__line {
  font-family: var(--font-serif);
  font-size: 16px;
  color: rgba(250, 249, 245, 0.9);
  line-height: var(--leading-dialog);
  opacity: 0;
  animation: revealLine 400ms ease-out forwards;
}

.persona-reveal__line:nth-child(1) { animation-delay: 0ms; }
.persona-reveal__line:nth-child(2) { animation-delay: 300ms; }
.persona-reveal__line:nth-child(3) { animation-delay: 600ms; }

@keyframes revealLine {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── 명식 셀 stagger 등장 (B-4 단계3) ── */
.saju-cell--reveal {
  animation: cellReveal 350ms var(--ease) both;
  animation-fill-mode: both;
}

@keyframes cellReveal {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── 오행 색 타일 (B-5): 천간/지지 span에 JS에서 inline style 적용 ──
   pillar-tiangan / pillar-dizhi 기본 색 초기화 (오행 타일 적용 시 덮어씀) */
.saju-cell:not(.empty) .pillar-tiangan,
.saju-cell:not(.empty) .pillar-dizhi {
  /* 기본값: JS에서 오행 배경/텍스트 색이 inline style로 적용됨
     초기 색은 JS applyOhangTile() 이전 placeholder용 */
  color: rgba(139, 105, 20, 0.6);
}

/* ── 페르소나 리딩 섹션 (B-7) ── */
.persona-reading {
  background: var(--bg-section);
  padding: 32px 24px;
  margin-top: 20px;
  border-radius: 0;
}

.persona-reading__header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.persona-reading__avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(27, 74, 60, 0.6);
  flex-shrink: 0;
}

.persona-reading__dialog {
  font-family: var(--font-serif);
  font-size: 15px;
  color: rgba(250, 249, 245, 0.9);
  line-height: var(--leading-dialog);
  margin-bottom: 0;
}

.persona-reading__dialog + .persona-reading__dialog {
  margin-top: 2px;
}

.persona-reading__divider {
  height: 1px;
  background: rgba(27, 74, 60, 0.2);
  margin: 20px 0;
}

/* readings-saju.js 해석문 컨테이너 */
.persona-reading__interpretation {
  margin-bottom: 4px;
}

.persona-reading__interpretation p {
  font-family: var(--font-sans);
  font-size: 14px;
  color: rgba(250, 249, 245, 0.75);
  line-height: var(--leading-body);
  margin-bottom: 8px;
}

.persona-reading__interpretation p:last-child {
  margin-bottom: 0;
}

/* 클리프행어 대사 — 약간 늦은 등장 효과 */
.persona-reading__cliffhanger {
  color: rgba(250, 249, 245, 0.8);
}

/* ── 면책 고지 개선 (B-9) ── */
.disclaimer-persona {
  font-family: var(--font-serif);
  font-size: 13px;
  color: rgba(250, 249, 245, 0.35);
  line-height: 1.9;
  margin-bottom: 12px;
}

.disclaimer-tech {
  font-family: var(--font-sans);
  font-size: 11px;
  color: rgba(250, 249, 245, 0.2);
  margin-top: 12px;
  line-height: 1.7;
}

/* ── scroll-reveal (§4-4 IntersectionObserver) ──
   초기 상태는 JS에서 설정. CSS는 transition만 정의. */
.scroll-reveal {
  /* JS에서 opacity:0 + translateY(20px) + transition 설정 */
}

/* ── reduced-motion: translateY 제거 ── */
@media (prefers-reduced-motion: reduce) {
  .persona-reveal__line {
    animation: revealLineFade 400ms ease-out forwards;
  }
  @keyframes revealLineFade {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  .saju-cell--reveal {
    animation: cellRevealFade 350ms ease-out both;
  }
  @keyframes cellRevealFade {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
}

/* ── 핸드오프 푸터 페르소나 대사 스타일 ── */
.handoff-footer__persona-lines {
  margin-top: 10px;
}

/* ── 데스크탑 (760px+) ── */
@media (min-width: 760px) {
  :root {
    --container-max: 760px;
  }

  .page-hero {
    min-height: 300px;
  }

  .result-grid {
    display: grid;
    grid-template-columns: 55% 45%;
    gap: 24px;
    align-items: start;
  }
}
