/* ============================================
   BACKFORTH - AI Discussion Arena
   v3.3.0 - Mobile-First + Single Chat Mode
   ============================================ */

:root {
    /* Color System */
    --bg-base: #09090b;
    --bg-elevated: #0f0f12;
    --bg-surface: #16161a;
    --bg-hover: #1c1c21;
    --bg-active: #232329;
    
    /* Accent Gradient */
    --accent-1: #3b82f6;
    --accent-2: #8b5cf6;
    --accent-3: #d946ef;
    --gradient-primary: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
    --gradient-subtle: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    
    /* Model Colors */
    --model-1: #3b82f6;
    --model-2: #10b981;
    --model-3: #f59e0b;
    --model-4: #ef4444;
    
    /* Text */
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --text-muted: #52525b;
    
    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.15);
    
    /* Effects */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 40px rgba(139, 92, 246, 0.15);
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Space Grotesk', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Spacing */
    --header-height: 72px;
    --sidebar-width: 280px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

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

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

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

/* ============================================
   BACKGROUND EFFECTS
   ============================================ */

.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 0%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(217, 70, 239, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.bg-noise {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.015;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   HEADER
   ============================================ */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(9, 9, 11, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 100;
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

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

.logo-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    font-size: 1.25rem;
    font-weight: 700;
    position: relative;
    overflow: hidden;
}

.logo-icon .arrow {
    color: white;
    font-weight: 900;
    animation: pulse-arrow 2s ease-in-out infinite;
}

.logo-icon .arrow.left {
    animation-delay: 0s;
}

.logo-icon .arrow.right {
    animation-delay: 1s;
}

@keyframes pulse-arrow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-name {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-tagline {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.header-stats {
    display: flex;
    gap: 2rem;
}

.header-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

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

.stat-value {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

.powered-link {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.powered-link:hover {
    color: var(--text-secondary);
    background: var(--bg-surface);
}

.powered-link strong {
    color: var(--accent-2);
}

/* ============================================
   MAIN LAYOUT
   ============================================ */

.main {
    position: relative;
    min-height: 100vh;
    padding-top: var(--header-height);
    z-index: 1;
}

/* ============================================
   SETUP PANEL
   ============================================ */

.setup-panel {
    padding: 3rem 2rem;
    display: flex;
    justify-content: center;
}

.setup-panel.hidden {
    display: none;
}

.setup-container {
    width: 100%;
    max-width: 900px;
}

.setup-section {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.step-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: 50%;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
}

.section-header h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    flex: 1;
}

.selection-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
}

.input-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.topic-textarea {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.2s ease;
}

.topic-textarea:focus {
    outline: none;
    border-color: var(--accent-2);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.topic-textarea::placeholder {
    color: var(--text-muted);
}

/* Mode Selector */
.mode-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 1rem;
    background: var(--bg-surface);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-default);
    color: var(--text-primary);
}

.mode-btn.active {
    background: var(--gradient-subtle);
    border-color: var(--accent-2);
    color: var(--text-primary);
}

.mode-icon {
    font-size: 1.5rem;
}

.mode-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.mode-desc {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    text-align: center;
}

.mode-btn.active .mode-desc {
    color: var(--text-secondary);
}

/* Model Grid */
.model-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tier-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.tier-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tier-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tier-btn.active {
    background: var(--gradient-subtle);
    border-color: var(--accent-2);
    color: var(--text-primary);
}

.model-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.model-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem;
    background: var(--bg-surface);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-height: 80px;
}

.model-card:hover {
    background: var(--bg-hover);
    border-color: var(--border-default);
}

.model-card.selected {
    border-color: var(--accent-2);
    background: var(--gradient-subtle);
}

.model-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.model-card-check {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-strong);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.model-card.selected .model-card-check {
    background: var(--gradient-primary);
    border-color: transparent;
}

.model-card.selected .model-card-check::after {
    content: '✓';
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
}

.model-card-icon {
    font-size: 1.5rem;
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.model-card-info {
    flex: 1;
    min-width: 0;
}

.model-card-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-card-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.model-card-meta span {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: var(--font-mono);
}

.model-provider {
    color: var(--text-tertiary);
    background: var(--bg-active);
}

.model-params {
    color: var(--accent-2);
    background: rgba(139, 92, 246, 0.15);
}

.model-context {
    color: var(--accent-1);
    background: rgba(59, 130, 246, 0.15);
}

.model-card-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    line-height: 1.3;
}

.model-card-provider {
    font-size: 0.7rem;
    color: var(--text-tertiary);
}

.model-card-order {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
}

.model-card.selected .model-card-order {
    opacity: 1;
    transform: scale(1);
}

/* Config Grid */
.config-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.config-item {
    display: flex;
    flex-direction: column;
}

.config-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.config-slider {
    flex: 1;
    height: 6px;
    background: var(--bg-active);
    border-radius: 3px;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.config-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.slider-value {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 80px;
}

.config-hint {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.75rem;
}

.length-buttons {
    display: flex;
    gap: 0.5rem;
}

.length-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.length-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-default);
}

.length-btn.active {
    background: var(--gradient-subtle);
    border-color: var(--accent-2);
    color: var(--text-primary);
}

/* Start Section */
.start-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 0;
}

