/* NSFWBench page layouts: Board, Leaderboard, Gallery, Arena, Prompts, About, 404.
   Tokens and shared components (header, sidebar, cards, tables, modal, notice) come from theme-v2.css. */

/* ---------- shared ---------- */

.lead { max-width: 68ch; margin-top: 8px; color: var(--text-2); font-size: 15px; line-height: 1.6; }
.example-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 10px; color: var(--muted); font-size: 12.5px; }
.noscript { max-width: 60ch; margin: 40px auto; color: var(--muted); text-align: center; }
.x-title > .btn { flex: none; }
.jump { display: flex; flex-wrap: wrap; gap: 6px; }
.jump a { display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border: 1px solid var(--border-2); border-radius: 999px; color: var(--text-2); font-size: 13px; text-decoration: none; }
.jump a:hover { border-color: var(--muted); color: var(--text); }
.badge-rank.top, .badge.win { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.badge-pending { color: var(--muted); }
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--border-2); border-radius: 5px; color: var(--muted); font: 500 11px/1 var(--mono); }

/* ---------- Board ---------- */

.results.is-table, #b-results.is-table { min-width: 0; }
#b-results .empty { margin-top: 4px; }

/* ---------- Leaderboard ---------- */

.lb-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.lb-controls .grow { flex: 1; }
.lb-controls .search { width: 240px; }
.lb-controls .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.lb-controls .seg::-webkit-scrollbar { display: none; }
.seg .sm { display: none; }
.lb .col-n { width: 74px; }
.lb .col-overall { width: 112px; }
.lb-controls .pop-wrap > .btn .val { max-width: 18ch; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); font-weight: 400; }
.lb-controls .pop-wrap > .btn > svg:last-child { width: 14px; height: 14px; color: var(--muted); }
.pop-labs { width: 360px; }
.pop-labs .tree { max-height: none; }
.lb-chips { margin-top: 12px; }
.lb-chips:empty { display: none; }
.lb-chart { display: grid; gap: 6px; margin: 4px 0 28px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.lb-chart h2 { margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.chart-row { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr) 64px; align-items: center; gap: 12px; font-size: 13px; }
.chart-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-row .name small { margin-left: 6px; color: var(--faint); font-size: 12px; }
.chart-row .bar { height: 8px; border-radius: 4px; }
.chart-row .bar i { border-radius: 4px; }
.chart-row .v { text-align: right; font-variant-numeric: tabular-nums; }
.chart-row .v b { font-weight: 600; }
.chart-row .v small { color: var(--faint); }
.lb .c-model a { color: var(--text); font-weight: 600; font-size: 13.5px; text-decoration: none; }
.lb .c-model a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-2); }
.lb td.t a { display: block; color: inherit; text-decoration: none; border-radius: 4px; }
.lb td.t a:hover { background: var(--surface-2); color: var(--text); }
.lb th button { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: inherit; font: inherit; }
.lb th button:hover, .lb th[aria-sort] button { color: var(--text); }
.lb th button svg { width: 12px; height: 12px; opacity: 0; }
.lb th[aria-sort] button svg { opacity: 1; }
.lb td.t.hi { background: var(--accent-soft); }

/* ---------- Gallery ---------- */

