/* === Base === */
:root, [data-theme="dark"] {
    --bg: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-input: #16213e;
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --border: #2d2d44;
    --gpt: #10a37f;
    --claude: #d97706;
    --gemini: #4285f4;
    --synthesis: #8b5cf6;
    --radius: 12px;
}
[data-theme="light"] {
    --bg: #f5f5f5;
    --bg-card: #ffffff;
    --bg-input: #f0f0f0;
    --text: #1a1a2e;
    --text-dim: #64748b;
    --border: #d1d5db;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Nav === */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 200;
}
.nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.hamburger-btn {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 7px;
    transition: border-color 0.2s;
}
.hamburger-btn:hover { border-color: var(--text-dim); }
.hamburger-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-dim);
    border-radius: 1px;
    transition: background 0.2s;
}
.hamburger-btn:hover span { background: var(--text); }

.nav-logo img { display: block; }

.nav-links { display: flex; gap: 24px; }

.nav-link {
    color: var(--text-dim);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: color 0.2s;
}
.nav-link:hover, .nav-link.active { color: var(--text); }

/* === Layout === */
.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px;
    flex: 1;
}

.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-dim);
    font-size: 13px;
    border-top: 1px solid var(--border);
}

/* === Hero === */
.hero {
    text-align: center;
    margin-bottom: 32px;
}
.hero h1 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gpt), var(--claude), var(--gemini));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-sub {
    color: var(--text-dim);
    margin-top: 8px;
    font-size: 15px;
}

/* === Input === */
.input-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.input-card textarea {
    width: 100%;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    font-family: inherit;
    font-size: 15px;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}
.input-card textarea:focus { border-color: var(--gemini); }
.input-card textarea::placeholder { color: var(--text-dim); }

.input-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
}

/* === Options Grid === */
.options-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 16px;
}
.option-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.option-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.option-group select {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
    cursor: pointer;
}
.option-group select:focus { border-color: var(--gemini); }

/* === Participants === */
.participants-section {
    margin-top: 16px;
}
.participants-section > label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: block;
    margin-bottom: 8px;
}
.participants-checkboxes {
    display: flex;
    gap: 12px;
}
.participant-check {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    transition: border-color 0.2s;
    font-size: 13px;
}
.participant-check:hover { border-color: var(--text-dim); }
.participant-check input[type="checkbox"] {
    accent-color: var(--gemini);
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.gpt-check:has(input:checked) { border-color: var(--gpt); }
.claude-check:has(input:checked) { border-color: var(--claude); }
.gemini-check:has(input:checked) { border-color: var(--gemini); }

.input-hint {
    font-size: 12px;
    color: var(--text-dim);
}

@media (max-width: 900px) {
    .options-grid { grid-template-columns: repeat(2, 1fr); }
    .participants-checkboxes { flex-direction: column; }
}

/* === Buttons === */
.btn-primary {
    background: linear-gradient(135deg, var(--gpt), var(--gemini));
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 28px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 28px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: border-color 0.2s;
}
.btn-secondary:hover { border-color: var(--text-dim); }

.btn-danger {
    background: transparent;
    color: #ef4444;
    border: 1px solid #ef444444;
    border-radius: 6px;
    padding: 4px 12px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}
.btn-danger:hover { background: #ef444422; }

/* === Spinner === */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Arena === */
.arena-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.round-header {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dim);
}
.cost-display {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
}
.cost-total {
    color: var(--claude);
    font-weight: 600;
    background: rgba(217,119,6,0.12);
    padding: 3px 10px;
    border-radius: 6px;
}
.cost-model {
    color: var(--text-dim);
}

/* === Initial question === */
.arena-question {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--gemini);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
}
.arena-question-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gemini);
    margin-bottom: 8px;
}
.arena-question-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
}
.arena-question-text p { margin-bottom: 6px; }