.start-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 3rem;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-xl);
    color: white;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.start-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 60px rgba(139, 92, 246, 0.3);
}

.start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.start-icon {
    font-size: 1.25rem;
}

.start-hint {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* ============================================
   DISCUSSION VIEW
   ============================================ */

.discussion-view {
    display: none;
    flex-direction: column;
    height: calc(100vh - var(--header-height));
}

.discussion-view.active {
    display: flex;
}

.discussion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
}

.discussion-topic {
    flex: 1;
    min-width: 0;
}

.topic-label {
    font-size: 0.65rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.discussion-topic h2 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 500px;
}

.discussion-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-bar {
    width: 150px;
    height: 6px;
    background: var(--bg-active);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 3px;
    width: 0%;
    transition: width 0.5s ease;
}

.progress-text {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-default);
}

.control-btn.pause-btn.paused {
    background: var(--accent-2);
    color: white;
    border-color: var(--accent-2);
}

.control-btn.stop-btn:hover {
    background: var(--model-4);
    border-color: var(--model-4);
    color: white;
}

/* Discussion Content */
.discussion-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Participants Panel */
.participants-panel {
    width: var(--sidebar-width);
    background: var(--bg-elevated);
    border-right: 1px solid var(--border-subtle);
    padding: 1.5rem;
    overflow-y: auto;
}

.panel-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

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

.participant-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--model-1);
}

.participant-card:nth-child(2) { border-left-color: var(--model-2); }
.participant-card:nth-child(3) { border-left-color: var(--model-3); }
.participant-card:nth-child(4) { border-left-color: var(--model-4); }

.participant-card.speaking {
    background: var(--bg-hover);
    box-shadow: var(--shadow-md);
}

.participant-icon {
    font-size: 1.25rem;
}

.participant-info {
    flex: 1;
    min-width: 0;
}

.participant-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.participant-provider {
    font-size: 0.7rem;
    color: var(--text-tertiary);
}

.participant-stats {
    text-align: right;
}

.participant-stat {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Live Stats */
.live-stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.live-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
}

