/* === Speech Arena — light AA-style theme === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* Palette lifted from the AA page tokens (hsl) */
    --background: hsl(0 0% 100%);
    --foreground: hsl(0 0% 0%);
    --muted: hsl(220 9% 46%);
    --panel: hsl(220 10% 95%);          /* AA brand-blue-light */
    --border: hsl(220 13% 88%);
    --brand: hsl(262.46 97.91% 62.55%); /* AA brand-purple */
    --brand-blue: hsl(261.54 98.2% 54.9%);
    --brand-soft: hsl(262 100% 97%);
    --success: hsl(150 65% 35%);
    --danger: hsl(0 70% 48%);
    --radius: 10px;
    --radius-sm: 8px;
    --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
    /* AA arena nav */
    --brand-yellow: hsl(50 100% 57%);
    --brand-yellow-hover: hsl(50 100% 50%);
    --nav-bg: hsl(220 40% 97%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--foreground);
    line-height: 1.5;
    min-height: 100vh;
}

/* === Header === */
#header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 24px 32px 8px;
    max-width: 1100px;
    margin: 0 auto;
}
.title-block { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
#header h1 { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }
.title-sub { font-size: 16px; color: var(--foreground); }
.subtitle { color: var(--muted); font-size: 14px; margin-top: 2px; }

#header-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}
.instructions { color: var(--muted); font-size: 13px; max-width: 560px; }
.instructions-title { margin-bottom: 2px; }
.instructions ul { list-style: disc; padding-left: 18px; }
.instructions li { margin: 1px 0; }

.progress-pill {
    background: var(--brand-soft);
    border: 1px solid var(--brand);
    color: var(--brand-blue);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    white-space: nowrap;
}

/* === Tabs === */
#tabs {
    display: flex;
    gap: 4px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 32px;
    border-bottom: 1px solid var(--border);
}
.tab-btn {
    background: none;
    border: none;
    color: var(--muted);
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: var(--foreground); }
.tab-btn.active { color: var(--brand-blue); border-bottom-color: var(--brand); }

/* === Tab Content === */
.tab-content { display: none; padding: 24px 32px 60px; max-width: 1100px; margin: 0 auto; }
.tab-content.active { display: block; }

/* === Buttons === */
.btn {
    padding: 8px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-blue); }
.btn-sm {
    padding: 5px 12px;
    font-size: 13px;
    background: var(--background);
    color: var(--foreground);
    border: 1px solid var(--border);
}
.btn-sm:hover { background: var(--panel); }
.btn-link {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 13px;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.btn-link:hover { color: var(--foreground); }

kbd {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 11px;
    color: var(--muted);
}

/* === Arena: voting section (AA-style) === */
.section-heading {
    font-size: 17px;
    font-weight: 500;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 22px;
}
.shortcuts-heading { margin-top: 36px; font-size: 15px; }

.prompt-panel {
    background: var(--panel);
    border-radius: var(--radius);
    padding: 18px 22px;
    margin-bottom: 22px;
    font-size: 15px;
    line-height: 1.6;
}
.prompt-label { margin-right: 4px; }
.prompt-text { color: var(--foreground); }
.category-badge {
    display: inline-block;
    background: var(--panel);
    border-radius: 4px;
    padding: 1px 8px;
    font-size: 12px;
    color: var(--muted);
    margin-left: 8px;
    white-space: nowrap;
}

.models-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 22px;
}
.sample-card {
    background: var(--panel);
    border-radius: var(--radius);
    padding: 20px 20px 12px;
    min-height: 122px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
}
.sample-top { display: flex; align-items: center; gap: 14px; }
.sample-label {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sample-card audio { width: 100%; height: 40px; }
.sample-hint {
    text-align: right;
    font-size: 12px;
    color: var(--muted);
    min-height: 16px;
}

/* === Keyboard shortcuts === */
.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px 24px;
    font-size: 14px;
    color: var(--foreground);
}
.shortcuts-grid kbd { margin-right: 6px; min-width: 24px; text-align: center; display: inline-block; }
.vote-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.vote-btn {
    background: var(--background);
    border: 1px solid var(--border);
    color: var(--foreground);
    padding: 12px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.vote-btn:hover:not(:disabled) {
    border-color: var(--brand);
    background: var(--brand-soft);
    box-shadow: 0 0 0 1px var(--brand);
}
.vote-btn:disabled { opacity: 0.45; cursor: not-allowed; }

#vote-status { margin-top: 14px; text-align: center; font-size: 14px; min-height: 22px; }
.skip-row { text-align: center; margin-top: 4px; }

.keyboard-hint {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    margin-top: 16px;
}

/* === VoiceArena-style feedback voting (/voicearena100 only) === */
.voicearena-page {
    --va-bg: #fbfaf6;
    --va-card: #fffefa;
    --va-muted: #606879;
    --va-primary: #28338f;
    --va-border: #d8cbb7;
    --va-soft: #f6f3ec;
    --va-accent: #2c3493;
    --va-disabled: #a2a6d2;
    background: var(--va-bg);
}

.voicearena-page #header {
    max-width: 1180px;
}

