/* ============================================================
 * 사주 페이지 — 신비로운 우주 디자인 (Cosmic Mystic)
 * 은하수 그라디언트 + 별빛 + 동양 전통 격자
 * ============================================================ */

/* 우주 배경 + 별빛 파티클 */
body:has(.saju-wrap) {
  /* 후기 반영: 색을 연하게 — 가독성 우선 */
  background:
    radial-gradient(ellipse at top, rgba(167, 139, 250, 0.10) 0%, transparent 55%),
    radial-gradient(ellipse at bottom right, rgba(236, 72, 153, 0.06) 0%, transparent 55%),
    radial-gradient(ellipse at bottom left, rgba(99, 102, 241, 0.06) 0%, transparent 55%),
    linear-gradient(180deg, #f5f3ff 0%, #ede9fe 50%, #f0e7ff 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: #1f1f3a;
  position: relative;
  overflow-x: hidden;
}
@media (prefers-color-scheme: dark) {
  body:has(.saju-wrap) {
    background:
      radial-gradient(ellipse at top, rgba(99, 102, 241, 0.12) 0%, transparent 55%),
      radial-gradient(ellipse at bottom right, rgba(236, 72, 153, 0.08) 0%, transparent 55%),
      radial-gradient(ellipse at bottom left, rgba(139, 92, 246, 0.08) 0%, transparent 55%),
      linear-gradient(180deg, #1a1530 0%, #261d3f 50%, #2d1d4a 100%);
    color: #f5f5fa;
  }
}

/* 별빛 파티클 — 라이트 모드에서는 거의 안 보이게, 다크 모드에서만 살짝 */
body:has(.saju-wrap)::before,
body:has(.saju-wrap)::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(167, 139, 250, 0.4), transparent),
    radial-gradient(1px 1px at 60% 70%, rgba(236, 72, 153, 0.3), transparent),
    radial-gradient(1.5px 1.5px at 80% 20%, rgba(99, 102, 241, 0.4), transparent),
    radial-gradient(1px 1px at 35% 80%, rgba(167, 139, 250, 0.3), transparent),
    radial-gradient(2px 2px at 90% 50%, rgba(236, 72, 153, 0.35), transparent),
    radial-gradient(1px 1px at 15% 60%, rgba(99, 102, 241, 0.3), transparent),
    radial-gradient(1.5px 1.5px at 50% 15%, rgba(167, 139, 250, 0.35), transparent),
    radial-gradient(1px 1px at 70% 90%, rgba(236, 72, 153, 0.25), transparent),
    radial-gradient(2px 2px at 25% 50%, rgba(99, 102, 241, 0.35), transparent),
    radial-gradient(1px 1px at 85% 75%, rgba(167, 139, 250, 0.3), transparent);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  opacity: 0.4;
  animation: twinkle 8s ease-in-out infinite alternate;
}
@media (prefers-color-scheme: dark) {
  body:has(.saju-wrap)::before,
  body:has(.saju-wrap)::after {
    background-image:
      radial-gradient(2px 2px at 20% 30%, white, transparent),
      radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,0.8), transparent),
      radial-gradient(1.5px 1.5px at 80% 20%, white, transparent),
      radial-gradient(1px 1px at 35% 80%, rgba(255,255,255,0.7), transparent),
      radial-gradient(2px 2px at 90% 50%, rgba(255,255,255,0.9), transparent),
      radial-gradient(1px 1px at 15% 60%, white, transparent),
      radial-gradient(1.5px 1.5px at 50% 15%, rgba(255,255,255,0.8), transparent),
      radial-gradient(1px 1px at 70% 90%, rgba(255,255,255,0.6), transparent),
      radial-gradient(2px 2px at 25% 50%, white, transparent),
      radial-gradient(1px 1px at 85% 75%, rgba(255,255,255,0.7), transparent);
    opacity: 0.6;
  }
}
body:has(.saju-wrap)::after {
  background-image:
    radial-gradient(1px 1px at 10% 25%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1.5px 1.5px at 45% 65%, white, transparent),
    radial-gradient(1px 1px at 75% 15%, rgba(255,255,255,0.8), transparent),
    radial-gradient(2px 2px at 30% 85%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 65% 45%, white, transparent),
    radial-gradient(1.5px 1.5px at 95% 35%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 5% 75%, rgba(255,255,255,0.5), transparent),
    radial-gradient(2px 2px at 55% 95%, white, transparent),
    radial-gradient(1px 1px at 40% 5%, rgba(255,255,255,0.8), transparent),
    radial-gradient(1.5px 1.5px at 85% 60%, rgba(255,255,255,0.6), transparent);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  opacity: 0.5;
  animation: twinkle 10s ease-in-out 1s infinite alternate;
}

@keyframes twinkle {
  0%   { opacity: 0.3; }
  50%  { opacity: 0.9; }
  100% { opacity: 0.4; }
}

.saju-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 0 36px;
  position: relative;
  z-index: 1;
}
@media (min-width: 481px) {
  .saju-wrap { padding: 24px 16px 60px; }
}
/* 대장님 명령: 모바일 누적 padding 폐단 — 외곽 컨테이너만 적게,
   카드 자체에 좌우 padding을 부여 (중첩 컨테이너 padding 누적 방지) */
@media (max-width: 480px) {
  .saju-wrap > .saju-card,
  .saju-wrap > .saju-screen > .saju-card { padding: 14px 12px !important; }
  .saju-wrap .feature-section { padding-left: 0 !important; padding-right: 0 !important; }
  .saju-wrap .feature-section--love-main { padding: 12px 12px 4px !important; }
  .saju-wrap .feature-card { padding: 12px 14px !important; }
  .saju-wrap .saju-extra-fortunes[open] { padding: 0 8px 8px !important; }
}

/* 라이트 카드 — 가독성 우선 (후기 반영) */
.saju-wrap .saju-card {
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  border: 1px solid rgba(167, 139, 250, 0.20) !important;
  box-shadow:
    0 12px 36px rgba(99, 102, 241, 0.10),
    inset 0 0 0 1px rgba(167, 139, 250, 0.08) !important;
  color: #2d2d4a;
}
.saju-wrap .saju-card p,
.saju-wrap .saju-card li,
.saju-wrap .saju-card div:not(.saju-title):not(.saju-icon-big) {
  color: #2d2d4a;
}
@media (prefers-color-scheme: dark) {
  .saju-wrap .saju-card {
    background: rgba(30, 22, 55, 0.78) !important;
    border: 1px solid rgba(167, 139, 250, 0.25) !important;
    color: #f0f0ff;
    box-shadow:
      0 16px 50px rgba(0, 0, 0, 0.45),
      inset 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
  }
  .saju-wrap .saju-card p,
  .saju-wrap .saju-card li,
  .saju-wrap .saju-card div:not(.saju-title):not(.saju-icon-big) {
    color: #f0f0ff;
  }
}

/* 황금 액센트 글로우 타이틀 */
.saju-wrap .saju-title {
  color: #fff;
  text-shadow:
    0 0 20px rgba(217, 180, 74, 0.4),
    0 0 40px rgba(167, 139, 250, 0.3);
  background: linear-gradient(135deg, #fbbf24 0%, #ec4899 50%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.saju-wrap .saju-subtitle {
  color: rgba(240, 240, 255, 0.75);
}

.saju-wrap .saju-icon-big {
  filter: drop-shadow(0 0 24px rgba(167, 139, 250, 0.6));
  animation: cosmic-float 4s ease-in-out infinite;
}

@keyframes cosmic-float {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-8px) rotate(3deg); }
}

