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

:root {
    --cream: #F7F8FA;
    --cream-deep: #EEF1F5;
    --amber: #1E3A8A;
    --amber-light: #93C5FD;
    --amber-hover: #1D4ED8;
    --white: #FFFFFF;
    --text-primary: #111111;
    --text-sec: #4B5563;
    --text-muted: #6B7280;
    --border: #D1D5DB;
    --card-shadow: 0 8px 24px rgba(15, 23, 42, .08);
    --card-shadow-hover: 0 10px 28px rgba(15, 23, 42, .11);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 16px;
    --font: 'Inter', system-ui, sans-serif;
    --ease: cubic-bezier(.4, 0, .2, 1);
    --t: 0.22s;
    --history-width: 340px;
}

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

body {
    font-family: var(--font);
    background: linear-gradient(180deg, #F9FAFB 0%, #F3F4F6 100%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    padding-left: var(--history-width);
}

/* ── Utility ── */
.hidden {
    display: none !important;
}

/* ══════════════════════════════════════════
   STICKY NAV HEADER
══════════════════════════════════════════ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(0, 0, 0, .04);
    transition: box-shadow var(--t), background var(--t);
}

.header.scrolled {
    box-shadow: 0 4px 18px rgba(15, 23, 42, .05);
    background: rgba(255, 255, 255, .92);
}

.header-inner {
    max-width: 940px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

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

.logo-text {
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: .3px;
    color: #0F172A;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.top-nav-link {
    border: none;
    background: transparent;
    color: #64748B;
    font-family: var(--font);
    font-size: .74rem;
    font-weight: 550;
    padding: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background var(--t), color var(--t);
}

.top-nav-link:hover {
    background: rgba(30, 58, 138, .06);
    color: #334155;
}

.top-nav-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, .18);
}

/* Opt toggle (in header) */
.opt-toggle-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .82rem;
    font-weight: 500;
    color: var(--text-sec);
    cursor: pointer;
    white-space: nowrap;
}

.opt-icon {
    font-size: .9rem;
}

.opt-status {
    font-size: .78rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 20px;
    transition: color var(--t);
}

.opt-status.on {
    color: var(--amber);
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    display: block;
    width: 40px;
    height: 22px;
    background: var(--border);
    border-radius: 11px;
    position: relative;
    transition: background var(--t);
}

.toggle-switch input:checked~.toggle-track {
    background: var(--amber);
}

.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--white);
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
    transition: transform var(--t);
}

.toggle-switch input:checked~.toggle-track .toggle-thumb {
    transform: translateX(18px);
}

/* ══════════════════════════════════════════
   HERO SECTION (scrolls away)
══════════════════════════════════════════ */
.hero {
    position: relative;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(165deg, #FFF9E0 0%, #FFFBEF 55%, #FFF0C2 100%);
}

/* Subtle animated grid background */
.hero-bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(245, 166, 35, .06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(245, 166, 35, .06) 1px, transparent 1px);
    background-size: 44px 44px;
    animation: gridDrift 18s linear infinite;
}

@keyframes gridDrift {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 44px 44px;
    }
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 24px 24px 28px;
    max-width: 680px;
    width: 100%;
    will-change: opacity, transform;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(250, 204, 21, .25);
    border: 1px solid rgba(245, 166, 35, .35);
    color: #7A4F00;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 6px 16px;
    border-radius: 20px;
    margin-bottom: 28px;
    backdrop-filter: blur(6px);
}

.hero-badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--amber);
    animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.45);
        opacity: .65;
    }
}

.hero-title {
    font-size: clamp(1.6rem, 3.8vw, 2.25rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -.6px;
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hero-accent {
    color: var(--amber);
    display: block;
}

.hero-sub {
    color: var(--text-sec);
    font-size: .95rem;
    line-height: 1.5;
    max-width: 560px;
    margin: 0 auto 8px;
}

.hero-scroll-hint {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: .78rem;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
    animation: hintFade 2.5s ease-in-out 1.5s both;
}

@keyframes hintFade {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

.scroll-arrow {
    font-size: 1.1rem;
    animation: bounceDown 1.6s ease-in-out infinite;
}

@keyframes bounceDown {

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

    50% {
        transform: translateY(5px);
    }
}

/* ══════════════════════════════════════════
   MAIN WORKSPACE
══════════════════════════════════════════ */
.main {
    flex: 1;
    max-width: 1140px;
    margin: 0 auto;
    width: 100%;
    padding: 10px 20px 250px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: calc(100vh - 54px);
}

/* Mode toggle */
.mode-toggle {
    display: inline-flex;
    background: rgba(255, 255, 255, .9);
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 999px;
    padding: 2px;
    gap: 2px;
    box-shadow: none;
}

.mode-btn {
    padding: 4px 10px;
    border-radius: 999px;
    border: none;
    background: transparent;
    font-family: var(--font);
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-sec);
    cursor: pointer;
    transition: background var(--t), color var(--t), box-shadow var(--t), transform var(--t);
}

.mode-btn.active {
    background: #EDF2FF;
    color: #1E3A8A;
    box-shadow: none;
}

.mode-btn:not(.active):hover {
    background: var(--cream-deep);
    color: var(--text-primary);
}

.mode-btn:active {
    transform: scale(.97);
}

/* ── Card ── */
.card {
    background: var(--white);
    border: 1px solid rgba(15, 23, 42, .06);
    border-radius: var(--radius-md);
    box-shadow: none;
    padding: 12px 14px;
    transition: border-color var(--t), transform var(--t);
}

.card:hover {
    border-color: rgba(15, 23, 42, .1);
}

.composer-toolbar {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 4px 8px 4px;
    background: transparent;
}

.composer-toolbar-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    flex-wrap: wrap;
}

.toolbar-mode-toggle {
    box-shadow: none;
    border-color: rgba(15, 23, 42, .08);
    background: rgba(255, 255, 255, .9);
    border-radius: 999px;
    padding: 2px;
}

.toolbar-mode-toggle .mode-btn {
    padding: 4px 10px;
    font-size: .75rem;
    font-weight: 600;
    border-radius: 999px;
}

.feature-strip {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    justify-content: flex-start;
    flex-wrap: nowrap;
}

.feature-chip-wrap {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    flex: 0 0 auto;
    min-width: auto;
}

.feature-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    min-height: 34px;
    border: 1px solid rgba(148, 163, 184, .28);
    background: rgba(248, 250, 252, .86);
    color: rgba(51, 65, 85, .88);
    font-family: var(--font);
    font-size: .72rem;
    font-weight: 600;
    line-height: 1;
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05), inset 0 1px 0 rgba(255, 255, 255, .65);
    transition:
        transform .15s ease,
        filter .15s ease,
        border-color .15s ease,
        background-color .15s ease,
        color .15s ease,
        box-shadow .15s ease,
        opacity .15s ease;
    white-space: nowrap;
    overflow: hidden;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.chip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    font-size: 14px;
    line-height: 1;
    color: currentColor;
    opacity: .82;
    transform: scale(1);
    transition: transform .18s ease, color .18s ease, opacity .18s ease;
    flex-shrink: 0;
}

.chip-label {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.feature-chip:hover:not(:disabled) {
    transform: translateY(-1px);
    background: #F8FAFC;
    border-color: rgba(100, 116, 139, .4);
    color: #1F2937;
    box-shadow: 0 5px 12px rgba(15, 23, 42, .1);
    filter: brightness(1.03);
}

.feature-chip:hover:not(:disabled) .chip-icon {
    transform: scale(1.05);
    opacity: .92;
}

.feature-chip.active,
.feature-chip[aria-checked="true"] {
    color: #1E3A8A;
    background: linear-gradient(180deg, rgba(37, 99, 235, .2), rgba(37, 99, 235, .13));
    border-color: rgba(30, 58, 138, .45);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .12), 0 6px 14px rgba(30, 58, 138, .18);
    font-weight: 700;
    transform: scale(1.02);
}

.feature-chip.active .chip-icon,
.feature-chip[aria-checked="true"] .chip-icon {
    color: #1D4ED8;
    opacity: .96;
}

