/* chataiopensource / Arena UI */
:root {
    color-scheme: light;
    --bg: #f7f7f5;
    --bg-subtle: #f1f1ee;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --surface-hover: #f4f4f1;
    --surface-selected: #ececff;
    --sidebar: #f1f1ee;
    --text: #181816;
    --text-secondary: #686861;
    --text-tertiary: #92928a;
    --text-inverse: #ffffff;
    --border: #e5e4de;
    --border-strong: #d4d3cc;
    --accent: #5b5bd6;
    --accent-hover: #4d4dc4;
    --accent-soft: #ececff;
    --accent-text: #4a49b7;
    --success: #18875b;
    --success-soft: #e8f7ef;
    --danger: #c53d43;
    --danger-soft: #fceced;
    --warning: #a56718;
    --warning-soft: #fff4dd;
    --shadow-xs: 0 1px 2px rgba(20, 20, 16, 0.04);
    --shadow-sm: 0 2px 8px rgba(20, 20, 16, 0.06), 0 1px 2px rgba(20, 20, 16, 0.04);
    --shadow-md: 0 12px 36px rgba(20, 20, 16, 0.1), 0 2px 8px rgba(20, 20, 16, 0.05);
    --sidebar-width: 240px;
    --header-height: 52px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #11110f;
    --bg-subtle: #151513;
    --surface: #191917;
    --surface-raised: #20201d;
    --surface-hover: #252521;
    --surface-selected: #292943;
    --sidebar: #0d0d0c;
    --text: #f1f1ed;
    --text-secondary: #aaa9a1;
    --text-tertiary: #77776f;
    --text-inverse: #11110f;
    --border: #2b2b27;
    --border-strong: #3b3b35;
    --accent: #8b8bf0;
    --accent-hover: #9d9df5;
    --accent-soft: #262640;
    --accent-text: #aaaaff;
    --success: #4ac58b;
    --success-soft: #173126;
    --danger: #ff7b80;
    --danger-soft: #351c1e;
    --warning: #e3ad58;
    --warning-soft: #352a18;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-sm: 0 3px 10px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 18px 48px rgba(0, 0, 0, 0.42);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    min-width: 320px;
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
}

body,
button,
input,
select,
textarea {
    font-family: var(--font-sans);
}

/* Search page styles */
.search-bar {
    margin-bottom: 2rem;
}

.search-bar input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
}

.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.model-card {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    transition: box-shadow 0.2s ease;
}

.model-card:hover {
    box-shadow: var(--shadow-sm);
}

.model-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0;
}

.model-meta {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.55;
}

.model-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
}

.search-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sort-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-group label {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.sort-group select {
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 0.82rem;
}

.ready-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
}

.ready-filter input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent);
}