/* 입력 폼 다크 톤 */
.saju-wrap .saju-form input[type="text"],
.saju-wrap .saju-form input[type="number"],
.saju-wrap .saju-form select {
  background: rgba(10, 5, 25, 0.7) !important;
  border-color: rgba(167, 139, 250, 0.3) !important;
  color: #f0f0ff !important;
}
.saju-wrap .saju-form input:focus,
.saju-wrap .saju-form select:focus {
  border-color: #a78bfa !important;
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.25) !important;
}
.saju-wrap .saju-form label {
  color: rgba(240, 240, 255, 0.85) !important;
}
.saju-wrap .gender-opt {
  background: rgba(10, 5, 25, 0.6) !important;
  border-color: rgba(167, 139, 250, 0.3) !important;
  color: #f0f0ff !important;
}
.saju-wrap .gender-opt:has(input:checked) {
  background: linear-gradient(135deg, #a78bfa, #ec4899) !important;
  border-color: #a78bfa !important;
}

/* 우주적 제출 버튼 */
.saju-wrap .saju-submit {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%) !important;
  box-shadow:
    0 8px 32px rgba(167, 139, 250, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset !important;
  position: relative;
  overflow: hidden;
}
.saju-wrap .saju-submit::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.2) 50%, transparent 70%);
  animation: shimmer 3s linear infinite;
}
@keyframes shimmer {
  to { transform: translate(50%, 50%); }
}

/* 8자 그리드 — 동양 전통 격자 + 글로우 */
.saju-wrap .bazi-grid {
  background:
    repeating-linear-gradient(0deg, rgba(217, 180, 74, 0.05) 0, rgba(217, 180, 74, 0.05) 1px, transparent 1px, transparent 12px),
    repeating-linear-gradient(90deg, rgba(217, 180, 74, 0.05) 0, rgba(217, 180, 74, 0.05) 1px, transparent 1px, transparent 12px);
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(217, 180, 74, 0.15);
}

.saju-wrap .bazi-cell {
  background: linear-gradient(180deg, rgba(167, 139, 250, 0.12), rgba(167, 139, 250, 0.04)) !important;
  border: 1px solid rgba(167, 139, 250, 0.2) !important;
  position: relative;
  overflow: hidden;
}

.saju-wrap .bazi-cell.day-master {
  background: linear-gradient(180deg, rgba(217, 180, 74, 0.25), rgba(236, 72, 153, 0.1)) !important;
  border-color: rgba(217, 180, 74, 0.5) !important;
  box-shadow:
    0 0 24px rgba(217, 180, 74, 0.4),
    0 0 0 1px rgba(217, 180, 74, 0.3) inset !important;
  animation: dm-pulse 3s ease-in-out infinite;
}
@keyframes dm-pulse {
  0%, 100% { box-shadow: 0 0 24px rgba(217, 180, 74, 0.4), 0 0 0 1px rgba(217, 180, 74, 0.3) inset; }
  50%      { box-shadow: 0 0 36px rgba(217, 180, 74, 0.6), 0 0 0 1px rgba(217, 180, 74, 0.5) inset; }
}

.saju-wrap .bazi-cell .heaven {
  text-shadow: 0 0 12px currentColor;
  font-size: 1.7rem !important;
}
.saju-wrap .bazi-cell .pillar-label {
  color: rgba(240, 240, 255, 0.6);
}

/* 일간 메인 박스 — 황금 빛 */
.saju-wrap .day-master-box {
  background: linear-gradient(135deg, rgba(217, 180, 74, 0.1), rgba(167, 139, 250, 0.08)) !important;
  border: 1px solid rgba(217, 180, 74, 0.25) !important;
  position: relative;
}
.saju-wrap .day-master-box .dm-icon {
  filter: drop-shadow(0 0 16px rgba(217, 180, 74, 0.6));
}
.saju-wrap .day-master-box .dm-name {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #ec4899 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.saju-wrap .day-master-box .dm-tagline {
  color: rgba(217, 180, 74, 0.85);
}

/* 5행 차트 — 다크 톤 */
.saju-wrap .element-bar .e-track {
  background: rgba(255, 255, 255, 0.06);
}
.saju-wrap .elements-comment {
  background: rgba(20, 12, 40, 0.5) !important;
  color: rgba(240, 240, 255, 0.85);
}

/* 결합/환경/MBTI 카드들 다크 톤 */
.saju-wrap .env-advice-section {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(167, 139, 250, 0.08)) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}
.saju-wrap .mbti-advice-section {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}
.saju-wrap .feature-card {
  background: rgba(20, 12, 40, 0.5) !important;
  border-color: rgba(167, 139, 250, 0.2) !important;
  color: rgba(240, 240, 255, 0.92);
}
.saju-wrap .career-card { background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(99,102,241,0.06)) !important; }
.saju-wrap .wealth-card { background: linear-gradient(135deg, rgba(245,158,11,0.18), rgba(234,88,12,0.08)) !important; }
.saju-wrap .health-card { background: linear-gradient(135deg, rgba(16,185,129,0.18), rgba(5,150,105,0.08)) !important; }
.saju-wrap .love-card   { background: linear-gradient(135deg, rgba(236,72,153,0.2), rgba(244,63,94,0.08)) !important; }
.saju-wrap .year-card   { background: linear-gradient(135deg, rgba(167,139,250,0.2), rgba(124,58,237,0.08)) !important; }

.saju-wrap .ten-god-card {
  background: rgba(20, 12, 40, 0.5) !important;
  border-color: rgba(167, 139, 250, 0.2) !important;
  color: rgba(240, 240, 255, 0.85);
}
.saju-wrap .tg-name { color: #fbbf24 !important; }

/* 디스클레이머 톤 */
.saju-wrap .disclaimer {
  background: rgba(245, 158, 11, 0.1) !important;
  color: rgba(240, 240, 255, 0.65);
}

/* 푸터 */
.saju-wrap .saju-footer {
  border-top-color: rgba(167, 139, 250, 0.15) !important;
}
.saju-wrap .footer-nav { color: rgba(240, 240, 255, 0.6); }
.saju-wrap .footer-copy { color: rgba(240, 240, 255, 0.4); }

/* 광고 슬롯 톤 다운 */
.saju-wrap .ad-slot {
  background: rgba(20, 12, 40, 0.4) !important;
  border-color: rgba(167, 139, 250, 0.15) !important;
}

/* ============================================================
 * 🔮 사주 소개 섹션 — 비중 있는 콘텐츠 + 사료
 * ============================================================ */
.saju-intro-card {
  margin-bottom: 24px;
  padding: 36px 28px !important;
}

.intro-section-title {
  font-size: 1.6rem;
  font-weight: 900;
  text-align: center;
  margin-bottom: 28px;
  background: linear-gradient(135deg, #fbbf24 0%, #ec4899 50%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(217, 180, 74, 0.3);
  letter-spacing: -0.01em;
  word-break: keep-all;
}

.intro-block {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(167, 139, 250, 0.12);
}

.intro-block:last-of-type {
  border-bottom: none;
  margin-bottom: 16px;
}

.intro-block h3 {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 10px;
  color: #fbbf24;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.3);
  word-break: keep-all;
}

.intro-block p {
  font-size: 0.95rem;
  line-height: 1.75;
  color: rgba(240, 240, 255, 0.88);
  word-break: keep-all;
  margin: 0;
}

.intro-block p strong {
  color: #fbbf24;
  font-weight: 800;
}

/* 사료 박스 — 한자 격자 패턴 강조 */
.intro-sources {
  background:
    repeating-linear-gradient(0deg, rgba(217, 180, 74, 0.04) 0, rgba(217, 180, 74, 0.04) 1px, transparent 1px, transparent 16px),
    repeating-linear-gradient(90deg, rgba(217, 180, 74, 0.04) 0, rgba(217, 180, 74, 0.04) 1px, transparent 1px, transparent 16px),
    rgba(20, 12, 40, 0.4);
  border-radius: 14px;
  padding: 18px 20px;
  border: 1px solid rgba(217, 180, 74, 0.2);
  margin-bottom: 24px;
}

.intro-sources h3 { margin-bottom: 12px; }

.intro-sources ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.intro-sources li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 10px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: rgba(240, 240, 255, 0.82);
  word-break: keep-all;
}

.intro-sources li::before {
  content: '📜';
  position: absolute;
  left: 0;
  top: 1px;
  font-size: 0.95rem;
  filter: sepia(0.3) hue-rotate(-20deg);
}

/* 학술 검증 박스 — 신뢰 강조 */
.intro-academic {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.06));
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 24px;
}

