/* ===== CSS Custom Properties ===== */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: #1a2035;
    --bg-card-hover: #1f2847;
    --bg-input: #0d1220;
    --bg-bubble-user: #2563eb;
    --bg-bubble-assistant: #1e293b;
    --bg-thinking: #1a1a2e;
    --bg-tool: #0f1a2e;
    --bg-drop: rgba(37, 99, 235, 0.08);
    --bg-glass: rgba(26, 32, 53, 0.85);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #60a5fa;

    --border-color: rgba(148, 163, 184, 0.12);
    --border-focus: #3b82f6;

    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme */
body.light {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #d2d6db;
    --bg-input: #f1f5f9;
    --bg-bubble-user: #2563eb;
    --bg-bubble-assistant: #dde1e5;
    --bg-thinking: #fef3c7;
    --bg-tool: #ecfdf5;
    --bg-drop: rgba(37, 99, 235, 0.06);
    --bg-glass: rgba(255, 255, 255, 0.9);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-accent: #2563eb;

    --border-color: rgba(15, 23, 42, 0.1);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.08);
}

body.light .bubble-assistant {
    color: var(--text-primary);
}

body.light .thinking-content,
body.light .tool-call-content {
    color: var(--text-primary);
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background var(--transition-normal), color var(--transition-normal);
}

code {
    font-family: var(--font-mono);
    background: rgba(59, 130, 246, 0.15);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
    color: var(--text-accent);
}

/* ===== Upload Screen ===== */
.upload-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: var(--bg-primary);
    background-image: radial-gradient(circle at 30% 20%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
}

.upload-container {
    text-align: center;
    max-width: 480px;
    width: 100%;
    animation: fadeInUp 0.6s var(--transition-slow);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.upload-logo {
    margin-bottom: 1.5rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.upload-container h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.upload-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1rem;
}

.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    background: var(--bg-drop);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent-blue);
    background: rgba(37, 99, 235, 0.12);
    box-shadow: var(--shadow-glow);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
}

.drop-zone-content svg {
    opacity: 0.6;
}

.drop-zone-or {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-browse {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius-full);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-browse:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}

.upload-error {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    color: var(--accent-red);
    font-size: 0.9rem;
}

/* ===== Top Bar ===== */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.top-bar-title {
    font-weight: 700;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-icon {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    border-color: var(--accent-blue);
    color: var(--text-accent);
    background: rgba(59, 130, 246, 0.1);
}

.btn-theme {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.btn-theme:hover {
    border-color: var(--accent-blue);
    color: var(--text-accent);
}

.theme-icon {
    font-size: 1rem;
}

/* Toggle buttons for thinking/tools */
.btn-toggle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.35rem 0.7rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.btn-toggle:hover {
    border-color: var(--accent-blue);
    color: var(--text-secondary);
}

.btn-toggle.toggle-active {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.15);
    color: var(--text-accent);
}

/* ===== Tab Navigation (inline in header) ===== */
.tab-nav {
    display: flex;
    gap: 0;
    margin-left: 1.5rem;
}

.tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    padding: 0.5rem 0.9rem;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

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

.tab-btn.active {
    color: var(--text-accent);
    border-bottom-color: var(--accent-blue);
}

.tab-content {
    display: none;
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ===== Prompt Section ===== */
.prompt-section {
    margin-bottom: 1.5rem;
}

.prompt-card {
    background: var(--bg-bubble-user);
    color: white;
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    line-height: 1.7;
    box-shadow: var(--shadow-md);
    position: relative;
}

.prompt-card::before {
    content: 'Initial Prompt';
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.7;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

/* ===== Overview Grid ===== */
.overview-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.overview-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.overview-card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: var(--shadow-glow);
}

.overview-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    cursor: pointer;
    user-select: none;
}

.overview-card-title {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-accent);
}

.overview-card-toggle {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: transform var(--transition-fast);
}

.overview-card.expanded .overview-card-toggle {
    transform: rotate(180deg);
}

.overview-card-body {
    padding: 0 1.25rem 1.25rem;
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.75;
    display: none;
    white-space: pre-wrap;
}

.overview-card.expanded .overview-card-body {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Source Section ===== */
.source-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.source-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.source-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 100px;
}

