/* CSBench — Data Tables & Leaderboard: Dark Theme */

/* ========================================
   Table Wrapper
   ======================================== */
.stats-table-wrap {
    margin-top: 2rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border);
    overflow: hidden;
}

.stats-table-wrap h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-table-wrap h3::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 1em;
    background: var(--primary);
    border-radius: 2px;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

/* ========================================
   Core Table
   ======================================== */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
    padding: 0.65rem 0.9rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--bg-elevated);
    font-weight: 700;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 2;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid rgba(255, 255, 255, 0.08);
}

.data-table thead tr:first-child th {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.data-table thead tr:last-child th {
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.data-table tbody tr {
    transition: background-color 0.15s ease;
}

.data-table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.015);
}

.data-table tbody tr:hover {
    background-color: rgba(6, 214, 160, 0.04);
}

.data-table td:first-child {
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
}

/* Corner rounding */
.data-table thead tr:first-child th:first-child {
    border-top-left-radius: 9px;
}

.data-table thead tr:first-child th:last-child {
    border-top-right-radius: 9px;
}

.data-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 9px;
}

.data-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 9px;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ========================================
   Highlight Cells
   ======================================== */
.highlight-cell {
    background-color: rgba(6, 214, 160, 0.1) !important;
    font-weight: 700;
    color: var(--primary) !important;
}

.highlight-cell::after {
    content: '▲';
    font-size: 0.5rem;
    margin-left: 0.2rem;
    color: var(--primary);
    vertical-align: super;
}

/* CSBench column group header */
.data-table thead th[colspan="2"]:last-of-type {
    background: rgba(6, 214, 160, 0.12) !important;
    color: var(--primary) !important;
    font-weight: 800;
}

/* ========================================
   Leaderboard — Rank Medals
   ======================================== */
.results-table td:first-child {
    min-width: 160px;
    white-space: nowrap;
}

.model-org {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 0.1rem 0.4rem;
    margin-left: 0.35rem;
    vertical-align: middle;
    letter-spacing: 0.02em;
    border: 1px solid var(--border);
}

.rank-1 td:first-child::before {
    content: '🥇';
    margin-right: 0.3rem;
    font-size: 0.9rem;
}

.rank-2 td:first-child::before {
    content: '🥈';
    margin-right: 0.3rem;
    font-size: 0.9rem;
}

.rank-3 td:first-child::before {
    content: '🥉';
    margin-right: 0.3rem;
    font-size: 0.9rem;
}

.rank-1 {
    background: rgba(255, 215, 0, 0.06) !important;
}

.rank-2 {
    background: rgba(192, 192, 192, 0.05) !important;
}

.rank-3 {
    background: rgba(205, 127, 50, 0.05) !important;
}

.rank-1:hover {
    background: rgba(255, 215, 0, 0.1) !important;
}

.rank-2:hover {
    background: rgba(192, 192, 192, 0.08) !important;
}

.rank-3:hover {
    background: rgba(205, 127, 50, 0.08) !important;
}

.overall-best {
    background-color: rgba(6, 214, 160, 0.12) !important;
    color: var(--primary) !important;
    font-weight: 800;
}

.best-in-row {
    background-color: rgba(56, 189, 248, 0.08) !important;
    font-weight: 700;
    color: var(--secondary) !important;
}

/* Monospaced values */
.results-table td:not(:first-child),
.topic-table td:not(:first-child) {
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    letter-spacing: -0.01em;
}

/* ========================================
   Category Headers
   ======================================== */
.cat-system {
    background: rgba(6, 214, 160, 0.1) !important;
    color: var(--primary) !important;
    font-weight: 800 !important;
}

.cat-ai {
    background: rgba(56, 189, 248, 0.1) !important;
    color: var(--secondary) !important;
    font-weight: 800 !important;
}

.cat-app {
    background: rgba(255, 209, 102, 0.1) !important;
    color: var(--accent) !important;
    font-weight: 800 !important;
}

.cat-others {
    background: rgba(239, 71, 111, 0.1) !important;
    color: var(--danger) !important;
    font-weight: 800 !important;
}

.cat-overall {
    background: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
    font-weight: 800;
}

/* ========================================
   Topic Table — Category Rows
   ======================================== */
.topic-table .cat-system-row td:first-child {
    border-left: 3px solid var(--primary);
    padding-left: 0.8rem;
}

.cat-ai-row td:first-child {
    border-left: 3px solid var(--secondary);
    padding-left: 0.8rem;
}

.cat-app-row td:first-child {
    border-left: 3px solid var(--accent);
    padding-left: 0.8rem;
}

.cat-others-row td:first-child {
    border-left: 3px solid var(--danger);
    padding-left: 0.8rem;
}