.feature-chip[aria-checked="true"]:hover:not(:disabled) {
    background: linear-gradient(180deg, rgba(37, 99, 235, .23), rgba(37, 99, 235, .15));
    border-color: rgba(30, 58, 138, .5);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .16), 0 7px 15px rgba(30, 58, 138, .22);
    transform: translateY(-1px) scale(1.02);
    filter: brightness(1.02);
}

.feature-chip:active:not(:disabled) {
    transform: translateY(0) scale(1.01);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 1px 4px rgba(15, 23, 42, .09);
}

.feature-chip.is-toggling {
    animation: chipTogglePulse .28s ease-out;
}

.feature-chip:disabled {
    opacity: .56;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.feature-chip:disabled .chip-icon {
    opacity: .52;
}

@keyframes chipTogglePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(30, 58, 138, .22);
    }

    65% {
        box-shadow: 0 0 0 6px rgba(30, 58, 138, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(30, 58, 138, 0);
    }
}

.chip-tooltip {
    position: absolute;
    top: auto;
    bottom: calc(100% + 8px);
    left: 0;
    min-width: 220px;
    max-width: 360px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, .14);
    background: #111827;
    color: #F9FAFB;
    font-size: .72rem;
    line-height: 1.4;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .26);
    opacity: 0;
    visibility: hidden;
    transform: translateY(2px);
    pointer-events: none;
    transition: opacity .18s ease, visibility .18s ease, transform .18s ease;
    z-index: 20;
}

.feature-chip:hover + .chip-tooltip,
.feature-chip:focus-visible + .chip-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .feature-chip,
    .chip-icon,
    .chip-tooltip {
        transition: none;
    }

    .feature-chip,
    .feature-chip:hover:not(:disabled),
    .feature-chip:active:not(:disabled) {
        transform: none;
    }

    .feature-chip.is-toggling {
        animation: none;
    }
}

.toolbar-model-group,
.toolbar-compare-group {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px 2px;
    flex-wrap: wrap;
}

.toolbar-model-label,
.toolbar-compare-label {
    font-size: .74rem;
    font-weight: 700;
    color: #334155;
}

.toolbar-model-select {
    min-width: 156px;
    max-width: 240px;
    border-color: transparent;
    background-color: transparent;
    padding-left: 0;
    font-size: .78rem;
    font-weight: 600;
}

.toolbar-compare-sep {
    font-size: .7rem;
    color: #64748B;
    font-weight: 600;
}

.toolbar-compare-third {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.toolbar-compare-slot {
    display: inline-flex;
    position: relative;
    align-items: center;
    min-width: 0;
    flex: 0 1 auto;
}

.toolbar-compare-slot .model-picker {
    flex: 1 1 auto;
}

.compare-model-select {
    min-width: 150px;
    max-width: 220px;
}

.compare-remove-model-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    z-index: 3;
    width: 19px;
    height: 19px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(15, 23, 42, .12);
    border-radius: 50%;
    background-color: rgba(255, 255, 255, .96);
    color: rgba(71, 85, 105, .66);
    font-family: var(--font);
    font-size: .8rem;
    font-weight: 700;
    line-height: 1;
    cursor: default;
    box-shadow: 0 4px 10px rgba(15, 23, 42, .08);
    opacity: 0;
    pointer-events: none;
    transform: scale(.94);
    transition:
        opacity 180ms ease,
        transform 180ms ease,
        background-color 180ms ease,
        border-color 180ms ease,
        color 180ms ease,
        box-shadow 180ms ease;
}

.toolbar-compare-slot:hover .compare-remove-model-btn:not(:disabled),
.toolbar-compare-slot:focus-within .compare-remove-model-btn:not(:disabled),
.compare-remove-model-btn:focus-visible {
    cursor: pointer;
    opacity: .86;
    pointer-events: auto;
    transform: scale(1);
}

.compare-remove-model-btn:hover:not(:disabled) {
    background-color: rgba(255, 241, 242, .98);
    border-color: rgba(225, 29, 72, .32);
    color: #BE123C;
    opacity: 1;
    box-shadow: 0 6px 16px rgba(190, 18, 60, .14);
    transform: scale(1.05);
}

.compare-remove-model-btn:focus-visible {
    outline: none;
    background-color: rgba(255, 241, 242, .98);
    border-color: rgba(225, 29, 72, .36);
    color: #BE123C;
    opacity: 1;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, .18), 0 6px 16px rgba(190, 18, 60, .12);
    transform: scale(1.05);
}

.compare-remove-model-btn:disabled {
    cursor: default;
    opacity: 0;
    pointer-events: none;
    box-shadow: none;
    transform: scale(.94);
}

.toolbar-compare-slot.is-removing {
    opacity: 0;
    transform: scale(.98);
    transition: opacity 160ms ease, transform 160ms ease;
}

@media (prefers-reduced-motion: reduce) {
    .compare-remove-model-btn,
    .toolbar-compare-slot.is-removing {
        transition: none;
        transform: none;
    }
}

.toolbar-add-model-btn {
    border: 1px solid rgba(30, 58, 138, .18);
    background: rgba(30, 58, 138, .04);
    color: #1E3A8A;
    font-family: var(--font);
    font-size: .72rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 4px 9px;
    cursor: pointer;
    transition: background var(--t), border-color var(--t), color var(--t);
}

.toolbar-add-model-btn:hover {
    background: rgba(30, 58, 138, .09);
    border-color: rgba(30, 58, 138, .28);
}

.toolbar-add-model-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, .18);
}

.routing-hint {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 0;
    padding: 0 10px 2px;
}

.routing-hint:empty {
    display: none;
}

.routing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(30, 58, 138, .08);
    color: #1E3A8A;
    border: 1px solid rgba(30, 58, 138, .16);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: .71rem;
    font-weight: 600;
    white-space: nowrap;
}

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

.model-select.model-select-enhanced {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.model-picker {
    position: relative;
    display: inline-flex;
    min-width: 164px;
    max-width: 320px;
    flex: 0 1 auto;
}

.model-picker-btn {
    width: 100%;
    min-height: 35px;
    padding: 7px 30px 7px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: border-color var(--t), box-shadow var(--t);
}

.model-picker-btn:hover {
    border-color: #D1D5DB;
}

.model-picker-btn:focus-visible {
    outline: none;
    border-color: var(--amber);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, .14);
}

.model-picker.is-disabled .model-picker-btn {
    opacity: .62;
    cursor: not-allowed;
}

.model-picker-selected {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
}

.model-picker-selected-label {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.model-picker-caret {
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);
    font-size: .68rem;
    color: #6B7280;
    pointer-events: none;
}

.model-picker-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    max-width: calc(100vw - 32px);
    max-height: 260px;
    overflow: auto;
    padding: 6px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, .1);
    background: #FFFFFF;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .16);
    z-index: 260;
    display: none;
}