.intro-academic h3 { color: #c4b5fd; margin-bottom: 10px; }
.intro-academic p { color: rgba(240, 240, 255, 0.92); }

/* 본 서비스의 자세 — 약간 톤 다운 */
.intro-stance {
  background: rgba(245, 158, 11, 0.05);
  border-left: 3px solid #f59e0b;
  border-radius: 0 12px 12px 0;
  padding: 14px 18px;
  margin-bottom: 24px;
}

.intro-stance h3 {
  color: #fbbf24;
  margin-bottom: 8px;
  font-size: 1rem;
}

.intro-stance p {
  font-size: 0.88rem;
  color: rgba(240, 240, 255, 0.78);
}

/* CTA — 액션으로 자연스럽게 유도 */
.intro-cta {
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: #fbbf24;
  margin-top: 16px;
  padding: 16px;
  background: rgba(251, 191, 36, 0.08);
  border-radius: 12px;
  border: 1px dashed rgba(251, 191, 36, 0.3);
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.2);
}

@media (max-width: 600px) {
  .saju-intro-card { padding: 28px 20px !important; }
  .intro-section-title { font-size: 1.35rem; margin-bottom: 22px; }
  .intro-block h3 { font-size: 0.9rem; }
  .intro-block p { font-size: 0.9rem; }
}

/* ============================================================
 * 📚 사주 라이브러리 + 💞 궁합 화면
 * ============================================================ */
.saju-lib-btn {
  background: linear-gradient(135deg, rgba(217, 180, 74, 0.2), rgba(167, 139, 250, 0.15));
  color: #fbbf24;
  border: 1px solid rgba(217, 180, 74, 0.35);
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  text-shadow: 0 0 8px rgba(217, 180, 74, 0.3);
}
.saju-lib-btn:hover {
  background: linear-gradient(135deg, rgba(217, 180, 74, 0.35), rgba(167, 139, 250, 0.25));
  transform: translateY(-1px);
}

/* 라이브러리 헤더 */
.lib-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}
.lib-title {
  font-size: 1.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #fbbf24, #ec4899, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lib-back-btn {
  background: rgba(167, 139, 250, 0.15);
  color: #c4b5fd;
  border: 1px solid rgba(167, 139, 250, 0.3);
  padding: 6px 14px;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
}
.lib-back-btn:hover { background: rgba(167, 139, 250, 0.3); }

.lib-subtitle {
  color: rgba(240, 240, 255, 0.7);
  font-size: 0.9rem;
  margin-bottom: 18px;
  word-break: keep-all;
}

/* 모드 토글 */
.lib-mode-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  background: rgba(20, 12, 40, 0.5);
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(167, 139, 250, 0.2);
}
.lib-mode-btn {
  flex: 1;
  background: transparent;
  color: rgba(240, 240, 255, 0.7);
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.2s ease;
}
.lib-mode-btn.active {
  background: linear-gradient(135deg, #6366f1, #ec4899);
  color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

/* 카드 그리드 */
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.lib-card {
  background: rgba(20, 12, 40, 0.55);
  border: 1px solid rgba(167, 139, 250, 0.25);
  border-radius: 16px;
  padding: 18px 16px;
  cursor: default;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lib-card:hover {
  background: rgba(30, 18, 60, 0.7);
  border-color: rgba(217, 180, 74, 0.35);
  transform: translateY(-2px);
}

.lib-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.lib-card-icon { font-size: 1.6rem; }
.lib-card-label {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fbbf24;
}

.lib-card-row {
  font-size: 0.92rem;
  color: rgba(240, 240, 255, 0.85);
}

.lib-mbti-badge {
  display: inline-block;
  background: rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.lib-card-date {
  font-size: 0.75rem;
  color: rgba(240, 240, 255, 0.5);
}

.lib-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.lib-card-btn {
  background: rgba(167, 139, 250, 0.2);
  color: #f0f0ff;
  border: 1px solid rgba(167, 139, 250, 0.3);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.15s;
}
.lib-card-btn:hover { background: rgba(167, 139, 250, 0.35); }
.lib-card-view { flex: 1; }
.lib-card-del { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.3); }
.lib-card-del:hover { background: rgba(239, 68, 68, 0.3); }

/* 궁합 모드 체크박스 카드 */
.lib-card-check {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(167, 139, 250, 0.15);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  color: #f0f0ff;
}
.lib-card-check.selected {
  background: linear-gradient(135deg, #ec4899, #a78bfa);
  color: white;
  border-color: #ec4899;
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.4);
}
.lib-card-check input { accent-color: #ec4899; }

/* 빈 상태 */
.lib-empty {
  text-align: center;
  padding: 60px 20px;
  display: none;
}
.lib-empty-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  opacity: 0.7;
}
.lib-empty p {
  color: rgba(240, 240, 255, 0.6);
  font-size: 0.95rem;
  word-break: keep-all;
}

/* 궁합 보기 액션 */
.lib-compat-action {
  margin-top: 24px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.15), rgba(167, 139, 250, 0.1));
  border: 1px solid rgba(236, 72, 153, 0.3);
  border-radius: 16px;
  text-align: center;
}
.lib-selected-count {
  margin-top: 10px;
  color: rgba(240, 240, 255, 0.75);
  font-size: 0.88rem;
}
.lib-compat-action .primary-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================================
 * 💾 라이브러리 저장 (결과 페이지)
 * ============================================================ */
.save-to-library {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(167, 139, 250, 0.06));
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 16px;
  padding: 18px 20px;
  margin: 24px 0;
}
.save-to-library .result-section-title {
  margin-bottom: 6px !important;
  color: #fbbf24 !important;
}
.save-desc {
  font-size: 0.88rem;
  color: rgba(240, 240, 255, 0.75);
  margin-bottom: 14px;
}
.save-row {
  display: flex;
  gap: 10px;
}
.save-row input {
  flex: 1;
  padding: 10px 14px;
  background: rgba(10, 5, 25, 0.7);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 10px;
  color: #f0f0ff;
  font-size: 0.95rem;
  font-family: inherit;
}
.save-row input:focus {
  outline: none;
  border-color: #fbbf24;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2);
}
.save-row .primary-btn {
  width: auto;
  padding: 10px 22px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
  color: #000 !important;
  font-weight: 800;
}
.save-status {
  margin-top: 10px;
  font-size: 0.88rem;
  font-weight: 700;
}

