@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700;900&family=Noto+Serif+KR:wght@400;700;900&display=swap');

/* ===== 다크 테마 (기본) ===== */
:root {
  --navy: #0a0e27;
  --navy-light: #111640;
  --navy-mid: #1a1f4e;
  --gold: #d4a853;
  --gold-light: #f0d48a;
  --gold-dark: #b8892e;
  --white: #f5f0e8;
  --red: #c73e3e;
  --text-muted: #8a8db0;
  --glass-border: rgba(212,168,83,0.2);
  --body-bg: #0a0e27;
  --card-bg-start: #111640;
  --card-bg-end: #1a1f4e;
  --input-bg: rgba(255,255,255,.04);
  --input-border: rgba(212,168,83,.15);
  --star-color: var(--gold-light);
  --glow-color: rgba(212,168,83,.06);
}

/* ===== 라이트 테마 ===== */
[data-theme="light"] {
  --navy: #f5f0e8;
  --navy-light: #ffffff;
  --navy-mid: #f0ebe0;
  --white: #1a1a2e;
  --text-muted: #6b6b80;
  --glass-border: rgba(184,137,46,0.2);
  --body-bg: #f5f0e8;
  --card-bg-start: #ffffff;
  --card-bg-end: #f8f4ec;
  --input-bg: rgba(0,0,0,.04);
  --input-border: rgba(184,137,46,.25);
  --star-color: rgba(184,137,46,.3);
  --glow-color: rgba(212,168,83,.08);
}

[data-theme="light"] body { color: var(--white); }
[data-theme="light"] .saju-char .hanja { color: inherit; }
[data-theme="light"] select.form-input option { background: #fff; color: #1a1a2e; }
[data-theme="light"] .modal-box { background: #fff; }
[data-theme="light"] .modal-box h3 { color: var(--gold-dark); }
[data-theme="light"] .modal-box p { color: #555; }

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans KR', sans-serif;
  background: var(--body-bg);
  color: var(--white);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background .4s, color .4s;
}

/* ===== 배경 효과 ===== */
.bg-stars {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0; overflow: hidden;
}
.bg-stars .star {
  position: absolute; width: 2px; height: 2px;
  background: var(--star-color); border-radius: 50%;
  animation: twinkle var(--dur) ease-in-out infinite; opacity: 0;
}
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(.5); }
  50% { opacity: var(--max-opacity); transform: scale(1); }
}
.bg-glow {
  position: fixed; top: -30%; left: 50%; transform: translateX(-50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--glow-color) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}

.container {
  position: relative; z-index: 1;
  max-width: 480px; margin: 0 auto;
  padding: 20px 16px 40px; min-height: 100vh;
}

/* ===== 테마 전환 버튼 ===== */
.theme-toggle-wrap {
  text-align: right; margin-bottom: 8px;
}
.theme-toggle-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  background: rgba(212,168,83,.1);
  border: 1px solid rgba(212,168,83,.25);
  border-radius: 20px;
  color: var(--gold-light); font-size: 12px; font-weight: 600;
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer; transition: all .3s;
}
.theme-toggle-btn:hover {
  background: rgba(212,168,83,.2);
  border-color: var(--gold);
}
.theme-icon { font-size: 16px; }

/* ===== HEADER ===== */
.header { text-align: center; padding: 30px 0 12px; }
.header-icon {
  font-size: 48px; margin-bottom: 12px; display: block;
  animation: float 3s ease-in-out infinite;
}
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
.header h1 {
  font-family: 'Noto Serif KR', serif; font-size: 26px; font-weight: 900;
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-dark));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; line-height: 1.4; margin-bottom: 8px;
}
.header .subtitle {
  font-size: 13px; color: var(--text-muted); font-weight: 300; letter-spacing: 1px;
}

.season-badge-wrap { text-align: center; margin: 10px 0 0; }
.season-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px;
  background: linear-gradient(135deg, rgba(212,168,83,.18), rgba(212,168,83,.06));
  border: 1px solid rgba(212,168,83,.35);
  border-radius: 24px; font-size: 12px; color: var(--gold-light);
  letter-spacing: .3px; animation: badge-pulse 2.5s ease-in-out infinite;
}
.season-badge .fire { color: #f87171; font-weight: 700; }
@keyframes badge-pulse {
  0%,100% { box-shadow: 0 0 8px rgba(212,168,83,.1); }
  50% { box-shadow: 0 0 18px rgba(212,168,83,.25); }
}

.header .badge {
  display: inline-block; margin-top: 10px; padding: 5px 14px;
  background: rgba(212,168,83,.12); border: 1px solid var(--glass-border);
  border-radius: 20px; font-size: 11px; color: var(--gold-light);
}

.instant-badge {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px; padding: 5px 14px;
  background: rgba(74,222,128,.08);
  border: 1px solid rgba(74,222,128,.2);
  border-radius: 20px; font-size: 11px; color: rgba(74,222,128,.9);
}

.trust-banner {
  display: flex; justify-content: center; gap: 24px;
  padding: 16px 0; margin-bottom: 8px;
}
.trust-item { text-align: center; }
.trust-item .num { font-size: 20px; font-weight: 900; color: var(--gold); }
.trust-item .label { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

.trust-tech {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 6px; margin-bottom: 16px;
}
.trust-tech-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px; font-size: 10px; color: var(--text-muted);
}
.trust-tech-badge .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: #4ade80; flex-shrink: 0;
}