.model-picker.compare-model-picker .model-picker-menu {
    width: min(400px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
}

.model-picker.open-up .model-picker-menu {
    top: auto;
    bottom: calc(100% + 6px);
}

.model-picker.is-open .model-picker-menu {
    display: block;
}

.model-picker-option {
    width: 100%;
    border: none;
    background: transparent;
    display: inline-flex;
    align-items: flex-start;
    gap: 0;
    min-height: 34px;
    padding: 8px 10px;
    border-radius: 8px;
    font-family: var(--font);
    font-size: .79rem;
    color: #334155;
    cursor: pointer;
    text-align: left;
}

.model-picker-option:hover {
    background: rgba(30, 58, 138, .06);
}

.model-picker-option.is-disabled,
.model-picker-option:disabled {
    color: #94A3B8;
    cursor: not-allowed;
    opacity: .78;
}

.model-picker-option.is-disabled:hover,
.model-picker-option:disabled:hover {
    background: transparent;
}

.model-picker-option.is-active {
    background: rgba(30, 58, 138, .1);
    color: #1E3A8A;
    font-weight: 600;
}

.model-picker-option-text {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.model-picker-option-label {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    overflow: visible;
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal;
    line-height: 1.25;
}

.model-picker-option-secondary {
    display: block;
    min-width: 0;
    color: #64748B;
    font-size: .69rem;
    font-weight: 500;
    line-height: 1.25;
    overflow-wrap: anywhere;
    white-space: normal;
}

.model-picker-option.is-active .model-picker-option-secondary {
    color: #475569;
}

.model-picker-provider-icon,
.model-picker-provider-fallback {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.model-picker-option .model-picker-provider-icon,
.model-picker-option .model-picker-provider-fallback {
    margin-right: 8px;
}

.model-picker-provider-icon {
    border-radius: 4px;
    object-fit: contain;
}

.model-picker-provider-fallback {
    border-radius: 999px;
}

.model-picker-empty {
    font-size: .78rem;
    color: #64748B;
    padding: 8px;
}

.compare-model-select.model-select-enhanced + .model-picker {
    min-width: 150px;
    max-width: 280px;
}

/* Custom select */
.model-select {
    padding: 7px 30px 7px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: .8rem;
    color: var(--text-primary);
    background: var(--white);
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236B7280'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
    transition: border-color var(--t), box-shadow var(--t);
}

.model-select:focus {
    border-color: var(--amber);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, .14);
}

.model-select:hover {
    border-color: #D1D5DB;
}
/* ── Prompt card ── */
.prompt-card {
    padding: 0;
    overflow: visible;
    border: none;
    border-radius: 0;
    box-shadow: none;
    transition: transform .3s var(--ease), top .3s var(--ease), bottom .3s var(--ease);
    position: fixed;
    left: calc(var(--history-width) + ((100vw - var(--history-width)) / 2));
    top: 44%;
    bottom: auto;
    transform: translate(-50%, -50%);
    width: min(940px, calc(100vw - var(--history-width) - 40px));
    z-index: 320;
    background: transparent;
    isolation: isolate;
}

.prompt-card:hover {
    box-shadow: none;
}

.prompt-card.docked {
    top: auto;
    bottom: 14px;
    transform: translateX(-50%);
}

.prompt-card.focused {
    box-shadow: none;
}

.prompt-card.expanded {
    border-color: transparent;
}

.prompt-input-wrap {
    position: relative;
    z-index: 12;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 8px;
    padding: 6px 8px;
    border: 1px solid rgba(148, 163, 184, .32);
    border-radius: 30px;
    min-height: 48px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 6px 16px rgba(15, 23, 42, .08);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
    cursor: text;
}

.prompt-input-wrap:focus-within {
    border-color: rgba(30, 58, 138, .34);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, .11), 0 8px 18px rgba(15, 23, 42, .1);
    background: #FFFFFF;
}

.prompt-input-action {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(148, 163, 184, .34);
    background: #F8FAFC;
    color: #475569;
    font-size: 1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform .15s ease, border-color .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
    position: relative;
    z-index: 4;
    pointer-events: auto;
}

.prompt-input-action:hover {
    transform: translateY(-1px);
    border-color: rgba(100, 116, 139, .45);
    background: #FFFFFF;
    color: #334155;
    box-shadow: 0 3px 9px rgba(15, 23, 42, .08);
}

.prompt-input-action:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(30, 58, 138, .18);
}

#promptAddBtn {
    cursor: pointer;
    pointer-events: auto !important;
}

.attachment-input {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.prompt-input-add {
    font-size: .9rem;
}

.prompt-textarea {
    display: block;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 36px;
    max-height: 112px;
    height: 36px;
    padding: 8px 2px;
    border: none;
    outline: none;
    font-family: var(--font);
    font-size: .93rem;
    color: var(--text-primary);
    background: transparent;
    resize: none;
    line-height: 1.4;
    overflow-y: hidden;
    transition: height .15s ease;
    position: relative;
    z-index: 3;
    pointer-events: auto;
    cursor: text;
}

.prompt-textarea::placeholder {
    color: #94A3B8;
    font-size: .88rem;
}

#promptInput {
    cursor: text;
    pointer-events: auto !important;
}

.attachment-strip {
    display: grid;
    gap: 6px;
    margin: 8px 12px 0;
    padding: 8px 10px;
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 12px;
    background: rgba(248, 250, 252, .72);
}

.attachment-strip.hidden {
    display: none;
}

.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    padding: 5px 8px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, .35);
    background: #FFFFFF;
    color: #334155;
    font-size: .74rem;
}

.attachment-chip.is-ready {
    border-color: rgba(16, 185, 129, .44);
    background: rgba(236, 253, 245, .9);
}

.attachment-chip.is-uploading,
.attachment-chip.is-processing,
.attachment-chip.is-queued {
    border-color: rgba(59, 130, 246, .38);
    background: rgba(239, 246, 255, .92);
}

.attachment-chip.is-error {
    border-color: rgba(248, 113, 113, .52);
    background: rgba(254, 242, 242, .95);
    color: #7F1D1D;
}

.attachment-chip-name {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.attachment-chip-meta {
    opacity: .8;
    white-space: nowrap;
}

.attachment-chip-retry {
    border: 1px solid rgba(59, 130, 246, .34);
    border-radius: 8px;
    background: rgba(219, 234, 254, .72);
    color: #1D4ED8;
    font-size: .68rem;
    font-weight: 600;
    padding: 2px 7px;
    cursor: pointer;
    line-height: 1.2;
}

.attachment-chip-retry:hover {
    background: rgba(191, 219, 254, .82);
}

.attachment-chip-retry:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, .26);
}

.attachment-chip-remove {
    border: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(148, 163, 184, .18);
    color: inherit;
    font-size: .82rem;
    cursor: pointer;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.attachment-chip-remove:hover {
    background: rgba(100, 116, 139, .22);
}

.attachment-chip-remove:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(30, 58, 138, .22);
}

.attachment-hint {
    min-height: 16px;
    font-size: .72rem;
    color: #64748B;
}

.prompt-footer {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 10px 2px;
    border-top: none;
    background: transparent;
    gap: 8px;
}

.prompt-footer-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
    flex: 1 1 auto;
    flex-wrap: wrap;
}

.composer-footer-features {
    width: 100%;
    gap: 10px;
    min-height: 0;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
}

.prompt-footer-right {
    display: inline-flex;
    align-items: flex-end;
    justify-content: flex-end;
    flex: 0 0 auto;
    margin-left: auto;
}

.prompt-hint {
    font-size: .78rem;
    color: var(--text-muted);
}

.prompt-hint kbd {
    font-family: var(--font);
    background: var(--border);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: .72rem;
}

.feature-chip:focus-visible,
.model-select:focus-visible,
.btn-submit:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(30, 58, 138, .22);
}

.prompt-textarea:focus,
.prompt-textarea:focus-visible {
    outline: none;
    box-shadow: none;
}

/* ✨ View Optimized button */
.btn-opt-view {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1.5px solid rgba(30, 58, 138, .4);
    background: rgba(147, 197, 253, .16);
    font-family: var(--font);
    font-size: .74rem;
    font-weight: 600;
    color: #1E3A8A;
    cursor: pointer;
    transition: all var(--t);
    animation: fadeUp .3s var(--ease) both;
}

.btn-opt-view:hover {
    background: rgba(147, 197, 253, .26);
    border-color: var(--amber);
    transform: translateY(-1px);
}

/* ── Optimized Prompt Panel ── */
.opt-panel {
    background: var(--white);
    border: 1.5px solid rgba(30, 58, 138, .3);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 12px rgba(30, 58, 138, .1), var(--card-shadow);
    overflow: hidden;
    animation: fadeUp .3s var(--ease) both;
}

.opt-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: linear-gradient(135deg, #FFFFFF, #EFF6FF);
    border-bottom: 1px solid rgba(30, 58, 138, .18);
}

.opt-panel-title {
    font-size: .84rem;
    font-weight: 700;
    color: #1E3A8A;
}

.opt-panel-close {
    background: transparent;
    border: none;
    font-size: .9rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 3px 7px;
    border-radius: 5px;
    transition: background var(--t), color var(--t);
}

.opt-panel-close:hover {
    background: rgba(30, 58, 138, .12);
    color: var(--text-primary);
}

.opt-panel-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.opt-col {
    padding: 14px 18px;
}

.opt-col-right {
    border-left: 1px solid rgba(30, 58, 138, .16);
    background: rgba(147, 197, 253, .08);
}

