/* ================================================================
 * 主页（排盘页）专用样式
 * ================================================================ */

/* ---- 主容器 ---- */
.container {
    max-width: 860px;
    width: 100%;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-xl) var(--space-xl) 20px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-base);
    margin-bottom: 20px;
}

/* ---- 标题区域 ---- */
.header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.header h1 {
    font-size: 1.64rem;
    font-weight: 700;
    letter-spacing: 6px;
    color: var(--text-gold);
    text-shadow: 0 2px 12px rgba(200, 150, 80, 0.25);
}

.header h1 span {
    color: var(--text-accent);
    font-weight: 300;
}

.header .subtitle {
    font-size: 0.78rem;
    color: var(--text-light);
    letter-spacing: 4px;
    margin-top: 4px;
    font-style: italic;
}

/* ---- 标题下方广告卡片（融入页面风格） ---- */
.ad-card {
    margin-top: var(--space-xl);
    background: var(--bg-inner);
    border: 1px solid var(--border-base);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 215, 150, 0.05);
}

.ad-card-label {
    font-size: 0.64rem;
    color: var(--text-fade);
    letter-spacing: 3px;
    text-align: center;
    padding: 6px 0 4px;
    border-bottom: 1px solid var(--border-light);
    background: rgba(60, 44, 34, 0.25);
    text-transform: uppercase;
}

.ad-card-body {
    padding: var(--space-md) var(--space-sm);
    text-align: center;
    overflow: hidden;
}

.ad-card-body:empty {
    display: none;
}

.ad-card-body img,
.ad-card-body a {
    max-width: 100%;
}

.ad-card-body table,
.ad-card-body div {
    margin: 0 auto !important;
}

/* ---- 表单网格 ---- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.btn-row {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    margin: 4px 0 2px;
}

/* ---- 结果区域 ---- */
.result {
    margin-top: var(--space-xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border-base);
    display: none;
}

.result.show {
    display: block;
    animation: fadeUp var(--anim-slow) var(--ease-out);
}

/* ---- 四柱卡片 ---- */
.pillars {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
}

.pillar {
    background: var(--bg-inner);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-base);
    padding: 10px 4px 8px;
    text-align: center;
    transition: all var(--anim-normal) var(--ease-out);
    position: relative;
}

.pillar:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-float);
    border-color: var(--border-focus);
}

.pillar.day-master {
    border-color: var(--border-focus);
    background: rgba(60, 44, 34, 0.5);
}

.pillar.day-master::after {
    content: '日主';
    position: absolute;
    top: -8px;
    right: 50%;
    transform: translateX(50%);
    font-size: 0.6rem;
    color: var(--bg-main);
    background: var(--text-accent);
    padding: 1px 8px;
    border-radius: 20px;
    letter-spacing: 1px;
    white-space: nowrap;
}

.pillar .label {
    font-size: 0.71rem;
    color: var(--text-fade);
    letter-spacing: 2px;
    font-weight: 300;
    margin-bottom: 4px;
}

.pillar .gan {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-gold);
    line-height: 1.1;
}

.pillar.day-master .gan {
    color: #f5e0c0;
    text-shadow: 0 0 20px rgba(200, 160, 100, 0.2);
}

.pillar .zhi {
    font-size: 1.36rem;
    color: #d4b894;
    line-height: 1.1;
}

.pillar .wu-xing {
    font-size: 0.71rem;
    color: var(--text-sub);
    margin-top: 4px;
    display: inline-block;
    background: var(--bg-tag);
    padding: 1px 8px;
    border-radius: 20px;
}

.pillar .cang-gan {
    font-size: 0.64rem;
    color: var(--text-weak);
    margin-top: 3px;
    line-height: 1.3;
}

.pillar .shi-shen {
    font-size: 0.64rem;
    color: var(--text-accent);
    margin-top: 2px;
    opacity: 0.8;
}

/* ---- 信息网格 ---- */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.info-card {
    background: rgba(40, 30, 24, 0.4);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-xl);
    border: 1px solid var(--border-light);
    transition: border-color var(--anim-fast);
}

.info-card:hover {
    border-color: var(--border-focus);
}

.info-card .label {
    font-size: 0.64rem;
    color: var(--text-fade);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.info-card .value {
    font-size: 1.07rem;
    color: var(--text-gold);
    font-weight: 500;
    margin-top: 2px;
}

.info-card .sub {
    font-size: 0.71rem;
    color: var(--text-light);
    margin-top: 2px;
}

/* ---- 五行分布条形图 ---- */
.wx-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
}

.wx-bar-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.71rem;
}

.wx-bar-row .wx-name {
    width: 16px;
    text-align: center;
    font-weight: 600;
}

.wx-bar-row .wx-track {
    flex: 1;
    height: 10px;
    background: rgba(160, 120, 80, 0.08);
    border-radius: 5px;
    overflow: hidden;
}

.wx-bar-row .wx-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s var(--ease-out);
    min-width: 2px;
}

.wx-bar-row[data-wx="木"] .wx-name { color: var(--wx-wood); }
.wx-bar-row[data-wx="木"] .wx-fill { background: var(--wx-wood); }
.wx-bar-row[data-wx="火"] .wx-name { color: var(--wx-fire); }
.wx-bar-row[data-wx="火"] .wx-fill { background: var(--wx-fire); }
.wx-bar-row[data-wx="土"] .wx-name { color: var(--wx-earth); }
.wx-bar-row[data-wx="土"] .wx-fill { background: var(--wx-earth); }
.wx-bar-row[data-wx="金"] .wx-name { color: var(--wx-metal); }
.wx-bar-row[data-wx="金"] .wx-fill { background: var(--wx-metal); }
.wx-bar-row[data-wx="水"] .wx-name { color: var(--wx-water); }
.wx-bar-row[data-wx="水"] .wx-fill { background: var(--wx-water); }

.wx-bar-row .wx-count {
    width: 28px;
    text-align: right;
    color: var(--text-sub);
}

/* ---- 大运区域 ---- */
.dayun-section {
    margin-top: var(--space-md);
    background: var(--bg-dark);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-base);
    padding: var(--space-lg) var(--space-xl);
}

.dayun-title {
    font-size: 0.93rem;
    font-weight: 600;
    color: var(--text-accent);
    letter-spacing: 2px;
    margin-bottom: var(--space-md);
}

.dayun-list {
    display: flex;
    gap: var(--space-xs);
    overflow-x: auto;
    padding-bottom: 4px;
}

.dayun-item {
    flex-shrink: 0;
    min-width: 56px;
    text-align: center;
    padding: 6px 4px;
    border-radius: var(--radius-sm);
    background: rgba(40, 30, 24, 0.4);
    border: 1px solid var(--border-light);
    transition: all var(--anim-fast);
    cursor: default;
}

.dayun-item:hover {
    border-color: var(--border-focus);
    transform: translateY(-2px);
}

.dayun-item.current {
    border-color: var(--text-accent);
    background: rgba(60, 44, 34, 0.6);
    box-shadow: 0 0 12px rgba(200, 160, 100, 0.15);
}

.dayun-item .age {
    font-size: 0.64rem;
    color: var(--text-fade);
}

.dayun-item .gz {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-gold);
    margin-top: 2px;
}

.dayun-item .wx {
    font-size: 0.6rem;
    color: var(--text-sub);
    margin-top: 1px;
}

/* ---- 评分面板 ---- */
.score-panel {
    display: none;
    gap: var(--space-xl);
    margin-bottom: var(--space-md);
    padding: var(--space-lg) var(--space-xl);
    background: var(--bg-dark);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.score-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.score-item .score-label {
    font-size: 0.71rem;
    color: var(--text-fade);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.score-item .score-bar {
    width: 100%;
    height: 8px;
    background: rgba(160, 120, 80, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.score-item .score-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--text-accent), var(--text-gold));
    transition: width 0.8s var(--ease-out);
}

.score-item .score-value {
    font-size: 1.14rem;
    font-weight: 700;
    color: var(--text-gold);
}

/* ---- AI 推演模块 ---- */
.ai-section {
    margin-top: var(--space-md);
    background: var(--bg-dark);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-base);
    overflow: hidden;
}

.ai-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-xl);
    background: rgba(60, 44, 34, 0.3);
    border-bottom: 1px solid var(--border-light);
}

.ai-header .brand {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: 0.93rem;
    font-weight: 600;
    color: var(--text-accent);
    letter-spacing: 2px;
}

.ai-header .brand .badge {
    font-size: 0.64rem;
    background: var(--bg-tag-strong);
    padding: 1px 10px;
    border-radius: 30px;
    color: var(--text-sub);
    letter-spacing: 1px;
    border: 1px solid var(--border-base);
}

.ai-header .status {
    font-size: 0.79rem;
    color: var(--text-fade);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.ai-header .status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-weak);
    display: inline-block;
    transition: var(--anim-fast);
}

.ai-header .status .dot.active {
    background: #7cb87c;
    box-shadow: 0 0 10px rgba(124, 184, 124, 0.3);
    animation: pulse 1.2s infinite;
}

.ai-body {
    padding: var(--space-lg) var(--space-xl) 18px;
    min-height: 80px;
}

.ai-body .thinking {
    color: var(--text-fade);
    font-style: italic;
    font-size: 0.93rem;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.ai-body .thinking .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(160, 120, 80, 0.2);
    border-top-color: var(--text-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.ai-output {
    font-size: 1rem;
    line-height: 1.9;
    color: #d4c0a8;
    letter-spacing: 0.4px;
    white-space: pre-wrap;
    word-break: break-word;
    animation: fadeInContent var(--anim-slow) ease-out;
}

.ai-output em {
    color: var(--text-gold);
    font-style: normal;
    font-weight: 600;
    background: linear-gradient(90deg, var(--text-accent), var(--text-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ai-output .highlight {
    color: #e8c89a;
    font-weight: 600;
}

.ai-output .section-title {
    display: block;
    font-weight: 700;
    color: var(--text-gold);
    letter-spacing: 2px;
    margin-top: 10px;
    margin-bottom: 2px;
    font-size: 1.07rem;
    padding-left: 8px;
    border-left: 3px solid var(--text-accent);
}

.ai-output .section-title:first-of-type {
    margin-top: 0;
}

.ai-output .inline-tag {
    display: inline-block;
    background: var(--bg-tag);
    padding: 0 8px;
    border-radius: 4px;
    border: 1px solid var(--border-light);
}

.ai-footer {
    padding: 4px var(--space-xl) 10px;
    font-size: 0.71rem;
    color: var(--text-weak);
    text-align: right;
    letter-spacing: 1px;
    border-top: 1px solid var(--border-light);
}

.footer-note {
    text-align: center;
    font-size: 0.71rem;
    color: var(--text-weak);
    margin-top: var(--space-lg);
    letter-spacing: 1px;
    border-top: 1px solid var(--border-light);
    padding-top: var(--space-lg);
}

/* ---- 导航链接 ---- */
.nav-links {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    margin-bottom: var(--space-lg);
}

.nav-links a {
    color: var(--text-fade);
    text-decoration: none;
    font-size: 0.79rem;
    letter-spacing: 2px;
    transition: color var(--anim-fast);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-accent);
    background: var(--bg-tag);
}

/* ---- 响应式 ---- */
@media (max-width: 700px) {
    .container {
        padding: var(--space-lg) var(--space-lg) 16px;
    }

    .header h1 {
        font-size: 1.29rem;
        letter-spacing: 4px;
    }

    .form-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-sm);
    }

    .pillars {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-xs);
    }

    .info-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .btn {
        padding: 4px 12px;
        font-size: 0.86rem;
        height: 32px;
        max-width: 100%;
    }

    .btn-row {
        flex-wrap: wrap;
    }

    .btn-secondary {
        max-width: 100%;
    }

    .ai-body {
        padding: 10px var(--space-lg) 14px;
    }

    .ai-output {
        font-size: 0.93rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px 6px 12px;
    }

    .form-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-xs);
    }

    .pillar .gan {
        font-size: 1.14rem;
    }

    .pillar .zhi {
        font-size: 1rem;
    }

    .pillar {
        padding: 6px 2px;
    }

    .header h1 {
        font-size: 1.14rem;
    }

    .btn {
        font-size: 0.79rem;
        height: 28px;
        letter-spacing: 2px;
    }

    .ai-output {
        font-size: 0.86rem;
    }

    .ai-output .section-title {
        font-size: 0.93rem;
    }
}
