a {
    text-decoration: none;
}

.inline-form-control {
    display: inline-block !important; /* 取消 block，改为行内块 */
    width: auto !important; /* 取消 100% 宽度，自适应内容/栅格 */
    min-width: 80px; /* 最小宽度，确保内容可见 */
    max-width: 200px; /* 最大宽度，避免过度拉伸 */
    border: 1px solid #dddddd !important; /* 为输入框添加边框 */
}

/* 确保query-card内所有元素在一行显示 */
.query-card {
    flex-wrap: nowrap; /* 默认不换行 */
    background-color: #ffffff; /* 白色背景 */
    border: 1px solid #dddddd; /* 灰色边框 */
    border-radius: 6px; /* 圆角 */
    padding: 15px !important; /* 内边距 */
    color: #030303; /* 文字颜色 */
}

/* 性别选项样式 */
.query-card .sex-label {
    margin-right: 10px;
    color: #030303;
    font-weight: 500;
}

.query-card input[type="radio"] {
    margin: 0 5px;
    color: #030303;
    accent-color: #8B0000;
}

.query-card input[type="radio"] + span {
    color: #333333;
    margin-right: 15px;
    font-weight: 500;
}

.row-bordered {
    margin: 10px; /* 重置row默认负边距（或保留负边距，加padding） */
    padding: 15px; /* 内部间距，抵消col的padding，避免内容贴边框 */
    border: 1px solid #ddd; /* 灰色边框，可自定义颜色/粗细 */
    border-radius: 4px; /* 可选：圆角 */
    background-color: #f9f9f9; /* 可选：背景色，区分区域 */
}

/* paipan-result 样式 */
.title-lg {
    font-size: 18px; /* 尺寸1：16px */
    font-weight: 700; /* 加粗（700=bold，也可写 bold） */
    margin: 8px 0; /* 可选：设置上下间距，提升排版美观度 */
}

/* 小标题：14px 加粗 */
.title-sm {
    font-size: 12px; /* 尺寸2：14px */
    font-weight: bold; /* 加粗（与700等效，写法更直观） */
    margin: 6px 0; /* 可选：上下间距略小于大标题 */
    color: #666; /* 可选：小标题用浅一点的颜色，区分层级 */
}

/* 大字体居中样式 */
.title-center,
.title-center-sm {
    font-size: 18px;
    font-weight: bold;
    color: #FFD700;
    text-align: center;
    display: block;
}

.detail-card {
    background-color: #ffffff; /* 白色背景，与页面协调 */
    border: 1px solid #dddddd; /* 灰色边框 */
    border-radius: 6px; /* 圆角 */
    padding: 15px; /* 内边距 */
    margin-top: 10px; /* 与上方查询卡片的间距 */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); /* 轻微阴影，增加层次感 */
}

/* 增加选择器特异性，确保样式能覆盖.detail-card div */
.detail-card div.table-left-bold {
    border-left: 4px solid #A52A2A !important; /* 3px 加粗 + 实线 + 深灰色（可自定义颜色） */
}

/* 结果卡片内部内容样式 */
.detail-card h3 {
    color: #333333;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 16px;
}

.detail-card p {
    color: #666666;
    margin-bottom: 8px;
    line-height: 1.4;
    font-size: 12px;
}


/* 八字结果表格样式 - 浅灰色背景黑字 */
.bazi-result-table {
    background-color: #f5f5f5;
    border-radius: 6px;
    padding: 6px;
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #dddddd;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
}

.bazi-result-table td {
    padding: 3px 6px;
    color: #333333;
    font-size: 12px;
    border: none;
}

.bazi-result-table td:first-child {
    font-weight: 500;
    color: #666666;
    width: 40px;
}

.bazi-result-table td:last-child {
    font-weight: 600;
}

/* Bootstrap网格布局样式，模拟表格效果 */
.detail-card .row,
.row:not(.content-center .row):not(.content-left .row):not(.thead-row) {
    display: flex;
    flex-wrap: nowrap;
    border-bottom: 1px solid #e0e0e0;
    align-items: center;
}

.detail-card .row:first-child,
.row:not(.content-center .row):not(.content-left .row):not(.thead-row):first-child {
    border-top: 1px solid #e0e0e0;
}

