/* ============================================================
   京房知道 - 主样式表
   淡黄宣纸 #F5F0E0 | 纯黑 #1A1A1A | 朱砂红 #C3272B | 金色 #C9A84C
   ============================================================ */

/* --- CSS Variables --- */
:root {
    --bg-primary: #F5F0E0;
    --bg-card: #FAF6EA;
    --bg-card-hover: #F5EFD8;
    --text-primary: #1A1A1A;
    --text-secondary: #8D6E63;
    --text-muted: #5A4A3A;
    --cinnabar: #C3272B;
    --gold: #C9A84C;
    --border-color: rgba(26, 26, 26, 0.1);
    --vermilion: #C3272B;
    --bronze: #8D6E63;
    --wood: #4CAF50;
    --fire: #F44336;
    --earth: #FF9800;
    --metal: #9E9E9E;
    --water: #2196F3;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Noto Serif SC', 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- 旋转八卦背景 --- */
.bagua-bg {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 600px;
    height: 600px;
    transform: translate(-50%, -50%);
    background: rgba(160, 128, 64, 0.08);
    border-radius: 50%;
    animation: baguaSpin 25s linear infinite;
    pointer-events: none;
    z-index: 0;
}
.bagua-bg::before {
    content: '☯';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 200px;
    color: #A08040;
    opacity: 0.12;
    text-shadow: 0 0 60px rgba(160, 128, 64, 0.3),
                 0 0 120px rgba(160, 128, 64, 0.15),
                 0 0 200px rgba(160, 128, 64, 0.08);
}
@keyframes baguaSpin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes baguaPulse {
    0%, 100% { opacity: 0.08; }
    50% { opacity: 0.12; }
}

/* --- 金光粒子 --- */
.particle-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* --- 导航栏 --- */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: rgba(245, 240, 224, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-brand { display: flex; align-items: center; gap: 0.5rem; }
.logo { display: flex; align-items: center; gap: 0.5rem; }
.logo i { font-size: 1.5rem; color: var(--cinnabar); }
.logo span { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }
.tagline { font-size: 0.75rem; color: var(--text-muted); }
.nav-menu { display: flex; gap: 0.3rem; }
.nav-link {
    padding: 0.5rem 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: 6px;
    transition: all 0.2s;
}
.nav-link:hover { color: var(--cinnabar); background: rgba(195,39,43,0.05); }
.nav-link.active { color: var(--cinnabar); background: rgba(195,39,43,0.08); font-weight: 600; }

/* --- 主内容 --- */
.main-content {
    max-width: 1200px;
    margin: 5rem auto 2rem;
    padding: 0 1.5rem;
    position: relative;
    z-index: 1;
}

.page { display: none; }
.page.active { display: block; }

/* --- 首页 - Hero --- */
.hero-section {
    display: flex;
    align-items: center;
    gap: 3rem;
    padding: 3rem 0;
    min-height: 60vh;
}
.hero-content { flex: 1; }
.hero-title {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1.3;
    background: linear-gradient(135deg, var(--cinnabar), #8B0000);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 1rem 0 2rem;
    line-height: 1.8;
}
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero-visual { flex: 0 0 300px; }

/* --- 太极 --- */
.taiji-container {
    width: 280px; height: 280px;
    position: relative;
    margin: 0 auto;
}
.taiji {
    width: 200px; height: 200px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--cinnabar) 0deg 180deg, #fff 180deg 360deg);
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 40px rgba(195,39,43,0.2);
    animation: taijiSpin 12s linear infinite;
}
.taiji::before {
    content: '';
    position: absolute;
    top: 25%; left: 50%;
    width: 25px; height: 25px;
    background: var(--cinnabar);
    border-radius: 50%;
    transform: translateX(-50%);
}
.taiji::after {
    content: '';
    position: absolute;
    bottom: 25%; left: 50%;
    width: 25px; height: 25px;
    background: #fff;
    border-radius: 50%;
    transform: translateX(-50%);
}
@keyframes taijiSpin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* --- 八卦符号轨道 --- */
.orbit { position: absolute; width: 100%; height: 100%; }
.orbit-item {
    position: absolute;
    font-size: 1.5rem;
    animation: orbitSpin 20s linear infinite;
    animation-delay: calc(var(--i) * -2.5s);
    transform-origin: 140px 140px;
}
.orbit-item:nth-child(1) { transform: rotate(0deg) translateY(-100px); }
.orbit-item:nth-child(2) { transform: rotate(45deg) translateY(-100px); }
.orbit-item:nth-child(3) { transform: rotate(90deg) translateY(-100px); }
.orbit-item:nth-child(4) { transform: rotate(135deg) translateY(-100px); }
.orbit-item:nth-child(5) { transform: rotate(180deg) translateY(-100px); }
.orbit-item:nth-child(6) { transform: rotate(225deg) translateY(-100px); }
.orbit-item:nth-child(7) { transform: rotate(270deg) translateY(-100px); }
.orbit-item:nth-child(8) { transform: rotate(315deg) translateY(-100px); }

/* --- 功能卡片 --- */
.features-section { padding: 2rem 0; }
.section-title {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--cinnabar);
}
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}
.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s;
}
.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.06);
}
.feature-icon { font-size: 2.5rem; color: var(--cinnabar); margin-bottom: 1rem; }
.feature-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.feature-card p { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 1rem; }