/* ============================================================
 * 💞 궁합 결과 화면
 * ============================================================ */
.compat-card { padding: 32px 24px !important; }

.compat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 8px;
}
.compat-title {
  font-size: 1.4rem;
  font-weight: 900;
  background: linear-gradient(135deg, #ec4899, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* 두 사람 카드 */
.compat-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
  position: relative;
}
.compat-pair::after {
  content: '💞';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.6rem;
  filter: drop-shadow(0 0 12px rgba(236, 72, 153, 0.6));
  z-index: 2;
  background: rgba(20, 12, 40, 0.9);
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(236, 72, 153, 0.4);
}

.compat-person-card {
  background: rgba(20, 12, 40, 0.6);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 16px;
  padding: 18px 14px;
  text-align: center;
}
.compat-person-card .cp-icon { font-size: 2.5rem; line-height: 1; margin-bottom: 6px; }
.compat-person-card .cp-name { font-size: 1.1rem; font-weight: 800; color: #fbbf24; margin-bottom: 4px; }
.compat-person-card .cp-dm { font-size: 0.85rem; color: rgba(240, 240, 255, 0.75); }
.compat-person-card .cp-mbti {
  display: inline-block;
  margin-top: 8px;
  background: rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

/* 종합 점수 카드 */
.compat-score-card {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(236, 72, 153, 0.1));
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 18px;
  padding: 28px 20px;
  text-align: center;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.compat-score-num {
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, #fbbf24, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 24px rgba(251, 191, 36, 0.4);
}
.compat-stars {
  font-size: 1.8rem;
  color: #fbbf24;
  letter-spacing: 4px;
  margin: 8px 0;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.5);
}
.compat-score-label {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fbbf24;
}

/* 분석 섹션 */
.compat-section {
  background: rgba(20, 12, 40, 0.5);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 14px;
}
.compat-section h3 {
  font-size: 1rem;
  font-weight: 800;
  color: #fbbf24;
  margin-bottom: 10px;
}
.compat-section p {
  font-size: 0.93rem;
  line-height: 1.7;
  color: rgba(240, 240, 255, 0.88);
  word-break: keep-all;
}

/* 결론 */
.compat-conclusion {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.18), rgba(236, 72, 153, 0.1));
  border: 1px solid rgba(167, 139, 250, 0.4);
  border-radius: 16px;
  padding: 22px 22px;
  margin: 20px 0;
}
.compat-conclusion h3 {
  color: #c4b5fd;
  font-size: 1.1rem;
  font-weight: 900;
  margin-bottom: 10px;
}
.compat-conclusion p {
  font-size: 1rem;
  line-height: 1.75;
  color: #fff;
  font-weight: 500;
  word-break: keep-all;
}

@media (max-width: 600px) {
  .compat-pair { grid-template-columns: 1fr 1fr; gap: 8px; }
  .compat-pair::after { font-size: 1.3rem; width: 32px; height: 32px; }
  .compat-person-card { padding: 14px 10px; }
  .compat-person-card .cp-icon { font-size: 2rem; }
  .compat-score-num { font-size: 2.4rem; }
  .compat-stars { font-size: 1.5rem; }
  .save-row { flex-direction: column; }
  .save-row .primary-btn { width: 100%; }
  .lib-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .lib-card { padding: 14px 12px; }
  .lib-card-icon { font-size: 1.4rem; }
  .lib-card-label { font-size: 0.95rem; }
}

/* ============================================================
 * MBTI 직접 입력 + MBTI-only 친구 등록
 * ============================================================ */
.saju-wrap .saju-form #sj-mbti-pick {
  background: rgba(10, 5, 25, 0.7) !important;
  border: 1px solid rgba(167, 139, 250, 0.4) !important;
  color: #f0f0ff !important;
}
.saju-mbti-hint {
  font-size: 0.78rem;
  color: rgba(240, 240, 255, 0.6);
  margin-top: 4px;
  font-style: italic;
}

.lib-add-mbti-btn {
  width: 100%;
  background: rgba(167, 139, 250, 0.15);
  color: #c4b5fd;
  border: 1px dashed rgba(167, 139, 250, 0.4);
  border-radius: 14px;
  padding: 12px 18px;
  margin-bottom: 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  transition: all 0.2s ease;
}
.lib-add-mbti-btn:hover {
  background: rgba(167, 139, 250, 0.28);
  border-color: rgba(167, 139, 250, 0.7);
  transform: translateY(-1px);
}

.lib-card--mbti-only {
  border-color: rgba(139, 92, 246, 0.4) !important;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(99, 102, 241, 0.08)) !important;
}

.lib-card-onlymark {
  display: inline-block;
  background: rgba(139, 92, 246, 0.4);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: auto;
}

/* MBTI-only 등록 모달 */
.mbti-only-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px);
}
.mbti-only-content {
  background: linear-gradient(180deg, #1a1033 0%, #2a0a3e 100%);
  border: 1px solid rgba(167, 139, 250, 0.35);
  border-radius: 24px;
  padding: 32px 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.mbti-only-title {
  font-size: 1.3rem;
  font-weight: 900;
  background: linear-gradient(135deg, #fbbf24, #ec4899, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
  text-align: center;
}
.mbti-only-desc {
  font-size: 0.88rem;
  color: rgba(240, 240, 255, 0.72);
  text-align: center;
  margin-bottom: 20px;
  word-break: keep-all;
}
.mbti-only-form { display: flex; flex-direction: column; gap: 12px; }
.mbti-only-form label {
  font-weight: 700;
  font-size: 0.85rem;
  color: rgba(240, 240, 255, 0.85);
  margin-bottom: 4px;
}
.mbti-only-form input,
.mbti-only-form select {
  width: 100%;
  padding: 12px 14px;
  background: rgba(10, 5, 25, 0.7);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 10px;
  color: #f0f0ff;
  font-size: 0.95rem;
  font-family: inherit;
}
.mbti-only-form input:focus,
.mbti-only-form select:focus {
  outline: none;
  border-color: #a78bfa;
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.25);
}
.mbti-only-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.mbti-only-actions .secondary-btn,
.mbti-only-actions .primary-btn {
  flex: 1;
  padding: 12px 18px !important;
}

/* 사주 정보 없는 경우 안내 */
.compat-no-dm-notice {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(236, 72, 153, 0.1));
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 14px;
  padding: 18px 20px;
  text-align: center;
}
.compat-no-dm-notice h3 {
  color: #c4b5fd !important;
  margin-bottom: 8px;
}
.compat-no-dm-notice p {
  font-size: 0.92rem;
  color: rgba(240, 240, 255, 0.85);
  word-break: keep-all;
}

.saju-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 4px 110px 4px 0; /* 우측 lang-switcher 공간 확보 */
}
@media (max-width: 480px) {
  .saju-header {
    padding-right: 80px; /* 모바일에선 lang-switcher가 더 작음 */
    flex-wrap: wrap;
    gap: 6px;
  }
  .saju-header .brand-row {
    font-size: 0.88rem;
  }
  .saju-lib-btn {
    font-size: 0.76rem;
    padding: 5px 10px;
  }
  .saju-back {
    font-size: 0.8rem;
    padding: 5px 10px;
  }
}