.opt-col-label {
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .1em;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.opt-col-right .opt-col-label {
    color: #1E3A8A;
}

.opt-col-text {
    font-size: .86rem;
    line-height: 1.65;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 580px) {
    .opt-panel-body {
        grid-template-columns: 1fr;
    }

    .opt-col-right {
        border-left: none;
        border-top: 1px solid rgba(30, 58, 138, .2);
    }
}

/* ── Submit button ──
 */
.btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 999px;
    border: none;
    background: var(--amber);
    color: var(--white);
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
    box-shadow: 0 4px 12px rgba(30, 58, 138, .3);
    position: relative;
    overflow: hidden;
}

.btn-submit::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, .3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity var(--t);
}

.btn-submit:hover:not(:disabled)::after {
    opacity: 1;
}

.btn-submit:hover:not(:disabled) {
    background: var(--amber-hover);
    transform: translateY(-1px);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .15), 0 6px 16px rgba(30, 58, 138, .3);
}

.btn-submit.is-stop {
    background: #DC2626;
    box-shadow: 0 4px 12px rgba(220, 38, 38, .3);
}

.btn-submit.is-stop:hover:not(:disabled) {
    background: #B91C1C;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, .2), 0 6px 16px rgba(185, 28, 28, .3);
}

.btn-submit-inline {
    position: static;
    z-index: 4;
    pointer-events: auto;
    flex-shrink: 0;
}

.btn-submit:active:not(:disabled) {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: .45;
    cursor: default;
    box-shadow: none;
    pointer-events: none;
}

.btn-icon {
    font-size: .86rem;
}

.stop-icon {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: currentColor;
    display: inline-block;
    flex-shrink: 0;
}
/* Spinner */
.spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    display: inline-block;
    flex-shrink: 0;
}

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

/* ── Example chips ── */
.examples-title {
    font-size: .67rem;
    font-weight: 800;
    letter-spacing: .1em;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.examples-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.examples-section {
    display: none;
}

.chip {
    padding: 6px 13px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: var(--white);
    font-family: var(--font);
    font-size: .8rem;
    font-weight: 500;
    color: var(--text-sec);
    cursor: pointer;
    transition: background var(--t), border-color var(--t), color var(--t), transform var(--t), box-shadow var(--t);
}

.chip:hover {
    background: var(--cream-deep);
    border-color: var(--amber-light);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(30, 58, 138, .15);
}

.chip:active {
    transform: translateY(0);
}

/* ── Results ── */
.results-section {
    animation: fadeUp .4s var(--ease) both;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 10px;
}

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

.results-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.btn-clear {
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 5px 12px;
    font-family: var(--font);
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--t);
}

.btn-clear:hover {
    background: #F3F4F6;
    color: #111827;
    border-color: #9CA3AF;
}

.results-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr;
}

.results-grid.multi {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.jump-to-latest {
    position: fixed;
    left: calc(var(--history-width) + ((100vw - var(--history-width)) / 2));
    bottom: 128px;
    z-index: 340;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(30, 58, 138, .18);
    border-radius: 999px;
    background: rgba(255, 255, 255, .96);
    color: #1E3A8A;
    font-family: var(--font);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .14);
    cursor: pointer;
    transition: transform var(--t), box-shadow var(--t), border-color var(--t), background var(--t);
}

.jump-to-latest:hover {
    transform: translateX(-50%) translateY(-1px);
    border-color: rgba(30, 58, 138, .28);
    background: #FFFFFF;
    box-shadow: 0 14px 32px rgba(15, 23, 42, .18);
}

.jump-to-latest:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, .18), 0 14px 32px rgba(15, 23, 42, .16);
}

/* ── Response card ── */
.response-card {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow var(--t), transform var(--t), border-color var(--t);
}

.response-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}

.response-card.error-card {
    border-color: #FECACA;
}

.response-card.loading-card .response-text::after {
    content: "▋";
    margin-left: 2px;
    color: var(--amber);
    animation: streamCursor 0.9s steps(1) infinite;
}

@keyframes streamCursor {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

/* Staggered entry animation via inline style animation-delay */
@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(.98);
    }

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

.response-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px;
    border-bottom: 1px solid rgba(209, 213, 219, .6);
    background: #FFFFFF;
}

.web-source-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px 9px;
    background: #FAFAFA;
    border-top: 1px solid rgba(209, 213, 219, .75);
}

.web-source-label {
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #64748B;
}

.web-source-icons {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.web-source-icon-link {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, .45);
    background: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}

.web-source-icon-link:hover {
    transform: translateY(-1px);
    border-color: rgba(30, 58, 138, .42);
    box-shadow: 0 2px 8px rgba(30, 58, 138, .18);
}

.web-source-icon-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, .18);
}

.web-source-icon {
    width: 12px;
    height: 12px;
    display: block;
}

.model-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--cream-deep);
    border: 1px solid var(--amber-light);
    border-radius: 6px;
    padding: 3px 10px;
    font-size: .76rem;
    font-weight: 700;
    color: #1E3A8A;
}

.provider-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.provider-logo {
    display: inline-block;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 4px;
}

.provider-logo-inline {
    width: 12px;
    height: 12px;
}

/* Pulsing while card is loading */
.provider-dot.loading {
    animation: pulseDot 1.2s ease-in-out infinite;
}

.response-card-body {
    padding: 16px;
    flex: 1;
}

.turn-user-prompt {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #EFF6FF;
    border: 1px solid #DBEAFE;
}

.turn-user-label {
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #1D4ED8;
    margin-bottom: 4px;
}

.turn-user-text {
    margin: 0;
    font-size: .88rem;
    line-height: 1.55;
    color: #1E293B;
    white-space: pre-wrap;
    word-break: break-word;
}

.response-text {
    font-size: .9rem;
    line-height: 1.72;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

.model-soft-error {
    margin: 24px 16px;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid #FDE68A;
    background: linear-gradient(180deg, #FFFBEB 0%, #FEF3C7 100%);
    color: #92400E;
    font-size: .92rem;
    line-height: 1.55;
    font-style: normal;
}

.model-soft-error-title {
    font-weight: 650;
    margin-bottom: 4px;
}

.model-soft-error-body {
    color: #A16207;
}

.response-error,
.response-text.error-text {
    font-family: var(--font);
    font-size: .9rem;
    line-height: 1.58;
    color: #92400E;
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: none;
    font-style: normal;
}

.response-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    background: #FAFAFA;
    flex-wrap: wrap;
}

.response-stats {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.response-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.response-action-btn {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: 1px solid rgba(203, 213, 225, .9);
    background: #FFFFFF;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color var(--t), border-color var(--t), background var(--t), box-shadow var(--t), transform var(--t);
}

.response-action-btn svg {
    width: 14px;
    height: 14px;
}

.response-action-btn:hover {
    color: #0F172A;
    border-color: rgba(148, 163, 184, .95);
    background: #F8FAFC;
}

.response-action-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, .16);
}

.response-action-btn.copied {
    color: #1D4ED8;
    border-color: rgba(37, 99, 235, .4);
    background: rgba(239, 246, 255, .95);
}

.response-action-btn[data-action="like"].is-active {
    color: #15803D;
    border-color: rgba(34, 197, 94, .35);
    background: rgba(240, 253, 244, .95);
}

