.tag-visual-card {
    overflow: hidden;
}

.tag-description {
    white-space: pre-line;
}

.tag-visual-body {
    padding: 0.75rem 1rem 1rem;
}

.tag-section-head {
    display: flex;
    align-items: center;
    font-size: clamp(0.95rem, 0.82rem + 0.35vw, 1.2rem);
    font-weight: 600;
    color: #333;
    margin-bottom: clamp(0.35rem, 0.25rem + 0.25vw, 0.65rem);
    line-height: 1.2;
}

.tag-treemap-chart {
    width: 100%;
    height: clamp(480px, 58vh, 720px);
    min-height: 480px;
    margin: 0;
}

@media (min-width: 1200px) {
    .tag-treemap-chart {
        height: clamp(540px, 64vh, 820px);
        min-height: 540px;
    }
}

@media (min-width: 1400px) {
    .tag-treemap-chart {
        height: clamp(580px, 68vh, 900px);
        min-height: 580px;
    }
}

/* 云图容器样式 */
.tag-cloud-container {
    position: relative;
    width: 100%;
    height: 560px;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.1);
}

.tag-cloud {
    position: relative;
    width: 100%;
    height: 100%;
    display: block;
}

/* 基础标签样式 - 高性能版本 */
.tag-item {
    position: absolute;
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.15s ease;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    border: 2px solid transparent;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    will-change: transform;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    letter-spacing: 0.5px;
    line-height: 1.2;
    transform-origin: center center;
}

/* 文字方向样式 */
.tag-item.horizontal {
    transform: rotate(0deg);
}

.tag-item.vertical {
    transform: rotate(90deg);
    writing-mode: vertical-rl;
}

.tag-item.diagonal-right {
    transform: rotate(15deg);
}

.tag-item.diagonal-left {
    transform: rotate(-15deg);
}

.tag-item.diagonal-steep-right {
    transform: rotate(45deg);
}

.tag-item.diagonal-steep-left {
    transform: rotate(-45deg);
}

/* 热度等级样式 - 动态大小，颜色由JavaScript控制 */
.tag-hot-1 { 
    font-size: 0.7rem;
    opacity: 0.8;
    font-weight: 600;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    transform-origin: center center;
}
.tag-hot-2 { 
    font-size: 0.9rem;
    opacity: 0.85;
    font-weight: 600;
    z-index: 2;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    transform-origin: center center;
}
.tag-hot-3 { 
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 600;
    z-index: 3;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    transform-origin: center center;
}
.tag-hot-4 { 
    font-size: 1.3rem;
    opacity: 0.95;
    font-weight: 700;
    z-index: 4;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
    transform-origin: center center;
}
.tag-hot-5 { 
    font-size: 1.5rem;
    opacity: 1.0;
    font-weight: 700;
    z-index: 5;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
    transform-origin: center center;
}
.tag-hot-6 { 
    font-size: 1.7rem;
    opacity: 1.0;
    font-weight: 700;
    z-index: 6;
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
    transform-origin: center center;
}
.tag-hot-7 { 
    font-size: 1.9rem;
    opacity: 1.0;
    font-weight: 800;
    z-index: 7;
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
    transform-origin: center center;
}
.tag-hot-8 { 
    font-size: 2.1rem;
    opacity: 1.0;
    font-weight: 800;
    z-index: 8;
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
    transform-origin: center center;
}
.tag-hot-9 { 
    font-size: 2.3rem;
    opacity: 1.0;
    font-weight: 800;
    z-index: 9;
    text-shadow: 0 2px 5px rgba(0,0,0,0.4);
    transform-origin: center center;
}
.tag-hot-10 { 
    font-size: 2.6rem;
    opacity: 1.0;
    font-weight: 900;
    z-index: 10;
    text-shadow: 0 3px 6px rgba(0,0,0,0.5);
    transform-origin: center center;
}

/* 悬停效果 - 完全固定位置，只放大 */
.tag-item:hover {
    transform: translate(-50%, -50%) scale(1.08) !important;
    z-index: 100 !important;
    box-shadow: 0 6px 16px rgba(0,0,0,0.2) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease !important;
    will-change: transform, box-shadow, filter;
    filter: brightness(1.15) saturate(1.3);
    transform-origin: center center !important;
}

/* 特别针对最大标签的悬停效果 */
.tag-hot-10:hover {
    transform: translate(-50%, -50%) scale(1.08) !important;
    z-index: 100 !important;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease !important;
    filter: brightness(1.15) saturate(1.3) !important;
    transform-origin: center center !important;
}

/* 中心标签悬停效果 - 覆盖动画 */
.tag-item.center-tag:hover {
    transform: translate(-50%, -50%) scale(1.08) !important;
    z-index: 100 !important;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease !important;
    filter: brightness(1.15) saturate(1.3) !important;
    transform-origin: center center !important;
    animation: none !important;
}