.voicearena-page #header h1,
.voicearena-page .title-sub,
.voicearena-page .va-arena-card h2,
.voicearena-page .va-sample-card h3,
.voicearena-page .va-vote-section h3 {
    font-family: Georgia, 'Times New Roman', serif;
    letter-spacing: 0;
}

.voicearena-page .tab-content {
    max-width: 1180px;
}

.va-arena-card {
    background: var(--va-card);
    border: 1px solid var(--va-border);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(40, 35, 22, 0.04);
    padding: 22px;
}

.va-arena-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.va-arena-head h2 {
    color: var(--va-primary);
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 3px;
}

.va-arena-head p {
    color: var(--va-muted);
    font-size: 14px;
}

.va-prompt-panel {
    border: 1px solid var(--va-border);
    border-radius: 12px;
    background: var(--va-soft);
    padding: 15px 18px;
    margin-bottom: 22px;
}

.va-prompt-panel .prompt-text {
    display: block;
    color: #1c202b;
    font-size: 18px;
    line-height: 1.55;
}

.va-samples-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.va-sample-card {
    background: var(--va-card);
    border: 1px solid var(--va-border);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(40, 35, 22, 0.06);
    padding: 18px 20px 20px;
    min-width: 0;
}

.va-sample-card h3 {
    color: var(--va-primary);
    font-size: 19px;
    font-weight: 700;
    margin: 0 0 14px;
}

.va-player {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--va-border);
    border-radius: 999px;
    background: var(--va-soft);
    padding: 8px 10px;
}

.va-hidden-audio {
    display: none;
}

.va-play-btn {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: #171b25;
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

.va-play-btn:hover {
    background: #252a38;
}

.va-play-btn:focus-visible {
    outline: 2px solid var(--va-accent);
    outline-offset: 2px;
}

.va-play-icon {
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 12px solid currentColor;
    margin-left: 3px;
}

.va-play-btn.is-playing .va-play-icon {
    width: 12px;
    height: 16px;
    border: 0;
    margin-left: 0;
    background:
        linear-gradient(currentColor, currentColor) left center / 4px 16px no-repeat,
        linear-gradient(currentColor, currentColor) right center / 4px 16px no-repeat;
}

.va-waveform {
    height: 40px;
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 3px;
    overflow: hidden;
    cursor: pointer;
}

.va-waveform span {
    flex: 1 1 2px;
    min-width: 2px;
    border-radius: 999px;
    background: rgba(91, 98, 114, 0.36);
    transition: background 0.12s;
}

.va-waveform span.is-played {
    background: var(--va-accent);
}

.va-time-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    min-height: 26px;
    margin: 5px 2px 12px;
    color: var(--va-muted);
    font-size: 18px;
}

.va-time-row .sample-hint {
    min-height: auto;
    font-size: 12px;
    text-align: right;
    align-self: center;
}

.va-feedback-block {
    margin-top: 8px;
}

.va-feedback-block p,
.va-comment-label {
    display: block;
    color: var(--va-muted);
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 8px;
}

.va-comment-label {
    margin-top: 14px;
}

.va-comment-label span {
    color: #8b92a1;
}

.va-issue-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px;
}

.va-issue-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    border: 1px solid var(--va-border);
    border-radius: 10px;
    background: var(--va-card);
    padding: 7px 10px;
    color: #1c202b;
    font-size: 14px;
    line-height: 1.05;
    cursor: pointer;
}