.saju-back {
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}
.saju-back:hover { background: rgba(0, 0, 0, 0.75); }

.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 0.95rem;
}
.brand-mark { font-size: 1.3rem; }

.saju-screen { display: none; animation: fadeIn 0.4s ease-out forwards; }
.saju-screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.saju-card {
  background: var(--card-bg, rgba(255, 255, 255, 0.7));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.5));
  border-radius: 24px;
  padding: 36px 24px;
  box-shadow: var(--shadow);
}

.saju-icon-big {
  font-size: 4rem;
  text-align: center;
  margin-bottom: 8px;
}

.saju-title {
  font-size: 1.6rem;
  font-weight: 900;
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  word-break: keep-all;
}

.saju-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 28px;
  line-height: 1.6;
  word-break: keep-all;
}

/* ===== 입력 폼 ===== */
.saju-form { display: flex; flex-direction: column; gap: 16px; }

.saju-form label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: var(--text);
}

.saju-form input[type="text"],
.saju-form input[type="number"],
.saju-form select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
}

.saju-form input:focus,
.saju-form select:focus {
  outline: none;
  border-color: var(--primary, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

.gender-pick {
  display: flex; gap: 8px; margin-top: 4px;
}
.gender-opt {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.6);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all 0.15s ease;
}
.gender-opt:has(input:checked) {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: white;
  border-color: var(--primary);
}
.gender-opt input { display: none; }

.saju-note {
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 4px 0;
}

.saju-submit {
  background: linear-gradient(135deg, var(--primary, #6366f1), #8b5cf6);
  color: white;
  border: none;
  padding: 16px 24px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
  font-family: inherit;
  margin-top: 8px;
}
.saju-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.5);
}

.saju-privacy-note {
  font-size: 0.78rem;
  color: var(--text-light);
  text-align: center;
  margin-top: 8px;
  line-height: 1.5;
}
.saju-privacy-note a { color: var(--primary); text-decoration: underline; }

/* ===== 결과 화면 ===== */
.result-greeting {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  margin-bottom: 18px;
}

.result-greeting strong {
  background: linear-gradient(135deg, var(--primary), #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 900;
}

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

.bazi-cell {
  background: linear-gradient(180deg, rgba(99,102,241,0.08), rgba(236,72,153,0.04));
  border: 1px solid rgba(99,102,241,0.18);
  border-radius: 14px;
  padding: 14px 6px;
  text-align: center;
}

.bazi-cell .pillar-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: 1px;
}
.bazi-cell .heaven {
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 4px;
}
.bazi-cell .earth {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-muted);
}

/* 일간(메인) 강조 */
.bazi-cell.day-master {
  background: linear-gradient(180deg, rgba(236,72,153,0.18), rgba(99,102,241,0.1));
  border-color: rgba(236,72,153,0.4);
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(236,72,153,0.2);
}