/* --- 页面标题 --- */
.page-header {
    text-align: center;
    padding: 2rem 0;
}
.page-header h2 { font-size: 1.5rem; color: var(--cinnabar); }
.page-header p { color: var(--text-secondary); font-size: 0.9rem; margin-top: 0.3rem; }

/* --- 按钮 --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-primary {
    background: var(--cinnabar);
    color: #fff;
}
.btn-primary:hover { background: #A02020; transform: translateY(-1px); }
.btn-secondary {
    background: linear-gradient(135deg, #4A6FA5, #3A5A8A);
    color: #fff;
}
.btn-secondary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-outline {
    background: transparent;
    border: 1px solid var(--cinnabar);
    color: var(--cinnabar);
}
.btn-outline:hover { background: rgba(195,39,43,0.05); }
.btn-large { padding: 0.8rem 1.8rem; font-size: 1rem; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.75rem; }
.btn-test {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.btn-test:hover { border-color: var(--cinnabar); color: var(--cinnabar); }
.glow-btn {
    box-shadow: 0 2px 10px rgba(195,39,43,0.2);
}
.glow-btn:hover {
    box-shadow: 0 4px 20px rgba(195,39,43,0.3);
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- 表单 --- */
.bazi-container {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
}
.bazi-input-section, .bazi-result-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}
.bazi-input-section h3, .bazi-result-section h3 {
    font-size: 1rem;
    color: var(--cinnabar);
    margin-bottom: 1rem;
}
.form-group { margin-bottom: 0.8rem; }
.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}
.form-group input[type="date"],
.form-group input[type="time"],
.form-group input[type="text"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #fff;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: all 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--cinnabar);
    box-shadow: 0 0 0 3px rgba(195,39,43,0.1);
}
.radio-group { display: flex; gap: 1rem; }
.radio-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    font-size: 0.85rem;
}
.form-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }

.quick-test {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}
.quick-test h4 { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.test-buttons { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* --- 结果占位 --- */
.result-placeholder {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}
.placeholder-content i { font-size: 3rem; opacity: 0.3; margin-bottom: 1rem; }
.placeholder-content p { font-size: 0.85rem; }

/* --- 四柱八字（旧，保留兼容） --- */
.four-pillars h4 { font-size: 0.9rem; margin-bottom: 0.5rem; }
.pillars-grid { margin-bottom: 1rem; }
.pillar-card {
    padding: 1rem 0.8rem;
    border-radius: 12px;
    text-align: center;
    min-width: 70px;
    flex: 1;
}
.pillar-title { font-size: 0.7rem; color: rgba(255,255,255,0.8); margin-bottom: 0.3rem; }
.pillar-gan, .pillar-zhi { font-size: 1.5rem; font-weight: 900; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.pillar-nayin { font-size: 0.65rem; color: rgba(255,255,255,0.7); }

/* --- 解读区 --- */
.reading-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    margin-top: 0.8rem;
}
.reading-section h4 { color: var(--cinnabar); font-size: 1rem; margin-bottom: 0.5rem; }
.reading-section h5 { font-size: 0.9rem; margin: 0.5rem 0; }

/* --- 页脚 --- */
.footer {
    background: #1A1A1A;
    color: #ccc;
    padding: 2rem 1.5rem;
    margin-top: 3rem;
}
.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}
.footer-section h4 { color: var(--gold); font-size: 0.9rem; margin-bottom: 0.5rem; }
.footer-section p, .footer-section li { font-size: 0.8rem; color: #999; }
.footer-section ul { list-style: none; }
.footer-section a { color: #999; text-decoration: none; }
.footer-section a:hover { color: var(--gold); }
.social-links { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.social-links a { font-size: 1.2rem; color: #666; }
.footer-bottom {
    text-align: center;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid #333;
    font-size: 0.75rem;
    color: #666;
}

/* --- Toast通知 --- */
.notification {
    position: fixed;
    top: 4rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-size: 0.85rem;
    z-index: 999;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; } }

/* --- 响应式 --- */
@media (max-width: 768px) {
    .bazi-container { grid-template-columns: 1fr; }
    .hero-section { flex-direction: column; text-align: center; }
    .hero-actions { justify-content: center; }
    .hero-visual { flex: none; }
    .nav-menu { gap: 0; }
    .nav-link { font-size: 0.75rem; padding: 0.4rem 0.5rem; }
    .footer-content { grid-template-columns: 1fr; }
}

/* 命格分析加载动画 */
@keyframes loadingBar {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(200%); }
    100% { transform: translateX(400%); }
}

/* --- 命格分析全文展示优化 --- */
.reading-section {
    padding: 1rem 1.8rem;
}
.reading-section h4 {
    font-size: 1.1rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(195,39,43,0.12);
    padding-bottom: 0.4rem;
    margin-bottom: 0.6rem;
}
.reading-section h5 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0.6rem 0 0.2rem;
}
.reading-section p, .reading-section div[style], .reading-section strong + br + span, .reading-section {
    font-size: 0.9rem;
    line-height: 1.9;
}
.reading-section strong {
    font-weight: 600;
}

/* 排盘后结果区全宽 */
.bazi-result-section {
    grid-column: 1;
}

/* --- 合盘展示优化：全宽+字体 --- */
#hepan .bazi-container {
    max-width: 100%;
}
#hepan .bazi-input-section {
    max-width: 100%;
    margin: 0 auto;
}
/* 合盘输入表单横排 */
#hepan .hepan-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
#hepan .hepan-person {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem 1.2rem;
}
#hepan .bazi-result-section {
    grid-column: 1;
    max-width: 100%;
    margin: 1rem auto 0;
}
#hepan .reading-section {
    max-width: 100%;
    padding: 1.2rem 2rem;
}
#hepan .reading-section h4 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--cinnabar);
    border-bottom: 1px solid rgba(195,39,43,0.12);
    padding-bottom: 0.5rem;
    margin-bottom: 0.6rem;
}
#hepan .reading-section h5 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0.7rem 0 0.3rem;
    color: var(--text-primary);
}
#hepan .reading-section p, #hepan .reading-section div:not(.reading-section) {
    font-size: 0.92rem;
    line-height: 2;
    color: var(--text-primary);
}
#hepan .reading-section strong {
    color: var(--cinnabar);
    font-weight: 600;
}

/* 全局字体优化 */
.reading-section {
    font-size: 0.92rem;
    line-height: 2;
}
.reading-section p {
    margin-bottom: 0.4rem;
}
.reading-section br {
    content: '';
    display: block;
    margin: 0.2rem 0;
}