.source-value {
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.source-value a {
    color: var(--text-accent);
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

.source-value a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* ===== Model Tabs ===== */
.model-tabs {
    display: flex;
    gap: 0.75rem;
    padding-bottom: 1.25rem;
    overflow-x: auto;
    scrollbar-width: thin;
}

.model-tab {
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.25rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    min-width: 180px;
}

.model-tab:hover {
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.model-tab.active {
    border-color: var(--accent-blue);
    background: rgba(37, 99, 235, 0.1);
    box-shadow: var(--shadow-glow);
}

.model-tab-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.model-tab-model {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.model-tab-stat {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.model-tab-stat-label {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.model-tab-stat-value {
    font-weight: 600;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.model-tab-score {
    color: var(--accent-green);
    font-weight: 700;
}

/* ===== Trace Container ===== */
.trace-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.trace-message-info {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0 0.5rem;
    margin-bottom: -0.25rem;
}

/* ===== Chat Bubbles ===== */
.bubble-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.15rem;
}

.bubble-row-user {
    align-items: flex-end;
}

.bubble-row-assistant {
    align-items: flex-start;
}

.bubble {
    max-width: 85%;
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-md);
    font-size: 1.05rem;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.bubble-user {
    background: var(--bg-bubble-user);
    color: white;
    border-bottom-right-radius: var(--radius-sm);
}

.bubble-assistant {
    background: var(--bg-bubble-assistant);
    color: var(--text-primary);
    border-bottom-left-radius: var(--radius-sm);
}

.bubble-role-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
    color: var(--text-muted);
    padding: 0 0.25rem;
}

.bubble-role-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.dot-user {
    background: var(--accent-blue);
}

.dot-assistant {
    background: var(--accent-purple);
}

/* ===== Trace detail rows (thinking/tool) ===== */
.trace-detail-row {
    margin: 0.15rem 0;
    max-width: 85%;
}

.trace-hidden {
    display: none !important;
}

/* ===== Thinking Block ===== */
.thinking-block {
    background: var(--bg-thinking);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: var(--radius-md);
    margin: 0.5rem 0;
    overflow: hidden;
}

.thinking-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-orange);
    transition: background var(--transition-fast);
}

.thinking-header:hover {
    background: rgba(251, 191, 36, 0.08);
}

.thinking-header svg {
    flex-shrink: 0;
}

.thinking-toggle {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.thinking-block.expanded .thinking-toggle {
    transform: rotate(180deg);
}

.thinking-content {
    display: none;
    padding: 0.75rem 1rem 1rem;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-secondary);
    border-top: 1px solid rgba(251, 191, 36, 0.15);
    white-space: pre-wrap;
}

.thinking-block.expanded .thinking-content {
    display: block;
    animation: slideDown 0.2s ease;
}

/* ===== Tool Call Block ===== */
.tool-call-block {
    background: var(--bg-tool);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: var(--radius-md);
    margin: 0.5rem 0;
    overflow: hidden;
}

.tool-call-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-green);
    transition: background var(--transition-fast);
}

.tool-call-header:hover {
    background: rgba(34, 197, 94, 0.08);
}

.tool-call-name {
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

.tool-call-toggle {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.tool-call-block.expanded .tool-call-toggle {
    transform: rotate(180deg);
}

.tool-call-content {
    display: none;
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid rgba(34, 197, 94, 0.15);
}

.tool-call-block.expanded .tool-call-content {
    display: block;
    animation: slideDown 0.2s ease;
}

.tool-call-section-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    margin-top: 0.75rem;
}

.tool-call-section-label:first-child {
    margin-top: 0;
}

.tool-call-json {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--text-secondary);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
}

.tool-call-error {
    color: var(--accent-red);
}

/* ===== Rubric Container ===== */
.rubric-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rubric-summary-bar {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.rubric-summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.rubric-summary-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.rubric-summary-value {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.1rem;
}

.rubric-summary-value.score-positive {
    color: var(--accent-green);
}

.rubric-summary-value.score-mixed {
    color: var(--accent-orange);
}

.rubric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    transition: all var(--transition-fast);
}

.rubric-card:hover {
    border-color: rgba(59, 130, 246, 0.2);
}

.rubric-card-top {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.rubric-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-accent);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
}

.rubric-title {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.5;
    flex: 1;
}

.rubric-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.rubric-weight {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    background: rgba(59, 130, 246, 0.15);
    color: var(--text-accent);
}

.rubric-weight.negative {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.rubric-category {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    background: rgba(139, 92, 246, 0.12);
    color: var(--accent-purple);
    white-space: nowrap;
}

.rubric-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.rubric-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.25rem 0.7rem;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.rubric-badge.present {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.rubric-badge.not-present {
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-red);
}

.rubric-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.rubric-badge.present .rubric-badge-dot {
    background: var(--accent-green);
}

.rubric-badge.not-present .rubric-badge-dot {
    background: var(--accent-red);
}

.rubric-justification {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    flex: 1;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .tab-content {
        padding: 1rem;
    }

    .model-tabs {
        gap: 0.5rem;
    }

    .model-tab {
        min-width: 140px;
        padding: 0.65rem 0.85rem;
    }

    .bubble {
        max-width: 95%;
    }

    .rubric-card-top {
        flex-direction: column;
    }

    .rubric-rating {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ===== Loading State ===== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
    gap: 0.75rem;
}

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

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

/* ===== Token formatting ===== */
.token-count {
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

/* ===== All Models Comparison (Rubrics Tab) ===== */
.rubric-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.rubric-comparison-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-card);
}

.rubric-comparison-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

/* ===== Floating Scroll-to-Top Button ===== */
.fab-scroll-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
    opacity: 0;
    pointer-events: none;
    z-index: 200;
}

.fab-scroll-top.visible {
    opacity: 1;
    pointer-events: auto;
}

.fab-scroll-top:hover {
    border-color: var(--accent-blue);
    color: var(--text-accent);
    background: rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}