.bazi-cell.day-master .pillar-label { color: #ec4899; }

/* 오행 색상 */
.element-mok  .heaven, .element-mok  .earth { color: #16a34a; } /* 목·녹색 */
.element-hwa  .heaven, .element-hwa  .earth { color: #dc2626; } /* 화·빨강 */
.element-to   .heaven, .element-to   .earth { color: #ca8a04; } /* 토·황 */
.element-geum .heaven, .element-geum .earth { color: #6b7280; } /* 금·회 */
.element-su   .heaven, .element-su   .earth { color: #2563eb; } /* 수·파 */

/* ===== 일간 풀이 박스 ===== */
.day-master-box {
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(236,72,153,0.05));
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 18px;
  padding: 24px 22px;
  margin-bottom: 24px;
}

.day-master-box .dm-icon {
  font-size: 2.8rem;
  text-align: center;
  margin-bottom: 6px;
}
.day-master-box .dm-name {
  font-size: 1.6rem;
  font-weight: 900;
  text-align: center;
  margin-bottom: 4px;
  background: linear-gradient(135deg, var(--primary), #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.day-master-box .dm-tagline {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-style: italic;
}
.day-master-box .dm-body {
  font-size: 0.97rem;
  line-height: 1.75;
  color: var(--text);
  word-break: keep-all;
}
.day-master-box .dm-body p { margin-bottom: 10px; }

/* ===== 오행 차트 ===== */
.result-section-title {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.elements-section { margin-bottom: 24px; }

.elements-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.element-bar {
  display: grid;
  grid-template-columns: 80px 1fr 36px;
  gap: 10px;
  align-items: center;
  font-size: 0.9rem;
}

.element-bar .e-label {
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.element-bar .e-track {
  height: 14px;
  background: rgba(0,0,0,0.05);
  border-radius: 7px;
  overflow: hidden;
}

.element-bar .e-fill {
  height: 100%;
  border-radius: 7px;
  transition: width 0.6s ease-out;
}

.element-bar .e-count {
  font-weight: 800;
  text-align: right;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.elements-comment {
  background: rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 14px;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text);
}

/* ===== 환경 advice ===== */
.env-advice-section {
  margin-bottom: 24px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(99,102,241,0.04));
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 16px;
  padding: 20px 22px;
}

.env-advice-section h3 { color: #047857; margin-bottom: 12px; }

.env-advice-section .ea-line {
  padding: 8px 0;
  font-size: 0.95rem;
  line-height: 1.65;
  word-break: keep-all;
}
.env-advice-section .ea-line strong { color: #047857; margin-right: 4px; }

/* ===== MBTI advice ===== */
.mbti-advice-section {
  margin-bottom: 24px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(236, 72, 153, 0.04));
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 16px;
  padding: 20px 22px;
}

.mbti-advice-section h3 { color: #7c3aed; margin-bottom: 12px; }

.mbti-advice-section p {
  font-size: 0.97rem;
  line-height: 1.7;
  word-break: keep-all;
}

/* ===== 신규 5개 영역 (직업/재물/건강/연애/올해운) ===== */
.feature-section {
  margin-bottom: 22px;
}

.feature-card {
  border-radius: 16px;
  padding: 18px 20px;
  font-size: 0.95rem;
  line-height: 1.7;
  word-break: keep-all;
  border: 1px solid;
}

.career-card {
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(99,102,241,0.04));
  border-color: rgba(99,102,241,0.2);
}
.wealth-card {
  background: linear-gradient(135deg, rgba(245,158,11,0.1), rgba(234,88,12,0.05));
  border-color: rgba(245,158,11,0.25);
}
.health-card {
  background: linear-gradient(135deg, rgba(16,185,129,0.1), rgba(5,150,105,0.05));
  border-color: rgba(16,185,129,0.25);
}
.love-card {
  background: linear-gradient(135deg, rgba(236,72,153,0.1), rgba(244,63,94,0.05));
  border-color: rgba(236,72,153,0.25);
}
.year-card {
  background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(124,58,237,0.05));
  border-color: rgba(139,92,246,0.25);
}

@media (prefers-color-scheme: dark) {
  .career-card { background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(99,102,241,0.08)); }
  .wealth-card { background: linear-gradient(135deg, rgba(245,158,11,0.18), rgba(234,88,12,0.08)); }
  .health-card { background: linear-gradient(135deg, rgba(16,185,129,0.18), rgba(5,150,105,0.08)); }
  .love-card   { background: linear-gradient(135deg, rgba(236,72,153,0.18), rgba(244,63,94,0.08)); }
  .year-card   { background: linear-gradient(135deg, rgba(139,92,246,0.18), rgba(124,58,237,0.08)); }
}

/* ===== 십신 ===== */
.ten-gods-section {
  margin-bottom: 24px;
}

.ten-gods-section h3 { margin-bottom: 12px; }

.ten-gods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.ten-god-card {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.88rem;
}
.ten-god-card .tg-name { font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.ten-god-card .tg-desc { color: var(--text-muted); line-height: 1.55; font-size: 0.82rem; }

/* ===== 광고 ===== */
.ad-slot {
  width: 100%;
  background: rgba(0, 0, 0, 0.03);
  border: 1px dashed rgba(99, 102, 241, 0.15);
  border-radius: 12px;
  margin: 18px 0;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-light);
  min-height: 100px;
  padding: 24px 16px;
}
.ad-slot::after {
  content: '';
  color: var(--text-light);
}
.ad-label {
  position: absolute;
  top: 6px;
  left: 10px;
  font-size: 0.68rem;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--text-light);
  opacity: 0.55;
  background: rgba(255, 255, 255, 0.5);
  padding: 2px 6px;
  border-radius: 4px;
}
.ad-slot--in-article { background: rgba(99,102,241,0.04); }

/* ===== 다음 추천 ===== */
.next-recommend { margin: 28px 0 16px; }
.next-recommend-title {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 14px;
}
.next-recommend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.next-recommend-card {
  background: linear-gradient(135deg, var(--primary, #6366f1), #8b5cf6);
  color: white;
  border-radius: 18px;
  padding: 22px 18px;
  text-decoration: none;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.25s ease;
  box-shadow: 0 6px 20px rgba(99,102,241,0.25);
}
.next-recommend-card.love { background: linear-gradient(135deg, #ec4899, #f43f5e); box-shadow: 0 6px 20px rgba(236,72,153,0.25); }
.next-recommend-card:hover { transform: translateY(-4px); box-shadow: 0 14px 36px rgba(99,102,241,0.4); }
.next-recommend-card .nrc-icon { font-size: 2rem; line-height: 1; }
.next-recommend-card .nrc-title { font-size: 0.95rem; font-weight: 800; }
.next-recommend-card .nrc-desc { font-size: 0.85rem; opacity: 0.92; line-height: 1.4; }
.next-recommend-card .nrc-cta { font-size: 0.85rem; font-weight: 700; margin-top: 4px; opacity: 0.95; }

/* ===== 액션 버튼 ===== */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.primary-btn, .secondary-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

.primary-btn {
  background: var(--primary, #6366f1);
  color: white;
  box-shadow: 0 4px 14px rgba(99,102,241,0.35);
}
.primary-btn:hover { background: var(--primary-dark, #4f46e5); transform: translateY(-1px); }

.secondary-btn {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--primary);
}
.secondary-btn:hover { background: rgba(99,102,241,0.1); }

.disclaimer {
  margin-top: 24px;
  padding: 12px 16px;
  background: rgba(245, 158, 11, 0.08);
  border-radius: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ===== 푸터 ===== */
.saju-footer {
  margin-top: 28px;
  text-align: center;
  border-top: 1px solid rgba(99,102,241,0.1);
  padding-top: 20px;
}
.footer-nav { display: inline-flex; gap: 8px; flex-wrap: wrap; justify-content: center; font-size: 0.9rem; color: var(--text-muted); }
.footer-nav a { color: inherit; text-decoration: none; }
.footer-nav a:hover { color: var(--primary); }
.footer-nav .dot { color: var(--text-light); }
.footer-copy { margin-top: 12px; color: var(--text-light); font-size: 0.85rem; }

@media (prefers-color-scheme: dark) {
  .saju-form input,
  .saju-form select {
    background: rgba(30, 30, 46, 0.7);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text);
  }
  .gender-opt { background: rgba(30,30,46,0.5); border-color: rgba(255,255,255,0.1); }
  .ten-god-card { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08); }
  .elements-comment { background: rgba(255,255,255,0.04); }
  .env-advice-section { background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(99,102,241,0.08)); }
  .mbti-advice-section { background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.1)); }
  .element-bar .e-track { background: rgba(255,255,255,0.08); }
}

@media (max-width: 600px) {
  .saju-card { padding: 24px 16px; }
  .saju-title { font-size: 1.35rem; }
  .bazi-grid { gap: 6px; }
  .bazi-cell { padding: 10px 4px; }
  .bazi-cell .heaven { font-size: 1.2rem; }
  .bazi-cell .earth { font-size: 1rem; }
  .row-3 { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .day-master-box { padding: 20px 16px; }
  .day-master-box .dm-name { font-size: 1.35rem; }
}

/* ============================================================
 * 후기 반영: 가독성 강화 — 본문 색상/배경 명확히
 * ============================================================ */
@media (prefers-color-scheme: light), (prefers-color-scheme: no-preference) {
  .saju-wrap .saju-card,
  .saju-wrap .saju-card * {
    color-scheme: light;
  }
  .saju-wrap .saju-card .compat-no-dm-notice p,
  .saju-wrap .saju-card .compat-section,
  .saju-wrap .saju-card .saju-section {
    color: #2d2d4a;
  }
  .saju-wrap .saju-card a {
    color: #6366f1;
  }
  /* 인용 박스/하이라이트 박스의 어두운 배경도 라이트화 */
  .saju-wrap .saju-card .saju-quote,
  .saju-wrap .saju-card .saju-highlight,
  .saju-wrap .saju-card .saju-day-master {
    background: rgba(167, 139, 250, 0.08) !important;
    border-color: rgba(167, 139, 250, 0.25) !important;
    color: #1f1f3a !important;
  }
  /* 입력 필드도 가독성 보장 */
  .saju-wrap .saju-form input,
  .saju-wrap .saju-form select {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #1f1f3a !important;
    border-color: rgba(167, 139, 250, 0.35) !important;
  }
}

/* 라이트 모드: 폼 요소도 가독성 강화 */
@media (prefers-color-scheme: light), (prefers-color-scheme: no-preference) {
  .saju-wrap .saju-subtitle {
    color: rgba(70, 70, 100, 0.85) !important;
  }
  .saju-wrap .saju-form label {
    color: #2d2d4a !important;
  }
  .saju-wrap .saju-form input[type="text"],
  .saju-wrap .saju-form input[type="number"],
  .saju-wrap .saju-form select {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #1f1f3a !important;
    border-color: rgba(167, 139, 250, 0.35) !important;
  }
  .saju-wrap .gender-opt {
    background: rgba(255, 255, 255, 0.85) !important;
    border-color: rgba(167, 139, 250, 0.35) !important;
    color: #2d2d4a !important;
  }
  .saju-wrap .gender-opt:has(input:checked) {
    background: linear-gradient(135deg, #a78bfa, #ec4899) !important;
    color: white !important;
  }
  /* 결과 섹션 본문 폰트 약간 키우고 행간 늘림 */
  .saju-wrap .saju-result-card p,
  .saju-wrap .saju-result-card .saju-section-body {
    font-size: 1rem;
    line-height: 1.85;
    word-break: keep-all;
  }
}

/* ============================================================
 * 🎨 라이트 모드 전체 가독성 갭 시정 v2
 * 박정원 후기 + 대장님 갭 분석:
 *   feature-card / ten-god-card / elements-comment / ad-slot 등
 *   다크 카드 잔재가 라이트 배경 위에 뜨면서 가독성 떨어짐
 * ============================================================ */
@media (prefers-color-scheme: light), (prefers-color-scheme: no-preference) {

  /* ----- 결과 섹션 카드들: 라이트 화이트 베이스 ----- */
  .saju-wrap .feature-card,
  .saju-wrap .ten-god-card,
  .saju-wrap .elements-comment,
  .saju-wrap .day-master-card,
  .saju-wrap .balance-summary {
    background: rgba(255, 255, 255, 0.92) !important;
    border-color: rgba(167, 139, 250, 0.20) !important;
    color: #2d2d4a !important;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.08);
  }
  .saju-wrap .feature-card *,
  .saju-wrap .ten-god-card *,
  .saju-wrap .elements-comment {
    color: #2d2d4a !important;
  }

  /* career/wealth/health/love/year 컬러 그라데이션 카드 — 옅게 + 본문 어둡게 */
  .saju-wrap .career-card { background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(99,102,241,0.03)) !important; }
  .saju-wrap .wealth-card { background: linear-gradient(135deg, rgba(245,158,11,0.10), rgba(234,88,12,0.04)) !important; }
  .saju-wrap .health-card { background: linear-gradient(135deg, rgba(16,185,129,0.10), rgba(5,150,105,0.04)) !important; }
  .saju-wrap .love-card   { background: linear-gradient(135deg, rgba(236,72,153,0.10), rgba(244,63,94,0.04)) !important; }
  .saju-wrap .year-card   { background: linear-gradient(135deg, rgba(167,139,250,0.10), rgba(124,58,237,0.04)) !important; }
  .saju-wrap .weekly-card { background: rgba(255, 255, 255, 0.92) !important; }

  /* 십신 카드의 강조 라벨 — 어두운 보라/주황으로 */
  .saju-wrap .tg-name {
    color: #7c3aed !important;
    background: rgba(167, 139, 250, 0.12) !important;
    padding: 4px 10px;
    border-radius: 8px;
    display: inline-block;
  }
  .saju-wrap .tg-desc {
    color: #2d2d4a !important;
  }

  /* 환경 advice 카드는 그대로 라이트 그린 (기존 OK) */

  /* 디스클레이머 — 옅은 노랑 */
  .saju-wrap .disclaimer {
    background: rgba(245, 158, 11, 0.08) !important;
    color: #78350f !important;
    border: 1px solid rgba(245, 158, 11, 0.25) !important;
  }

  /* 광고 슬롯 — 라이트 placeholder */
  .saju-wrap .ad-slot {
    background: rgba(167, 139, 250, 0.06) !important;
    border-color: rgba(167, 139, 250, 0.15) !important;
  }
  .saju-wrap .ad-slot .ad-label {
    color: #6b7280 !important;
  }

  /* 푸터 톤 정리 */
  .saju-wrap .footer-nav,
  .saju-wrap .footer-nav a {
    color: #6b7280 !important;
  }
  .saju-wrap .footer-copy {
    color: #9ca3af !important;
  }

  /* 궁합 카드 — 사람 카드 라이트화 */
  .saju-wrap .compat-person-card {
    background: rgba(255, 255, 255, 0.92) !important;
    border-color: rgba(167, 139, 250, 0.20) !important;
  }
  .saju-wrap .compat-person-card .cp-name {
    color: #d97706 !important;
  }
  .saju-wrap .compat-person-card .cp-dm {
    color: #4b5563 !important;
  }

  /* 일주 강조 — 본문 가독성 */
  .saju-wrap .saju-greeting,
  .saju-wrap .saju-greeting * {
    color: #2d2d4a !important;
  }

  /* 십신 카드 안 라벨/숫자 */
  .saju-wrap .ten-god-card * {
    color: #2d2d4a !important;
  }

  /* "오행 비교적 고르게..." 본문 (elements-comment) */
  .saju-wrap #elements-comment {
    background: rgba(167, 139, 250, 0.06) !important;
    color: #2d2d4a !important;
    border: 1px solid rgba(167, 139, 250, 0.20) !important;
  }
}

/* ============================================================
 * 🎨 라이트 모드 가독성 갭 v3 — 추가 잔재 시정
 * 대장님 갭 분석 (스크린샷 2장):
 *   1. 헤더 라이브러리 버튼 옅은 글자
 *   2. 주요 사료 박스 다크
 *   3. MBTI만 알고 있는 친구 등록 모달 다크
 *   4. 라이브러리 카드 다크 (저장된 사주 안 보임)
 * ============================================================ */
@media (prefers-color-scheme: light), (prefers-color-scheme: no-preference) {

  /* [1] 헤더 라이브러리 버튼 — 어두운 보라 글자 + 라이트 박스 */
  .saju-wrap .saju-lib-btn {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.15), rgba(236, 72, 153, 0.10)) !important;
    color: #7c3aed !important;
    border-color: rgba(167, 139, 250, 0.45) !important;
    text-shadow: none !important;
    font-weight: 800;
  }
  .saju-wrap .saju-lib-btn:hover {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.25), rgba(236, 72, 153, 0.15)) !important;
    color: #6d28d9 !important;
  }

  /* 헤더 ← 홈 버튼도 라이트 */
  .saju-wrap .saju-back {
    background: rgba(255, 255, 255, 0.7) !important;
    color: #2d2d4a !important;
    border-color: rgba(167, 139, 250, 0.30) !important;
  }

  /* [2] 주요 사료 박스 (.intro-sources) */
  .saju-wrap .intro-sources {
    background: rgba(167, 139, 250, 0.06) !important;
    border: 1px solid rgba(167, 139, 250, 0.20) !important;
    color: #2d2d4a !important;
  }
  .saju-wrap .intro-sources *,
  .saju-wrap .intro-sources li,
  .saju-wrap .intro-sources li::before {
    color: #2d2d4a !important;
  }
  .saju-wrap .intro-sources h3 { color: #6d28d9 !important; }

  /* 학술 출처 + 입장 박스도 동일 톤 */
  .saju-wrap .intro-academic,
  .saju-wrap .intro-stance {
    background: rgba(167, 139, 250, 0.05) !important;
    border: 1px solid rgba(167, 139, 250, 0.18) !important;
    color: #2d2d4a !important;
  }
  .saju-wrap .intro-academic *,
  .saju-wrap .intro-stance * {
    color: #2d2d4a !important;
  }
  .saju-wrap .intro-academic h3,
  .saju-wrap .intro-stance h3 { color: #6d28d9 !important; }

  /* [3] MBTI만 알고 있는 친구 등록 모달 */
  .saju-wrap .mbti-only-modal,
  .mbti-only-modal {
    background: rgba(0, 0, 0, 0.45) !important;
  }
  .saju-wrap .mbti-only-content,
  .mbti-only-content {
    background: rgba(255, 255, 255, 0.98) !important;
    color: #2d2d4a !important;
    border: 1px solid rgba(167, 139, 250, 0.25) !important;
  }
  .mbti-only-content *,
  .mbti-only-title,
  .mbti-only-desc,
  .mbti-only-form label {
    color: #2d2d4a !important;
  }
  .mbti-only-title { color: #d97706 !important; }
  .mbti-only-form input,
  .mbti-only-form select {
    background: rgba(255, 255, 255, 1) !important;
    color: #2d2d4a !important;
    border-color: rgba(167, 139, 250, 0.35) !important;
  }
  .mbti-only-actions .secondary-btn {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #6d28d9 !important;
    border: 1px solid rgba(167, 139, 250, 0.4) !important;
  }

  /* [4] 라이브러리 카드 — 라이트 화이트 + 어두운 글자 */
  .saju-wrap .lib-card {
    background: rgba(255, 255, 255, 0.95) !important;
    border-color: rgba(167, 139, 250, 0.25) !important;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.08);
  }
  .saju-wrap .lib-card:hover {
    background: rgba(255, 255, 255, 1) !important;
    border-color: rgba(217, 180, 74, 0.45) !important;
    box-shadow: 0 8px 24px rgba(167, 139, 250, 0.18);
  }
  .saju-wrap .lib-card-label { color: #d97706 !important; }
  .saju-wrap .lib-card-row {
    color: #2d2d4a !important;
  }
  .saju-wrap .lib-card-date {
    color: #9ca3af !important;
  }
  .saju-wrap .lib-mbti-badge {
    background: rgba(139, 92, 246, 0.12) !important;
    color: #6d28d9 !important;
  }
  .saju-wrap .lib-card-btn {
    background: rgba(167, 139, 250, 0.12) !important;
    color: #6d28d9 !important;
    border-color: rgba(167, 139, 250, 0.30) !important;
  }
  .saju-wrap .lib-card-btn:hover {
    background: rgba(167, 139, 250, 0.25) !important;
  }
  .saju-wrap .lib-card-del {
    background: rgba(239, 68, 68, 0.08) !important;
    color: #dc2626 !important;
    border-color: rgba(239, 68, 68, 0.25) !important;
  }
  .saju-wrap .lib-card-del:hover {
    background: rgba(239, 68, 68, 0.18) !important;
  }
  .saju-wrap .lib-card-check {
    background: rgba(167, 139, 250, 0.08) !important;
    color: #6d28d9 !important;
    border-color: rgba(167, 139, 250, 0.30) !important;
  }
  .saju-wrap .lib-card-check.selected {
    background: linear-gradient(135deg, #a78bfa, #ec4899) !important;
    color: white !important;
  }
  /* 라이브러리 화면 헤더 + 라벨들 */
  .saju-wrap .lib-title { color: #6d28d9 !important; }
  .saju-wrap .lib-subtitle,
  .saju-wrap .lib-back-btn,
  .saju-wrap .lib-mode-btn,
  .saju-wrap .lib-empty,
  .saju-wrap .lib-empty * {
    color: #2d2d4a !important;
  }
  .saju-wrap .lib-mode-btn.active {
    background: linear-gradient(135deg, #a78bfa, #ec4899) !important;
    color: white !important;
  }
}

/* ============================================================
 * 🎨 라이트 모드 갭 v4 — 라이브러리 저장 input + 액션 버튼
 * ============================================================ */
@media (prefers-color-scheme: light), (prefers-color-scheme: no-preference) {
  /* [1] 라이브러리 저장 박스 — 라이트 톤 */
  .saju-wrap .save-to-library {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.10), rgba(167, 139, 250, 0.04)) !important;
    border-color: rgba(251, 191, 36, 0.30) !important;
  }
  .saju-wrap .save-to-library .result-section-title { color: #d97706 !important; }
  .saju-wrap .save-desc { color: #2d2d4a !important; }
  .saju-wrap .save-row input {
    background: rgba(255, 255, 255, 0.95) !important;
    border-color: rgba(167, 139, 250, 0.35) !important;
    color: #2d2d4a !important;
  }
  .saju-wrap .save-row input::placeholder { color: #9ca3af !important; }

  /* [2] '친구에게 공유하기' / '다른 사주 보기' action-buttons 정리 */
  .saju-wrap .action-buttons .secondary-btn {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #6d28d9 !important;
    border: 2px solid rgba(99, 102, 241, 0.35) !important;
  }
  .saju-wrap .action-buttons .secondary-btn:hover {
    background: rgba(99, 102, 241, 0.05) !important;
    border-color: #6366f1 !important;
  }
  .saju-wrap .action-buttons .primary-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
    color: white !important;
  }
}

/* ============================================================
 * 🎨 라이트 모드 갭 v5 — 추천 카드 + 전체 정밀 점검
 * 대장님 갭 분석: '다음 추천 서비스' 카드의 부제/CTA 옅음
 * ============================================================ */
/* [1] 다음 추천 서비스 카드 — opacity 제거 + text-shadow */
.next-recommend-card .nrc-desc {
  opacity: 1 !important;
  color: rgba(255, 255, 255, 0.96) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.next-recommend-card .nrc-cta {
  opacity: 1 !important;
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.20);
  font-weight: 800 !important;
}
.next-recommend-card .nrc-title {
  color: #ffffff !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.22);
}

/* ============================================================
 * 🎨 라이트 모드 갭 v6 — 황금색(#fbbf24) 가독성 일괄
 * 흰 카드 배경 위에서 황금색은 대비비 1.5:1 이하 (WCAG 위반)
 * 라이트 모드: 황금색 → amber-700(#b45309) 또는 amber-600(#d97706) 강제
 * 다크 모드: 기존 #fbbf24 유지
 * ============================================================ */
@media (prefers-color-scheme: light), (prefers-color-scheme: no-preference) {
  /* 사주 페이지 황금 텍스트 일괄 어두운 갈색으로 */
  .saju-wrap .intro-block p strong,
  .saju-wrap .intro-stance h3,
  .saju-wrap .intro-academic h3,
  .saju-wrap .intro-sources h3,
  .saju-wrap .compat-person-card .cp-name,
  .saju-wrap .day-master-card .dm-title,
  .saju-wrap .save-to-library .result-section-title,
  .saju-wrap .lib-card-label {
    color: #b45309 !important;  /* amber-700, 흰 배경에서 4.5:1 이상 */
    text-shadow: none !important;
  }

  /* 환경 advice 카드의 환경 라벨 (황금색 가능성) */
  .saju-wrap .env-advice-card strong {
    color: #b45309 !important;
  }

  /* 일주(.day-master) 강조 박스의 글자도 어둡게 */
  .saju-wrap .day-master,
  .saju-wrap .day-master * {
    color: #2d2d4a !important;
  }
  .saju-wrap .day-master .dm-stem,
  .saju-wrap .day-master .dm-branch {
    color: #b45309 !important;
  }
}
