/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --accent-color: #0066cc;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Consolas', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
}

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    margin: -20px -20px 20px -20px;
}

header h1 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
}

nav {
    display: flex;
    gap: 24px;
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

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

nav a.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

/* Section description */
.section-description {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 16px;
    margin-top: -8px;
}

/* Intro section */
.intro {
    background: var(--bg-primary);
    border-left: 4px solid var(--accent-color);
    padding: 24px;
    margin-bottom: 24px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.intro h2 {
    margin-top: 0;
    margin-bottom: 16px;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
}

.intro p {
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 14px;
}

.intro p:last-of-type {
    margin-bottom: 16px;
}

.version-notice {
    background: #fff9e6;
    border: 1px solid var(--warning-color);
    border-radius: 4px;
    padding: 12px 16px;
    margin-top: 16px;
    color: #856404;
    font-size: 13px;
    line-height: 1.5;
}

.version-notice strong {
    color: #856404;
    font-weight: 600;
}

/* Cross-agent details section */
.cross-agent-details {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.cross-agent-details h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.analysis-list-container {
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
}

.analysis-list {
    padding: 0;
}

.analysis-list .table-container {
    margin: 0;
    border: none;
    box-shadow: none;
}

.analysis-list table {
    margin: 0;
}

/* Analysis detail view */
.analysis-detail {
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 4px;
}

.analysis-detail h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.analysis-detail h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.analysis-detail h5 {
    font-size: 13px;
    font-weight: 600;
    margin-top: 12px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.analysis-detail .card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 16px;
}

.analysis-detail .code-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.comparative-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.metric-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.analysis-text p {
    margin-bottom: 12px;
    line-height: 1.6;
    color: var(--text-primary);
}

.chart-container {
    margin-bottom: 16px;
    max-height: 400px;
}

#agent-details-container {
    margin-top: 16px;
}

#agent-details-container .card h4 {
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 600;
}

.rationale-section {
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-secondary);
    border-left: 3px solid var(--accent-color);
    border-radius: 4px;
}

.rationale-section h5 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rationale-section p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}

.agent-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.collapsible-section {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* Controls */
.controls {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.control-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.control-group select,
.control-group input {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 14px;
    font-family: var(--font-sans);
    background: var(--bg-primary);
    min-width: 150px;
}

.control-group button,
.btn-secondary {
    padding: 6px 16px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 14px;
    font-family: var(--font-sans);
    background: var(--bg-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.control-group button:hover,
.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
}

.btn-primary {
    padding: 6px 16px;
    border: 1px solid var(--accent-color);
    border-radius: 3px;
    font-size: 14px;
    font-family: var(--font-sans);
    background: var(--accent-color);
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #0052a3;
    border-color: #0052a3;
}

.btn-action {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 11px;
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    margin: 2px;
}

.btn-action:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.btn-icon {
    font-size: 14px;
    line-height: 1;
}

.hidden {
    display: none !important;
}

/* Stats Overview */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 16px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Metrics Grid */
.metrics-summary {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.metrics-summary h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.metric-card {
    text-align: center;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 3px;
}

.metric-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.metric-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.metric-detail {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Tables */
.leaderboard,
.pr-results,
.comparison-table,
.pr-comparison,
.win-loss-matrix {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.leaderboard h2,
.pr-results h2,
.comparison-table h2,
.pr-comparison h2,
.win-loss-matrix h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead {
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
}

th {
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    font-size: 12px;
}

th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    background: var(--bg-tertiary);
}

td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
}

/* Specific column widths for agent results table */
#agent-results-table th:nth-child(1),
#agent-results-table td:nth-child(1) {
    width: 40px; /* Rank */
}

#agent-results-table th:nth-child(2),
#agent-results-table td:nth-child(2) {
    min-width: 150px; /* Agent */
}

#agent-results-table th:nth-child(3),
#agent-results-table td:nth-child(3) {
    width: 100px; /* W/L/T */
    white-space: nowrap;
}

/* Score columns - compact */
#agent-results-table th:nth-child(4),
#agent-results-table th:nth-child(5),
#agent-results-table th:nth-child(6),
#agent-results-table th:nth-child(7),
#agent-results-table th:nth-child(8),
#agent-results-table th:nth-child(9),
#agent-results-table td:nth-child(4),
#agent-results-table td:nth-child(5),
#agent-results-table td:nth-child(6),
#agent-results-table td:nth-child(7),
#agent-results-table td:nth-child(8),
#agent-results-table td:nth-child(9) {
    width: 55px;
    text-align: center;
}