.cat-system-row {
    background-color: rgba(6, 214, 160, 0.02) !important;
}

.cat-ai-row {
    background-color: rgba(56, 189, 248, 0.02) !important;
}

.cat-app-row {
    background-color: rgba(255, 209, 102, 0.02) !important;
}

.cat-others-row {
    background-color: rgba(239, 71, 111, 0.02) !important;
}

.cat-system-row:hover {
    background-color: rgba(6, 214, 160, 0.06) !important;
}

.cat-ai-row:hover {
    background-color: rgba(56, 189, 248, 0.06) !important;
}

.cat-app-row:hover {
    background-color: rgba(255, 209, 102, 0.06) !important;
}

.cat-others-row:hover {
    background-color: rgba(239, 71, 111, 0.06) !important;
}

.overall-row {
    background-color: var(--bg-elevated) !important;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.overall-row td {
    font-weight: 700;
    font-size: 0.9rem;
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
}

.overall-row td:first-child {
    border-left: 3px solid var(--text-primary);
    padding-left: 0.8rem;
}

/* ========================================
   Category Group Headers
   ======================================== */
.category-group-header td {
    font-weight: 800 !important;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.5rem 0.9rem !important;
    border-bottom: 1px solid var(--border);
    text-align: left !important;
}

.category-group-header.system-group td {
    background: rgba(6, 214, 160, 0.08) !important;
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

.category-group-header.ai-group td {
    background: rgba(56, 189, 248, 0.08) !important;
    color: var(--secondary);
    border-left: 3px solid var(--secondary);
}

.category-group-header.app-group td {
    background: rgba(255, 209, 102, 0.08) !important;
    color: var(--accent);
    border-left: 3px solid var(--accent);
}

.category-group-header.others-group td {
    background: rgba(239, 71, 111, 0.08) !important;
    color: var(--danger);
    border-left: 3px solid var(--danger);
}

/* ========================================
   Comparison Table
   ======================================== */
.group-header {
    font-size: 0.82rem !important;
    letter-spacing: 0.04em;
}

.group-csbench {
    background: rgba(6, 214, 160, 0.1) !important;
    color: var(--primary) !important;
    font-weight: 800 !important;
}

.th-csbench {
    background: rgba(6, 214, 160, 0.06) !important;
    color: var(--primary) !important;
    font-weight: 700 !important;
}

.comparison-table tbody td:nth-last-child(-n+2) {
    background-color: rgba(6, 214, 160, 0.03);
}

.comparison-table tbody tr:hover td:nth-last-child(-n+2) {
    background-color: rgba(6, 214, 160, 0.07);
}

/* ========================================
   Custom Scrollbar for Tables
   ======================================== */
.table-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.table-scroll::-webkit-scrollbar {
    height: 5px;
}

.table-scroll::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.table-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.table-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ========================================
   Pipeline Stages (csbench override)
   ======================================== */
.pipeline-stages {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin: 1.2rem 0;
}

/* ========================================
   Figure Caption (override)
   ======================================== */
.figure-caption {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-top: 0.6rem;
}

.abstract-figure-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem;
    align-items: start;
}

.abstract-figure-card {
    display: flex;
    flex-direction: column;
}

.abstract-figure-card img {
    width: 100%;
    height: 320px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.02);
}

/* ========================================
   Results Note Override
   ======================================== */
.results-note {
    margin-top: 1.2rem;
    padding: 1rem 1.2rem;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--primary);
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* ========================================
   Hero Overrides for CSBench
   ======================================== */
/* (Most hero styles come from hero.css; this just ensures stats grid is correct) */

/* ========================================
   Scroll Indicator
   ======================================== */
.scroll-indicator {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    text-decoration: none;
    animation: indicatorBounce 2s infinite;
}

.scroll-indicator-icon {
    font-size: 1.1rem;
}

@keyframes indicatorBounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-6px);
    }

    60% {
        transform: translateY(-3px);
    }
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .data-table {
        font-size: 0.76rem;
    }

    .abstract-figure-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .abstract-figure-card img {
        height: auto;
    }

    .data-table th,
    .data-table td {
        padding: 0.45rem 0.55rem;
    }

    .stats-table-wrap {
        padding: 1rem;
    }

    .category-group-header td {
        font-size: 0.7rem;
    }

    .model-org {
        font-size: 0.55rem;
        padding: 0.06rem 0.25rem;
    }

    .highlight-cell::after {
        display: none;
    }
}

@media (max-width: 480px) {
    .data-table {
        font-size: 0.72rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.35rem 0.45rem;
    }

    .stat-number {
        font-size: 1.4rem;
    }
}

