/* === Base === */
:root, [data-theme="dark"] {
    --bg: #0c1524;
    --bg-card: #132038;
    --bg-input: #1b2a4a;
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --border: #243352;
    --accent: #2ec4b6;
    --accent-light: #5dd8cc;
    --gpt: #10a37f;
    --claude: #d97706;
    --gemini: #4285f4;
    --synthesis: #2ec4b6;
    --radius: 12px;
}
[data-theme="light"] {
    --bg: #f0f4f8;
    --bg-card: #ffffff;
    --bg-input: #e8edf3;
    --text: #1b2a4a;
    --text-dim: #546e8a;
    --border: #c8d6e5;
    --accent: #2ec4b6;
    --accent-light: #5dd8cc;
}

* { 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: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
}
body {
    padding-top: 75px;
}
.nav-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.hamburger-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 4px;
    transition: opacity 0.2s;
    opacity: 0.6;
}
.hamburger-btn:hover { opacity: 1; }
.hamburger-btn span {
    display: block;
    width: 14px;
    height: 1.5px;
    background: var(--text);
    border-radius: 1px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    overflow: hidden;
}
.nav-logo img { display: block; }
.logo-with-slogan {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.logo-with-slogan img {
    height: 32px;
    width: auto;
    max-width: 160px;
}
/* Dark theme (default): show light logo, hide dark logo */
.logo-light-theme { display: none !important; }
.logo-dark-theme { display: block !important; }
/* Light theme: show dark logo, hide light logo */
[data-theme="light"] .logo-dark-theme { display: none !important; }
[data-theme="light"] .logo-light-theme { display: block !important; }
.nav-abbreviation {
    font-size: 11px;
    letter-spacing: 0.03em;
    white-space: nowrap;
    text-transform: none;
}
.nav-abbr-cap {
    color: var(--text);
    font-weight: 700;
    text-transform: uppercase;
}
.nav-abbr-rest {
    color: var(--synthesis);
    font-weight: 700;
    text-transform: uppercase;
}
@media (max-width: 700px) {
    .nav-abbreviation { display: none; }
}

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

.nav-link {
    color: var(--text);
    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 {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 20px;
    color: var(--text-dim);
    font-size: 13px;
    border-top: 1px solid var(--border);
}
.footer-version {
    opacity: 0.5;
    font-size: 11px;
}

/* === Hero === */
.hero {
    text-align: center;
    margin-bottom: 28px;
}
.hero h1 {
    font-size: 26px;
    font-weight: 700;
    background: linear-gradient(135deg, #2ec4b6, #1a9e92);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-sub {
    color: var(--text);
    margin-top: 6px;
    font-size: 14px;
    font-weight: 600;
}
.hero-gaon {
    font-weight: 800;
    font-size: 1.15em;
    letter-spacing: 0.1em;
    color: var(--synthesis);
}

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

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

.input-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* === Options Grid === */
.options-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.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 32px 9px 12px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b8fa3' d='M2.5 4.5l3.5 3.5 3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
}
.option-group select:focus { border-color: var(--accent); }

/* === Participants === */
.participants-section {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.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(--accent);
    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);
    opacity: 0.5;
}

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

/* === Buttons === */
.btn-primary {
    background: linear-gradient(135deg, #2ec4b6, #1a9e92);
    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;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.arena-status-bar .stop-btn { margin-left: auto; }
.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(--accent);
    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(--accent);
    margin-bottom: 8px;
}
.arena-question-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
}
.arena-question-text p { margin-bottom: 6px; }
.arena-followup-highlight {
    background: rgba(46, 196, 182, 0.08);
    border: 1px solid rgba(46, 196, 182, 0.25);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 12px;
}
.arena-followup-highlight .arena-question-label {
    font-size: 12px;
    color: var(--accent);
    margin-bottom: 6px;
}
.arena-followup-highlight .arena-question-text {
    font-size: 15px;
    font-weight: 500;
    color: #fff;
}

.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;
}