.va-issue-chip:hover {
    background: var(--va-soft);
}

.va-issue-chip input {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid var(--va-accent);
    border-radius: 50%;
    background: transparent;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    cursor: pointer;
}

.va-issue-chip input::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transform: scale(0);
    transition: transform 0.12s;
    background: #fff;
}

.va-issue-chip input:checked {
    background: var(--va-accent);
}

.va-issue-chip input:checked::after {
    transform: scale(1);
}

.va-comment {
    width: 100%;
    min-height: 70px;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--va-soft);
    color: #1c202b;
    padding: 10px 12px;
    font: inherit;
    font-size: 14px;
}

.va-comment:focus {
    outline: 2px solid rgba(44, 52, 147, 0.22);
    border-color: var(--va-accent);
}

.va-vote-section {
    margin-top: 26px;
}

.va-vote-section h3 {
    color: var(--va-primary);
    font-size: 20px;
    margin: 0 0 14px;
}

.va-vote-grid {
    grid-template-columns: repeat(4, 1fr);
}

.va-vote-choice {
    border-color: var(--va-border);
    border-radius: 12px;
    background: var(--va-card);
    font-size: 16px;
    padding: 12px 10px;
}

.va-vote-choice.is-selected {
    border-color: var(--va-accent);
    background: rgba(44, 52, 147, 0.08);
    color: var(--va-accent);
    box-shadow: 0 0 0 1px var(--va-accent);
}

.va-submit-row {
    display: flex;
    justify-content: flex-end;
    padding-top: 14px;
}

.va-submit-row .btn-primary {
    min-width: 150px;
    border-radius: 11px;
    background: var(--va-accent);
    font-size: 16px;
    padding: 10px 22px;
}

.va-submit-row .btn-primary:disabled {
    background: var(--va-disabled);
    cursor: not-allowed;
}

/* === VoiceArena QA review tab === */
.vaq-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.vaq-head h2 {
    color: var(--va-primary);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 28px;
    line-height: 1.2;
    margin: 0 0 4px;
    letter-spacing: 0;
}

.vaq-head p {
    color: var(--va-muted);
    font-size: 14px;
}

.vaq-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.vaq-stat {
    border: 1px solid var(--va-border);
    border-radius: 10px;
    background: var(--va-card);
    padding: 13px 14px;
    min-width: 0;
}

.vaq-stat-label,
.vaq-stat-note,
.vaq-meta,
.vaq-subtitle,
.vaq-box-label,
.vaq-comments-label,
.vaq-page-info {
    color: var(--va-muted);
}

.vaq-stat-label,
.vaq-box-label,
.vaq-comments-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.vaq-stat strong {
    display: block;
    color: #1c202b;
    font-size: 24px;
    font-weight: 750;
    line-height: 1.15;
    margin: 5px 0 2px;
    font-variant-numeric: tabular-nums;
}

.vaq-stat-note {
    display: block;
    font-size: 12px;
}

.vaq-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border: 1px solid var(--va-border);
    border-radius: 10px;
    background: var(--va-soft);
    padding: 10px 12px;
    margin-bottom: 18px;
}

.vaq-controls label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--va-muted);
    font-size: 13px;
    font-weight: 600;
}

.vaq-controls select {
    max-width: min(280px, 70vw);
    border: 1px solid var(--va-border);
    border-radius: 8px;
    background: var(--va-card);
    color: #1c202b;
    font: inherit;
    font-size: 13px;
    padding: 5px 8px;
}

.segmented {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    border: 1px solid var(--va-border);
    border-radius: 9px;
    background: var(--va-card);
    padding: 2px;
}

.seg-btn {
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--va-muted);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    padding: 5px 10px;
}

.seg-btn.selected {
    background: #1c202b;
    color: #fff;
}

.vaq-rows {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.vaq-row {
    border: 1px solid var(--va-border);
    border-radius: 12px;
    background: var(--va-card);
    box-shadow: 0 1px 2px rgba(40, 35, 22, 0.04);
    padding: 16px 18px;
}

.vaq-row-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 3px;
}

.vaq-title-wrap {
    min-width: 0;
}

.vaq-title-wrap h3 {
    color: #1c202b;
    font-size: 17px;
    line-height: 1.25;
    margin: 0;
    overflow-wrap: anywhere;
}