/* 搜索高亮效果 - 简化版本 */
.tag-item.highlight {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7) !important;
    color: #856404 !important;
    border-color: #ffc107 !important;
    z-index: 50 !important;
}

/* 中心标签特殊效果 - 动态颜色变化 */
.tag-item.center-tag {
    animation: centerGlow 3s ease-in-out infinite alternate, colorShift 8s ease-in-out infinite;
    will-change: transform, box-shadow, filter;
}

@keyframes centerGlow {
    0% { 
        box-shadow: 0 0 15px rgba(0,0,0,0.2);
        transform: translate(-50%, -50%) scale(1);
    }
    100% { 
        box-shadow: 0 0 25px rgba(0,0,0,0.4);
        transform: translate(-50%, -50%) scale(1.01);
    }
}

@keyframes colorShift {
    0% { filter: hue-rotate(0deg) brightness(1); }
    25% { filter: hue-rotate(90deg) brightness(1.05); }
    50% { filter: hue-rotate(180deg) brightness(1.1); }
    75% { filter: hue-rotate(270deg) brightness(1.05); }
    100% { filter: hue-rotate(360deg) brightness(1); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .tag-visual-body {
        padding: 0.6rem 0.75rem 0.75rem;
    }

    .tag-treemap-chart {
        height: clamp(360px, 55vh, 520px);
        min-height: 360px;
    }

    .tag-cloud-container {
        height: 500px;
    }
    
    .tag-item {
        padding: 0.2rem 0.6rem;
        border-radius: 15px;
        font-weight: 700;
        text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    }
    
    /* 移动端字体大小调整 - 确保清晰度 */
    .tag-hot-1 { font-size: 0.6rem; font-weight: 700; }
    .tag-hot-2 { font-size: 0.8rem; font-weight: 700; }
    .tag-hot-3 { font-size: 1.0rem; font-weight: 700; }
    .tag-hot-4 { font-size: 1.2rem; font-weight: 800; }
    .tag-hot-5 { font-size: 1.4rem; font-weight: 800; }
    .tag-hot-6 { font-size: 1.6rem; font-weight: 800; }
    .tag-hot-7 { font-size: 1.8rem; font-weight: 800; }
    .tag-hot-8 { font-size: 2.0rem; font-weight: 900; }
    .tag-hot-9 { font-size: 2.2rem; font-weight: 900; }
    .tag-hot-10 { font-size: 2.4rem; font-weight: 900; }
}

@media (max-width: 480px) {
    .tag-cloud-container {
        height: 400px;
}

.tag-item {
        padding: 0.15rem 0.5rem;
        border-radius: 12px;
        font-weight: 800;
        text-shadow: 0 1px 3px rgba(0,0,0,0.6);
    }
    
    /* 小屏幕字体大小 - 确保清晰度 */
    .tag-hot-1 { font-size: 0.5rem; font-weight: 800; }
    .tag-hot-2 { font-size: 0.7rem; font-weight: 800; }
    .tag-hot-3 { font-size: 0.9rem; font-weight: 800; }
    .tag-hot-4 { font-size: 1.1rem; font-weight: 900; }
    .tag-hot-5 { font-size: 1.3rem; font-weight: 900; }
    .tag-hot-6 { font-size: 1.5rem; font-weight: 900; }
    .tag-hot-7 { font-size: 1.7rem; font-weight: 900; }
    .tag-hot-8 { font-size: 1.9rem; font-weight: 900; }
    .tag-hot-9 { font-size: 2.1rem; font-weight: 900; }
    .tag-hot-10 { font-size: 2.3rem; font-weight: 900; }
}

/* 标签云图导航样式 - 与cloud.html完全一致 */
.first-level-section {
    margin-bottom: 1rem;
}

.first-level-btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.first-level-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.first-level-icon {
    font-size: 0.8rem;
}

.breadcrumb-area {
    margin-bottom: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f8f9fa;
}

   /* 字母分区域样式 */
   .tag-letter-section {
    margin-bottom: 2rem;
}

.tag-letter-section h4 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.1em;
}

.tag-letter-section hr {
    border-top: 2px solid var(--bs-primary);
    opacity: 0.3;
}

/* 字母导航按钮样式 */
.letter-nav-btn {
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-weight: 500;
}

.letter-nav-btn:hover {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: white;
}

.letter-nav-btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.letter-nav-btn.active {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: white;
}

.letter-nav-btn.active:hover {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: white;
}

.letter-nav-btn.active .badge {
    background-color: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* 迷你标签卡片样式 - 一页显示所有标签 */
.tag-card-mini {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 6px;
    min-height: 140px;
    cursor: pointer;
}

.tag-card-mini:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
}

