@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700&display=swap');

/* ===== CSS 변수 (다크모드 기본) ===== */
:root {
    --bg-primary: #0d1117;
    --bg-card: #161b22;
    --bg-input: #0d1117;
    --bg-info: #1c2a3a;
    --bg-warn: #2a2418;
    --bg-good: #1a2d1a;
    --border: #30363d;
    --border-active: #58a6ff;
    --text-primary: #e6edf3;
    --text-secondary: #c9d1d9;
    --text-muted: #8b949e;
    --text-faint: #484f58;
    --accent: #58a6ff;
    --accent-purple: #bc8cff;
    --bar-bg: #21262d;
    --green: #238636;
    --green-bright: #3fb950;
    --red: #da3633;
    --red-bright: #f85149;
    --yellow: #9e6a03;
    --yellow-bright: #d29922;
    --metal-color: #8b949e;
}

/* ===== 화이트모드 ===== */
body.light {
    --bg-primary: #f6f8fa;
    --bg-card: #ffffff;
    --bg-input: #f6f8fa;
    --bg-info: #dbeafe;
    --bg-warn: #fef3c7;
    --bg-good: #dcfce7;
    --border: #d0d7de;
    --border-active: #0969da;
    --text-primary: #1f2328;
    --text-secondary: #424a53;
    --text-muted: #656d76;
    --text-faint: #8c959f;
    --accent: #0969da;
    --accent-purple: #8250df;
    --bar-bg: #e1e4e8;
    --green: #1a7f37;
    --green-bright: #1a7f37;
    --red: #cf222e;
    --red-bright: #cf222e;
    --yellow: #9a6700;
    --yellow-bright: #9a6700;
    --metal-color: #656d76;
}

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

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    transition: background 0.3s, color 0.3s;
}

.container { max-width: 860px; margin: 0 auto; }

/* ===== 테마 토글 ===== */
.theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 100;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    color: var(--text-primary);
    font-family: inherit;
}
.theme-toggle:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.theme-toggle .label {
    font-size: 0.7em;
    font-weight: 500;
}

/* ===== 헤더 ===== */
.header { text-align: center; padding: 50px 20px 30px; }
.header h1 {
    font-size: 2.2em; font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent-purple));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    margin-bottom: 10px;
}
.header p { font-size: 1.1em; color: var(--text-muted); }

/* ===== 카드 ===== */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; padding: 30px; margin-bottom: 24px;
    transition: background 0.3s, border-color 0.3s;
}

.section-title {
    font-size: 1.3em; color: var(--accent); margin-bottom: 24px;
    padding-bottom: 12px; border-bottom: 1px solid var(--border); font-weight: 600;
}

/* ===== 폼 ===== */
.form-group { margin-bottom: 22px; }
.form-group label {
    display: block; font-weight: 500; color: var(--text-secondary);
    margin-bottom: 8px; font-size: 0.95em;
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select {
    width: 100%; padding: 12px 14px; background: var(--bg-input);
    border: 1px solid var(--border); border-radius: 8px; color: var(--text-primary);
    font-size: 1em; font-family: inherit; transition: border-color 0.2s, background 0.3s;
}
.form-group input:focus, .form-group select:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}
.form-group input::placeholder { color: var(--text-faint); }

/* 라디오 */
.radio-group { display: flex; gap: 0; margin-top: 8px; }
.radio-group label {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 10px 16px; background: var(--bg-input); border: 1px solid var(--border);
    cursor: pointer; font-weight: 400; font-size: 0.95em; color: var(--text-muted);
    transition: all 0.2s; margin-bottom: 0;
}
.radio-group label:first-child { border-radius: 8px 0 0 8px; }
.radio-group label:last-child { border-radius: 0 8px 8px 0; border-left: none; }
.radio-group input[type="radio"] { display: none; }
.radio-group label.active {
    background: var(--bg-info); border-color: var(--accent);
    color: var(--accent); font-weight: 600;
}
.radio-group label.active + label { border-left-color: var(--accent); }