.response-action-btn[data-action="dislike"].is-active {
    color: #B91C1C;
    border-color: rgba(248, 113, 113, .5);
    background: rgba(254, 242, 242, .95);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-label {
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .09em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-value {
    font-size: .8rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ── Error banner ── */
.error-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0 0 14px;
    background: linear-gradient(180deg, #FFFBEB 0%, #FFF7ED 100%);
    border: 1px solid #FCD9BD;
    border-radius: 12px;
    padding: 14px 15px;
    color: #7C2D12;
    box-shadow: 0 8px 18px rgba(124, 45, 18, .08);
    animation: errorBannerIn .18s var(--ease) both;
}

.error-icon-wrap {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: rgba(251, 146, 60, .2);
    border: 1px solid rgba(249, 115, 22, .3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.error-icon {
    font-size: .95rem;
    line-height: 1;
    animation: pulseWarn 1.6s ease-in-out infinite;
}

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

.error-title {
    font-size: .92rem;
    font-weight: 700;
    color: #9A3412;
    margin-bottom: 3px;
}

.error-message {
    font-size: .86rem;
    line-height: 1.4;
    color: #9A3412;
}

.error-hint {
    margin-top: 2px;
    font-size: .78rem;
    line-height: 1.4;
    color: #B45309;
}

.error-retry {
    margin-top: 10px;
    border: 1px solid #FDBA74;
    background: linear-gradient(180deg, #FFEDD5 0%, #FED7AA 100%);
    color: #7C2D12;
    border-radius: 9px;
    padding: 6px 12px;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--t), box-shadow var(--t), background var(--t);
}

.error-retry:hover {
    background: linear-gradient(180deg, #FED7AA 0%, #FDBA74 100%);
    box-shadow: 0 4px 12px rgba(124, 45, 18, .14);
}

.error-retry:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(251, 146, 60, .3);
}

.error-retry:disabled {
    cursor: not-allowed;
    opacity: .72;
    box-shadow: none;
    transform: none;
}

.error-close {
    margin-left: 8px;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    color: #9A3412;
    font-size: 1rem;
    line-height: 1;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    transition: background var(--t), border-color var(--t);
}

.error-close:hover {
    background: rgba(251, 146, 60, .16);
    border-color: rgba(251, 146, 60, .35);
}

.error-close:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(251, 146, 60, .25);
}

/* ── Provider dots ── */
.dot-openai {
    background: #10A37F;
}

.dot-gemini {
    background: #4285F4;
}

.dot-deepseek {
    background: #5B5BD6;
}

.dot-grok {
    background: #1DA1F2;
}

/* ── Shared animations ── */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

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

/* ── Responsive ── */
@keyframes errorBannerIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

@keyframes pulseWarn {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.08);
        opacity: .88;
    }
}

@media (max-width: 620px) {
    .main {
        padding: 14px 14px 220px;
        gap: 14px;
    }

    .hero-content {
        padding: 48px 16px 60px;
    }

    .hero-title {
        font-size: 1.9rem;
    }

    .results-grid.multi {
        grid-template-columns: 1fr;
    }

    .mode-btn {
        padding: 4px 9px;
        font-size: .76rem;
    }

    .header-inner {
        padding: 0 14px;
    }

    .composer-toolbar-row {
        flex-direction: row;
        align-items: center;
    }

    .toolbar-mode-toggle {
        width: auto;
    }

    .toolbar-mode-toggle .mode-btn {
        flex: 0 0 auto;
    }

    .composer-toolbar-row .feature-strip {
        width: 100%;
        justify-content: flex-start;
    }

    .feature-chip-wrap {
        flex: 0 0 auto;
        min-width: auto;
        max-width: 100%;
    }

    .toolbar-model-group,
    .toolbar-compare-group {
        width: 100%;
        justify-content: flex-start;
        padding-inline: 10px;
    }

    .toolbar-model-select,
    .compare-model-select {
        min-width: 0;
        max-width: 100%;
        flex: 1 1 180px;
    }

    .toolbar-model-select.model-select-enhanced + .model-picker,
    .compare-model-select.model-select-enhanced + .model-picker {
        min-width: 0;
        max-width: 100%;
        flex: 1 1 180px;
    }

    .toolbar-compare-slot {
        flex: 1 1 210px;
        max-width: 100%;
    }

    .toolbar-compare-third {
        flex: 1 1 100%;
    }

    .toolbar-add-model-btn {
        margin-left: auto;
    }

    .top-nav-link {
        padding: 4px 6px;
        font-size: .72rem;
    }

    .routing-indicator {
        font-size: .69rem;
    }

    .prompt-card {
        width: calc(100vw - 20px);
        left: 50%;
        top: 46%;
    }

    .prompt-input-wrap {
        margin: 0 4px;
        padding: 6px 7px;
        min-height: 46px;
        gap: 6px;
    }

    .prompt-input-action {
        width: 28px;
        height: 28px;
    }

    .attachment-strip {
        margin: 7px 6px 0;
        padding: 7px 8px;
    }

    .attachment-chip-name {
        max-width: 150px;
    }

    .prompt-footer {
        align-items: center;
        gap: 6px;
        padding: 7px 6px 2px;
    }

    .prompt-footer-left {
        max-width: 100%;
        gap: 6px;
    }

    .composer-footer-features {
        width: 100%;
        gap: 10px;
        justify-content: flex-start;
        flex-wrap: nowrap;
    }

    .prompt-card.docked {
        bottom: 10px;
    }
}

/* ══════════════════════════════════════════
   HISTORY SIDEBAR
══════════════════════════════════════════ */

@media (max-width: 1300px) {
    :root {
        --history-width: 300px;
    }
}

@media (max-width: 980px) {
    body {
        padding-left: 0;
    }
    .prompt-card {
        left: 50%;
        width: calc(100vw - 28px);
    }

    .jump-to-latest {
        left: 50%;
    }

    .history-sidebar {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        width: 100% !important;
        height: 320px !important;
        border-right: none !important;
        border-bottom: 1px solid rgba(229, 231, 235, 0.8) !important;
        box-shadow: none !important;
        z-index: 120 !important;
    }
}
.history-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--history-width);
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(24px) saturate(1.8);
    -webkit-backdrop-filter: blur(24px) saturate(1.8);
    border-right: 1px solid rgba(229, 231, 235, 0.8);
    z-index: 210;
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.08);
}

.history-sidebar-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.history-sidebar-title {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
}

.history-sidebar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-btn {
    min-height: 34px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-family: var(--font);
    font-size: 0.74rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transform: translateY(0);
    transition: background .16s ease-out, color .16s ease-out, border-color .16s ease-out, box-shadow .16s ease-out, transform .16s ease-out;
}

.history-btn-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.history-btn-primary {
    background: #0F172A;
    color: #FFFFFF;
    border-color: rgba(15, 23, 42, .25);
}

.history-btn-primary:hover {
    background: #111F38;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.history-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.history-btn-secondary {
    background: rgba(15, 23, 42, .03);
    color: #64748B;
    border-color: rgba(15, 23, 42, .1);
}

.history-btn-secondary:hover {
    background: rgba(15, 23, 42, .06);
    color: #475569;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
}

.history-btn-secondary:active {
    transform: translateY(0);
    box-shadow: none;
}

.history-btn:focus-visible {
    outline: 2px solid rgba(0, 0, 0, 0.1);
    outline-offset: 2px;
}

.history-search-wrap {
    padding: 12px 20px 10px;
    position: relative;
}

.history-search-icon {
    position: absolute;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.76rem;
    color: #94A3B8;
    pointer-events: none;
}

.history-search {
    width: 100%;
    height: 40px;
    padding: 0 12px 0 34px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, .12);
    background: var(--white);
    font-family: var(--font);
    font-size: 0.84rem;
    color: #0F172A;
    outline: none;
    transition: border-color .16s ease-out, box-shadow .16s ease-out, background .16s ease-out;
}

.history-search::placeholder {
    color: #94A3B8;
}

.history-search:focus {
    border-color: rgba(30, 58, 138, .3);
    box-shadow: 0 0 0 2px rgba(30, 58, 138, .08);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 5px 17px 28px;
    list-style: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, .38) transparent;
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(148, 163, 184, .28);
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, .38);
}

.history-entry {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, .88);
    border: 1px solid rgba(15, 23, 42, .07);
    border-radius: 8px;
    padding: 8px 10px 7px;
    margin-bottom: 6px;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65);
    transition: background .14s ease-out, border-color .14s ease-out, box-shadow .14s ease-out, transform .14s ease-out;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.history-entry:not(.is-active-session):hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, .98);
    border-color: rgba(15, 23, 42, .12);
    box-shadow: 0 4px 12px rgba(15, 23, 42, .045);
}

.history-entry:active {
    transform: translateY(0);
    background: rgba(248, 250, 252, .96);
}

.history-entry.is-active-session {
    background: rgba(255, 255, 255, .96);
    border-color: rgba(37, 99, 235, .18);
    box-shadow: none;
}

.history-entry.is-active-session::before {
    content: "";
    position: absolute;
    left: 0;
    top: 7px;
    bottom: 7px;
    width: 2px;
    border-radius: 0 999px 999px 0;
    background: rgba(37, 99, 235, .5);
}

.history-entry-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.history-mode-badge {
    flex-shrink: 0;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: none;
    line-height: 1.15;
    padding: 1.5px 6px;
    border-radius: 999px;
    letter-spacing: 0;
    border: 1px solid rgba(15, 23, 42, .06);
}