/* 基础列样式：统一所有行的内边距和字体大小 */
.detail-card .row > div,
.row:not(.content-center .row):not(.content-left .row):not(.thead-row) > div {
    padding: 6px 10px; /* 与前7行保持一致的内边距 */
    text-align: center;
    border-right: 1px solid #e0e0e0;
    vertical-align: middle;
    font-size: 11px; /* 与前7行保持一致的字体大小 */
}

/* 只对前7行应用固定宽度样式 */
.content-center .row > div,
.content-left .row > div {
    flex: 0 0 auto;
}

/* 前7行的标签列样式：固定宽度，确保标签能完整显示，减小内边距 */
.content-center .row > div.detail-label,
.content-left .row > div.detail-label {
    width: 80px;
    font-weight: 500;
    color: #A52A2A;
    text-align: center;
    padding: 6px 10px; /* 减小内边距，降低行高 */
    font-size: 11px; /* 减小字体大小 */
}

/* 前7行的数据列样式：根据内容调整宽度，增加最后一列宽度，减小内边距 */
.content-center .row > div:not(.detail-label),
.content-left .row > div:not(.detail-label) {
    width: 100px;
    min-width: 70px;
    padding: 6px 10px; /* 减小内边距，降低行高 */
    font-size: 11px; /* 减小字体大小 */
}

/* 标题行样式优化，减小高度 */
.content-center .thead-row,
.content-left .thead-row {
    padding: 4px 0; /* 减小内边距 */
    font-size: 12px; /* 调整字体大小 */
}

/* 调整标题行的列样式，减小内边距 */
.content-center .thead-row > div,
.content-left .thead-row > div {
    padding: 6px 10px; /* 减小内边距 */
}

/* 前7行标题行的列样式 */
.content-center .thead-row > div,
.content-left .thead-row > div {
    width: 100px;
    min-width: 70px;
    font-weight: 600;
}

/* 前7行标题行的空白列 */
.content-center .thead-row > div:first-child,
.content-left .thead-row > div:first-child {
    width: 80px;
    min-width: 50px;
}

/* 移除纳音行的特殊样式，使用与上面行相同的通用样式 */
/* 只对刑冲会合行（第8行）进行特殊处理 */
.content-center .row:nth-child(8) > div:nth-child(2),
.content-center .row:nth-child(8) > div:nth-child(3),
.content-left .row:nth-child(8) > div:nth-child(2),
.content-left .row:nth-child(8) > div:nth-child(3) {
    width: 100px;
    min-width: 70px;
}

/* 刑冲会合行的跨列数据 */
.content-center .row:nth-child(8) > div:nth-child(4),
.content-center .row:nth-child(8) > div:nth-child(5),
.content-left .row:nth-child(8) > div:nth-child(4),
.content-left .row:nth-child(8) > div:nth-child(5) {
    width: 200px;
    min-width: 140px;
}

/* 通用detail-label样式：统一字体颜色和居中对齐 */
.detail-label {
    color: #A52A2A !important;
    text-align: center !important;
}

/* 大运行、流年行和流月行保持Bootstrap网格系统 */
.detail-card .row:not(.content-center .row):not(.justify-content-center) > div,
.row:not(.content-center .row):not(.justify-content-center):not(.thead-row) > div {
    flex: 0 0 auto;
    width: 88px; /* 调整列宽为88px */
    min-width: 60px; /* 最小宽度 */
    padding: 4px 6px; /* 减小内边距 */
    font-size: 12px; /* 减小字体大小 */
}

/* 大运、流年、流月行的标签列样式 */
.detail-card .row:not(.content-center .row):not(.justify-content-center) > div.detail-label,
.row:not(.content-center .row):not(.justify-content-center):not(.thead-row) > div.detail-label {
    width: 80px; /* 标签列宽度 */
    min-width: 70px;
    padding: 4px 6px;
    font-size: 12px;
}

/* 优化流月行样式 */
.liu-yue-row > div {
    width: 88px !important;
    min-width: 60px !important;
    padding: 4px 6px !important;
    font-size: 12px !important;
}

.detail-card .row > div:last-child,
.row:not(.content-center .row):not(.content-left .row):not(.thead-row) > div:last-child {
    border-right: none;
}