.vaq-subtitle {
    display: block;
    font-size: 12px;
    margin-top: 2px;
    overflow-wrap: anywhere;
}

.vaq-rate {
    border: 1px solid var(--border);
    border-radius: 999px;
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 750;
    padding: 4px 9px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.vaq-rate.is-high {
    background: hsl(0 80% 95%);
    border-color: hsl(0 70% 82%);
    color: var(--danger);
}

.vaq-rate.is-mid {
    background: hsl(38 92% 94%);
    border-color: hsl(38 80% 78%);
    color: hsl(30 90% 35%);
}

.vaq-rate.is-low {
    background: hsl(150 55% 94%);
    border-color: hsl(150 45% 78%);
    color: hsl(150 60% 28%);
}

.vaq-meta {
    font-size: 12px;
    margin-bottom: 9px;
}

.vaq-text {
    color: #1c202b;
    font-size: 14px;
    line-height: 1.55;
    margin-bottom: 12px;
}

.vaq-normalized {
    border: 1px solid var(--va-border);
    border-radius: 10px;
    background: hsl(220 18% 98%);
    margin: 0 0 12px;
    padding: 10px 12px;
}

.vaq-normalized-text {
    color: #1c202b;
    font: inherit;
    font-size: 13px;
    line-height: 1.5;
    margin: 5px 0 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.vaq-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.vaq-tag,
.vaq-no-tags {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 650;
    padding: 3px 8px;
}

.vaq-tag {
    border: 1px solid var(--brand);
    background: var(--brand-soft);
    color: var(--brand-blue);
}

.vaq-no-tags {
    border: 1px solid var(--va-border);
    background: var(--va-soft);
    color: var(--va-muted);
}

.vaq-detail-grid {
    display: grid;
    grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1.2fr);
    gap: 12px;
    margin: 8px 0 12px;
}

.vaq-detail-box {
    border: 1px solid var(--va-border);
    border-radius: 10px;
    background: var(--va-soft);
    padding: 10px 12px;
    min-width: 0;
}

.vaq-pref {
    color: #1c202b;
    font-size: 13px;
    font-weight: 650;
    margin-top: 4px;
}

.vaq-audio {
    display: block;
    width: 100%;
    min-width: 0;
    height: 34px;
    margin-top: 5px;
    accent-color: var(--va-accent);
}

.vaq-missing-audio {
    color: var(--va-muted);
    font-size: 13px;
    margin-top: 5px;
}

.vaq-comments-label {
    margin: 8px 0 7px;
}

.vaq-comments {
    display: flex;
    flex-direction: column;
    gap: 7px;
    list-style: none;
}

.vaq-comment {
    border-left: 3px solid var(--brand);
    border-radius: 0 8px 8px 0;
    background: hsl(220 18% 98%);
    color: #1c202b;
    font-size: 13.5px;
    line-height: 1.45;
    padding: 8px 10px;
}

.vaq-comment small {
    display: block;
    color: var(--va-muted);
    font-size: 11px;
    margin-top: 3px;
}

.vaq-error,
.vaq-empty {
    border: 1px solid var(--va-border);
    border-radius: 10px;
    background: var(--va-card);
    color: var(--va-muted);
    padding: 16px;
}

.vaq-error {
    color: var(--danger);
    margin-bottom: 14px;
}

.vaq-pager {
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.vaq-pager .btn-sm[disabled] {
    opacity: 0.45;
    cursor: default;
}

/* === Completion screen === */
.completion-card {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 48px 40px;
    max-width: 480px;
    margin: 40px auto;
    text-align: center;
}
.completion-card h2 { margin-bottom: 10px; }
.completion-card p { color: var(--muted); margin-bottom: 12px; }
.completion-card code {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--brand-blue);
}
.completion-card .btn { margin-top: 12px; text-decoration: none; display: inline-block; }

/* === Tables (leaderboard + metrics) === */
.vote-badge { color: var(--muted); font-size: 13px; margin-bottom: 12px; }

.lb-controls {
    display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
    margin-bottom: 12px; padding: 10px 14px; font-size: 13px;
    background: hsl(220 14% 97%); border: 1px solid hsl(220 13% 90%); border-radius: 8px;
}
.lb-controls label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.lb-controls input[type="checkbox"] { cursor: pointer; }
.lb-controls .lb-hint { color: var(--muted); font-size: 12px; }
.lb-recompute {
    border: 1px solid hsl(220 13% 80%); background: #fff; border-radius: 6px;
    padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.lb-recompute:hover:not(:disabled) { background: hsl(220 14% 95%); }
.lb-recompute:disabled { opacity: 0.6; cursor: default; }
.lb-auto { color: var(--muted); font-size: 12px; }
.lb-updated { color: var(--muted); font-size: 12px; margin-left: auto; }

.lb-table, .data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 14px;
}
.lb-table th, .lb-table td, .data-table th, .data-table td {
    padding: 9px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.lb-table th, .data-table th {
    background: var(--panel);
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}
.lb-table tr:hover, .data-table tr:hover { background: hsl(220 10% 97%); }
.lb-table .rank { color: var(--muted); font-weight: 600; white-space: nowrap; }
.lb-voice-count { color: var(--foreground); font-weight: 600; text-align: right; white-space: nowrap; }
.lb-contestant { background: var(--brand-soft); }
.lb-contestant:hover { background: hsl(262 100% 95%) !important; }

.lb-model-wrap { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 220px; }
.model-cell { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.lb-provenance {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.35;
    max-width: 430px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (max-width: 700px) {
    .lb-model-wrap { min-width: 180px; }
    .lb-provenance { max-width: 260px; white-space: normal; }
}
.creator-logo { width: 18px; height: 18px; object-fit: contain; border-radius: 3px; flex-shrink: 0; }
.creator-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.eval-badge {
    display: inline-block;
    background: var(--brand-soft);
    border: 1px solid var(--brand);
    color: var(--brand-blue);
    font-size: 10px;
    font-weight: 600;
    padding: 0 6px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.lb-ci { color: var(--muted); font-size: 13px; white-space: nowrap; }
.lb-human { color: var(--foreground); font-weight: 600; }
.lb-predicted { color: var(--success); font-weight: 600; }
.lb-na { color: var(--border); }
.lb-source-badge {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--muted);
    margin-left: 6px;
    text-transform: uppercase;
}

.lang-badge {
    display: inline-block;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 12px;
    margin: 2px;
}

/* === Gate formula / metrics form === */
.gate-formula {
    background: var(--panel);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 18px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.7;
}
.gate-formula code, code {
    background: var(--background);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
    color: var(--brand-blue);
}
.metric-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    background: var(--panel);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 20px;
}
.metric-form .field { display: flex; flex-direction: column; gap: 4px; }
.metric-form .field label { font-size: 12px; color: var(--muted); }
.metric-form input {
    background: var(--background);
    border: 1px solid var(--border);
    color: var(--foreground);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    width: 150px;
}
.metric-form input:focus { outline: none; border-color: var(--brand); }

/* === Status / loading === */
.status-success { color: var(--success); }
.status-error { color: var(--danger); }
.loading-indicator { color: var(--muted); font-style: italic; }
.loading-indicator::before {
    content: '';
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

h2 { margin-bottom: 16px; font-size: 20px; letter-spacing: -0.01em; }
h3 { margin-bottom: 12px; margin-top: 24px; font-size: 16px; }
h3:first-child { margin-top: 0; }

/* === Explore / Compare pages === */
.page-nav { display: flex; align-items: center; gap: 2px; }
.page-link {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
}
.page-link:hover { color: var(--foreground); background: var(--panel); }
.page-link.active { color: var(--brand-blue); }

/* Cross-links on the right edge of the index tab bar */
#tabs .page-links { margin-left: auto; display: flex; align-items: center; }
#tabs .page-link { padding: 10px 12px; border-radius: 0; }
#tabs .page-link:hover { background: none; }

.page-main { max-width: 1100px; margin: 0 auto; padding: 24px 32px 60px; }

/* Explore: model grid */
.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
}
.model-card {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 16px;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.model-card:hover { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.model-card .model-cell { font-size: 15px; }
.model-card-elo { margin-top: 8px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.model-card-elo b { color: var(--foreground); font-size: 14px; }
.model-card-meta { margin-top: 6px; font-size: 12px; color: var(--muted); }
.slot-chip {
    display: inline-block;
    background: var(--panel);
    border-radius: 4px;
    padding: 0 6px;
    font-size: 11px;
    color: var(--muted);
    margin: 2px 4px 0 0;
}

/* Explore: model detail (review board) */
.detail-top { margin-bottom: 10px; }
.detail-header { margin-bottom: 18px; }
.detail-header h2 { margin-bottom: 6px; }
.text-row {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 14px 18px;
    margin-bottom: 12px;
}
.text-row-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.text-num { color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
.text-body { font-size: 14px; }
.player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 8px 14px;
}
.player {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--panel);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
}
.player audio { flex: 1; width: 100%; height: 30px; min-width: 150px; }
.voice-tag {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    line-height: 1.3;
    color: var(--foreground);
    white-space: nowrap;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.voice-tag small { color: var(--muted); font-size: 10px; }

/* Compare: chips + filters */
.compare-controls {
    background: var(--panel);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.model-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--background);
    border: 1px solid var(--border);
    color: var(--foreground);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.model-chip:hover { border-color: var(--brand); }
.model-chip.selected {
    background: var(--brand-soft);
    border-color: var(--brand);
    color: var(--brand-blue);
    box-shadow: 0 0 0 1px var(--brand);
}
.compare-filters { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.compare-filters select {
    background: var(--background);
    border: 1px solid var(--border);
    color: var(--foreground);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 13px;
    max-width: 480px;
}
.compare-filters select:focus { outline: none; border-color: var(--brand); }

/* Compare: table */
.compare-table-wrap { overflow-x: auto; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.compare-table th, .compare-table td {
    border-bottom: 1px solid var(--border);
    padding: 8px 10px;
    text-align: left;
    vertical-align: middle;
}
.compare-table thead th {
    background: var(--panel);
    color: var(--foreground);
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}
.compare-table .slot-row th {
    background: var(--brand-soft);
    color: var(--brand-blue);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.compare-table .slot-row .slot-voice, .compare-table .slot-row .lb-na {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    color: var(--foreground);
}
.compare-table .slot-row .lb-na { color: var(--border); }
.compare-rowhead { min-width: 220px; }
.compare-text-cell { color: var(--muted); font-size: 12px; max-width: 280px; }
.compare-table audio { width: 100%; min-width: 180px; height: 30px; display: block; }
.voice-select {
    background: var(--background);
    border: 1px solid var(--border);
    color: var(--foreground);
    border-radius: var(--radius-sm);
    padding: 3px 6px;
    font-size: 12px;
    font-weight: 500;
    max-width: 170px;
}

/* ============================================================
   AA-style Arena Nav
   ============================================================ */

/* Prolific mode: hide the entire nav — raters are isolated */
#site-nav.prolific-hidden { display: none !important; }

/* ── Outer nav wrapper ── */
#site-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    /* no extra wrapper background: bar carries its own */
}

/* ── Sticky bar (AA's brand-blue-light strip) ── */
.sn-bar {
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
}

.sn-bar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    height: 52px;
}

/* ── Yellow pill dropdown button ── */
.sn-dropdown-wrapper {
    position: relative;
    flex-shrink: 0;
}

.sn-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--brand-yellow);
    border: none;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: #1a1200; /* dark text on yellow */
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    line-height: 1;
}

.sn-dropdown-btn:hover,
.sn-dropdown-btn.open {
    background: var(--brand-yellow-hover);
}

.sn-dropdown-btn:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.sn-pill-inner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sn-pill-label { /* hide on very narrow screens */ }

.sn-chevron {
    width: 14px;
    height: 14px;
    transition: transform 0.15s;
    flex-shrink: 0;
}

.sn-dropdown-btn.open .sn-chevron {
    transform: rotate(180deg);
}

/* ── Dropdown panel ── */
.sn-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px;
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06);
    z-index: 200;
}

.sn-dropdown[hidden] { display: none; }

.sn-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--foreground);
    text-decoration: none;
    transition: background 0.1s, color 0.1s;
    cursor: pointer;
}

.sn-dropdown-item:hover {
    background: var(--panel);
}

.sn-dropdown-item.active {
    background: var(--brand-yellow);
    color: #1a1200;
}

.sn-dropdown-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    opacity: 0.75;
}