.search-count {
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.model-header h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.model-provider {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.model-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.status-ready {
    color: var(--success);
}

.status-unavailable {
    color: var(--text-tertiary);
}

.model-actions {
    display: flex;
    gap: 0.5rem;
}

.button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.button-primary {
    background: var(--accent);
    color: var(--text-inverse);
}

.button-primary:hover {
    background: var(--accent-hover);
}

.button-secondary {
    background: var(--surface-hover);
    color: var(--text);
}

.button-secondary:hover {
    background: var(--border);
}

/* Admin page styles */
.admin-page .page-width {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.admin-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.admin-card h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group.span-two {
    grid-column: 1 / -1;
}

.metadata-details {
    margin-top: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

.metadata-details summary {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    padding: 0.625rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 0.875rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-subtle);
}

.data-table tbody tr:hover {
    background: var(--surface-hover);
}

.table-empty {
    text-align: center;
    color: var(--text-tertiary);
    padding: 2rem;
}

.error-text {
    color: var(--danger);
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.success-text {
    color: var(--success);
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.loading {
    text-align: center;
    color: var(--text-tertiary);
    padding: 2rem;
}

/* How it works page styles */
.how-page .page-width.narrow {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.steps {
    list-style: none;
    padding: 0;
    margin: 2rem 0;
    counter-reset: step-counter;
}

.steps li {
    position: relative;
    padding: 1.5rem 1.5rem 1.5rem 4rem;
    margin-bottom: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.steps li::before {
    counter-increment: step-counter;
    content: counter(step-counter);
    position: absolute;
    left: 1.5rem;
    top: 1.5rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: var(--text-inverse);
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.875rem;
}

.steps h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.steps p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.lede {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--accent);
}

.text-link {
    color: var(--accent);
    text-decoration: none;
}

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

/* About page styles */
.about-page .page-width.narrow {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.content-section {
    margin-bottom: 2rem;
}

.content-section h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.content-section p {
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.content-section ul {
    list-style: none;
    padding: 0;
}

.content-section li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    line-height: 1.5;
}

.content-section li strong {
    color: var(--text);
}

.action-links {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.action-links .separator {
    margin: 0 0.75rem;
    color: var(--text-tertiary);
}

/* Search page styles */
.search-page .page-width {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.muted {
    color: var(--text-tertiary);
}

/* Footer styles */
.site-footer {
    background: var(--bg-subtle);
    border-top: 1px solid var(--border);
    padding: 2rem 1rem 1rem;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-title {
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.footer-section p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.875rem;
}

.footer-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-nav a svg {
    width: 16px;
    height: 16px;
}

.footer-nav a:hover {
    color: var(--accent);
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

/* Privacy and Terms page styles */
.privacy-page .page-width.narrow,
.terms-page .page-width.narrow {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.last-updated {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.content-section {
    margin-bottom: 2rem;
}

.content-section h2 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.content-section p {
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.content-section ul {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.content-section li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    line-height: 1.5;
    position: relative;
    padding-left: 1.5rem;
}

.content-section li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent);
}

.content-section li strong {
    color: var(--text);
}

/* Model page styles */
.model-page .page-width {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.model-overview {
    margin-bottom: 2rem;
}

.model-header-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
}

.model-identity-large {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.model-avatar {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: var(--text-inverse);
    font-size: 1.5rem;
    font-weight: 700;
}

.model-identity-large h2 {
    margin: 0 0 0.25rem 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.model-identity-large p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.model-quick-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.quick-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.quick-stat .stat-label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.quick-stat strong {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.model-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.info-card {
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.info-card h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.info-card h3 svg {
    width: 18px;
    height: 18px;
    color: var(--accent);
}

.info-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem 1rem;
    margin: 0;
}

.info-list dt {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.info-list dd {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text);
}

.info-list code {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    background: var(--bg-subtle);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text);
}

.category-performance {
    margin-bottom: 2rem;
}

.category-performance h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.category-performance h3 svg {
    width: 18px;
    height: 18px;
    color: var(--accent);
}

.category-stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.category-stat-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    align-items: center;
}

.category-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.category-name {
    font-weight: 500;
    color: var(--text);
}

.category-stats-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.category-bar {
    height: 6px;
    background: var(--bg-subtle);
    border-radius: 3px;
    overflow: hidden;
}

.category-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.category-winrate {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    text-align: right;
}

.recent-battles {
    margin-bottom: 2rem;
}

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

.section-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.section-header h3 svg {
    width: 18px;
    height: 18px;
    color: var(--accent);
}

.battle-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.battle-placeholder {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.loading-text {
    color: var(--text-tertiary);
    font-style: italic;
}

/* Keyboard hints for vote buttons */
.keyboard-hint {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-subtle);
    color: var(--text-tertiary);
    font-size: 0.75rem;
    font-weight: 600;
}

.vote-button {
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.vote-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.vote-button:active:not(:disabled) {
    transform: translateY(0);
}

.vote-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Response panel animations */
.response-panel {
    transition: box-shadow 0.3s ease, opacity 0.3s ease;
}

.response-panel:hover {
    box-shadow: var(--shadow-sm);
}

.response-panel.is-selected {
    box-shadow: 0 0 0 2px var(--accent), var(--shadow-md);
}

.response-panel.is-muted {
    opacity: 0.6;
}

/* Loading animations */
.loading-block {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

.loading-line {
    height: 12px;
    background: var(--bg-subtle);
    border-radius: 4px;
    margin-bottom: 8px;
    animation: shimmer 1.5s ease-in-out infinite;
}

.loading-line:nth-child(1) { width: 80%; }
.loading-line:nth-child(2) { width: 60%; }
.loading-line:nth-child(3) { width: 90%; }
.loading-line:nth-child(4) { width: 70%; }
.loading-line:nth-child(5) { width: 50%; }
.loading-line:nth-child(6) { width: 85%; }

@keyframes shimmer {
    0% {
        background: var(--bg-subtle);
    }
    50% {
        background: var(--border);
    }
    100% {
        background: var(--bg-subtle);
    }
}

/* Status spinner animation */
.status-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Fade-in animations for turns */
.battle-turn {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Vote panel reveal animation */
.vote-panel {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Result celebration animation */
.vote-result {
    animation: scaleIn 0.4s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.result-icon {
    animation: bounce 0.5s ease-out;
}

@keyframes bounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* Leaderboard enhancements */
.leaderboard-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.leaderboard-actions .button {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
}

.select-column {
    width: 40px;
    text-align: center;
}

.select-column input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent);
    cursor: pointer;
}

.data-table tbody tr.selected {
    background: var(--surface-selected);
}

.data-table tbody tr:hover input[type="checkbox"] {
    opacity: 1;
}

.data-table tbody tr input[type="checkbox"] {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    animation: toastIn 0.3s ease-out;
    max-width: 400px;
}

.toast.success {
    border-color: var(--success);
    background: var(--success-soft);
    color: var(--success);
}

.toast.error {
    border-color: var(--danger);
    background: var(--danger-soft);
    color: var(--danger);
}

.toast.info {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-text);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

/* Responsive design improvements */
@media (max-width: 768px) {
    .model-header-card {
        padding: 1rem;
    }
    
    .model-quick-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .model-actions {
        flex-direction: column;
    }
    
    .model-actions .button {
        width: 100%;
        justify-content: center;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .category-stat-row {
        grid-template-columns: 1fr;
    }
    
    .category-bar {
        margin-bottom: 0.25rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .search-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filter-group {
        flex-wrap: wrap;
    }
    
    .sort-group {
        width: 100%;
        justify-content: space-between;
    }
    
    .sort-group select {
        flex: 1;
    }
    
    .model-grid {
        grid-template-columns: 1fr;
    }
    
    .model-actions {
        flex-direction: column;
    }
    
    .model-actions .button {
        width: 100%;
        justify-content: center;
    }
    
    .leaderboard-card {
        overflow-x: auto;
    }
    
    .data-table {
        min-width: 600px;
    }
    
    .page-tabs {
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .page-tab {
        white-space: nowrap;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .battle-landing {
        padding: 2rem 1rem;
    }
    
    .battle-landing > h1 {
        font-size: 2rem;
    }
    
    .prompt-composer {
        border-radius: var(--radius-md);
    }
    
    .suggestion-grid {
        grid-template-columns: 1fr;
    }
    
    .vote-grid {
        grid-template-columns: 1fr;
    }
    
    .vote-button {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .model-avatar {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }
    
    .model-identity-large h2 {
        font-size: 1.25rem;
    }
}

button,
input,
select,
textarea {
    color: inherit;
}

button,
a,
select {
    -webkit-tap-highlight-color: transparent;
}

button {
    border: 0;
}

button:not(:disabled),
a,
select {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

img,
svg {
    display: block;
}

svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

[hidden] {
    display: none !important;
}

::selection {
    background: color-mix(in srgb, var(--accent) 24%, transparent);
}

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

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

.skip-link {
    position: fixed;
    z-index: 1000;
    top: 10px;
    left: 10px;
    padding: 9px 13px;
    border-radius: var(--radius-sm);
    background: var(--text);
    color: var(--bg);
    font-weight: 650;
    text-decoration: none;
    transform: translateY(-160%);
    transition: transform 160ms ease;
}

.skip-link:focus {
    transform: translateY(0);
}

/* Application shell */
.app-shell {
    display: flex;
    min-height: 100vh;
    min-height: 100svh;
}

.sidebar {
    position: fixed;
    z-index: 80;
    inset: 0 auto 0 0;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--sidebar);
    color: var(--text-secondary);
}

.sidebar-header {
    display: flex;
    min-height: var(--header-height);
    align-items: center;
    justify-content: space-between;
    padding: 0 14px 0 16px;
}

.brand,
.mobile-brand {
    display: inline-flex;
    align-items: center;
    color: var(--text);
    text-decoration: none;
}

.brand {
    min-width: 0;
    gap: 9px;
}

.brand-mark {
    display: grid;
    width: 25px;
    height: 25px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 7px;
    background: var(--text);
    color: var(--bg);
}

.brand-mark svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.1;
}

.brand-name {
    overflow: hidden;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.035em;
}

.brand-badge {
    margin-left: 1px;
    padding: 2px 5px;
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    color: var(--text-tertiary);
    font-size: 8px;
    font-weight: 750;
    letter-spacing: 0.08em;
}

.sidebar-close {
    display: none !important;
}

.sidebar-scroll {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px 10px 16px;
    scrollbar-width: thin;
}

.sidebar-primary,
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-link {
    display: flex;
    width: 100%;
    min-height: 34px;
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    text-align: left;
    text-decoration: none;
    transition: background 140ms ease, color 140ms ease;
}

.sidebar-link:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.sidebar-link.is-active {
    background: var(--surface-selected);
    color: var(--accent-text);
    font-weight: 620;
}

.sidebar-link svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    stroke-width: 1.8;
}

.sidebar-link > span:not(.sidebar-shortcut) {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-shortcut {
    color: var(--text-tertiary);
    font-size: 10px;
    font-weight: 600;
}

.sidebar-new-link {
    margin-bottom: 6px;
    color: var(--text);
    font-weight: 620;
}

.history-section {
    margin-top: 25px;
}

.sidebar-section-label {
    display: flex;
    height: 30px;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    color: var(--text-tertiary);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.text-button {
    padding: 2px;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 10px;
    font-weight: 550;
    letter-spacing: 0;
    text-transform: none;
}

.text-button:hover {
    color: var(--text);
}

.battle-history {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.history-empty {
    padding: 8px;
    color: var(--text-tertiary);
    font-size: 12px;
}

.history-item {
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    text-align: left;
}

.history-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.history-item > svg {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
    color: var(--text-tertiary);
}

.history-item span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 10px;
    border-top: 1px solid var(--border);
}

.theme-toggle {
    position: relative;
}

.theme-icon {
    position: absolute;
    left: 9px;
    width: 17px !important;
    height: 17px !important;
}

.theme-toggle .theme-icon + span {
    padding-left: 27px;
}

.theme-icon-moon,
:root[data-theme="dark"] .theme-icon-sun {
    display: none;
}

:root[data-theme="dark"] .theme-icon-moon {
    display: block;
}

:root[data-theme="dark"] .theme-label-light {
    display: none;
}

:root[data-theme="dark"] .theme-label-dark {
    display: inline !important;
}

.sidebar-scrim {
    display: none;
}

.app-main {
    width: calc(100% - var(--sidebar-width));
    min-width: 0;
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.mobile-header {
    display: none;
}

.page-content {
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
}

/* Shared controls */
.icon-button {
    display: inline-grid;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
}

.icon-button:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.icon-button svg {
    width: 18px;
    height: 18px;
}

.button {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 13px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 620;
    line-height: 1;
    text-decoration: none;
    transition: background 140ms ease, border-color 140ms ease, transform 140ms ease, opacity 140ms ease;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.button:active:not(:disabled) {
    transform: translateY(0);
}

.button:disabled {
    opacity: 0.55;
}

.button svg {
    width: 15px;
    height: 15px;
}

.button-primary {
    background: var(--text);
    color: var(--bg);
}

.button-primary:hover:not(:disabled) {
    opacity: 0.88;
}

.button-secondary {
    border-color: var(--border);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-xs);
}

.button-secondary:hover:not(:disabled) {
    border-color: var(--border-strong);
    background: var(--surface-hover);
}

.form-message {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin: 10px 0 0;
    padding: 9px 11px;
    border: 1px solid color-mix(in srgb, var(--danger) 25%, var(--border));
    border-radius: 9px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 12px;
    line-height: 1.45;
}

.form-message::before {
    content: "!";
    display: inline-grid;
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 750;
}

.form-message.is-success {
    border-color: color-mix(in srgb, var(--success) 25%, var(--border));
    background: var(--success-soft);
    color: var(--success);
}

.form-message.is-success::before {
    content: "✓";
}

/* Battle landing */
.battle-page {
    overflow-x: hidden;
}

.battle-landing {
    display: flex;
    width: min(100%, 900px);
    min-height: 100vh;
    min-height: 100svh;
    margin: 0 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 62px 28px 36px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 14px;
    color: var(--text-tertiary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.eyebrow > span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 14%, transparent);
}

.battle-landing > h1 {
    margin: 0;
    color: var(--text);
    font-size: clamp(40px, 5.1vw, 66px);
    font-weight: 630;
    letter-spacing: -0.065em;
    line-height: 1.04;
    text-align: center;
}

.battle-landing > h1 > span {
    background: linear-gradient(105deg, var(--accent-text), color-mix(in srgb, var(--accent-text) 55%, var(--text)) 75%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.landing-copy {
    max-width: 560px;
    margin: 17px 0 30px;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
    text-align: center;
}

.prompt-composer {
    width: min(100%, 720px);
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--surface-raised);
    box-shadow: var(--shadow-md);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.prompt-composer:focus-within {
    border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent), var(--shadow-md);
}

.composer-topline {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 13px;
    border-bottom: 1px solid var(--border);
}

.category-select {
    position: relative;
    display: inline-flex;
    min-width: 108px;
    height: 31px;
    align-items: center;
    gap: 6px;
    padding: 0 29px 0 9px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-subtle);
    color: var(--text-secondary);
}

.category-select > svg:first-child {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}

.category-select .select-chevron {
    position: absolute;
    right: 8px;
    width: 13px;
    height: 13px;
    pointer-events: none;
}

.category-select select {
    width: 100%;
    min-width: 0;
    appearance: none;
    border: 0;
    outline: 0;
    background: transparent;
    color: inherit;
    font-size: 12px;
    font-weight: 580;
}

.composer-privacy {
    color: var(--text-tertiary);
    font-size: 11px;
}

.prompt-composer > textarea {
    display: block;
    width: 100%;
    min-height: 116px;
    max-height: 300px;
    resize: none;
    padding: 19px 20px 8px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 16px;
    line-height: 1.55;
}

.prompt-composer > textarea::placeholder,
.followup-composer textarea::placeholder {
    color: var(--text-tertiary);
}

.composer-footer {
    display: flex;
    min-height: 50px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 10px 9px 19px;
}

.composer-hint {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-tertiary);
    font-size: 10px;
}

kbd {
    display: inline-grid;
    min-width: 20px;
    height: 20px;
    place-items: center;
    padding: 0 5px;
    border: 1px solid var(--border);
    border-bottom-color: var(--border-strong);
    border-radius: 5px;
    background: var(--bg-subtle);
    color: var(--text-tertiary);
    font-family: var(--font-sans);
    font-size: 9px;
    font-weight: 650;
    line-height: 1;
    box-shadow: 0 1px 0 var(--border);
}

.composer-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.char-count {
    color: var(--text-tertiary);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.send-button {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 9px;
    background: var(--text);
    color: var(--bg);
    transition: opacity 140ms ease, transform 140ms ease, background 140ms ease;
}

.send-button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.send-button:disabled {
    background: var(--bg-subtle);
    color: var(--text-tertiary);
    opacity: 0.8;
}

.send-button svg {
    width: 17px;
    height: 17px;
    stroke-width: 2;
}

.suggestions {
    width: min(100%, 720px);
    margin-top: 30px;
}

.suggestions-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 11px;
    padding: 0 2px;
}

.suggestions-heading h2 {
    margin: 0;
    color: var(--text);
    font-size: 12px;
    font-weight: 650;
}

.suggestions-heading > span {
    color: var(--text-tertiary);
    font-size: 10px;
}

.suggestion-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.suggestion-card {
    display: flex;
    min-width: 0;
    min-height: 67px;
    align-items: center;
    gap: 11px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    color: var(--text);
    text-align: left;
    box-shadow: var(--shadow-xs);
    transition: border-color 140ms ease, background 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.suggestion-card:hover {
    border-color: var(--border-strong);
    background: var(--surface-hover);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.suggestion-icon {
    display: grid;
    width: 35px;
    height: 35px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 9px;
}

.suggestion-icon svg {
    width: 16px;
    height: 16px;
}

.suggestion-icon.lavender {
    background: #efedff;
    color: #6864d7;
}

.suggestion-icon.blue {
    background: #e9f3ff;
    color: #3678bd;
}

.suggestion-icon.peach {
    background: #fff0e8;
    color: #bd6940;
}

.suggestion-icon.green {
    background: #e9f6ed;
    color: #3d8758;
}

:root[data-theme="dark"] .suggestion-icon.lavender { background: #292742; color: #a7a3ff; }
:root[data-theme="dark"] .suggestion-icon.blue { background: #1e2d3e; color: #8dbce7; }
:root[data-theme="dark"] .suggestion-icon.peach { background: #3a2922; color: #e5a07b; }
:root[data-theme="dark"] .suggestion-icon.green { background: #20352a; color: #84c99a; }

.suggestion-card > span:nth-child(2) {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 2px;
}

.suggestion-card strong {
    overflow: hidden;
    font-size: 12px;
    font-weight: 620;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suggestion-card small {
    overflow: hidden;
    color: var(--text-tertiary);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suggestion-arrow {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    color: var(--text-tertiary);
    opacity: 0;
    transform: translate(-3px, 3px);
    transition: opacity 140ms ease, transform 140ms ease;
}

.suggestion-card:hover .suggestion-arrow {
    opacity: 1;
    transform: translate(0, 0);
}

.landing-footnote {
    display: flex;
    width: min(100%, 720px);
    align-items: flex-start;
    gap: 8px;
    margin-top: 25px;
    color: var(--text-tertiary);
    font-size: 10px;
    line-height: 1.45;
}

.landing-footnote > svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    margin-top: 1px;
}

.landing-footnote strong {
    color: var(--text-secondary);
    font-weight: 620;
}

/* Battle workspace */
.battle-workspace {
    width: min(100%, 1280px);
    margin: 0 auto;
    padding: 40px 32px 64px;
}

.battle-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 27px;
}

.battle-kicker,
.vote-overline {
    display: block;
    margin-bottom: 4px;
    color: var(--text-tertiary);
    font-size: 9px;
    font-weight: 720;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.battle-toolbar h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 650;
    letter-spacing: -0.035em;
}

.battle-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.category-pill {
    display: inline-flex;
    height: 30px;
    align-items: center;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 620;
}

.battle-notice {
    display: flex;
    min-height: 44px;
    align-items: center;
    gap: 10px;
    margin: -10px 0 20px;
    padding: 10px 13px;
    border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border));
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent-text);
    font-size: 12px;
}

/* Warning variant: short admin password, degraded service, anything the admin
   must act on. Same shape as .battle-notice, warning palette. */
.battle-notice.is-warn {
    border-color: color-mix(in srgb, var(--warning) 34%, var(--border));
    background: var(--warning-soft);
    color: var(--warning);
}

.status-spinner {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

.battle-turns {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.battle-turn {
    animation: turn-in 240ms ease both;
}

.turn-prompt {
    width: min(86%, 760px);
    margin: 0 0 16px auto;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: 14px 14px 4px 14px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.turn-prompt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 5px;
}

.turn-prompt-header strong {
    font-size: 11px;
    font-weight: 680;
}

.turn-prompt-header span {
    color: var(--text-tertiary);
    font-size: 9px;
}

.turn-prompt p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.55;
    white-space: pre-wrap;
}

.response-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.response-panel {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 380px;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.response-panel.is-selected {
    border-color: color-mix(in srgb, var(--success) 50%, var(--border));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--success) 10%, transparent), var(--shadow-sm);
}

.response-panel.is-muted {
    opacity: 0.58;
}

.response-panel-header {
    display: flex;
    min-height: 50px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 11px 9px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-raised);
}

.model-identity {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
}

.anonymous-mark {
    display: grid;
    width: 25px;
    height: 25px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 750;
}

.model-identity-text {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.model-identity-text strong {
    overflow: hidden;
    color: var(--text);
    font-size: 11px;
    font-weight: 630;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.model-identity-text span {
    overflow: hidden;
    color: var(--text-tertiary);
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 3px;
}

.panel-stat {
    margin-right: 4px;
    color: var(--text-tertiary);
    font-size: 9px;
    font-variant-numeric: tabular-nums;
}

.copy-button {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 7px;
    background: transparent;
    color: var(--text-tertiary);
}

.copy-button:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.copy-button svg {
    width: 14px;
    height: 14px;
}

.response-body {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    color: var(--text);
    font-size: 13px;
    line-height: 1.72;
    overflow-wrap: anywhere;
}

.response-body > :first-child {
    margin-top: 0;
}

.response-body > :last-child {
    margin-bottom: 0;
}

.response-body p {
    margin: 0 0 13px;
}

.response-body h1,
.response-body h2,
.response-body h3 {
    margin: 21px 0 9px;
    color: var(--text);
    font-weight: 680;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.response-body h1 { font-size: 19px; }
.response-body h2 { font-size: 16px; }
.response-body h3 { font-size: 14px; }

.response-body ul,
.response-body ol {
    margin: 8px 0 14px;
    padding-left: 23px;
}

.response-body li {
    margin: 4px 0;
    padding-left: 2px;
}

.response-body blockquote {
    margin: 13px 0;
    padding: 5px 0 5px 14px;
    border-left: 3px solid var(--border-strong);
    color: var(--text-secondary);
}

.response-body pre {
    max-width: 100%;
    margin: 14px 0;
    overflow-x: auto;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg-subtle);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.6;
    white-space: pre;
}

.response-body code {
    padding: 2px 5px;
    border-radius: 5px;
    background: var(--bg-subtle);
    color: var(--accent-text);
    font-family: var(--font-mono);
    font-size: 0.9em;
}

.response-body pre code {
    padding: 0;
    background: transparent;
    color: inherit;
}

.response-body hr {
    height: 1px;
    margin: 18px 0;
    border: 0;
    background: var(--border);
}

.response-body a {
    color: var(--accent-text);
    text-underline-offset: 2px;
}

.response-error,
.response-empty {
    display: flex;
    min-height: 260px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    color: var(--text-tertiary);
    text-align: center;
}

.response-error {
    color: var(--danger);
}

.response-error svg {
    width: 24px;
    height: 24px;
}

.response-error strong {
    font-size: 12px;
}

.response-error p {
    max-width: 330px;
    margin: 0;
    color: var(--text-secondary);
    font-size: 11px;
}

.loading-block {
    width: 100%;
}

.loading-line {
    height: 9px;
    margin-bottom: 10px;
    overflow: hidden;
    border-radius: 5px;
    background: var(--bg-subtle);
}

.loading-line::after {
    display: block;
    width: 45%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--surface-hover), transparent);
    content: "";
    animation: shimmer 1.35s ease-in-out infinite;
}

.loading-line:nth-child(1) { width: 86%; }
.loading-line:nth-child(2) { width: 93%; }
.loading-line:nth-child(3) { width: 74%; }
.loading-line:nth-child(4) { width: 88%; }
.loading-line:nth-child(5) { width: 58%; }

/* Named conversation setup */
.conversation-setup {
    justify-content: flex-start;
    padding-top: 72px;
}

.setup-card {
    width: min(100%, 760px);
    padding: 16px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--surface-raised);
    box-shadow: var(--shadow-md);
}

.picker-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: end;
    gap: 10px;
    margin-bottom: 12px;
}

.picker-grid.single-picker {
    grid-template-columns: minmax(0, 1fr) auto;
}

.picker-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 620;
}

.picker-field select {
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg-subtle);
    color: var(--text);
    font-size: 13px;
}

.swap-button {
    margin-bottom: 1px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.setup-card > textarea {
    display: block;
    width: 100%;
    min-height: 104px;
    max-height: 260px;
    resize: none;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-subtle);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
}

.setup-card > textarea:focus {
    border-color: var(--accent);
    outline: 0;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}

.setup-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}

.setup-meta {
    color: var(--text-tertiary);
    font-size: 11px;
}

.response-body table {
    width: 100%;
    margin: 14px 0;
    border-collapse: collapse;
    font-size: 12px;
}

.response-body th,
.response-body td {
    padding: 8px 10px;
    border: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.response-body thead th {
    background: var(--bg-subtle);
}

.single-grid {
    grid-template-columns: minmax(0, 1fr);
}

.single-grid .response-panel {
    min-height: 320px;
}

/* Follow-up and voting */
.followup-section,
.vote-panel,
.vote-result {
    margin-top: 30px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.followup-heading,
.vote-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 13px;
}

.followup-heading h2,
.vote-heading h2,
.vote-result h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.followup-heading p,
.vote-heading p,
.vote-result p {
    margin: 3px 0 0;
    color: var(--text-tertiary);
    font-size: 10px;
}

.followup-heading > span {
    padding: 3px 7px;
    border-radius: 6px;
    background: var(--bg-subtle);
    color: var(--text-tertiary);
    font-size: 9px;
    font-weight: 620;
}

.followup-composer {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    padding: 8px 8px 8px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-subtle);
}

.followup-composer:focus-within {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 9%, transparent);
}

.followup-composer textarea {
    min-width: 0;
    min-height: 42px;
    max-height: 140px;
    flex: 1;
    resize: none;
    padding: 9px 0 5px;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 13px;
    line-height: 1.5;
}

.vote-heading {
    align-items: center;
}

.vote-heading > p {
    max-width: 300px;
    text-align: right;
}

.vote-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.vote-button {
    display: grid;
    min-width: 0;
    min-height: 65px;
    grid-template-columns: 30px minmax(0, 1fr) 14px;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-subtle);
    color: var(--text);
    text-align: left;
    transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.vote-button:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
    background: var(--accent-soft);
    transform: translateY(-1px);
}

.vote-button:disabled {
    opacity: 0.55;
}

.vote-button > span:nth-child(2) {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.vote-button strong {
    overflow: hidden;
    font-size: 11px;
    font-weight: 630;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vote-button small {
    overflow: hidden;
    color: var(--text-tertiary);
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vote-button > svg {
    width: 13px;
    height: 13px;
    color: var(--text-tertiary);
}

.vote-choice {
    display: grid;
    width: 29px;
    height: 29px;
    place-items: center;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface);
    font-size: 10px;
    font-weight: 750;
}

.vote-choice svg {
    width: 14px;
    height: 14px;
}

.vote-both-bad {
    color: var(--text-secondary);
}

.vote-message {
    margin-bottom: 0;
}

.vote-result {
    display: grid;
    grid-template-columns: 42px minmax(180px, 1fr) auto auto;
    align-items: center;
    gap: 14px;
    border-color: color-mix(in srgb, var(--success) 25%, var(--border));
    background: linear-gradient(110deg, var(--success-soft), var(--surface) 48%);
}

.result-icon {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 50%;
    background: var(--success);
    color: #fff;
}

.result-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.2;
}

.rating-results {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rating-chip {
    display: flex;
    min-width: 112px;
    flex-direction: column;
    gap: 1px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 85%, transparent);
}

.rating-chip span {
    max-width: 150px;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 9px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rating-chip strong {
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.rating-chip em {
    color: var(--success);
    font-size: 9px;
    font-style: normal;
}

/* Search and toast */
.search-dialog {
    width: min(92vw, 600px);
    max-height: min(72vh, 580px);
    margin-top: 12vh;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    background: var(--surface-raised);
    color: var(--text);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.search-dialog::backdrop {
    background: rgba(20, 20, 18, 0.32);
    backdrop-filter: blur(3px);
}

.search-dialog-shell {
    display: flex;
    min-height: 330px;
    flex-direction: column;
}

.search-input-wrap {
    display: flex;
    height: 58px;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
    padding: 0 11px 0 16px;
    border-bottom: 1px solid var(--border);
}

.search-input-wrap > svg {
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
}

.search-input-wrap input {
    min-width: 0;
    height: 100%;
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 14px;
}

.search-results {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.search-result {
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    text-align: left;
}

.search-result:hover,
.search-result:focus {
    outline: 0;
    background: var(--surface-hover);
}

.search-result > svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    color: var(--text-tertiary);
}

.search-result span {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.search-result time {
    color: var(--text-tertiary);
    font-size: 9px;
}

.search-empty {
    display: grid;
    min-height: 230px;
    place-items: center;
    color: var(--text-tertiary);
    font-size: 12px;
    text-align: center;
}

.search-footer {
    display: flex;
    min-height: 38px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    padding: 7px 13px;
    border-top: 1px solid var(--border);
    color: var(--text-tertiary);
    font-size: 9px;
}

.search-footer span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.toast-region {
    position: fixed;
    z-index: 300;
    right: 18px;
    bottom: 18px;
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    max-width: min(360px, calc(100vw - 36px));
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    background: var(--surface-raised);
    color: var(--text);
    font-size: 11px;
    box-shadow: var(--shadow-md);
    animation: toast-in 180ms ease both;
}

.toast.is-error {
    border-color: color-mix(in srgb, var(--danger) 28%, var(--border));
    color: var(--danger);
}

.toast svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
}

/* Leaderboard */
.leaderboard-page {
    padding: 44px 38px 72px;
}

.standard-page {
    width: min(100%, 980px);
    margin: 0 auto;
    padding: 48px 34px 76px;
}

.page-width {
    width: min(100%, 1180px);
    margin: 0 auto;
}

.page-eyebrow {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 9px;
    color: var(--accent-text);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.page-eyebrow svg {
    width: 14px;
    height: 14px;
}

.page-hero h1 {
    margin: 0;
    font-size: clamp(32px, 4vw, 48px);
    font-weight: 650;
    letter-spacing: -0.055em;
    line-height: 1.08;
}

.page-hero > p {
    max-width: 640px;
    margin: 12px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.page-tabs {
    display: flex;
    gap: 4px;
    margin-top: 30px;
    border-bottom: 1px solid var(--border);
}

.page-tab {
    position: relative;
    padding: 10px 13px 12px;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 590;
    text-decoration: none;
}

.page-tab:hover {
    color: var(--text);
}

.page-tab.is-active {
    color: var(--text);
}

.page-tab.is-active::after {
    position: absolute;
    right: 8px;
    bottom: -1px;
    left: 8px;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--text);
    content: "";
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 22px 0 16px;
}

.stat-card {
    padding: 14px 15px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-tertiary);
    font-size: 9px;
    font-weight: 650;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.stat-card-header svg {
    width: 15px;
    height: 15px;
}

.stat-card strong {
    display: block;
    margin-top: 7px;
    font-size: 20px;
    font-weight: 660;
    letter-spacing: -0.035em;
    font-variant-numeric: tabular-nums;
}

.stat-card small {
    display: block;
    margin-top: 1px;
    color: var(--text-tertiary);
    font-size: 9px;
}

.leaderboard-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.leaderboard-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

.table-search {
    display: flex;
    width: min(100%, 300px);
    height: 34px;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-subtle);
    color: var(--text-tertiary);
}

.table-search:focus-within {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.table-search svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}

.table-search input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 11px;
}

.leaderboard-meta {
    color: var(--text-tertiary);
    font-size: 10px;
}

.table-scroll {
    max-width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.data-table th {
    background: var(--bg-subtle);
    color: var(--text-tertiary);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover td {
    background: color-mix(in srgb, var(--surface-hover) 55%, transparent);
}

.data-table .numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.rank-number {
    display: inline-grid;
    width: 25px;
    height: 25px;
    place-items: center;
    border-radius: 7px;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
}

.rank-number.top-rank {
    background: var(--accent-soft);
    color: var(--accent-text);
}

.model-cell {
    display: flex;
    min-width: 220px;
    align-items: center;
    gap: 10px;
}

.model-avatar {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 750;
    text-transform: uppercase;
}

.model-cell-text {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.model-cell-text strong {
    max-width: 270px;
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    font-weight: 620;
    text-overflow: ellipsis;
}

.model-cell-text span {
    color: var(--text-tertiary);
    font-size: 9px;
}

.rating-cell {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
}

.rating-bar {
    width: 54px;
    height: 4px;
    overflow: hidden;
    border-radius: 99px;
    background: var(--bg-subtle);
}

.rating-bar > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
}

/* 95% bootstrap CI sub-line under the rating (leaderboard), like LMArena's +X/-X */
.rating-ci {
    display: block;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-tertiary);
    white-space: nowrap;
}

/* Admin: vote-feedback summary bars */
.admin-card-hint {
    margin: -0.5rem 0 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.feedback-bars {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.feedback-bar-row {
    display: grid;
    grid-template-columns: minmax(9rem, 14rem) 1fr auto;
    gap: 0.75rem;
    align-items: center;
}

.feedback-bar-label {
    font-size: 0.85rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.feedback-bar-track {
    display: block;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-subtle);
    overflow: hidden;
}

.feedback-bar-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 0.3s ease;
}

.feedback-bar-count {
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
}

@media (max-width: 640px) {
    .feedback-bar-row {
        grid-template-columns: 1fr auto;
    }

    .feedback-bar-track {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--success-soft);
    color: var(--success);
    font-size: 9px;
    font-weight: 650;
}

.status-pill::before {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.status-pill.is-inactive {
    background: var(--bg-subtle);
    color: var(--text-tertiary);
}

.table-empty,
.table-error {
    padding: 70px 20px !important;
    color: var(--text-tertiary);
    text-align: center !important;
}

.retry-button {
    display: inline-flex;
    margin-top: 10px;
    align-items: center;
    gap: 6px;
    color: var(--accent-text);
    font-size: 11px;
    font-weight: 620;
}

.retry-button svg {
    width: 13px;
    height: 13px;
}

.leaderboard-note {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 13px;
    padding: 11px 13px;
    color: var(--text-tertiary);
    font-size: 10px;
    line-height: 1.55;
}

.leaderboard-note svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    margin-top: 1px;
}

/* Informational pages */
.info-page-header {
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 25px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 590;
    text-decoration: none;
}

.back-link:hover {
    color: var(--text);
}

.back-link svg {
    width: 14px;
    height: 14px;
    transform: rotate(180deg);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.info-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.info-card-icon {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    margin-bottom: 16px;
    border-radius: 9px;
    background: var(--accent-soft);
    color: var(--accent-text);
}

.info-card-icon svg {
    width: 17px;
    height: 17px;
}

.info-card h2 {
    margin: 0 0 7px;
    font-size: 15px;
    font-weight: 650;
}

.info-card p,
.info-card li {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.65;
}

.info-card p {
    margin: 0;
}

.info-card ol,
.info-card ul {
    margin: 0;
    padding-left: 18px;
}

.info-callout {
    margin-top: 22px;
    padding: 20px;
    border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
    border-radius: 12px;
    background: var(--accent-soft);
}

.info-callout h2 {
    margin: 0 0 7px;
    color: var(--accent-text);
    font-size: 14px;
}

.info-callout p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.6;
}

/* Admin compatibility and polish */
.admin-page {
    min-height: 100vh;
    padding-top: 1px;
}

.legacy-header,
.site-header {
    display: flex;
    min-height: 56px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: blur(12px);
}

.legacy-header .logo,
.site-header .logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 14px;
    font-weight: 680;
    text-decoration: none;
}

.logo-icon {
    font-size: 18px;
}

.header-nav,
.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-nav a,
.nav-links a {
    padding: 7px 10px;
    border-radius: 7px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 550;
    text-decoration: none;
}

.header-nav a:hover,
.header-nav a.active,
.nav-links a:hover,
.nav-links a.active {
    background: var(--surface-hover);
    color: var(--text);
}

.admin-section,
.main-content.admin-main {
    width: min(100%, 1040px);
    margin: 0 auto;
    padding: 35px 25px 70px;
}

.page-title {
    margin: 0 0 22px;
    font-size: 27px;
    font-weight: 650;
    letter-spacing: -0.04em;
}

.admin-card {
    margin-bottom: 14px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.admin-card h2 {
    margin: 0 0 16px;
    font-size: 15px;
    font-weight: 650;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.form-group label {
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 620;
}

.form-group input,
.form-group select {
    width: 100%;
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: 0;
    background: var(--bg-subtle);
    color: var(--text);
    font-size: 12px;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}

.error-text,
.success-text {
    display: block;
    margin-top: 8px;
    font-size: 11px;
}

.error-text { color: var(--danger); }
.success-text { color: var(--success); }

.table-wrapper,
.table-container {
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.admin-table {
    min-width: 720px;
}

.admin-table .btn-secondary {
    min-height: 29px;
    padding: 5px 9px;
    border: 1px solid var(--border);
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-size: 10px;
}

.site-footer {
    padding: 22px;
    border-top: 1px solid var(--border);
    color: var(--text-tertiary);
    font-size: 10px;
    text-align: center;
}

.loading,
.spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
}

.loading {
    min-height: 90px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes shimmer {
    from { transform: translateX(-140%); }
    to { transform: translateX(340%); }
}

@keyframes turn-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 980px) {
    :root {
        --sidebar-width: 0px;
    }

    .sidebar {
        width: min(86vw, 280px);
        box-shadow: var(--shadow-md);
        transform: translateX(-105%);
        transition: transform 180ms ease;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-close {
        display: inline-grid !important;
    }

    .sidebar-scrim {
        position: fixed;
        z-index: 70;
        inset: 0;
        display: block;
        visibility: hidden;
        background: rgba(15, 15, 13, 0.32);
        opacity: 0;
        transition: opacity 180ms ease, visibility 180ms ease;
    }

    body.sidebar-open .sidebar-scrim {
        visibility: visible;
        opacity: 1;
    }

    .app-main {
        width: 100%;
        margin-left: 0;
    }

    .mobile-header {
        position: sticky;
        z-index: 50;
        top: 0;
        display: flex;
        height: 52px;
        align-items: center;
        justify-content: space-between;
        padding: 0 10px;
        border-bottom: 1px solid var(--border);
        background: color-mix(in srgb, var(--bg) 90%, transparent);
        backdrop-filter: blur(12px);
    }

    .mobile-brand {
        gap: 7px;
        font-size: 15px;
        font-weight: 700;
        letter-spacing: -0.03em;
    }

    .mobile-brand .brand-mark {
        width: 22px;
        height: 22px;
    }

    .battle-landing {
        min-height: calc(100vh - 52px);
        min-height: calc(100svh - 52px);
        padding-top: 48px;
    }

    .battle-workspace {
        padding-top: 27px;
    }

    .leaderboard-page,
    .standard-page {
        padding-top: 34px;
    }

    .vote-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .vote-result {
        grid-template-columns: 42px minmax(0, 1fr) auto;
    }

    .rating-results {
        grid-column: 2 / -1;
    }
}

@media (max-width: 760px) {
    .battle-landing {
        justify-content: flex-start;
        padding: 52px 16px 30px;
    }

    .battle-landing > h1 {
        font-size: clamp(36px, 12vw, 52px);
    }

    .landing-copy {
        max-width: 420px;
        margin: 13px 0 24px;
        font-size: 13px;
    }

    .suggestion-grid {
        grid-template-columns: 1fr;
    }

    .suggestion-card {
        min-height: 61px;
    }

    .composer-hint {
        display: none;
    }

    .response-grid {
        grid-template-columns: 1fr;
    }

    .response-panel {
        min-height: 290px;
    }

    .turn-prompt {
        width: 92%;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .vote-result {
        grid-template-columns: 40px minmax(0, 1fr);
    }

    .vote-result > .button {
        grid-column: 1 / -1;
    }

    .rating-results {
        grid-column: 1 / -1;
        flex-wrap: wrap;
    }
}

@media (max-width: 560px) {
    .eyebrow {
        margin-bottom: 10px;
    }

    .landing-copy {
        margin-bottom: 20px;
    }

    .prompt-composer {
        border-radius: 13px;
    }

    .prompt-composer > textarea {
        min-height: 108px;
        padding: 16px 15px 7px;
        font-size: 15px;
    }

    .composer-topline {
        min-height: 43px;
        padding: 6px 9px;
    }

    .composer-footer {
        min-height: 46px;
        padding-left: 14px;
    }

    .suggestions {
        margin-top: 24px;
    }

    .suggestion-card:nth-child(n+4) {
        display: none;
    }

    .landing-footnote {
        margin-top: 19px;
    }

    .battle-workspace {
        padding: 22px 12px 50px;
    }

    .battle-toolbar {
        align-items: flex-start;
    }

    .battle-toolbar h1 {
        font-size: 20px;
    }

    .battle-toolbar .category-pill {
        display: none;
    }

    .battle-toolbar .button {
        min-width: 36px;
        padding: 8px;
        font-size: 0;
    }

    .battle-toolbar .button svg {
        width: 16px;
        height: 16px;
    }

    .turn-prompt {
        width: 95%;
    }

    .followup-section,
    .vote-panel,
    .vote-result {
        padding: 14px;
    }

    .followup-heading,
    .vote-heading {
        flex-direction: column;
        gap: 5px;
    }

    .vote-heading > p {
        text-align: left;
    }

    .vote-grid {
        grid-template-columns: 1fr;
    }

    .vote-button {
        min-height: 58px;
    }

    .leaderboard-page,
    .standard-page {
        padding: 27px 14px 55px;
    }

    .page-tabs {
        overflow-x: auto;
    }

    .page-tab {
        white-space: nowrap;
    }

    .stats-grid {
        gap: 7px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-card strong {
        font-size: 17px;
    }

    .leaderboard-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .table-search {
        width: 100%;
    }

    .leaderboard-meta {
        display: flex;
        justify-content: space-between;
    }

    .rating-bar {
        display: none;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Model page: recent battle rows (assets/model.js) */
.battle-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.battle-item:last-child {
    border-bottom: none;
}

.battle-item-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.battle-outcome {
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 4.5rem;
}

.battle-opponent {
    font-weight: 500;
    color: var(--text);
}

.battle-prompt {
    font-size: 0.875rem;
    color: var(--text-secondary);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.battle-meta {
    font-size: 0.78rem;
    color: var(--text-tertiary);
}

/* ==========================================================================
   Composer style controls
   The temperature dial and style-prompt panel. Built from the same tokens as
   the rest of the composer so it inherits both themes for free.
   ========================================================================== */

.style-toggle {
    display: inline-flex;
    height: 31px;
    align-items: center;
    gap: 6px;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font: inherit;
    font-size: 12px;
    font-weight: 580;
    cursor: pointer;
    white-space: nowrap;
}

.style-toggle > svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}

.style-toggle:hover {
    background: var(--surface-hover);
    color: var(--text);
}

/* A non-default setting stays visible once the panel is collapsed. */
.style-toggle[aria-expanded="true"] {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-text);
}

.style-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.style-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-subtle);
}

.style-panel[hidden] {
    display: none;
}

.style-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.style-label {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 580;
}

.style-select {
    position: relative;
    display: inline-flex;
    width: 100%;
    height: 34px;
    align-items: center;
    padding: 0 30px 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}

.style-select .select-chevron {
    position: absolute;
    right: 9px;
    width: 13px;
    height: 13px;
    pointer-events: none;
    color: var(--text-tertiary);
}

.style-select select {
    width: 100%;
    min-width: 0;
    appearance: none;
    border: 0;
    outline: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 13px;
    font-weight: 560;
    cursor: pointer;
}

.style-panel textarea {
    width: 100%;
    min-height: 58px;
    resize: vertical;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: 0;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    line-height: 1.5;
}

.style-panel textarea::placeholder {
    color: var(--text-tertiary);
}

.style-panel textarea:focus,
.style-select:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.style-hint {
    color: var(--text-tertiary);
    font-size: 11px;
    line-height: 1.45;
}

#style-prompt-count {
    text-align: right;
}

.style-panel input[type="range"] {
    width: 100%;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.style-value {
    color: var(--text);
    font-size: 13px;
    font-weight: 620;
    font-variant-numeric: tabular-nums;
}

/* The temperature row needs the slider and its readout side by side. */
.style-row:has(input[type="range"]) {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    column-gap: 12px;
}

.style-row:has(input[type="range"]) .style-label {
    grid-column: 1 / -1;
}

.style-row:has(input[type="range"]) .style-hint {
    grid-column: 1 / -1;
}

/* Narrow viewports: let the toggle label wrap instead of overflowing. */
@media (max-width: 560px) {
    .composer-topline {
        flex-wrap: wrap;
    }

    .style-toggle {
        order: 3;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .style-panel {
        animation: style-panel-in 140ms ease-out;
    }
}

@keyframes style-panel-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* ==========================================================================
   Post-vote feedback
   The "why did you pick that one?" panel. Advisory only: it never changes a
   rating, so it is visually quieter than the vote result itself.
   ========================================================================== */

.feedback {
    width: 100%;
    margin-top: 4px;
    border-top: 1px solid var(--border);
    padding-top: 4px;
}

.feedback-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 2px;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 13px;
    font-weight: 560;
    text-align: left;
    cursor: pointer;
}

.feedback-toggle:hover {
    color: var(--text);
}

.feedback-toggle > svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    color: var(--text-tertiary);
    transition: transform 140ms ease;
}

.feedback-toggle[aria-expanded="true"] > svg {
    transform: rotate(180deg);
}

.feedback-toggle:disabled {
    cursor: default;
    opacity: 0.6;
}

.feedback-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.feedback-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 2px 2px 8px;
}

.feedback-panel[hidden] {
    display: none;
}

.feedback-hint {
    color: var(--text-tertiary);
    font-size: 11px;
    line-height: 1.45;
}

.feedback-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.feedback-option {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    user-select: none;
}

.feedback-option:hover {
    background: var(--surface-hover);
    color: var(--text);
}

/* The chip is highlighted from the checkbox, so there is no extra JS to keep
   the visual state and the form state in step. */
.feedback-option:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-text);
}

.feedback-option:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.feedback-option input {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: var(--accent);
    cursor: inherit;
}

.feedback-option input:disabled {
    cursor: default;
}

.feedback-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.feedback-status {
    color: var(--text-tertiary);
    font-size: 11px;
}

.feedback-status:not(:empty) {
    color: var(--text-secondary);
}

@media (prefers-reduced-motion: reduce) {
    .feedback-toggle > svg {
        transition: none;
    }
}

/* ==========================================================================
   Documentation pages (FAQ, Blog, Datasets)
   Long-form prose. A single measure keeps the line length readable; headings,
   links and lists share the same tokens as the rest of the app.
   ========================================================================== */

.doc-page {
    padding: 40px 34px 76px;
}

.doc-page .page-width.narrow {
    max-width: 800px;
    margin: 0 auto;
}

.doc-page .page-lede {
    max-width: 640px;
    margin: 12px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.doc-toc {
    margin: 28px 0 8px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-subtle);
}

.doc-toc-label {
    margin: 0 0 8px;
    color: var(--text-tertiary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.doc-toc ul {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.doc-toc a {
    display: inline-block;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 560;
    text-decoration: none;
}

.doc-toc a:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

.doc-section {
    margin: 34px 0 0;
}

.doc-section h2 {
    margin: 0 0 12px;
    font-size: 19px;
    font-weight: 650;
    letter-spacing: -0.02em;
    /* Offset for the sticky-free layout, but keeps the heading clear of the
       viewport edge when a TOC link jumps to it. */
    scroll-margin-top: 20px;
}

.doc-footer {
    margin: 40px 0 0;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    color: var(--text-tertiary);
    font-size: 13px;
}

.doc-footer a,
.doc-page a:not(.doc-toc a) {
    color: var(--accent-text);
}

/* ------------------------------------------------------------------ FAQ */

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    overflow: hidden;
}

.faq-item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    color: var(--text);
    font-size: 14px;
    font-weight: 580;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary:hover {
    background: var(--surface-hover);
}

.faq-item summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.faq-item summary > svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    color: var(--text-tertiary);
    transition: transform 150ms ease;
}

.faq-item[open] summary > svg {
    transform: rotate(180deg);
}

.faq-item[open] {
    border-color: var(--border-strong);
}

.faq-answer {
    padding: 0 16px 16px;
    color: var(--text-secondary);
    font-size: 13.5px;
    line-height: 1.65;
}

.faq-answer p {
    margin: 0;
}

/* ------------------------------------------------------------------ Blog */

.post-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 24px 0 0;
    /* The divider is drawn on the li, not the card, so a hovered card does not
       erase the rule underneath it. */
    border-top: 1px solid var(--border);
}

.post-card {
    display: grid;
    grid-template-columns: 108px 1fr;
    gap: 18px;
    padding: 22px 4px;
    border-bottom: 1px solid var(--border);
    color: inherit;
    text-decoration: none;
}

.post-card:hover .post-title {
    color: var(--accent-text);
}

.post-card:hover {
    background: var(--surface-hover);
}

.post-meta {
    color: var(--text-tertiary);
    font-size: 11.5px;
    line-height: 1.5;
}

.post-date {
    display: block;
    font-variant-numeric: tabular-nums;
    font-weight: 560;
}

.post-title {
    margin: 0;
    font-size: 16px;
    font-weight: 620;
    letter-spacing: -0.015em;
    line-height: 1.35;
    transition: color 120ms ease;
}

.post-excerpt {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 13.5px;
    line-height: 1.6;
}

.post-tag {
    display: inline-block;
    margin-top: 9px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-text);
    font-size: 10.5px;
    font-weight: 640;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

@media (max-width: 640px) {
    .doc-page {
        padding: 28px 18px 60px;
    }

    .post-card {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .faq-item summary > svg,
    .post-title {
        transition: none;
    }
}

/* ==========================================================================
   Dataset page components
   The category breakdown, the field table and the export snippets. Scoped
   under .doc-page so nothing here can leak into the battle UI.
   ========================================================================== */

.doc-page .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 18px 0 4px;
}

.doc-page .stat-value {
    display: block;
    font-size: 26px;
    font-weight: 660;
    letter-spacing: -0.035em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.doc-page .stat-label {
    display: block;
    margin-top: 3px;
    color: var(--text-tertiary);
    font-size: 9px;
    font-weight: 650;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

/* --- Category bars ------------------------------------------------------ */

.bar-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.bar-row {
    display: grid;
    grid-template-columns: minmax(96px, 152px) minmax(0, 1fr) 46px;
    align-items: center;
    gap: 12px;
}

.bar-label {
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 560;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-track {
    height: 8px;
    border-radius: 999px;
    background: var(--bg-subtle);
    overflow: hidden;
}

.bar-fill {
    display: block;
    height: 100%;
    min-width: 3px;
    border-radius: inherit;
    background: var(--accent);
    transition: width 0.32s ease;
}

.bar-value {
    color: var(--text-tertiary);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* --- Field table -------------------------------------------------------- */

.doc-page .table-scroll {
    margin: 16px 0 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.doc-page .data-table th,
.doc-page .data-table td {
    padding: 9px 13px;
    font-size: 12.5px;
    vertical-align: top;
}

.doc-page .data-table th[scope="row"] {
    background: transparent;
    color: var(--text);
    font-weight: 560;
    white-space: nowrap;
}

.doc-page .data-table code {
    font-size: 11.5px;
}

/* --- Pills -------------------------------------------------------------- */

.pill {
    display: inline-block;
    padding: 2px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 640;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.pill-safe {
    border-color: var(--success);
    background: var(--success-soft);
    color: var(--success);
}

.pill-warn {
    border-color: var(--warning);
    background: var(--warning-soft);
    color: var(--warning);
}

/* --- Notes, lists, code ------------------------------------------------- */

.doc-note {
    margin: 14px 0 0;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-size: 12.5px;
    line-height: 1.6;
}

.doc-note strong {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.doc-page ul.doc-list {
    margin: 14px 0 0;
    padding-left: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.65;
}

.doc-page ul.doc-list li + li {
    margin-top: 6px;
}

.code-block {
    margin: 14px 0 0;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.7;
    overflow-x: auto;
    white-space: pre;
}

.doc-page .page-hero.compact {
    padding-bottom: 4px;
}

@media (max-width: 640px) {
    .doc-page .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .bar-row {
        grid-template-columns: minmax(74px, 104px) minmax(0, 1fr) 38px;
        gap: 9px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bar-fill {
        transition: none;
    }
}

/* ==========================================================================
   Shared battle page (battle.php)
   Read-only rendering of one voted (or in-flight) battle. Reuses the
   response-panel grid; only the header/meta chrome is share-specific.
   ========================================================================== */

.share-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px 20px;
    margin-bottom: 6px;
}

.share-header h1 {
    margin: 6px 0 0;
    font-size: 24px;
    letter-spacing: -0.02em;
}

.share-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.share-meta-item {
    display: inline-block;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 560;
    white-space: nowrap;
}

.share-turns {
    display: flex;
    flex-direction: column;
    gap: 22px;
    margin-top: 18px;
}

.share-turns .battle-turn {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.share-note {
    margin: 18px 0 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-subtle);
}

.share-note summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 640;
}

.share-note p {
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 12.5px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.share-section {
    margin-top: 22px;
}

.pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.text-muted {
    color: var(--text-tertiary);
}

.response-error {
    color: var(--danger);
    font-size: 13px;
}

@media (max-width: 640px) {
    .share-header h1 {
        font-size: 20px;
    }
}

/* Vote-result share row */
.result-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.result-share {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.result-share[hidden] {
    display: none;
}

/* LMArena-parity arenas: media, citations, uploads, filters. */
.response-media { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.response-media img { width: 100%; border-radius: 10px; border: 1px solid var(--border, #e5e5e0); object-fit: cover; }
.citations { margin-top: 12px; padding: 10px 12px; border-top: 1px solid var(--border, #e5e5e0); font-size: 0.85em; }
.citations ol { margin: 6px 0 0 18px; padding: 0; }
.citations small { opacity: 0.75; }
.composer-attachments { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.attach-button { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 0.9em; opacity: 0.85; }
.pending-images { display: flex; gap: 8px; }
.pending-images img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.leaderboard-filters { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; }
.filter-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.85em; }
.page-tabs-sub { margin-top: -8px; }
.page-tabs-sub .page-tab { font-size: 0.9em; }

/* ==========================================================================
   Multimodal battle components (vision / image / search / webdev arenas)
   Uploads, generated images, citation lists and the sandboxed HTML preview.
   ========================================================================== */

.attachment-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 10px 0 0;
}

.attachment-bar[hidden] {
    display: none;
}

.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.attachment-item {
    position: relative;
    width: 64px;
    height: 64px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-subtle);
}

.attachment-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attachment-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.attachment-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border: 1px dashed var(--border-strong);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 560;
    cursor: pointer;
}

.attachment-button:hover {
    border-color: var(--accent);
    color: var(--text);
}

.attachment-button svg {
    width: 15px;
    height: 15px;
}

.response-media {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.response-image {
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-subtle);
}

.response-image img {
    display: block;
    width: 100%;
    height: auto;
}

.citations {
    margin-top: 12px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-subtle);
    font-size: 12.5px;
}

.citations summary {
    cursor: pointer;
    font-weight: 640;
}

.citations ol {
    margin: 8px 0 0;
    padding-left: 20px;
}

.citations li + li {
    margin-top: 6px;
}

.citations a {
    font-weight: 560;
    overflow-wrap: anywhere;
}

.citations p {
    margin: 2px 0 0;
    color: var(--text-secondary);
}

.web-preview {
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.web-preview summary {
    padding: 9px 14px;
    background: var(--bg-subtle);
    font-size: 12.5px;
    font-weight: 640;
    cursor: pointer;
}

.web-preview-frame {
    display: block;
    width: 100%;
    height: 420px;
    border: none;
    border-top: 1px solid var(--border);
    background: #fff;
}

.category-select.is-locked {
    opacity: 0.75;
}

@media (max-width: 640px) {
    .web-preview-frame {
        height: 320px;
    }
}

/* Search directory type badge */
.status-pill.is-type {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-text);
}

/* Media + citations (vision / image / video / search arenas). */
.response-media { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.response-media .response-image { margin: 0; }
.response-media img, .response-media video { width: 100%; border-radius: 10px; border: 1px solid var(--border, #e5e5e0); object-fit: cover; display: block; }
.response-media video { background: #000; }
.citations { margin-top: 12px; font-size: 0.85em; opacity: 0.95; }
.citations ol { margin: 6px 0 0 18px; padding: 0; }
.citations small { opacity: 0.75; }
.attachment-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.attachment-list { display: flex; gap: 8px; list-style: none; margin: 0; padding: 0; }
.attachment-item img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
