@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@500;700;900&family=Noto+Serif+KR:wght@200;400;700&display=swap');

/* 1. 폰트 및 공통 스타일 */
@font-face {
    font-family: 'NMK-Classic';
    src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/noonfonts_twelve@1.1/NMK_Classic_Bold.woff') format('woff');
    font-weight: bold; font-style: normal;
}

:root {
    --bg-overlay: rgba(5, 5, 10, 0.85);
    --text-color: #ffffff; --sub-text: #94a3b8; --accent-color: #f8b500;
    --nav-eng-color: #d1d5db; --nav-text: #ffffff; --glass-bg: rgba(255, 255, 255, 0.03);
    --border-color: rgba(255, 255, 255, 0.1); --card-text: #e2e8f0; --box-bg: rgba(255, 255, 255, 0.05);
    --water-color: #3b82f6;
}

body.light-mode {
    --bg-overlay: rgba(248, 249, 250, 0.92);
    --text-color: #0f172a; --sub-text: #334155; --accent-color: #1e3a8a;
    --nav-eng-color: #1e293b; --nav-text: #0f172a; --glass-bg: #ffffff;
    --border-color: #cbd5e1; --card-text: #1e293b; --box-bg: #f1f5f9;
    --water-color: #1e3a8a;
}

body {
    font-family: 'Noto Serif KR', serif;
    background-color: #05050a; color: var(--text-color);
    margin: 0; transition: background-color 0.6s, color 0.6s;
    overflow-x: hidden; word-break: keep-all;
}

.nmk-font { font-family: 'NMK-Classic', serif; }

/* 기본 배경 */
.library-bg {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: -4;
}

/* 메인 페이지 전용 책장 배경 */
.main-bookshelf {
    background-image: url('https://images.unsplash.com/photo-1507842217343-583bb7270b66?auto=format&fit=crop&q=80&w=2000');
    background-size: cover; 
    background-position: center; 
}

.overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg-overlay); z-index: -3; transition: background-color 0.6s;
}

.gold-text {
    background: linear-gradient(to bottom, #ffffff 0%, #f8b500 50%, #fceabb 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 12px rgba(248, 181, 0, 0.4));
}
body.light-mode .gold-text {
    background: linear-gradient(to right, #1e3a8a, #3b82f6, #1e3a8a);
    -webkit-background-clip: text;
    background-clip: text; 
    -webkit-text-fill-color: transparent; filter: none;
}

/* Responsive Navigation Styles */
.side-nav { 
    position: fixed; 
    z-index: 100;
    transition: all 0.3s ease;
}

@media (max-width: 1023px) {
    .side-nav {
        top: 0; left: 0; right: 0;
        padding: 1rem 1.5rem;
        background: rgba(5, 5, 10, 0.9);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid var(--border-color);
        display: flex; flex-direction: column; height: auto;
    }
    body.light-mode .side-nav { background: rgba(255, 255, 255, 0.9); }
    .nav-menu-container { display: none; width: 100%; padding-top: 1.5rem; padding-bottom: 1rem; text-align: center; }
    .nav-menu-container.open { display: block; animation: slideDown 0.3s ease-out forwards; }
    @keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
    .mobile-header-row { display: flex; justify-content: space-between; align-items: center; width: 100%; }
}

@media (min-width: 1024px) { 
    .side-nav { top: 4rem; left: 4rem; width: auto; background: transparent; border: none; backdrop-filter: none; display: block; }
    .nav-menu-container { display: block !important; padding-top: 0; }
    .mobile-header-row { display: block; }
    #mobile-toggle-btn { display: none; }
}

.nav-link {
    font-family: 'Noto Sans KR', sans-serif; font-weight: 700; font-size: 1.35rem;
    transition: all 0.4s ease; display: block; color: var(--nav-text);
    text-decoration: none; opacity: 0.7; letter-spacing: 0.1em; padding: 0.5rem 0;
}
.nav-link:hover, .active-page { color: var(--accent-color); opacity: 1; letter-spacing: 0.2em; }
@media (min-width: 1024px) { .nav-link:hover, .active-page { padding-left: 10px; } }

.content-section { display: block; opacity: 1; transform: none; }
.glass-box { background: var(--glass-bg); backdrop-filter: blur(15px); border: 1px solid var(--border-color); border-radius: 20px; transition: all 0.5s ease; }
.element-box { background-color: var(--box-bg); border: 1px solid var(--border-color); border-radius: 15px; transition: all 0.3s ease; }
.num-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--accent-color); color: white;
    font-weight: 900; margin-right: 12px; font-size: 0.9rem; flex-shrink: 0;
}