/* ========================================
   Performance by Category — Horizontal Bar Chart
   ======================================== */

/* Header with toggle */
.perf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.perf-header h3 {
    margin: 0;
}

/* Toggle buttons */
.perf-toggle {
    display: flex;
    background: var(--bg-elevated);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    flex-shrink: 0;
}

.perf-toggle-btn {
    padding: 0.4rem 1rem;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    letter-spacing: 0.01em;
}

.perf-toggle-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.perf-toggle-btn.active {
    color: var(--text-inverse);
    background: var(--primary);
    font-weight: 700;
}

/* View switching */
.perf-view {
    display: none;
}

.perf-view.active {
    display: block;
}

/* Legend */
.perf-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.perf-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.perf-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
    flex-shrink: 0;
}

/* Chart container */
.perf-chart {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Each model row */
.perf-model {
    display: grid;
    grid-template-columns: 180px 1fr;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.2s ease;
}

.perf-model:last-child {
    border-bottom: none;
}

.perf-model:hover {
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius);
}

/* Left label */
.perf-label {
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    text-align: right;
    padding-right: 0.5rem;
}

/* Bar group — 5 bars stacked vertically */
.perf-bars {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* Single bar row */
.perf-bar-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 16px;
}

/* The bar itself */
.perf-bar {
    height: 100%;
    border-radius: 3px;
    min-width: 4px;
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.3s ease,
        filter 0.3s ease;
    position: relative;
}

/* Hover effect — dim siblings */
.perf-model:hover .perf-bar-row:not(:hover) .perf-bar {
    opacity: 0.45;
}

.perf-model:hover .perf-bar-row:hover .perf-bar {
    filter: brightness(1.2);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.1);
}

/* Bar colors */
.bar-system {
    background: linear-gradient(90deg, var(--primary-dim), var(--primary));
}

.bar-ai {
    background: linear-gradient(90deg, var(--secondary-dim), var(--secondary));
}

.bar-app {
    background: linear-gradient(90deg, var(--accent-dim), var(--accent));
}

.bar-others {
    background: linear-gradient(90deg, #c73a5a, var(--danger));
}

.bar-overall {
    background: linear-gradient(90deg, #94a3b8, var(--text-primary));
    height: 100%;
}

/* Best-in-category indicator — subtle glow */
.best-cat {
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.15);
}

.best-overall {
    box-shadow: 0 0 8px rgba(6, 214, 160, 0.3);
}

/* Overall-only bar (single bar per model) */
.bar-overall-rank {
    background: linear-gradient(90deg, rgba(100, 116, 139, 0.6), var(--text-secondary));
    height: 100%;
    border-radius: 3px;
}

.bar-overall-rank.rank-gold {
    background: linear-gradient(90deg, #b8860b, #ffd700);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.25);
}

.bar-overall-rank.rank-silver {
    background: linear-gradient(90deg, #808080, #c0c0c0);
    box-shadow: 0 0 8px rgba(192, 192, 192, 0.2);
}

.bar-overall-rank.rank-bronze {
    background: linear-gradient(90deg, #8b5e3c, #cd7f32);
    box-shadow: 0 0 8px rgba(205, 127, 50, 0.2);
}

/* Overall view — thicker single bar */
.perf-view-overall .perf-bar-row {
    height: 26px;
}

.perf-view-overall .perf-model {
    padding: 0.45rem 0;
}

/* Value label next to bar */
.perf-val {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 42px;
    letter-spacing: -0.01em;
}

.best-overall-val {
    color: var(--primary);
    font-weight: 700;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .perf-model {
        grid-template-columns: 140px 1fr;
        gap: 0.6rem;
    }

    .perf-label {
        font-size: 0.78rem;
    }

    .perf-bar-row {
        height: 14px;
    }

    .perf-val {
        font-size: 0.66rem;
        min-width: 36px;
    }
}

@media (max-width: 480px) {
    .perf-model {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }

    .perf-label {
        text-align: left;
        padding-right: 0;
        padding-left: 0.2rem;
    }

    .perf-legend {
        gap: 0.5rem 1rem;
    }

    .perf-bar-row {
        height: 12px;
    }
}

/* ========================================
   CS000232 Case Explorer
   ======================================== */
.case-explorer-card {
    margin-top: 1.5rem;
}

.case-explorer-intro {
    margin-bottom: 1.25rem;
}

.case-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
}

.case-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.case-explorer-note {
    margin-bottom: 0;
    font-size: 0.92rem;
}

.case-explorer-layout {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.case-tree-panel,
.case-viewer-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.case-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1rem 0.85rem;
    border-bottom: 1px solid var(--border);
}

.case-panel-header h3 {
    margin-bottom: 0.15rem;
}

.case-panel-subtitle,
.case-current-path {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    word-break: break-all;
}

.case-open-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0.45rem 0.8rem;
    border-radius: var(--radius-sm);
    background: rgba(6, 214, 160, 0.08);
    border: 1px solid var(--primary-border);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 600;
}

.case-open-link:hover {
    color: var(--text-inverse);
    background: var(--primary);
}

.case-tree {
    padding: 0.6rem;
    max-height: 720px;
    overflow: auto;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0));
}

