/* Bootstrap 5.3.0 Essential Components */
*, *::before, *::after {
    box-sizing: border-box;
}

@media (prefers-reduced-motion:no-preference) {
    :root {
        scroll-behavior: smooth;
    }
}

body {
    margin: 0;
    font-family: var(--bs-body-font-family);
    font-size: var(--bs-body-font-size);
    font-weight: var(--bs-body-font-weight);
    line-height: var(--bs-body-line-height);
    color: var(--soft-text);
    text-align: var(--bs-body-text-align);
    background-color: var(--page-bg);
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

:root {
    --bs-blue: #0d6efd;
    --bs-indigo: #6610f2;
    --bs-purple: #6f42c1;
    --bs-pink: #d63384;
    --bs-red: #dc3545;
    --bs-orange: #fd7e14;
    --bs-yellow: #ffc107;
    --bs-green: #198754;
    --bs-teal: #20c997;
    --bs-cyan: #0dcaf0;
    --bs-primary: #0d6efd;
    --bs-secondary: #6c757d;
    --bs-success: #198754;
    --bs-info: #0dcaf0;
    --bs-warning: #ffc107;
    --bs-danger: #dc3545;
    --bs-light: #f8f9fa;
    --bs-dark: #212529;
    --bs-primary-rgb: 13, 110, 253;
    --bs-secondary-rgb: 108, 117, 125;
    --bs-success-rgb: 25, 135, 84;
    --bs-info-rgb: 13, 202, 240;
    --bs-warning-rgb: 255, 193, 7;
    --bs-danger-rgb: 220, 53, 69;
    --bs-light-rgb: 248, 249, 250;
    --bs-dark-rgb: 33, 37, 41;
    --bs-white-rgb: 255, 255, 255;
    --bs-black-rgb: 0, 0, 0;
    --bs-body-color-rgb: 33, 37, 41;
    --bs-body-bg-rgb: 255, 255, 255;
    --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    --bs-font-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    --bs-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
    --bs-body-font-family: var(--bs-font-sans-serif);
    --bs-body-font-size: 1rem;
    --bs-body-font-weight: 400;
    --bs-body-line-height: 1.5;
    --bs-body-color: #212529;
    --bs-body-bg: #fff;
    --bs-border-width: 1px;
    --bs-border-style: solid;
    --bs-border-color: #dee2e6;
    --bs-border-color-translucent: rgba(0, 0, 0, 0.175);
    --bs-border-radius: 0.375rem;
    --bs-border-radius-sm: 0.25rem;
    --bs-border-radius-lg: 0.5rem;
    --bs-border-radius-xl: 1rem;
    --bs-border-radius-2xl: 2rem;
    --bs-border-radius-pill: 50rem;
    --bs-link-color: #0d6efd;
    --bs-link-hover-color: #0a58ca;
    --bs-code-color: #d63384;
    --bs-highlight-bg: #fff3cd;
}

.container,
.container-fluid,
.container-lg,
.container-md,
.container-sm,
.container-xl,
.container-xxl {
    width: 100%;
    padding-right: var(--bs-gutter-x, .75rem);
    padding-left: var(--bs-gutter-x, .75rem);
    margin-right: auto;
    margin-left: auto;
}

@media (min-width:576px) {
    .container-sm,
    .container {
        max-width: 540px;
    }
}

@media (min-width:768px) {
    .container-md,
    .container-sm,
    .container {
        max-width: 720px;
    }
}

@media (min-width:992px) {
    .container-lg,
    .container-md,
    .container-sm,
    .container {
        max-width: 960px;
    }
}

@media (min-width:1200px) {
    .container-xl,
    .container-lg,
    .container-md,
    .container-sm,
    .container {
        max-width: 1140px;
    }
}

@media (min-width:1400px) {
    .container-xxl,
    .container-xl,
    .container-lg,
    .container-md,
    .container-sm,
    .container {
        max-width: 1320px;
    }
}

.row {
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 0;
    display: flex;
    flex-wrap: wrap;
    margin-top: calc(-1 * var(--bs-gutter-y));
    margin-right: calc(-0.5 * var(--bs-gutter-x));
    margin-left: calc(-0.5 * var(--bs-gutter-x));
}

.row > * {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    padding-right: calc(var(--bs-gutter-x) * 0.5);
    padding-left: calc(var(--bs-gutter-x) * 0.5);
    margin-top: var(--bs-gutter-y);
}

.col {
    flex: 1 0 0%;
}

.col-12 {
    flex: 0 0 auto;
    width: 100%;
}

@media (min-width:768px) {
    .col-md-4 {
        flex: 0 0 auto;
        width: 33.33333333%;
    }

    .col-md-6 {
        flex: 0 0 auto;
        width: 50%;
    }

    .col-md-8 {
        flex: 0 0 auto;
        width: 66.66666667%;
    }
}

@media (min-width:992px) {
    .col-lg-3 {
        flex: 0 0 auto;
        width: 25%;
    }

    .col-lg-4 {
        flex: 0 0 auto;
        width: 33.33333333%;
    }

    .col-lg-6 {
        flex: 0 0 auto;
        width: 50%;
    }

    .col-lg-9 {
        flex: 0 0 auto;
        width: 75%;
    }
}

.btn {
    display: inline-block;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    background-color: transparent;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    border-radius: 0.375rem;
    transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.btn:hover {
    color: #212529;
}

.btn-primary {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-primary:hover {
    color: #fff;
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

.btn-outline-primary {
    color: #0d6efd;
    border-color: #0d6efd;
}

.btn-outline-primary:hover {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-outline-secondary {
    color: #6c757d;
    border-color: #6c757d;
}

.btn-outline-secondary:hover {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: #fff;
    background-clip: border-box;
    border: 1px solid rgba(0, 0, 0, .125);
    border-radius: 0.375rem;
}

.card-body {
    flex: 1 1 auto;
    padding: 1rem;
}

.card-title {
    margin-bottom: 0.5rem;
}

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

.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
}

.badge-bg-success {
    background-color: #198754 !important;
}

.badge-bg-warning {
    background-color: #ffc107 !important;
    color: #000 !important;
}

.badge-bg-danger {
    background-color: #dc3545 !important;
}

.text-center {
    text-align: center !important;
}

.text-muted {
    color: #6c757d !important;
}

.text-md-end {
    text-align: end !important;
}

@media (min-width:768px) {
    .text-md-end {
        text-align: end !important;
    }
}

.me-2 {
    margin-right: 0.5rem !important;
}

.mb-2 {
    margin-bottom: 0.5rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.ms-2 {
    margin-left: 0.5rem !important;
}

.mt-3 {
    margin-top: 1rem !important;
}

.p-3 {
    padding: 1rem !important;
}

.d-flex {
    display: flex !important;
}

.flex-wrap {
    flex-wrap: wrap !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.align-items-center {
    align-items: center !important;
}

.shadow {
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15) !important;
}

.shadow-sm {
    box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075) !important;
}

.h-100 {
    height: 100% !important;
}

/* Custom CSS for the benchmark page */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    /* Muted gradients for lighter but less glaring look; hero color customizable */
    --gradient-primary: linear-gradient(135deg, #d6e6f2 0%, #e9f3ef 100%);
    --gradient-secondary: linear-gradient(135deg, #e7dfe8 0%, #eebfb1 100%);
    /* Page-level color tokens to make theme switching predictable */
    --page-foreground: var(--bs-body-color);
    --overview-text: rgba(33,37,41,0.9);
    /* Soft light theme tokens (low-contrast, non-glaring) */
    --page-bg: #eef2f5; /* page background */
    --panel-bg: #f5f7f8; /* cards and panels */
    --muted-panel-bg: #eef2f3; /* chart / secondary panels */
    --card-border: rgba(33,37,41,0.06);
    --soft-shadow: 0 6px 18px rgba(33,37,41,0.04);
    --soft-text: #2b2f33;
}

[data-theme="dark"] {
    --bs-body-color: #e9ecef;
    --bs-body-bg: #212529;
    --bs-dark: #e9ecef;
    --bs-light: #343a40;
    /* Dark theme tokens for the soft system */
    --page-bg: #0f1720;
    --panel-bg: #1f272b;
    --muted-panel-bg: #16191c;
    --card-border: rgba(255,255,255,0.06);
    --soft-shadow: 0 6px 18px rgba(0,0,0,0.6);
    --soft-text: #e9ecef;
}

[data-theme="dark"] .card {
    background-color: var(--panel-bg);
    border-color: var(--card-border);
    color: var(--soft-text);
}

[data-theme="dark"] .navbar {
    background-color: #343a40 !important;
}

[data-theme="dark"] .hero-section {
    background: linear-gradient(135deg,#182026 0%,#101316 100%);
}

[data-theme="dark"] .hero-section h1 {
    color: #f8f9fa !important;
}

[data-theme="dark"] .hero-section .lead {
    color: #e9ecef !important;
}

[data-theme="dark"] .text-muted {
    color: rgba(233,236,239,0.65) !important;
}

[data-theme="dark"] a {
    color: #6cb2eb !important;
}

[data-theme="dark"] a:hover {
    color: #85c4f0 !important;
}

body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: 10000;
}

.skip-link:focus {
    position: fixed;
    left: 50%;
    top: 12px;
    transform: translateX(-50%);
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: #fff;
    border-radius: 999px;
    box-shadow: 0 10px 30px rgba(15, 23, 32, 0.35);
}

.site-header {
    position: relative;
    z-index: 10;
    padding-top: 1rem;
}

.header-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 3rem;
}

.site-main {
    display: block;
    padding-bottom: 3rem;
}

.section-card {
    padding: 1.5rem 0;
}

.section-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.section-heading h2 {
    margin-bottom: 0.25rem;
}

.summary-chip {
    background: var(--panel-bg);
    border: 1px solid var(--card-border);
    border-radius: 999px;
    padding: 0.75rem 1.25rem;
    display: flex;
    flex-direction: column;
    min-width: 220px;
    text-align: center;
    box-shadow: var(--soft-shadow);
}

.summary-chip .summary-label {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    color: var(--text-muted, var(--overview-text));
}

.summary-chip strong {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--soft-text);
}

.hero-section {
    background: var(--gradient-primary);
    color: var(--soft-text);
    padding: 2.5rem 0;
    margin-bottom: 1.25rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--soft-shadow);
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Cpath d='m36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
    opacity: 0.1;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.stats-card {
    /* soft card for light mode */
    background: var(--panel-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin: 0.75rem 0;
    color: var(--soft-text);
    transition: transform 0.22s ease;
}

.stats-card:hover {
    transform: translateY(-5px);
}

.chart-container {
    position: relative;
    background: var(--muted-panel-bg);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin: 0.75rem 0;
    box-shadow: var(--soft-shadow);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.charts-section #charts-container {
    margin-top: 1rem;
}

.chart-stats-row {
    gap: 0.75rem;
}

.chart-stat-item {
    min-width: 6.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.125rem 0.25rem;
    box-sizing: border-box;
}

.chart-stat-item .stat-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.68rem;
    text-transform: uppercase;
    opacity: 0.85;
    margin-bottom: 0.28rem;
}

.chart-stat-item .stat-value {
    font-size: 1.05rem;
    color: var(--soft-text);
    font-weight: 800;
    line-height: 1;
    min-height: 1.25rem; /* keep values aligned even if some items wrap */
    display: flex;
    align-items: flex-end; /* align numbers to bottom for consistent baseline */
    justify-content: center;
}

/* Highlight box around per-chart stats */
.chart-stats {
    display: block;
    background: var(--panel-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.6rem 0.9rem;
    box-shadow: 0 12px 40px rgba(2,6,23,0.10);
    width: 100%;
    overflow: visible;
}

.chart-stats-row .chart-stat-item {
    color: var(--overview-text);
}

[data-theme="dark"] .chart-stats {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    box-shadow: 0 6px 18px rgba(0,0,0,0.6);
}

.chart-stats-title {
    font-weight: 700;
    font-size: 1.05rem;
    margin: 0;
    color: var(--soft-text);
    white-space: nowrap;
    text-align: center;

    /* make clear this title can be interacted with to collapse/expand stats */
    cursor: pointer;
}

@media (max-width: 600px) {
    .chart-stats-title { font-size: 0.9rem; margin-bottom: 0.25rem; }
}

[data-theme="dark"] .chart-container {
    background: var(--muted-panel-bg);
    color: var(--soft-text);
}

.chart-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

/* emphasized stat values for better readability */
.chart-stat-item .stat-value {
    font-size: 1.05rem;
    color: var(--soft-text);
    font-weight: 800;
}

/* Collapsible stats support: hide the row and reduce visual footprint when collapsed */
.chart-stats {
    transition: padding 220ms ease, box-shadow 220ms ease, max-height 240ms ease;
}

.chart-stats.collapsed {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
    box-shadow: 0 6px 18px rgba(2,6,23,0.06);
}

.chart-stats.collapsed .chart-stats-row {
    display: none;
}

/* Use max-height to fully collapse the stats box (only title remains) */
.chart-stats {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 240ms ease, padding 220ms ease, box-shadow 220ms ease;
}
.chart-stats.collapsed {
    /* tightly collapse the stats box so only a compact title pill remains visible */
    max-height: 40px;
    padding: 0;
    box-shadow: none;
    border-color: transparent;
    background: transparent;
}
.chart-stats.collapsed .chart-stats-title {
    margin: 0 auto !important;
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.03);
    color: var(--soft-text);
}

@media (prefers-color-scheme: light) {
    .chart-stats.collapsed .chart-stats-title {
        background: rgba(0,0,0,0.04);
        color: rgba(33,37,41,0.9);
    }
}

.chart-stats-title::after {
    content: '\25BE'; /* small down-caret */
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 0.78rem;
    opacity: 0.85;
    transition: transform 200ms ease;
}

.chart-stats.collapsed .chart-stats-title::after {
    transform: rotate(-90deg);
}

/* change percent coloring */
.stat-change--improve .stat-value { color: var(--success-color); font-weight: 700; }
.stat-change--regress .stat-value { color: var(--danger-color); font-weight: 700; }
.stat-change--stable .stat-value { color: var(--secondary-color); font-weight: 700; }

/* layout tweak: center the stats row inside the box and align values on a common baseline */
.chart-stats-row { 
    justify-content: center; 
    align-items: flex-end; /* align stat values on a common baseline */
}

/* small inline swatches for min/max to make values scannable */
.stat-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 6px;
    vertical-align: -2px; /* visually center with text */
}
.chart-stat-item[data-label="min"] .stat-swatch { background: var(--success-color); }
.chart-stat-item[data-label="max"] .stat-swatch { background: var(--danger-color); }

/* median and stddev smaller labels */
.chart-stat-item[data-label="median"] .stat-label,
.chart-stat-item[data-label="stddev"] .stat-label {
    font-size: 0.62rem;
}

/* Enhanced overview cards styling */
#overview-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin: 1.5rem auto 0;
}

.overview-card {
    border-radius: 12px;
    overflow: hidden;
    background: var(--panel-bg);
    box-shadow: var(--soft-shadow);
    border: 1px solid var(--card-border);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.overview-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 18px 44px rgba(2, 6, 23, 0.35);
}

.overview-card .card-body {
    padding: 1.5rem 1.35rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
}

.overview-card .card-title {
    font-weight: 700;
    letter-spacing: 0.2px;
    margin-bottom: 0.25rem;
}

.metric-list {
    margin: 0;
    padding: 0;
    width: 100%;
    display: grid;
    /* allow the entity (encoder name) to take available space and the time to size to its content */
    grid-template-columns: 1fr auto;
    gap: 0.35rem 0.75rem;
}

.metric-list dt,
.metric-list dd {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--overview-text);
}