/* Stop button */
.stop-btn {
    background: transparent;
    color: var(--text-dim);
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.3px;
    opacity: 0.6;
}
.stop-btn:hover { background: rgba(239,68,68,0.15); color: #ef4444; opacity: 1; }

/* 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);
}
.status-done {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--synthesis);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.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;
}
/* Markdown tables in rendered content */
.rendered-md table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 13px;
}
.rendered-md th, .rendered-md td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}
.rendered-md th {
    background: rgba(46, 196, 182, 0.1);
    color: var(--text);
    font-weight: 600;
    white-space: nowrap;
}
.rendered-md td {
    color: var(--text-dim);
}
.rendered-md tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.model-content h1, .model-content h2, .model-content h3 {
    font-size: 15px;
    margin: 12px 0 6px;
}

/* Help icon */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: rgba(46,196,182,0.15);
    color: var(--synthesis);
    font-size: 10px;
    font-weight: 700;
    cursor: help;
    margin-left: 4px;
    vertical-align: middle;
}
.toggle-prompt-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.15s;
}
.toggle-prompt-btn:hover {
    color: var(--text);
    border-color: var(--synthesis);
}
.moderator-prompt-section {
    margin-top: 12px;
}
.moderator-prompt-section textarea {
    width: 100%;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
    margin-top: 6px;
}
.moderator-prompt-section textarea:focus {
    border-color: var(--synthesis);
}

/* 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(46, 196, 182, 0.12);
    font-weight: 700;
    font-size: 16px;
    color: var(--synthesis);
}
.synthesis-copy-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-dim);
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
}
.synthesis-copy-btn:hover { background: rgba(255,255,255,0.15); color: var(--text); }
.synthesis-copy-btn svg { flex-shrink: 0; }
.synthesis-footer {
    padding: 10px 20px 14px;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border);
}
.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;
}

/* === Moderator Summary === */
.moderator-summary {
    background: var(--bg-card);
    border: 1px solid rgba(46, 196, 182, 0.3);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    margin: 8px 0 20px;
    overflow: hidden;
}
.moderator-summary-header {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(46, 196, 182, 0.06);
    display: flex;
    align-items: center;
    gap: 8px;
}
.moderator-icon { font-size: 16px; }
.moderator-status {
    margin-left: auto;
    font-weight: 400;
    font-size: 12px;
    opacity: 0.6;
}
.moderator-summary.collapsed .moderator-summary-content { display: none; }
.moderator-summary-header { cursor: pointer; }
.moderator-summary-content {
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-dim);
}
.moderator-summary-content strong { color: var(--text); }

/* === Model Name Mentions === */
.model-mention {
    font-weight: 700;
    padding: 1px 0;
}
.gpt-mention { color: var(--gpt); }
.claude-mention { color: var(--claude); }
.gemini-mention { color: var(--gemini); }

/* === Agreement & Influence === */
.agreement-badge {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    margin: 8px 0;
}
.agreement-score {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    color: var(--text-dim);
    margin-bottom: 8px;
}
.agreement-score.high { background: rgba(46, 196, 182, 0.15); color: var(--accent); }
.agreement-score.full { background: rgba(46, 196, 182, 0.25); color: var(--accent); }
.influence-bars { display: flex; flex-direction: column; gap: 4px; }
.influence-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}
.influence-label {
    width: 110px;
    flex-shrink: 0;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.influence-track {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    overflow: hidden;
}
.influence-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}
.gpt-fill { background: var(--gpt); }
.claude-fill { background: var(--claude); }
.gemini-fill { background: var(--gemini); }
.influence-pct {
    width: 35px;
    text-align: right;
    color: var(--text-dim);
    flex-shrink: 0;
}

/* === Arena Actions === */
.arena-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 32px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}
.arena-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    font-size: 13px;
    border-radius: 8px;
}

/* === 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(--accent);
    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(--accent); }
.badge-error { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.badge-stopped { background: rgba(234, 179, 8, 0.2); color: #eab308; }

.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); }

.session-question-box {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 14px;
}
.session-question-text, .session-question-full {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}
.session-question-text {
    max-height: 80px;
    overflow: hidden;
}
.session-question-toggle {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 0;
    margin-top: 4px;
    font-family: inherit;
}
.session-question-toggle:hover { text-decoration: underline; }

.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;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.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(--accent);
}
.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: 10px;
    margin-top: 6px;
}
.temp-slider input[type="range"] {
    flex: 1;
    accent-color: var(--accent);
    height: 4px;
}
.temp-slider span {
    font-size: 13px;
    font-weight: 500;
    color: var(--synthesis);
    min-width: 28px;
    text-align: right;
}

/* === Advanced Section === */
.advanced-section {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.advanced-section summary {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    list-style: none;
}
.advanced-section summary::-webkit-details-marker { display: none; }
.advanced-section summary::before {
    content: "▸ ";
    color: var(--synthesis);
}
.advanced-section[open] summary::before {
    content: "▾ ";
}
.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(--accent); }
.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(--accent); }

