:root {
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-primary: #ffffff;
    --text-secondary: #e2e8f0;
    --accent-color: #3b82f6;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Microsoft YaHei', sans-serif;
    background: #0f172a;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding-top: 80px; /* 为导航栏留空 */
}

/* 导航栏 */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    box-sizing: border-box;
    z-index: 1000;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 0;
}

.nav-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-color);
}

.nav-links button {
    margin-left: 1rem;
    background: transparent;
    border: 1px solid transparent;
}

.nav-links button:hover {
    border-color: var(--glass-border);
    background: rgba(255,255,255,0.05);
}

/* 响应式文字控制 */
.mobile-text { display: none; }
.desktop-text { display: inline; }

/* 动态背景 */
.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    animation: float 20s infinite;
}

.orb-1 { width: 400px; height: 400px; background: #4f46e5; top: -100px; left: -100px; }
.orb-2 { width: 300px; height: 300px; background: #ec4899; bottom: 20%; right: -50px; animation-delay: -5s; }
.orb-3 { width: 250px; height: 250px; background: #06b6d4; bottom: -50px; left: 20%; animation-delay: -10s; }

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(30px, -50px); }
    66% { transform: translate(-20px, 20px); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* 毛玻璃卡片 */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    transition: transform 0.3s ease;
}

.header { text-align: center; margin-bottom: 3rem; }
.title { font-size: 3rem; font-weight: bold; background: linear-gradient(to right, #fff, #94a3b8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 0.5rem; }
.subtitle { color: var(--text-secondary); font-size: 1.1rem; }

/* 表单样式 */
.input-group { display: flex; gap: 1rem; justify-content: center; margin-top: 2rem; flex-wrap: wrap; }
input, select, button { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--glass-border); padding: 12px 24px; border-radius: 12px; color: white; font-size: 1rem; outline: none; transition: all 0.3s; }
input:focus, select:focus { background: rgba(255, 255, 255, 0.1); border-color: var(--accent-color); }
button { background: var(--accent-color); cursor: pointer; font-weight: bold; }
button:hover { filter: brightness(1.1); transform: scale(1.05); }
button:disabled { background: #64748b; cursor: not-allowed; }

.query-input {
    flex: 1;
    min-width: 300px;
}

/* 结果区域 */
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; display: none; }
.full-width-card { grid-column: 1 / -1; }

.bazi-compare-container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 2rem;
}
.bazi-column {
    flex: 1;
    min-width: 300px;
}
.bazi-separator {
    display: flex;
    align-items: center;
    justify-content: center;
}

.bazi-box { display: flex; justify-content: space-between; text-align: center; }
.pillar { display: flex; flex-direction: column; gap: 0.5rem; flex: 1; align-items: center; }
.gan, .zhi { font-size: 1.5rem; font-weight: bold; width: 50px; height: 50px; line-height: 50px; border-radius: 10px; background: rgba(255,255,255,0.05); }
.shen-label { font-size: 0.8rem; color: #94a3b8; width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.wuxing-chart-container { height: 300px; position: relative; }
.analysis-text { line-height: 1.8; color: var(--text-secondary); white-space: pre-wrap; }
.qimen-info-box { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 10px; font-size: 1.1rem; }

.loading { text-align: center; display: none; padding: 2rem; }
.spinner { width: 40px; height: 40px; border: 4px solid rgba(255,255,255,0.1); border-left-color: var(--accent-color); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 1rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 五行颜色 */
.wx-木 { color: #4ade80; }
.wx-火 { color: #f87171; }
.wx-土 { color: #fbbf24; }
.wx-金 { color: #94a3b8; }
.wx-水 { color: #60a5fa; }

/* 日历样式 */
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.cal-day {
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 10px;
    min-height: 80px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.cal-day:hover { background: rgba(255,255,255,0.1); border-color: var(--accent-color); }
.cal-date { font-size: 1.2rem; font-weight: bold; margin-bottom: 5px; }
.cal-info { font-size: 0.8rem; color: #94a3b8; }
.cal-level { margin-top: 5px; font-weight: bold; display: block; }

.level-大吉 { color: #4ade80; }
.level-吉 { color: #86efac; }
.level-平 { color: #cbd5e1; }
.level-凶 { color: #fca5a5; }
.level-大凶 { color: #ef4444; }

/* 模态框 */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 2000; justify-content: center; align-items: center; }
.modal-content { width: 90%; max-width: 800px; max-height: 90vh; overflow-y: auto; position: relative; }
.close-modal { position: absolute; top: 20px; right: 20px; font-size: 2rem; cursor: pointer; color: #fff; }

.hours-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; margin-top: 20px; }
.hour-item {
    background: rgba(255,255,255,0.05);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}
.hour-score { font-size: 1.2rem; font-weight: bold; margin: 5px 0; }
.ai-btn { background: linear-gradient(45deg, #4f46e5, #ec4899); border: none; font-size: 1.1rem; padding: 15px 40px; border-radius: 30px; box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4); width: 100%; max-width: 300px;}
.modal-input-container { text-align: center; margin-top: 2rem; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 20px; }
.modal-input { width: 80%; padding: 12px; margin-bottom: 15px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.2); }

/* ========== 移动端适配 (断点：768px) ========== */
@media (max-width: 768px) {
    /* 切换显示文字 */
    .mobile-text { display: inline; }
    .desktop-text { display: none; }

    body {
        padding-top: 60px; /* 导航栏变矮 */
    }

    .nav-bar {
        height: 60px;
        padding: 0 10px; /* 减小左右内边距 */
        width: 100%; /* 强制回满宽，防止塌陷 */
    }
    .nav-title {
        font-size: 1.1rem; /* 稍微调小标题 */
        flex-shrink: 0; /* 防止标题被压缩 */
        margin-right: auto; /* 将右侧按钮推到最右边 */
    }
    .nav-links {
        display: flex;
        gap: 5px; /* 按钮间距 */
    }
    .nav-links button {
        margin-left: 0;
        padding: 6px 10px;
        font-size: 0.85rem;
        white-space: nowrap; /* 防止文字换行 */
    }

    /* 手机端隐藏部分文字，只保留核心语义或使用紧凑布局 */
    .container {
        padding: 1rem;
    }

    .glass-card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .title {
        font-size: 2rem;
    }
    .header {
        margin-bottom: 2rem;
    }

    .input-group {
        flex-direction: column;
        align-items: stretch;
        margin-top: 1rem; /* 减小顶部间距 */
    }
    .input-group > * {
        width: 100%;
        box-sizing: border-box; /* 确保 padding 不撑大宽度 */
        margin-bottom: 10px; /* 增加垂直间距 */
    }
    input, select, button {
        width: 100%; /* 强制宽度 */
        padding: 12px 15px; /* 减小 padding */
    }
    .query-input {
        min-width: 0; /* 允许更小 */
    }

    .result-grid {
        grid-template-columns: 1fr; /* 强制单列 */
        gap: 1.5rem;
    }

    .bazi-compare-container {
        flex-direction: column;
        gap: 1.5rem;
    }
    .bazi-column {
        min-width: 100%;
    }
    .bazi-separator {
        transform: rotate(90deg); /* 闪电图标旋转，表示上下关系 */
        margin: 0.5rem 0;
    }
    .bazi-box {
        justify-content: space-around;
        gap: 5px; /* 减小间距 */
    }

    .gan, .zhi {
        width: 40px;
        height: 40px;
        line-height: 40px;
        font-size: 1.2rem;
        border-radius: 8px;
    }
    
    .shen-label {
        font-size: 0.7rem;
    }

    .wuxing-chart-container {
        height: 250px;
    }

    /* 日历适配 */
    .calendar-header h2 {
        font-size: 1.2rem;
    }
    .calendar-grid {
        gap: 5px;
    }
    .cal-day {
        min-height: 60px;
        padding: 5px;
        border-radius: 6px;
    }
    .cal-date {
        font-size: 1rem;
    }
    .cal-info {
        font-size: 0.7rem;
    }

    /* 模态框 */
    .modal-content {
        padding: 1.5rem;
        width: 95%;
    }
    .hours-list {
        grid-template-columns: repeat(2, 1fr); /* 手机上两列 */
        gap: 10px;
    }
    .hour-item {
        padding: 10px;
    }
    .modal-input {
        width: 100%;
        box-sizing: border-box;
    }
}