.history-timestamp {
    min-width: 0;
    max-width: 132px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-left: auto;
    color: #A7B0BD;
    font-size: 0.66rem;
    font-weight: 500;
    line-height: 1.25;
}

.history-mode-chat {
    background: rgba(59, 130, 246, .075);
    color: #315987;
}

.history-mode-compare {
    background: rgba(15, 23, 42, .045);
    color: #475569;
}

.history-mode-mixed {
    background: rgba(245, 158, 11, .09);
    color: #8A5A10;
}

.history-provider-model {
    margin-left: auto;
    min-width: 0;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.72rem;
    font-weight: 500;
    color: #64748B;
}

.history-delete-btn {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    border: 1px solid transparent;
    background: transparent;
    color: rgba(71, 85, 105, .6);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity .16s ease-out, color .16s ease-out, background .16s ease-out, border-color .16s ease-out;
}

.history-delete-btn svg {
    width: 13px;
    height: 13px;
}

.history-entry:hover .history-delete-btn,
.history-entry:focus-within .history-delete-btn,
.history-delete-btn:focus-visible {
    opacity: 1;
    pointer-events: auto;
}

.history-delete-btn:hover {
    border-color: rgba(239, 68, 68, .25);
    background: rgba(239, 68, 68, .08);
    color: #EF4444;
}

.history-delete-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(30, 58, 138, .12);
}

.history-prompt {
    font-size: 0.84rem;
    font-weight: 600;
    color: #0F172A;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.history-meta {
    margin-top: -1px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 18px;
    font-size: 0.69rem;
    color: #64748B;
    font-weight: 500;
}

.history-meta-left {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.history-cost-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.69rem;
    line-height: 1.25;
    color: #7C8796;
}

@media (hover: none) {
    .history-delete-btn {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Empty state */
.history-empty {
    flex: 1;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.history-empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.2;
}

.history-empty p {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Messenger UI Overrides */
.main {
    padding: 8px 20px 128px;
    gap: 8px;
}

.results-section {
    padding: 0 4px 120px;
}

.results-header {
    justify-content: flex-end;
    margin-bottom: 8px;
}

.results-title {
    display: none;
}

.btn-clear {
    background: rgba(255, 255, 255, .86);
    border: 1px solid rgba(148, 163, 184, .32);
    border-radius: 999px;
    padding: 6px 11px;
    font-size: .74rem;
    color: #64748B;
}

.btn-clear:hover {
    background: rgba(248, 250, 252, .95);
    color: #334155;
    border-color: rgba(100, 116, 139, .4);
}

.results-grid,
.results-grid.multi {
    display: flex;
    flex-direction: column;
    grid-template-columns: none !important;
    gap: 8px;
    padding-bottom: 16px;
}

.chat-message {
    width: 100%;
    display: flex;
    animation: messageIn .2s ease-out both;
}

.chat-message-user {
    justify-content: flex-end;
}

.chat-message-ai {
    justify-content: flex-start;
    margin-bottom: 2px;
}

.chat-message-system {
    justify-content: center;
    margin-top: 8px;
}

.chat-message-user+.chat-message-ai {
    margin-top: 8px;
}

.chat-message-ai+.chat-message-user,
.compare-summary-card+.chat-message-user {
    margin-top: 16px;
}

.results-grid.compare-transcript {
    gap: 14px;
}

.compare-turn {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.compare-grid {
    width: 100%;
    display: grid;
    gap: 12px;
    align-items: start;
}

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

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

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

.compare-column {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.compare-model-header {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    min-width: 0;
    padding: 7px 10px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, .08);
    background: rgba(248, 250, 252, .92);
    color: #334155;
    font-size: .74rem;
    line-height: 1.25;
    font-weight: 600;
}

.compare-model-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    object-fit: contain;
    border-radius: 4px;
}

.compare-model-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compare-column .chat-message-ai {
    margin: 0;
}

.compare-column .chat-bubble {
    max-width: 100%;
    width: 100%;
}

.compare-column .chat-bubble-ai {
    border-radius: 14px;
}

.chat-bubble {
    max-width: 72%;
    border-radius: 22px;
    padding: 12px 14px;
    border: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
    background: #FFFFFF;
}

.chat-bubble-user {
    background: #EAF1FF;
    border-bottom-right-radius: 8px;
}

.chat-bubble-ai {
    position: relative;
    background: #FFFFFF;
    border-bottom-left-radius: 8px;
    padding: 12px 14px;
}

.chat-bubble-system {
    max-width: min(580px, 95%);
    background: rgba(248, 250, 252, .8);
    border-color: rgba(148, 163, 184, .26);
    border-radius: 14px;
}

.optimization-message {
    justify-content: flex-end;
}

.optimization-bubble {
    position: relative;
    overflow: hidden;
    max-width: 72%;
    background:
        linear-gradient(135deg, rgba(234, 241, 255, .98), rgba(241, 246, 255, .94)),
        #EAF1FF;
    border-bottom-right-radius: 8px;
    transition: opacity .09s ease-out, filter .09s ease-out, transform .09s ease-out;
}

.optimization-user-text {
    min-width: 0;
}

.optimization-message.is-pending .optimization-bubble {
    animation: optimizationBubbleBreath 3.6s ease-in-out infinite;
}

.optimization-message.is-pending .optimization-bubble::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, .38) 45%, transparent 70%);
    opacity: .42;
    transform: translateX(-120%);
    animation: optimizationBubbleShimmer 3.8s ease-in-out infinite;
}

.optimization-message.is-resolving .optimization-bubble {
    animation: optimizationResolveFade .09s ease-out forwards;
}

.optimization-message.is-pending .optimization-user-text {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    font-size: .82rem;
    line-height: 1.35;
    font-weight: 700;
    color: #0F3A6D;
}

.optimization-sparkle {
    display: inline-block;
    font-size: 0;
    transform-origin: center;
    filter: drop-shadow(0 0 5px rgba(37, 99, 235, .22));
    animation: optimizationSparkleGlow 2.6s ease-in-out infinite;
}

.optimization-sparkle::before {
    content: "\2728";
    font-size: .82rem;
}

.optimization-state-text {
    display: inline-block;
    transition: opacity .16s ease, transform .16s ease, filter .16s ease;
}

.optimization-state-text.is-swapping {
    opacity: .28;
    transform: translateY(-2px);
    filter: blur(.2px);
}

.optimization-dots {
    display: inline-flex;
    align-items: flex-end;
    gap: 1px;
    color: rgba(23, 37, 84, .85);
}

.optimization-dot {
    display: inline-block;
    opacity: .28;
    transform: translateY(0);
    animation: optimizationDotFloat 1.25s ease-in-out infinite;
}

.optimization-dot:nth-child(2) {
    animation-delay: .16s;
}

.optimization-dot:nth-child(3) {
    animation-delay: .32s;
}

.optimization-message.is-cancelled .optimization-user-text {
    color: #64748B;
}

.optimization-result-note {
    margin: 6px 0 0;
    display: inline-block;
    padding: 4px 8px;
    font-size: .66rem;
    line-height: 1.3;
    font-weight: 500;
    letter-spacing: .01em;
    color: #3F6F5E;
    background: #F3FAF6;
    border: 1px solid #CFE8DA;
    border-radius: 8px;
}

.optimization-message.is-kept-original .optimization-result-note {
    color: #3F6F5E;
    background: #F3FAF6;
    border-color: #CFE8DA;
}

.optimization-message.is-failed .optimization-result-note {
    color: #3F6F5E;
    background: #F3FAF6;
    border-color: #CFE8DA;
}

@keyframes optimizationBubbleBreath {
    0%,
    100% {
        filter: saturate(1);
        transform: translateY(0);
    }
    50% {
        filter: saturate(1.06);
        transform: translateY(-1px);
    }
}

@keyframes optimizationBubbleShimmer {
    0%,
    42% {
        transform: translateX(-120%);
    }
    72%,
    100% {
        transform: translateX(120%);
    }
}

@keyframes optimizationSparkleGlow {
    0%,
    100% {
        opacity: .78;
        transform: scale(1) rotate(0deg);
    }
    45% {
        opacity: 1;
        transform: scale(1.08) rotate(4deg);
    }
}

