/* General Body Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    /* color: #333; */
    background-color: #f5f5f5;
    margin: 0;
    padding: 20px;
}

/* Page Header */
h1 {
    text-align: center;
    color: #2c3e50;
    font-size: 2.5em;
    margin-bottom: 30px;
}

.toggle-container {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #2c3e50;
    font-weight: bold;
}

.view-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-slider {
    position: relative;
    width: 48px;
    height: 26px;
    background-color: #dcdcdc;
    border-radius: 13px;
    transition: background-color 0.2s ease;
    box-shadow: inset 0 0 0 1px #c4c4c4;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background-color: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

.view-toggle input:checked + .toggle-slider {
    background-color: #b0b0b0;
}

.view-toggle input:checked + .toggle-slider::after {
    transform: translateX(22px);
}

/* Navigation Buttons Container */
.competition-navigation {
    text-align: center;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.competition-set-buttons,
.competition-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.competition-select {
    display: none;
    margin-top: 8px;
}

.competition-select select {
    min-width: 260px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #cfcfcf;
    background: #ffffff;
    font-size: 0.95rem;
    box-sizing: border-box;
    width: min(360px, 100%);
}

.competition-select select option {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.table-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    margin: 6px 0 4px;
    font-size: 0.9em;
    color: #2c3e50;
}

.table-filters--view-toggle {
    justify-content: flex-end;
}

.table-filters-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.table-filters label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.table-filters select {
    min-width: 140px;
    padding: 4px 6px;
    border: 1px solid #cfcfcf;
    border-radius: 4px;
    background: #fff;
    font-size: 0.9em;
}

.param-filter .param-range {
    display: flex;
    align-items: center;
    gap: 6px;
}

.param-filter input[type="number"] {
    width: 90px;
    padding: 6px 8px;
    border: 1px solid #cfcfcf;
    border-radius: 4px;
    background: #fff;
    font-size: 0.95em;
}

.table-view-toggle {
    display: flex;
    align-items: center;
    margin-left: 0;
}

.problem.selected-trace {
    outline: 3px solid #276dff;
    outline-offset: -3px;
}

.trace-viewer {
    margin: 16px auto 0;
    max-width: 1100px;
}

.table-helper-note {
    margin: 10px 0 8px;
    color: #276dff;
    font-weight: 700;
    text-align: center;
}

.models-helper-note__mobile {
    display: none;
}

.models-page__table-scroll {
    max-height: none !important;
}

.trace-card {
    max-height: none !important;
}

.trace-header {
    align-items: center;
    margin-bottom: 8px;
}

.trace-title {
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    color: #276dff;
}

.trace-subtitle {
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    color: #4a4a4a;
    margin-top: 4px;
}

.trace-tabs .tab button {
    border-bottom: 4px solid transparent;
}

.trace-meta {
    margin-bottom: 10px;
    font-weight: bold;
}

.trace-meta-box {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 6px;
    color: #fff;
    font-weight: 700;
    margin-bottom: 10px;
}

.trace-meta-box.grade-high { background-color: #2ecc71; }
.trace-meta-box.grade-mid { background-color: #f1c40f; color: #2c3e50; }
.trace-meta-box.grade-low { background-color: #e74c3c; }

.trace-section-title {
    font-weight: 700;
    margin-bottom: 4px;
}

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

.trace-detail {
    margin-bottom: 12px;
}

.trace-detail-title {
    font-weight: bold;
    margin-bottom: 0px;
}
.trace-detail-desc {
    margin-bottom: 6px;
}

.trace-toggle {
    margin-top: 10px;
}

.trace-toggle summary {
    font-weight: bold;
    cursor: pointer;
    color: #1f3d7a;
    margin-bottom: 6px;
}

.trace-messages .box {
    margin-top: 8px;
    max-width: 100%;
    box-sizing: border-box;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.box-message-header {
    margin-bottom: 6px;
}

/* General Button Styles */
.button {
    border: 1px solid #cfcfcf;
    background-color: #e6e6e6;
    color: #2c3e50;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    box-shadow: none;
}

.button:hover {
    background-color: #dcdcdc;
    border-color: #c4c4c4;
}

.competition-set-button,
.competition-button {
    font-weight: bold;
}

.competition-button {
    font-weight: 500;
    font-size: 0.9rem;
    padding: 3px 8px;
}

.competition-set-button.is-deprecated,
.competition-button.is-deprecated {
    opacity: 0.58;
}

.competition-set-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.competition-set-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.competition-set-button.is-active,
.competition-button.is-active {
    background-color: #ffffff;
    border-color: #b0b0b0;
    font-weight: 700;
}

.competition-set-button.is-deprecated.is-active,
.competition-button.is-deprecated.is-active {
    opacity: 0.78;
}

/* Table Container */
.table-container {
    background-color: white;
    border-radius: 6px;
    border: 1px solid #ddd;
    margin-top: 20px;
}

/* Table Styles */
table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 6px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.metric-bar-cell {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    white-space: nowrap;
}

.metric-bar-cell::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 5px;
    bottom: 5px;
    width: var(--bar-width, 0%);
    max-width: calc(100% - 12px);
    border-radius: 4px;
    background: var(--metric-bar-color, rgba(39, 109, 255, 0.16));
    z-index: 0;
    pointer-events: none;
}

.metric-bar-cell--cost {
    --metric-bar-color: rgba(214, 158, 46, 0.24);
}

.metric-bar-cell--accuracy {
    --metric-bar-color: rgba(56, 161, 105, 0.22);
}

.metric-bar-cell--tokens {
    --metric-bar-color: rgba(39, 109, 255, 0.16);
}

.metric-bar-value {
    position: relative;
    z-index: 1;
}

.invalid-usage {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: #b42318;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    cursor: help;
}

.invalid-usage__icon {
    color: #d92d20;
    font-size: 0.95em;
}

.invalid-usage:focus-visible {
    outline: 2px solid #d92d20;
    outline-offset: 2px;
    border-radius: 3px;
}

.problem {
    position: relative;
    cursor: pointer;
    transition: outline 0.15s ease;
}

.col-problem {
    max-width: 100px;
    width: 100px;
}

.col-problem-head {
    text-align: right !important;
}

.problem:hover {
    outline: 1px solid #276dff;
    outline-offset: -1px;
}

.hover-highlight {
    color: #276dff !important;
}

/* Table Header */
thead th {
    background-color: #ecf0f1;
    color: #2c3e50;
    font-weight: bold;
}

.problem-head {
    text-align: center !important;
    width: 35px;
    max-width: 35px;
    font-size: 0.8em;
    padding-left: 0px;
    padding-right: 0px;
    padding-top: 8px;
}

.overall-problem-table .problem-head {
    width: 130px;
    max-width: 130px;
}

.problem-overall-score {
    text-align: center !important;
}

/* Table Body */
tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

tbody tr:hover {
    background-color: #f1f1f1;
}

.simple-data-table tbody tr,
.simple-data-table tbody tr:nth-child(even),
.simple-data-table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

.simple-data-table tbody tr:hover {
    background-color: #f7f9fc;
}

.competition-tables,
.competition-table-wrapper {
    display: none;
}

.competition-tables.is-active,
.competition-table-wrapper.is-active {
    display: block;
}

.table-scroll {
    max-width: 1200px;
    max-height: 500px;
    overflow: auto;
    margin: 0 auto;
    position: relative;
}

.mobile-leaderboard-view {
    display: none;
    max-width: 720px;
    margin: 0 auto;
}

.mobile-leaderboard-list {
    display: grid;
    gap: 12px;
}

.mobile-model-card {
    position: relative;
    border: 1px solid #d7e2ef;
    border-radius: 14px;
    padding: 10px 12px;
    background: #ffffff;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.mobile-model-card[role="button"] {
    cursor: pointer;
}

.mobile-model-card[role="button"]::after {
    content: "▾";
    position: absolute;
    top: 10px;
    right: 12px;
    color: #8a97a8;
    font-size: 0.8rem;
    line-height: 1;
    transition: transform 0.18s ease;
}

.mobile-model-card.is-expanded {
    border-color: #c4d3e7;
}

.mobile-model-card.is-expanded::after {
    transform: rotate(180deg);
}

.mobile-model-card__name {
    margin: 0 0 0.35rem;
    padding-right: 1rem;
    font-size: 1rem;
    line-height: 1.35;
    color: #0f243e;
}

.mobile-model-card__name a {
    color: inherit;
    text-decoration: none;
}

.mobile-model-card__name a:hover {
    text-decoration: underline;
}

.mobile-model-card__rank-inline {
    margin-left: 0.45rem;
    color: #7b8798;
    font-size: 0.9rem;
    font-weight: 600;
}

.mobile-model-card__stats {
    display: grid;
    gap: 0.45rem;
}

.mobile-model-card__details {
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px solid #edf2f7;
    min-width: 0;
}

.mobile-model-card__stat {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    min-width: 0;
}

.mobile-model-card__accuracy {
    display: grid;
    gap: 0.25rem;
}

.mobile-model-card__accuracy-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.mobile-model-card__accuracy-track {
    width: 100%;
    height: 0.38rem;
    border-radius: 999px;
    background: #e4ebf3;
    overflow: hidden;
}

.mobile-model-card__accuracy-fill {
    height: 100%;
    border-radius: inherit;
    background: #0a4aa7;
}

.mobile-problem-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.mobile-problem-chip {
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.24rem 0.58rem;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
    background: #f2f5f9;
    color: #334155;
}

.mobile-problem-chip--green {
    background: #e6f7ee;
    color: #12603c;
}

.mobile-problem-chip--yellow {
    background: #fff5d6;
    color: #8a6414;
}

.mobile-problem-chip--orange {
    background: #ffe8d9;
    color: #9a4c11;
}

.mobile-problem-chip--red {
    background: #fde7e7;
    color: #9a2d2d;
}

.mobile-problem-chip--gray {
    background: #eef2f7;
    color: #607080;
}

.mobile-problem-chip.is-selected {
    border-color: #0a4aa7;
    box-shadow: inset 0 0 0 1px #0a4aa7;
}

.mobile-problem-chip:disabled {
    opacity: 0.72;
    cursor: default;
}

.mobile-model-card__trace {
    margin-top: 0.7rem;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.mobile-model-card__trace .trace-viewer-inner {
    max-width: 100%;
    min-width: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-sizing: border-box;
}

.mobile-model-card__trace .trace-title {
    font-size: 1.15rem;
    text-align: left;
}

.mobile-model-card__trace .trace-subtitle {
    text-align: left;
}

.mobile-model-card__trace .box {
    margin-bottom: 0.75rem;
    max-width: 100%;
    box-sizing: border-box;
}

.mobile-model-card__trace .tab {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
}

.mobile-model-card__trace .tab button {
    float: none;
    display: inline-block;
    white-space: nowrap;
}

.mobile-model-card__trace .tabcontent,
.mobile-model-card__trace .tabcontentjudges {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: hidden;
}

.mobile-trace-loading {
    padding: 0.8rem 0;
    color: #526173;
    font-weight: 600;
}

.mobile-model-card__stat-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #59708f;
}

.mobile-model-card__stat-value {
    font-size: 0.92rem;
    font-weight: 700;
    color: #102033;
}

.mobile-model-card__stat-value.is-predicted {
    color: #b45f5f;
}

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

.right-row {
    text-align: right !important;
}

.left-row {
    text-align: left !important;
}

.model-name {
    min-width: 200px;
}

.model-name .model-link {
    color: inherit;
    text-decoration: none;
}

.model-name .model-link:hover {
    text-decoration: underline;
}

.problem-table .model-head,
.problem-table .model-name {
    position: sticky;
    left: 0;
    z-index: 3;
}

.problem-table .model-head {
    z-index: 4;
    background-color: #ecf0f1;
}

.problem-table .model-name {
    background-color: #ffffff;
    box-shadow: 2px 0 0 #ddd;
}

.problem-table tbody tr:nth-child(even) .model-name {
    background-color: #f9f9f9;
}

.problem-table tbody tr:hover .model-name {
    background-color: #f1f1f1;
}

/* Score colors */
.score-green { background-color: rgba(0, 255, 0, 0.15); }
.score-yellow { background-color: rgba(255, 255, 0, 0.15); }
.score-orange { background-color: rgba(255, 125, 0, 0.15); }
.score-red { background-color: rgba(255, 0, 0, 0.15); }
.score-gray { background-color: rgba(255, 255, 255, 0.15); }
.predicted-problem-cell { background-color: rgba(220, 38, 38, 0.18); }
.predicted-overall-score { color: #b45f5f; font-weight: 700; }
.predicted-accuracy-cell { color: #b45f5f; font-weight: 700; }
.predicted-score-text { color: #b45f5f; font-weight: 700; }
.problem-disabled {
    cursor: default;
}
.problem-disabled:hover {
    transform: none;
}

.problem-difficulty {
    font-size: 0.7rem;
    font-weight: 400;
    text-align: center;
}

.problem-head-extra-width {
    width: 40px;
    max-width: 40px;
}

.problem-easy {
  color: #38a169;
  /* Green for easy */
}

.problem-medium {
  color: #d69e2e;
  /* Yellow for medium */
}

.problem-hard {
  color: #e53e3e;
  /* Red for hard */
}

.score-inline {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    min-width: 4ch;
}

.score-badges {
    position: absolute;
    left: 0;
    transform: translateX(-100%);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.score-value {
    display: inline-block;
    text-align: center;
    min-width: 3.5ch;
}

.medal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
}

.contamination-warning {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
}

.alpha-warning {
    opacity: 0.5;
    font-size: 0.8em;
}

.help-title {
    cursor: help;
}

.predicted-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.predicted-tooltip__trigger {
    display: inline-flex;
    align-items: center;
    cursor: help;
}

.predicted-tooltip__trigger:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
    border-radius: 4px;
}

.predicted-tooltip__bubble {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%) translateY(4px);
    z-index: 30;
    width: min(320px, calc(100vw - 2rem));
    padding: 10px 12px;
    border-radius: 10px;
    background: #1f2937;
    color: #f9fafb;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.24);
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.45;
    text-align: left;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

.predicted-tooltip__bubble::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #1f2937 transparent transparent transparent;
}

.predicted-tooltip:hover .predicted-tooltip__bubble,
.predicted-tooltip:focus-within .predicted-tooltip__bubble {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.predicted-tooltip__bubble a {
    color: #bfdbfe;
    text-decoration: underline;
}

.predicted-tooltip__bubble a:hover,
.predicted-tooltip__bubble a:focus-visible {
    color: #ffffff;
}

@media (max-width: 768px) {
    .table-filters,
    .competition-set-buttons,
    .competition-buttons {
        display: none !important;
    }

    .competition-select {
        display: block;
        width: 100%;
    }

    .competition-select select {
        width: 100%;
        max-width: 360px;
        margin: 0 auto;
    }

    .table-scroll {
        display: none !important;
    }

    .mobile-leaderboard-view {
        display: block !important;
    }

    .table-helper-note {
        display: none !important;
    }

    .predicted-tooltip__bubble {
        display: none !important;
    }

    .models-helper-note {
        display: block !important;
    }

    .models-helper-note__desktop {
        display: none;
    }

    .models-helper-note__mobile {
        display: inline;
    }
}