/* 标题行样式 */
.detail-card .thead-row {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #caac07;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #C9A86E;
}

/* 奇数行背景色 */
.detail-card .row:nth-child(odd):not(.thead-row),
.row:not(.content-center .row):not(.content-left .row):not(.thead-row):nth-child(odd) {
    background-color: #ffffff;
}

/* 偶数行背景色 */
.detail-card .row:nth-child(even):not(.thead-row),
.row:not(.content-center .row):not(.content-left .row):not(.thead-row):nth-child(even) {
    background-color: #f9f9fa;
}

/* 悬停效果 */
.detail-card .row:hover:not(.thead-row),
.row:not(.content-center .row):not(.content-left .row):not(.thead-row):hover {
    background-color: #f0f0f0;
}

.align-top {
    vertical-align: top; /* 核心：顶对齐 */
}

/* 八字结果卡片：红底金字样式 */
.title-panel {
    background: linear-gradient(135deg, #8B0000 0%, #a52a2a 50%, #8B0000 100%) !important;
    border-radius: 10px;
    padding: 12px;
    margin: 8px;
    box-shadow: 0 3px 15px rgba(139, 0, 0, 0.3);
    border: 1px solid #FFD700;
}

.title-label {
    color: #FFD700 !important;
    font-size: 11px;
    margin-bottom: 3px;
}

.title-content {
    color: #FFD700 !important;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.title-panel table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.title-panel td {
    padding: 6px 10px;
    border: 1px solid rgba(255, 215, 0, 0.3) !important;
    vertical-align: middle;
}

.title-panel tbody tr {
    background-color: transparent !important;
}

.title-panel tbody tr:hover {
    background-color: transparent !important;
}

/* 木：清新、生机、暖绿、圆润、自然字体 */
.font-wood {
    color: #2E8B57; /* 深绿（海草绿） */
    font-size: 14px;
}

/* 火：热烈、醒目、赤红、粗体、动态感 */
.font-fire {
    color: #DC143C; /* 猩红 */
    font-size: 14px;
}

/* 土：厚重、沉稳、大地色、粗体+宽字距 */
.font-earth {
    color: #8B4513; /* 赭石色 */
    font-size: 14px;
}

.font-gold {
    color: #D4AF37; /* 黄金色 */
    font-size: 14px;
}

/* 水：柔和、流畅、冷蓝、轻盈、细体+斜体 */
.font-water {
    color: #1E90FF; /* 宝蓝 */
    font-size: 14px;
}

.grid-item {
    background-color: #ffffff;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    font-size: 13px;
}

.grid-item-lr {
    /* 字体竖排核心属性 */
    writing-mode: vertical-lr; /* 垂直排版，从左到右 */
    text-orientation: upright; /* 文字直立显示，不旋转 */
    letter-spacing: 2px; /* 字间距，优化竖排效果 */
    /* 向上对齐 */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
}

.grid-ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.grid-list {
    text-align: left;
    border: 1px solid #ddd;
    padding: 4px 6px;
    margin: 3px;
    font-size: 13px;
}

.grid-title {
    color: #A52A2A;
    font-weight: 600;
    text-align: left;
    border: 1px solid #ddd;
    padding: 4px 6px;
    margin: 3px;
    font-size: 13px;
}
.show-jiXiong{
    display: none;
}

/* 移动端适配：小屏幕优化 */
@media (max-width: 768px) {
    /* 容器宽度调整 */
    .container {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    /* 查询卡片响应式 */
    .query-card {
        flex-wrap: wrap !important;
        flex-direction: column !important;
        align-items: stretch !important;
        display: flex !important;
        padding: 10px !important;
    }

    .detail-label {
        width: 100% !important;
        margin-bottom: 8px !important;
        display: block !important;
    }

    .date-options {
        width: 100% !important;
        margin-bottom: 10px !important;
        display: flex !important;
        flex-wrap: wrap !important;
    }

    .date-options > select.inline-form-control,
    .date-options > input.inline-form-control {
        width: 100% !important;
        margin-right: 0 !important;
        margin-bottom: 8px !important;
    }

    .sex-query-container {
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center;
    }

    .sex-query-container > .sex-label {
        width: 100% !important;
        margin-right: 0 !important;
        margin-bottom: 8px !important;
    }

    .sex-query-container > #query {
        width: 100% !important;
    }

    /* 结果卡片优化 */
    .title-panel {
        padding: 12px !important;
        margin: 8px !important;
    }

    .title-panel table {
        font-size: 12px !important;
    }

    .title-panel td {
        padding: 4px 8px !important;
    }

    /* 调整标题大小 */
    .title-center,
    .title-center-sm {
        font-size: 20px !important;
    }

    /* 八字结果表格优化 */
    .bazi-result-table {
        padding: 4px !important;
        font-size: 12px !important;
    }

    .bazi-result-table td {
        padding: 2px 4px !important;
        font-size: 12px !important;
    }

    /* 调整详细卡片内边距 */
    .detail-card {
        padding: 15px !important;
    }

    /* 表格适配 */
    .detail-card table {
        font-size: 12px !important;
    }

    .detail-card th,
    .detail-card td {
        padding: 8px 10px !important;
    }

    /* 竖排文字调整 */
    .grid-item-lr {
        writing-mode: horizontal-tb !important;
        text-orientation: mixed !important;
    }

    /* 调整输入框大小 */
    .inline-form-control {
        font-size: 12px !important;
        min-width: 60px !important;
        max-width: 100% !important;
    }

    /* 按钮文字不换行 */
    #query {
        white-space: normal !important;
        padding: 6px 12px !important;
    }

    /* 调整性别选项 */
    .query-card input[type="radio"] + span {
        margin-right: 10px !important;
        font-size: 12px !important;
    }
}