/* === 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(--accent); }
.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, #2ec4b6, #1a9e92);
    -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: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    padding-top: 75px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    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 { display: none !important; }
    .sidebar {
        transform: translateX(0);
    }
    body:has(.sidebar:not(.force-closed)) .app-layout {
        margin-left: 300px;
    }
    .sidebar.force-closed {
        transform: translateX(-100%);
    }
    body:has(.sidebar.force-closed) .app-layout {
        margin-left: 0;
    }
    .app-layout {
        transition: margin-left 0.25s ease;
    }
}
/* On mobile, show overlay */
@media (max-width: 900px) {
    .sidebar-overlay.show { display: block; }
    .sidebar { width: 280px; padding-top: 65px; }
}

.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;
    align-items: center;
    border-bottom: 1px solid var(--border);
}
.sidebar-close-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 16px;
    padding: 8px 10px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.15s;
}
.sidebar-close-btn:hover { opacity: 1; }
.sidebar-open-tab {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    z-index: 99;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 4px 4px 0;
    color: var(--synthesis);
    font-size: 14px;
    padding: 12px 6px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    writing-mode: vertical-lr;
    letter-spacing: 1px;
    display: none;
}
.sidebar-open-tab:hover { opacity: 1; }
.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(--accent);
    border-bottom-color: var(--accent);
}

.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(--accent); }

.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-wrap.sidebar-child {
    padding-left: 16px;
    border-bottom: none;
    background: rgba(46,196,182,0.03);
}
.sidebar-item-wrap.sidebar-child .sidebar-item {
    padding: 7px 10px 7px 8px;
    border-left: 2px solid var(--synthesis);
}
.sidebar-item-wrap.sidebar-child .sidebar-task {
    font-size: 12px;
    color: var(--text-dim);
}
.sidebar-item-wrap.sidebar-child .sidebar-item.active .sidebar-task {
    color: var(--text);
}
.sidebar-child-icon {
    color: var(--synthesis);
    font-size: 12px;
    margin-right: 4px;
    opacity: 0.8;
}
.sidebar-badge {
    display: inline-block;
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1px 5px;
    border-radius: 3px;
    margin-bottom: 3px;
}
.sidebar-badge-original {
    background: rgba(46,196,182,0.15);
    color: var(--synthesis);
}
.sidebar-badge-followup {
    background: rgba(100,149,237,0.15);
    color: #6495ed;
}
.sidebar-parent-row {
    display: flex;
    align-items: stretch;
}
.sidebar-parent-row > .sidebar-item-wrap {
    flex: 1;
    min-width: 0;
}
.sidebar-collapse-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    border-left: 1px solid var(--border);
    padding: 0 8px;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 11px;
    transition: color 0.15s;
}
.sidebar-collapse-btn:hover { color: var(--accent); }
.collapse-icon {
    font-size: 10px;
    transition: transform 0.2s;
    display: inline-block;
}
.collapse-icon.expanded { transform: rotate(90deg); }
.sidebar-child-count {
    font-size: 10px;
    opacity: 0.6;
}
.sidebar-children {
    overflow: hidden;
    transition: max-height 0.25s ease;
    max-height: 500px;
}
.sidebar-children.collapsed {
    max-height: 0;
}