@keyframes optimizationDotFloat {
    0%,
    75%,
    100% {
        opacity: .28;
        transform: translateY(0);
    }
    35% {
        opacity: .92;
        transform: translateY(-2px);
    }
}

@keyframes optimizationResolveFade {
    from {
        opacity: 1;
        filter: blur(0);
    }
    to {
        opacity: .18;
        filter: blur(.8px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .optimization-message.is-pending .optimization-bubble,
    .optimization-message.is-pending .optimization-bubble::before,
    .optimization-sparkle,
    .optimization-dot {
        animation: none;
    }

    .optimization-state-text {
        transition: none;
    }
}

.chat-user-text {
    margin: 0;
    font-size: .92rem;
    line-height: 1.55;
    color: #172554;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-user-files {
    display: grid;
    gap: 8px;
    margin-top: 10px;
    width: min(100%, 440px);
}

.chat-user-files:first-child {
    margin-top: 0;
}

.user-file-card {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    min-width: 0;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, .06);
    background: linear-gradient(135deg, rgba(255, 255, 255, .94) 0%, rgba(248, 250, 252, .86) 100%);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
    padding: 12px;
    transition: box-shadow var(--t), transform var(--t), border-color var(--t), background var(--t);
}

.user-file-card:hover {
    transform: translateY(-1px);
    border-color: rgba(30, 58, 138, .12);
    background: linear-gradient(135deg, #FFFFFF 0%, rgba(241, 245, 249, .92) 100%);
    box-shadow: 0 12px 28px rgba(15, 23, 42, .1);
}

.user-file-card.is-failed {
    border-color: rgba(248, 113, 113, .3);
    background: linear-gradient(135deg, #FFFFFF 0%, rgba(254, 242, 242, .86) 100%);
}

.user-file-card.is-uploading {
    border-color: rgba(59, 130, 246, .16);
}

.user-file-thumb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, .06);
    background: linear-gradient(180deg, #F8FAFC 0%, #EEF2F7 100%);
    color: #334155;
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75);
}

.user-file-thumb.is-image {
    background: linear-gradient(180deg, #F0FDFA 0%, #E2E8F0 100%);
    color: #0F766E;
}

.user-file-thumb.has-preview {
    background: #E2E8F0;
    box-shadow: none;
}

.user-file-thumb-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-file-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 4px;
    padding-top: 1px;
}

.user-file-name {
    font-size: .9rem;
    line-height: 1.28;
    color: #0F172A;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-file-meta {
    min-width: 0;
    font-size: .72rem;
    line-height: 1.3;
    color: #64748B;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-file-status {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    white-space: nowrap;
    font-size: .72rem;
    line-height: 1.3;
    font-weight: 600;
    color: #334155;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-file-status::before {
    content: "";
    width: 5px;
    height: 5px;
    flex: 0 0 5px;
    margin-right: 7px;
    border-radius: 999px;
    background: #64748B;
}

.user-file-card.is-uploading .user-file-status {
    color: #1D4ED8;
}

.user-file-card.is-uploading .user-file-status::before {
    background: #3B82F6;
}

.user-file-card.is-failed .user-file-status {
    color: #B91C1C;
}

.user-file-card.is-failed .user-file-status::before {
    background: #EF4444;
}

@media (max-width: 620px) {
    .chat-user-files {
        width: 100%;
    }

    .user-file-card {
        grid-template-columns: 44px minmax(0, 1fr);
        gap: 10px;
        padding: 10px;
    }

    .user-file-thumb {
        width: 44px;
        height: 44px;
    }
}

.chat-message-ai.is-error .chat-bubble-ai {
    background: #FFFFFF;
    box-shadow: none;
}

.response-card-header,
.response-card-footer,
.response-stats,
.model-badge,
.turn-user-prompt {
    display: none !important;
}

.response-card-body {
    padding: 0;
    flex: initial;
}

.message-provider {
    display: none;
}

.response-text {
    margin: 0;
    line-height: 1.58;
    overflow-wrap: anywhere;
}

.response-text p {
    margin: 0;
}

.response-text p + p,
.response-text p + ul,
.response-text p + ol,
.response-text p + pre,
.response-text p + .response-table-wrap,
.response-text ul + p,
.response-text ol + p,
.response-text pre + p,
.response-text .response-table-wrap + p,
.response-text h1 + p,
.response-text h2 + p,
.response-text h3 + p,
.response-text h4 + p,
.response-text h5 + p,
.response-text h6 + p {
    margin-top: 10px;
}

.response-text h1,
.response-text h2,
.response-text h3,
.response-text h4,
.response-text h5,
.response-text h6 {
    margin: 0;
    line-height: 1.35;
}

.response-text h1 { font-size: 1.14rem; }
.response-text h2 { font-size: 1.08rem; }
.response-text h3 { font-size: 1.03rem; }
.response-text h4,
.response-text h5,
.response-text h6 { font-size: .98rem; }

.response-text ul,
.response-text ol {
    margin: 0;
    padding-left: 20px;
}

.response-text li + li {
    margin-top: 4px;
}

.response-text pre {
    margin: 0;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, .08);
    background: rgba(15, 23, 42, .03);
    overflow-x: auto;
}

.response-text code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: .86em;
}

.response-text :not(pre) > code {
    padding: 1px 5px;
    border-radius: 6px;
    border: 1px solid rgba(15, 23, 42, .1);
    background: rgba(15, 23, 42, .04);
}