.arena-original-q {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}
.arena-original-q summary {
    font-size: 12px;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px 0;
}
.arena-original-q summary:hover { color: var(--text); }
.arena-original-q-text {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
    padding: 10px 12px;
    background: var(--bg-input);
    border-radius: 8px;
}
.arena-original-q-text p { margin-bottom: 4px; }

/* === Rounds timeline === */
.rounds-timeline {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.round-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
}
.round-accordion-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.round-accordion-header:hover { background: rgba(255,255,255,0.03); }
.round-toggle-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dim);
    background: var(--bg-input);
    border-radius: 4px;
    flex-shrink: 0;
}
.round-accordion-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.round-cost-badge {
    margin-left: auto;
    font-size: 11px;
    color: var(--claude);
    background: rgba(217,119,6,0.1);
    padding: 2px 10px;
    border-radius: 10px;
}
.round-cost-badge:empty { display: none; }

.round-header-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.round-meta-chip {
    font-size: 11px;
    color: var(--text-dim);
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 8px;
}
.round-model-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.gpt-dot { background: var(--gpt); }
.claude-dot { background: var(--claude); }
.gemini-dot { background: var(--gemini); }

/* Round preview snippets in accordion header */
.round-previews {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
.round-preview-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.round-preview-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}
.round-preview-text {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.4;
    font-weight: 400;
}

/* Moderator badge */
.moderator-badge {
    font-size: 12px;
    color: var(--synthesis);
    background: rgba(139,92,246,0.12);
    padding: 3px 12px;
    border-radius: 6px;
    font-weight: 500;
}
.round-accordion-body {
    padding: 0 12px 12px;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    max-height: 5000px;
    opacity: 1;
}
.round-section.collapsed .round-accordion-body {
    max-height: 0;
    opacity: 0;
    padding: 0 12px;
    overflow: hidden;
}

.models-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.model-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.model-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
}
.model-header.gpt { background: rgba(16, 163, 127, 0.15); border-bottom: 2px solid var(--gpt); }
.model-header.claude { background: rgba(217, 119, 6, 0.15); border-bottom: 2px solid var(--claude); }
.model-header.gemini { background: rgba(66, 133, 244, 0.15); border-bottom: 2px solid var(--gemini); }

.model-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}
.model-header.gpt .model-dot { background: var(--gpt); }
.model-header.claude .model-dot { background: var(--claude); }
.model-header.gemini .model-dot { background: var(--gemini); }

.model-status {
    margin-left: auto;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-dim);
}

.model-content {
    padding: 16px;
    font-size: 14px;
    line-height: 1.7;
    max-height: 500px;
    overflow-y: auto;
    flex: 1;
}
.model-content p { margin-bottom: 10px; }
.model-content ul, .model-content ol { margin: 8px 0 8px 20px; }
.model-content strong { color: #fff; }
.model-content code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}
.model-content pre {
    background: var(--bg-input);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}
.model-content h1, .model-content h2, .model-content h3 {
    font-size: 15px;
    margin: 12px 0 6px;
}

/* Thinking indicator */
.thinking {
    display: flex;
    gap: 4px;
    padding: 16px;
}
.thinking span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-dim);
    animation: pulse 1.2s ease-in-out infinite;
}
.thinking span:nth-child(2) { animation-delay: 0.2s; }
.thinking span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1); }
}

/* === Synthesis === */
.synthesis-section {
    background: var(--bg-card);
    border: 2px solid var(--synthesis);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 24px;
}
.synthesis-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: rgba(139, 92, 246, 0.15);
    font-weight: 700;
    font-size: 16px;
    color: var(--synthesis);
}
.synthesis-status {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-dim);
}
.synthesis-content {
    padding: 20px;
    font-size: 15px;
    line-height: 1.7;
}
.synthesis-content p { margin-bottom: 10px; }
.synthesis-content ul, .synthesis-content ol { margin: 8px 0 8px 20px; }
.synthesis-content strong { color: #fff; }
.synthesis-content h1, .synthesis-content h2, .synthesis-content h3 {
    font-size: 16px;
    margin: 14px 0 8px;
}

/* === Arena Actions === */
.arena-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* === History === */
.history-table {
    width: 100%;
    border-collapse: collapse;
}
.history-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
}
.history-table td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}
.history-table tr:hover td { background: rgba(255,255,255,0.02); }