.live-stat-label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.live-stat-value {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Conversation Container */
.conversation-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.conversation-thread {
    max-width: 800px;
    margin: 0 auto;
}

.conversation-start {
    display: flex;
    justify-content: center;
    padding: 3rem;
}

.start-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.pulse {
    width: 10px;
    height: 10px;
    background: var(--accent-2);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

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

/* Message Styles */
.message {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    animation: messageIn 0.4s ease;
}

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

.message-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    background: var(--bg-surface);
    border: 2px solid var(--model-1);
}

.message.model-1 .message-avatar { border-color: var(--model-1); }
.message.model-2 .message-avatar { border-color: var(--model-2); }
.message.model-3 .message-avatar { border-color: var(--model-3); }
.message.model-4 .message-avatar { border-color: var(--model-4); }

.message-content {
    flex: 1;
    min-width: 0;
}

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

.message-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.message.model-1 .message-name { color: var(--model-1); }
.message.model-2 .message-name { color: var(--model-2); }
.message.model-3 .message-name { color: var(--model-3); }
.message.model-4 .message-name { color: var(--model-4); }

.message-params {
    font-size: 0.65rem;
    color: var(--accent-2);
    padding: 0.15rem 0.4rem;
    background: rgba(139, 92, 246, 0.15);
    border-radius: 4px;
    font-family: var(--font-mono);
}

.message-round {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    padding: 0.2rem 0.5rem;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
}

.message-time {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
}

.message-text {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.message-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--accent-2);
    border-radius: 50%;
    animation: typing 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

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

.typing-text {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* Summary Panel */
.summary-panel {
    display: none;
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 4rem);
    max-width: 700px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    z-index: 50;
}

.summary-panel.active {
    display: block;
    animation: slideUp 0.3s ease;
}

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

.summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.summary-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.close-summary {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-summary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.summary-content {
    padding: 1.5rem;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-stat {
    text-align: center;
    padding: 1rem;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
}

.summary-stat-value {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-stat-label {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    margin-top: 0.25rem;
}

.summary-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.summary-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.summary-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.summary-btn.primary {
    background: var(--gradient-primary);
    border: none;
    color: white;
}

.summary-btn.primary:hover {
    box-shadow: var(--shadow-glow);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 200;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
}

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

.toast.success { border-left: 3px solid var(--model-2); }
.toast.error { border-left: 3px solid var(--model-4); }
.toast.info { border-left: 3px solid var(--accent-1); }

/* ============================================
   ADVANCED SETTINGS
   ============================================ */

.advanced-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    margin-top: 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.advanced-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-default);
}

.advanced-toggle.active {
    border-color: var(--accent-2);
    color: var(--text-primary);
}

.toggle-icon {
    font-size: 1.1rem;
}

.toggle-arrow {
    margin-left: auto;
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.advanced-toggle.active .toggle-arrow {
    transform: rotate(180deg);
}

.advanced-panel {
    display: none;
    margin-top: 1rem;
    padding: 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    animation: slideDown 0.3s ease;
}

.advanced-panel.active {
    display: block;
}

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

.advanced-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.advanced-item {
    display: flex;
    flex-direction: column;
}

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

.advanced-value {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-2);
    padding: 0.25rem 0.5rem;
    background: rgba(139, 92, 246, 0.1);
    border-radius: var(--radius-sm);
}

.preset-buttons {
    grid-column: span 2;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.preset-btn {
    padding: 0.6rem 0.75rem;
    background: var(--bg-active);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-2);
}

.preset-btn:active {
    transform: scale(0.98);
}

@media (max-width: 768px) {
    .advanced-grid {
        grid-template-columns: 1fr;
    }
    
    .preset-buttons {
        grid-column: span 1;
    }
    
    .preset-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-active);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-2);
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* ============================================
   5.0 EMPOWERMENT UPGRADES
   ============================================ */

/* 1. Aurora Background */
@keyframes aurora-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.bg-gradient {
    background: radial-gradient(circle at 50% 50%, 
        rgba(var(--active-color-rgb, 59, 130, 246), 0.15) 0%, 
        transparent 60%),
        linear-gradient(120deg, 
            rgba(var(--active-color-rgb, 59, 130, 246), 0.05) 0%, 
            rgba(139, 92, 246, 0.05) 100%);
    transition: background 1.5s ease;
    filter: blur(40px);
}

/* 2. Inspire Me Button */
.topic-input-container {
    position: relative;
    width: 100%;
}

.inspire-btn {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    padding: 0.4rem 0.8rem;
    background: var(--bg-elevated);
    border: 1px solid var(--accent-2);
    border-radius: var(--radius-md);
    color: var(--accent-2);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.inspire-btn:hover {
    background: var(--accent-2);
    color: white;
    transform: translateY(-1px);
}

/* 3. Injection Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transform: translateY(20px);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

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

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.modal-textarea {
    width: 100%;
    padding: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    min-height: 120px;
    margin-bottom: 1.5rem;
    resize: vertical;
}

.modal-textarea:focus {
    border-color: var(--accent-2);
    outline: none;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.modal-btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.modal-btn.secondary {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.modal-btn.secondary:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.modal-btn.primary {
    background: var(--gradient-primary);
    border: none;
    color: white;
}

.modal-btn.primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* 4. Typewriter Effect */
.message-text.typing::after {
    content: '▋';
    display: inline-block;
    vertical-align: bottom;
    color: var(--accent-2);
    animation: blink 1s step-end infinite;
    margin-left: 2px;
}

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

/* 5. Inject Button */
.inject-btn {
    background: rgba(245, 158, 11, 0.1) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
    color: #fbbf24 !important;
}

.inject-btn:hover {
    background: rgba(245, 158, 11, 0.2) !important;
    border-color: #fbbf24 !important;
}

/* Custom Prompt Input (in model card) */
.custom-prompt-input {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-active);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: var(--font-mono);
    display: none;
}

.model-card.selected .custom-prompt-input {
    display: block;
}

/* ============================================
   RESPONSIVE & MOBILE ADAPTATIONS
   ============================================ */

.mobile-only {
    display: none !important;
}

/* Touch Device Optimizations */
@media (hover: none) {
    .model-card:hover { transform: none; }
    .start-btn:hover { transform: none; }
    
    /* Better scroll behavior */
    .model-cards-container, 
    .conversation-container, 
    .participants-panel {
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 1024px) {
    .participants-panel {
        position: fixed;
        top: var(--header-height);
        right: -100%;
        bottom: 0;
        width: 85%;
        max-width: 320px;
        z-index: 50;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-left: 1px solid var(--border-subtle);
        box-shadow: -4px 0 20px rgba(0,0,0,0.5);
        background: var(--bg-elevated); /* Ensure opaque background */
    }

    .participants-panel.active {
        display: block;
        right: 0;
    }
    
    .mobile-only {
        display: flex !important;
    }
    
    .mode-selector {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .config-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 60px;
        --radius-lg: 12px;
        --radius-xl: 16px;
    }

    body {
        /* Prevent horizontal scroll */
        width: 100%;
        overflow-x: hidden;
    }

    /* === Header === */
    .header-content {
        padding: 0 1rem;
    }

    .logo-text {
        display: none;
    }

    .logo-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .header-stats {
        display: none;
    }

    /* === Setup Panel === */
    .setup-panel {
        padding: 1rem;
        /* account for safe areas */
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }

    .setup-section {
        padding: 1.25rem 1rem;
        margin-bottom: 1rem;
    }

    .section-header h2 {
        font-size: 1.1rem;
    }

    /* Inputs - 16px prevents iOS zoom */
    .topic-textarea, 
    .model-search-input,
    input[type="text"],
    select {
        font-size: 16px !important; 
    }

    .topic-textarea {
        padding: 0.75rem;
    }

    /* Mode Buttons */
    .mode-btn {
        padding: 1rem 0.5rem;
    }
    
    .mode-icon {
        font-size: 1.25rem;
    }

    /* === Model Selection === */
    .model-filters {
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--bg-elevated);
        padding-top: 0.5rem;
        margin: -1.25rem -1rem 1rem -1rem; /* Negative margin to span full width */
        padding-left: 1rem;
        padding-right: 1rem;
        border-bottom: 1px solid var(--border-subtle);
    }

    .tier-filter, .capability-filter {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.75rem;
        -webkit-overflow-scrolling: touch;
        /* Hide scrollbar */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .tier-filter::-webkit-scrollbar,
    .capability-filter::-webkit-scrollbar {
        display: none;
    }

    .tier-btn, .cap-btn {
        flex-shrink: 0;
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
        /* Larger touch target */
        min-height: 36px; 
    }

    .model-cards-container {
        max-height: 50vh; /* More vertical space on mobile */
        padding-right: 0;
    }

    .model-card {
        padding: 1rem;
        margin-bottom: 0.75rem;
        border-width: 1px;
        /* Improve tap feedback */
        active: scale(0.98);
    }
    
    .model-card.selected {
        background: rgba(59, 130, 246, 0.1);
        border-color: var(--accent-1);
        border-width: 2px;
    }

    .model-card-check {
        width: 24px;
        height: 24px;
    }

    .model-card-info {
        padding-left: 0.25rem;
    }

    .model-card-name {
        font-size: 0.95rem;
    }
    
    .model-card-desc {
        font-size: 0.8rem;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* === Discussion View === */
    .discussion-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
        position: sticky;
        top: var(--header-height);
        z-index: 40;
    }

    .discussion-topic {
        width: 100%;
    }

    .discussion-topic h2 {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .discussion-controls {
        display: flex;
        justify-content: space-between;
        gap: 0.5rem;
        padding-top: 0.25rem;
        border-top: 1px solid var(--border-subtle);
    }
    
    .progress-container {
        display: none; /* Hide progress bar on mobile */
    }

    .control-btn {
        flex: 1;
        justify-content: center;
        padding: 0.75rem;
        min-height: 44px; /* Touch target */
    }

    .control-btn span:last-child {
        display: none; /* Icon only */
    }
    
    .control-btn .btn-icon {
        margin: 0;
        font-size: 1.2rem;
    }

    /* === Conversation === */
    .conversation-container {
        padding: 1rem 0.5rem;
        /* Prevent keyboard overlap issues */
        padding-bottom: 100px;
    }
    
    .conversation-thread {
        width: 100%;
    }

    .message {
        flex-direction: column; /* Stack avatar and content */
        gap: 0.5rem;
        margin-bottom: 2rem;
        background: var(--bg-surface);
        padding: 1rem;
        border-radius: var(--radius-lg);
        border: 1px solid var(--border-subtle);
        /* Slight separation from edges */
        width: 100%;
    }

    /* Color code message backgrounds slightly for clarity */
    .message.model-1 { border-left: 3px solid var(--model-1); }
    .message.model-2 { border-left: 3px solid var(--model-2); }
    .message.model-3 { border-left: 3px solid var(--model-3); }
    .message.model-4 { border-left: 3px solid var(--model-4); }

    .message-avatar {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
        align-self: flex-start;
        border-width: 1px;
        margin-bottom: 0.25rem;
    }

    .message-header {
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-bottom: 0.75rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid var(--border-subtle);
    }

    .message-name {
        font-size: 1rem; /* Larger name */
    }

    .message-params {
        display: none; /* Hide technical details */
    }
    
    .message-text {
        font-size: 1rem; /* Larger text for reading */
        line-height: 1.6;
    }

    .message-reactions {
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    .reaction-btn {
        padding: 0.5rem 0.8rem;
        min-height: 32px;
    }

    /* === Start Button === */
    .start-section {
        position: sticky;
        bottom: 0;
        background: linear-gradient(to top, var(--bg-base) 80%, transparent);
        padding: 1.5rem 1rem 2rem 1rem;
        z-index: 20;
        width: 100%;
        margin-left: -1rem; /* Offset parent padding */
        width: calc(100% + 2rem);
    }

    .start-btn {
        width: 100%;
        justify-content: center;
        padding: 1.2rem;
        font-size: 1.1rem;
    }

    /* === Modals === */
    .summary-panel, 
    .judge-panel-content {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: none;
        padding-bottom: env(safe-area-inset-bottom);
        overflow-y: auto;
    }

    .summary-panel {
        animation: slideUpMobile 0.3s ease;
    }

    @keyframes slideUpMobile {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    
    .summary-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    /* Toast */
    .toast-container {
        bottom: 1.5rem;
        right: 1rem;
        left: 1rem;
        width: auto;
        align-items: center;
    }
    
    .toast {
        width: 100%;
        max-width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .mode-selector {
        grid-template-columns: 1fr; /* Stack modes vertically on very small screens */
    }
    
    .mode-btn {
        flex-direction: row;
        text-align: left;
        padding: 1rem;
    }
    
    .mode-icon {
        font-size: 1.5rem;
        margin-right: 0.75rem;
    }

    .templates-section {
        margin: 0 -1rem 1.5rem -1rem;
        padding: 1rem;
    }

    .template-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}

/* Floating Scroll Button */
.scroll-bottom-btn {
    position: fixed;
    bottom: 2rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    background: var(--accent-2);
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    z-index: 90;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0.9;
}

.scroll-bottom-btn:hover {
    transform: scale(1.1);
    opacity: 1;
}

.scroll-bottom-btn.hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   V3.0 NEW FEATURES
   ============================================ */

/* Templates Section */
.templates-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    margin-bottom: 1rem;
    overflow-x: auto;
}

.templates-label {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.templates-container {
    display: flex;
    gap: 0.5rem;
}

.template-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-2);
    color: var(--text-primary);
}

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

/* Section hint */
.section-hint {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}

/* Model Filters */
.model-filters {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
}

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

.model-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    outline: none;
}

.model-search-input::placeholder {
    color: var(--text-muted);
}

.filter-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.capability-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.cap-btn {
    padding: 0.35rem 0.7rem;
    background: var(--bg-active);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    font-family: var(--font-sans);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cap-btn:hover {
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.cap-btn.active {
    background: rgba(139, 92, 246, 0.2);
    color: var(--text-primary);
    border-color: var(--accent-2);
}

/* Tier Groups */
.tier-group {
    margin-bottom: 1.5rem;
}

.tier-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.tier-title {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tier-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Enhanced Model Cards */
.model-card-caps {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.35rem;
}

.cap-tag {
    font-size: 0.7rem;
    opacity: 0.7;
}

.model-output {
    color: var(--accent-3);
    background: rgba(217, 70, 239, 0.15);
    font-size: 0.6rem !important;
}

/* Role Selector */
.model-role-selector {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-subtle);
}

.role-select {
    width: 100%;
    padding: 0.4rem 0.6rem;
    background: var(--bg-active);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    cursor: pointer;
}

/* Participant Role Badge */
.participant-role {
    font-size: 0.8rem;
    margin-left: 0.25rem;
}

.msg-role {
    font-size: 0.8rem;
    margin-left: 0.25rem;
}

/* Verdict Button */
.verdict-btn {
    background: linear-gradient(135deg, #f59e0b, #ef4444) !important;
    border-color: transparent !important;
}

.verdict-btn:hover {
    opacity: 0.9;
}

/* Judge Panel */
.judge-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}

.judge-panel.active {
    display: flex;
}

.judge-panel-content {
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 2rem;
    overflow-y: auto;
}

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

.judge-header h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
}

.close-judge {
    width: 32px;
    height: 32px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-judge:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.judge-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.judge-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.judge-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-surface);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
}

.judge-card:hover {
    background: var(--bg-hover);
    border-color: var(--border-default);
}

.judge-card.selected {
    border-color: var(--accent-2);
    background: var(--gradient-subtle);
}

.judge-check {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-active);
    border-radius: 50%;
    font-size: 0.8rem;
    color: var(--accent-2);
}

.judge-card.selected .judge-check {
    background: var(--accent-2);
    color: white;
}

.judge-icon {
    font-size: 1.5rem;
}

.judge-info {
    flex: 1;
}

.judge-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.judge-context {
    font-size: 0.75rem;
    color: var(--accent-1);
    font-family: var(--font-mono);
}

.judge-card .judge-desc {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin: 0.25rem 0 0 0;
}

.get-verdict-btn {
    width: 100%;
    padding: 1rem;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-lg);
    color: white;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.get-verdict-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.judge-verdicts {
    margin-top: 1.5rem;
}

.judge-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.verdict-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.verdict-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
}

.verdict-icon {
    font-size: 1.25rem;
}

.verdict-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.verdict-content {
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.verdict-content strong {
    color: var(--text-primary);
}

/* Message Reactions */
.message-reactions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle);
}