.metric-list dt {
    font-weight: 600;
    justify-content: flex-start;
}

.metric-label {
    white-space: nowrap;
}

.metric-entity {
    flex: 1 1 auto;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /* allow the entity to fill available space instead of a fixed max-width */
    max-width: none;
}

.metric-value {
    font-weight: 600;
    white-space: nowrap;
    min-width: 6ch; /* reserve reasonable width for numeric times */
    text-align: right;
}

.metric-list dd {
    justify-content: flex-end;
}

.metric-list dd span + span {
    margin-left: 0.35rem;
}

.metric-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    width: 1.5rem;
}

.overview-card .card-title.text-success + .metric-list .metric-icon { color: var(--success-color); }
.overview-card .card-title.text-warning + .metric-list .metric-icon { color: var(--warning-color); }
.overview-card .card-title.text-info + .metric-list .metric-icon { color: var(--bs-info); }
.overview-card .card-title.text-primary + .metric-list .metric-icon { color: var(--primary-color); }

@media (max-width: 600px) {
    .metric-list {
        grid-template-columns: 1fr;
    }

    .metric-list dd {
        justify-content: flex-start;
    }

    .metric-entity {
        max-width: 100%;
    }
}

@media (prefers-color-scheme: light) {
    .overview-card {
        box-shadow: 0 5px 14px rgba(33, 37, 41, 0.04);
        background: var(--panel-bg);
        color: var(--soft-text);
    }
    .metric-list dt,
    .metric-list dd {
        color: rgba(43, 47, 51, 0.85);
    }
}

