/* hexagram-upgrade.css - 9卦升级样式 v10.13 */
/* v8.0: 添加展开/收起按钮、卦辞弹窗、手机端3x3紧凑布局 */
/* v8.1: 添加悬停预览框样式 */
/* v8.7: 完整1:1尺寸替换 - 所有元素尺寸都带详细注释 */
/* v8.8: 修复CSS重复定义导致样式冲突的bug */
/* v8.9: 修复手机端宽度超出问题 - 桌面CSS改用媒体查询包裹，强制hidden-guas使用contents布局 */
/* v9.0: 全面优化手机端尺寸 - 减小SVG(60->50px)、所有文字、边距，彻底解决宽度超出 */
/* v10.0: 完全重新设计手机端 - 参考用户截图，紧凑清晰的3列布局，字体大小合理 */
/* v10.1: 修复768px临界值问题，改用769px媒体查询 */
/* v10.2: 强制应用3列布局 - 超高优先级选择器确保覆盖style.css的全局规则 */
/* v10.3: 压缩卡片宽度减少拥挤 - 左侧24px、SVG48px、右侧20px，底部卦名框扩展至80px显示4字卦名 */
/* v10.4: 修复SVG爻线显示 - SVG容器52px、移除scale缩放、底部卦名框84px，确保6条爻线完整显示 */
/* v10.5: 极限压缩卡片宽度 - 左20px、SVG45px、右18px、底部76px，所有字号缩小，彻底解决9卦拥挤 */
/* v10.6: 修复电脑端默认9宫格问题 - 恢复展开/收起逻辑，默认显示3卦，点击展开显示9卦 */
/* v10.7: 优化手机端间距 - gap 8px->5px, padding 10px->6px，让9卦布局更紧凑居中 */
/* v10.8: 放大手机端字体 - 左侧五行10px竖排、右侧爻位9px、底部卦名11px、SVG 52px显示完整6爻 */
/* v10.9: 左侧八卦五行竖排显示 - 乾金/兑金等改为竖排（像比合一样），SVG优化高度确保6爻完整显示 */
/* v10.10: 修复竖排和SVG显示 - 超高优先级CSS确保竖排生效，移除SVG最大高度限制显示完整6爻 */
/* v10.11: 修复手机端9宫格显示 - 强制显示全部9卦，隐藏展开/收起按钮 */
/* v10.12: 修复CSS优先级问题 - 将hidden-guas的display:none规则移入电脑端媒体查询 */
/* v10.13: 修复手机端SVG爻线显示 - 增加容器高度从93px到120px，卡片高度从155px到175px */

/* 五行颜色 - 与64卦查询保持一致 - 增强优先级 */
.gua-info .gua-bagua .bagua-name.wuxing-金,
.bagua-name.wuxing-金,
.wuxing-金 {
    color: #FFD700 !important;
    background: rgba(255,215,0,0.1) !important;
}

.gua-info .gua-bagua .bagua-name.wuxing-木,
.bagua-name.wuxing-木,
.wuxing-木 {
    color: #32CD32 !important;
    background: rgba(50,205,50,0.1) !important;
}

.gua-info .gua-bagua .bagua-name.wuxing-水,
.bagua-name.wuxing-水,
.wuxing-水 {
    color: #FFFFFF !important;
    background: rgba(26,26,26,0.3) !important;
    border: 1px solid rgba(255,255,255,0.3) !important;
}

.gua-info .gua-bagua .bagua-name.wuxing-火,
.bagua-name.wuxing-火,
.wuxing-火 {
    color: #FF4500 !important;
    background: rgba(255,69,0,0.1) !important;
}

.gua-info .gua-bagua .bagua-name.wuxing-土,
.bagua-name.wuxing-土,
.wuxing-土 {
    color: #CD853F !important;
    background: rgba(205,133,63,0.1) !important;
}

/* 9卦网格布局 - 基础样式（所有设备通用） */
.gua-grid-9 {
    display: grid;
    margin: 30px auto 20px auto;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 20, 30, 1);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(100, 150, 180, 0.1);
    border: 1px solid rgba(100, 150, 180, 0.2);
}

/* 电脑端专用样式 - 固定宽度 */
@media (min-width: 769px) {
    /* hidden-guas 容器 - 默认隐藏，点击展开后使用contents让子元素参与网格布局 */
    .gua-grid-9 .hidden-guas {
        display: none; /* 默认隐藏 */
    }

    /* 展开状态 - 使用contents让隐藏的6个卦参与网格布局 */
    .gua-grid-9:not(.collapsed) .hidden-guas {
        display: contents !important; /* 展开时使用contents */
    }

    .gua-grid-9 {
        grid-template-columns: repeat(3, 260px);  /* 固定每个卡片宽度为260px */
        gap: 15px;  /* 卡片之间间距 */
    }
}

/* 卦象点击样式 */
.clickable-gua-card {
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.clickable-gua-card:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 6px 20px rgba(100, 150, 180, 0.4) !important;
    border-color: rgba(100, 150, 180, 0.6) !important;
}

.clickable-gua-card:active {
    transform: translateY(-1px) !important;
}

