/* =========================
   1. 基础变量与全局设置
   ========================= */
   :root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --text-color: #0f172a;
    --text-muted: #475569;
    --bg-color: #f4f7fc;
    --card-bg: #ffffff;
    --border-color: #d9e4f5;
    --radius: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
}

/* =========================
   2. 导航栏 (Navbar)
   ========================= */
.navbar {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.02);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.nav-logo-img {
    height: 70px;
    width: auto;
    object-fit: contain;
}

.nav-links a {
    margin-left: 2rem;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* =========================
   3. 头部 Hero 区域
   ========================= */
.hero {
    background: linear-gradient(135deg, #ffffff 0%, #f3f7ff 100%);
    padding: 5rem 2rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.hero-logo-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.hero-logo-img {
    height: 210px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 10px 15px rgba(37, 99, 235, 0.1)); 
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1.2rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.3;
}

.hero .subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 800px;
    margin: 0 auto 2rem auto;
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.btn {
    display: inline-block;
    padding: 0.6rem 1.8rem;
    border-radius: 9999px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #f8fbff;
    border-color: #bfdbfe;
    color: var(--primary-color);
}

/* =========================
   4. 布局容器与卡片通用样式
   ========================= */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
}

.container-wide {
    max-width: 1550px; 
    margin: 0 auto;
    padding: 0 2rem;
}

.section {
    padding: 4rem 0 2rem 0;
}

.section-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 2rem;
    color: var(--text-color);
    text-align: center;
}

/* 新增：Leaderboard 内部的副标题样式 */
.subsection-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1.2rem;
    color: var(--text-color);
    text-align: center;
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.card h3 {
    font-size: 1.3rem;
    margin-bottom: 1.2rem;
    color: var(--text-color);
}

.card p {
    color: var(--text-muted);
    margin-bottom: 1rem;
    text-align: justify; 
    text-justify: inter-word; 
}

.card p:last-child {
    margin-bottom: 0;
}

.mt-4 {
    margin-top: 2rem;
}

