*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0e27;
  --card: rgba(26,26,46,0.65);
  --card-solid: #1a1a2e;
  --border-purple: rgba(139,92,246,0.2);
  --border-gold: rgba(251,191,36,0.2);
  --gold: #fbbf24;
  --gold-dark: #f59e0b;
  --purple: #8b5cf6;
  --teal: #14b8a6;
  --orange: #f97316;
  --white: #ffffff;
  --text: #e2e8f0;
  --text-sec: #cbd5e0;
  --text-muted: #a0aec0;
  --text-dim: #64748b;
  --el-wood: #10b981;
  --el-fire: #f97316;
  --el-earth: #fbbf24;
  --el-metal: #e5e7eb;
  --el-water: #3b82f6;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Pretendard Variable', 'Pretendard', -apple-system, sans-serif;
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  min-height: 100vh;
}

/* ── HEADER (로고+탭 한 줄) ── */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,14,39,0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(139,92,246,0.08);
  padding: 0 16px;
  display: flex; align-items: center;
  height: 52px; gap: 16px;
}
.header-logo { display: flex; align-items: center; flex-shrink: 0; text-decoration: none; }
.header-logo img { height: 28px; width: auto; filter: drop-shadow(0 0 8px rgba(251,191,36,0.3)); }
.logo-text {
  font-family: 'Pretendard Variable', 'Pretendard', sans-serif;
  font-weight: 800; font-size: 17px; color: #ffffff;
  letter-spacing: -0.5px;
}
.logo-text .logo-accent {
  color: #ffcd4a;
}
.tab-bar {
  display: flex; gap: 2px; overflow-x: auto; flex: 1;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab {
  font-size: 14px; font-weight: 700; color: var(--text-muted);
  text-decoration: none; padding: 14px 12px; white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tab:hover { color: var(--text); }
.tab--active { color: var(--gold); border-bottom-color: var(--gold); }
/* 헤더 오른쪽 액션 (내 사주 버튼 등) */
.header-actions {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.header-action-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 12px; border-radius: 100px;
  background: rgba(251,191,36,0.08);
  border: 1px solid rgba(251,191,36,0.22);
  color: var(--gold);
  font-size: 12px; font-weight: 700;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}
.header-action-btn:hover {
  background: rgba(251,191,36,0.15);
  border-color: var(--gold);
}
.header-action-btn .icon { font-size: 14px; line-height: 1; display: inline-flex; align-items: center; }
.header-action-btn .icon svg { width: 15px; height: 15px; stroke-width: 2; }
/* 모바일/태블릿: 아이콘만 표시 (탭바 공간 확보) */
@media (max-width: 900px) {
  .header-action-btn { padding: 7px 9px; }
  .header-action-btn .label { display: none; }
}
/* 프리미엄 탭 (상세풀이) — 유료 유도용 강조 */
.tab--premium {
  position: relative;
  color: var(--gold);
}
.tab--premium:hover { color: #ffcd4a; }
.tab--premium.tab--active { color: var(--gold); border-bottom-color: var(--gold); }
.tab-badge-new {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  background: linear-gradient(135deg, #f97316, #fbbf24);
  color: #1a1a2e;
  font-size: 9px;
  font-weight: 800;
  border-radius: 4px;
  vertical-align: middle;
  letter-spacing: 0.3px;
  line-height: 1.4;
}

/* ── PROFILE BAR ── */
.profile-bar {
  display: none; align-items: center; justify-content: space-between;
  max-width: 520px; margin: 8px auto 0;
  padding: 8px 16px;
  background: rgba(251,191,36,0.06);
  border: 1px solid rgba(251,191,36,0.15);
  border-radius: 12px;
}
.profile-info { display: flex; align-items: center; gap: 8px; }
.profile-ilju { font-size: 14px; font-weight: 700; color: var(--gold); }
.profile-detail { font-size: 12px; color: var(--text-muted); }
.profile-clear {
  background: none; border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px; padding: 4px 10px;
  color: var(--text-dim); font-size: 11px; cursor: pointer; font-family: inherit;
  transition: all 0.2s;
}
.profile-clear:hover { border-color: var(--gold); color: var(--gold); }

/* ── SECTION ── */
.section {
  max-width: 520px; margin: 0 auto;
  padding: 16px 16px 8px;
}
.section-title {
  font-size: 22px; font-weight: 800; margin-bottom: 12px;
  color: var(--white);
  text-shadow: 0 0 20px rgba(251,191,36,0.15);
}

/* ── BADGES ── */
.badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 100px; vertical-align: middle; }
.badge--hot { background: #ef4444; color: #fff; }
.badge--new { background: #f97316; color: #fff; }
.badge--rec { background: var(--gold); color: #1a1a2e; }

/* ── GOLD BUTTON ── */
.btn-gold {
  display: inline-block;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #1a1a2e; padding: 6px 18px; border-radius: 100px;
  font-size: 12px; font-weight: 600;
  box-shadow:
    0 4px 20px rgba(251,191,36,0.3),
    0 0 40px rgba(251,191,36,0.1);
  transition: all 0.2s;
}
.btn-gold:hover {
  box-shadow:
    0 6px 30px rgba(251,191,36,0.5),
    0 0 60px rgba(251,191,36,0.15);
  transform: translateY(-1px);
}

/* ── AD SLOT ── */
.ad-slot {
  max-width: 520px; margin: 24px auto;
  min-height: 50px;
}

/* ── FOOTER ── */
.footer {
  text-align: center; padding: 40px 16px;
  border-top: 1px solid rgba(139,92,246,0.08);
  margin-top: 32px;
}
.footer-logo { height: 28px; width: auto; opacity: 0.4; margin-bottom: 10px; }
.footer p { font-size: 11px; color: var(--text-dim); }
.footer-biz { font-size: 11px; color: var(--text-muted); line-height: 1.8; margin-top: 14px; }
.footer-links { display: flex; justify-content: center; gap: 16px; margin-top: 12px; }
.footer-links a { font-size: 12px; color: var(--text-muted); text-decoration: none; font-weight: 600; transition: color 0.2s; }
.footer-links a:hover { color: var(--gold); }

/* ── SHARE BUTTONS (공통) ── */
.share-row { display: flex; gap: 8px; }
.btn-ghost {
  flex: 1; padding: 12px;
  background: rgba(10,10,30,0.7); backdrop-filter: blur(8px);
  border: 1px solid rgba(251,191,36,0.25); border-radius: 12px;
  color: var(--gold); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all 0.2s;
}
.btn-ghost:hover { border-color: var(--gold); background: rgba(251,191,36,0.1); }

/* ── MOBILE ── */
@media (max-width: 380px) {
  .tab { font-size: 12px; padding: 8px 10px; }
}

/* ── BOTTOM NAV (모바일 전용 하단 탭바) ── */
.bottom-nav { display: none; }
@media (max-width: 900px) {
  /* 모바일에서 상단 탭바 숨김 — 하단 탭바로 대체 */
  .header .tab-bar { display: none; }
  .header { gap: 0; }
  .header-logo { flex: 1; }
  .bottom-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 99;
    background: rgba(10,14,39,0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(139,92,246,0.12);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bn-item {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    padding: 9px 4px 7px;
    text-decoration: none;
    color: var(--text-muted);
    transition: color 0.2s;
    position: relative;
    min-height: 56px;
  }
  .bn-item .bn-icon { font-size: 20px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
  .bn-item .bn-icon svg { width: 22px; height: 22px; stroke-width: 1.8; }
  .bn-item .bn-label { font-size: 10.5px; font-weight: 700; line-height: 1.2; letter-spacing: -0.2px; }
  .bn-item.bn-item--active { color: var(--gold); }
  .bn-item.bn-item--active::before {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 28px; height: 2px;
    background: var(--gold);
    border-radius: 0 0 3px 3px;
  }
  .bn-item--premium { color: var(--gold); }
  .bn-item--premium .bn-icon { filter: drop-shadow(0 0 6px rgba(251,191,36,0.4)); }
  body { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
  .footer { margin-bottom: 0; }
}
@media print {
  .bottom-nav { display: none !important; }
  body { padding-bottom: 0 !important; }
}

/* ── ACCORDION 토글 (풀이 결과 섹션 접기) ── */
.acc-toggle {
  position: fixed;
  right: 12px; bottom: 72px;
  z-index: 98;
  background: rgba(10,14,39,0.92);
  border: 1px solid rgba(251,191,36,0.3);
  color: var(--gold);
  padding: 10px 14px;
  border-radius: 100px;
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: inline-flex; align-items: center; gap: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  font-family: inherit;
  transition: all 0.2s;
}
.acc-toggle .acc-icon { font-size: 14px; line-height: 1; }
.acc-toggle:hover { border-color: var(--gold); background: rgba(251,191,36,0.12); }
@media (min-width: 901px) {
  .acc-toggle { bottom: 24px; right: 24px; }
}
/* 접힌 상태 — 아이템 제목만 노출 */
body.acc-collapsed .acc-item {
  cursor: pointer;
  transition: background 0.2s;
}
body.acc-collapsed .acc-item:hover { background: rgba(251,191,36,0.04); }
body.acc-collapsed .acc-item:not(.acc-expanded) > *:not(.box-title):not(h3):not(h4):not(h2):not(.pr-header):not(.section-header):not(.card-header):not(.yr-section-head) {
  display: none !important;
}
body.acc-collapsed .acc-item:not(.acc-expanded) .box-title::after,
body.acc-collapsed .acc-item:not(.acc-expanded) > h3::after,
body.acc-collapsed .acc-item:not(.acc-expanded) > h4::after,
body.acc-collapsed .acc-item:not(.acc-expanded) > h2::after,
body.acc-collapsed .acc-item:not(.acc-expanded) .pr-header::after,
body.acc-collapsed .acc-item:not(.acc-expanded) .section-header::after,
body.acc-collapsed .acc-item:not(.acc-expanded) .card-header::after,
body.acc-collapsed .acc-item:not(.acc-expanded) .yr-section-head::after {
  content: ' ▸';
  color: var(--gold);
  font-size: 0.85em;
  margin-left: 6px;
}
body.acc-collapsed .acc-item.acc-expanded .box-title::after,
body.acc-collapsed .acc-item.acc-expanded > h3::after,
body.acc-collapsed .acc-item.acc-expanded > h4::after,
body.acc-collapsed .acc-item.acc-expanded > h2::after,
body.acc-collapsed .acc-item.acc-expanded .pr-header::after,
body.acc-collapsed .acc-item.acc-expanded .section-header::after,
body.acc-collapsed .acc-item.acc-expanded .card-header::after,
body.acc-collapsed .acc-item.acc-expanded .yr-section-head::after {
  content: ' ▾';
}
/* 인쇄 시 아코디언 강제 펼침 */
@media print {
  .acc-toggle { display: none !important; }
  body.acc-collapsed .acc-item > * { display: revert !important; }
  body.acc-collapsed .acc-item .box-title::after,
  body.acc-collapsed .acc-item h3::after,
  body.acc-collapsed .acc-item h4::after,
  body.acc-collapsed .acc-item .pr-header::after,
  body.acc-collapsed .acc-item .section-header::after { content: '' !important; }
}