.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(--accent);
    background: rgba(46,196,182,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);
}
.sidebar-status {
    font-size: 10px;
    font-weight: 600;
}
.sidebar-status.complete {
    color: #10a37f;
    background: rgba(16, 163, 127, 0.15);
    padding: 1px 6px;
    border-radius: 8px;
}
.sidebar-status.running {
    color: var(--claude);
    animation: statusPulse 1.5s ease-in-out infinite;
}
.sidebar-status.error {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    padding: 1px 6px;
    border-radius: 8px;
}
.sidebar-status.stopped {
    color: #eab308;
    background: rgba(234, 179, 8, 0.15);
    padding: 1px 6px;
    border-radius: 8px;
}
@keyframes statusPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.sidebar-item-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
    flex-shrink: 0;
}
.fav-btn {
    background: none;
    border: none;
    color: var(--border);
    font-size: 15px;
    padding: 2px 4px;
    cursor: pointer;
    transition: color 0.15s;
    line-height: 1;
}
.fav-btn:hover { color: var(--claude); }
.fav-btn.fav-active { color: var(--claude); }
.del-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 11px;
    padding: 2px 4px;
    cursor: pointer;
    transition: color 0.15s;
    line-height: 1;
    opacity: 0;
}
.rename-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 11px;
    padding: 2px 4px;
    cursor: pointer;
    transition: color 0.15s;
    line-height: 1;
    opacity: 0;
}
.sidebar-item-wrap:hover .rename-btn { opacity: 1; }
.rename-btn:hover { color: var(--synthesis); }
.sidebar-item-wrap:hover .del-btn { opacity: 1; }
.del-btn:hover { color: #ef4444; }

.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 16px;
    margin: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #2ec4b6, #1a9e92);
    text-decoration: none;
    border-radius: 8px;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 8px rgba(46,196,182,0.25);
}
.sidebar-new-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(46,196,182,0.35);
}
.sidebar-footer {
    display: block;
    text-align: center;
    padding: 8px;
    font-size: 10px;
    color: var(--text-dim);
    text-decoration: none;
    opacity: 0.4;
}

/* === Attachments === */
.attach-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}
.attach-hint {
    font-size: 12px;
    color: var(--text-dim);
    opacity: 0.6;
}
.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); }
.grecaptcha-badge { visibility: hidden !important; }
.suggestions-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.suggestions-label { font-size: 11px; font-weight: 500; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.suggestions-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.suggestion-chip { background: rgba(46,196,182,0.06); border: 1px solid rgba(46,196,182,0.2); color: var(--text); border-radius: 20px; padding: 8px 14px; font-size: 12px; font-family: inherit; cursor: pointer; transition: all 0.2s; text-align: left; line-height: 1.4; }
.suggestion-chip:hover { background: rgba(46,196,182,0.12); border-color: var(--accent); color: var(--accent); }
.sidebar-hamburger { display: none; background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 6px; border-radius: 6px; line-height: 1; transition: all 0.2s; margin-right: 4px; }
.sidebar-hamburger:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.sidebar-hamburger svg { display: block; }
@media (max-width: 900px) { .sidebar-hamburger { display: inline-flex; align-items: center; } }
.mobile-start-row { display: none; margin-top: 12px; }
@media (max-width: 768px) { .mobile-start-row { display: block; } .mobile-start-btn { width: 100%; padding: 12px; font-size: 15px; } }
.voice-btn.recording { background: rgba(239,68,68,0.15); border-color: #ef4444; color: #ef4444; animation: voice-pulse 1.5s ease-in-out infinite; }
.voice-btn.recording .voice-label::after { content: '  Recording...'; }
.voice-btn:not(.recording) .voice-label::after { content: ''; }
@keyframes voice-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.3); } 50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); } }
.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(--accent); 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(--accent); }

/* === 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: Tablet === */
@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; }
    /* Touch targets */
    .btn-primary, .btn-secondary, .btn-danger { min-height: 44px; }
    .stop-btn { min-height: 44px; padding: 8px 16px; }
    .sidebar-item { padding: 10px 12px; }
    .sidebar-item-actions button { min-width: 32px; min-height: 32px; }
    /* Sidebar action buttons always visible on touch */
    .sidebar-item-actions { opacity: 1; }
    /* Sidebar width */
    .sidebar { width: min(280px, 80vw); }
}