.text-center { text-align: center; }
.text-muted { color: #94a3b8 !important; }

/* 图文占位 */
.image-wrapper {
    width: 100%;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
}

.image-wrapper img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.image-placeholder {
    width: 100%;
    min-height: 250px;
    background-color: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-style: italic;
    padding: 2rem;
    text-align: center;
}

.image-caption {
    font-size: 0.95rem;
    text-align: justify;
    background: #f8fbff;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* =========================
   5. TOC 侧边栏 (On this page)
   ========================= */
.page-wrapper {
    display: flex;
    align-items: flex-start;
    max-width: 1600px;
    margin: 0 auto;
    position: relative;
}

.toc-sidebar {
    position: sticky;
    top: 80px; 
    width: 220px; 
    flex-shrink: 0;
    padding: 2rem 1rem 2rem 2rem;
    height: calc(100vh - 80px);
    overflow-y: auto;
}

.main-content {
    flex-grow: 1;
    min-width: 0; 
    padding-bottom: 4rem;
}

.toc-title {
    font-weight: 800;
    font-size: 1.05rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toc-list {
    list-style: none;
    border-left: 2px solid var(--border-color); 
}

.toc-link {
    display: block;
    padding: 0.4rem 0 0.4rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    position: relative;
    left: -2px; 
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
}

/* =========================
   TOC 二级目录样式
   ========================= */
   .toc-sublist {
    list-style: none;
    /* 缩进，体现层级关系 */
    padding-left: 1.2rem; 
    margin-top: 0.2rem;
    margin-bottom: 0.2rem;
    border-left: 2px solid var(--border-color); 
}

.toc-sublink {
    font-size: 0.85rem; /* 字号比一级目录稍微小一点 */
    padding: 0.3rem 0 0.3rem 1rem;
    color: #64748b;
}

.toc-sublink.active {
    color: var(--primary-color);
    font-weight: 700;
    /* 二级目录高亮时左侧边框变色 */
    border-left-color: var(--primary-color); 
    background: transparent;
}

.toc-link:hover {
    color: var(--primary-color);
    border-left-color: #bfdbfe;
}

.toc-link.active {
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 700;
    background: linear-gradient(90deg, rgba(37,99,235,0.05) 0%, transparent 100%);
}

@media (max-width: 1024px) {
    .toc-sidebar {
        display: none;
    }
}

/* =========================
   6. 语种 Tabs (Leaderboard & Demos)
   ========================= */
.lang-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.lang-tab {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-tab:hover {
    background: #f8fbff;
    color: var(--primary-color);
    border-color: #bfdbfe;
}

.lang-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* =========================
   7. Leaderboard 表格样式
   ========================= */
.table-legend {
    font-size: 0.9rem;
    color: var(--text-muted);
    background: #f8fafc;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.table-legend code {
    background: #e2e8f0;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.table-responsive {
    width: 100%;
    max-height: 650px; 
    overflow: auto;    
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.leaderboard-table {
    width: 100%;
    border-collapse: separate; 
    border-spacing: 0;
    white-space: nowrap;
    text-align: center;
    font-size: 0.85rem; 
}

.leaderboard-table.hidden-table {
    display: none;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 0.5rem 0.8rem; 
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.leaderboard-table th:last-child,
.leaderboard-table td:last-child {
    border-right: none;
}
.leaderboard-table tbody tr:last-child td {
    border-bottom: none;
}

/* 固定表头与首列 */
.leaderboard-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.leaderboard-table thead th {
    font-weight: 700;
    color: #1e293b;
    background-color: #f8fafc; 
}

.sticky-col {
    position: sticky;
    left: 0;
    background-color: var(--card-bg);
    z-index: 11;
    box-shadow: 2px 0 5px -2px rgba(0,0,0,0.1); 
}

.leaderboard-table thead .sticky-col {
    z-index: 12;
    background-color: #f8fafc;
}

/* 表头背景分类 */
.th-easy { background-color: #e0f2fe !important; }
.th-easy-sub { background-color: #f0f9ff !important; }
.th-hard { background-color: #f3e8ff !important; }
.th-hard-sub { background-color: #faf5ff !important; }
.th-special { background-color: #ffedd5 !important; }
.th-special-sub { background-color: #fff7ed !important; }

/* 斑马线与悬浮高亮 */
.model-row:nth-child(even) td:not(.sticky-col) {
    background-color: #fdfdfd;
}

.model-row:hover td {
    background-color: #f1f5f9;
}
.model-row:hover .sticky-col {
    background-color: #f1f5f9;
}

.font-weight-bold {
    font-weight: 700;
    color: var(--primary-color);
}

.score-main {
    font-size: 0.95rem; 
    font-weight: 800;
    color: #0f172a;
}

.score-sub {
    font-size: 0.7rem; 
    color: #64748b;
    margin-top: 2px;
    line-height: 1.2;
}

/* =========================
   8. Demos 动态分类树容器
   ========================= */
#taxonomy-tabs-container {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.demo-tabs-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    align-items: center;
}

.demo-tabs-row:not([data-level="0"])::before {
    content: "↳";
    color: #94a3b8;
    margin-right: 0.5rem;
    font-weight: bold;
}

.level-tab-primary {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: capitalize;
}
.level-tab-primary.active {
    background: var(--text-color);
    color: white;
    border-color: var(--text-color);
}

.level-tab {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.35rem 1rem;
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: capitalize;
}
.level-tab.active {
    background: #e0f2fe;
    color: var(--primary-color);
    border-color: #bae6fd;
}

/* =========================
   9. Demos 页面其他区域与卡片网格
   ========================= */
.demo-container {
    padding: 1.5rem 2.5rem;
}

.demo-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

/* Shared Input 区 */
.shared-input-box {
    background: #f8fbff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.shared-header {
    margin-bottom: 1rem;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    background: #e2e8f0;
    color: #334155;
    margin-right: 0.5rem;
}

.badge-outline {
    background: transparent;
    border: 1px solid #cbd5e1;
}

.text-primary {
    color: var(--primary-hover);
    font-weight: 500;
}

/* 模型卡片网格 */
.model-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    gap: 1.5rem;
}

@media (max-width: 1200px) { .model-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 992px) { .model-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .model-grid { grid-template-columns: 1fr; } }

.model-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.model-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    border-color: #bfdbfe;
}

.model-card h4 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 0.5rem;
}

/* 指标仪表盘 2x2 */
.card-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.metric-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem;
    text-align: center;
}

.metric-label {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
}

.metric-val {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f172a;
}

.metric-delta {
    font-size: 0.8rem;
}

/* 音频播放器 */
.model-card audio {
    width: 100%;
    height: 36px;
    margin-bottom: 0.8rem;
    outline: none;
}

/* Details 折叠面板 */
details {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem;
    font-size: 0.85rem;
}

summary {
    font-weight: 600;
    cursor: pointer;
    color: #475569;
    outline: none;
}

.details-content {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed #cbd5e1;
    color: #334155;
    max-height: 200px;
    overflow-y: auto;
}

.details-content p {
    margin-bottom: 0.4rem;
}

/* =========================
   10. 页脚
   ========================= */
footer {
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
    margin-top: 4rem;
}

/* =========================
   Detailed Heatmap Leaderboard
   ========================= */
   #detailed-heatmap-table {
    border-collapse: separate; 
    border-spacing: 0;
    width: 100%;
}

#detailed-heatmap-table th, 
#detailed-heatmap-table td {
    padding: 0.4rem 0.8rem; /* 热力图格子需要紧凑一些 */
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    vertical-align: middle;
}

.taxonomy-col {
    text-align: left !important;
    font-weight: 600;
    white-space: nowrap;
    background-color: var(--card-bg) !important;
}

/* 热力图格子内的文字 */
.heatmap-cell {
    font-weight: 700;
    color: #1e293b; /* 深色文字，保证在深色背景上能看清，你可以加 JS 逻辑让极深背景变白字 */
    transition: filter 0.2s ease;
}
.heatmap-cell:hover {
    filter: brightness(0.9);
}

/* 可折叠行的交互样式 */
.row-expandable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}
.row-expandable:hover .taxonomy-col {
    background-color: #f1f5f9 !important;
}

.toggle-icon {
    display: inline-block;
    width: 20px;
    color: var(--primary-color);
    font-size: 0.85rem;
    transition: transform 0.2s ease;
}
.toggle-icon.collapsed {
    transform: rotate(-90deg);
}

/* 不同层级的缩进 */
.level-0 .taxonomy-col { padding-left: 1.0rem !important; font-size: 1.05rem; background: #f8fafc !important;}
.level-1 .taxonomy-col { padding-left: 2.5rem !important; font-size: 0.95rem; }
.level-2 .taxonomy-col { padding-left: 4.0rem !important; font-size: 0.9rem; }
.level-3 .taxonomy-col { padding-left: 5.5rem !important; font-size: 0.85rem; color: #475569; }
.level-4 .taxonomy-col { padding-left: 7.0rem !important; font-size: 0.85rem; color: #64748b; font-weight: 400;}

/* 隐藏行的动画过渡辅助类 */
.row-hidden {
    display: none;
}

#detailed-heatmap-table {
    border-collapse: separate; 
    border-spacing: 0;
    width: 100%;
    /* 加这一行，让透明度变化有一个 0.2 秒的丝滑过渡 */
    transition: opacity 0.2s ease; 
}

@media (max-width: 992px) {
    /* Summary 文字左右分栏变上下 */
    .summary-section > div {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    /* 雷达图左右分栏变上下 */
    .radar-grid {
        grid-template-columns: 1fr !important;
    }
}

/* TDS 表格中缺省值的样式 */
#tds-table th {
    white-space: nowrap;
    font-size: 0.85rem;
}

/* TDS 音频样本列表中的单个音频卡片 */
.tds-audio-item {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tds-audio-item audio {
    width: 100%;
    height: 36px;
}