.tag-card-mini .card-title a:hover {
    color: var(--bs-primary) !important;
}

.tag-card-mini .card-body {
    padding: 0.75rem !important;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

/* 迷你布局优化 */
.tag-card-mini .row.g-0 {
    margin: 0;
}

.tag-card-mini .row.g-0>* {
    padding: 0;
}

/* 响应式优化 */
@media (max-width: 1200px) {
    .tag-card-mini .card-body {
        padding: 0.2rem !important;
    }
}

@media (max-width: 768px) {
    .tag-card-mini .card-body {
        padding: 0.15rem !important;
    }

    .tag-card-mini .row.g-0 .col-6 {
        margin-bottom: 0.05rem;
    }
}

@media (max-width: 576px) {
    .tag-card-mini .d-flex.justify-content-between {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.1rem;
    }
}

/* 超紧凑标签卡片样式（保留作为备用） */
.tag-card-ultra-compact {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 6px;
    min-height: 120px;
}

.tag-card-ultra-compact:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15) !important;
}

.tag-card-ultra-compact .card-title a:hover {
    color: var(--bs-primary) !important;
}

.tag-card-ultra-compact .card-body {
    padding: 0.5rem !important;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

/* 紧凑标签卡片样式（保留作为备用） */
.tag-card-compact {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 8px;
}

.tag-card-compact:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.tag-card-compact .card-title a:hover {
    color: var(--bs-primary) !important;
}

.tag-card-compact .card-body {
    padding: 0.75rem !important;
}

/* 小徽章样式 */
.badge-sm {
    font-size: 0.6rem;
    padding: 0.25rem 0.4rem;
}

.content-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.content-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

.content-card .card-title a:hover {
    color: var(--bs-primary) !important;
}

.btn-group .btn {
    border-radius: 0.375rem;
}

.btn-group .btn:not(:last-child) {
    margin-right: 0.25rem;
}

@media (max-width: 768px) {
    .btn-group {
        display: flex;
        flex-direction: column;
    }
    
    .btn-group .btn {
        margin-right: 0;
        margin-bottom: 0.25rem;
    }
}

/* ===== 相关标签侧边栏（知识图谱） ===== */
.rel-card { border-radius: 0.75rem; overflow: hidden; }
.rel-card .card-body { padding: 0; }
.rel-card .rel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #f8f9fc 0%, #eef1f6 100%);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.rel-card .rel-head .rel-title {
    font-size: 0.92rem; font-weight: 600; color: #343a40; margin: 0;
    display: flex; align-items: center;
}
.rel-card .rel-head .rel-title i {
    color: #6366f1; margin-right: 0.45rem; font-size: 0.68rem;
    width: 1.35rem; height: 1.35rem; line-height: 1.35rem;
    text-align: center; border-radius: 50%;
    background: rgba(99,102,241,0.12);
}
.rel-card .rel-head .rel-count {
    font-size: 0.7rem; color: #9aa0ac; font-weight: 500;
    background: #fff; padding: 0.1rem 0.5rem; border-radius: 1rem;
}
.rel-card .rel-body { padding: 0.75rem 1rem 0.85rem; }

/* 列表折叠 */
.rel-list-collapse { border-top: 1px solid rgba(0,0,0,0.05); }
.rel-list-collapse > summary {
    list-style: none; cursor: pointer; user-select: none;
    padding: 0.7rem 1rem;
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.78rem; font-weight: 600; color: #6c757d;
    transition: all 0.18s ease;
    border-bottom: 1px solid transparent;
}
.rel-list-collapse > summary:hover {
    background: rgba(99,102,241,0.06);
    color: #6366f1;
}
.rel-list-collapse > summary::-webkit-details-marker { display: none; }
.rel-list-collapse > summary i.fa-list-ul {
    font-size: 0.7rem;
    width: 1.4rem; height: 1.4rem; line-height: 1.4rem;
    text-align: center; border-radius: 6px;
    background: linear-gradient(135deg, #f1f3f5, #e9ecef);
    color: #9aa0ac;
    margin-right: 0.45rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    transition: all 0.18s;
}
.rel-list-collapse > summary:hover i.fa-list-ul {
    background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(99,102,241,0.1));
    color: #6366f1;
    box-shadow: 0 2px 5px rgba(99,102,241,0.18);
}
.rel-list-collapse > summary .rel-list-count {
    font-size: 0.66rem; font-weight: 600;
    background: #eef0f3; color: #9aa0ac;
    padding: 0.1rem 0.45rem; border-radius: 1rem;
    margin-left: 0.15rem;
}
.rel-list-collapse > summary .rel-list-arrow {
    margin-left: auto; font-size: 0.62rem; color: #c0c4cc;
    transition: transform 0.22s ease;
}
.rel-list-collapse[open] > summary { border-bottom-color: rgba(0,0,0,0.05); }
.rel-list-collapse[open] > summary .rel-list-arrow { transform: rotate(180deg); }
.rel-list-collapse[open] > summary i.fa-list-ul {
    background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(99,102,241,0.12));
    color: #6366f1;
    box-shadow: 0 2px 5px rgba(99,102,241,0.2);
}