/* 展开/收起按钮 */
.toggle-9gua-btn {
    width: calc(100% - 40px);
    max-width: 400px;
    margin: 15px auto;
    padding: 12px 20px;
    background: rgba(238, 187, 85, 0.1);
    border: 1px solid rgba(238, 187, 85, 0.3);
    border-radius: 8px;
    color: var(--gold);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.toggle-9gua-btn:hover {
    background: rgba(238, 187, 85, 0.2);
    border-color: rgba(238, 187, 85, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(238, 187, 85, 0.3);
}

.toggle-9gua-btn:active {
    background: rgba(238, 187, 85, 0.3);
    transform: translateY(0);
}

/* 卦辞弹窗 */
.gua-meaning-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gua-meaning-modal.show {
    opacity: 1;
}

.gua-meaning-box {
    background: linear-gradient(135deg, #1a1a2e 0%, #0a0a14 100%);
    border: 2px solid rgba(238, 187, 85, 0.3);
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.gua-meaning-header {
    padding: 18px 24px;
    border-bottom: 1px solid rgba(238, 187, 85, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* 移除sticky定位，改为普通定位，可以随内容滚动 */
    position: relative;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
}

.gua-meaning-header h3 {
    margin: 0;
    color: var(--gold);
    font-size: 20px;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(238, 187, 85, 0.3);
}

.gua-meaning-header .modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    transition: all 0.3s;
}

.gua-meaning-header .modal-close:hover {
    background: rgba(238, 187, 85, 0.2);
    color: var(--gold);
    transform: rotate(90deg);
}

.gua-meaning-content {
    padding: 24px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.8;
    font-size: 15px;
}

.gua-meaning-section {
    margin-bottom: 20px;
}

.gua-meaning-section:last-child {
    margin-bottom: 0;
}

.gua-meaning-subtitle {
    color: var(--gold);
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(238, 187, 85, 0.2);
}

.gua-meaning-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: 15px;
    line-height: 1.8;
    white-space: pre-wrap;
}

/* 底部关闭按钮区域 */
.gua-meaning-footer {
    padding: 15px 24px;
    border-top: 1px solid rgba(238, 187, 85, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(26, 26, 46, 0.95);
}

.gua-meaning-footer .btn-close-bottom {
    background: rgba(238, 187, 85, 0.15);
    border: 1px solid rgba(238, 187, 85, 0.4);
    color: var(--gold);
    padding: 10px 40px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s;
}

.gua-meaning-footer .btn-close-bottom:hover {
    background: rgba(238, 187, 85, 0.25);
    border-color: rgba(238, 187, 85, 0.6);
    transform: translateY(-2px);
}

/* 卦象类型标签 */
.hex-type-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    margin-left: 10px;
    font-weight: bold;
}

/* 结果容器 - 固定背景色 */
.result-container {
    background: rgba(15, 20, 30, 1) !important;  /* 固定背景色，与9卦网格外层一致 */
    border: 1px solid rgba(100, 150, 180, 0.2) !important;  /* 固定边框色 */
    border-radius: 15px !important;
    padding: 20px !important;
    margin-top: 20px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(100, 150, 180, 0.1) !important;
}

/* 手机端结果容器 - 增加宽度 */
@media (max-width: 769px) {
    div.result-container,
    #res-box-number.result-container,
    #res-box-time.result-container,
    #res-box-manual.result-container {
        margin-left: -20px !important;  /* 外框宽度：20px */
        margin-right: -20px !important;
        width: calc(100% + 40px) !important;  /* 容器宽度扩展40px */
        max-width: calc(100% + 40px) !important;
        padding: 12px !important;
        box-sizing: border-box !important;
    }

    /* 占卜记录卡片宽度 - 与结果容器保持一致 */
    body div.record-item,
    .records-list .record-item,
    div.record-item[data-record-id],
    .record-item.record-item {
        margin-left: -20px !important;  /* 外框宽度：20px */
        margin-right: -20px !important;
        width: calc(100% + 40px) !important;
        max-width: calc(100% + 40px) !important;
        box-sizing: border-box !important;
    }
}

.hex-type-banxiang {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.hex-type-daxiang {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.hex-type-normal {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.hex-note {
    display: block;
    font-size: 12px;
    color: #ff9800;
    margin-top: 5px;
    padding: 5px 10px;
    background: rgba(255, 152, 0, 0.1);
    border-radius: 4px;
}

/* 体用关系中的五行文字 - 移除背景色和发光效果 */
.tiyong-content .wuxing-金,
.tiyong-content .wuxing-木,
.tiyong-content .wuxing-水,
.tiyong-content .wuxing-火,
.tiyong-content .wuxing-土 {
    background: transparent !important;
    text-shadow: none !important;
}

/* 体用关系 */
.tiyong-info {
    background: rgba(25, 35, 50, 0.8) !important;  /* 固定背景色，不随主题变化 */
    border-top: 2px solid rgba(100, 150, 180, 0.5) !important;  /* 顶部边框加深 */
    border-bottom: 2px solid rgba(100, 150, 180, 0.5) !important;  /* 底部边框加深 */
    border-left: 1px solid rgba(100, 150, 180, 0.3) !important;
    border-right: 1px solid rgba(100, 150, 180, 0.3) !important;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

/* 问测标题 - 固定背景色 */
.subject-title {
    background: rgba(25, 35, 50, 0.6) !important;  /* 固定背景色 */
    border-top: 2px solid rgba(100, 150, 180, 0.5) !important;  /* 顶部边框加深 */
    border-bottom: 2px solid rgba(100, 150, 180, 0.5) !important;  /* 底部边框加深 */
    border-left: 1px solid rgba(100, 150, 180, 0.3) !important;
    border-right: 1px solid rgba(100, 150, 180, 0.3) !important;
    border-radius: 8px !important;
    padding: 15px !important;
    margin-bottom: 20px !important;
}

/* 象数计算方式 - 固定背景色，稍亮的蓝灰色 */
.logs {
    background: rgba(30, 45, 65, 0.6) !important;  /* 改为稍亮的蓝灰色半透明背景 */
    border: 1px solid rgba(100, 150, 180, 0.3) !important;  /* 固定边框色 */
    border-radius: 8px !important;
    padding: 15px !important;
    margin: 15px 0 !important;
}

/* 动爻信息 - 固定背景色 */
.moving-info {
    background: rgba(25, 35, 50, 0.8) !important;  /* 固定背景色 */
    border: 1px solid rgba(100, 150, 180, 0.3) !important;  /* 固定边框色 */
    border-radius: 8px !important;
    padding: 15px !important;
    margin: 15px 0 !important;
    text-align: center !important;
    font-size: 15px !important;
    color: rgba(255, 255, 255, 0.9) !important;
}

/* 操作按钮区域 - 固定背景色 */
.action-area {
    background: rgba(25, 35, 50, 0.8) !important;  /* 固定背景色 */
    border: 1px solid rgba(100, 150, 180, 0.3) !important;  /* 固定边框色 */
    border-radius: 8px !important;
    padding: 15px !important;
    margin: 15px 0 !important;
}

.tiyong-title {
    color: var(--gold);
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 14px;
}

.tiyong-content {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 13px;
}

.tiyong-content span {
    color: rgba(255, 255, 255, 0.8);
}

.conclusion {
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
}

.conclusion-大吉 {
    background: #4caf50;
    color: white;
}

.conclusion-吉 {
    background: #8bc34a;
    color: white;
}

.conclusion-中平 {
    background: #ff9800;
    color: white;
}

.conclusion-不利 {
    background: #ff5722;
    color: white;
}

.conclusion-大凶 {
    background: #f44336;
    color: white;
}

/* 卡片结构 */
.gua-card {
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(100, 150, 180, 0.3);  /* 改为蓝灰色，与9卦保持一致 */
    border-radius: 10px;
    overflow: visible;  /* 改为visible，让标签可以显示在外面 */
    transition: all 0.3s ease;
    position: relative;  /* 为绝对定位的标签提供参考 */
    margin-top: 25px;  /* 为顶部标签留出空间 */
}

.gua-card:hover {
    border-color: rgba(100, 150, 180, 0.5);  /* 改为蓝灰色，与9卦保持一致 */
    box-shadow: 0 4px 15px rgba(100, 150, 180, 0.2);  /* 改为蓝灰色阴影 */
    transform: translateY(-2px);
}

/* 卡片头部 - 9卦中隐藏 */
.card-header {
    padding: 6px 10px;
    background: rgba(255, 215, 0, 0.08);
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
}

.gua-grid-9 .card-header {
    display: none;  /* 在9卦中隐藏这个元素 */
}

/* 卡片主体 */
.card-body {
    display: flex;
    flex-direction: column;
    padding: 10px 8px;
    gap: 8px;
    flex: 1;
}

/* 9卦中优化卡片主体 */
.gua-grid-9 .card-body {
    padding: 6px 4px;
    justify-content: center;
    background: transparent !important;
    overflow: visible !important;  /* 确保含义标签可见 */
}

/* 顶部标签 - 绝对定位在卡片外部 */
.card-header-embedded {
    position: absolute;
    top: -18px;  /* 负值让标签显示在卡片上方外部 */
    left: 50%;
    transform: translateX(-50%);
    background: transparent;  /* 改为透明 */
    padding: 8px 20px;
    border-radius: 8px 8px 0 0;
    text-align: center;
    flex-shrink: 0;
    box-shadow: none;  /* 移除阴影 */
    border: 2px solid rgba(100, 150, 180, 0.5);  /* 改为蓝灰色边框 */
    border-bottom: none;
    z-index: 10;
    white-space: nowrap;
}

.card-header-embedded .tag-top {
    font-size: 16px;
    font-weight: 800;
    color: #FFFFFF;  /* 白色文字在透明背景上清晰 */
    text-shadow: none;
    white-space: nowrap;
}

.card-header-embedded .tag-special-new {
    font-size: 11px;
    margin-left: 8px;
    padding: 2px 8px;
    background: transparent;
    border-radius: 4px;
    color: #FFFFFF;  /* 白色文字与主标签一致 */
}

/* 卡片底部 - 优化卦名显示 */
.card-footer {
    padding: 12px 12px;
    background: linear-gradient(180deg, rgba(20, 30, 45, 0.8), rgba(30, 40, 55, 0.95));
    border-top: 1px solid rgba(255, 215, 0, 0.4);
    text-align: center;
    border-radius: 0 0 10px 10px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* 卦名样式 - 白色加粗清晰 */
.gua-name {
    font-size: 18px;
    font-weight: 900;
    color: #FFFFFF;
    letter-spacing: 2px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8), 0 0 1px rgba(255, 255, 255, 0.3);
}

/* 标签样式 - 基础样式保持主题色 */
.tag-top {
    font-size: 16px;
    font-weight: 700;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tag-special-new {
    display: inline-block;
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
}

/* 移除所有文字发光效果 */
.gua-grid-9 .tag-top,
.gua-grid-9 .tag-special-new,
.gua-grid-9 .gua-name,
.gua-grid-9 .gua-text .name,
.gua-grid-9 .bagua-name,
.gua-grid-9 .wuxing-name,
.gua-grid-9 .relation-text,
.gua-grid-9 .num-val,
.gua-grid-9 .num-label,
.gua-grid-9 .yao-label {
    text-shadow: none !important;
}

/* 数字列 */
.gua-num-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 40px;
    gap: 6px;
}

.num-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.num-label {
    display: none; /* 隐藏上下标签 */
}

.num-val {
    font-size: 16px;
    color: var(--gold);
    font-weight: 700;
}

.num-divider {
    display: none; /* 隐藏横线 */
}

/* 主内容区 - 三列布局 */
.gua-main-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1;
    margin-top: 35px;  /* 增加上边距，让内容往下移更多: 20px -> 35px */
}

/* 9卦中确保主内容区透明 */
.gua-grid-9 .gua-main-content {
    background: transparent !important;
    position: relative !important;
    overflow: visible !important;  /* 确保绝对定位的标签可见 */
}

/* 左侧标签 - 横向八卦五行 */
.gua-left-labels {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-width: 60px;
    height: 130px;
}

.left-upper,
.left-lower {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

.bagua-name,
.wuxing-name {
    font-size: 18px;  /* 增大字体：14px -> 18px */
    font-weight: 800;  /* 加粗：700 -> 800 */
}

/* 五行关系 - 默认横向布局（电脑端） */
.left-relation {
    position: relative;
    display: flex;
    flex-direction: row;  /* 横向排列 */
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 80px;
    gap: 6px;  /* 箭头和文字之间的间距 */
}

/* 显示箭头符号 */
.arrow {
    display: block;
    font-size: 20px;  /* 粗大的箭头 */
    font-weight: bold;
    line-height: 1;
    color: inherit;  /* 继承父元素颜色 */
}

/* 关系文字 */
.relation-text {
    position: relative;
    z-index: 3;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    background: rgba(30, 45, 65, 0.9);
    padding: 4px 8px;
    border-radius: 4px;
    color: inherit;  /* 继承父元素颜色 */
}

/* 相生、相克、被生、被克：箭头跨越上下卦，文字在右侧 - 仅电脑端 */
@media (min-width: 769px) {
    .left-relation.relation-arrow-style {
        position: absolute;  /* 绝对定位，覆盖整个左侧区域 */
        left: 5px;  /* 靠左边，但不超出边框 */
        top: 0;
        bottom: 0;
        width: 40px;  /* 固定宽度 */
        display: flex;
        flex-direction: row;  /* 横向排列：箭头在左，文字在右 */
        align-items: center;  /* 垂直居中 */
        justify-content: flex-start;
        gap: 6px;
        z-index: 2;
    }

    /* 箭头容器（垂直布局，固定高度） */
    .arrow-line-top,
    .arrow-line-bottom {
        display: flex;
        flex-direction: column;
        align-items: center;
        position: relative;
        flex-shrink: 0;
        height: 70px;  /* 增加高度（从60px改为70px） */
    }

    /* 向下箭头：粗线条 + 向下箭头尖 */
    .arrow-line-top::before {
        content: '';
        display: block;
        width: 6px;
        height: 50px;  /* 增加线条长度（从40px改为50px） */
        background: var(--arrow-top-color, #32CD32);
    }

    .arrow-line-top::after {
        content: '';
        display: block;
        width: 0;
        height: 0;
        border-left: 9px solid transparent;
        border-right: 9px solid transparent;
        border-top: 14px solid var(--arrow-top-color, #32CD32);
        margin-top: -1px;
    }

    /* 向上箭头：向上箭头尖 + 粗线条 */
    .arrow-line-bottom::before {
        content: '';
        display: block;
        width: 0;
        height: 0;
        border-left: 9px solid transparent;
        border-right: 9px solid transparent;
        border-bottom: 14px solid var(--arrow-bottom-color, #FF4500);
        margin-bottom: -1px;
    }

    .arrow-line-bottom::after {
        content: '';
        display: block;
        width: 6px;
        height: 50px;  /* 增加线条长度（从40px改为50px） */
        background: var(--arrow-bottom-color, #FF4500);
    }

    /* 文字在箭头右侧，与五行字大小和粗细一致 */
    .left-relation.relation-arrow-style .relation-text {
        position: relative;
        z-index: 3;
        margin: 0;
        padding: 0;
        font-size: 18px;  /* 与五行字大小一致 */
        font-weight: 800;  /* 与五行字粗细一致 */
        white-space: nowrap;
        align-self: center;  /* 垂直居中 */
        line-height: 1;
    }

    /* 确保左侧标签容器有相对定位，以便箭头绝对定位 */
    .gua-left-labels {
        position: relative;
    }
}

/* 比合关系：两条并排的竖线（||） - 仅电脑端 */
@media (min-width: 769px) {
    .left-relation.relation-bihe {
        position: absolute;  /* 绝对定位，覆盖整个左侧区域 */
        left: 5px;  /* 靠左边，但不超出边框 */
        top: 0;
        bottom: 0;
        width: 40px;  /* 固定宽度 */
        display: flex;
        flex-direction: row;  /* 横向排列：竖线在左，文字在右 */
        align-items: center;  /* 垂直居中 */
        justify-content: flex-start;
        gap: 6px;
        z-index: 2;
    }

    /* 竖线容器 */
    .bihe-line-container {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 3px;  /* 两条竖线之间的间距 */
        height: 70px;  /* 与箭头高度一致 */
        flex-shrink: 0;
    }

    .bihe-line-top,
    .bihe-line-bottom {
        display: block;
        width: 6px;  /* 与箭头线条宽度一致 */
        height: 70px;  /* 与箭头高度一致 */
        /* 背景色由内联样式设置（上卦和下卦的五行颜色） */
    }

    .left-relation.relation-bihe .relation-text {
        position: relative;
        z-index: 3;
        margin: 0;
        padding: 2px 5px;
        font-size: 16px;  /* 与生克文字大小一致 */
        font-weight: 900;  /* 与生克文字加粗一致 */
        writing-mode: vertical-rl;  /* 竖排显示 */
        white-space: nowrap;
        align-self: center;
        letter-spacing: 0;
    }

    /* 隐藏比合关系的箭头符号 */
    .left-relation.relation-bihe .arrow {
        display: none !important;
    }
}

/* 手机端：箭头在左，文字在右 */
@media (max-width: 768px) {
    /* 箭头样式：横向布局 */
    .left-relation.relation-arrow-style {
        position: absolute;
        left: 0px;
        top: 0;
        bottom: 0;
        width: 20px;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 0px;
        z-index: 2;
    }

    /* 箭头容器 */
    .arrow-line-top,
    .arrow-line-bottom {
        display: flex;
        flex-direction: column;
        align-items: center;
        height: 32px;
        flex-shrink: 0;
    }

    /* 向下箭头 */
    .arrow-line-top::before {
        content: '';
        display: block;
        width: 2px;
        height: 22px;
        background: var(--arrow-top-color, #32CD32);
    }

    .arrow-line-top::after {
        content: '';
        display: block;
        width: 0;
        height: 0;
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
        border-top: 7px solid var(--arrow-top-color, #32CD32);
        margin-top: -1px;
    }

    /* 向上箭头 */
    .arrow-line-bottom::before {
        content: '';
        display: block;
        width: 0;
        height: 0;
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
        border-bottom: 7px solid var(--arrow-bottom-color, #FF4500);
        margin-bottom: -1px;
    }

    .arrow-line-bottom::after {
        content: '';
        display: block;
        width: 2px;
        height: 22px;
        background: var(--arrow-bottom-color, #FF4500);
    }

    /* 文字在箭头右侧 - 紧贴线条 */
    .left-relation.relation-arrow-style .relation-text {
        font-size: 14px;
        font-weight: 600;
        writing-mode: vertical-rl;
        text-orientation: upright;
        letter-spacing: 0px;
        margin-left: 0px;
        background: none !important;
        padding: 0 !important;
        border-radius: 0 !important;
        text-shadow: none !important;
    }

    /* 九宫格内的生克文字 - 与上卦字体一致 */
    .gua-grid-9 .gua-card .left-relation.relation-arrow-style .relation-text {
        font-size: 16px !important;
        font-weight: 700 !important;
    }

    /* 比合样式：只显示一条竖线 */
    .left-relation.relation-bihe {
        position: absolute;
        left: 0px;
        top: 0;
        bottom: 0;
        width: 20px;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 0px;
        z-index: 2;
    }

    /* 竖线容器 - 只显示一条线 */
    .bihe-line-container {
        display: flex;
        flex-direction: row;
        align-items: center;
        height: 32px;
        flex-shrink: 0;
    }

    /* 只显示第一条竖线 */
    .bihe-line-top {
        display: block;
        width: 2px;
        height: 32px;
    }

    /* 隐藏第二条竖线 */
    .bihe-line-bottom {
        display: none;
    }

    /* 比合文字 - 紧贴线条 */
    .left-relation.relation-bihe .relation-text {
        font-size: 14px;
        font-weight: 600;
        writing-mode: vertical-rl;
        text-orientation: upright;
        letter-spacing: 0px;
        margin-left: 0px;
        background: none !important;
        padding: 0 !important;
        border-radius: 0 !important;
        text-shadow: none !important;
    }

    /* 九宫格内的比合文字 - 与上卦字体一致 */
    .gua-grid-9 .gua-card .left-relation.relation-bihe .relation-text {
        font-size: 16px !important;
        font-weight: 700 !important;
    }

    /* 上下卦标签定位 */
    .gua-left-labels {
        position: relative;
    }

    .left-upper {
        position: absolute;
        top: 3px;
        left: 0;
        right: 0;
    }

    .left-lower {
        position: absolute;
        bottom: 3px;
        left: 0;
        right: 0;
    }
}

/* 中间卦象 */
.gua-center {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    min-width: 130px;  /* 增加宽度以容纳变爻标记: 100px -> 130px */
    width: 130px;  /* 固定宽度，确保所有卦象容器宽度一致 */
}

/* 9卦中的卦象SVG居中显示 */
.gua-grid-9 .gua-center svg {
    display: block;
    margin: 0 auto;  /* SVG在容器中水平居中 */
}

/* 右侧爻位标签 */
.gua-right-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 45px;
    height: 130px;
}

.yao-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
    line-height: 1;
    font-weight: 600;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 按钮区域 */
.action-area {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn-copy.ai {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-copy.kb {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* 移除9卦的发光特效 */
.gua-grid-9 .yang {
    box-shadow: none !important;
}

.gua-grid-9 .yin::before,
.gua-grid-9 .yin::after {
    box-shadow: none !important;
}

.gua-grid-9 .yao.moving .yang,
.gua-grid-9 .yao.moving .yin::before,
.gua-grid-9 .yao.moving .yin::after {
    box-shadow: none !important;
}

.gua-grid-9 .yao.changed .yang,
.gua-grid-9 .yao.changed .yin::before,
.gua-grid-9 .yao.changed .yin::after {
    box-shadow: none !important;
}

/* 卦名横向显示 - 9卦中隐藏 */
.gua-grid-9 .gua-text {
    display: none !important;  /* 隐藏这个元素，避免遮挡 */
}

.gua-grid-9 .gua-text .name {
    text-align: center;
    white-space: nowrap;
}

/* 增加卡片高度以容纳完整内容 */
.gua-grid-9 > .gua-card,
.gua-grid-9 .gua-card {
    min-height: 220px !important;  /* 增加最小高度: 200px -> 220px，为居中留更多空间 */
    padding-top: 0 !important;
    border-radius: 10px !important;  /* 改为10px以配合顶部标签的圆角 */
    position: relative !important;
    overflow: visible !important;  /* 让标签可以显示在外面 */
    margin-top: 25px !important;  /* 为顶部标签留出空间 */
    background: rgba(30, 45, 65, 0.6) !important;  /* 改为稍亮的蓝灰色半透明背景 */
    border: 2px solid rgba(100, 150, 180, 0.3) !important;  /* 固定边框色，不随主题变化 */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

.gua-grid-9 .gua-card:hover {
    background: rgba(45, 65, 90, 0.7) !important;  /* 悬停时稍亮一些 */
    border-color: rgba(100, 150, 180, 0.5) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

/* 9卦顶部标签样式 - 挂在边框外 */
.gua-grid-9 .card-header-embedded {
    position: absolute !important;
    top: -18px !important;
    left: 50% !important;  /* 居中对齐，删除偏移 */
    transform: translateX(-50%) !important;
    background: transparent !important;  /* 去掉背景 */
    border: 2px solid rgba(100, 150, 180, 0.5) !important;  /* 固定边框色，与底部统一，改为蓝灰色 */
    border-bottom: none !important;
    padding: 6px 16px !important;
    box-shadow: none !important;
    border-radius: 8px 8px 0 0 !important;
    z-index: 10 !important;
    width: 130px !important;  /* 固定宽度130px，与底部card-footer和gua-center保持一致 */
    box-sizing: border-box !important;  /* 确保padding包含在宽度内 */
    border-color: rgba(100, 150, 180, 0.5) !important;  /* 强制覆盖主题色 */
}

/* 移除顶部高光效果 */
.gua-grid-9 .card-header-embedded::before {
    display: none;
}

.gua-grid-9 .card-header-embedded .tag-top {
    font-size: 16px !important;
    font-weight: 900 !important;
    text-shadow: none !important;  /* 去掉发光效果 */
    color: #FFFFFF !important;  /* 白色文字 */
    letter-spacing: 1px;
}

/* 9卦顶部标签内的所有元素都强制白色 */
.gua-grid-9 .card-header-embedded * {
    color: #FFFFFF !important;
}

.gua-grid-9 .card-header-embedded .tag-special-new {
    font-size: 11px !important;
    font-weight: 700 !important;
    text-shadow: none !important;
    background: transparent;
    border: none;  /* 移除边框，因为已经在顶部标签中 */
    padding: 3px 10px;
    color: #FFFFFF !important;  /* 白色文字，与主标签一致 */
}

/* 特殊标签样式 - 显示在本卦标签中间 */
.gua-grid-9 .tag-special-new {
    display: inline-block;
    margin-left: 8px;
    background: transparent;
    border: none;  /* 移除边框，因为已经在顶部标签中 */
    color: #FFFFFF !important;  /* 白色文字，不随主题变化 */
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 14px !important;
    font-weight: 900 !important;
    vertical-align: middle;
}

/* 三列布局容器 */
.gua-main-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

/* 左侧标签 - 八卦五行和关系 */
.gua-left-labels {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-width: 55px;
    height: 130px;
    flex-shrink: 0;
}

.gua-left-labels .left-upper,
.gua-left-labels .left-lower {
    font-size: 14px;
    font-weight: 900;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
}

.gua-left-labels .left-relation {
    font-size: 14px;
    font-weight: 900;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
}

/* 中间卦象区域 */
.gua-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
    flex: 1;
}

/* 右侧爻位标签 */
.gua-right-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 45px;
    height: 130px;
    flex-shrink: 0;
}

.yao-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
    line-height: 1;
    font-weight: 700;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 卦名统一白色、加大加粗 */
.gua-grid-9 .gua-text .name {
    color: #FFFFFF !important;
    font-size: 20px !important;
    font-weight: 900 !important;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8) !important;
}

/* 9卦底部卦名区域样式 */
.gua-grid-9 .card-footer {
    background: transparent;  /* 去掉背景 */
    border: 2px solid rgba(100, 150, 180, 0.5);  /* 加深边框，让它更明显 */
    border-radius: 8px;
    padding: 6px 8px;  /* 减小padding让文字有更多空间 */
    margin: 4px auto 8px auto;  /* 改为auto居中，左右自动对齐 */
    text-align: center;  /* 确保文字居中 */
    display: flex;  /* 使用flex布局 */
    align-items: center;  /* 垂直居中 */
    justify-content: center;  /* 水平居中 */
    width: 130px;  /* 扩展宽度：100px -> 130px，与gua-center保持一致，防止SVG宽度变化导致偏移 */
}

.gua-grid-9 .gua-name {
    font-size: 16px !important;  /* 减小字体：19px -> 16px，避免换行 */
    font-weight: 900 !important;
    color: #FFFFFF !important;
    letter-spacing: 0px !important;  /* 去掉字间距：2px -> 0px，避免换行 */
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9), 0 0 2px rgba(255, 255, 255, 0.4) !important;
    white-space: nowrap;  /* 强制不换行 */
}

/* 卦象含义标签 - 显示在卡片最顶部 */
.gua-grid-9 .gua-meaning-label {
    position: absolute;
    top: -16px;  /* 往下移动一点 */
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px !important;  /* 加大字体 */
    font-weight: 800 !important;  /* 更粗 */
    color: #FFFFFF !important;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9) !important;
    white-space: nowrap;
    text-align: center;
    pointer-events: none;
    z-index: 5;
}

/* 隐藏顶部header内的含义文字 - 所有设备都隐藏 */
.gua-grid-9 .tag-meaning {
    display: none !important;
}

/* 电脑端也隐藏header中的含义 */
.gua-grid-9 .card-header-embedded .tag-meaning {
    display: none !important;
}

/* 数字列左对齐 */
.gua-grid-9 .gua-num-col {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 130px;
    gap: 8px;
}

.gua-grid-9 .num-box {
    align-items: flex-start;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.gua-grid-9 .num-divider {
    width: 100%;
    height: 1px;
    background: rgba(255,255,255,0.1);
    flex-shrink: 0;
}

/* 手机端卦象优化 - v10.2 强制应用3列布局（超高优先级） */
@media (max-width: 769px) {
    /* 9卦网格 - 清晰的3列布局 - 超高优先级确保覆盖所有其他规则 */
    .result-container .gua-grid-9,
    .result-container .gua-grid.gua-grid-9,
    div.gua-grid-9,
    div.gua-grid.gua-grid-9,
    .gua-grid-9,
    .gua-grid.gua-grid-9 {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;  /* 卡片间距：固定8px */
        padding: 8px !important;  /* 内边距：固定8px */
        margin: 15px auto 10px auto !important;  /* 恢复auto居中，由外层容器控制宽度 */
        display: grid !important;
        max-width: 100% !important;  /* 九宫格宽度：100% */
    }

    /* 手机端：收起状态隐藏6个组合卦 */
    .gua-grid-9.collapsed .hidden-guas {
        display: none !important;
    }

    /* 手机端：展开状态显示6个组合卦 */
    .gua-grid-9:not(.collapsed) .hidden-guas {
        display: contents !important;
    }

    /* 手机端：显示展开/收起按钮 */
    .toggle-9gua-btn {
        display: block !important;
    }

    /* 卦象卡片 - 增加高度让内容更舒展 */
    .gua-grid-9 > .gua-card,
    .gua-grid-9 .gua-card {
        min-height: 190px !important;  /* 卡片高度：175px -> 190px */
        margin-top: 20px !important;  /* 增加顶部外边距防止含义标签被挤出：16px -> 20px */
        padding: 6px 3px !important;  /* 增加内边距：4px 2px -> 6px 3px */
        border-width: 1px !important;
        border-radius: 8px !important;
        width: 115px !important;  /* 卡片宽度：auto -> 115px */
        max-width: 115px !important;
        overflow: visible !important;
    }

    /* 顶部标签 - 加大字号让标签更清晰 */
    .gua-grid-9 .card-header-embedded {
        top: -13px !important;  /* 稍微调整位置 */
        width: 100px !important;  /* 顶部宽度：65px -> 100px */
        padding: 12px 6px !important;  /* 顶部内边距：4px 6px -> 12px 6px */
        border-width: 1px !important;
        border-radius: 8px 8px 0 0 !important;
        box-sizing: border-box !important;
    }

    .gua-grid-9 .card-header-embedded .tag-top {
        font-size: 16px !important;  /* 顶部字体：11px -> 16px */
        font-weight: 800 !important;  /* 加粗：700 -> 800 */
        letter-spacing: 0px !important;
    }

    /* 隐藏特殊标签 - 手机端空间有限 */
    .gua-grid-9 .card-header-embedded .tag-special-new {
        display: none !important;
    }

    /* 卦象含义标签 - 手机端显示在卡片顶部 */
    .gua-grid-9 .gua-meaning-label {
        display: block !important;  /* 确保显示 */
        font-size: 14px !important;  /* 含义字体：10px -> 14px */
        font-weight: 700 !important;
        top: -20px !important;  /* 含义标签位置：-12px -> -20px */
        z-index: 20 !important;  /* 提高层级 */
    }

    /* 主内容区 - 增加间距 */
    .gua-grid-9 .gua-main-content {
        margin-top: 24px !important;  /* SVG垂直位置：10px -> 24px */
        gap: 8px !important;  /* 内部元素间距：固定8px */
    }

    /* 左侧八卦五行 - 极限压缩宽度 */
    .gua-grid-9 .gua-left-labels {
        min-width: 20px !important;  /* 极限压缩：24px -> 20px */
        height: 100px !important;  /* 左侧高度：120px -> 100px */
        flex-shrink: 0 !important;
    }

    /* 左侧八卦五行 - 竖排显示（超高优先级） */
    .gua-grid-9 .gua-main-content .left-upper,
    .gua-grid-9 .gua-main-content .left-lower,
    .gua-grid-9 .left-upper,
    .gua-grid-9 .left-lower {
        display: flex !important;
        flex-direction: column !important;  /* 改为竖向排列 */
        align-items: center !important;
        gap: 1px !important;
    }

    .gua-grid-9 .gua-main-content .bagua-name,
    .gua-grid-9 .gua-main-content .wuxing-name,
    .gua-grid-9 .bagua-name,
    .gua-grid-9 .wuxing-name {
        font-size: 16px !important;  /* 左侧字体：10px -> 16px */
        font-weight: 700 !important;
        line-height: 1 !important;
        writing-mode: vertical-rl !important;  /* 竖排文字 */
        text-orientation: upright !important;  /* 文字正立 */
        letter-spacing: 0px !important;
    }

    /* 五行关系 - 竖排 */
    .gua-grid-9 .left-relation {
        gap: 0px !important;
    }

    .gua-grid-9 .arrow {
        font-size: 10px !important;  /* 放大箭头：9px -> 10px */
    }

    .gua-grid-9 .relation-text {
        font-size: 10px !important;  /* 放大关系文字：8px -> 10px */
        font-weight: 700 !important;
        writing-mode: vertical-rl !important;
        text-orientation: upright !important;
        letter-spacing: 0px !important;
    }

    /* 中间SVG - 扩大尺寸显示完整6条爻线 */
    .gua-grid-9 .gua-center {
        min-width: 65px !important;  /* 扩大容器宽度：50px -> 65px，容纳动爻标记 */
        width: auto !important;  /* 自动宽度 */
        max-width: 70px !important;  /* 最大宽度70px */
        min-height: 90px !important;  /* SVG高度：120px -> 90px */
        flex-shrink: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        overflow: visible !important;  /* 允许SVG完整显示，不被裁剪 */
    }

    .gua-grid-9 .gua-center svg {
        width: auto !important;  /* 自动宽度，容纳动爻标记 */
        height: auto !important;  /* 高度自动，根据6条爻线计算 */
        max-width: 65px !important;  /* 最大宽度65px，容纳48px爻线+15px动爻标记 */
        max-height: none !important;  /* 移除最大高度限制，让6条爻线完整显示 */
        transform: none !important;  /* 移除scale缩放，避免爻线变形 */
        transform-origin: center center !important;
    }

    /* 右侧爻位 - 放大字体 */
    .gua-grid-9 .gua-right-labels {
        min-width: 22px !important;  /* 扩大宽度：18px -> 22px，配合更大字号 */
        height: 100px !important;  /* 右侧高度：120px -> 100px */
        flex-shrink: 0 !important;
    }

    .gua-grid-9 .yao-label {
        font-size: 14px !important;  /* 右侧字体：9px -> 14px */
        font-weight: 600 !important;
        height: 13px !important;  /* 增加高度：11px -> 13px */
    }

    /* 底部卦名 - 放大字体并匹配SVG宽度 */
    .gua-grid-9 .card-footer {
        width: 84px !important;  /* 扩大宽度：76px -> 84px，与52px SVG宽度匹配 */
        padding: 3px 2px !important;  /* 减小padding */
        margin: 3px auto 5px auto !important;  /* 增加外边距 */
        border-width: 1px !important;
        border-radius: 6px !important;
        box-sizing: border-box !important;
    }

    .gua-grid-9 .gua-name {
        font-size: 15px !important;  /* 底部字体：11px -> 15px */
        font-weight: 700 !important;  /* 减轻加粗：800 -> 700 */
        letter-spacing: 0px !important;
        line-height: 1.2 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* 展开按钮 */
    .toggle-9gua-btn {
        font-size: 13px !important;
        padding: 10px 16px !important;
        margin: 10px auto !important;
    }

    /* 卦辞弹窗 */
    .gua-meaning-modal {
        padding: 10px !important;
    }

    .gua-meaning-box {
        max-height: 85vh !important;
        border-radius: 10px !important;
    }

    .gua-meaning-header {
        padding: 12px 15px !important;
    }

    .gua-meaning-header h3 {
        font-size: 18px !important;
    }

    .gua-meaning-content {
        padding: 15px !important;
        font-size: 14px !important;
        line-height: 1.7 !important;
    }

    .gua-meaning-subtitle {
        font-size: 15px !important;
    }

    .gua-meaning-text {
        font-size: 14px !important;
    }

    /* 其他手机端优化 */
    .tiyong-content {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .action-area {
        flex-direction: column !important;
    }

    .btn-copy {
        width: 100% !important;
    }

    .hex-type-tag {
        display: inline-block !important;
        margin-left: 8px !important;
        padding: 3px 8px !important;
        font-size: 11px !important;
        border-radius: 3px !important;
        vertical-align: middle !important;
    }

    /* 爻位关系分析 - 手机端优化 */
    .yaowei-toggle-btn {
        font-size: 12px !important;
        padding: 8px !important;
    }

    .yaowei-content {
        font-size: 10px !important;
    }

    .yaowei-content > div {
        padding: 8px !important;
    }
}

/* 超小屏手机 (≤375px) - 进一步压缩 */
@media (max-width: 375px) {
    .gua-grid-9 {
        gap: 4px;  /* 更小间距 */
        padding: 6px;
    }

    .gua-grid-9 .gua-card {
        min-height: 130px !important;  /* 进一步压缩 */
    }

    .gua-grid-9 .card-header-embedded {
        width: 70px !important;
        padding: 2px 4px !important;
    }

    .gua-grid-9 .card-header-embedded .tag-top {
        font-size: 10px !important;
    }

    .gua-grid-9 .gua-center {
        min-width: 60px !important;
        width: 60px !important;
    }

    .gua-grid-9 .gua-center svg {
        width: 60px !important;
        transform: scale(0.75);
    }

    .gua-grid-9 .card-footer {
        width: 70px !important;
    }

    .gua-grid-9 .gua-name {
        font-size: 10px !important;
    }
}

/* 平板适配 */
@media (min-width: 769px) and (max-width: 1024px) {
    .gua-grid-9 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* AI解卦结果样式 */
.ai-result-box, .kb-result-box {
    margin-top: 20px;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    padding: 15px;
    display: none;
}

.kb-result-box {
    background: rgba(240, 147, 251, 0.1);
    border-color: rgba(240, 147, 251, 0.3);
}

.ai-result-header, .kb-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-result-title, .kb-result-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--gold);
}

.ai-close-btn, .kb-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.ai-close-btn:hover, .kb-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ai-result-content, .kb-result-content {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.8;
    font-size: 14px;
}

.ai-loading, .kb-loading {
    text-align: center;
    padding: 20px;
    color: var(--gold);
    font-size: 14px;
}

.ai-error, .kb-error {
    text-align: center;
    padding: 20px;
    color: #f44336;
    font-size: 14px;
}

/* 悬停预览框样式 */
.gua-preview-tooltip {
    position: fixed;
    z-index: 10001;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid rgba(238, 187, 85, 0.4);
    border-radius: 8px;
    padding: 15px;
    max-width: 400px;
    min-width: 300px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7), 0 0 20px rgba(238, 187, 85, 0.2);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.gua-preview-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.gua-preview-header {
    color: var(--gold);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(238, 187, 85, 0.2);
    text-shadow: 0 0 10px rgba(238, 187, 85, 0.3);
}

.gua-preview-body {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    line-height: 1.6;
}

.gua-preview-section {
    margin-bottom: 10px;
}

.gua-preview-section:last-child {
    margin-bottom: 0;
}

.gua-preview-label {
    color: var(--gold);
    font-weight: 600;
    display: inline-block;
    min-width: 60px;
}

.gua-preview-tip {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed rgba(238, 187, 85, 0.2);
    text-align: center;
    font-size: 12px;
    color: rgba(238, 187, 85, 0.8);
    font-style: italic;
}

/* 手机端预览框优化 */
@media (max-width: 768px) {
    .gua-preview-tooltip {
        max-width: calc(100vw - 40px);
        min-width: 250px;
        font-size: 13px;
    }

    .gua-preview-header {
        font-size: 15px;
    }

    .gua-preview-body {
        font-size: 13px;
    }

    .gua-preview-label {
        display: block;
        margin-bottom: 3px;
    }
}

/* 打印样式 - 隐藏含义标签 */
@media print {
    .gua-grid-9 .gua-meaning-label {
        display: none !important;
    }

    /* 打印时也隐藏header中的含义 */
    .gua-grid-9 .tag-meaning {
        display: none !important;
    }
}

/* 手机端九宫格 - 五行关系样式 (自动生成) */
@media (max-width: 768px) {
    /* 比合文字 */
    .gua-grid-9 .gua-card .left-relation.relation-bihe .relation-text {
        font-size: 12px !important;
        font-weight: 700 !important;
        margin-left: 2px !important;
    }

    /* 生文字 */
    .gua-grid-9 .gua-card .left-relation.relation-arrow-style[data-relation-type="生"] .relation-text {
        font-size: 15px !important;
        font-weight: 700 !important;
        margin-left: -3px !important;
    }

    /* 克文字 */
    .gua-grid-9 .gua-card .left-relation.relation-arrow-style[data-relation-type="克"] .relation-text {
        font-size: 15px !important;
        font-weight: 700 !important;
        margin-left: -3px !important;
    }

    /* 生箭头容器 */
    .left-relation.relation-arrow-style[data-relation-type="生"] .arrow-line-top,
    .left-relation.relation-arrow-style[data-relation-type="生"] .arrow-line-bottom {
        height: 31px !important;
        margin-top: -1px !important;
    }

    /* 生箭头线条和三角 */
    .left-relation.relation-arrow-style[data-relation-type="生"] .arrow-line-top::before,
    .left-relation.relation-arrow-style[data-relation-type="生"] .arrow-line-top::after,
    .left-relation.relation-arrow-style[data-relation-type="生"] .arrow-line-bottom::before,
    .left-relation.relation-arrow-style[data-relation-type="生"] .arrow-line-bottom::after {
        margin-left: -2px !important;
    }

    /* 生箭头线条宽度 */
    .left-relation.relation-arrow-style[data-relation-type="生"] .arrow-line-top::before,
    .left-relation.relation-arrow-style[data-relation-type="生"] .arrow-line-bottom::after {
        width: 2px !important;
    }

    /* 克箭头容器 */
    .left-relation.relation-arrow-style[data-relation-type="克"] .arrow-line-top,
    .left-relation.relation-arrow-style[data-relation-type="克"] .arrow-line-bottom {
        height: 30px !important;
        margin-top: 1px !important;
    }

    /* 克箭头线条和三角 */
    .left-relation.relation-arrow-style[data-relation-type="克"] .arrow-line-top::before,
    .left-relation.relation-arrow-style[data-relation-type="克"] .arrow-line-top::after,
    .left-relation.relation-arrow-style[data-relation-type="克"] .arrow-line-bottom::before,
    .left-relation.relation-arrow-style[data-relation-type="克"] .arrow-line-bottom::after {
        margin-left: -2px !important;
    }

    /* 克箭头线条宽度 */
    .left-relation.relation-arrow-style[data-relation-type="克"] .arrow-line-top::before,
    .left-relation.relation-arrow-style[data-relation-type="克"] .arrow-line-bottom::after {
        width: 2px !important;
    }

    /* 比合竖线容器 */
    .bihe-line-container {
        height: 25px !important;
    }

    /* 比合竖线 */
    .bihe-line-top {
        width: 2px !important;
        height: 25px !important;
        margin-left: 0px !important;
    }
}