.reaction-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.6rem;
    background: var(--bg-active);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reaction-btn:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.reaction-btn.reacted {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--accent-2);
    color: var(--text-primary);
}

.reaction-btn span {
    font-family: var(--font-mono);
    font-size: 0.7rem;
}

/* Mode selector - 6 modes now */
.mode-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

@media (max-width: 768px) {
    .mode-selector {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .templates-section {
        padding: 1rem;
    }
    
    .judge-panel-content {
        padding: 1.5rem;
    }
}

/* Model cards container with tier groups */
.model-cards-container {
    max-height: 450px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* ============================================
   v3.3.0 ENHANCEMENTS
   ============================================ */

/* === 1. Dark/Light Mode Toggle === */
.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 150;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.theme-toggle:hover {
    transform: scale(1.1);
    border-color: var(--accent-2);
}

.theme-icon {
    font-size: 1.25rem;
    transition: transform 0.3s ease;
}

/* Light Mode */
body.light-mode {
    --bg-base: #f8fafc;
    --bg-elevated: #ffffff;
    --bg-surface: #f1f5f9;
    --bg-hover: #e2e8f0;
    --bg-active: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --text-muted: #94a3b8;
    --border-subtle: rgba(0, 0, 0, 0.06);
    --border-default: rgba(0, 0, 0, 0.1);
    --border-strong: rgba(0, 0, 0, 0.15);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.15);
}

body.light-mode .bg-gradient {
    opacity: 0.5;
}

body.light-mode .bg-noise {
    opacity: 0.02;
}

/* === 2. Quick Chat Button (Prominent) === */
.quick-chat-btn {
    width: 100%;
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem !important;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(59, 130, 246, 0.15)) !important;
    border: 2px solid var(--model-2) !important;
    border-radius: var(--radius-lg) !important;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-chat-btn:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(59, 130, 246, 0.25)) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.2);
}