/* === Responsive: Mobile (768px) === */
@media (max-width: 768px) {
    .navbar { flex-wrap: wrap; padding: 8px 12px 0; gap: 0; }
    .nav-left { flex: 1; }
    .nav-links { width: 100%; order: 3; justify-content: flex-start; gap: 4px; padding: 6px 0; border-top: 1px solid var(--border); margin-top: 6px; font-size: 13px; }
    .nav-links .nav-dropdown { order: -1; position: absolute; right: 12px; top: 6px; }
    .nav-links .theme-toggle { order: -2; position: absolute; right: 52px; top: 10px; }
    body { padding-top: 95px; }
    /* Hide non-essential nav links, keep core ones */
    .nav-link[href="/dashboard"],
    .nav-link[href="/settings"] { display: none; }
    .nav-usage-bar { display: none; }
    /* History table → card layout */
    .history-table thead { display: none; }
    .history-table tbody { display: flex; flex-direction: column; gap: 8px; }
    .history-table tr {
        display: flex; flex-direction: column;
        border: 1px solid var(--border); border-radius: 10px;
        padding: 12px 14px; gap: 6px;
        background: var(--bg-card);
    }
    .history-table td { padding: 0; border: none; font-size: 13px; }
    .history-table td:first-child { font-size: 11px; color: var(--text-dim); }
    .history-table td a { font-weight: 500; }
    .history-table td .btn-danger { padding: 6px 14px; font-size: 12px; min-height: 36px; }
    /* History search form stacks */
    .history-search-row { flex-direction: column !important; gap: 8px !important; }
    .history-search-row input[type="text"] { width: 100% !important; }
    /* Pricing cards */
    .pricing-page { padding: 0 12px; }
    .pricing-card { padding: 24px 18px; }
    .pricing-header h1 { font-size: 24px; }
    /* Login/Register */
    .login-card { padding: 28px 20px; }
    /* Session question word-break */
    .session-question-text,
    .session-question-full { overflow-wrap: break-word; word-break: break-word; }
    /* Chat input iOS zoom fix */
    .chat-input-area textarea { font-size: 16px; }
}

/* === Responsive: Small phones (600px) === */
@media (max-width: 600px) {
    .container { padding: 12px 10px; }
    .navbar { padding: 10px 12px; }
    .nav-links { gap: 6px; font-size: 11px; }
    .nav-links a { padding: 6px 4px; }
    .nav-link[href="/chat"] { display: none; }
    .logo-with-slogan img { max-width: 120px; }
    /* Brainstorm form */
    .hero h1 { font-size: 20px; }
    .hero p { font-size: 13px; }
    .input-card { padding: 14px; }
    .input-card textarea { font-size: 16px; padding: 10px 12px; }
    .options-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; padding-top: 10px; }
    .option-group { gap: 3px; }
    .option-group label { font-size: 10px; margin-bottom: 0; }
    .option-group select { font-size: 13px; padding: 7px 28px 7px 10px; min-height: 36px; border-radius: 6px; }
    .option-group input { font-size: 13px; padding: 7px 10px; }
    .participants-section { margin-top: 10px; padding-top: 10px; }
    .participants-section > label { font-size: 10px; margin-bottom: 4px; }
    .participants-checkboxes { flex-direction: row; flex-wrap: wrap; gap: 6px; }
    .participant-check { padding: 6px 10px; font-size: 12px; border-radius: 6px; flex: 1; min-width: 0; }
    .participant-check .check-label { font-size: 12px; }
    .temp-slider { gap: 6px; }
    .temp-slider input[type="range"] { height: 4px; }
    .temp-slider #tempValue { font-size: 13px; }
    .advanced-section { margin-top: 10px; }
    .advanced-section summary { font-size: 11px; padding: 8px 0; }
    .input-controls { margin-top: 10px; }
    .hero { margin-bottom: 8px; }
    .hero h1 { font-size: 18px; margin-bottom: 2px; }
    .hero p { font-size: 12px; }
    .input-card { padding: 12px; }
    .input-card textarea { font-size: 15px; padding: 8px 10px; rows: 3; }
    .attach-bar { gap: 6px; margin-top: 6px; }
    .attach-btn { padding: 5px 10px; font-size: 11px; }
    .mobile-start-btn { padding: 10px; font-size: 14px; }
    .input-section { padding: 0 8px; }
    /* Arena */
    .arena-status-bar { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
    .arena-status-bar #roundHeader { font-size: 13px; }
    .arena-actions { gap: 8px; }
    .arena-action-btn { padding: 8px 14px; font-size: 12px; flex: 1 1 auto; justify-content: center; min-height: 44px; }
    /* Rounds & cards */
    .round-accordion-header { padding: 10px 12px; }
    .round-accordion-title { font-size: 13px; }
    .round-header-meta { gap: 6px; }
    .round-meta-chip { font-size: 10px; padding: 2px 6px; }
    .round-model-dot { width: 8px; height: 8px; }
    .model-card { min-width: unset; }
    .model-header { padding: 8px 10px; font-size: 12px; }
    .model-content { padding: 10px 12px; font-size: 13px; max-height: none; }
    .moderator-summary-header { padding: 8px 12px; font-size: 12px; }
    .moderator-summary-content { padding: 10px 12px; font-size: 13px; }
    .synthesis-header { padding: 10px 12px; font-size: 14px; }
    .synthesis-content { padding: 10px 12px; font-size: 13px; }
    /* Session page */
    .session-meta { padding: 12px; }
    .session-question-box { padding: 10px 12px; font-size: 14px; }
    .followup-section .input-card { padding: 12px; }
    .followup-section textarea { font-size: 16px; }
    #sessionActions { flex-wrap: wrap; gap: 8px; }
    #sessionActions .btn-secondary,
    #sessionActions .btn-primary,
    #sessionActions .btn-danger { font-size: 12px; padding: 8px 14px; flex: 1 1 auto; min-height: 44px; text-align: center; }
    .arena-question { padding: 12px; font-size: 14px; }
    /* Cost */
    .cost-display { font-size: 11px; }
    .cost-total { padding: 2px 8px; font-size: 11px; }
    /* Settings/Profile */
    .settings-grid { gap: 16px; }
    .settings-section { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr; }
    /* Login */
    .login-card { padding: 24px 16px; }
    .login-wrapper { padding: 20px 12px; }
    /* Pricing */
    .pricing-card { padding: 20px 14px; }
    .pricing-price { font-size: 28px; }
    .pricing-tier { font-size: 18px; }
    .pricing-cta { padding: 14px; min-height: 48px; }
    .pricing-faq { margin-top: 40px; }
    /* Modal */
    .gaon-modal { padding: 18px; min-width: unset; width: 92%; }
    .gaon-modal-body { font-size: 14px; }
    /* Dashboard bar chart */
    .bar-label { min-width: 80px; font-size: 11px; }
}