#agent-results-table th:nth-child(10),
#agent-results-table td:nth-child(10) {
    width: 60px; /* Time */
    text-align: center;
}

/* Agent view sections */
.agent-view-section {
    margin-top: 10px;
}

tr:hover {
    background: var(--bg-secondary);
}

td.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-success {
    background: #d4edda;
    color: #155724;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
}

.status-timeout {
    background: #fff3cd;
    color: #856404;
}

/* Score coloring */
.score-positive {
    color: var(--success-color);
    font-weight: 500;
}

.score-neutral {
    color: var(--text-secondary);
}

.score-negative {
    color: var(--danger-color);
    font-weight: 500;
}

/* Win rate styling */
.win-rate {
    color: var(--success-color);
    font-weight: 600;
}

/* Charts */
.charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.chart-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
}

.chart-container-full {
    grid-column: 1 / -1;
}

.chart-container h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
}

canvas {
    max-height: 300px;
}

/* Run Info */
.run-info {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.run-info h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.info-item {
    display: flex;
    gap: 8px;
}

.info-label {
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 120px;
}

.info-value {
    font-family: var(--font-mono);
    font-size: 13px;
}

/* Comparison specific */
.comparison-summary {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.comparison-summary h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.comparison-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 12px;
}

/* Task Detail Page Styles */
.task-header {
    background: var(--bg-primary);
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.task-header h2 {
    font-size: 24px;
    margin-bottom: 16px;
}

.task-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.meta-value {
    font-size: 14px;
    color: var(--text-primary);
}

.meta-value a {
    color: var(--accent-color);
    text-decoration: none;
}

.meta-value a:hover {
    text-decoration: underline;
}

.task-scores {
    background: var(--bg-primary);
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.task-scores h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.task-instructions {
    background: var(--bg-primary);
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.task-instructions h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.code-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.task-stats {
    background: var(--bg-primary);
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.task-stats h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--bg-tertiary);
}

.stat-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 13px;
}

.diff-viewer {
    background: var(--bg-primary);
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.diff-viewer h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.diff-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.diff-content {
    position: relative;
}

.diff-panel {
    display: none;
}

.diff-panel.active {
    display: block;
}

.diff-block {
    max-height: 600px;
    overflow-y: auto;
}

/* Git diff coloring */
.diff-line-add {
    background-color: #e6ffec;
    color: #24292e;
}

.diff-line-del {
    background-color: #ffebe9;
    color: #24292e;
}

.diff-line-meta {
    background-color: #f1f8ff;
    color: #0366d6;
}

.diff-line-hunk {
    background-color: #f6f8fa;
    color: #6a737d;
}

.side-by-side-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.diff-column {
    min-width: 0;
}

.diff-column h4 {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.logs-viewer {
    background: var(--bg-primary);
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.logs-viewer h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.logs-controls {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    align-items: center;
}

.logs-controls label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
}

.logs-controls input[type="checkbox"] {
    cursor: pointer;
}

.logs-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 16px;
    max-height: 600px;
    overflow-y: auto;
}

.log-entries {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.log-entry {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--bg-tertiary);
}

.log-timestamp {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.log-event {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
    background: var(--bg-tertiary);
}

.log-agent-start .log-event {
    background: #e3f2fd;
    color: #1976d2;
}

.log-agent-run .log-event {
    background: #f3e5f5;
    color: #7b1fa2;
}

.log-agent-complete .log-event {
    background: #e8f5e9;
    color: #388e3c;
}

.log-agent-error .log-event {
    background: #ffebee;
    color: #c62828;
}

.log-stdout pre,
.log-stderr pre {
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    margin: 8px 0;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.log-stderr pre {
    background: #fff3e0;
    border-left: 3px solid var(--warning-color);
}

.log-details {
    margin-top: 8px;
    font-size: 13px;
}

.log-detail {
    padding: 4px 0;
    color: var(--text-secondary);
}

.log-detail strong {
    color: var(--text-primary);
}

.judge-rationale {
    background: var(--bg-primary);
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.judge-rationale h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

/* Agent logs display */
.logs-container {
    background: var(--bg-secondary);
    border-radius: 4px;
    padding: 12px;
    max-height: 600px;
    overflow-y: auto;
}

.logs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-entry {
    background: var(--bg-primary);
    border-left: 3px solid var(--border-color);
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 13px;
}

.log-entry.log-start {
    border-left-color: #2196f3;
    background: #e3f2fd;
}

.log-entry.log-success {
    border-left-color: var(--success-color);
    background: #e8f5e9;
}

.log-entry.log-error {
    border-left-color: var(--danger-color);
    background: #ffebee;
}

.log-entry.log-output {
    border-left-color: #9e9e9e;
}

.log-entry.log-info {
    border-left-color: #2196f3;
}

.log-timestamp {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.log-content {
    color: var(--text-primary);
}

.log-content strong {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.log-output-text {
    font-family: var(--font-mono);
    font-size: 12px;
    background: #f5f5f5;
    padding: 8px;
    border-radius: 3px;
    overflow-x: auto;
    margin-top: 6px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Agent Header with Score */
.agent-header {
    margin-bottom: 16px;
}

.agent-header h4 {
    margin: 0;
}

.judged-score-section {
    margin-bottom: 16px;
}

.judged-score-section h5 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.agent-score {
    font-size: 18px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 4px;
    font-family: var(--font-mono);
    display: inline-block;
}

.score-positive {
    background: #e8f5e9;
    color: #2e7d32;
}

.score-negative {
    background: #ffebee;
    color: #c62828;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .container {
        max-width: 100%;
        padding: 16px;
    }

    /* Hide Time column on narrower screens */
    #agent-results-table th:nth-child(10),
    #agent-results-table td:nth-child(10) {
        display: none;
    }

    /* Make score columns even more compact */
    #agent-results-table th:nth-child(4),
    #agent-results-table th:nth-child(5),
    #agent-results-table th:nth-child(6),
    #agent-results-table th:nth-child(7),
    #agent-results-table th:nth-child(8),
    #agent-results-table th:nth-child(9),
    #agent-results-table td:nth-child(4),
    #agent-results-table td:nth-child(5),
    #agent-results-table td:nth-child(6),
    #agent-results-table td:nth-child(7),
    #agent-results-table td:nth-child(8),
    #agent-results-table td:nth-child(9) {
        width: 50px;
        font-size: 11px;
    }
}

@media (max-width: 1200px) {
    /* Hide individual score columns, keep only Aggregate */
    #agent-results-table th:nth-child(5),
    #agent-results-table th:nth-child(6),
    #agent-results-table th:nth-child(7),
    #agent-results-table th:nth-child(8),
    #agent-results-table th:nth-child(9),
    #agent-results-table td:nth-child(5),
    #agent-results-table td:nth-child(6),
    #agent-results-table td:nth-child(7),
    #agent-results-table td:nth-child(8),
    #agent-results-table td:nth-child(9) {
        display: none;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 12px;
    }

    .container {
        padding: 8px;
    }

    /* Make table scroll horizontally on mobile */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 10px;
    }

    th, td {
        padding: 4px 6px;
    }

    /* Make remaining columns very compact */
    #agent-results-table th:nth-child(1),
    #agent-results-table td:nth-child(1) {
        width: 25px; /* Rank */
        padding: 4px 2px;
    }

    #agent-results-table th:nth-child(2),
    #agent-results-table td:nth-child(2) {
        min-width: 100px; /* Agent */
        max-width: 100px;
        font-size: 9px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #agent-results-table th:nth-child(3),
    #agent-results-table td:nth-child(3) {
        width: 70px; /* W/L/T */
        font-size: 9px;
    }

    #agent-results-table th:nth-child(4),
    #agent-results-table td:nth-child(4) {
        width: 55px; /* Aggregate */
        padding: 4px 4px;
    }

    #agent-results-table th:nth-child(10),
    #agent-results-table td:nth-child(10) {
        width: 50px; /* Time */
        font-size: 9px;
    }

    .btn-action {
        padding: 4px 8px;
        font-size: 10px;
        gap: 4px;
        margin: 2px;
    }

    .btn-icon {
        font-size: 12px;
    }
}
