/* QA fixes — loaded last so it wins over extracted Arena CSS */

/* P0: real variable font already swapped in tokens.css; keep a solid fallback stack */
html, body {
  overflow-x: clip;
}

/* P0/P1: frosted header always opaque enough, above charts and scene banners */
.site-chrome {
  z-index: 400;
  isolation: isolate;
  background: rgba(250, 250, 250, 0.94);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
}
html[data-theme="dark"] .site-chrome {
  background: rgba(15, 20, 25, 0.94);
}
.site-chrome .nav {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid rgba(31, 41, 55, 0.06);
}
html[data-theme="dark"] .site-chrome .nav {
  background: rgba(17, 24, 39, 0.88);
  border-bottom-color: rgba(255, 255, 255, 0.06);
}
.site-chrome.is-condensed .nav {
  background: rgba(255, 255, 255, 0.9);
}
html[data-theme="dark"] .site-chrome.is-condensed .nav {
  background: rgba(17, 24, 39, 0.92);
}

/* P1: in-page rail stays under the header, not mid-content */
:where(body:has(.model-index-page)) .model-page-nav {
  top: calc(var(--nav-height, 54px) + 12px);
  z-index: 8;
}
html.chrome-hidden :where(body:has(.model-index-page)) .model-page-nav {
  top: 16px;
}

/* P1: anchor landing — one consistent offset; no 100svh-centered sections */
html {
  scroll-padding-top: 80px;
}
body:has(.model-index-page) .model-section,
body:has(.model-index-page) .model-index-page .model-content-main > .model-section,
body:has(.model-index-page) .leaderboard-section,
body:has(.model-index-page) .compare-section,
body:has(.model-index-page) .analysis-section,
body:has(.model-index-page) .scenario-rankings-section,
body:has(.model-index-page) .method-section,
body:has(.model-index-page) .model-guide-section,
body:has(.model-index-page) .model-content-main > .model-guide-section:first-child {
  min-height: 0 !important;
  height: auto !important;
  justify-content: flex-start;
  align-content: start;
}
@media (min-width: 1181px) {
  body:has(.model-index-page) .model-section,
  body:has(.model-index-page) .leaderboard-section,
  body:has(.model-index-page) .compare-section,
  body:has(.model-index-page) .analysis-section,
  body:has(.model-index-page) .model-content-main > .model-guide-section:first-child {
    min-height: 0 !important;
    height: auto !important;
    padding-block: 48px 56px;
    scroll-margin-top: 80px !important;
    justify-content: flex-start;
    align-content: start;
  }
}
.model-index-page h2[id],
.model-index-page .model-section,
.model-index-page .compare-section,
.model-index-page .leaderboard-section,
.model-index-page .scenario-rankings-section,
.model-index-page .analysis-section,
.model-index-page .method-section,
.model-index-page .model-guide-section,
.model-index-page .section-heading h2,
#compare-title, #weighted-title, #quick-pick-title,
#leaderboard-title, #task-title, #analysis-title, #method-title {
  scroll-margin-top: 80px !important;
}

.analysis-section .efficiency-chart-shell,
.analysis-section .efficiency-chart-stage {
  position: relative;
  z-index: 1;
}

/* P1: scatter labels — hide by default, show winners / hover / JS-kept */
.cost-point-name {
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease;
}
.cost-point.is-label-on .cost-point-name,
.cost-point.is-winner .cost-point-name,
.cost-point.is-baseline .cost-point-name,
.cost-point:hover .cost-point-name,
.cost-point:focus-visible .cost-point-name {
  opacity: 1;
}
.cost-point:hover,
.cost-point:focus-visible,
.cost-point.is-baseline {
  z-index: 6;
}

/* P1: bar chart names — room for the last label, no mid-word glyph wrap */
.ranking-chart-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 8px 10px 0;
}
.model-index-page .ranking-list {
  min-width: 1180px;
  padding-inline-end: 20px;
  box-sizing: content-box;
}
.model-index-page .ranking-pair-prominent .ranking-model strong,
.model-index-page .scenario-live-panel .ranking-model strong,
.model-index-page .ranking-model strong {
  overflow-wrap: normal;
  word-break: normal;
  overflow: visible;
  -webkit-line-clamp: unset;
  line-clamp: unset;
}

/* P0: models square lead should not wrap mid-word like 「模 / 型。」 */
.page-lead,
.sq-head .page-lead {
  max-width: 40em;
  word-break: keep-all;
  line-break: strict;
  overflow-wrap: break-word;
  text-wrap: pretty;
}

/* Preference FLIP: keep end-state clean (brief mid-overlap is ok) */
.model-guide-results [data-rank-row] {
  will-change: auto;
}