/* === Responsive: Extra small phones (380px) === */
@media (max-width: 380px) {
    .nav-links { gap: 4px; font-size: 10px; }
    .nav-link[href="/history"] { display: none; }
    .logo-with-slogan img { max-width: 90px; }
    .container { padding: 8px 6px; }
    .hero h1 { font-size: 18px; }
    .round-accordion-title { font-size: 12px; }
    .pricing-card { padding: 16px 12px; }
    .pricing-price { font-size: 24px; }
    .bar-label { min-width: 60px; }
}

/* Complete badge */
.complete-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--synthesis);
    font-weight: 600;
    animation: completeFadeIn 0.5s ease-out;
}
@keyframes completeFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Progress Dots (collapsed round/moderator indicators) === */
.round-progress {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
}
.progress-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.3;
    animation: progressPulse 1.4s ease-in-out infinite;
}
.progress-dot:nth-child(2) { animation-delay: 0.2s; }
.progress-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes progressPulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.2); }
}

/* === Confirm Modal === */
.gaon-modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 10000;
    animation: modalFadeIn 0.15s ease-out;
}
.gaon-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    min-width: 320px;
    max-width: 420px;
    animation: modalSlideIn 0.15s ease-out;
}
.gaon-modal-body {
    font-size: 15px;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 20px;
}
.gaon-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.gaon-modal-btn {
    padding: 8px 22px;
    font-size: 14px;
}
.gaon-modal-confirm {
    background: rgba(239,68,68,0.15);
    color: #ef4444;
    border-color: rgba(239,68,68,0.3);
}
.gaon-modal-confirm:hover {
    background: rgba(239,68,68,0.25);
}
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalSlideIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* Help modals */
.help-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: modalFadeIn 0.2s ease;
}
.help-modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px 24px 20px;
    max-width: 480px;
    width: 90vw;
    position: relative;
    animation: modalSlideIn 0.25s ease;
    max-height: 80vh;
    overflow-y: auto;
}
.help-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}
.help-modal-close:hover { color: var(--text); }
.help-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px;
}
.help-modal-subtitle {
    font-size: 13px;
    color: var(--text-dim);
    margin: 0 0 16px;
}
.help-modal-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.help-modal-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.help-modal-icon {
    font-size: 20px;
    min-width: 28px;
    text-align: center;
    padding-top: 2px;
}
.help-modal-item-body {
    flex: 1;
}
.help-modal-item-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}
.help-modal-item-desc {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.5;
}
.help-modal-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(46,196,182,0.12);
    padding: 1px 6px;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 4px;
}
.help-modal-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.6;
}