.sn-dropdown-item.active .sn-dropdown-icon { opacity: 1; }

/* ── Tab row ── */
.sn-tabs {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 0;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    /* Align with bottom of bar so underline sits at the border */
    align-self: stretch;
}

.sn-tabs::-webkit-scrollbar { display: none; }

.sn-tab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0 16px;
    height: 52px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s;
    position: relative;
    flex-shrink: 0;
}

.sn-tab svg { flex-shrink: 0; opacity: 0.7; }

.sn-tab:hover {
    color: var(--foreground);
}

.sn-tab:hover svg { opacity: 1; }

.sn-tab.active {
    color: var(--foreground);
    font-weight: 600;
}

.sn-tab.active svg { opacity: 1; }

.sn-tab-label {
    /* Show label on medium+ screens */
}

/* Animated underline indicator (mirrors AA's sliding border) */
.sn-tab-indicator {
    position: absolute;
    bottom: 0;
    height: 2px;
    background: var(--foreground);
    pointer-events: none;
    will-change: left, width;
    transform: translateZ(0);
    backface-visibility: hidden;
    border-radius: 1px;
    opacity: 0;
}

/* ── Internal-view badge ── */
.sn-internal-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
    margin-left: auto;
    flex-shrink: 0;
}

/* Auth affordance in the nav bar (avatar when signed in; sign-in link + One
   Tap when not). Sits at the far right after the internal badge. */