.gal { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tile .embed { cursor: pointer; }
.tile.is-live .tile-cap { opacity: 0; transition: opacity .2s; }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile-actions { position: absolute; top: 6px; right: 6px; z-index: 3; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.tile-actions a { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; background: rgba(12, 14, 15, .78); color: #d7dcdd; }
.tile-actions a:hover { color: #fff; background: rgba(12, 14, 15, .92); }
.tile-actions svg { width: 14px; height: 14px; }
.tile:hover .tile-actions, .tile:focus-within .tile-actions { opacity: 1; }
.tile .tl { position: absolute; top: 6px; left: 6px; z-index: 3; pointer-events: none; }
.tile .tl .badge { background: rgba(12, 14, 15, .78); border-color: rgba(255, 255, 255, .12); color: #c9d0d1; }
@media (hover: none) { .tile-actions { opacity: 1; } }

/* ---------- Arena ---------- */

.arena-page { padding-bottom: 12px; }
.arena-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; padding: 32px 0 18px; }
.arena-title h1 { font: 500 clamp(28px, 3.4vw, 38px)/1.1 var(--serif); font-synthesis: none; letter-spacing: -.01em; }
.arena-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.test-pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border: 1px solid var(--border-2); border-radius: 999px; color: var(--muted); font-size: 13px; }
.test-pill b { color: var(--text); font-weight: 600; }
.arena-stage { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.arena-stage, .vote-bar { max-width: max(640px, calc((100vh - 380px) * 2 + 16px)); margin-left: auto; margin-right: auto; }
.contender { position: relative; min-width: 0; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; transition: border-color .2s, opacity .2s; }
.contender .slot .embed { border-bottom: 1px solid var(--border); }
.contender .bl { position: absolute; left: 10px; bottom: 10px; z-index: 2; pointer-events: none; }
.contender .bl .badge { background: rgba(12, 14, 15, .78); border-color: rgba(255, 255, 255, .14); color: #c9d0d1; }
.contender .side-tag { position: absolute; top: 10px; left: 10px; z-index: 2; background: rgba(12, 14, 15, .78); border-color: rgba(255, 255, 255, .14); color: #d7dcdd; pointer-events: none; }
.contender .result { position: absolute; top: 10px; right: 10px; z-index: 2; pointer-events: none; }
.contender .result.badge-pending { background: rgba(12, 14, 15, .78); border-color: rgba(255, 255, 255, .14); color: #aeb6b8; }
.contender.win { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line); }
.contender.lose { opacity: .72; }
.contender-foot { padding: 12px 14px 14px; }
.who { display: grid; gap: 2px; min-height: 42px; }
.who strong { font-weight: 600; font-size: 15px; }
.who span { color: var(--muted); font-size: 12.5px; }
.hidden-name { display: inline-block; width: 11ch; height: .9em; border-radius: 4px; background: repeating-linear-gradient(90deg, var(--surface-2) 0 6px, var(--track) 6px 12px); vertical-align: -1px; }
.reveal-in { animation: xReveal .35s ease both; }
@keyframes xReveal { from { opacity: 0; transform: translateY(3px); } }
.vote-bar { display: grid; grid-template-columns: 1fr auto auto 1fr; gap: 10px; margin-top: 16px; }
.vote-bar .btn { height: 44px; font-size: 14px; }
.vote-bar kbd { margin: 0 2px; }
.vote-bar .btn-primary kbd { border-color: rgba(128, 128, 128, .4); color: inherit; opacity: .7; }
.vote-bar .btn[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.vote-bar .btn:disabled { cursor: default; opacity: .55; }
.vote-bar .btn[aria-pressed="true"]:disabled { opacity: 1; }
.next-wrap { display: flex; justify-content: center; margin-top: 16px; }
.next-btn { position: relative; overflow: hidden; min-width: 200px; }
.next-btn .fill { position: absolute; inset: 0; transform: scaleX(0); transform-origin: left; background: var(--accent-soft); }
.next-btn.counting .fill { animation: xFill var(--dur, 3500ms) linear forwards; }
.next-btn > span:last-child { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.next-btn svg { width: 16px; height: 16px; }
@keyframes xFill { to { transform: scaleX(1); } }
.arena-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-top: 18px; color: var(--muted); font-size: 12.5px; }
.arena-foot b { color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- Prompts ---------- */

.subject-block { padding-top: 28px; scroll-margin-top: calc(var(--header-h) + 8px); }
.subject-block + .subject-block { margin-top: 12px; border-top: 1px solid var(--border); }
.subject-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-bottom: 14px; }
.subject-head h2 { font: 500 24px/1.2 var(--serif); font-synthesis: none; }
.subject-head p { color: var(--muted); font-size: 13.5px; }
.prompt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.prompt-card { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.prompt-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.prompt-card-head h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-right: auto; font-size: 15px; font-weight: 600; }
.prompt-card-head h3 a { color: var(--muted); font: 400 12px var(--mono); text-decoration: none; }
.prompt-card-head h3 a:hover { color: var(--text); text-decoration: underline; }
.prompt-card-head .runs { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.badge-ver { font-family: var(--mono); }
.prompt-clip { position: relative; max-height: 220px; padding: 14px; overflow: hidden; }
.prompt-clip::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 64px; background: linear-gradient(transparent, var(--surface)); pointer-events: none; }
.prompt-card.open .prompt-clip { max-height: none; }
.prompt-card.open .prompt-clip::after { display: none; }
.prompt-card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; padding: 10px 14px 12px; border-top: 1px solid var(--border); }
.prompt-card-foot .spacer { flex: 1; }

/* ---------- About ---------- */

.about-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 48px; align-items: start; }
.toc { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: 2px; font-size: 13px; }
.toc a { padding: 5px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--text); background: var(--hover); }
.prose { max-width: 760px; min-width: 0; color: var(--text-2); font-size: 15px; line-height: 1.7; }
.prose h2 { margin: 44px 0 12px; color: var(--text); font: 500 26px/1.2 var(--serif); font-synthesis: none; letter-spacing: -.01em; scroll-margin-top: calc(var(--header-h) + 16px); }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: 24px 0 6px; color: var(--text); font-size: 15.5px; font-weight: 600; }
.prose p + p { margin-top: 12px; }
.prose ul, .prose ol { margin: 12px 0; padding-left: 20px; }
.prose li + li { margin-top: 6px; }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { color: var(--text); text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose code { color: var(--text); font: 13px var(--mono); }
.table-wrap { margin: 14px 0; border: 1px solid var(--border); border-radius: var(--r-lg); overflow-x: auto; background: var(--surface); }
.test-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.test-table th, .test-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.test-table thead th { background: var(--bg-2); color: var(--muted); font-size: 12.5px; font-weight: 500; }
.test-table tbody tr:last-child > * { border-bottom: 0; }
.test-table tbody th { color: var(--text); font-weight: 600; }
.test-table a { text-decoration: none; color: var(--text-2); }
.test-table a:hover { color: var(--accent); }
.axis-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
.axis-card { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); font-size: 13.5px; line-height: 1.55; }
.axis-card .top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.axis-card .top h3 { margin: 0; }
.axis-card .pts { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.anchors { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 6px 10px; margin: 12px 0 0; }
.anchors dt { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.anchors dd { margin: 0; color: var(--muted); }
.formula { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 18px; margin: 14px 0; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.formula dt { color: var(--text); font-weight: 600; font-size: 14px; }
.formula dd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin: 0; font-size: 14px; }
.formula dd span { color: var(--faint); font-size: 12.5px; }
.callout { margin: 14px 0; padding: 14px 16px; border-left: 2px solid var(--accent); border-radius: 0 var(--r) var(--r) 0; background: var(--accent-soft); }
.cite { margin: 14px 0 10px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.cite-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.cite pre { margin: 0; padding: 14px; overflow-x: auto; color: var(--text-2); font: 12.5px/1.6 var(--mono); }
.cite-plain { color: var(--muted); font-size: 13.5px; }
.changelog { list-style: none; padding: 0 !important; }
.changelog li { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 4px 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.changelog li + li { margin-top: 0; }
.changelog time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.changelog .tag { justify-self: start; grid-column: 2; padding: 1px 7px; border: 1px solid var(--border-2); border-radius: 5px; color: var(--muted); font-size: 12px; }
.changelog p { grid-column: 2; margin: 0; font-size: 14px; }

/* ---------- 404 ---------- */

.not-found { max-width: 520px; margin: 12vh auto 0; }
.not-found .actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .about-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc { position: static; display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 28px; }
  .toc a { padding: 0 11px; height: 28px; display: inline-flex; align-items: center; border: 1px solid var(--border-2); border-radius: 999px; }
}
@media (max-width: 900px) {
  .prompt-grid { grid-template-columns: minmax(0, 1fr); }
  .chart-row { grid-template-columns: minmax(0, 140px) minmax(0, 1fr) 56px; }
}
@media (max-width: 640px) {
  .sort-label > span { display: none; }
  .results-bar .tools { margin-left: 0; flex: 1; justify-content: flex-end; }
  .results-bar .tools .select { max-width: 140px; }
  .seg .lg { display: none; }
  .seg .sm { display: inline; }
  .lb-controls .search { width: 100%; }
  .lb .col-n { width: 56px; }
  .lb .col-overall { width: 84px; }
  .lb-controls .grow { display: none; }
  .lb-controls .pop-wrap { flex: 1; }
  .lb-controls .pop-wrap > .btn { width: 100%; justify-content: space-between; }
  .lb-chart { padding: 14px; }
  .chart-row { grid-template-columns: minmax(0, 1fr) 48px; gap: 4px 10px; }
  .chart-row .bar { grid-column: 1 / -1; grid-row: 2; }
  .arena-top { padding-top: 22px; }
  .arena-stage { gap: 8px; }
  .contender-foot { padding: 10px; }
  .who strong { font-size: 13.5px; }
  .who span { font-size: 11.5px; }
  .contender .side-tag { top: 6px; left: 6px; }
  .contender .result { top: 6px; right: 6px; }
  .vote-bar { grid-template-columns: 1fr 1fr; }
  .vote-bar .v-left { order: 1; }
  .vote-bar .v-right { order: 2; }
  .vote-bar .v-tie { order: 3; }
  .vote-bar .v-bad { order: 4; }
  .vote-bar kbd, .keys-hint { display: none; }
  .axis-cards { grid-template-columns: minmax(0, 1fr); }
  .formula { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .formula dd + dt { margin-top: 10px; }
  .changelog li { grid-template-columns: minmax(0, 1fr); }
  .changelog .tag, .changelog p { grid-column: 1; }
  .prose { font-size: 14.5px; }
  .prose h2 { font-size: 23px; }
}
@media (max-width: 400px) {
  .view-seg button { padding: 0 8px; }
  .view-seg button svg { display: none; }
}