.quick-chat-btn.active {
    border-color: var(--model-2) !important;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
}

.quick-chat-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.quick-chat-icon {
    font-size: 2rem;
}

.quick-chat-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.quick-chat-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.quick-chat-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

.quick-chat-arrow {
    font-size: 1.5rem;
    color: var(--model-2);
    transition: transform 0.2s ease;
}

.quick-chat-btn:hover .quick-chat-arrow {
    transform: translateX(4px);
}

/* Compact mode buttons - remove desc */
.mode-selector .mode-btn {
    padding: 0.875rem 0.5rem;
}

.mode-selector .mode-btn .mode-desc {
    display: none;
}

.mode-selector .mode-btn .mode-name {
    font-size: 0.8rem;
}

.mode-selector .mode-btn .mode-icon {
    font-size: 1.25rem;
}

.single-chat-view {
    display: none;
    flex-direction: column;
    height: calc(100vh - var(--header-height));
    background: var(--bg-base);
}

.single-chat-view.active {
    display: flex;
}

.single-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
}

.single-chat-model {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.single-model-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 2px solid var(--accent-2);
}

.single-model-info {
    display: flex;
    flex-direction: column;
}

.single-model-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.single-model-context {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

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

/* Chat Action Buttons with SVG icons */
.chat-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 44px;
    min-height: 44px;
}