.history-table a {
    color: var(--gemini);
    text-decoration: none;
}
.history-table a:hover { text-decoration: underline; }

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.badge-complete { background: rgba(16, 163, 127, 0.2); color: var(--gpt); }
.badge-running { background: rgba(66, 133, 244, 0.2); color: var(--gemini); }
.badge-error { background: rgba(239, 68, 68, 0.2); color: #ef4444; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
}

/* === Session replay === */
.session-meta {
    margin-bottom: 24px;
    color: var(--text-dim);
    font-size: 14px;
}
.session-meta strong { color: var(--text); }

.round-divider {
    text-align: center;
    margin: 32px 0 20px;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-dim);
    position: relative;
}
.round-divider::before, .round-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 30%;
    height: 1px;
    background: var(--border);
}
.round-divider::before { left: 0; }
.round-divider::after { right: 0; }

/* === Login === */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 40px 20px;
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
}
.login-header {
    text-align: center;
    margin-bottom: 28px;
}
.login-sub {
    color: var(--text-dim);
    font-size: 14px;
    margin-top: 10px;
}
.login-error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}
.form-group {
    margin-bottom: 18px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
    margin-bottom: 6px;
}
.form-group input[type="text"],
.form-group input[type="password"] {
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}
.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
    border-color: var(--gemini);
}
.login-card .btn-primary {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 12px;
    padding: 12px 28px;
    font-size: 16px;
}

/* === Model Actions (vote, copy) === */
.model-actions {
    display: flex;
    gap: 6px;
    padding: 8px 16px;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.15);
}
.vote-btn, .copy-btn {
    background: var(--bg-input);
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 10px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.vote-btn:hover { color: var(--text); border-color: var(--text-dim); }
.copy-btn:hover { color: var(--text); border-color: var(--text-dim); }
.copy-btn { margin-left: auto; }

.model-badge {
    font-size: 10px;
    font-weight: 500;
    background: rgba(139,92,246,0.2);
    color: var(--synthesis);
    padding: 2px 8px;
    border-radius: 10px;
}
.model-badge:empty { display: none; }

.model-cost-badge {
    font-size: 10px;
    color: var(--text-dim);
    margin-left: auto;
    margin-right: 4px;
}
.model-cost-badge:empty { display: none; }

/* === Temperature Slider === */
.temp-slider {
    display: flex;
    align-items: center;
    gap: 8px;
}
.temp-slider input[type="range"] {
    flex: 1;
    accent-color: var(--gemini);
    height: 4px;
}
.temp-slider span {
    font-size: 13px;
    color: var(--text);
    min-width: 24px;
}

/* === Advanced Section === */
.advanced-section {
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.advanced-section summary {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-dim);
    cursor: pointer;
    background: var(--bg-input);
}
.advanced-section summary:hover { color: var(--text); }
.advanced-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.advanced-content textarea {
    width: 100%;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
}
.advanced-content textarea:focus { border-color: var(--gemini); }
.advanced-content input[type="text"] {
    width: 100%;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}
.advanced-content input[type="text"]:focus { border-color: var(--gemini); }

/* === Follow-up === */
.followup-section {
    margin-bottom: 24px;
}
.followup-section textarea {
    box-sizing: border-box;
}
.followup-attachments {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    flex-wrap: wrap;
}

/* === Tags === */
.tag {
    display: inline-block;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 13px;
    text-decoration: none;
    transition: border-color 0.2s;
}
.tag:hover { border-color: var(--gemini); }
.tag-count {
    font-size: 11px;
    color: var(--text-dim);
    margin-left: 4px;
}
.tag-sm {
    display: inline-block;
    background: var(--bg-input);
    color: var(--text-dim);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    text-decoration: none;
}
.tag-sm:hover { color: var(--text); }
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* === Dashboard === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
}
.stat-value {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gpt), var(--gemini));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-label {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 4px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.dash-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.dash-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}
.empty-text {
    font-size: 13px;
    color: var(--text-dim);
}