/* ===== 공통 애니메이션 ===== */
.fade-in-up {
  opacity: 0; transform: translateY(20px);
  animation: fadeInUpAnim .6s ease forwards;
}
@keyframes fadeInUpAnim { to { opacity: 1; transform: translateY(0); } }
.delay-1{animation-delay:.15s} .delay-2{animation-delay:.3s}
.delay-3{animation-delay:.45s} .delay-4{animation-delay:.6s}
.delay-5{animation-delay:.75s} .delay-6{animation-delay:.9s}
.delay-7{animation-delay:1.05s} .delay-8{animation-delay:1.2s}
.delay-9{animation-delay:1.35s}

/* Footer */
.footer {
  text-align: center; padding: 30px 0 10px;
  font-size: 11px; color: rgba(138,141,176,.5); line-height: 1.8;
}

/* ================================================================
   상단 네비게이션 (운신 스타일)
   ================================================================ */

/* 전체 네비 래퍼 — 상단 고정 */
.top-nav-wrap {
  position: sticky;
  top: 0; z-index: 100;
  background: var(--body-bg);
  margin: 0 -16px;
  padding: 0 16px;
  transition: background .4s, box-shadow .3s;
}
.top-nav-wrap.scrolled {
  box-shadow: 0 2px 20px rgba(0,0,0,.25);
}
[data-theme="light"] .top-nav-wrap.scrolled {
  box-shadow: 0 2px 16px rgba(0,0,0,.06);
}

/* ── 1단: 텍스트 메뉴바 ── */
.text-menu-bar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 14px 0 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.text-menu-bar::-webkit-scrollbar { display: none; }

.text-menu-item {
  position: relative;
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Noto Sans KR', sans-serif;
  white-space: nowrap;
  transition: color .3s;
}
.text-menu-item:first-child { padding-left: 4px; }
.text-menu-item.active {
  color: var(--gold);
  font-weight: 700;
}
.text-menu-item.active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 14px; right: 14px;
  height: 2.5px;
  background: var(--gold);
  border-radius: 2px;
}
.text-menu-item .menu-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  background: #f87171;
  border-radius: 8px;
  font-size: 9px;
  color: #fff;
  font-weight: 700;
  vertical-align: top;
  line-height: 14px;
}

/* 구분선 */
.text-menu-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-border), transparent);
  margin: 0;
}

/* ── 2단: 아이콘 카테고리 그리드 ── */
.icon-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 8px 4px;
  padding: 18px 4px 14px;
}

.icon-cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
  cursor: pointer;
  border-radius: 14px;
  transition: all .25s;
  border: none;
  background: none;
  font-family: 'Noto Sans KR', sans-serif;
}
.icon-cat-item:active { transform: scale(.95); }
.icon-cat-item.active .icon-cat-circle {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,168,83,.15);
}
.icon-cat-item.active .icon-cat-label {
  color: var(--gold);
  font-weight: 700;
}

/* 원형 아이콘 */
.icon-cat-circle {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: 2px solid transparent;
  transition: all .3s;
}

/* 아이콘 배경색 개별 지정 */
.icon-cat-circle.ic-saju {
  background: linear-gradient(135deg, rgba(212,168,83,.2), rgba(212,168,83,.08));
  border-color: rgba(212,168,83,.15);
}
.icon-cat-circle.ic-gunghap {
  background: linear-gradient(135deg, rgba(248,113,113,.2), rgba(248,113,113,.08));
  border-color: rgba(248,113,113,.15);
}
.icon-cat-circle.ic-today {
  background: linear-gradient(135deg, rgba(168,85,247,.2), rgba(168,85,247,.08));
  border-color: rgba(168,85,247,.15);
}
.icon-cat-circle.ic-dict {
  background: linear-gradient(135deg, rgba(59,130,246,.2), rgba(59,130,246,.08));
  border-color: rgba(59,130,246,.15);
}
.icon-cat-circle.ic-study {
  background: linear-gradient(135deg, rgba(74,222,128,.2), rgba(74,222,128,.08));
  border-color: rgba(74,222,128,.15);
}
.icon-cat-circle.ic-tip {
  background: linear-gradient(135deg, rgba(251,191,36,.2), rgba(251,191,36,.08));
  border-color: rgba(251,191,36,.15);
}

/* 라이트 모드 아이콘 강화 */
[data-theme="light"] .icon-cat-circle.ic-saju { background: linear-gradient(135deg, rgba(212,168,83,.15), rgba(212,168,83,.05)); }
[data-theme="light"] .icon-cat-circle.ic-gunghap { background: linear-gradient(135deg, rgba(248,113,113,.12), rgba(248,113,113,.04)); }
[data-theme="light"] .icon-cat-circle.ic-today { background: linear-gradient(135deg, rgba(168,85,247,.12), rgba(168,85,247,.04)); }
[data-theme="light"] .icon-cat-circle.ic-dict { background: linear-gradient(135deg, rgba(59,130,246,.12), rgba(59,130,246,.04)); }
[data-theme="light"] .icon-cat-circle.ic-study { background: linear-gradient(135deg, rgba(74,222,128,.12), rgba(74,222,128,.04)); }
[data-theme="light"] .icon-cat-circle.ic-tip { background: linear-gradient(135deg, rgba(251,191,36,.12), rgba(251,191,36,.04)); }

.icon-cat-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
  transition: color .3s;
}

/* 하단 구분선 */
.icon-category-divider {
  height: 6px;
  background: rgba(0,0,0,.15);
  margin: 0 -16px 20px;
}
[data-theme="light"] .icon-category-divider {
  background: rgba(0,0,0,.04);
}