.chat-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-default);
}

.chat-action-btn:active {
    transform: scale(0.95);
}

.chat-action-btn svg {
    flex-shrink: 0;
}

.chat-action-btn.back-btn {
    padding: 0.6rem 1rem;
}

.chat-action-btn.back-btn span {
    font-size: 0.85rem;
    font-weight: 500;
}

.single-chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    -webkit-overflow-scrolling: touch;
}

.single-chat-messages {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-tertiary);
}

.welcome-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.chat-welcome h3 {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.chat-welcome p {
    font-size: 0.9rem;
    max-width: 300px;
}

/* Chat Messages */
.chat-message {
    display: flex;
    gap: 1rem;
    animation: messageIn 0.3s ease;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-message-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    background: var(--bg-surface);
    border: 2px solid var(--accent-2);
}

.chat-message.user .chat-message-avatar {
    border-color: var(--model-1);
    background: rgba(59, 130, 246, 0.1);
}

.chat-message-content {
    max-width: 75%;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
}

.chat-message.user .chat-message-content {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
}

.chat-message-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.chat-message-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Chat Input Area */
.single-chat-input-area {
    padding: 1rem 1.5rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-subtle);
}

.chat-input-container {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    max-width: 800px;
    margin: 0 auto;
}

.chat-input {
    flex: 1;
    padding: 0.875rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 16px; /* Prevent iOS zoom */
    line-height: 1.5;
    resize: none;
    max-height: 150px;
    transition: all 0.2s ease;
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent-2);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.chat-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-send-btn:not(:disabled):hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.chat-input-hints {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.hint-item kbd {
    padding: 0.15rem 0.4rem;
    background: var(--bg-active);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
}

/* === 3. Context Menu (Long-press) === */
.context-menu {
    position: fixed;
    display: none;
    flex-direction: column;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    overflow: hidden;
    min-width: 160px;
}

.context-menu.active {
    display: flex;
    animation: contextIn 0.15s ease;
}

@keyframes contextIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s ease;
    text-align: left;
}