/* Bar chart */
.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label { font-size: 12px; color: var(--text-dim); min-width: 120px; }
.bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s;
}
.gpt-bar { background: var(--gpt); }
.claude-bar { background: var(--claude); }
.gemini-bar { background: var(--gemini); }
.bar-value { font-size: 12px; color: var(--text-dim); min-width: 40px; text-align: right; }

/* Recent list */
.recent-list { display: flex; flex-direction: column; gap: 8px; }
.recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-input);
    border-radius: 8px;
    text-decoration: none;
    transition: border-color 0.2s;
    border: 1px solid transparent;
}
.recent-item:hover { border-color: var(--border); }
.recent-task { font-size: 13px; color: var(--text); }
.recent-meta { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 8px; }

/* === Toast === */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
    pointer-events: none;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* === Sidebar (sliding drawer) === */
.app-layout {
    display: flex;
    flex: 1;
    min-height: 0;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 149;
}

.sidebar {
    position: fixed;
    top: 57px;
    left: 0;
    bottom: 0;
    width: 300px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
}
.sidebar.open {
    transform: translateX(0);
}

/* On desktop, push content when sidebar is open */
@media (min-width: 901px) {
    .sidebar-overlay.show { display: none; }
    body:has(.sidebar.open) .app-layout {
        margin-left: 300px;
        transition: margin-left 0.25s ease;
    }
    .app-layout {
        transition: margin-left 0.25s ease;
    }
}
/* On mobile, show overlay */
@media (max-width: 900px) {
    .sidebar-overlay.show { display: block; }
    .sidebar { top: 0; width: 280px; }
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    font-weight: 600;
    font-size: 15px;
    border-bottom: 1px solid var(--border);
}
.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 4px;
}
.sidebar-toggle:hover { color: var(--text); background: var(--bg-input); }

.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}
.sb-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}
.sb-tab:hover { color: var(--text); }
.sb-tab.active {
    color: var(--gemini);
    border-bottom-color: var(--gemini);
}

.sidebar-search {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
.sidebar-search input {
    width: 100%;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 12px;
    outline: none;
    box-sizing: border-box;
}
.sidebar-search input:focus { border-color: var(--gemini); }

.sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.sidebar-item-wrap {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.sidebar-item-wrap:hover { background: rgba(255,255,255,0.03); }

.sidebar-item {
    display: block;
    flex: 1;
    padding: 10px 12px 10px 16px;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.15s;
    min-width: 0;
}
.sidebar-item.active {
    border-left-color: var(--gemini);
    background: rgba(66,133,244,0.08);
}
.sidebar-task {
    display: block;
    font-size: 13px;
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-meta {
    font-size: 11px;
    color: var(--text-dim);
}

.fav-btn {
    background: none;
    border: none;
    color: var(--border);
    font-size: 16px;
    padding: 0 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: color 0.15s;
    flex-shrink: 0;
}
.fav-btn:hover { color: var(--claude); }
.fav-btn.fav-active { color: var(--claude); }

.sidebar-loading, .sidebar-empty {
    padding: 24px 16px;
    font-size: 13px;
    color: var(--text-dim);
    text-align: center;
}
.sidebar-bottom {
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}
.sidebar-new-btn {
    display: block;
    text-align: center;
    padding: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--gpt), var(--gemini));
    text-decoration: none;
    transition: opacity 0.2s;
}
.sidebar-new-btn:hover { opacity: 0.9; }
.sidebar-footer {
    display: block;
    text-align: center;
    padding: 8px;
    font-size: 11px;
    color: var(--text-dim);
    text-decoration: none;
}
.sidebar-footer:hover { color: var(--gemini); }

/* === Attachments === */
.attach-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}
.attach-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-input);
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.attach-btn:hover { color: var(--text); border-color: var(--text-dim); }
.attach-hint { font-size: 11px; color: var(--text-dim); }