/* 内容居中容器样式 */
.content-center {
    margin: 0 auto;
    width: 720px; /* 减小容器宽度，容纳更宽的列 */
    background-color: #f9f9fa;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 15px;
}

/* 内容左对齐容器样式 */
.content-left {
    margin: 0;
    width: 100%;
    background-color: #f9f9fa;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 15px;
}

/* 优化前8行的行样式 */
.content-center .row,
.content-left .row {
    display: flex;
    justify-content: flex-start; /* 行内列左对齐，保持表格结构 */
    flex-wrap: nowrap;
    border-bottom: 1px solid #e0e0e0;
    align-items: center;
    margin: 0 auto;
    width: 100%;
    max-width: 100%;
}

/* 平板适配 */
@media (max-width: 992px) {
    /* 调整标题大小 */
    .title-center,
    .title-center-sm {
        font-size: 22px !important;
    }

    /* 调整表格字体 */
    .detail-card table {
        font-size: 13px !important;
    }

    /* 平板端优化：保持原有布局，不换行 */
    .content-center .row {
        flex-wrap: nowrap;
        justify-content: center;
    }

    /* 平板端优化：保持列宽不变，只调整内边距 */
    .content-center .row > div {
        padding: 8px 10px;
        font-size: 13px;
    }

    /* 平板端优化：图表行允许换行 */
    .row.justify-content-center {
        flex-wrap: wrap;
    }

    /* 平板端优化：图表列占满宽度 */
    .row.justify-content-center > div {
        flex: 1 0 100%;
        margin-bottom: 20px;
    }
}

/* 手机端适配 */
@media (max-width: 576px) {
    /* 手机端优化：保持原有布局，不换行 */
    .content-center .row {
        flex-wrap: nowrap;
        justify-content: center;
    }

    /* 手机端优化：调整内边距和字体大小 */
    .content-center .row > div {
        padding: 6px 8px;
        font-size: 11px;
    }

    /* 手机端优化：标签列调整 */
    .content-center .row > div.detail-label {
        width: 80px;
        padding-right: 10px;
    }

    /* 手机端优化：数据列调整 */
    .content-center .row > div:not(.detail-label) {
        width: 100px;
        min-width: 60px;
    }

    /* 手机端优化：图表行允许换行 */
    .row.justify-content-center {
        flex-wrap: wrap;
    }

    /* 手机端优化：图表列占满宽度 */
    .row.justify-content-center > div {
        flex: 1 0 100%;
        margin-bottom: 20px;
    }

    /* 手机端优化：其他行调整内边距 */
    .detail-card .row:not(.content-center .row):not(.justify-content-center) > div {
        padding: 6px 8px;
        font-size: 11px;
    }
}