.sn-auth {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.sn-auth .sn-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: block;
    object-fit: cover;
    border: 1px solid var(--border);
}
.sn-auth .sn-auth-email {
    font-size: 12px;
    color: var(--muted);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sn-auth .sn-signin,
.sn-auth .sn-signout {
    font-size: 12px;
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
}
.sn-auth .sn-signin:hover,
.sn-auth .sn-signout:hover { color: var(--foreground); text-decoration: underline; }

/* === Responsive === */
@media (max-width: 760px) {
    #site-nav { position: sticky; }
    .sn-bar-inner { padding: 0 16px; gap: 10px; }
    .sn-tab { padding: 0 10px; font-size: 12px; }
    .sn-tab-label { display: none; }   /* icon-only on small screens */
    .sn-tab svg { opacity: 1; }
    .sn-pill-label { display: none; }  /* icon-only pill on small screens */
    .sn-internal-badge { display: none; }
    .models-row { grid-template-columns: 1fr; }
    .va-samples-grid { grid-template-columns: 1fr; }
    .vote-buttons { grid-template-columns: 1fr 1fr; }
    .va-vote-grid { grid-template-columns: 1fr 1fr; }
    .va-arena-card { padding: 16px; }
    .va-prompt-panel .prompt-text { font-size: 16px; }
    .vaq-head { flex-direction: column; }
    .vaq-summary { grid-template-columns: 1fr 1fr; }
    .vaq-controls { align-items: stretch; }
    .vaq-controls label { width: 100%; justify-content: space-between; }
    .vaq-controls select { max-width: 62vw; }
    .vaq-row-head { flex-direction: column; }
    .vaq-rate { align-self: flex-start; }
    .vaq-detail-grid { grid-template-columns: 1fr; }
    #header, #tabs { padding-left: 16px; padding-right: 16px; }
    .tab-content { padding: 16px 16px 48px; }
    .page-main { padding: 16px 16px 48px; }
    .model-grid { grid-template-columns: 1fr; }
}

.lb-mode { gap: 6px; }
.lb-mode select { font: inherit; font-size: 13px; padding: 4px 6px; border: 1px solid hsl(220 13% 80%); border-radius: 6px; background: #fff; cursor: pointer; }
.lb-rankrange { color: var(--muted); font-size: 12px; white-space: nowrap; }

.lb-play-cell { width: 28px; padding-right: 0 !important; }
.lb-play { border: none; background: none; cursor: pointer; color: var(--brand-blue); font-size: 13px; padding: 2px 4px; border-radius: 4px; line-height: 1; }
.lb-play:hover { background: var(--brand-soft); }

/* --- Board freshness ("Last computed … ago · N votes since") --- */
.lb-freshness { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* --- Head-to-head W-L-T drill-down (expandable board rows) --- */
.lb-row-clickable { cursor: pointer; }
.lb-row-clickable .expand-icon { color: var(--muted); font-size: 9px; margin-left: 4px; }
.h2h-detail > td { background: hsl(220 14% 98%); padding: 8px 10px 12px 40px !important; }
.h2h-table { width: auto; min-width: 380px; border-collapse: collapse; font-size: 12.5px; }
.h2h-table th, .h2h-table td { text-align: left; padding: 4px 14px 4px 0; border: none; white-space: nowrap; }
.h2h-table thead th { color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.h2h-table .h2h-win  td:last-child { color: #1a7f37; font-weight: 600; }
.h2h-table .h2h-loss td:last-child { color: #b42318; font-weight: 600; }
.h2h-table .h2h-total td { border-top: 1px solid var(--border); }
.h2h-empty { color: var(--muted); font-size: 12.5px; }

/* --- Per-voice scorecard drill-down (internal-only) --- */
.lb-vtoggle { border: none; background: none; cursor: pointer; color: var(--brand-blue);
    font-size: 11px; padding: 0 4px 0 0; line-height: 1; }
.lb-vtoggle:hover { color: var(--brand-blue); opacity: 0.7; }
.lb-voice-detail > td { background: var(--brand-soft); padding: 6px 10px 10px 40px !important; }
.lb-voice-table { width: auto; min-width: 480px; border-collapse: collapse; font-size: 12.5px; }
.lb-voice-table th, .lb-voice-table td { text-align: left; padding: 4px 14px 4px 0; border: none; white-space: nowrap; }
.lb-voice-table thead th { color: var(--muted, #666); font-weight: 600; border-bottom: 1px solid var(--border); }
.lb-voice-table tbody td:first-child { font-weight: 500; }
.lb-voice-table .lb-voice-selected td { font-weight: 700; }
.lb-counted {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--brand-soft);
    color: var(--brand-blue);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

/* --- Leaderboard model-info icon + training card modal --- */
.lb-info {
    background: none; border: none; cursor: pointer;
    font-size: 13px; line-height: 1; color: var(--brand-blue);
    opacity: 0.5; padding: 0 2px; vertical-align: middle;
    transition: opacity 120ms ease, transform 120ms ease;
}
.lb-info:hover { opacity: 1; transform: scale(1.18); }
.lb-info:focus-visible { outline: 2px solid var(--brand); border-radius: 4px; opacity: 1; }

.card-modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(16, 24, 40, 0.45); backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center; padding: 24px;
    opacity: 0; pointer-events: none; transition: opacity 160ms ease;
}
.card-modal-overlay.open { opacity: 1; pointer-events: auto; }

.card-modal {
    position: relative; background: var(--background);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(16, 24, 40, 0.22);
    width: min(560px, 100%); max-height: 85vh; overflow-y: auto;
    padding: 24px 26px 22px;
    transform: translateY(8px) scale(0.98);
    transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
.card-modal-overlay.open .card-modal { transform: translateY(0) scale(1); }

.card-modal-close {
    position: absolute; top: 12px; right: 14px;
    background: none; border: none; font-size: 24px; line-height: 1;
    color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.card-modal-close:hover { background: var(--panel); color: var(--foreground); }

.card-modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; padding-right: 28px; }
.card-modal-head h3 { margin: 0; font-size: 20px; color: var(--foreground); }
.card-modal-tag {
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
    padding: 3px 8px; border-radius: 999px; white-space: nowrap;
    background: var(--brand-soft); color: var(--brand-blue); border: 1px solid var(--brand);
}
.card-modal-tag.champion { background: hsl(50 100% 92%); color: hsl(38 90% 32%); border-color: var(--brand-yellow); }
.card-modal-tag.baseline { background: var(--panel); color: var(--muted); border-color: var(--border); }
.card-modal-tag.experiment { background: hsl(0 80% 96%); color: var(--danger); border-color: hsl(0 70% 85%); }

.card-modal-sub { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 6px 0 16px; }
.card-modal-fields { margin: 0; display: grid; gap: 12px; }
.card-modal-fields dt {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
    color: var(--brand-blue); margin-bottom: 2px;
}
.card-modal-fields dd { margin: 0; font-size: 14px; line-height: 1.5; color: var(--foreground); }