.attachments-area {
    margin-top: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.attachments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
}
.attach-clear {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 11px;
    cursor: pointer;
}
.attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
}
.attachment-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
}
.attachment-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}
.attachment-icon {
    font-size: 11px;
    color: var(--text-dim);
    background: rgba(66,133,244,0.15);
    padding: 4px 8px;
    border-radius: 4px;
}
.attachment-name {
    font-size: 12px;
    color: var(--text);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.attachment-remove {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
}
.attachment-remove:hover { color: #ef4444; }

/* === Chat === */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 160px);
    max-width: 800px;
    margin: 0 auto;
}
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.chat-header h2 { font-size: 20px; }
.chat-options { display: flex; gap: 8px; }
.chat-options select {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.chat-welcome {
    text-align: center;
    color: var(--text-dim);
    padding: 60px 20px;
    font-size: 14px;
}
.chat-msg { display: flex; flex-direction: column; }
.user-msg { align-items: flex-end; }
.ai-msg { align-items: flex-start; }
.chat-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
}
.chat-bubble p { margin-bottom: 8px; }
.chat-bubble p:last-child { margin-bottom: 0; }
.user-bubble { background: var(--gemini); color: #fff; border-bottom-right-radius: 4px; }
.ai-bubble { background: var(--bg-card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-model-label { font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.chat-cost { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.chat-input-area {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.chat-input-area textarea {
    flex: 1;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    outline: none;
    box-sizing: border-box;
}
.chat-input-area textarea:focus { border-color: var(--gemini); }

/* === Settings === */
.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}
.settings-section h3 {
    font-size: 16px;
    margin-bottom: 8px;
}
.settings-desc {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 16px;
}
.model-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    gap: 12px;
}
.model-row-info {
    display: flex;
    gap: 8px;
    flex: 1;
    flex-wrap: wrap;
}
.model-row-info input, .model-row-info select {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    font-family: inherit;
    font-size: 12px;
    outline: none;
    min-width: 100px;
}
.model-row-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-dim);
    cursor: pointer;
}
.toggle-label input { accent-color: var(--gpt); }

.template-list { display: flex; flex-direction: column; gap: 8px; }
.template-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: 8px;
    font-size: 13px;
}
.template-meta { color: var(--text-dim); font-size: 12px; margin-left: 8px; }

/* === Compare === */
.compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.compare-col {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.compare-header {
    padding: 14px 20px;
    border-bottom: 3px solid;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.compare-content {
    padding: 20px;
    font-size: 14px;
    line-height: 1.7;
    max-height: 600px;
    overflow-y: auto;
}
.compare-content p { margin-bottom: 10px; }

/* === Theme toggle === */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text-dim); }

/* === Shortcuts modal === */
.shortcuts-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.shortcuts-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    width: 320px;
}
.shortcuts-card h3 { margin-bottom: 16px; font-size: 16px; }
.sc-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    font-size: 13px;
    color: var(--text-dim);
}
kbd {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 8px;
    font-family: inherit;
    font-size: 12px;
    color: var(--text);
    min-width: 20px;
    text-align: center;
}

/* === Responsive === */
@media (max-width: 900px) {
    .models-grid { grid-template-columns: 1fr !important; }
    .model-content { max-height: 300px; }
    .navbar { padding: 12px 16px; }
    .container { padding: 20px 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .options-grid { grid-template-columns: repeat(2, 1fr); }
    .arena-actions { flex-wrap: wrap; }
    .app-layout { flex-direction: column; }
    .compare-grid { grid-template-columns: 1fr; }
    .chat-bubble { max-width: 95%; }
    .nav-links { gap: 12px; font-size: 12px; }
    .model-row { flex-direction: column; }
    .model-row-info { flex-direction: column; }
}