.context-menu-item:hover {
    background: var(--bg-hover);
}

.context-menu-item:active {
    background: var(--bg-active);
}

/* === 4. Bottom Sheet Model Selector === */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    z-index: 1500;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.bottom-sheet.active {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--bg-active);
    border-radius: 2px;
    margin: 0.75rem auto;
}

.bottom-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.bottom-sheet-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.close-sheet {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
}

.bottom-sheet-search {
    padding: 1rem 1.5rem;
}

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

.bottom-sheet-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 1.5rem 2rem;
    -webkit-overflow-scrolling: touch;
}

.sheet-model-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-surface);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sheet-model-item:hover {
    border-color: var(--border-default);
    background: var(--bg-hover);
}

.sheet-model-item.selected {
    border-color: var(--accent-2);
    background: var(--gradient-subtle);
}

.sheet-model-icon {
    font-size: 1.5rem;
}

.sheet-model-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.sheet-model-meta {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1400;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.bottom-sheet-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* === 5. Keyboard Shortcuts Help === */
.shortcuts-help {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    z-index: 2000;
    min-width: 320px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
}

.shortcuts-help.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.shortcuts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.shortcuts-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.close-shortcuts {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
}

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

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.shortcut-item kbd {
    min-width: 32px;
    padding: 0.35rem 0.6rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-align: center;
    color: var(--text-primary);
}

/* === 6. Pull to Refresh Indicator === */
.pull-indicator {
    position: fixed;
    top: var(--header-height);
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 100;
    transition: transform 0.2s ease;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pull-indicator.active {
    transform: translateX(-50%) translateY(0);
}

.pull-indicator.refreshing .pull-icon {
    animation: spin 1s linear infinite;
}

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

/* === 7. Enhanced Touch Targets === */
@media (hover: none) and (pointer: coarse) {
    /* Ensure 44px minimum touch targets on mobile */
    .control-btn,
    .mode-btn,
    .tier-btn,
    .cap-btn,
    .length-btn,
    .template-btn,
    .preset-btn,
    .reaction-btn {
        min-height: 44px;
        min-width: 44px;
    }

    .model-card {
        min-height: 72px;
        padding: 1rem;
    }

    /* Larger slider thumbs */
    .config-slider::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }
}

/* === 8. Haptic Visual Feedback === */
.haptic-tap {
    animation: hapticPulse 0.15s ease;
}

@keyframes hapticPulse {
    0% { transform: scale(1); }
    50% { transform: scale(0.97); }
    100% { transform: scale(1); }
}

/* === 9. Swipe Indicator === */
.swipe-indicator {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 100;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.swipe-indicator.left { left: 1rem; }
.swipe-indicator.right { right: 1rem; }

.swipe-indicator.active {
    opacity: 1;
}

/* === Mobile Responsive Updates === */
@media (max-width: 768px) {
    .theme-toggle {
        top: calc(var(--header-height) + 0.5rem);
        right: 0.75rem;
        width: 40px;
        height: 40px;
    }

    .single-chat-header {
        padding: 0.75rem 1rem;
    }

    .single-model-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .single-chat-actions .control-btn span:last-child {
        display: none;
    }

    .chat-input-hints {
        display: none;
    }

    .single-chat-input-area {
        padding: 0.75rem 1rem;
    }

    .chat-message-content {
        max-width: 85%;
    }

    /* Hide keyboard shortcuts on mobile */
    .shortcuts-help {
        display: none;
    }
}

/* === Auto-save indicator === */
.autosave-indicator {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    padding: 0.5rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    color: var(--text-tertiary);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 50;
}

.autosave-indicator.active {
    opacity: 1;
    transform: translateY(0);
}

/* === Message action hover states === */
.message {
    position: relative;
}

.message-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.message:hover .message-actions {
    opacity: 1;
}

.msg-action-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--bg-active);
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.msg-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Touch devices show actions differently */
@media (hover: none) {
    .message-actions {
        display: none;
    }
}

/* ============================================
   COMPACT 2x2 MODEL GRID
   ============================================ */

/* Desktop: Keep current layout */
/* Mobile: Compact 2x2 grid */
@media (max-width: 768px) {
    .model-cards-container {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
        max-height: 55vh;
    }

    .model-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 0.75rem 0.5rem !important;
        min-height: auto !important;
        gap: 0.25rem;
    }

    .model-card-check {
        position: absolute;
        top: 0.4rem;
        right: 0.4rem;
        width: 18px;
        height: 18px;
    }

    .model-card-icon {
        font-size: 1.75rem;
        margin: 0;
    }

    .model-card-info {
        width: 100%;
        padding: 0;
    }

    .model-card-name {
        font-size: 0.75rem;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .model-card-meta {
        justify-content: center;
        gap: 0.25rem;
        margin-top: 0.2rem;
    }

    .model-card-meta span {
        font-size: 0.55rem;
        padding: 0.1rem 0.3rem;
    }

    .model-card-desc {
        display: none;
    }

    .model-card-order {
        top: -4px;
        right: -4px;
        width: 20px;
        height: 20px;
        font-size: 0.65rem;
    }

    /* Speed indicator badge */
    .model-card[data-tier="instant"]::before {
        content: '⚡';
        position: absolute;
        top: 0.4rem;
        left: 0.4rem;
        font-size: 0.7rem;
    }

    /* Tier group headers - more compact */
    .tier-header {
        padding: 0.5rem 0;
        margin-bottom: 0.5rem;
    }

    .tier-title {
        font-size: 0.8rem;
    }

    .tier-subtitle {
        display: none;
    }
}

/* Speed Indicators */
.speed-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    font-size: 0.6rem;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--model-2);
}

.speed-badge.fast {
    background: rgba(16, 185, 129, 0.2);
}

.speed-badge.medium {
    background: rgba(245, 158, 11, 0.15);
    color: var(--model-3);
}

.speed-badge.slow {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-2);
}

/* Smart Suggestion Banner */
.smart-suggestion {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.1));
    border: 1px solid var(--accent-2);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.smart-suggestion:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(59, 130, 246, 0.2));
}

.smart-suggestion-icon {
    font-size: 1.25rem;
}

.smart-suggestion-text {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.smart-suggestion-text strong {
    color: var(--text-primary);
}

.smart-suggestion-action {
    font-size: 0.75rem;
    color: var(--accent-2);
    font-weight: 600;
}

/* Floating Quick Chat Button */
.floating-chat-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
    z-index: 90;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.floating-chat-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(139, 92, 246, 0.5);
}

.floating-chat-btn.visible {
    display: flex;
}

@media (max-width: 768px) {
    .floating-chat-btn {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 56px;
        height: 56px;
    }
}