.response-table-wrap {
    margin: 10px 0 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.response-table-wrap:first-child {
    margin-top: 0;
}

.response-text table {
    width: 100%;
    min-width: 360px;
    border-collapse: collapse;
    table-layout: fixed;
}

.response-text thead {
    background: rgba(15, 23, 42, .04);
}

.response-text th,
.response-text td {
    border: 1px solid rgba(148, 163, 184, .45);
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.response-text th {
    font-size: .8rem;
    font-weight: 700;
}

.response-text td {
    font-size: .84rem;
}

.response-table-wrap.is-stacked {
    overflow: visible;
}

.response-text table.is-stacked {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.response-text table.is-stacked thead {
    display: none;
}

.response-text table.is-stacked tbody,
.response-text table.is-stacked tr,
.response-text table.is-stacked td {
    display: block;
    width: 100%;
}

.response-text table.is-stacked tr {
    border: 1px solid rgba(148, 163, 184, .45);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.response-text table.is-stacked td {
    border: none;
    border-bottom: 1px solid rgba(148, 163, 184, .2);
    padding: 8px 10px 8px 44%;
    min-height: 34px;
    position: relative;
}

.response-text table.is-stacked td:last-child {
    border-bottom: none;
}

.response-text table.is-stacked td::before {
    content: attr(data-label);
    position: absolute;
    left: 10px;
    top: 8px;
    width: calc(44% - 16px);
    font-size: .74rem;
    font-weight: 700;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 0;
    font-size: .82rem;
    line-height: 1.35;
    font-weight: 500;
    color: rgba(71, 85, 105, .9);
}

.typing-indicator-label {
    letter-spacing: .01em;
}

.typing-indicator-dots {
    display: inline-flex;
    align-items: flex-end;
    gap: 1px;
}

.typing-indicator-dot {
    display: inline-block;
    opacity: .28;
    transform: translateY(0);
    animation: thinkingDot 1.05s ease-in-out infinite;
}

.typing-indicator-dot:nth-child(2) {
    animation-delay: .15s;
}

.typing-indicator-dot:nth-child(3) {
    animation-delay: .3s;
}

@keyframes thinkingDot {
    0%,
    80%,
    100% {
        opacity: .28;
        transform: translateY(0);
    }

    40% {
        opacity: .95;
        transform: translateY(-1px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .typing-indicator-dot {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

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

.web-source-strip {
    margin-top: 0;
    padding: 0;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    min-width: 0;
    max-width: 50%;
    flex: 1 1 auto;
}

.web-source-label {
    display: none;
}

.web-source-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 33px;
    padding: 0 11px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, .08);
    background: #FAFAFA;
    color: rgba(15, 23, 42, .56);
    font-size: 13px;
    line-height: 1.28;
    font-weight: 500;
    letter-spacing: .01em;
    cursor: pointer;
    transition: color .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}

.web-source-toggle:hover {
    border-color: rgba(0, 0, 0, .1);
    background: #F3F4F6;
    color: rgba(15, 23, 42, .74);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
    transform: translateY(-1px);
}

.web-source-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(30, 58, 138, .2);
}

.web-source-toggle-leading-icon {
    width: 15px;
    height: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(15, 23, 42, .5);
    flex-shrink: 0;
}

.web-source-toggle-leading-icon svg {
    width: 15px;
    height: 15px;
    display: block;
}

.web-source-toggle-text {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: inherit;
}

.web-source-toggle-label {
    font-weight: 500;
}

.web-source-toggle-count {
    font-weight: 600;
}

.web-source-toggle-icon {
    width: 13px;
    height: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(15, 23, 42, .46);
    transform: rotate(0deg);
    transition: transform .18s ease, color .18s ease;
}

.web-source-toggle-icon svg {
    width: 13px;
    height: 13px;
    display: block;
}

.web-source-strip.is-expanded .web-source-toggle-icon {
    transform: rotate(180deg);
    color: rgba(15, 23, 42, .72);
}

.web-source-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateY(-2px);
    margin-top: 0;
    padding: 0;
    border-radius: 12px;
    background: rgba(0, 0, 0, .02);
    transition: max-height .18s ease, opacity .18s ease, transform .18s ease, margin-top .18s ease, padding .18s ease;
}

.web-source-list[aria-hidden="false"] {
    max-height: 220px;
    opacity: 1;
    transform: translateY(0);
    margin-top: 8px;
    padding: 9px;
}

.web-source-list[aria-hidden="true"] {
    pointer-events: none;
}

.source-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, .08);
    background: #FAFAFA;
    color: rgba(15, 23, 42, .78);
    font-size: 12px;
    line-height: 1.2;
    text-decoration: none;
    transition: border-color .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.source-chip:hover {
    border-color: rgba(0, 0, 0, .12);
    background: #F3F4F6;
    color: rgba(15, 23, 42, .92);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
    transform: translateY(-1px);
}

.source-chip:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(30, 58, 138, .2);
}

.source-chip-icon {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
    .web-source-toggle,
    .web-source-toggle-icon,
    .web-source-list,
    .source-chip {
        transition: none;
        transform: none;
    }
}

.message-footer {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, .04);
    min-width: 0;
}

.message-footer.is-compare-compact {
    margin-top: 6px;
    padding-top: 6px;
}

.message-footer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.message-footer.is-compare-compact .message-footer-bar {
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: nowrap;
}

.response-provider-meta {
    min-width: 0;
    max-width: 220px;
    flex: 0 1 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
    font-size: 12px;
    line-height: 1.3;
    font-weight: 500;
    letter-spacing: .01em;
    color: rgba(0, 0, 0, .55);
}

.message-footer-meta {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 14px;
    flex: 1 1 auto;
    transition: opacity .18s ease-out, transform .18s ease-out;
}

.message-footer.is-compare-compact .message-footer-meta {
    margin-left: 0;
    flex: 0 0 auto;
    gap: 0;
    flex-wrap: nowrap;
}

.chat-message-ai.is-streaming .message-footer {
    display: none;
}

.response-token-usage {
    display: inline-block;
    min-width: 0;
    max-width: 128px;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .78rem;
    line-height: 1.2;
    font-weight: 500;
    color: rgba(71, 85, 105, .9);
}

.response-actions {
    margin-left: 0;
    display: inline-flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}

.response-action-rail {
    --response-action-size: 32px;
    --response-action-icon-size: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    white-space: nowrap;
}

.message-footer.is-compare-compact .response-action-rail {
    --response-action-size: 30px;
    --response-action-icon-size: 16px;
}

.message-footer.is-compare-compact .response-actions {
    flex-wrap: nowrap;
}

.response-action-group {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.message-footer.is-compare-compact .response-action-group {
    gap: 12px;
}

.response-action-group + .response-action-group {
    margin-left: 0;
}

.message-footer.is-compare-compact .response-action-group + .response-action-group {
    margin-left: 0;
}

.response-action-btn {
    width: var(--response-action-size, 32px);
    height: var(--response-action-size, 32px);
    padding: 0;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: rgba(71, 85, 105, .7);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: scale(1);
    transition: color .14s ease-out, background .14s ease-out, transform .12s ease-out, box-shadow .14s ease-out;
}

.message-footer.is-compare-compact .response-action-btn {
    border-radius: 999px;
}

.response-action-btn svg {
    width: var(--response-action-icon-size, 17px);
    height: var(--response-action-icon-size, 17px);
}

.message-footer.is-compare-compact .response-action-btn svg {
    width: var(--response-action-icon-size, 16px);
    height: var(--response-action-icon-size, 16px);
}

.response-action-rail .web-source-strip,
.message-footer.is-compare-compact .web-source-strip {
    flex: 0 0 auto;
    max-width: none;
}

.response-action-rail .web-source-toggle {
    width: var(--response-action-size, 32px);
    min-width: var(--response-action-size, 32px);
    height: var(--response-action-size, 32px);
    min-height: var(--response-action-size, 32px);
    justify-content: center;
    gap: 0;
    padding: 0;
    border-radius: 999px;
    border: 0;
    background: transparent;
    color: rgba(71, 85, 105, .7);
    box-shadow: none;
    transform: scale(1);
    transition: color .14s ease-out, background .14s ease-out, transform .12s ease-out, box-shadow .14s ease-out;
}

.message-footer.is-compare-compact .web-source-toggle {
    border-radius: 999px;
}

.response-action-rail .web-source-toggle-leading-icon,
.response-action-rail .web-source-toggle-leading-icon svg {
    width: var(--response-action-icon-size, 17px);
    height: var(--response-action-icon-size, 17px);
    color: currentColor;
}

.response-action-rail .web-source-toggle-text,
.response-action-rail .web-source-toggle-icon {
    display: none;
}

.response-action-rail .web-source-toggle:hover,
.response-action-btn:hover {
    color: rgba(15, 23, 42, .86);
    background: rgba(15, 23, 42, .055);
    box-shadow: none;
    transform: scale(1);
}

.response-action-rail .web-source-toggle:active,
.response-action-btn:active {
    transform: scale(.96);
}

.response-action-rail .web-source-toggle:focus-visible,
.response-action-btn:focus-visible {
    outline: none;
    background: rgba(15, 23, 42, .055);
    box-shadow: 0 0 0 2px rgba(30, 58, 138, .16);
}

.response-action-btn.copied {
    color: rgba(29, 78, 216, .8);
    background: rgba(219, 234, 254, .5);
}

.response-action-btn[data-action="like"].is-active {
    color: rgba(22, 101, 52, .85);
    background: rgba(236, 253, 245, .7);
}

.response-action-btn[data-action="dislike"].is-active {
    color: rgba(153, 27, 27, .82);
    background: rgba(254, 242, 242, .7);
}

.compare-summary-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    font-size: .76rem;
    color: #475569;
}

.prompt-card,
.prompt-card.docked {
    top: auto;
    bottom: 8px;
    transform: translateX(-50%);
}

@media (max-width: 980px) {
    .compare-grid.compare-grid-2,
    .compare-grid.compare-grid-3 {
        grid-template-columns: minmax(0, 1fr);
    }

    .compare-model-label {
        white-space: normal;
    }
}

@media (max-width: 620px) {
    .main {
        padding: 8px 12px 122px;
    }

    .chat-bubble {
        max-width: 88%;
    }

    .message-footer {
        gap: 0;
    }

    .message-footer-bar {
        gap: 8px;
    }

    .web-source-strip {
        flex: 1 1 auto;
        max-width: 52%;
    }

    .message-footer-meta {
        flex: 0 1 auto;
        justify-content: flex-end;
        gap: 12px;
    }

    .response-provider-meta {
        max-width: 140px;
        flex-basis: 140px;
    }

    .response-token-usage {
        max-width: 94px;
    }

    .prompt-card,
    .prompt-card.docked {
        width: calc(100vw - 16px);
        bottom: 8px;
    }

    .jump-to-latest {
        bottom: 116px;
        max-width: calc(100vw - 32px);
    }
}