/* 紫薇斗数样式 */
.ziwei-container {
    position: relative;
    width: 100%;
    min-height: 500px; /* 确保容器有最小高度 */
    padding: 0 20px; /* 左右各加20px空白 */
    box-sizing: border-box; /* 确保padding不会增加总宽度 */
}

/* 最外层连线Canvas：绝对定位+最高z-index，确保永不被遮挡 */
#connectionCanvas {
    position: absolute;
    top: 0;
    left: 20px;  /* 对齐到容器的padding */
    width: 600px;  /* 固定宽度 */
    height: 500px; /* 固定高度 */
    z-index: 15;
    pointer-events: none;
}

/* 表格容器：居中放置，层级低于Canvas */
.ziwei-table-container {
    position: relative;
    z-index: 10;
    margin: 0 auto;
}

/* 四行四列表格样式 */
.ziwei-table {
    border-collapse: collapse;
    width: 560px;
    height: 460px;
    background-color: #f0f5f9;
}

.ziwei-table td {
    border: 2px solid #2c3e50;
    width: 25%;
    height: 25%;
    text-align: center;
    vertical-align: middle;
    position: relative;
    background-color: #ffffff;
    padding: 2px;
}

/* 宫位样式 */
.palace {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 3px;
    position: relative;
    z-index: 10;
}

.palace:hover {
    background-color: #e3f2fd;
}

.palace.active {
    /* 移除背景色变化，只保留边框和阴影 */
    border-radius: 6px;
    border: 2px solid #FFD700;
    box-shadow: 0 0 10px rgba(139, 0, 0, 0.5);
}

.palace-name {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 3px;
}

.palace-desc {
    font-size: 10px;
    color: #7f8c8d;
}

/* 中间合并单元格 - 八字展示区域 */
.bazi-area {
    background-color: #ffffff;
    font-size: 12px;
    font-weight: bold;
    color: #2c3e50;
    padding: 8px;
    line-height: 1.8;
    position: relative;
    z-index: 10;
}

.bazi-title {
    font-size: 12px;
    color: #1abc9c;
    margin-bottom: 8px;
}

/* 九宫格面板容器 */
.nine-grid-panel {
    width: 100%;
    min-height: 120px;
    height: auto;
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: 2fr 1fr 1fr;
    gap: 1px;
    background-color: #f8f9fa;
    padding: 1px;
    border-radius: 8px;
}

/* 九宫格格子样式 */
.nine-grid-panel .grid-item {
    background-color: #ffffff;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    font-size: 9px;
    white-space: nowrap;
}

/* 竖排格子顶对齐 */
.nine-grid-panel .grid-item-lr {
    align-items: flex-start;
    justify-content: flex-start;
}

.nine-grid-panel .grid-item ul {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.nine-grid-panel .grid-item ul li {
    margin: 1px 0;
}

.nine-grid-panel .grid-item ul li.auxiliary-star {
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 2px;
}

.nine-grid-panel .grid-item-lr {
    writing-mode: vertical-lr;
    text-orientation: upright;
    letter-spacing: 1px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    font-size: 8px;
    white-space: nowrap;
}

.nine-grid-panel .grid-item-lr ul {
    align-self: flex-start;
    margin-top: 0;
    height: auto;
}

/* 为 -pStar 和 -mStar 添加样式，让它们独占一行 */
[id$="-pStar"], [id$="-mStar"] {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
}

[id$="-pStar"] li, [id$="-mStar"] li {
    white-space: nowrap;
    margin: 1px 0;
}

.nine-grid-panel .grid-item-zhuxing {
    font-weight: bold;
    font-size: 12px;
    color: #1abc9c;
    white-space: nowrap;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding-top: 2px;
}

/* 九宫格标题项 */
.nine-grid-panel .grid-item.title {
    font-weight: bold;
    color: #1abc9c;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 合并样式：(2,3) 横向合并 */
.nine-grid-panel .grid-item.merge-2-3 {
    grid-column: 3 / span 1;
}

/* 合并样式：(4,5,6) 横向合并 */
.nine-grid-panel .grid-item.merge-4-5-6 {
    grid-row: 2 / span 1;
    grid-column: 1 / span 3;
    font-size: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