/* 시간 */
.time-input-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.time-field { position: relative; }
.time-field label { font-size: 0.85em; color: var(--text-muted); margin-bottom: 6px; }
.time-field input { text-align: center; }
.time-helper {
    margin-top: 10px; padding: 10px 14px; background: var(--bg-info);
    border-radius: 8px; font-size: 0.9em; color: var(--accent);
    display: flex; align-items: center; gap: 8px;
}
.unknown-check {
    margin-top: 12px; display: flex; align-items: center; gap: 8px;
    color: var(--text-muted); font-size: 0.9em; cursor: pointer;
}
.unknown-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* 버튼 */
.btn {
    width: 100%; padding: 14px;
    background: linear-gradient(135deg, var(--green) 0%, #2ea043 100%);
    color: white; border: 1px solid var(--green); border-radius: 8px;
    font-size: 1.1em; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: all 0.2s; margin-top: 8px;
}
.btn:hover { box-shadow: 0 4px 16px rgba(46, 160, 67, 0.3); }
.btn:active { transform: scale(0.98); }

/* 결과 */
.result-section { display: none; }
.result-section.show { display: block; animation: fadeIn 0.4s ease; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 사주 */
.saju-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.pillar {
    text-align: center; padding: 16px 8px; background: var(--bg-input);
    border: 1px solid var(--border); border-radius: 10px; transition: background 0.3s;
}
.pillar-title { font-size: 0.8em; color: var(--text-muted); margin-bottom: 10px; font-weight: 500; }
.pillar-char { font-size: 1.6em; font-weight: 700; color: var(--text-primary); margin: 4px 0; line-height: 1.3; }
.pillar-element { font-size: 0.75em; margin-top: 4px; padding: 3px 10px; border-radius: 20px; display: inline-block; font-weight: 500; }

/* 오행 바 */
.element-bars { margin-top: 16px; }
.element-bar { margin-bottom: 16px; }
.element-label { display: flex; justify-content: space-between; margin-bottom: 6px; font-weight: 500; font-size: 0.95em; }
.bar-container { width: 100%; height: 28px; background: var(--bar-bg); border-radius: 6px; overflow: hidden; }
.bar-fill {
    height: 100%; border-radius: 6px; transition: width 0.8s ease;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 600; font-size: 0.8em;
}
.wood { background: linear-gradient(90deg, var(--green), var(--green-bright)); }
.fire { background: linear-gradient(90deg, var(--red), var(--red-bright)); }
.earth { background: linear-gradient(90deg, var(--yellow), var(--yellow-bright)); }
.metal { background: linear-gradient(90deg, #6e7681, var(--metal-color)); }
.water { background: linear-gradient(90deg, #1f6feb, var(--accent)); }

/* 산 추천 */
.recommendation-note {
    background: var(--bg-info); padding: 16px; border-radius: 8px;
    margin-bottom: 20px; border-left: 3px solid var(--accent);
    line-height: 1.7; font-size: 0.95em; color: var(--text-secondary);
}
.recommendation-note strong { color: var(--accent); }
.mountain-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-top: 16px; }
.mountain-card {
    padding: 20px; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 10px; transition: all 0.2s;
}
.mountain-card:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(88,166,255,0.1); transform: translateY(-3px); }
.mountain-name { font-size: 1.15em; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.mountain-location { color: var(--text-muted); font-size: 0.85em; margin-bottom: 4px; }
.mountain-elevation { font-size: 0.82em; color: var(--text-faint); }
.mountain-element { display: inline-block; padding: 4px 14px; border-radius: 20px; font-size: 0.82em; font-weight: 600; margin-top: 10px; }
.mountain-description { color: var(--text-muted); font-size: 0.9em; margin-top: 10px; line-height: 1.6; }

/* 산 카드 링크 */
.mountain-links {
    display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap;
}
.mountain-links a {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 6px; font-size: 0.82em; font-weight: 500;
    text-decoration: none; transition: all 0.2s; border: 1px solid var(--border);
}
.mountain-links a:hover { transform: translateY(-1px); }
.mountain-links .link-naver {
    background: #03c75a15; color: #03c75a; border-color: #03c75a40;
}
.mountain-links .link-naver:hover { background: #03c75a25; }
.mountain-links .link-youtube {
    background: #ff000015; color: #ff4444; border-color: #ff000040;
}
.mountain-links .link-youtube:hover { background: #ff000025; }

body.light .mountain-links .link-naver { background: #03c75a12; color: #03a04e; }
body.light .mountain-links .link-youtube { background: #ff000012; color: #cc0000; }

/* 오행 태그 */
.element-wood { background: rgba(35, 134, 54, 0.2); color: var(--green-bright); }
.element-fire { background: rgba(218, 54, 51, 0.2); color: var(--red-bright); }
.element-earth { background: rgba(158, 106, 3, 0.2); color: var(--yellow-bright); }
.element-metal { background: rgba(110, 118, 129, 0.2); color: var(--metal-color); }
.element-water { background: rgba(31, 111, 235, 0.2); color: var(--accent); }

body.light .element-wood { background: #dcfce7; color: #166534; }
body.light .element-fire { background: #fee2e2; color: #991b1b; }
body.light .element-earth { background: #fef3c7; color: #92400e; }
body.light .element-metal { background: #f3f4f6; color: #374151; }
body.light .element-water { background: #dbeafe; color: #1e40af; }

/* 푸터 */
.footer { text-align: center; padding: 30px 20px; color: var(--text-faint); font-size: 0.82em; line-height: 1.8; }

/* 서브타이틀 */
.card-subtitle { color: var(--text-secondary); font-size: 1.05em; margin-bottom: 16px; font-weight: 600; }

/* 분석 텍스트 */
.analysis-text { color: var(--text-secondary); line-height: 1.9; font-size: 0.95em; }
.analysis-text p { margin-bottom: 14px; }
.analysis-text p:last-child { margin-bottom: 0; }
.analysis-text .highlight { color: var(--accent); font-weight: 600; }
.analysis-text .highlight-fire { color: var(--red-bright); font-weight: 600; }
.analysis-text .highlight-wood { color: var(--green-bright); font-weight: 600; }
.analysis-text .highlight-earth { color: var(--yellow-bright); font-weight: 600; }
.analysis-text .highlight-metal { color: var(--metal-color); font-weight: 600; }
.analysis-text .highlight-water { color: var(--accent); font-weight: 600; }
.analysis-text .sub-heading {
    display: block; color: var(--accent); font-weight: 600; font-size: 1em;
    margin-top: 20px; margin-bottom: 8px; padding-left: 12px; border-left: 3px solid var(--accent);
}
.analysis-text .info-box {
    background: var(--bg-info); border-radius: 8px; padding: 14px 16px;
    margin: 12px 0; border-left: 3px solid var(--accent);
}
.analysis-text .info-box.warn { border-left-color: var(--yellow-bright); background: var(--bg-warn); }
.analysis-text .info-box.good { border-left-color: var(--green-bright); background: var(--bg-good); }
.analysis-text ul { list-style: none; padding: 0; margin: 10px 0; }
.analysis-text ul li { padding: 6px 0 6px 20px; position: relative; }
.analysis-text ul li::before { content: '\2022'; position: absolute; left: 4px; color: var(--accent); }

/* 월운 기둥 */
.monthly-pillar {
    display: inline-flex; gap: 8px; align-items: center;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 10px; padding: 14px 24px; margin-bottom: 20px;
}
.monthly-pillar .mp-char { font-size: 1.8em; font-weight: 700; color: var(--text-primary); }
.monthly-pillar .mp-label { font-size: 0.8em; color: var(--text-muted); text-align: center; }
.monthly-pillar .mp-element { font-size: 0.75em; padding: 2px 10px; border-radius: 20px; display: inline-block; margin-top: 4px; }
.monthly-pillar .mp-divider { width: 1px; height: 50px; background: var(--border); margin: 0 12px; }

/* ===== 네비게이션 탭 ===== */
.nav-tabs {
    display: flex; gap: 0; margin-bottom: 24px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
    overflow: hidden;
}
.nav-tab {
    flex: 1; padding: 14px 16px; border: none; background: none;
    color: var(--text-muted); font-size: 0.95em; font-weight: 500;
    font-family: inherit; cursor: pointer; transition: all 0.2s;
    border-bottom: 2px solid transparent;
}
.nav-tab:hover { color: var(--text-primary); background: var(--bg-input); }
.nav-tab.active {
    color: var(--accent); font-weight: 600;
    border-bottom-color: var(--accent); background: var(--bg-info);
}
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

/* ===== 국립공원 통계 ===== */
.park-summary {
    display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; justify-content: center;
}
.park-stat {
    display: flex; flex-direction: column; align-items: center;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 10px; padding: 14px 20px; min-width: 90px;
}
.park-stat .stat-num { font-size: 1.6em; font-weight: 700; color: var(--accent); }
.park-stat .stat-label { font-size: 0.78em; color: var(--text-muted); margin-top: 4px; }

/* ===== 국립공원 필터 ===== */
.park-filters {
    display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap;
}
.filter-btn {
    padding: 8px 18px; border-radius: 20px; border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text-muted); font-size: 0.88em;
    font-family: inherit; cursor: pointer; transition: all 0.2s; font-weight: 500;
}
.filter-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.filter-btn.active {
    background: var(--accent); color: #fff; border-color: var(--accent);
}
body.light .filter-btn.active { color: #fff; }

/* ===== 국립공원 카드 ===== */
.park-list {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
}
.park-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 10px; padding: 22px; transition: all 0.2s;
}
.park-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(88,166,255,0.08); }
.park-card .park-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.park-card .park-name { font-size: 1.2em; font-weight: 700; color: var(--text-primary); }
.park-card .park-number { font-size: 0.75em; color: var(--text-faint); background: var(--bg-input); padding: 2px 10px; border-radius: 10px; }
.park-card .park-type {
    display: inline-block; padding: 3px 12px; border-radius: 20px;
    font-size: 0.78em; font-weight: 600; margin-bottom: 10px;
}
.park-type.type-mountain { background: rgba(35,134,54,0.2); color: var(--green-bright); }
.park-type.type-sea { background: rgba(31,111,235,0.2); color: var(--accent); }
.park-type.type-historic { background: rgba(158,106,3,0.2); color: var(--yellow-bright); }

body.light .park-type.type-mountain { background: #dcfce7; color: #166534; }
body.light .park-type.type-sea { background: #dbeafe; color: #1e40af; }
body.light .park-type.type-historic { background: #fef3c7; color: #92400e; }

.park-card .park-meta { font-size: 0.85em; color: var(--text-muted); line-height: 1.8; }
.park-card .park-meta span { margin-right: 14px; }
.park-card .park-desc { font-size: 0.9em; color: var(--text-secondary); line-height: 1.6; margin-top: 10px; }

.park-card .park-links {
    display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap;
}
.park-card .park-links a {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 12px; border-radius: 6px; font-size: 0.78em; font-weight: 500;
    text-decoration: none; transition: all 0.2s; border: 1px solid var(--border);
    color: var(--text-muted);
}
.park-card .park-links a:hover { border-color: var(--accent); color: var(--accent); }
.park-card .park-links .link-official { color: var(--green-bright); border-color: rgba(35,134,54,0.4); }
.park-card .park-links .link-official:hover { background: rgba(35,134,54,0.1); }
.park-card .park-links .link-naver { color: #03c75a; border-color: #03c75a40; }
.park-card .park-links .link-naver:hover { background: #03c75a15; }
.park-card .park-links .link-youtube { color: #ff4444; border-color: #ff000040; }
.park-card .park-links .link-youtube:hover { background: #ff000015; }

body.light .park-card .park-links .link-naver { color: #03a04e; }
body.light .park-card .park-links .link-youtube { color: #cc0000; }

/* 반응형 */
@media (max-width: 768px) {
    body { padding: 10px; }
    .header { padding: 30px 10px 20px; }
    .header h1 { font-size: 1.6em; }
    .card { padding: 20px 16px; }
    .saju-grid { gap: 6px; }
    .pillar { padding: 12px 4px; }
    .pillar-char { font-size: 1.3em; }
    .mountain-list { grid-template-columns: 1fr; }
    .park-list { grid-template-columns: 1fr; }
    .park-summary { gap: 8px; }
    .park-stat { min-width: 70px; padding: 10px 14px; }
    .park-stat .stat-num { font-size: 1.3em; }
    .park-filters { gap: 6px; }
    .filter-btn { padding: 6px 14px; font-size: 0.82em; }
    .nav-tab { padding: 12px 10px; font-size: 0.88em; }
    .theme-toggle { top: 10px; right: 10px; padding: 6px 10px; font-size: 1em; }
    .theme-toggle .label { display: none; }
}