/* 移动端 mini 图谱 */
.rel-mini-graph-mobile {
    height: 260px;
    margin-bottom: 0.6rem;
    border-bottom: 1px dashed rgba(0,0,0,0.06);
    padding-bottom: 0.4rem;
}
@media (min-width: 768px) { .rel-mini-graph-mobile { display: none; } }

/* mini 图谱缩略图 */
.rel-mini-graph {
    padding: 0.4rem 0.5rem 0.2rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    text-align: center;
    height: 280px;
    overflow: hidden;
}
.rel-mini-graph svg { display: block; margin: 0 auto; user-select: none; -webkit-user-select: none; }
.rel-mini-graph svg circle { transition: r 0.15s, opacity 0.15s; }
.rel-mini-graph svg g { cursor: grab; }
.rel-mini-graph svg g:active { cursor: grabbing; }
.rel-mini-graph svg g:hover circle { filter: drop-shadow(0 1px 3px rgba(99,102,241,0.4)); }
.rel-group { margin-bottom: 0.85rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.rel-group:last-child { margin-bottom: 0; }
.rel-group-label {
    display: inline-flex; align-items: center;
    font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em;
    padding: 0.18rem 0.6rem; border-radius: 1rem;
    margin-bottom: 0.1rem;
    width: 100%;
}
.rel-group-label i { margin-right: 0.3rem; font-size: 0.72rem; }
.rel-lbl-upper   { background: rgba(13,110,253,0.1);  color: #0d6efd; }
.rel-lbl-lower   { background: rgba(25,135,84,0.1);   color: #198754; }
.rel-lbl-synonym { background: rgba(255,193,7,0.15);  color: #b8860b; }
.rel-lbl-related { background: rgba(13,202,240,0.12); color: #0aa3c0; }
.rel-lbl-cooccur { background: rgba(108,117,125,0.1); color: #6c757d; }

.rel-tag {
    display: inline-flex; align-items: center; justify-content: space-between;
    padding: 0.32rem 0.7rem; margin: 0;
    font-size: 0.88rem; line-height: 1.3;
    border-radius: 0.5rem; text-decoration: none;
    border: 1px solid #eef0f3; background: #fff; color: #495057;
    transition: all 0.18s ease;
    flex: 1 1 auto; min-width: 0;
}
.rel-tag:hover {
    background: #6366f1; color: #fff;
    border-color: #6366f1;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(99,102,241,0.28);
}
.rel-tag:hover .rel-tag-count { color: rgba(255,255,255,0.75); }
.rel-tag .rel-tag-count {
    font-size: 0.72rem; color: #c0c4cc; margin-left: 0.5rem;
    font-weight: 500; transition: color 0.18s; white-space: nowrap;
}
}
.rel-tag.rel-synonym {
    background: rgba(255,193,7,0.06); color: #b8860b;
    border-color: rgba(255,193,7,0.22);
}
.rel-tag.rel-synonym:hover {
    background: #f59e0b; color: #fff; border-color: #f59e0b;
    box-shadow: 0 3px 8px rgba(245,158,11,0.28);
}

/* 移动端折叠 */
.rel-collapse {
    background: #fff; border: 1px solid #eef0f3; border-radius: 0.75rem;
    overflow: hidden;
}
@media (max-width: 767.98px) {
    .rel-collapse { margin-top: 0.25rem; }
}
.rel-collapse > summary {
    list-style: none; cursor: pointer; padding: 0.7rem 0.9rem;
    font-size: 0.88rem; font-weight: 600; color: #343a40;
    display: flex; align-items: center; justify-content: space-between;
    background: linear-gradient(135deg, #f8f9fc 0%, #eef1f6 100%);
}
.rel-collapse > summary::-webkit-details-marker { display: none; }
.rel-collapse > summary i.fa-project-diagram {
    color: #6366f1; margin-right: 0.45rem; font-size: 0.7rem;
}
.rel-collapse > summary .rel-arrow { color: #adb5bd; transition: transform 0.2s; font-size: 0.7rem; }
.rel-collapse[open] > summary .rel-arrow { transform: rotate(90deg); }
.rel-collapse[open] > summary { border-bottom: 1px solid rgba(0,0,0,0.05); }
.rel-collapse .rel-collapse-body { padding: 0.75rem 0.9rem 0.85rem; }
@media (min-width: 768px) { .rel-collapse { display: none; } }