/* Additional light-theme toning: reduce contrast of theme toggle */
.theme-toggle {
    background: #f7f9fb;
    color: #212529;
}

/* Floating overlay toggle (mirrors theme-toggle placement) */
.overlay-toggle {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    background: linear-gradient(180deg,#ffffff,#eef4f6);
    border: 1px solid rgba(43,47,51,0.08);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    color: var(--soft-text);
}

[data-theme="dark"] .overlay-toggle {
    background: linear-gradient(180deg,#343a40,#2b3136);
    color: #ffdca3;
    border: 1px solid rgba(255,255,255,0.06);
}

.overlay-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 10px 30px rgba(43,47,51,0.09);
}

.overlay-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(13,110,253,0.12); }

/* Dark theme tweak: set page tokens for easy overrides */
[data-theme="dark"] {
    --page-foreground: #e9ecef;
    --overview-text: rgba(233,236,239,0.95);
}

[data-theme="dark"] .hero-section {
    color: var(--page-foreground);
}

.performance-badge {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-weight: 600;
}

.badge-improved {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
}

.badge-regression {
    background: linear-gradient(45deg, #dc3545, #fd7e14);
    color: white;
}

.badge-stable {
    background: linear-gradient(45deg, #6c757d, #495057);
    color: white;
}

.filter-controls {
    background: var(--panel-bg);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--soft-shadow);
}

.filter-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.encoder-filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

[data-theme="dark"] .filter-controls {
    background: #343a40;
    color: #e9ecef;
}

.encoder-toggle {
    margin: 0;
    transition: all 0.3s ease;
}

.encoder-toggle:hover {
    transform: scale(1.05);
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    /* more visible in light mode: subtle white-to-muted gradient, clear border */
    background: linear-gradient(180deg, #ffffff, #eef4f6);
    border: 1px solid rgba(43,47,51,0.08);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    box-shadow: 0 8px 22px rgba(43,47,51,0.06);
    color: var(--soft-text);
}

[data-theme="dark"] .theme-toggle {
    background: linear-gradient(180deg,#343a40,#2b3136);
    color: #ffdca3;
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 6px 18px rgba(0,0,0,0.6);
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 30px rgba(43,47,51,0.09);
}

.theme-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(13,110,253,0.12), 0 10px 30px rgba(43,47,51,0.09);
}

.benchmark-chart {
    width: 100%;
    height: 520px; /* increased for better readability */
    max-height: 520px;
}

.trend-indicator {
    display: inline-flex;
    align-items: center;
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

.trend-up {
    color: #dc3545;
}

.trend-down {
    color: #198754;
}

.trend-stable {
    color: #6c757d;
}

/* Small sparkline charts inside overview cards */
.overview-sparkline {
    width: 92%;
    height: 68px;
    max-height: 80px;
    display: block;
    margin-top: 0.6rem;
}

@media (max-width: 768px) {
    .hero-section {
        padding: 2rem 0;
    }

    .stats-card {
        margin: 0.5rem 0;
    }

    .chart-container {
        padding: 1rem;
        margin: 0.5rem 0;
    }

    .filter-controls {
        padding: 1rem;
    }

    .section-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .summary-chip {
        width: 100%;
        align-items: center;
    }

    .filter-actions {
        justify-content: flex-start;
    }

    .theme-toggle {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    /* On small screens keep charts reasonable height so they don't dominate the viewport */
    .benchmark-chart {
        height: 300px;
        max-height: 300px;
    }
}

/* Tablet-specific sizing: slightly reduced height for better vertical rhythm on tablets */
@media (min-width: 601px) and (max-width: 1024px) {
    .benchmark-chart {
        height: 360px;
        max-height: 360px;
    }

    .chart-container {
        padding: 0.85rem;
    }
}

.hidden {
    display: none !important;
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Tooltip styles */
.tooltip-inner {
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    max-width: 300px;
}

/* Prototype .NET version overlay styles */
.dotnet-marker {
    position: absolute;
    /* default to letting script decide top/bottom; when not bottom use a small top offset */
    top: auto;
    transform: translateX(-50%);
    pointer-events: none; /* non-interactive in prototype */
    z-index: 15;
    white-space: nowrap;
    will-change: left, bottom;
}
.dotnet-marker:not(.bottom) {
    top: 8px;
}
.dotnet-marker.bottom {
    top: auto; /* ensure top does not interfere when bottom is used */
}
.dotnet-pill {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #fff;
    background: rgba(13,110,253,0.92);
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 6px 20px rgba(2,6,23,0.28);
    text-shadow: 0 1px 0 rgba(0,0,0,0.45);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (prefers-color-scheme: light) {
    .dotnet-pill {
        color: #0d2b66;
        background: rgba(13,110,253,0.07);
        border-color: rgba(13,110,253,0.12);
    }
}

/* Thin vertical line under the pill to indicate exact marker position */
.dotnet-marker::after {
    content: '';
    display: block;
    /* slightly wider and much taller for better visibility */
    width: 4px;
    height: 60px;
    margin: 12px auto 0;
    background: rgba(13,110,253,1);
    border-radius: 3px;
    opacity: 0.98;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.45));
}

/* For bottom-positioned markers we render the vertical line above the pill.
   Use ::before for that and hide ::after when .bottom is present. */
.dotnet-marker::before { content: ''; display: none; }
.dotnet-marker.bottom::before {
    content: '';
    display: block;
    /* slightly wider and much taller so the marker line reaches well into the chart area */
    width: 4px;
    height: 60px;
    margin: 0 auto 12px;
    background: rgba(13,110,253,1);
    border-radius: 3px;
    opacity: 0.98;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.45));
}
.dotnet-marker.bottom::after { display: none; }