.case-tree-folder {
    margin-left: 0;
}

.case-tree-folder+.case-tree-folder,
.case-tree-folder+.case-tree-file,
.case-tree-file+.case-tree-folder,
.case-tree-file+.case-tree-file {
    margin-top: 0.18rem;
}

.case-tree-folder-label {
    display: flex;
    align-items: center;
    gap: 0.42rem;
    list-style: none;
    cursor: pointer;
    color: #d7e3f8;
    font-weight: 500;
    font-size: 0.82rem;
    padding: 0.24rem 0.36rem;
    border-radius: var(--radius-sm);
    transition: background var(--t-fast), color var(--t-fast);
    overflow: hidden;
    user-select: none;
}

.case-tree-folder-label::-webkit-details-marker {
    display: none;
}

.case-tree-folder-label:hover {
    background: rgba(255, 255, 255, 0.05);
}

.case-tree-twistie {
    width: 0.8rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    flex-shrink: 0;
    transition: transform var(--t-fast), color var(--t-fast);
}

.case-tree-folder[open]>.case-tree-folder-label .case-tree-twistie {
    transform: rotate(90deg);
    color: var(--text-secondary);
}

.case-tree-children {
    margin-left: 0.9rem;
    padding-left: 0.35rem;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.case-tree-file {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.42rem;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.24rem 0.36rem;
    color: #c5d2e8;
    cursor: pointer;
    font: inherit;
    transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
    overflow: hidden;
}

.case-tree-file:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #edf4ff;
}

.case-tree-file.active {
    background: rgba(0, 122, 204, 0.22);
    color: #ffffff;
    border: 1px solid rgba(56, 189, 248, 0.22);
}

.case-tree-icon {
    width: 1rem;
    text-align: center;
    flex-shrink: 0;
    color: #8fb8ff;
}

.case-tree-file-indent {
    width: 0.8rem;
    flex-shrink: 0;
}

.case-tree-icon-folder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #dcb067;
}

.case-tree-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.case-tree-empty {
    padding: 0.3rem 0.35rem 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-style: italic;
}

.case-tree-icon-file {
    color: #8fb8ff;
}

.case-tree-icon-markdown {
    color: #58a6ff;
}

.case-tree-icon-python {
    color: #ffd166;
}

.case-tree-icon-shell {
    color: #73daca;
}

.case-tree-icon-c {
    color: #a78bfa;
}

.case-tree-icon-build,
.case-tree-icon-config {
    color: #c4b5fd;
}

.case-tree-icon-docker {
    color: #38bdf8;
}

.case-tree-icon-data {
    color: #94a3b8;
}

.case-file-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    padding: 0.9rem 1rem 0;
}

.case-viewer {
    margin: 0.9rem 1rem 1rem;
    min-height: 420px;
    max-height: 720px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #0b1120;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.case-viewer-status {
    padding: 1.2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.case-viewer-error {
    color: #fda4af;
}

.case-embed-wrap {
    min-height: 100%;
}

.case-file-embed {
    display: block;
    width: 100%;
    min-height: 620px;
    border: none;
    background: #ffffff;
}

.case-code {
    min-width: max-content;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.65;
}

.case-code-line {
    display: grid;
    grid-template-columns: 4rem minmax(0, 1fr);
}

.case-code-line:hover {
    background: rgba(255, 255, 255, 0.025);
}

.case-line-number,
.case-line-content {
    padding: 0 0.9rem;
    white-space: pre;
}

.case-line-number {
    color: var(--text-muted);
    text-align: right;
    user-select: none;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.015);
}

.case-line-content {
    color: #dbe7ff;
}

@media (max-width: 960px) {
    .case-explorer-layout {
        grid-template-columns: 1fr;
    }

    .case-tree {
        max-height: 420px;
    }
}

@media (max-width: 640px) {
    .case-panel-header {
        flex-direction: column;
        align-items: stretch;
    }

    .case-open-link {
        width: 100%;
    }

    .case-code-line {
        grid-template-columns: 3.2rem minmax(0, 1fr);
    }

    .case-line-number,
    .case-line-content {
        padding: 0 0.6rem;
    }
}