.wood { color: #22c55e; } .fire { color: #ef4444; } .earth { color: #d97706; } .metal { color: #94a3b8; } .water { color: var(--water-color); }
body.light-mode .metal { color: #475569; }

.kakao-btn {
    background-color: #FEE500; color: #191919; box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.kakao-btn:hover { background-color: #FADA0A; transform: scale(1.05); }

.theme-toggle {
    position: fixed; bottom: 2rem; right: 2rem; width: 55px; height: 55px; border-radius: 50%;
    background: var(--accent-color); color: white; display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 1000; box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.star { position: absolute; background: white; border-radius: 50%; opacity: 0; animation: twinkle var(--duration) infinite ease-in-out; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(0.5); } 50% { opacity: 0.7; transform: scale(1.2); } }

.review-input { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px; color: white; transition: all 0.3s; }
.review-input option { background-color: #1a1a1a; color: white; }
body.light-mode .review-input { background: white; border: 1px solid #cbd5e1; color: #0f172a; }
body.light-mode .review-input option { background-color: white; color: #0f172a; }
.review-input:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 10px rgba(248, 181, 0, 0.2); }

/* ==================================================
   [점성학 전용] 행성 궤도 및 별똥별 애니메이션 (고해상도 디테일)
   ================================================== */
.astro-bg-container {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    overflow: hidden; z-index: -2; pointer-events: none;
    display: flex; justify-content: center; align-items: center;
}

/* 빛나는 태양 (크기 증가) */
.sun-center {
    position: absolute; width: 90px; height: 90px;
    background: radial-gradient(circle, #fceabb, #f8b500 40%, transparent 70%); 
    border-radius: 50%; box-shadow: 0 0 80px 30px rgba(248, 181, 0, 0.3);
}

/* 궤도 선 */
.orbit { 
    position: absolute; border: 1px dashed rgba(255,255,255,0.15); 
    border-radius: 50%; animation: spin infinite linear; 
}

.planet-wrapper {
    position: absolute; top: 0; left: 50%;
    transform: translate(-50%, -50%);
    display: flex; justify-content: center; align-items: center;
}

/* 기본 입체 구체 속성 */
.planet {
    border-radius: 50%;
    box-shadow: inset -10px -10px 20px rgba(0,0,0,0.8), inset 5px 5px 10px rgba(255,255,255,0.4), 0 0 15px rgba(255,255,255,0.1);
}

/* 1. 달 (Moon) - 분화구 표현 */
.orbit-moon { width: 300px; height: 300px; animation-duration: 20s; } 
.planet-moon { 
    width: 45px; height: 45px; 
    background-color: #d4d4d8;
    /* CSS 그라데이션으로 분화구 질감 묘사 */
    background-image: 
        radial-gradient(circle at 30% 30%, #9ca3af 3px, transparent 4px),
        radial-gradient(circle at 70% 60%, #9ca3af 4px, transparent 5px),
        radial-gradient(circle at 40% 80%, #9ca3af 2px, transparent 3px),
        radial-gradient(circle at 80% 20%, #9ca3af 2.5px, transparent 3.5px);
}

/* 2. 화성 (Mars) - 붉고 거친 표면 */
.orbit-mars { width: 500px; height: 500px; animation-duration: 35s; } 
.planet-mars { 
    width: 60px; height: 60px; 
    background: radial-gradient(circle at 30% 30%, #ef4444, #991b1b, #450a0a);
}

/* 3. 목성 (Jupiter) - 거대한 크기 및 가스 줄무늬 */
.orbit-jupiter { width: 750px; height: 750px; animation-duration: 60s; } 
.planet-jupiter { 
    width: 100px; height: 100px; 
    background: linear-gradient(to bottom, #78350f 10%, #d97706 25%, #fde68a 40%, #b45309 60%, #fcd34d 80%, #78350f 100%);
}

/* 4. 토성 (Saturn) - 뚜렷한 입체 고리 */
.orbit-saturn { width: 1050px; height: 1050px; animation-duration: 90s; } 
.planet-saturn { 
    width: 80px; height: 80px; 
    background: radial-gradient(circle at 40% 30%, #fef08a, #d97706, #78350f);
    position: relative;
}
/* 토성의 고리 */
.planet-saturn::after {
    content: ''; position: absolute; top: 50%; left: 50%;
    width: 170px; height: 170px;
    border: 15px solid rgba(253, 230, 138, 0.7);
    border-radius: 50%;
    /* 고리를 눕히고 비틀어서 입체감 부여 */
    transform: translate(-50%, -50%) rotateX(75deg);
    box-shadow: 0 0 15px rgba(253, 230, 138, 0.5), inset 0 0 15px rgba(253, 230, 138, 0.5);
}

@keyframes spin { 100% { transform: rotate(360deg); } }

/* 별똥별 */
.shooting-star {
    position: absolute; width: 180px; height: 3px; 
    background: linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,1));
    animation: shooting 4s linear infinite; opacity: 0;
    box-shadow: 0 0 10px 2px rgba(255,255,255,0.5);
}
.ss-1 { top: 10%; left: 80%; animation-delay: 0s; animation-duration: 5s;} 
.ss-2 { top: 30%; left: 110%; animation-delay: 3s; animation-duration: 4s;}
.ss-3 { top: 5%; left: 60%; animation-delay: 7s; animation-duration: 6s;} 
.ss-4 { top: 40%; left: 90%; animation-delay: 10s; animation-duration: 5s;}

@keyframes shooting {
    0% { transform: translateX(0) translateY(0) rotate(-45deg); opacity: 1; }
    100% { transform: translateX(-1500px) translateY(1500px) rotate(-45deg); opacity: 0; }
}

/* ==================================================
   [명리학 전용] 천간/지지 회전 만세력 휠 애니메이션
   ================================================== */
.myeongri-bg-container {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    overflow: hidden; z-index: -2; pointer-events: none;
    display: flex; justify-content: center; align-items: center;
    opacity: 0.2; 
}
.saju-center {
    position: absolute; width: 100px; height: 100px;
    background: radial-gradient(circle, rgba(248, 181, 0, 0.2), transparent);
    border-radius: 50%; box-shadow: 0 0 60px rgba(248, 181, 0, 0.5);
}
.myeongri-orbit {
    position: absolute; border-radius: 50%; border: 1px dashed rgba(255, 255, 255, 0.15);
    animation: spin-saju linear infinite;
}
.myeongri-orbit .hanja {
    position: absolute; top: 50%; left: 50%; width: 30px; height: 30px;
    margin-top: -15px; margin-left: -15px; text-align: center; line-height: 30px;
    font-family: 'NMK-Classic', serif; font-size: 1.5rem; font-weight: bold; text-shadow: 0 0 10px currentColor;
}
.orbit-cheon { width: 450px; height: 450px; animation-duration: 40s; }
.orbit-cheon .hanja { color: var(--accent-color); transform: rotate(calc(36deg * var(--i))) translateY(-225px); }
.orbit-ji { width: 750px; height: 750px; animation-duration: 60s; animation-direction: reverse; }
.orbit-ji .hanja { color: rgba(255, 255, 255, 0.8); transform: rotate(calc(30deg * var(--i))) translateY(-375px); }
@keyframes spin-saju { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }