/* =================================================
   全局重置 & 变量（明亮模式）
   ================================================= */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg: #eff3f8;
    --card-bg: #ffffff;
    --text-primary: #2c3e4e;
    --text-secondary: #6c7e9c;
    --accent: #c9a96b;
    --accent-dark: #b58a4b;
    --border-soft: #d9e2f0;
    --shadow-card: 0 10px 20px -5px rgba(0,0,0,0.08);
    --radius-card: 28px;
    --color-wood: #4caf50;
    --color-fire: #f44336;
    --color-earth: #cd853f;
    --color-metal: #daa520;
    --color-water: #2196f3;
    --modal-bg: rgba(0,0,0,0.5);
    --nav-height: 68px;
}

body {
    background: var(--bg);
    font-family: system-ui, 'Segoe UI', 'Noto Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    min-height: 100vh;
    line-height: 1.5;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

#app { position: relative; min-height: 100vh; }

/* =================================================
   1. 顶部导航栏
   ================================================= */
.navbar {
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    height: var(--nav-height);
    position: sticky;
    top: 0;
    z-index: 50;
}
.nav-brand-center {
    font-weight: 320;
    font-size: 1.8rem;
    color: #000;
    letter-spacing: 2px;
}

/* =================================================
   2. 页面卡片容器
   ================================================= */

.page-container {
    max-width: none;
    width: 100%;
    padding: 0 0 80px 0;   /* 底部给导航留白 */
    margin: 0;
}
.card {
    background: var(--card-bg);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 28px 24px;
    margin-bottom: 24px;
}
.page-title {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(145deg, #2c3e4e, #1f2e3c);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    margin-bottom: 6px;
}
.sub-title {
    font-size: 0.95rem;
    color: var(--text-secondary);
    border-left: 3px solid var(--accent);
    padding-left: 14px;
    margin-bottom: 24px;
}

/* =================================================
   3. 通用输入组件（下拉选择器、按钮）
   ================================================= */
.select-row {
    display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px;
}
.select-group {
    flex: 1 1 calc(20% - 10px); min-width: 85px; display: flex; flex-direction: column;
}
.select-group label {
    font-size: 0.8rem; font-weight: 600; color: #2c4a6e; margin-bottom: 6px;
}
.custom-select { position: relative; width: 100%; user-select: none; }
.select-trigger {
    width: 100%; padding: 10px 4px; font-size: 0.9rem; border: 1.5px solid var(--border-soft);
    border-radius: 28px; background: #fff; cursor: pointer; font-weight: 500;
    display: flex; justify-content: center; align-items: center; color: #1e2c3a;
    padding-right: 24px; transition: border-color 0.2s;
}
.select-trigger:hover { border-color: var(--accent); }
.select-trigger::after {
    content: '▾'; font-size: 10px; color: #7a5c3a; position: absolute;
    right: 10px; top: 50%; transform: translateY(-50%);
}
.dropdown-list {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    background: white; border: 1px solid var(--border-soft); border-radius: 16px;
    max-height: 200px; overflow-y: auto; z-index: 30;
    box-shadow: 0 8px 18px rgba(0,0,0,0.1); display: none;
}
.custom-select.open .dropdown-list { display: block; }
.dropdown-item {
    padding: 10px 12px; cursor: pointer; border-bottom: 1px solid #f0e4d0;
    color: var(--text-primary); text-align: center; font-size: 0.85rem; transition: background 0.15s;
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover, .dropdown-item.active { background: #f5e8d8; color: #8b5e3c; }

/* 通用按钮 */
.btn {
    display: block; width: 100%; background: #2c3e4e; border: none; padding: 16px;
    font-size: 1.1rem; font-weight: 600; border-radius: 60px; color: white; cursor: pointer;
    margin-top: 8px; text-align: center; transition: transform 0.2s, opacity 0.2s; letter-spacing: 0.5px;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { background: #eaecf0; color: #2c3e4e; margin-top: 16px; }

@media (max-width: 420px) {
    .select-group { flex: 1 1 calc(33.333% - 10px); }
}

/* =================================================
   4. 信息卡片（性别、年龄、日期等）
   ================================================= */
.info-grid {
    background: #fef9f0; border-radius: 24px; padding: 18px;
    margin: 18px 0 14px; display: flex; flex-wrap: wrap; gap: 10px;
}
.info-item { font-size: 0.9rem; color: var(--text-primary); display: flex; align-items: center; gap: 6px; }
.info-item .info-label { font-weight: 600; color: #7a5c3a; }

/* =================================================
   5. 八字命盘结果表格
   ================================================= */
.bazi-table-wrapper { width: 100%; overflow-x: visible; margin: 14px 0; }
.bazi-table {
    width: 100%; border-collapse: collapse; font-size: 0.95rem; table-layout: fixed; border: none;
}
.bazi-table th, .bazi-table td {
    padding: 14px 8px; text-align: center; vertical-align: middle; font-weight: 700; border: none;
}
.bazi-table thead th {
    background: #ffffff; color: #999; font-weight: normal; font-size: 0.9rem;
    writing-mode: horizontal-tb !important;
}
.bazi-table .row-label {
    font-weight: normal; color: #999; background: #ffffff; width: 70px; font-size: 0.9rem;
    writing-mode: horizontal-tb !important;
}

/* 天干、地支竖排 */
.bazi-table tbody tr:nth-child(2) td:not(.row-label),
.bazi-table tbody tr:nth-child(3) td:not(.row-label) {
    writing-mode: vertical-rl; text-orientation: mixed;
}
.bazi-table tbody tr:nth-child(1) td:not(.row-label) { writing-mode: horizontal-tb !important; }
.bazi-table tbody tr:nth-child(4) td:not(.row-label) .hide-list {
    display: flex; flex-direction: column; gap: 4px; align-items: center; font-size: 0.8rem; font-weight: 600;
}
.bazi-table tbody tr:nth-child(5) td:not(.row-label),
.bazi-table tbody tr:nth-child(6) td:not(.row-label),
.bazi-table tbody tr:nth-child(7) td:not(.row-label),
.bazi-table tbody tr:nth-child(8) td:not(.row-label) {
    writing-mode: horizontal-tb !important;
}
/* 藏干单元格顶部对齐 */
.bazi-table tbody tr:nth-child(4) td {
    vertical-align: top;
}



.gan-cell, .zhi-cell {
    font-size: 2.2rem; font-weight: 800; font-family: "Noto Serif SC", "Times New Roman", serif; display: block;
}

/* 统一内容字体颜色和大小（PC 端） */
.main-star-cell,
.self-sit-cell,
.xunkong-cell,
.nayin-cell {
    color: #2c2c2c;
    font-size: 0.9rem;
    font-weight: 400;
}

/* 神煞单项 */
.shensha-item {
    display: block; cursor: pointer; padding: 2px 6px; text-decoration: none;
    color: #c9a96b; font-weight: normal; transition: none; border-radius: 4px;
}
.shensha-item:hover { color: #d4b37c; background: transparent; }
.shensha-item:active { color: #8b5e3c; background: transparent; transform: none; }

/* 神煞内容从顶部对齐 */
.bazi-table tbody tr:last-child td {
    vertical-align: top;
}

/* =================================================
   移动端优化 (导航、表格、卡片、字体)
   ================================================= */
@media (max-width: 640px) {


    /* 卡片：微贴边 + 清晰轮廓 */
    .card {
    width: calc(100% - 8px);     /* 左右各留 4px 间距，更贴边 */
    max-width: 100%;
    border-radius: 16px;
    margin: 8px auto;            /* 上下间距不变，水平居中 */
    padding: 16px 12px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-soft, #e0e0e0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    box-sizing: border-box;
}

    /* 导航栏 */
    .navbar { height: 60px; padding: 0 16px; }
    .nav-brand-center { font-size: 1.5rem; }
    
     
    /* 表格自适应 */
    .bazi-table-wrapper { overflow-x: visible; width: 100%; }
    .bazi-table { font-size: 0.8rem; width: 100%; }
    .bazi-table th, .bazi-table td { padding: 8px 3px; }
    .bazi-table .row-label { width: 50px; font-size: 0.8rem; padding: 8px 2px; }

    .gan-cell, .zhi-cell { font-size: 1.6rem; }
    .hide-list { font-size: 0.9rem; gap: 3px; }
    .hide-item span { font-size: 0.9rem; }

    .main-star-cell,
    .self-sit-cell,
    .xunkong-cell,
    .nayin-cell {
        font-size: 0.9rem;
        color: #555;
    }
    .shensha-cell,
    .shensha-item {
        font-size: 0.9rem;
    }

/* 奇数行灰色，偶数行白色 */
/* 表格隔行换色：奇数行灰色，偶数行白色 */
.bazi-table tbody tr:nth-child(odd) td { background-color: #f0f0f0; }
.bazi-table tbody tr:nth-child(even) td { background-color: #ffffff; }
    /* 底部导航固定 */
    .bottom-nav {
        flex-shrink: 0;
        position: fixed;
        bottom: 0;
        width: 100%;
    }
    .picker-overlay {
        z-index: 200;
    }
}

/* =================================================
   6. 结果页导航栏
   ================================================= */
.result-navbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px; height: var(--nav-height); background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06); position: sticky; top: 0; z-index: 50;
}
.result-nav-left { display: flex; align-items: center; cursor: pointer; color: var(--accent);min-width: 30px;     /* 留出足够点击区域 */}
.back-arrow { font-size: 1.2rem; margin-right: 4px; }

.back-text {
    font-size: 2.5rem;   /* 根据视觉需要调整，例如 1.5rem、1.8rem */
    font-weight: 320;
    line-height: 1;
    color: #000;                /* 箭头黑色 */
}

.result-nav-title {
    font-weight: normal;   /* 或 400 */
    font-size: 1.5rem;
    color: #000;
    letter-spacing: 2px;
}
.result-nav-right { font-size: 2rem; font-weight: 300; cursor: pointer; color: #333; line-height: 1; }
.plus-icon { user-select: none; }
.dropdown-panel { background: #fff; border-bottom: 1px solid #eee; animation: fadeIn 0.2s ease; }
.sub-nav {
    display: flex;
    background: #fff;
    padding: 0 16px;
    border-bottom: 1px solid #eee;
    gap: 0;
    position: sticky;
    top: var(--nav-height);   /* 68px，紧贴在顶部导航下方 */
    z-index: 99;
}
.sub-nav-item {
    padding: 10px 16px; color: #666; font-weight: 500; font-size: 0.9rem; cursor: pointer;
    border-bottom: 2px solid transparent; transition: color 0.2s, border-color 0.2s;
}
.sub-nav-item.active { color: var(--accent); border-bottom-color: var(--accent); }
.result-content { background: #fff; width: 100%; padding: 0; margin: 0; }
.result-content .info-grid { margin: 0; border-radius: 0; }
.result-content .bazi-table-wrapper { margin: 0; }

/* =================================================
   7. 模态弹窗（通用）
   ================================================= */
.modal-mask {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--modal-bg); display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-content {
    background: white; color: #000; border-radius: 24px; padding: 24px;
    width: 85%; max-width: 600px; max-height: 70vh; overflow-y: auto;
    box-shadow: 0 16px 32px rgba(0,0,0,0.2);
}
.modal-title {
    font-size: 1.3rem; font-weight: 700; color: #2c3e4e; margin-bottom: 14px;
    border-bottom: 2px solid var(--accent); padding-bottom: 8px;
}
.modal-list { list-style: none; padding: 0; }
.modal-list li { padding: 10px 0; border-bottom: 1px solid #f0e4d0; color: #000; font-size: 0.95rem; }
.modal-close {
    display: block; margin: 20px auto 0; background: #eaecf0; border: none;
    padding: 10px 28px; border-radius: 30px; font-size: 0.9rem; cursor: pointer; transition: background 0.2s;
}
.modal-close:hover { background: #ddd; }
.fade-enter-active, .fade-leave-active { transition: opacity 0.2s ease; }
.fade-enter-from, .fade-leave-to { opacity: 0; }

/* =================================================
   8. 错误提示 & 页脚
   ================================================= */
.error-msg {
    background: #ffe9e7; border-radius: 30px; padding: 14px;
    text-align: center; color: #bc3900; font-size: 0.9rem; margin: 14px 0;
}
footer { text-align: center; font-size: 0.7rem; color: #9ba9c0; margin-top: 20px; }




/* =================================================
   12. 排盘页面布局（性别/模式切换、输入行）
   ================================================= */
.control-row { display: flex; justify-content: space-between; margin-bottom: 30px; }
.switch-group { display: flex; background: #f0f0f0; border-radius: 30px; padding: 4px; }
.switch-group button {
    border: none; padding: 6px 16px; border-radius: 20px; font-size: 0.9rem;
    cursor: pointer; background: transparent; color: #666; font-weight: 400; transition: all 0.2s;
}
.switch-group button.active {
    background: #fff; color: var(--accent); font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.input-row { display: flex; align-items: baseline; margin-bottom: 24px; }
.input-label { font-size: 0.9rem; font-weight: 600; color: #2c4a6e; white-space: nowrap; margin-right: 12px; min-width: 4em; }
.underline-input {
    flex: 1; min-width: 0; padding: 10px 0; border-bottom: 2px solid var(--border-soft);
    font-size: 0.95rem; color: #1e2c3a; cursor: pointer; user-select: none;
    transition: border-color 0.2s; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    text-align: right;
}
.underline-input:hover { border-color: var(--accent); }
.req-hint { font-size: 0.75rem; color: #999; font-weight: 400; }

/* =================================================
   13. 弹窗通用（移动端底部弹出）
   ================================================= */
.picker-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); display: flex; align-items: flex-end; justify-content: center;
    z-index: 200; /* 高于底部导航，确保覆盖 */
    padding: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.picker-card {
    background: #fff; border-radius: 24px 24px 0 0; width: 100%; max-width: 100%;
    margin: 0; max-height: calc(100vh - 40px); overflow-y: auto;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.2); padding: 28px 20px 20px;
    padding-bottom: env(safe-area-inset-bottom);
    overscroll-behavior: contain; touch-action: pan-y;
}
.picker-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.picker-header h3 { font-size: 1.2rem; color: #2c3e4e; }
.close-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #999; padding: 0; line-height: 1; }
.close-btn:hover { color: #e74c3c; }

/* =================================================
   14. 日期弹窗内部组件
   ================================================= */
.date-picker-card { max-width: 500px; }
.date-picker-topbar {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px;
}
.today-btn-top {
    background: #e0e0e0; border: none; border-radius: 50%; width: 36px; height: 36px;
    font-weight: 700; color: #333; cursor: pointer; font-size: 0.9rem; flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05); transition: 0.2s;
}
.today-btn-top:hover { background: #d0d0d0; color: #000; }
.date-mode-switch.switch-group button.active {
    color: #000; background: #fff; font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.date-toolbar { margin-bottom: 16px; }
.manual-input-group { display: flex; gap: 6px; }
.date-manual-input {
    flex: 1; padding: 8px 12px; border: 1px solid var(--border-soft);
    border-radius: 20px; font-size: 0.85rem; outline: none; background: #fff; color: #333; transition: border 0.2s;
}
.date-manual-input:focus { border-color: var(--accent); }
.confirm-input-btn {
    background: var(--accent); border: none; color: #fff; border-radius: 20px;
    padding: 8px 16px; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: 0.2s;
}
.confirm-input-btn:hover { background: var(--accent-dark); }

/* 列标签 */
.picker-columns-label {
    display: flex; justify-content: center; gap: 10px; margin-bottom: 10px;
}
.picker-columns-label span {
    flex: 1; max-width: 80px; text-align: center; font-weight: 600; color: #7a5c3a; font-size: 0.9rem;
}

/* 垂直滑动选择器 */
.date-scroll-container { display: flex; gap: 10px; justify-content: center; }
.scroll-col { flex: 1; max-width: 80px; }
.scroll-list {
    height: 220px; overflow-y: auto; scroll-snap-type: y mandatory; scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; background: #ffffff; border-radius: 12px; box-shadow: none;
    padding: 88px 0; -ms-overflow-style: none; scrollbar-width: none;
    overscroll-behavior: contain;
}
.scroll-list::-webkit-scrollbar { display: none; }
.scroll-item {
    height: 44px; display: flex; align-items: center; justify-content: center;
    scroll-snap-align: center; font-size: 1rem; color: #333; font-weight: 500; cursor: pointer;
    transition: color 0.2s, font-size 0.2s;
}
.scroll-item.active {
    color: #000; font-weight: 800; font-size: 1.2rem; opacity: 1; text-shadow: none;
}
.scroll-item.adjacent { color: #555; opacity: 0.7; font-weight: 500; }
.scroll-item.distant { color: #999; opacity: 0.45; }

/* =================================================
   15. 地址弹窗
   ================================================= */
.address-card { max-width: 600px; }
.search-box input {
    width: 100%; padding: 10px; border: 1px solid var(--border-soft);
    border-radius: 8px; font-size: 0.9rem; margin-bottom: 16px;
}
.region-columns { display: flex; gap: 12px; margin-bottom: 20px; }
.region-columns .col { flex: 1; }
.col-header { font-weight: 600; font-size: 0.8rem; color: #7a5c3a; margin-bottom: 6px; text-align: center; }
.list-wrap {
    background: #fef9f0; border-radius: 12px; max-height: 250px; overflow-y: auto; padding: 4px 0;
}
.list-wrap div {
    padding: 8px 12px; text-align: center; cursor: pointer; font-size: 0.9rem; transition: 0.2s; color: #333;
}
.list-wrap div.active { color: var(--accent); font-weight: 700; background: #fff6e8; }
.list-wrap div.dimmed { color: #ccc; }
.confirm-btn { margin-top: 10px; }

/* =================================================
   16. 弹窗顶部导航及搜索框增强
   ================================================= */
.topbar-left { display: flex; align-items: center; gap: 8px; }
.close-btn-dark {
    background: #1a1a1a; color: #f0c14b; border: none; font-size: 1rem; font-weight: 600;
    padding: 10px 24px; border-radius: 20px; cursor: pointer; transition: background 0.2s;
}
.close-btn-dark:hover { background: #000; }
.search-btn-group {
    position: relative; display: flex; align-items: center; background: #f5f5f5;
    border: 1px solid var(--border-soft); border-radius: 20px; overflow: hidden;
}
.search-input {
    flex: 1; border: none; outline: none; padding: 10px 14px; padding-right: 80px;
    font-size: 1rem; color: #333; background: transparent; border-radius: 20px 0 0 20px;
}
.search-btn {
    position: absolute; right: 0; top: 0; bottom: 0; border: none; background: #fff;
    color: #999; padding: 0 24px; font-size: 0.85rem; font-weight: 500; cursor: pointer;
    border-radius: 20px; transition: background 0.2s, color 0.2s; white-space: nowrap;
}
.search-btn:hover { background: #f5f5f5; color: #666; }

/* =================================================
   17. 基础信息新布局（左圆右侧日期）
   ================================================= */
.result-info-grid {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #ffffff;
    border-radius: 24px;
}
.result-info-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.result-gender-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #f0e6d3;
    color: #7a5c3a;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.result-age-text {
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: #2c3e4e;
}
.result-age-unit {
    font-size: 0.7rem;
    color: #7a5c3a;
    margin-left: 2px;
}
.result-info-divider {
    width: 1px;
    height: 50px;
    background: #e0d6c6;
    flex-shrink: 0;
}
.result-info-right {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
}
.result-solar,
.result-lunar {
    line-height: 1.4;
}

.fade-enter-active, .fade-leave-active { transition: opacity 0.2s ease; }
.fade-enter-from, .fade-leave-to { opacity: 0; }

/* =========================================
   四柱选择器 – 最终优化版（纵向反推结果）
   ========================================= */
.bazi-picker-inner {
    background: #ffffff;
    border-radius: 12px;
    padding: 4px 0;
}
.bazi-header-row {
    display: flex;
    justify-content: space-around;
    margin-bottom: 16px;
    color: #999;
    font-weight: 600;
}
.bazi-header-row span {
    flex: 1;
    text-align: center;
    font-size: clamp(0.9rem, 4vw, 1.2rem);
}
.bazi-row {
    display: flex;
    justify-content: space-around;
    margin-bottom: 12px;
}
.bazi-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.bazi-circle-dark {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
    user-select: none;
}
.bazi-circle-dark:active { transform: scale(0.94); }
.bazi-circle-dark.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}
.bazi-circle-dark.highlight {
    background: #e0e0e0 !important;
    color: #333 !important;
    border-color: #ccc !important;
    box-shadow: none;
    transform: none;
    transition: background 0.15s ease;
}
.bazi-option-grid {
    display: grid;
    gap: 10px;
    padding: 16px 8px 8px;
    justify-items: center;
}
.bazi-option-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.bazi-option-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.bazi-option-grid.cols-2 { grid-template-columns: repeat(6, 1fr); }
.bazi-option-grid .bazi-option-circle {
    width: 52px;
    height: 52px;
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 50%;
    box-sizing: border-box;
    cursor: pointer;
    transition: transform 0.15s;
}
.bazi-option-circle:active { transform: scale(0.9); }
.bazi-option-grid.cols-2 .bazi-option-circle { gap: 1px; }
.bazi-option-grid.cols-2 .bazi-option-circle span { font-size: 1rem; }
.bazi-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}
.range-group {
    display: flex;
    align-items: center;
    gap: 6px;
}
.range-label { color: #000; font-size: 0.75rem; }
.range-text { color: #333; font-size: 0.75rem; font-weight: normal; }
.clear-btn {
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 16px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.clear-btn.highlight {
    background: #f5f5f5;
    color: #4a4a4a;
    font-weight: 700;
}
.clear-icon { font-size: 1.1rem; line-height: 1; }

/* 反推结果（纵向布局） */
.reverse-container {
    margin-top: 12px;
    background: #f5f5f5;
    border-radius: 12px;
    padding: 10px;
}
.reverse-results-table { width: 100%; }
.reverse-scroll { max-height: 220px; overflow-y: auto; }
.reverse-row {
    display: flex;
    flex-direction: column;
    padding: 8px 6px;
    font-size: 0.85rem;
    color: #333;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.15s;
    gap: 3px;
}
.reverse-row:hover { background: #e8e8e8; }
.reverse-row.selected {
    background: #d9e2f0;
    font-weight: 600;
}
.reverse-line {
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.reverse-label {
    font-weight: 700;
    color: #555;
    margin-right: 8px;
    min-width: 2.5em;
    text-align: right;
}
.reverse-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #666;
    font-size: 0.9rem;
}
.reverse-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #ddd;
    border-top-color: #999;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.reverse-empty {
    padding: 16px;
    text-align: center;
    color: #d9534f;
    font-weight: 500;
    font-size: 0.9rem;
}


/* ---------- 大运 / 流年 / 流月 ---------- */
.section {
    display: flex;
    height: 82px;
    margin-top: 16px;
    overflow: hidden;
}

.section-label {
    width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: #8a7a6a;
    font-weight: 500;
    border-right: 1px solid #ece4da;
    flex-shrink: 0;
    background: #ffffff;
    writing-mode: vertical-lr;
    letter-spacing: 4px;
}
.section-label.small {
    font-size: 13px;
}

.section-content {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    align-items: stretch;
    padding: 0 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.section-content::-webkit-scrollbar {
    display: none;
}

.item {
    flex: 0 0 auto;
    width: 62px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #ece4da;
    cursor: pointer;
    background: transparent;
    transition: background 0.15s;
}
.item:last-child {
    border-right: none;
}
.item.selected {
    background-color: #f0f0f0;
}
.item.selected .bold-on-select {
    font-weight: 600;
}
.item .top {
    font-size: 13px;
    color: #3d3228;
}
.item .mid {
    font-size: 16px;
    color: #2d2218;
    font-weight: bold;
}
.item .shen {
    font-weight: normal;
    font-size: 12px;
    color: #5d4e3e;
}
.item .shen-red {
    color: #c0392b;
    font-weight: 600;
}
.item.layout-3 .top {
    margin-bottom: 1px;
}
.item .bottom {
    font-size: 11px;
    color: #8a7a6a;
}