/* ── CHAT VIEW ── */

        #chat-image-container {
            --chat-composer-offset: 148px;
        }

        #obs-chat {
            --chat-shell-bg: radial-gradient(circle at top, rgba(255, 255, 255, 0.02), transparent 38%), #0f1013;
            --chat-canvas-bg: linear-gradient(180deg, rgba(11, 12, 16, 0.98), rgba(12, 13, 17, 0.98));
            --chat-surface-bg: rgba(255, 255, 255, 0.015);
            --chat-surface-border: rgba(255, 255, 255, 0.06);
            --chat-response-text-color: rgba(228, 232, 238, 0.95);
            --chat-heading-color: #ffffff;
            --chat-link-color: #ffc2cf;
            --chat-inline-bg: rgba(255, 255, 255, 0.055);
            --chat-inline-border: rgba(255, 255, 255, 0.08);
            --chat-inline-text: #ffd2dc;
            --chat-code-bg: linear-gradient(180deg, rgba(6, 9, 15, 0.98), rgba(11, 14, 22, 0.98));
            --chat-code-border: rgba(255, 255, 255, 0.08);
            --chat-code-text: rgba(245, 247, 252, 0.94);
            --chat-quote-bg: linear-gradient(180deg, rgba(255, 91, 125, 0.07), rgba(255, 255, 255, 0.025));
            --chat-quote-border: rgba(255, 91, 125, 0.72);
            --chat-attribution-text: rgba(188, 194, 203, 0.85);
            --chat-attribution-border: rgba(255, 255, 255, 0.08);
            --chat-avatar-accent-rgb: 255 86 118;
            --chat-avatar-fg: #fff7fa;
        }

        #obs-chat #chat-image-container {
            background:
                radial-gradient(circle at top left, rgba(255, 255, 255, 0.025), transparent 34%),
                var(--chat-shell-bg);
        }

        #obs-chat > .topbar {
            position: relative;
            z-index: 55;
            isolation: isolate;
        }

        .content-area {
            flex: 1;
            overflow-y: auto;
            padding: 32px 0 calc(var(--chat-composer-offset, 148px) + 26px);
            display: flex;
            flex-direction: column;
            align-items: center;
            scroll-padding-bottom: calc(var(--chat-composer-offset, 148px) + 36px);
        }

        .feed-container {
            width: 100%;
            max-width: 780px;
            padding: 0 24px;
            display: flex;
            flex-direction: column;
            gap: 28px;
        }
        /* [hidden] must win over the flex display above (author rule beats the
           UA [hidden] rule) — used to swap the Chat vs Podcast feeds. */
        .feed-container[hidden] { display: none !important; }

        .message {
            display: flex;
            gap: 14px;
            line-height: 1.65;
            animation: fadeUp 0.3s ease;
        }

        @keyframes fadeUp {
            from {
                opacity: 0;
                transform: translateY(8px)
            }

            to {
                opacity: 1;
                transform: translateY(0)
            }
        }

        .message.user-msg {
            flex-direction: row-reverse;
            position: relative;
        }

        /* The user-message edit control reuses the same polished action-bar
           pattern as the AI message (see .msg-actions-bar / .msg-action-btn
           below). For the user bubble we right-align the bar so it sits neatly
           under the right-aligned bubble, and reveal it on hover/focus. */
        .message.user-msg .msg-actions-bar {
            justify-content: flex-end;
            padding-left: 0;
            padding-right: 52px; /* clear the avatar column → aligns under the bubble */
        }

        .message.user-msg:hover .msg-actions-bar,
        .message.user-msg:focus-within .msg-actions-bar {
            opacity: 1;
            transform: translateY(0);
        }

        .chat-stopped-note {
            font-size: 11px;
            color: var(--text-3);
            opacity: 0.6;
            margin-top: 6px;
            font-style: italic;
        }

        .avatar {
            width: 32px;
            height: 32px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            font-size: 13px;
            font-weight: 700;
        }

        .message.user-msg .avatar {
            background: var(--bg-3);
            color: var(--text-2);
        }

        .message.ai-msg .avatar {
            background: var(--accent);
            color: var(--bg-0);
            box-shadow: var(--accent-glow);
        }

        .msg-content {
            flex: 1;
        }

        .message.user-msg .msg-content {
            text-align: right;
            display: inline-block;
            background: var(--bg-2);
            padding: 12px 18px;
            border-radius: 16px 16px 4px 16px;
            color: var(--text);
            border: 1px solid var(--border);
            max-width: 85%;
        }

        .message.ai-msg .msg-content {
            font-size: 15px;
        }

        .message.ai-msg .msg-content pre {
            background: var(--bg-1);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 0;
            font-family: 'JetBrains Mono', monospace;
            font-size: 13px;
            margin: 14px 0;
            overflow: hidden;
            position: relative;
        }

        .message.ai-msg .msg-content pre code {
            display: block;
            padding: 16px;
            overflow-x: auto;
            background: transparent;
            color: inherit;
        }

        .message.ai-msg .msg-content code {
            background: var(--accent-dim);
            color: var(--accent);
            padding: 2px 6px;
            border-radius: 4px;
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.9em;
        }

        /* ── Code-block toolbar (Copy + Download row above each code block) ── */
        .message.ai-msg .msg-content pre.vox-code-pre {
            padding-top: 0;
        }

        .vox-code-bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 8px 14px;
            background: rgba(255, 255, 255, 0.03);
            border-bottom: 1px solid var(--border);
            font-family: 'JetBrains Mono', monospace;
            font-size: 11.5px;
            letter-spacing: 0.02em;
            color: var(--text-dim, rgba(255, 255, 255, 0.55));
            user-select: none;
        }

        .vox-code-bar-label {
            text-transform: lowercase;
            opacity: 0.75;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .vox-code-bar-actions {
            display: flex;
            gap: 6px;
            flex-shrink: 0;
        }

        .vox-code-action {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 5px 12px;
            border: 1px solid var(--border);
            border-radius: 6px;
            background: rgba(255, 255, 255, 0.04);
            color: var(--text, rgba(255, 255, 255, 0.85));
            font-family: inherit;
            font-size: 11.5px;
            font-weight: 500;
            cursor: pointer;
            transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.06s ease;
        }

        .vox-code-action:hover {
            background: var(--accent-dim, rgba(255, 255, 255, 0.08));
            border-color: var(--accent, rgba(255, 255, 255, 0.25));
            color: var(--accent, #fff);
        }

        .vox-code-action:active {
            transform: translateY(1px);
        }

        .vox-code-action.vox-code-download {
            background: var(--accent-dim, rgba(255, 255, 255, 0.06));
        }

        /* Large-code-block fallback now uses the existing `.code-file-card`
           class defined in base.css — no extra CSS needed here. */

        .message.ai-msg .msg-content p {
            margin-bottom: 12px;
        }

        .message.ai-msg .msg-content p:last-child {
            margin-bottom: 0;
        }

        .response-text--streaming {
            opacity: 0.98;
        }

        .thinking-label {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            font-size: 12px;
            color: var(--text-3);
        }

        .thinking-label-dots {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            animation: thinkingDots 1.15s steps(3, end) infinite;
        }

        .thinking-label-timer {
            font-variant-numeric: tabular-nums;
            color: var(--text-3);
        }

        .thinking-label-retry {
            color: var(--accent);
            text-decoration: underline;
            text-decoration-color: rgba(244, 63, 94, 0.35);
        }

        .chat-inline-action {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 6px 10px;
            border-radius: 999px;
            border: 1px solid rgba(255, 255, 255, 0.12);
            background: rgba(255, 255, 255, 0.05);
            color: var(--text-2);
            transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease;
        }

        .chat-inline-action:hover,
        .chat-inline-action:focus-visible {
            border-color: rgba(255, 255, 255, 0.24);
            background: rgba(255, 255, 255, 0.08);
            color: var(--text-1);
            transform: translateY(-1px);
        }

        @keyframes thinkingDots {
            0%, 20% {
                opacity: 0.45;
            }
            50% {
                opacity: 1;
            }
            100% {
                opacity: 0.45;
            }
        }

        .model-attribution {
            display: inline-block;
            font-size: 10px;
            color: var(--text-3);
            border: 1px solid var(--border);
            padding: 2px 8px;
            border-radius: 999px;
            margin-top: 8px;
        }

        .input-container {
            padding: 0 24px 28px;
            display: flex;
            justify-content: center;
            position: relative;
            z-index: 20;
            isolation: isolate;
        }

        .input-wrapper {
            width: 100%;
            max-width: 780px;
        }

        .input-tools {
            display: flex;
            gap: 6px;
            margin-bottom: 8px;
            align-items: center;
        }

        .input-tools .action-btn {
            font-size: 16px;
            padding: 4px 8px;
            background: transparent;
            border: 1px solid var(--border);
            color: var(--text-2);
            cursor: pointer;
            border-radius: 8px;
            transition: 0.2s;
        }

        .input-tools .action-btn:hover {
            border-color: var(--accent);
            color: var(--accent);
        }

        .stats-pill {
            font-size: 11px;
            color: var(--text-3);
            padding: 2px 8px;
            border: 1px solid var(--border);
            border-radius: 999px;
        }

        .obs-model-picker {
            position: relative;
        }

        .obs-model-trigger {
            width: min(360px, calc(100vw - 96px));
            max-width: 100%;
            padding: 10px 14px;
            border-radius: 16px;
            border: 1px solid var(--border-bright);
            background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
            color: var(--text);
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            cursor: pointer;
            transition: 0.2s;
            text-align: left;
        }

        .obs-model-trigger:hover,
        .obs-model-trigger[aria-expanded="true"] {
            border-color: var(--accent);
            box-shadow: var(--accent-glow);
        }

        .obs-report-issue-btn {
            min-height: 42px;
            padding: 0 14px;
            border-radius: 14px;
            border: 1px solid var(--border-bright);
            background:
                linear-gradient(180deg, rgba(255, 255, 255, 0.032), rgba(255, 255, 255, 0.012)),
                radial-gradient(circle at top right, rgba(244, 114, 182, 0.10), transparent 42%);
            color: var(--text-2);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            font-size: 12px;
            font-weight: 700;
            letter-spacing: 0.01em;
            cursor: pointer;
            white-space: nowrap;
            transition:
                border-color 0.18s ease,
                box-shadow 0.18s ease,
                color 0.18s ease,
                background 0.18s ease,
                transform 0.18s ease;
        }

        .obs-report-issue-btn:hover,
        .obs-report-issue-btn:focus-visible {
            border-color: var(--accent);
            color: var(--text);
            box-shadow: var(--accent-glow);
            transform: translateY(-1px);
            outline: none;
        }

        .obs-report-issue-btn:active {
            transform: translateY(0);
        }

        .obs-model-trigger-copy {
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .obs-model-trigger-label {
            font-size: 10px;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: var(--text-3);
        }

        .obs-model-trigger-value {
            font-size: 13px;
            font-weight: 600;
            color: var(--text);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .obs-model-trigger-badge {
            flex-shrink: 0;
            padding: 5px 10px;
            border-radius: 999px;
            border: 1px solid var(--border);
            font-size: 11px;
            color: var(--text-2);
            background: var(--bg-2);
        }

        .obs-model-trigger-badge.ready {
            border-color: rgba(34, 197, 94, 0.35);
            color: #86efac;
            background: rgba(34, 197, 94, 0.10);
        }

        .obs-model-trigger-badge.cloud {
            border-color: var(--accent-line);
            color: var(--accent-text);
            background: var(--accent-soft-12);
        }

        .obs-model-trigger-badge.video {
            border-color: var(--accent-line);
            color: var(--accent-text);
            background: var(--accent-soft-12);
        }

        /* ── Voice picker — variant of the chat model picker ─────────── */
        /* Follows the global --accent so changing themes (e.g. blue, mint)
           recolors the trigger + dropdown in lockstep with everything else. */
        .obs-model-picker--voice .obs-model-trigger {
            width: min(220px, calc(100vw - 96px));
            background:
                linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)),
                radial-gradient(circle at top right, var(--accent-soft-10), transparent 38%);
        }
        .obs-model-picker--voice .obs-model-trigger:hover,
        .obs-model-picker--voice .obs-model-trigger[aria-expanded="true"] {
            border-color: var(--accent-line-strong);
            box-shadow: 0 0 0 1px var(--accent-soft-18), 0 0 24px var(--accent-soft-22);
        }
        .obs-model-trigger-badge--voice {
            border-color: var(--accent-line);
            color: var(--accent-text);
            background: var(--accent-soft-14);
        }

        .obs-model-menu--voice {
            background:
                linear-gradient(180deg, rgba(20, 22, 30, 0.985), rgba(10, 12, 18, 0.995)),
                radial-gradient(circle at top right, var(--accent-soft-12), transparent 32%);
            backdrop-filter: blur(18px);
            -webkit-backdrop-filter: blur(18px);
            box-shadow:
                0 28px 72px rgba(0, 0, 0, 0.52),
                0 0 0 1px rgba(255, 255, 255, 0.02) inset;
            width: min(560px, calc(100vw - 64px));
        }

        /* Voice card — what each option in the grid looks like */
        .obs-voice-card {
            appearance: none;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 4px;
            padding: 11px 12px;
            border-radius: 13px;
            border: 1px solid rgba(255, 255, 255, 0.08);
            background:
                linear-gradient(180deg, rgba(255, 255, 255, 0.030), rgba(255, 255, 255, 0.010)),
                rgba(17, 19, 26, 0.92);
            color: var(--text-2);
            cursor: pointer;
            text-align: left;
            min-height: 64px;
            transition:
                border-color 0.18s ease,
                background 0.18s ease,
                color 0.18s ease,
                box-shadow 0.18s ease,
                transform 0.18s ease;
        }
        .obs-voice-card:hover {
            border-color: var(--accent-line-strong);
            color: var(--text);
            background:
                linear-gradient(180deg, var(--accent-soft-10), var(--accent-soft-12)),
                rgba(20, 18, 22, 0.94);
            transform: translateY(-1px);
        }
        .obs-voice-card.is-active {
            border-color: var(--accent-line-bright);
            background:
                linear-gradient(180deg, var(--accent-soft-22), var(--accent-soft-14)),
                rgba(28, 22, 24, 0.92);
            color: var(--accent-text);
            box-shadow:
                0 0 0 1px var(--accent-soft-18) inset,
                0 0 22px var(--accent-soft-22);
        }
        .obs-voice-card-name {
            font-size: 13px;
            font-weight: 700;
            letter-spacing: 0.01em;
        }
        .obs-voice-card-desc {
            font-size: 11px;
            color: var(--text-3);
            line-height: 1.35;
        }
        .obs-voice-card.is-active .obs-voice-card-desc {
            color: rgba(255, 255, 255, 0.78);
        }

        /* Voice card states during preview playback */
        .obs-voice-card.is-previewing {
            border-color: var(--accent-line-bright);
            box-shadow:
                0 0 0 1px var(--accent-soft-22) inset,
                0 0 18px var(--accent-soft-22);
            animation: obs-voice-preview-pulse 1.2s ease-in-out infinite;
        }
        .obs-voice-card.is-preview-error {
            border-color: rgba(239, 68, 68, 0.6);
            background:
                linear-gradient(180deg, rgba(239, 68, 68, 0.10), rgba(239, 68, 68, 0.04)),
                rgba(20, 14, 14, 0.92);
            color: #fca5a5;
        }
        @keyframes obs-voice-preview-pulse {
            0%, 100% { box-shadow: 0 0 0 1px var(--accent-soft-18) inset, 0 0 14px var(--accent-soft-18); }
            50%      { box-shadow: 0 0 0 1px var(--accent-soft-22) inset, 0 0 24px var(--accent-soft-22); }
        }

        /* Options row — auto-tone toggle + auto-send toggle + test-tone button */
        .obs-voice-options-row {
            display: grid;
            grid-template-columns: 1fr 1fr auto;
            gap: 12px;
            align-items: stretch;
        }
        .obs-voice-toggle {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 12px;
            border-radius: 13px;
            border: 1px solid rgba(255, 255, 255, 0.08);
            background: rgba(17, 19, 26, 0.7);
            cursor: pointer;
            transition: border-color 0.18s ease, background 0.18s ease;
        }
        .obs-voice-toggle:hover {
            border-color: var(--accent-line);
        }
        .obs-voice-toggle input[type="checkbox"] {
            width: 16px;
            height: 16px;
            accent-color: var(--accent);
            cursor: pointer;
            flex-shrink: 0;
        }
        .obs-voice-toggle-text {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }
        .obs-voice-toggle-title {
            font-size: 12.5px;
            font-weight: 600;
            color: var(--text);
        }
        .obs-voice-toggle-desc {
            font-size: 11px;
            color: var(--text-3);
        }
        .obs-voice-test-btn {
            appearance: none;
            padding: 10px 14px;
            border-radius: 13px;
            border: 1px solid var(--accent-line);
            background:
                linear-gradient(180deg, var(--accent-soft-14), var(--accent-soft-10)),
                rgba(17, 19, 26, 0.78);
            color: var(--accent-text);
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 1px;
            cursor: pointer;
            text-align: left;
            transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
        }
        .obs-voice-test-btn:hover {
            border-color: var(--accent-line-bright);
            background:
                linear-gradient(180deg, var(--accent-soft-22), var(--accent-soft-14)),
                rgba(28, 18, 22, 0.94);
            transform: translateY(-1px);
        }
        .obs-voice-test-btn:disabled {
            opacity: 0.6;
            cursor: progress;
            transform: none;
        }
        .obs-voice-test-title {
            font-size: 12.5px;
            font-weight: 700;
            letter-spacing: 0.01em;
        }
        .obs-voice-test-hint {
            font-size: 10.5px;
            color: var(--accent-text-soft);
        }

        /* Narrow voice menu — stack options row */
        @media (max-width: 560px) {
            .obs-voice-options-row {
                grid-template-columns: 1fr;
            }
        }

        .obs-model-menu {
            position: absolute;
            top: calc(100% + 10px);
            right: 0;
            width: min(640px, calc(100vw - 64px));
            max-height: min(72vh, 760px);
            overflow: auto;
            padding: 14px;
            border-radius: 20px;
            border: 1px solid var(--border-bright);
            background:
                linear-gradient(180deg, rgba(20, 22, 30, 0.985), rgba(10, 12, 18, 0.995)),
                radial-gradient(circle at top right, var(--accent-soft-10), transparent 34%);
            box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
            z-index: 40;
        }

        #obs-chat-model-menu {
            background:
                linear-gradient(180deg, rgba(20, 22, 30, 0.985), rgba(10, 12, 18, 0.995)),
                radial-gradient(circle at top right, var(--accent-soft-12), transparent 32%);
            backdrop-filter: blur(18px);
            -webkit-backdrop-filter: blur(18px);
            box-shadow:
                0 28px 72px rgba(0, 0, 0, 0.52),
                0 0 0 1px rgba(255, 255, 255, 0.02) inset;
        }

        #obs-chat-model-menu.obs-model-menu--floating {
            position: fixed !important;
            top: var(--obs-model-menu-top, 72px) !important;
            left: var(--obs-model-menu-left, 16px) !important;
            right: auto !important;
            width: var(--obs-model-menu-width, min(640px, calc(100vw - 32px))) !important;
            max-width: calc(100vw - 32px);
            max-height: var(--obs-model-menu-max-height, min(72vh, 760px)) !important;
            overflow: auto;
            z-index: 5600 !important;
        }

        .obs-model-menu-header {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 12px;
        }

        .obs-model-menu-title {
            font-size: 15px;
            font-weight: 700;
            color: var(--text);
        }

        .obs-model-menu-subtitle {
            font-size: 12px;
            color: var(--text-3);
            margin-top: 3px;
        }

        .obs-model-menu-close {
            width: 30px;
            height: 30px;
            border-radius: 10px;
            border: 1px solid var(--border);
            background: var(--bg-2);
            color: var(--text-2);
            cursor: pointer;
            transition: 0.2s;
        }

        .obs-model-menu-close:hover {
            border-color: var(--accent);
            color: var(--accent);
        }

        .obs-model-menu-shortcuts {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
            gap: 7px;
            margin: 0 0 13px;
        }

        .obs-model-shortcut {
            appearance: none;
            min-width: 0;
            min-height: 32px;
            padding: 0 10px;
            border-radius: 11px;
            border: 1px solid rgba(255, 255, 255, 0.08);
            background:
                linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.014)),
                rgba(17, 19, 26, 0.92);
            color: var(--text-2);
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0;
            cursor: pointer;
            transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
        }

        .obs-model-shortcut:hover {
            border-color: var(--accent-line);
            color: var(--text);
        }

        .obs-model-shortcut.is-active {
            border-color: var(--accent-line-bright);
            background:
                linear-gradient(180deg, var(--accent-soft-18), var(--accent-soft-10)),
                rgba(28, 22, 24, 0.86);
            color: var(--accent-text);
            box-shadow: 0 0 0 1px var(--accent-soft-10) inset;
        }

        .obs-model-menu-section+.obs-model-menu-section {
            margin-top: 16px;
        }

        .obs-model-menu-heading {
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.12em;
            color: var(--text-3);
            margin-bottom: 10px;
        }

        .obs-model-menu-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
            gap: 10px;
        }

        .obs-model-picker--route .obs-model-trigger {
            width: min(360px, calc(100vw - 96px));
            background:
                linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
                radial-gradient(circle at top right, var(--accent-soft-10), transparent 34%);
        }

        #obs-image-model-menu {
            width: min(720px, calc(100vw - 48px));
        }

        #obs-image-model-menu .obs-model-menu-grid {
            grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
            gap: 12px;
        }

        #obs-image-model-menu .obs-model-card {
            min-height: 124px;
        }

        .obs-model-picker--route .obs-model-trigger[aria-expanded="true"] {
            border-color: var(--accent-line);
            box-shadow: 0 16px 34px var(--accent-soft-12);
        }

        .obs-model-menu--route {
            width: min(410px, calc(100vw - 48px));
            border: 1px solid var(--border-bright);
            background:
                linear-gradient(180deg, rgba(21, 23, 31, 0.98), rgba(12, 13, 18, 0.98)),
                radial-gradient(circle at top right, var(--accent-soft-10), transparent 30%);
            box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
        }

        .obs-model-menu--route[data-media-type="video"] {
            background:
                linear-gradient(180deg, rgba(24, 22, 30, 0.98), rgba(12, 13, 18, 0.98)),
                radial-gradient(circle at top right, var(--accent-soft-14), transparent 34%);
        }

        .obs-model-menu-section--route {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .img-route-field {
            display: flex;
            flex-direction: column;
            gap: 6px;
            padding: 9px 10px;
            border-radius: 12px;
            border: 1px solid rgba(255, 255, 255, 0.07);
            background: rgba(255, 255, 255, 0.03);
        }

        .img-route-field-label {
            font-size: 10px;
            font-weight: 700;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: var(--text-3);
        }

        .img-route-select {
            appearance: none;
            width: 100%;
            min-height: 38px;
            padding: 0 12px;
            border-radius: 11px;
            border: 1px solid rgba(255, 255, 255, 0.08);
            background:
                linear-gradient(180deg, rgba(20, 22, 30, 0.98), rgba(10, 12, 18, 0.98)),
                radial-gradient(circle at top right, var(--accent-soft-10), transparent 34%);
            color: var(--text);
            font: inherit;
            color-scheme: dark;
            transition: 0.18s ease;
        }

        .img-route-select:focus-visible {
            outline: 2px solid var(--accent);
            outline-offset: 2px;
            border-color: var(--accent);
        }

        .img-route-select option {
            background: #11141b;
            color: rgba(255, 255, 255, 0.92);
        }

        .img-route-select option:disabled {
            background: #11141b;
            color: rgba(255, 255, 255, 0.42);
        }

        .img-route-duration-wrap--provider .img-route-field {
            padding: 9px 10px;
            background:
                linear-gradient(180deg, rgba(20, 22, 30, 0.52), rgba(10, 12, 18, 0.52)),
                rgba(255, 255, 255, 0.03);
        }

        .img-route-duration-wrap--provider .img-route-select {
            min-height: 38px;
            border-radius: 11px;
        }

        .img-route-duration-wrap {
            display: flex;
            flex-direction: column;
            gap: 8px;
            padding: 10px;
            border-radius: 13px;
            border: 1px solid rgba(255, 255, 255, 0.08);
            background:
                linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02)),
                radial-gradient(circle at top right, var(--accent-soft-12), transparent 42%);
        }

        .img-route-duration-head {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .img-route-duration-title {
            font-size: 10px;
            font-weight: 700;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: #fbcfe8;
        }

        .img-route-duration-copy {
            font-size: 11px;
            line-height: 1.35;
            color: var(--text-3);
        }

        .obs-model-card {
            appearance: none;
            position: relative;
            width: 100%;
            min-height: 124px;
            display: flex;
            flex-direction: column;
            gap: 7px;
            background:
                linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.018)),
                var(--bg-2);
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: 13px;
            cursor: pointer;
            transition: 0.2s;
            text-align: left;
            color: inherit;
            font: inherit;
        }

        .obs-model-card-tier {
            position: absolute;
            top: 8px;
            right: 8px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 19px;
            max-width: calc(100% - 16px);
            padding: 2px 7px;
            border-radius: 999px;
            border: 1px solid var(--accent-line);
            background: rgba(10, 10, 14, 0.72);
            color: var(--accent-text);
            font-size: 9px;
            font-weight: 900;
            line-height: 1;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            pointer-events: none;
            white-space: nowrap;
            z-index: 2;
        }

        .obs-model-card:hover {
            border-color: var(--accent-mid);
            background: var(--bg-hover);
        }

        .obs-model-card.disabled,
        .obs-model-card:disabled {
            opacity: 0.58;
            cursor: not-allowed;
            box-shadow: none;
        }

        .obs-model-card.disabled:hover,
        .obs-model-card:disabled:hover {
            border-color: var(--border);
            background: var(--bg-2);
        }

        .obs-model-card.selected {
            border-color: var(--accent);
            background: var(--accent-dim);
            box-shadow: var(--accent-glow);
        }

        .obs-model-card-title {
            font-size: 13px;
            font-weight: 600;
            color: var(--text);
            padding-right: 66px;
            margin-bottom: 0;
            line-height: 1.2;
            overflow-wrap: anywhere;
        }

        .obs-model-card-subtitle {
            font-size: 11px;
            color: var(--text-3);
            min-height: 0;
            line-height: 1.35;
            word-break: break-word;
        }

        .obs-model-card-tags {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 5px;
            min-height: 22px;
        }

        .obs-model-card-tag {
            display: inline-flex;
            align-items: center;
            min-height: 20px;
            max-width: 100%;
            padding: 2px 8px;
            border-radius: 999px;
            border: 1px solid rgba(255, 255, 255, 0.08);
            background: rgba(255, 255, 255, 0.045);
            color: var(--text-2);
            font-size: 10px;
            font-weight: 800;
            line-height: 1;
            white-space: nowrap;
        }

        .obs-model-card-meta {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            margin-top: auto;
            min-width: 0;
        }

        .obs-model-card-chip {
            display: inline-flex;
            align-items: center;
            padding: 4px 8px;
            border-radius: 999px;
            font-size: 11px;
            border: 1px solid var(--border);
            color: var(--text-2);
            background: rgba(255, 255, 255, 0.03);
        }

        .obs-model-card-chip.ready {
            color: #86efac;
            border-color: rgba(34, 197, 94, 0.35);
            background: rgba(34, 197, 94, 0.10);
        }

        .obs-model-card-chip.cloud {
            color: var(--accent-text);
            border-color: var(--accent-line);
            background: var(--accent-soft-12);
        }

        .obs-model-card-chip.video {
            color: var(--accent-text);
            border-color: var(--accent-line);
            background: var(--accent-soft-10);
        }

        .obs-model-card-status {
            font-size: 11px;
            color: var(--text-3);
            min-width: 0;
            text-align: right;
            overflow-wrap: anywhere;
        }

        .input-box {
            background: var(--bg-2);
            border: 1px solid var(--border-bright);
            border-radius: 16px;
            padding: 14px 16px;
            display: flex;
            align-items: flex-end;
            gap: 12px;
            transition: 0.2s;
        }

        .input-box:focus-within {
            border-color: var(--accent);
            box-shadow: var(--accent-glow);
        }

        .input-box textarea {
            flex: 1;
            background: transparent;
            border: none;
            outline: none;
            resize: none;
            min-height: 24px;
            max-height: 160px;
            font-family: inherit;
            font-size: 15px;
            color: var(--text);
            line-height: 1.5;
        }

        .input-box textarea::placeholder {
            color: var(--text-3);
        }

        .send-btn {
            background: var(--accent);
            color: var(--bg-0);
            border: none;
            border-radius: 8px;
            width: 32px;
            height: 32px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
            transition: 0.2s;
            flex-shrink: 0;
        }

        .send-btn:hover {
            opacity: 0.85;
        }

        .send-btn--disabled,
        .send-btn:disabled {
            background: var(--bg-3, #2a2e38);
            color: var(--text-dim, #6b7280);
            cursor: not-allowed;
            opacity: 0.55;
        }
        .send-btn--disabled:hover,
        .send-btn:disabled:hover {
            opacity: 0.55;
        }

        .send-btn--stop {
            background: #ef4444;
        }

        .send-btn--stop .send-btn-icon {
            font-size: 14px;
            transform: none;
        }

        .input-box--chat {
            padding: 12px 14px;
            border-radius: 20px;
            gap: 12px;
            align-items: center;
            background:
                linear-gradient(180deg, rgba(16, 18, 27, 0.98), rgba(10, 12, 18, 0.985)),
                radial-gradient(circle at top right, var(--accent-soft-10), transparent 42%);
            backdrop-filter: blur(18px);
            -webkit-backdrop-filter: blur(18px);
            box-shadow: 0 16px 42px rgba(0, 0, 0, 0.28);
        }

        .input-box--chat .chat-composer-rail {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            flex: 0 0 auto;
        }

        .input-box--chat .mobile-composer-model-slot {
            display: none;
        }

        .input-box--chat .chat-composer-inline-actions {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            flex: 0 0 auto;
        }

        .input-box--chat .chat-tool-button {
            width: 38px;
            height: 38px;
            min-width: 38px;
            min-height: 38px;
            border-radius: 12px;
            border: 1px solid rgba(255, 255, 255, 0.08);
            background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
            color: var(--text-2);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0;
            cursor: pointer;
            transition: 0.18s ease;
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
        }

        .input-box--chat .chat-tool-button:hover {
            color: var(--text);
            border-color: var(--accent-mid);
            background: rgba(255, 255, 255, 0.045);
        }

        .input-box--chat .chat-tool-button.is-active,
        .input-box--chat .chat-tool-button[aria-pressed="true"] {
            color: var(--accent);
            border-color: rgba(244, 63, 94, 0.35);
            background: rgba(244, 63, 94, 0.12);
            box-shadow: 0 0 0 1px rgba(244, 63, 94, 0.14), var(--accent-glow);
        }

        /* ── Mic button (STT) states ──────────────────────────────────── */
        .chat-tool-button--mic.is-recording {
            color: #ef4444;
            border-color: rgba(239, 68, 68, 0.6);
            background: rgba(239, 68, 68, 0.18);
            box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.3), 0 0 12px rgba(239, 68, 68, 0.45);
            animation: vox-mic-pulse 1.1s ease-in-out infinite;
        }

        .chat-tool-button--mic.is-busy {
            opacity: 0.7;
            cursor: progress;
        }

        .chat-tool-button--mic.is-error {
            color: #f59e0b;
            border-color: rgba(245, 158, 11, 0.45);
            background: rgba(245, 158, 11, 0.12);
        }

        @keyframes vox-mic-pulse {
            0%, 100% { box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.3), 0 0 10px rgba(239, 68, 68, 0.35); }
            50%      { box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.5), 0 0 18px rgba(239, 68, 68, 0.65); }
        }

        /* ── Chat / Podcast mode tabs (topbar, theme-aware underline) ─── */
        .vox-mode-tabs {
            position: relative;
            display: inline-flex;
            gap: 4px;
            margin-left: 12px;
            padding: 1px 2px;
            padding-left: 14px;
            border-left: 1px solid var(--border);
        }
        .vox-mode-tab {
            position: relative;
            z-index: 2;
            border: none;
            background: none;
            color: var(--text-2, rgba(255,255,255,0.55));
            cursor: pointer;
            padding: 7px 14px 12px;
            font: inherit;
            font-size: 13px;
            font-weight: 700;
            letter-spacing: 0.01em;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            transition: color 0.2s ease;
            white-space: nowrap;
        }
        .vox-mode-tab:hover { color: var(--text); }
        .vox-mode-tab.is-active {
            color: var(--text);
            text-shadow: 0 0 16px var(--accent-soft-22);
        }
        .vox-mode-tab .vox-mode-ic { transition: filter 0.2s ease, transform 0.2s ease; }
        .vox-mode-tab.is-active .vox-mode-ic {
            filter: drop-shadow(0 0 7px var(--accent-line-strong));
            transform: scale(1.08);
        }
        .vox-mode-glider {
            position: absolute;
            bottom: 1px;
            height: 3px;
            border-radius: 999px;
            background: linear-gradient(90deg, hsl(calc(var(--accent-h) - 60), var(--accent-s), 66%), var(--accent));
            box-shadow: 0 0 12px var(--accent-line-bright), 0 0 3px var(--accent);
            transition: left 0.28s cubic-bezier(.2,.85,.25,1), width 0.28s cubic-bezier(.2,.85,.25,1);
            pointer-events: none;
        }
        .vox-mode-glider::before {
            content: "";
            position: absolute;
            left: 50%; bottom: -1px;
            transform: translateX(-50%);
            width: 80%; height: 22px;
            border-radius: 50% 50% 0 0;
            background: var(--accent-soft-18);
            filter: blur(8px);
        }

        /* Chat-model badge while podcast mode is active (shows podcast cost) */
        .obs-model-trigger-badge.vox-podcast-badge-active {
            border-color: var(--accent-line);
            color: var(--accent-text);
            background: var(--accent-soft-14);
        }

        /* Podcast controls (injected into the voice menu): hosts + presets + ambient */
        .obs-voice-podcast-controls { display: flex; flex-direction: column; gap: 14px; margin: 0 0 14px; }
        .obs-voice-podcast-controls .vpc-section { display: flex; flex-direction: column; gap: 8px; }
        .obs-voice-podcast-controls .vpc-heading {
            font-size: 10px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--text-3);
        }
        .obs-voice-podcast-controls .vpc-hint { font-size: 11px; color: var(--text-3); }
        .vpc-host-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
        /* Presets row */
        .vpc-presets { display: flex; flex-wrap: wrap; gap: 7px; }
        .vpc-preset {
            padding: 6px 13px; border-radius: 999px; cursor: pointer; font-size: 12px; font-weight: 600;
            border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.04); color: var(--text-2);
            transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
        }
        .vpc-preset:hover { color: #fff; border-color: var(--accent-line); background: var(--accent-soft-10); }
        /* Ambient background slider */
        .vpc-ambient {
            display: flex; align-items: center; gap: 10px;
            padding: 9px 12px; border-radius: 11px;
            border: 1px solid rgba(255,255,255,0.08); background: rgba(17,19,26,0.6);
        }
        .vpc-ambient-icon { color: var(--text-3); display: grid; place-items: center; }
        .vpc-ambient-range { flex: 1 1 auto; height: 4px; cursor: pointer; accent-color: var(--accent); }
        .vpc-ambient-val { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
        .obs-voice-host-slot {
            appearance: none;
            display: flex;
            flex-direction: column;
            gap: 2px;
            padding: 9px 12px;
            border-radius: 12px;
            border: 1px solid rgba(255, 255, 255, 0.08);
            background: rgba(17, 19, 26, 0.7);
            color: var(--text-2);
            cursor: pointer;
            text-align: left;
            transition: border-color 0.16s ease, background 0.16s ease;
        }
        .obs-voice-host-slot:hover { border-color: var(--accent-line); }
        .obs-voice-host-slot.is-active {
            border-color: var(--accent-line-bright);
            background: linear-gradient(180deg, var(--accent-soft-18), var(--accent-soft-10)), rgba(28,22,24,0.92);
            color: #fff;
            box-shadow: 0 0 0 1px var(--accent-soft-18) inset;
        }
        .obs-voice-host-slot .hs-label {
            font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3);
        }
        .obs-voice-host-slot.is-active .hs-label { color: var(--accent-text); }
        .obs-voice-host-slot .hs-voice { font-size: 13.5px; font-weight: 700; }
        /* Each host column: editable name on top, voice slot below */
        .obs-voice-host-row { display: flex; flex-direction: column; gap: 6px; }
        .obs-voice-host-row .obs-voice-host-slot { width: 100%; }
        .obs-voice-host-name {
            width: 100%;
            box-sizing: border-box;
            padding: 7px 11px;
            border-radius: 10px;
            border: 1px solid rgba(255, 255, 255, 0.10);
            background: rgba(12, 14, 20, 0.85);
            color: #fff;
            font-size: 13px;
            font-weight: 600;
            outline: none;
            transition: border-color 0.16s ease, box-shadow 0.16s ease;
        }
        .obs-voice-host-name::placeholder { color: var(--text-3); font-weight: 500; }
        .obs-voice-host-name:focus {
            border-color: var(--accent-line-bright);
            box-shadow: 0 0 0 1px var(--accent-soft-18) inset;
        }

        /* Host tag pill on the assigned voice cards */
        .obs-voice-host-tag {
            display: inline-block;
            margin-left: 7px;
            padding: 1px 7px;
            border-radius: 999px;
            font-size: 9.5px;
            font-weight: 800;
            letter-spacing: 0.04em;
            vertical-align: middle;
            border: 1px solid var(--accent-line-strong);
            background: var(--accent-soft-18);
            color: var(--accent-text);
        }

        /* ── Podcast episode card (rendered in the feed) ─────────────── */
        .vox-podcast-card {
            display: flex;
            gap: 16px;
            align-items: center;
            padding: 16px 18px;
            border-radius: 16px;
            border: 1px solid var(--accent-line);
            background:
                linear-gradient(180deg, rgba(22,18,26,0.55), rgba(14,12,18,0.65)),
                radial-gradient(circle at 28% 18%, var(--accent-soft-12), transparent 55%);
        }
        .vox-podcast-canvas {
            width: 96px; height: 96px;
            flex-shrink: 0;
            background: transparent;
        }
        .vox-podcast-meta { flex: 1; min-width: 0; }
        .vox-podcast-title { font-size: 14.5px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
        .vox-podcast-sub { font-size: 12px; color: var(--text-3); margin-bottom: 12px; }
        .vox-podcast-bar {
            height: 6px; border-radius: 999px; background: rgba(255,255,255,0.12);
            position: relative; overflow: hidden; cursor: pointer;
        }
        .vox-podcast-bar > i {
            position: absolute; inset: 0 100% 0 0;
            background: linear-gradient(90deg, hsl(calc(var(--accent-h) - 60), var(--accent-s), 66%), var(--accent));
        }
        .vox-podcast-ctrls { display: flex; align-items: center; gap: 10px; margin-top: 11px; }
        .vox-podcast-play {
            width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; cursor: pointer;
            border: none; padding: 0;
            background: linear-gradient(140deg, var(--accent), hsl(calc(var(--accent-h) - 55), var(--accent-s), 60%));
            color: #fff; display: grid; place-items: center;
            box-shadow: 0 4px 14px var(--accent-soft-22), inset 0 1px 0 rgba(255,255,255,0.25);
            transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
        }
        .vox-podcast-play:hover { transform: translateY(-1px); filter: brightness(1.08);
            box-shadow: 0 6px 20px var(--accent-soft-22), inset 0 1px 0 rgba(255,255,255,0.3); }
        .vox-podcast-play:active { transform: translateY(0); }
        .vox-podcast-play svg { width: 15px; height: 15px; display: block; }
        .vox-podcast-time { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
        /* Transport (rewind/forward) + volume + actions */
        .vox-podcast-btn {
            width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; cursor: pointer;
            border: 1px solid rgba(255,255,255,0.10); padding: 0;
            background: rgba(255,255,255,0.05); color: var(--text-2);
            display: grid; place-items: center;
            transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
        }
        .vox-podcast-btn:hover { color: #fff; border-color: var(--accent-line); background: var(--accent-soft-10); }
        .vox-podcast-btn svg { width: 15px; height: 15px; display: block; }
        .vox-podcast-btn.is-muted { color: var(--accent-text); border-color: var(--accent-line); }
        .vox-podcast-spacer { flex: 1 1 auto; }
        .vox-podcast-volrange {
            width: 72px; height: 4px; cursor: pointer; accent-color: var(--accent);
            background: transparent;
        }
        .vox-podcast-bar:focus-visible { outline: 2px solid var(--accent-line-bright); outline-offset: 2px; }
        /* Bottom action row under the podcast card — reuses chat .msg-action-btn
           icons (download / retry / volume) so it matches the chat surface. */
        .vox-podcast-actbar { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
        .vox-podcast-actbar .vox-podcast-volrange {
            width: 76px; height: 4px; margin-left: 4px; cursor: pointer; accent-color: var(--accent);
        }
        .vox-podcast-actbar .msg-action-btn.is-muted { color: var(--accent-text); }
        .vox-podcast-actions { display: flex; gap: 8px; margin-top: 10px; }
        .vox-podcast-act {
            display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
            padding: 6px 12px; border-radius: 9px;
            border: 1px solid rgba(255,255,255,0.10); background: rgba(255,255,255,0.04);
            color: var(--text-2); font-size: 12px; font-weight: 600;
            transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
        }
        .vox-podcast-act:hover { color: #fff; border-color: var(--accent-line); background: var(--accent-soft-10); }
        .vox-podcast-act svg { width: 14px; height: 14px; }
        .vox-podcast-act[disabled] { opacity: 0.5; pointer-events: none; }
        .vox-podcast-loading { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 10px; }
        .vox-podcast-spinner {
            width: 18px; height: 18px; border-radius: 50%;
            border: 2px solid var(--accent-soft-22); border-top-color: var(--accent);
            animation: vox-podcast-spin 0.8s linear infinite;
        }
        @keyframes vox-podcast-spin { to { transform: rotate(360deg); } }
        /* Podcast tier chooser popover (Core / Pro) */
        .vox-podcast-tier-menu {
            position: fixed; z-index: 1000; min-width: 300px; max-width: 340px;
            padding: 8px; border-radius: 14px;
            background: rgba(18, 20, 28, 0.98);
            border: 1px solid var(--accent-line);
            box-shadow: 0 18px 48px rgba(0,0,0,0.55);
            backdrop-filter: blur(12px);
        }
        .vox-podcast-tier-menu .vpt-head {
            font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
            color: var(--text-3); padding: 4px 8px 8px;
        }
        .vox-ptier {
            display: block; width: 100%; text-align: left; cursor: pointer;
            padding: 10px 12px; border-radius: 10px; margin-bottom: 4px;
            border: 1px solid transparent; background: rgba(255,255,255,0.03);
            color: var(--text-2);
            transition: border-color 0.16s ease, background 0.16s ease;
        }
        .vox-ptier:hover { border-color: var(--accent-line); background: var(--accent-soft-10); }
        .vox-ptier.is-active {
            border-color: var(--accent-line-bright);
            background: linear-gradient(180deg, var(--accent-soft-18), var(--accent-soft-10));
            color: #fff;
        }
        .vox-ptier .pt-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
        .vox-ptier .pt-name { font-size: 14px; font-weight: 700; }
        .vox-ptier .pt-cost { font-size: 11px; color: var(--accent-text); font-weight: 700; }
        .vox-ptier .pt-desc { display: block; margin-top: 3px; font-size: 11.5px; color: var(--text-3); line-height: 1.4; }

        /* ── "Listening…" floating HUD shown while STT is capturing ───── */
        .vox-listening-hud {
            position: fixed;
            left: 50%;
            bottom: 110px;
            transform: translate(-50%, 8px);
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 14px;
            border-radius: 999px;
            background: rgba(15, 15, 18, 0.92);
            border: 1px solid rgba(239, 68, 68, 0.45);
            box-shadow: 0 4px 22px rgba(0, 0, 0, 0.45), 0 0 18px rgba(239, 68, 68, 0.25);
            color: rgba(255, 255, 255, 0.95);
            font-size: 13px;
            font-weight: 500;
            letter-spacing: 0.1px;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.16s ease, transform 0.16s ease;
            z-index: 9999;
            max-width: min(640px, 80vw);
            white-space: nowrap;
        }

        .vox-listening-hud.is-visible {
            opacity: 1;
            transform: translate(-50%, 0);
        }

        .vox-listening-hud__dot {
            width: 9px;
            height: 9px;
            border-radius: 50%;
            background: #ef4444;
            box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.18);
            animation: vox-listening-dot 1.05s ease-in-out infinite;
        }

        .vox-listening-hud__label {
            color: rgba(255, 255, 255, 0.78);
        }

        .vox-listening-hud__text {
            color: #fff;
            max-width: 460px;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        @keyframes vox-listening-dot {
            0%, 100% { transform: scale(1);   box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.18); }
            50%      { transform: scale(1.2); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.32); }
        }

        /* ── Action row beneath each AI message (Gemini-style) ────────── */
        .msg-actions-bar {
            display: flex;
            align-items: center;
            gap: 4px;
            margin: 6px 0 4px 0;
            /* Force this row to wrap below the avatar+content row instead of
               eating horizontal space inside the flex row. Aligns with the
               start of msg-content (after avatar 36px + gap 16px = 52px). */
            flex-basis: 100%;
            padding-left: 52px;
            opacity: 0;
            transform: translateY(-2px);
            transition: opacity 0.18s ease, transform 0.18s ease;
        }

        .message.ai-msg:hover .msg-actions-bar,
        .message.ai-msg:focus-within .msg-actions-bar,
        .msg-actions-bar:has(.is-playing),
        .msg-actions-bar:has(.is-loading) {
            opacity: 1;
            transform: translateY(0);
        }

        .msg-action-btn {
            width: 30px;
            height: 30px;
            border-radius: 8px;
            border: 1px solid transparent;
            background: transparent;
            color: var(--text-dim, rgba(255, 255, 255, 0.5));
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            padding: 0;
            transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
        }

        .msg-action-btn:hover {
            color: var(--accent, rgba(255, 255, 255, 0.95));
            background: var(--accent-dim, rgba(255, 255, 255, 0.06));
            border-color: var(--border, rgba(255, 255, 255, 0.1));
        }

        .msg-action-btn:active {
            transform: translateY(1px);
        }

        .msg-action-btn:focus-visible {
            outline: 2px solid var(--accent, rgba(244, 63, 94, 0.6));
            outline-offset: 1px;
        }

        .msg-action-btn .msg-action-icon {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            line-height: 0;
        }

        .msg-action-btn.is-confirmed {
            color: #22c55e;
        }

        .msg-action-btn.is-loading {
            cursor: progress;
            position: relative;
            color: rgba(244, 63, 94, 0.85);
            border-color: rgba(244, 63, 94, 0.35);
            background: rgba(244, 63, 94, 0.06);
        }
        .msg-action-btn.is-loading .msg-action-icon {
            opacity: 0.55;
        }
        /* Smooth rotating arc — conic gradient + radial mask gives a
           clean trailing-arc spinner. Inset 4px keeps the ring inside
           the button bounds so it doesn't bleed around the neighbouring
           action icons, and the mask radial cut keeps the ring thin
           (~2px stroke) for a refined look. */
        .msg-action-btn.is-loading::after {
            content: "";
            position: absolute;
            inset: 4px;
            border-radius: 50%;
            background: conic-gradient(
                from 0deg,
                rgba(244, 63, 94, 0)    0deg,
                rgba(244, 63, 94, 0)    240deg,
                rgba(244, 63, 94, 0.95) 360deg
            );
            -webkit-mask: radial-gradient(circle, transparent 68%, #000 70%);
                    mask: radial-gradient(circle, transparent 68%, #000 70%);
            animation: vox-tts-spinner 0.9s linear infinite;
            pointer-events: none;
        }
        @keyframes vox-tts-spinner {
            to { transform: rotate(360deg); }
        }

        .msg-action-btn.is-playing {
            color: var(--accent, #f43f5e);
            background: rgba(244, 63, 94, 0.12);
            border-color: rgba(244, 63, 94, 0.4);
            animation: vox-tts-playing 1.4s ease-in-out infinite;
        }

        @keyframes vox-tts-playing {
            0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.0); }
            50%      { box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.18); }
        }

        .msg-action-btn.is-error {
            color: #ef4444;
            background: rgba(239, 68, 68, 0.14);
            border-color: rgba(239, 68, 68, 0.5);
            box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.3), 0 0 8px rgba(239, 68, 68, 0.25);
        }

        .input-box--chat .chat-tool-icon,
        .input-box--chat .chat-tool-icon svg {
            width: 17px;
            height: 17px;
            display: block;
        }

        .input-box--chat .chat-tool-label {
            display: none;
        }

        .input-box--chat .chat-compose-main {
            min-width: 0;
            flex: 1 1 auto;
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            align-items: center;
            gap: 12px;
        }

        .input-box--chat textarea {
            min-width: 0;
            min-height: 24px;
            padding: 2px 0;
        }

        .input-box--chat .send-btn {
            width: 42px;
            height: 42px;
            border-radius: 14px;
            margin-left: 0;
            box-shadow: var(--accent-glow);
        }

        .input-box--chat .send-btn-icon {
            font-size: 18px;
            line-height: 1;
            transform: translateX(1px);
        }

        .attach-preview {
            margin-top: 8px;
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }

        .attachment-preview-list,
        .inline-attach-list {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 8px;
        }

        .msg-content > .inline-attach-list {
            margin-top: 0;
            margin-bottom: 6px;
        }

        .message.user-msg .inline-attach-list {
            justify-content: flex-end;
        }

        .attach-thumb {
            width: 48px;
            height: 48px;
            flex: 0 0 48px;
            border-radius: 8px;
            overflow: hidden;
            border: 1px solid var(--border-bright);
            background: var(--bg-0);
            cursor: pointer;
        }

        .attach-thumb img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        .attach-thumb--input {
            width: 56px;
            height: 56px;
            flex: 0 0 56px;
            position: relative;
        }

        .attach-thumb--input .remove-attach {
            position: absolute;
            top: 2px;
            right: 2px;
            width: 18px;
            height: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(0,0,0,0.6);
            color: #fff;
            border-radius: 50%;
            font-size: 10px;
            cursor: pointer;
            opacity: 0;
            transition: opacity 0.15s;
        }

        .attach-thumb--input:hover .remove-attach {
            opacity: 1;
        }

        .inline-attach-chip {
            max-width: min(220px, 100%);
        }

        .inline-attach-chip img {
            width: 48px;
            height: 48px;
            flex: 0 0 48px;
            object-fit: cover;
            border-radius: 10px;
            border: 1px solid var(--border-bright);
            background: var(--bg-0);
        }

        .attach-chip {
            max-width: min(220px, 100%);
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 8px 10px;
            border-radius: 12px;
            border: 1px solid var(--border);
            background: color-mix(in srgb, var(--bg-2) 84%, #fff 16%);
            overflow: hidden;
        }

        .attach-chip img {
            width: 56px;
            height: 56px;
            flex: 0 0 56px;
            object-fit: cover;
            border-radius: 10px;
            border: 1px solid var(--border-bright);
            background: var(--bg-0);
        }

        .attach-chip-icon {
            font-size: 16px;
            flex: 0 0 auto;
        }

        .attach-chip-name {
            min-width: 0;
            flex: 1 1 auto;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-size: 12px;
            color: var(--text-2);
        }

        .attach-chip-size,
        .attach-thumb-size {
            flex: 0 0 auto;
            font-size: 10px;
            font-weight: 600;
            padding: 2px 6px;
            border-radius: 999px;
            background: color-mix(in srgb, var(--bg-0) 70%, var(--accent) 15%);
            border: 1px solid var(--border);
            color: var(--text-2);
            white-space: nowrap;
            letter-spacing: 0.2px;
        }

        .attach-thumb-size {
            position: absolute;
            bottom: 4px;
            right: 4px;
            font-size: 9px;
            padding: 1px 5px;
            background: rgba(0, 0, 0, 0.65);
            color: #fff;
            border-color: rgba(255, 255, 255, 0.2);
            backdrop-filter: blur(2px);
        }

        .attach-preview--flash {
            animation: attach-preview-flash 0.9s ease;
        }

        @keyframes attach-preview-flash {
            0% {
                box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent);
                background: color-mix(in srgb, var(--accent) 18%, transparent);
            }
            100% {
                box-shadow: 0 0 0 6px transparent;
                background: transparent;
            }
        }

        /* ═══════════ Dock-rail attachments (composer + sent bubbles) ═══════════ */
        /* Per-type accent colour driving the disc ring + thumbnail border. */
        .attach-disc.type-image   { --tc: #30a46c; }
        .attach-disc.type-pdf     { --tc: #e5484d; }
        .attach-disc.type-doc     { --tc: #3b82f6; }
        .attach-disc.type-sheet   { --tc: #16a34a; }
        .attach-disc.type-slides  { --tc: #f97316; }
        .attach-disc.type-audio   { --tc: #a855f7; }
        .attach-disc.type-video   { --tc: #f59e0b; }
        .attach-disc.type-code    { --tc: #38bdf8; }
        .attach-disc.type-config  { --tc: #94a3b8; }
        .attach-disc.type-archive { --tc: #eab308; }
        .attach-disc.type-text    { --tc: var(--accent); }
        .attach-disc.type-file    { --tc: var(--accent); }

        /* Composer dock shell */
        .attach-dock { margin-top: 8px; display: block; }
        .attach-dock .attach-slot {
            position: relative;
            border-radius: 13px;
            padding: 8px 10px;
            min-height: 52px;
            overflow: hidden;
            background: radial-gradient(120% 120% at 50% 0, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0.16));
            box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.5);
        }
        .attach-dock .attach-rail { position: relative; height: 36px; }

        /* The tile: a 36px disc that eases open into a name + ✕ pill on hover. */
        .attach-disc {
            --tc: var(--accent);
            position: absolute;
            top: 0;
            height: 36px;
            width: 36px;
            display: flex;
            align-items: center;
            gap: 0;
            border-radius: 18px;
            background: transparent;
            border: 1px solid transparent;
            cursor: pointer;
            transition: left .35s cubic-bezier(.22, .9, .3, 1), width .35s cubic-bezier(.22, .9, .3, 1),
                        background .275s ease, border-color .275s ease, gap .325s ease,
                        padding .325s ease, box-shadow .275s ease;
        }
        .attach-disc .ad-head {
            flex: 0 0 auto;
            position: relative;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            color: var(--tc);
            background: var(--bg-2);
            box-shadow: 0 0 0 2px color-mix(in srgb, var(--tc) 55%, transparent) inset, 0 2px 6px rgba(0, 0, 0, 0.45);
        }
        .attach-disc .ad-head::after {
            content: "";
            position: absolute;
            inset: -2px;
            border-radius: 50%;
            border: 2px solid var(--bg-1);
            pointer-events: none;
        }
        .attach-disc .ad-head.has-img { background: var(--bg-0); }
        .attach-disc .ad-img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
            border-radius: 50%;
        }
        .attach-disc .ad-ico {
            font-size: 16px;
            line-height: 1;
            position: relative;
            z-index: 1;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .attach-disc .ad-ico svg { width: 17px; height: 17px; display: block; }
        .attach-disc .ad-pct {
            display: none;
            font-size: 9.5px;
            font-weight: 800;
            color: var(--tc);
            position: relative;
            z-index: 1;
            font-variant-numeric: tabular-nums;
        }
        .attach-disc .ad-spin {
            display: none;
            position: absolute;
            inset: -2px;
            border-radius: 50%;
            z-index: 0;
            background: conic-gradient(var(--tc) 230deg, transparent 0);
            -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 0);
            mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 0);
            animation: ad-spin .9s linear infinite;
        }
        @keyframes ad-spin { to { transform: rotate(360deg); } }
        .attach-disc.is-up .ad-ico,
        .attach-disc.is-up .ad-img { display: none; }
        .attach-disc.is-up .ad-pct { display: flex; }
        .attach-disc.is-up .ad-spin { display: block; }
        .attach-disc.is-err .ad-head {
            box-shadow: 0 0 0 2px rgba(229, 72, 77, 0.7) inset, 0 2px 6px rgba(0, 0, 0, 0.45);
            color: #e5484d;
        }
        .attach-disc .ad-bang {
            position: absolute;
            top: -3px;
            right: -3px;
            width: 14px;
            height: 14px;
            border-radius: 50%;
            background: #e5484d;
            color: #fff;
            font-size: 9px;
            font-weight: 800;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 2px solid var(--bg-1);
            z-index: 2;
        }
        .attach-disc .ad-name {
            flex: 1 1 auto;
            min-width: 0;
            font-size: 11.5px;
            font-weight: 600;
            color: var(--text);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            opacity: 0;
            max-width: 0;
            margin: 0;
            transition: opacity .25s ease, max-width .35s cubic-bezier(.22, .9, .3, 1), margin .325s ease;
        }
        .attach-disc .ad-x {
            flex: 0 0 auto;
            width: 18px;
            height: 18px;
            border: 0;
            border-radius: 6px;
            background: rgba(0, 0, 0, 0.35);
            color: var(--text-2);
            font-size: 10px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            max-width: 0;
            overflow: hidden;
            margin: 0;
            padding: 0;
            transition: opacity .25s ease, max-width .3s ease, background .175s, color .175s;
        }
        .attach-disc .ad-x:hover { color: #fff; background: #e5484d; }

        /* Composer: the hovered (desktop) / tapped (touch → .is-open) tile opens. */
        .attach-dock .attach-disc:hover,
        .attach-dock .attach-disc.is-open {
            width: 152px;
            background: var(--bg-2);
            border-color: var(--border-bright);
            gap: 9px;
            padding: 0 7px 0 0;
            box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
            z-index: 90;
        }
        .attach-dock .attach-disc:hover .ad-head,
        .attach-dock .attach-disc.is-open .ad-head { box-shadow: 0 0 0 2px var(--tc) inset, 0 2px 6px rgba(0, 0, 0, 0.45); }
        .attach-dock .attach-disc:hover .ad-name,
        .attach-dock .attach-disc.is-open .ad-name { opacity: 1; max-width: 74px; margin: 0; }
        .attach-dock .attach-disc:hover .ad-x,
        .attach-dock .attach-disc.is-open .ad-x { opacity: 1; max-width: 18px; margin-left: auto; }

        /* ── Sent bubble: "E" pinned corner shelf (CSS-only overlap) ── */
        .message.user-msg .msg-content { position: relative; }
        .inline-attach-list.attach-shelf {
            position: absolute;
            top: -27px;
            right: 10px;
            left: auto;
            margin: 0;
            display: flex;
            flex-direction: row;
            flex-wrap: nowrap;
            gap: 0;
            justify-content: flex-end;
            z-index: 3;
            pointer-events: none;
        }
        .attach-shelf .attach-disc {
            position: relative;
            top: auto;
            left: auto !important;
            pointer-events: auto;
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
        }
        .attach-shelf .attach-disc + .attach-disc { margin-left: -16px; }
        .attach-shelf .attach-disc .ad-head { border: 1px solid var(--border-bright); }
        .attach-shelf .attach-disc:hover {
            width: 152px;
            background: var(--bg-2);
            border-color: var(--border-bright);
            gap: 9px;
            padding: 0 7px 0 0;
            margin-left: 0;
            z-index: 20;
        }
        .attach-shelf .attach-disc:hover + .attach-disc { margin-left: 0; }
        .attach-shelf .attach-disc:hover .ad-name { opacity: 1; max-width: 96px; margin: 0; }

        .remove-attach {
            flex: 0 0 auto;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 22px;
            height: 22px;
            border-radius: 999px;
            border: 1px solid var(--border);
            background: rgba(255, 255, 255, 0.06);
            color: var(--text-2);
            cursor: pointer;
            transition: 0.2s;
        }

        .remove-attach:hover {
            border-color: var(--accent);
            color: var(--accent);
        }

        .mobile-composer-model-slot {
            display: none;
            width: 100%;
            order: -1;
        }

        .mobile-model-button {
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 10px 12px;
            border-radius: 14px;
            border: 1px solid var(--border);
            background: color-mix(in srgb, var(--bg-1) 88%, #fff 12%);
            color: var(--text);
            cursor: pointer;
            text-align: left;
        }

        .mobile-model-copy {
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .mobile-model-label {
            font-size: 10px;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: var(--text-3);
        }

        .mobile-model-value {
            font-size: 12px;
            font-weight: 600;
            color: var(--text);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .mobile-model-badge {
            flex: 0 0 auto;
            padding: 5px 10px;
            border-radius: 999px;
            border: 1px solid var(--border);
            font-size: 10px;
            color: var(--text-2);
            background: var(--bg-2);
        }

        .mobile-model-badge.ready {
            border-color: rgba(34, 197, 94, 0.35);
            color: #86efac;
            background: rgba(34, 197, 94, 0.10);
        }

        .mobile-model-badge.cloud {
            border-color: var(--accent-line);
            color: var(--accent-text);
            background: var(--accent-soft-12);
        }

        .mobile-model-badge.video {
            border-color: var(--accent-line);
            color: var(--accent-text);
            background: var(--accent-soft-12);
        }

        /* ── CHAT FEED ── */
        .content-area {
            flex: 1;
            overflow-y: auto;
            padding: 24px;
            scroll-behavior: smooth;
        }

        #obs-chat .content-area {
            background:
                linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 18%),
                var(--chat-canvas-bg);
        }

        .feed-container {
            max-width: 1100px;
            margin: 0 auto;
            display: flex;
            flex-direction: column;
            gap: 24px;
            padding-bottom: 24px;
        }

        .message {
            display: flex;
            flex-wrap: wrap;            /* let .msg-actions-bar drop to a new line */
            gap: 16px;
            animation: fadeIn 0.3s forwards;
            line-height: 1.6;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(4px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .message.user-msg {
            flex-direction: row-reverse;
            position: relative;
        }

        .avatar {
            width: 36px;
            height: 36px;
            border-radius: 12px;
            background: var(--bg-3);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            font-weight: 700;
            flex-shrink: 0;
            color: var(--text-2);
            border: 1px solid var(--border);
        }

        .message.ai-msg .avatar {
            background: rgba(255, 255, 255, 0.03);
            color: var(--text);
            border: 1px solid rgba(255, 255, 255, 0.08);
            box-shadow: none;
        }

        #obs-chat .message.ai-msg .avatar[data-avatar-type="assistant"] {
            position: relative;
            overflow: hidden;
            background:
                radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.24), transparent 34%),
                linear-gradient(160deg, rgb(var(--chat-avatar-accent-rgb) / 0.95), rgb(var(--chat-avatar-accent-rgb) / 0.66));
            color: var(--chat-avatar-fg);
            border: 1px solid rgb(var(--chat-avatar-accent-rgb) / 0.34);
            box-shadow:
                0 10px 24px rgb(var(--chat-avatar-accent-rgb) / 0.18),
                inset 0 1px 0 rgba(255, 255, 255, 0.16);
        }

        #obs-chat .message.ai-msg .avatar[data-avatar-type="assistant"]::after {
            content: "";
            position: absolute;
            inset: 1px;
            border-radius: inherit;
            pointer-events: none;
            opacity: 0.88;
        }

        #obs-chat .avatar-glyph {
            position: relative;
            z-index: 1;
            letter-spacing: -0.04em;
        }

        #obs-chat[data-chat-avatar-style="solid"] .message.ai-msg .avatar[data-avatar-type="assistant"] {
            background: rgb(var(--chat-avatar-accent-rgb));
            border-color: rgb(var(--chat-avatar-accent-rgb) / 0.5);
            box-shadow: 0 10px 22px rgb(var(--chat-avatar-accent-rgb) / 0.18);
        }

        #obs-chat[data-chat-avatar-style="solid"] .message.ai-msg .avatar[data-avatar-type="assistant"]::after {
            background: transparent;
        }

        #obs-chat[data-chat-avatar-style="prism"] .message.ai-msg .avatar[data-avatar-type="assistant"] {
            background:
                linear-gradient(145deg, rgba(255, 255, 255, 0.16), transparent 38%),
                linear-gradient(130deg, rgb(var(--chat-avatar-accent-rgb) / 0.98), rgba(255, 255, 255, 0.2), rgb(var(--chat-avatar-accent-rgb) / 0.84));
            border-color: rgb(var(--chat-avatar-accent-rgb) / 0.42);
        }

        #obs-chat[data-chat-avatar-style="prism"] .message.ai-msg .avatar[data-avatar-type="assistant"]::after {
            background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 46%);
        }

        #obs-chat[data-chat-avatar-style="halo"] .message.ai-msg .avatar[data-avatar-type="assistant"] {
            background: rgba(9, 10, 15, 0.9);
            border-color: rgb(var(--chat-avatar-accent-rgb) / 0.46);
            box-shadow:
                0 0 0 1px rgb(var(--chat-avatar-accent-rgb) / 0.18),
                0 0 24px rgb(var(--chat-avatar-accent-rgb) / 0.34);
        }

        #obs-chat[data-chat-avatar-style="halo"] .message.ai-msg .avatar[data-avatar-type="assistant"]::after {
            background: radial-gradient(circle, rgb(var(--chat-avatar-accent-rgb) / 0.2), transparent 64%);
        }

        .msg-content {
            font-size: 15px;
            color: var(--text);
            max-width: 85%;
            word-break: break-word;
        }

        .message.user-msg .msg-content {
            background: var(--bg-2);
            border: 1px solid var(--border-bright);
            padding: 12px 18px;
            border-radius: 18px 18px 4px 18px;
            /* User messages stay compact on the right — don't stretch */
            max-width: 60%;
            width: fit-content;
            margin-left: auto;
        }

        .message.ai-msg .msg-content {
            width: min(100%, 1080px);
            max-width: min(100%, 1080px);
            padding: 6px 0 8px;
            border-radius: 0;
            border: none;
            background: transparent;
            box-shadow: none;
        }

        #obs-chat .message.ai-msg .msg-content {
            color: var(--chat-response-text-color);
        }

        .msg-content p {
            margin-bottom: 14px;
        }

        .msg-content p:last-child {
            margin-bottom: 0;
        }

        .msg-content code {
            font-family: 'JetBrains Mono', monospace;
            background: var(--bg-2);
            padding: 2px 6px;
            border-radius: 4px;
            font-size: 13.5px;
            color: var(--accent);
            border: 1px solid var(--border);
        }

        .msg-content pre {
            background: var(--bg-2);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 16px;
            margin: 16px 0;
            overflow-x: auto;
            font-size: 14px;
            font-family: 'JetBrains Mono', monospace;
        }

        .msg-content pre code {
            background: transparent;
            padding: 0;
            border: none;
            color: var(--text);
        }

        .model-attribution {
            display: inline-block;
            margin-top: 12px;
            font-size: 10.5px;
            line-height: 1;
            letter-spacing: 0.04em;
            color: var(--text-3);
            border: 1px solid var(--border);
            border-radius: 999px;
            padding: 4px 10px;
            background: var(--bg-1);
        }

        /* Inline, borderless footer treatment for the AI message's
           "Sent by: <Model>" line.  The bordered-pill default was a
           leftover beta look; in-chat we want it to read as a quiet
           inline byline that sits cleanly above the sources block. */
        .message.ai-msg .model-attribution.chat-sender {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            margin-top: 0;
            margin-bottom: 8px;
            padding: 0;
            background: transparent;
            border: none;
            font-size: 10.5px;
            font-weight: 500;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            color: rgba(195, 200, 215, 0.42);
        }

        .message.ai-msg .model-attribution.chat-sender::before {
            content: "";
            display: inline-block;
            width: 4px;
            height: 4px;
            border-radius: 999px;
            background: currentColor;
            opacity: 0.55;
            margin-right: 2px;
        }

        #obs-chat .message.ai-msg .model-attribution.chat-sender,
        #obs-chat .model-attribution {
            color: var(--chat-attribution-text);
        }

        #obs-chat .message.ai-msg .model-attribution.chat-sender {
            color: rgba(195, 200, 215, 0.42);
            border: none;
        }

        .response-text {
            display: flex;
            flex-direction: column;
            gap: 12px;
            width: 100%;
            /* Prose breathes better at 1.78 once lines get longer than ~760px.
               Code blocks and tables override this back to their own values. */
            line-height: 1.78;
            color: rgba(232, 235, 240, 0.96);
        }

        #obs-chat .response-text {
            color: var(--chat-response-text-color);
        }

        .response-text--streaming {
            gap: 0;
            white-space: pre-wrap;
            line-height: 1.78;
        }

        .response-text > * {
            margin: 0;
            /* Cap PROSE elements to a comfortable reading width (~75-85ch).
               Code blocks, tables, blockquotes, and lists override this back
               to 100% so they can use the full bubble width when they need
               to (long code, wide tables). */
            max-width: 820px;
            width: 100%;
        }
        .response-text > pre,
        .response-text > table,
        .response-text > blockquote,
        .response-text > ul,
        .response-text > ol,
        .response-text > hr,
        .response-text > .vox-code-pre,
        .response-text > div {
            max-width: 100%;
        }
        /* Margin between paragraphs — gap alone leaves them feeling stacked
           without rhythm at the wider line width. */
        .response-text > p {
            margin-bottom: 6px;
        }
        .response-text > p:last-child {
            margin-bottom: 0;
        }

        .response-text :is(h1, h2, h3, h4) {
            line-height: 1.14;
            letter-spacing: -0.03em;
            font-weight: 720;
            color: #fff;
        }

        #obs-chat .response-text :is(h1, h2, h3, h4) {
            color: var(--chat-heading-color);
        }

        .response-text h1 {
            font-size: clamp(2rem, 1.85rem + 0.8vw, 2.45rem);
            margin-top: 6px;
            margin-bottom: 8px;
        }

        .response-text h2 {
            font-size: clamp(1.38rem, 1.25rem + 0.45vw, 1.72rem);
            margin-top: 28px;
            margin-bottom: 10px;
            padding-bottom: 6px;
            /* Faint hairline so h2 visually anchors a section break. */
            border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        }

        .response-text h3 {
            font-size: 1.08rem;
            margin-top: 20px;
            margin-bottom: 6px;
            color: var(--accent-text, rgba(255, 200, 215, 0.92));
        }

        #obs-chat .response-text h3 {
            color: var(--accent-text, var(--chat-heading-color));
        }

        .response-text h4 {
            font-size: 1rem;
            margin-top: 14px;
            margin-bottom: 4px;
            color: rgba(232, 235, 240, 0.86);
        }

        .response-text p,
        .response-text li {
            font-size: 15px;
            color: rgba(224, 228, 235, 0.94);
        }

        #obs-chat .response-text p,
        #obs-chat .response-text li,
        #obs-chat .msg-content > p {
            color: var(--chat-response-text-color);
        }

        .response-text ul,
        .response-text ol {
            display: grid;
            /* Larger gap so lists feel like distinct items, not a paragraph
               with bullet glyphs. */
            gap: 14px;
            padding-left: 1.5rem;
            margin: 4px 0 6px;
        }

        .response-text li {
            /* Give individual list items their own internal breathing room
               for multi-line items. */
            padding-left: 4px;
        }

        .response-text li::marker {
            color: rgba(187, 193, 204, 0.82);
            font-weight: 600;
        }
        .response-text ol > li::marker {
            color: var(--accent-text, rgba(255, 200, 215, 0.85));
        }

        .response-text strong {
            color: #fff;
            font-weight: 700;
        }

        #obs-chat .response-text strong {
            color: var(--chat-heading-color);
        }

        .response-text a {
            color: #ffc2cf;
            text-decoration-thickness: 1px;
            text-underline-offset: 0.16em;
        }

        #obs-chat .response-text a {
            color: var(--chat-link-color);
        }

        .response-text blockquote {
            margin: 4px 0;
            padding: 14px 16px;
            border-left: 3px solid rgba(255, 91, 125, 0.72);
            border-radius: 0 16px 16px 0;
            background: linear-gradient(180deg, rgba(255, 91, 125, 0.07), rgba(255, 255, 255, 0.025));
            color: rgba(250, 235, 239, 0.96);
        }

        #obs-chat .response-text blockquote {
            background: var(--chat-quote-bg);
            border-left-color: var(--chat-quote-border);
            color: var(--chat-response-text-color);
        }

        .response-text hr {
            width: 100%;
            height: 1px;
            border: 0;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
            margin: 2px 0;
        }

        .response-text code {
            background: rgba(255, 255, 255, 0.055);
            border-color: rgba(255, 255, 255, 0.08);
            color: #ffd2dc;
        }

        #obs-chat .response-text code {
            background: var(--chat-inline-bg);
            border-color: var(--chat-inline-border);
            color: var(--chat-inline-text);
        }

        .response-text pre {
            background:
                linear-gradient(180deg, rgba(6, 9, 15, 0.98), rgba(11, 14, 22, 0.98)),
                radial-gradient(circle at top left, rgba(255, 91, 125, 0.08), transparent 28%);
            border-color: rgba(255, 255, 255, 0.08);
            border-radius: 18px;
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
        }

        #obs-chat .response-text pre {
            background: var(--chat-code-bg);
            border-color: var(--chat-code-border);
        }

        .response-text pre code {
            color: rgba(245, 247, 252, 0.94);
        }

        #obs-chat .response-text pre code {
            color: var(--chat-code-text);
        }

        .response-text table {
            width: 100%;
            border-collapse: separate;
            border-spacing: 0;
            overflow: hidden;
            border: 1px solid rgba(255, 255, 255, 0.08);
            border-radius: 16px;
            background: rgba(255, 255, 255, 0.02);
        }

        .response-text th,
        .response-text td {
            padding: 10px 12px;
            text-align: left;
            border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        }

        .response-text th {
            font-size: 11px;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--text-3);
            background: rgba(255, 255, 255, 0.03);
        }

        .response-text tr:last-child td {
            border-bottom: 0;
        }

        .assistant-response-extras {
            display: flex;
            flex-direction: column;
            gap: 14px;
            width: 100%;
            margin-top: 16px;
        }

        .assistant-extras-section {
            display: flex;
            flex-direction: column;
            gap: 8px;
            width: 100%;
        }

        .assistant-extras-heading {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 10.5px;
            line-height: 1;
            text-transform: uppercase;
            letter-spacing: 0.09em;
            color: rgba(225, 228, 234, 0.5);
            font-weight: 600;
            padding-left: 2px;
        }

        .assistant-extras-heading-label {
            white-space: nowrap;
        }

        .assistant-extras-heading-rule {
            flex: 1;
            height: 1px;
            background: linear-gradient(
                to right,
                rgba(255, 255, 255, 0.08) 0%,
                rgba(255, 255, 255, 0) 100%
            );
        }

        /* ── Sources: card-style citation links ────────────────────────── */
        .assistant-source-row {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
            gap: 6px;
            width: 100%;
        }

        .assistant-source-chip {
            display: grid;
            grid-template-columns: 24px 1fr auto;
            align-items: center;
            gap: 10px;
            padding: 9px 12px;
            min-height: 44px;
            border-radius: 10px;
            border: 1px solid rgba(140, 168, 220, 0.12);
            background: linear-gradient(
                180deg,
                rgba(120, 150, 200, 0.05) 0%,
                rgba(120, 150, 200, 0.02) 100%
            );
            color: var(--text-1);
            text-decoration: none;
            transition: border-color 0.16s ease,
                        background 0.16s ease,
                        transform 0.16s ease;
            position: relative;
            overflow: hidden;
        }

        .assistant-source-chip::before {
            content: "";
            position: absolute;
            inset: 0 auto 0 0;
            width: 2px;
            background: rgba(140, 168, 220, 0.28);
            opacity: 0;
            transition: opacity 0.16s ease;
        }

        .assistant-source-chip:hover,
        .assistant-source-chip:focus-visible {
            border-color: rgba(140, 168, 220, 0.32);
            background: linear-gradient(
                180deg,
                rgba(120, 150, 200, 0.09) 0%,
                rgba(120, 150, 200, 0.04) 100%
            );
            transform: translateY(-1px);
            outline: none;
        }

        .assistant-source-chip:hover::before,
        .assistant-source-chip:focus-visible::before {
            opacity: 1;
        }

        .assistant-source-chip-icon {
            width: 24px;
            height: 24px;
            border-radius: 6px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 11px;
            font-weight: 700;
            color: rgba(195, 215, 245, 0.95);
            background: rgba(140, 168, 220, 0.16);
            border: 1px solid rgba(140, 168, 220, 0.22);
        }

        .assistant-source-chip-text {
            display: flex;
            flex-direction: column;
            min-width: 0;
            gap: 2px;
        }

        .assistant-source-chip-label {
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-size: 12.5px;
            font-weight: 500;
            line-height: 1.35;
            color: rgba(232, 235, 240, 0.92);
        }

        .assistant-source-chip-domain {
            font-size: 10.5px;
            line-height: 1.2;
            color: rgba(180, 195, 220, 0.55);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .assistant-source-chip-arrow {
            font-size: 12px;
            color: rgba(180, 195, 220, 0.45);
            transition: transform 0.16s ease, color 0.16s ease;
            flex: 0 0 auto;
        }

        .assistant-source-chip:hover .assistant-source-chip-arrow,
        .assistant-source-chip:focus-visible .assistant-source-chip-arrow {
            color: rgba(195, 215, 245, 0.85);
            transform: translate(2px, -2px);
        }

        /* ── Follow-ups: tappable suggestion chips ─────────────────────── */
        .assistant-followup-row {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            width: 100%;
        }

        .assistant-followup-chip {
            appearance: none;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 6px 12px 6px 10px;
            min-height: 30px;
            border-radius: 999px;
            border: 1px solid rgba(255, 145, 170, 0.16);
            background: rgba(255, 145, 170, 0.05);
            color: rgba(232, 235, 240, 0.88);
            font: inherit;
            font-size: 12px;
            line-height: 1.3;
            text-align: left;
            white-space: normal;
            overflow-wrap: anywhere;
            cursor: pointer;
            transition: border-color 0.16s ease,
                        background 0.16s ease,
                        color 0.16s ease,
                        transform 0.16s ease;
        }

        .assistant-followup-chip:hover,
        .assistant-followup-chip:focus-visible {
            border-color: rgba(255, 145, 170, 0.38);
            background: rgba(255, 145, 170, 0.12);
            color: #fff;
            transform: translateY(-1px);
            outline: none;
        }

        /* ── Reading-rhythm helpers (Phase K) ────────────────────────────
           Callout blockquotes: any blockquote whose first text node starts
           with 💡 / ⚠️ / 🎯 / ✅ / ❌ / 🔥 / 📌 gets a mood-tinted left bar
           and background.  These are emitted by the model when it wants to
           highlight a tip, warning, or punchline as its own visual beat. */
        .response-text blockquote {
            /* Existing blockquote keeps its base style; the :has() variants
               below override the border + background. */
            position: relative;
        }
        .response-text blockquote:has(> p:first-child:is(:where([data-callout]))) {
            /* placeholder for explicit data-callout marking if the parser
               adopts it; today we rely on the emoji-prefix rules below. */
        }
        /* Tip / insight — cool yellow */
        .response-text blockquote:where(:has(> p:first-child)) {
            transition: background 0.2s ease, border-left-color 0.2s ease;
        }
        .response-text blockquote.callout-tip,
        .response-text blockquote:where(:has(> p:first-child:where(:first-letter))) {
            /* base; specific variants below win via class+emoji-attribute */
        }
        /* Emoji-prefix callout variants — applied via small JS that reads
           the first emoji of the leading paragraph and tags the blockquote. */
        .response-text blockquote[data-callout="tip"] {
            border-left-color: rgba(255, 211, 105, 0.78);
            background: linear-gradient(180deg, rgba(255, 211, 105, 0.10), rgba(255, 255, 255, 0.02));
        }
        .response-text blockquote[data-callout="warn"] {
            border-left-color: rgba(255, 154, 86, 0.85);
            background: linear-gradient(180deg, rgba(255, 154, 86, 0.10), rgba(255, 255, 255, 0.02));
        }
        .response-text blockquote[data-callout="success"] {
            border-left-color: rgba(120, 220, 145, 0.85);
            background: linear-gradient(180deg, rgba(120, 220, 145, 0.10), rgba(255, 255, 255, 0.02));
        }
        .response-text blockquote[data-callout="danger"] {
            border-left-color: rgba(255, 110, 130, 0.85);
            background: linear-gradient(180deg, rgba(255, 110, 130, 0.11), rgba(255, 255, 255, 0.02));
        }
        .response-text blockquote[data-callout="target"] {
            border-left-color: rgba(140, 200, 255, 0.85);
            background: linear-gradient(180deg, rgba(140, 200, 255, 0.10), rgba(255, 255, 255, 0.02));
        }
        .response-text blockquote[data-callout="hot"] {
            border-left-color: rgba(255, 138, 96, 0.85);
            background: linear-gradient(180deg, rgba(255, 138, 96, 0.10), rgba(255, 255, 255, 0.02));
        }
        .response-text blockquote[data-callout="pin"] {
            border-left-color: rgba(200, 180, 255, 0.85);
            background: linear-gradient(180deg, rgba(200, 180, 255, 0.10), rgba(255, 255, 255, 0.02));
        }

        /* Labeled-paragraph chip — when a paragraph starts with **Label:**
           we render the label as a coloured chip and indent the body.
           Applied via a small JS post-process; the base CSS hangs the chip
           on a span[data-label]. */
        .response-text p .label-chip {
            display: inline-flex;
            align-items: center;
            padding: 2px 9px;
            margin-right: 8px;
            border-radius: 999px;
            background: rgba(255, 145, 170, 0.12);
            border: 1px solid rgba(255, 145, 170, 0.32);
            color: rgba(255, 200, 215, 0.95);
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            vertical-align: 2px;
            line-height: 1.4;
        }
        /* Inline emoji breathing room — mid-sentence emojis shouldn't get
           squeezed against text on dense lines. */
        .response-text p span.emoji,
        .response-text li span.emoji {
            margin: 0 1px;
        }

        /* Study-mode chip variant — slightly cooler tint to distinguish from
           the regular follow-up suggestions. */
        .assistant-followup-chip--study {
            border-color: rgba(140, 180, 255, 0.20);
            background: rgba(140, 180, 255, 0.06);
        }
        .assistant-followup-chip--study:hover,
        .assistant-followup-chip--study:focus-visible {
            border-color: rgba(140, 180, 255, 0.45);
            background: rgba(140, 180, 255, 0.14);
        }

        .assistant-followup-chip-arrow {
            font-size: 13px;
            line-height: 1;
            font-weight: 600;
            color: rgba(255, 145, 170, 0.75);
            flex: 0 0 auto;
            transition: transform 0.16s ease, color 0.16s ease;
        }

        .assistant-followup-chip:hover .assistant-followup-chip-arrow,
        .assistant-followup-chip:focus-visible .assistant-followup-chip-arrow {
            color: rgba(255, 175, 195, 1);
            transform: translateX(2px);
        }

        .assistant-followup-chip-label {
            min-width: 0;
        }

        .sr--stack {
            align-items: flex-start;
        }

        .chat-theme-picker {
            width: 100%;
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
            gap: 12px;
            margin-top: 12px;
        }

        .chat-theme-card {
            appearance: none;
            border: 1px solid rgba(255, 255, 255, 0.08);
            background: rgba(255, 255, 255, 0.02);
            border-radius: 18px;
            padding: 12px;
            display: grid;
            gap: 10px;
            text-align: left;
            color: var(--text);
            cursor: pointer;
            transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
        }

        .chat-theme-card:hover,
        .chat-theme-card:focus-visible {
            border-color: rgba(255, 255, 255, 0.16);
            background: rgba(255, 255, 255, 0.04);
            transform: translateY(-1px);
        }

        .chat-theme-card.active {
            border-color: rgba(255, 89, 120, 0.42);
            box-shadow: 0 0 0 1px rgba(255, 89, 120, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.04);
            background: rgba(255, 89, 120, 0.05);
        }

        .chat-theme-card-preview {
            display: block;
            width: 100%;
            aspect-ratio: 1.8 / 1;
            border-radius: 14px;
            border: 1px solid rgba(255, 255, 255, 0.08);
            background: #151821;
            position: relative;
            overflow: hidden;
        }

        .chat-theme-card-preview::before {
            content: "";
            position: absolute;
            inset: 12% 12%;
            border-radius: 12px;
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid rgba(255, 255, 255, 0.08);
        }

        .chat-theme-card-preview::after {
            content: "";
            position: absolute;
            inset: auto 16% 16%;
            height: 8px;
            border-radius: 999px;
            background: rgba(255, 255, 255, 0.18);
        }

        .chat-theme-card-preview--obsidian {
            background: radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 40%), #0f1013;
        }

        .chat-theme-card-preview--ember {
            background: radial-gradient(circle at top left, rgba(255, 123, 76, 0.36), transparent 34%), radial-gradient(circle at top right, rgba(255, 74, 110, 0.24), transparent 28%), #130d0d;
        }

        .chat-theme-card-preview--aurora {
            background: radial-gradient(circle at top left, rgba(91, 197, 255, 0.32), transparent 34%), radial-gradient(circle at top right, rgba(124, 247, 199, 0.24), transparent 30%), #091119;
        }

        .chat-theme-card-preview--forest {
            background: radial-gradient(circle at top left, rgba(100, 255, 196, 0.24), transparent 32%), radial-gradient(circle at top right, rgba(125, 211, 252, 0.2), transparent 28%), #0c1412;
        }

        .chat-theme-card-copy {
            display: grid;
            gap: 4px;
        }

        .chat-theme-card-title {
            font-size: 14px;
            font-weight: 700;
            color: var(--text-1);
        }

        .chat-theme-card-desc {
            font-size: 12px;
            color: var(--text-3);
        }

        .chat-avatar-swatch-row {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            justify-content: flex-end;
        }

        .chat-avatar-swatch {
            width: 34px;
            height: 34px;
            border-radius: 999px;
            border: 2px solid rgba(255, 255, 255, 0.1);
            background:
                radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.28), transparent 34%),
                linear-gradient(155deg, rgb(var(--swatch-rgb) / 0.98), rgb(var(--swatch-rgb) / 0.7));
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
            cursor: pointer;
            transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
        }

        .chat-avatar-swatch:hover,
        .chat-avatar-swatch:focus-visible {
            transform: translateY(-1px) scale(1.02);
            border-color: rgba(255, 255, 255, 0.22);
        }

        .chat-avatar-swatch.active {
            border-color: rgba(255, 255, 255, 0.65);
            box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16), 0 6px 16px rgb(var(--swatch-rgb) / 0.24);
        }

        .chat-avatar-swatch[data-chat-avatar-color="rose"] { --swatch-rgb: 255 86 118; }
        .chat-avatar-swatch[data-chat-avatar-color="ember"] { --swatch-rgb: 255 140 82; }
        .chat-avatar-swatch[data-chat-avatar-color="ocean"] { --swatch-rgb: 80 182 255; }
        .chat-avatar-swatch[data-chat-avatar-color="mint"] { --swatch-rgb: 83 230 176; }
        .chat-avatar-swatch[data-chat-avatar-color="gold"] { --swatch-rgb: 244 211 94; }
        .chat-avatar-swatch[data-chat-avatar-color="violet"] { --swatch-rgb: 173 123 255; }

        /* ── CHAT + IMAGE HARDENING (desktop/shared) ── */
        .input-box--chat .chat-composer-rail {
            align-self: flex-end;
        }

        .input-box--chat #attach-btn,
        .input-box--chat #skills-toggle {
            font-size: 0 !important;
            line-height: 0 !important;
            text-indent: 0 !important;
            overflow: hidden;
            color: var(--text-2);
        }

        .input-box--chat #attach-btn::before,
        .input-box--chat #attach-btn::after,
        .input-box--chat #skills-toggle::before,
        .input-box--chat #skills-toggle::after {
            content: none !important;
        }

        .input-box--chat #attach-btn>*,
        .input-box--chat #skills-toggle>* {
            pointer-events: none;
        }

        /* ── Skills Dropdown ── */
        .skills-dropdown-wrap {
            position: relative;
            display: inline-flex;
        }

        .skills-dropdown {
            position: absolute;
            bottom: calc(100% + 8px);
            left: 0;
            min-width: 180px;
            background: var(--bg-2, #1a1a2e);
            border: 1px solid rgba(255, 255, 255, 0.10);
            border-radius: 14px;
            padding: 6px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04);
            z-index: 200;
            backdrop-filter: blur(20px);
            animation: skillsDropIn 0.15s ease;
        }

        @keyframes skillsDropIn {
            from { opacity: 0; transform: translateY(6px) scale(0.97); }
            to   { opacity: 1; transform: translateY(0) scale(1); }
        }

        .skills-dropdown-item {
            display: flex;
            align-items: center;
            gap: 10px;
            width: 100%;
            padding: 9px 12px;
            border: none;
            border-radius: 10px;
            background: transparent;
            color: var(--text-2, #aaa);
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
            transition: 0.14s ease;
            text-align: left;
        }

        .skills-dropdown-item:hover:not(:disabled) {
            background: rgba(255, 255, 255, 0.06);
            color: var(--text, #fff);
        }

        .skills-dropdown-item.is-active {
            background: rgba(244, 63, 94, 0.12);
            color: var(--accent, #f43f5e);
        }

        .skills-dropdown-item:disabled {
            opacity: 0.35;
            cursor: default;
        }

        .skills-dropdown-icon {
            font-size: 16px;
            width: 22px;
            text-align: center;
            flex-shrink: 0;
        }

        .skills-dropdown-label {
            flex: 1;
        }

        .skills-dropdown-badge {
            font-size: 10px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            padding: 2px 6px;
            border-radius: 6px;
            background: rgba(255, 255, 255, 0.06);
            color: var(--text-3, #666);
        }

        .skills-dropdown-divider {
            height: 1px;
            background: rgba(255, 255, 255, 0.06);
            margin: 4px 8px;
        }

        .skills-dropdown-item--clear .skills-dropdown-icon {
            font-size: 12px;
            opacity: 0.5;
        }

        /* ── Active Skill Chip (Gemini-style, sits next to the + button) ── */
        .skill-chip {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            height: 30px;
            padding: 0 6px 0 10px;
            margin-left: 4px;
            border-radius: 999px;
            background: linear-gradient(135deg, rgba(244, 63, 94, 0.14), rgba(139, 92, 246, 0.14));
            border: 1px solid rgba(244, 63, 94, 0.32);
            color: var(--text, #fff);
            font-size: 12px;
            font-weight: 500;
            line-height: 1;
            white-space: nowrap;
            animation: skillChipIn 0.18s ease-out;
        }

        @keyframes skillChipIn {
            from { opacity: 0; transform: translateY(2px) scale(0.96); }
            to   { opacity: 1; transform: translateY(0) scale(1); }
        }

        .skill-chip-icon {
            font-size: 13px;
            line-height: 1;
        }

        .skill-chip-label {
            font-size: 12px;
            font-weight: 500;
            letter-spacing: 0.01em;
        }

        .skill-chip-close {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 20px;
            height: 20px;
            padding: 0;
            margin-left: 2px;
            border: none;
            border-radius: 50%;
            background: transparent;
            color: var(--text-2, #aaa);
            font-size: 16px;
            font-weight: 400;
            line-height: 1;
            cursor: pointer;
            transition: 0.14s ease;
        }

        .skill-chip-close:hover {
            background: rgba(255, 255, 255, 0.1);
            color: var(--text, #fff);
        }

        @media (max-width: 640px) {
            .skill-chip {
                height: 28px;
                padding: 0 4px 0 8px;
                font-size: 11px;
            }
            .skill-chip-label { font-size: 11px; }
        }

        /* ── Chat Generated Media bubble (inline in conversation) ── */
        .chat-generated-image {
            margin: 10px 0 14px 0;
            padding: 14px 14px 10px 14px;
            border-radius: 18px;
            border: 1px solid rgba(244, 63, 94, 0.35);
            background: rgba(0, 0, 0, 0.25);
            max-width: min(560px, 100%);
            display: inline-flex;
            flex-direction: column;
            gap: 10px;
            box-sizing: border-box;
            contain: layout paint style;
            content-visibility: auto;
            contain-intrinsic-size: 360px 420px;
        }
        .chat-generated-image.is-portrait {
            max-width: min(340px, 100%);
        }
        .chat-gen-img-container {
            position: relative;
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 12px;
            overflow: hidden;
            border: 1px solid rgba(244, 63, 94, 0.32);
            background: rgba(0, 0, 0, 0.35);
            aspect-ratio: 16 / 10;
        }
        .chat-generated-image.is-portrait .chat-gen-img-container { aspect-ratio: 3 / 4; }
        .chat-generated-image.is-square   .chat-gen-img-container { aspect-ratio: 1 / 1; }
        .chat-gen-img,
        .chat-gen-vid {
            display: block;
            width: 100%;
            height: 100%;
            object-fit: cover;
            cursor: pointer;
            transition: 0.2s ease;
        }
        .chat-gen-img:hover { filter: brightness(1.05); }
        .chat-gen-title {
            font-size: 13px;
            font-weight: 500;
            color: var(--text-2, #cfcfcf);
            line-height: 1.35;
            padding: 0 2px;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }
        .chat-gen-actions {
            display: flex;
            gap: 8px;
            justify-content: space-between;
            padding-top: 6px;
            border-top: 1px solid rgba(255, 255, 255, 0.06);
        }
        .chat-gen-action {
            flex: 1 1 0;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
            padding: 6px 8px;
            font-size: 11.5px;
            font-weight: 500;
            color: var(--text-2, #d0d0d0);
            background: transparent;
            border: 1px solid rgba(244, 63, 94, 0.28);
            border-radius: 9px;
            cursor: pointer;
            transition: 0.15s ease;
        }
        .chat-gen-action:hover {
            color: #fff;
            border-color: rgba(244, 63, 94, 0.6);
            background: rgba(244, 63, 94, 0.08);
        }
        @media (max-width: 560px) {
            .chat-generated-image { max-width: 100%; padding: 10px 10px 8px; contain-intrinsic-size: 280px 360px; }
            .chat-gen-action { font-size: 11px; padding: 6px 4px; }
        }

        /* ── Minimal mode: image-only bubble (no title, no buttons) ──
           The image fills the message box. Click opens the original asset
           in a new tab via a wrapping anchor (handled in JS). */
        .chat-generated-image--minimal {
            padding: 0;
            border: none;
            background: transparent;
            gap: 0;
            max-width: min(540px, 100%);
        }
        .chat-generated-image--minimal.is-portrait {
            max-width: min(340px, 100%);
        }
        .chat-generated-image--minimal .chat-gen-img-container {
            aspect-ratio: auto;
            border-radius: 14px;
            border: 1px solid rgba(244, 63, 94, 0.32);
            background: rgba(0, 0, 0, 0.35);
            overflow: hidden;
        }
        .chat-generated-image--minimal .chat-gen-link {
            display: block;
            width: 100%;
            height: 100%;
            line-height: 0;
            cursor: zoom-in;
        }
        .chat-generated-image--minimal .chat-gen-img {
            width: 100%;
            height: auto;
            max-height: 58vh;
            object-fit: contain;
            display: block;
            cursor: zoom-in;
        }
        .chat-generated-image--minimal .chat-gen-vid {
            width: 100%;
            height: auto;
            max-height: 58vh;
            object-fit: contain;
            display: block;
            cursor: default;
        }
        .chat-generated-image--minimal .chat-gen-img:hover {
            filter: brightness(1.04);
        }
        .chat-generated-image--legacy {
            padding: 0;
            border: none;
            background: transparent;
            max-width: min(540px, 100%);
        }
        .chat-generated-image--legacy .chat-generated-image-card {
            margin: 0;
            max-width: 100%;
            overflow: hidden;
        }
        .chat-generated-image--legacy .chat-generated-image-card img {
            display: block;
            width: 100%;
            height: auto;
            max-height: 58vh;
            object-fit: contain;
            cursor: zoom-in;
            background: rgba(0, 0, 0, 0.35);
        }
        /* Video inside the legacy card — matches image sizing but uses native
           player controls and a solid black letterbox background. */
        .chat-generated-image--legacy .chat-generated-image-card video {
            display: block;
            width: 100%;
            height: auto;
            max-height: 65vh;
            background: #000;
            cursor: default;
        }
        .chat-generated-image--legacy.is-portrait {
            max-width: min(340px, 100%);
        }
        @media (max-width: 560px) {
            .chat-generated-image--minimal,
            .chat-generated-image--legacy {
                max-width: min(100%, calc(100vw - 74px));
            }
            .chat-generated-image--minimal.is-portrait,
            .chat-generated-image--legacy.is-portrait {
                max-width: min(82vw, 280px);
            }
            .chat-generated-image--minimal .chat-gen-img,
            .chat-generated-image--minimal .chat-gen-vid,
            .chat-generated-image--legacy .chat-generated-image-card img,
            .chat-generated-image--legacy .chat-generated-image-card video {
                max-height: 46vh;
            }
        }
        @media (max-width: 380px) {
            .chat-generated-image--minimal,
            .chat-generated-image--legacy {
                max-width: min(100%, calc(100vw - 62px));
            }
            .chat-generated-image--minimal .chat-gen-img,
            .chat-generated-image--minimal .chat-gen-vid,
            .chat-generated-image--legacy .chat-generated-image-card img,
            .chat-generated-image--legacy .chat-generated-image-card video {
                max-height: 42vh;
            }
        }

        .obs-gallery {
            align-items: stretch;
            gap: 16px;
        }

        /* ── SETTINGS VIEW (V3 SET-SPLIT) ── */


        .set-split {
            display: flex;
            flex: 1;
            overflow: hidden;
        }

        .set-nav {
            width: 220px;
            border-right: 1px solid var(--border);
            padding: 16px 0;
            background: var(--bg-1);
        }

        .sn {
            padding: 9px 24px;
            font-size: 14px;
            cursor: pointer;
            color: var(--text-2);
            transition: 0.15s;
            border-left: 2px solid transparent;
        }

        .sn:hover {
            color: var(--text);
            background: var(--bg-hover);
        }

        .sn.active {
            color: var(--accent);
            border-left-color: var(--accent);
            background: var(--accent-dim);
        }

        .set-body {
            flex: 1;
            padding: 32px 40px;
            overflow-y: auto;
            max-width: 720px;
        }

        .set-panel {
            display: none;
        }

        .set-panel.active {
            display: block;
        }

        .sg {
            margin-bottom: 36px;
        }

        .sg h2 {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 20px;
            padding-bottom: 14px;
            border-bottom: 1px solid var(--border);
        }

        .sr {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 14px 0;
            border-bottom: 1px solid rgba(255, 255, 255, 0.03);
        }

        .sr:last-child {
            border-bottom: none;
        }

        .sr-label {
            font-weight: 500;
            font-size: 14px;
        }

        .sr-desc {
            font-size: 12px;
            color: var(--text-3);
            margin-top: 2px;
        }

        .theme-picker {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }

        .theme-swatch {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            cursor: pointer;
            border: 2px solid transparent;
            transition: 0.2s;
        }

        .theme-swatch:hover {
            transform: scale(1.15);
        }

        .theme-swatch.active {
            border-color: var(--text);
            box-shadow: 0 0 0 4px var(--accent-dim);
        }

        .toggle {
            position: relative;
            width: 42px;
            height: 24px;
            display: inline-block;
        }

        .toggle input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .tsl {
            position: absolute;
            cursor: pointer;
            inset: 0;
            background: var(--bg-3);
            border-radius: 34px;
            transition: .3s;
        }

        .tsl:before {
            position: absolute;
            content: "";
            height: 18px;
            width: 18px;
            left: 3px;
            bottom: 3px;
            background: var(--text-3);
            border-radius: 50%;
            transition: .3s;
        }

        input:checked+.tsl {
            background: var(--accent);
        }

        input:checked+.tsl:before {
            transform: translateX(18px);
            background: var(--bg-0);
        }

        .setting-select {
            width: 200px;
            background: var(--bg-0);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 8px 12px;
            color: var(--text);
            font-family: inherit;
            font-size: 13px;
            outline: none;
        }

        .setting-select:focus {
            border-color: var(--accent);
        }

        .danger-btn {
            padding: 8px 16px;
            background: transparent;
            border: 1px solid var(--red);
            color: var(--red);
            font-weight: 600;
            font-size: 12px;
            cursor: pointer;
            border-radius: 6px;
            transition: 0.2s;
        }

        .danger-btn:hover {
            background: var(--red);
            color: #fff;
        }

        /* ── IDE ── */

        .ide-layout {
            display: flex;
            flex: 1;
            overflow: hidden;
        }

        .ide-sidebar {
            width: 240px;
            border-right: 1px solid var(--border);
            background: var(--bg-1);
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        .ide-sidebar-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 12px 8px;
            border-bottom: 1px solid var(--border);
            font-size: 13px;
        }

        .ide-file-tree {
            flex: 1;
            overflow-y: auto;
            padding: 4px 0;
            font-size: 13px;
        }

        .ide-editor-area {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        .ide-toolbar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 6px 12px;
            border-bottom: 1px solid var(--border);
            background: var(--bg-1);
            font-size: 12px;
        }

        .ide-toolbar-actions {
            display: flex;
            gap: 6px;
        }

        .ide-breadcrumbs {
            color: var(--text-3);
        }

        .ide-btn {
            background: transparent;
            border: 1px solid var(--border);
            color: var(--text-2);
            padding: 3px 8px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 12px;
            transition: 0.2s;
        }

        .ide-btn:hover {
            border-color: var(--accent);
            color: var(--accent);
        }

        .ide-tab-bar {
            display: flex;
            background: var(--bg-1);
            border-bottom: 1px solid var(--border);
            height: 32px;
        }

        .ide-tab {
            padding: 0 14px;
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 12px;
            color: var(--text-3);
            cursor: pointer;
            border-right: 1px solid var(--border);
            transition: 0.15s;
        }

        .ide-tab.active {
            background: var(--bg-0);
            color: var(--accent);
            border-bottom: 2px solid var(--accent);
        }

        .ide-tab:hover {
            color: var(--text);
        }

        .ide-editor {
            flex: 1;
            position: relative;
            display: flex;
            overflow: hidden;
            background: var(--bg-0);
        }

        .ide-statusbar {
            height: 24px;
            background: var(--accent);
            color: var(--bg-0);
            font-size: 11px;
            font-weight: 600;
            display: flex;
            align-items: center;
            padding: 0 16px;
            justify-content: space-between;
        }

        .ide-agent-panel {
            border-top: 1px solid var(--border);
            background: var(--bg-1);
            padding: 10px 12px;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .ide-agent-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 12px;
            color: var(--text-2);
        }

        .ide-agent-tools {
            display: flex;
            gap: 4px;
            flex-wrap: wrap;
        }

        .ide-tool-btn {
            background: var(--bg-2);
            border: 1px solid var(--border);
            color: var(--text-3);
            padding: 3px 8px;
            border-radius: 4px;
            font-size: 10px;
            cursor: pointer;
            transition: 0.2s;
        }

        .ide-tool-btn:hover {
            border-color: var(--accent);
            color: var(--accent);
        }

        .ide-agent-input-row {
            display: flex;
            gap: 6px;
        }

        .ide-agent-input-row input {
            flex: 1;
            background: var(--bg-0);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 6px 10px;
            font-size: 13px;
            color: var(--text);
            outline: none;
        }

        .ide-agent-input-row input:focus {
            border-color: var(--accent);
        }

        .ide-agent-output {
            max-height: 150px;
            overflow-y: auto;
            font-size: 12px;
            color: var(--text-2);
            padding: 6px;
            background: var(--bg-0);
            border-radius: 6px;
            border: 1px solid var(--border);
        }

        /* ── LIGHTBOX OVERLAY ── */
        .obs-lightbox-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.9);
            backdrop-filter: blur(8px);
            z-index: 9999;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.25s ease-in-out;
        }

        .obs-lightbox-overlay.active {
            opacity: 1;
            pointer-events: auto;
        }

        .obs-lightbox-close {
            position: absolute;
            top: 24px;
            right: 32px;
            font-size: 40px;
            color: rgba(255, 255, 255, 0.6);
            cursor: pointer;
            line-height: 1;
            transition: color 0.15s;
            z-index: 2;
        }

        .obs-lightbox-close:hover {
            color: #fff;
        }

        .obs-lightbox-content {
            display: flex;
            width: 90%;
            max-width: 1200px;
            height: 85vh;
            background: #111;
            border-radius: 12px;
            overflow: hidden;
            border: 1px solid rgba(255,255,255,0.1);
            box-shadow: 0 24px 64px rgba(0,0,0,0.5);
            transform: scale(0.95);
            transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .obs-lightbox-overlay.active .obs-lightbox-content {
            transform: scale(1);
        }

        .obs-lightbox-media {
            flex: 1;
            background: #000;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
        }

        .obs-lightbox-media img,
        .obs-lightbox-media video {
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
        }

        .obs-lightbox-sidebar {
            width: 320px;
            background: var(--bg-1);
            border-left: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            padding: 24px;
            overflow-y: auto;
            flex-shrink: 0;
        }

        .obs-lightbox-header {
            font-size: 16px;
            font-weight: 600;
            color: var(--text);
            margin-bottom: 24px;
            border-bottom: 1px solid var(--border);
            padding-bottom: 12px;
        }

        .lb-meta-title {
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: var(--text-3);
            margin-bottom: 6px;
        }

        .lb-meta-value {
            font-size: 14px;
            color: var(--text-2);
            line-height: 1.5;
            word-break: break-word;
        }
        
        .lb-tag {
            display: inline-block;
            background: var(--accent-dim);
            color: var(--accent);
            padding: 4px 10px;
            border-radius: 999px;
            font-size: 12px;
            font-weight: 600;
            margin-top: 4px;
        }

        .obs-lightbox-actions {
            margin-top: auto;
            display: flex;
            flex-direction: column;
            gap: 12px;
            padding-top: 24px;
        }

        .lb-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            width: 100%;
            padding: 12px;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: 0.2s;
            background: var(--bg-2);
            color: var(--text);
            border: 1px solid var(--border);
        }

        .lb-btn:hover {
            background: var(--bg-3);
            border-color: var(--border-light);
        }

        .lb-btn.primary {
            background: var(--accent);
            color: #fff;
            border: none;
        }

        .lb-btn.primary:hover {
            opacity: 0.9;
        }
        
        @media (max-width: 768px) {
            .obs-lightbox-content {
                flex-direction: column;
                height: 90vh;
            }
            .obs-lightbox-sidebar {
                width: 100%;
                height: 40%;
                border-left: none;
                border-top: 1px solid var(--border);
            }
            .obs-lightbox-media {
                height: 60%;
            }
            .obs-lightbox-close {
                top: 12px;
                right: 16px;
            }
        }

body.lightbox-open {
    overflow: hidden;
}

/* ── LIGHTBOX ── */
.lightbox-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background:
        radial-gradient(circle at top left, rgba(255, 91, 125, 0.16), transparent 30%),
        radial-gradient(circle at bottom right, rgba(93, 126, 255, 0.14), transparent 32%),
        rgba(5, 7, 12, 0.92);
    backdrop-filter: blur(10px);
    z-index: 9999;
}

.lightbox-content {
    display: flex;
    flex-direction: row;
    width: min(1480px, calc(100vw - 44px));
    height: min(900px, calc(100dvh - 44px));
    max-width: none;
    background:
        linear-gradient(180deg, rgba(18, 19, 26, 0.98), rgba(10, 11, 16, 0.99));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 30px 96px rgba(0, 0, 0, 0.62);
    animation: lightboxZoom 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes lightboxZoom {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes lightboxUpscaleSpin {
    to { transform: rotate(360deg); }
}

@keyframes lightboxUpscaleProgress {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(10%); }
    100% { transform: translateX(110%); }
}

.lightbox-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(9, 10, 15, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    z-index: 50;
    transition: 0.2s;
    backdrop-filter: blur(12px);
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
    background: rgba(255, 91, 125, 0.94);
    border-color: rgba(255, 91, 125, 0.98);
    color: #0b0d12;
}

.lightbox-media-container {
    flex: 1;
    min-width: 0;
    padding: 28px;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.05), transparent 36%),
        linear-gradient(180deg, rgba(2, 4, 8, 0.94), rgba(0, 0, 0, 1));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.lightbox-media-container.is-upscaling::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(180deg, rgba(4, 6, 12, 0.12), rgba(4, 6, 12, 0.52));
    pointer-events: none;
}

.lightbox-media-container.is-upscaling::after {
    content: "Upscaling to Gallery...";
    position: absolute;
    left: 50%;
    bottom: 28px;
    z-index: 3;
    transform: translateX(-50%);
    min-width: min(320px, calc(100% - 48px));
    padding: 13px 18px;
    border-radius: 14px;
    border: 1px solid rgba(255, 91, 125, 0.38);
    background: rgba(16, 18, 25, 0.9);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(14px);
}

.lightbox-media-container.is-upscaling .lightbox-media,
.lightbox-media-container.is-upscaling img,
.lightbox-media-container.is-upscaling video {
    filter: saturate(0.9) brightness(0.72);
}

.lightbox-media {
    width: auto;
    height: auto;
}

.lightbox-media-container .lightbox-media,
.lightbox-media-container img,
.lightbox-media-container video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 18px;
    box-shadow: 0 24px 56px rgba(0, 0, 0, 0.42);
}

.lightbox-sidebar {
    width: min(392px, 32vw);
    min-width: 320px;
    background:
        linear-gradient(180deg, rgba(25, 27, 34, 0.98), rgba(15, 16, 21, 0.98));
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    padding: 28px 24px 24px;
    min-height: 0;
    gap: 16px;
    overflow-y: auto;
}

.lightbox-header {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.lightbox-model-tag {
    display: inline-block;
    padding: 7px 13px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    font-size: 12px;
    color: var(--text-2);
    font-weight: 600;
}

.lightbox-model-tag.is-base {
    border-color: rgba(96, 165, 250, 0.36);
    background: rgba(59, 130, 246, 0.16);
    color: #dbeafe;
}

.lightbox-model-tag.is-mid {
    border-color: rgba(250, 204, 21, 0.36);
    background: rgba(234, 179, 8, 0.14);
    color: #fef3c7;
}

.lightbox-model-tag.is-pro,
.lightbox-model-tag.is-cloud {
    border-color: rgba(255, 91, 125, 0.34);
    background: rgba(255, 91, 125, 0.15);
    color: #ffd7df;
}

.lightbox-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 0;
}

.lightbox-meta-item {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 12px 14px;
    min-width: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.lightbox-meta-item-full {
    grid-column: 1 / -1;
}

.lightbox-meta-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
    margin-bottom: 6px;
}

.lightbox-meta-value {
    color: var(--text);
    font-size: 13px;
    line-height: 1.45;
    word-break: break-word;
}

.lightbox-prompt-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    flex: 1 1 auto;
}

.lightbox-prompt {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    flex: 1 1 auto;
    min-height: 110px;
    overflow-y: auto;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.lightbox-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 0;
    flex-shrink: 0;
    align-items: stretch;
}

.lightbox-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    min-height: 52px;
    height: 52px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.045);
    color: var(--text);
    text-align: center;
    border-radius: 14px;
    font-weight: 600;
    font-size: 13px;
    line-height: 1.15;
    text-decoration: none;
    transition: 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

.lightbox-btn[hidden] {
    display: none !important;
}

.lightbox-btn.is-loading {
    position: relative;
    color: var(--text);
    border-color: rgba(255, 91, 125, 0.42);
    background: rgba(255, 91, 125, 0.15);
}

.lightbox-btn.is-loading::before {
    content: "";
    width: 14px;
    height: 14px;
    margin-right: 8px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.32);
    border-top-color: rgba(255, 255, 255, 0.95);
    animation: lightboxUpscaleSpin 0.8s linear infinite;
    flex: 0 0 auto;
}

.lightbox-upscale-progress {
    display: grid;
    gap: 9px;
    padding: 12px 13px;
    border-radius: 14px;
    border: 1px solid rgba(255, 91, 125, 0.26);
    background: rgba(255, 91, 125, 0.08);
    color: var(--text);
    flex-shrink: 0;
}

.lightbox-upscale-progress.is-error {
    border-color: rgba(248, 113, 113, 0.42);
    background: rgba(127, 29, 29, 0.18);
    color: #fecaca;
}

.lightbox-upscale-progress.is-success {
    border-color: rgba(74, 222, 128, 0.34);
    background: rgba(22, 101, 52, 0.18);
    color: #dcfce7;
}

.lightbox-upscale-progress.is-error .lightbox-upscale-spinner,
.lightbox-upscale-progress.is-success .lightbox-upscale-spinner {
    display: none;
}

.lightbox-upscale-progress[hidden] {
    display: none !important;
}

.lightbox-upscale-progress-row {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    font-size: 12px;
    font-weight: 800;
}

.lightbox-upscale-spinner {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.24);
    border-top-color: rgba(255, 255, 255, 0.96);
    animation: lightboxUpscaleSpin 0.8s linear infinite;
    flex: 0 0 auto;
}

.lightbox-upscale-progress-track {
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.09);
}

.lightbox-upscale-progress-track span {
    display: block;
    width: 52%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(255, 91, 125, 0), rgba(255, 91, 125, 0.95), rgba(255, 179, 94, 0.9));
    animation: lightboxUpscaleProgress 1.15s ease-in-out infinite;
}

.lightbox-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.lightbox-btn:hover,
.lightbox-btn:focus-visible {
    background: rgba(255, 91, 125, 0.9);
    color: #0b0d12;
    border-color: rgba(255, 91, 125, 0.96);
}

.lightbox-btn-danger {
    border-color: rgba(239, 68, 68, 0.34);
    background: rgba(127, 29, 29, 0.16);
    color: #fecaca;
}

.lightbox-btn-danger:hover,
.lightbox-btn-danger:focus-visible {
    background: rgba(239, 68, 68, 0.92);
    color: #140608;
    border-color: rgba(248, 113, 113, 0.96);
}

@media (max-width: 900px) {
    .obs-chat-view .topbar-actions .obs-model-picker,
    .obs-image-view .topbar-actions .obs-model-picker {
        display: none;
    }

    .mobile-composer-model-slot {
        display: block;
    }

    .input-box,
    .img-prompt-box {
        flex-wrap: wrap;
        align-items: stretch;
    }

    .input-box textarea,
    .img-prompt-box textarea {
        width: 100%;
    }

    .lightbox-content {
        width: min(100%, 760px);
        height: auto;
        max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        flex-direction: column;
        border-radius: 22px;
    }
    .lightbox-sidebar {
        width: 100%;
        min-width: 0;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
        overflow-y: auto;
        gap: 12px;
    }
    .lightbox-meta-grid {
        order: 2;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .lightbox-meta-item {
        padding: 10px 12px;
    }
    .lightbox-prompt-wrap {
        order: 3;
        flex: 0 0 auto;
        gap: 6px;
    }
    .lightbox-media-container {
        min-height: clamp(220px, 38vh, 340px);
        max-height: 44dvh;
        padding: 18px 14px 12px;
    }
    .lightbox-prompt {
        min-height: 72px;
        max-height: 160px;
        padding: 12px 14px;
    }
    .lightbox-actions {
        order: 4;
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        margin-top: 4px;
    }
    .lightbox-btn {
        width: 100%;
        justify-content: center;
        padding: 8px 12px;
        min-height: 48px;
        height: 48px;
        font-size: 12px;
    }
    .lightbox-close {
        top: 10px;
        right: 10px;
    }
}

@media (hover: none), (pointer: coarse) {
        .g-card:hover,
        .g-card:focus-visible {
            transform: none;
            box-shadow: none;
        }

        .g-favorite-btn:hover,
        .g-favorite-btn:focus-visible {
            transform: none;
            box-shadow: none;
        }
}

.ide-task-item[data-status="pending"] {
        border-color: rgba(148, 163, 184, 0.28);
        background: rgba(148, 163, 184, 0.08);
}

.ide-task-item[data-status="current"] {
        border-color: rgba(96, 165, 250, 0.34);
        background: rgba(59, 130, 246, 0.12);
}

.ide-task-item[data-status="complete"] {
        border-color: rgba(74, 222, 128, 0.32);
        background: rgba(34, 197, 94, 0.12);
}

.g-creator-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 70px;
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid rgba(255, 171, 87, 0.28);
    background: rgba(41, 25, 10, 0.82);
    color: #ffd089;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    backdrop-filter: blur(12px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

/* ===========================================================================
   V4 PILL FAMILY
   ---------------------------------------------------------------------------
   Single engraved-underline pill (Thought / Drawing / Filming / Research /
   Deep Research) with theme-driven accent vars, click-to-expand panel, and
   dynamic agent stack.  Replaces the older .swarm-panel + .skill-status-bar
   UI which has been removed.
   =========================================================================== */

/* ── Pill shell ────────────────────────────────────────────────────────── */
.pill-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}
.v4-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 3px 2px 7px;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    position: relative;
    letter-spacing: 0.005em;
    white-space: nowrap;
}
.v4-pill::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 1px;
    background: linear-gradient(
        to right,
        var(--accent-line-strong) 0%,
        var(--accent-soft-18) 70%,
        transparent 100%
    );
}
.v4-label {
    color: var(--accent-text);
    font-size: 12px;
    font-weight: 600;
}
.v4-time {
    color: var(--accent-text-soft);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
}
.v4-divider {
    color: var(--accent-line);
    font-size: 11px;
}
.v4-chev {
    width: 6px; height: 6px;
    border-right: 1.4px solid currentColor;
    border-bottom: 1.4px solid currentColor;
    transform: rotate(45deg) translate(-1px, -1px);
    opacity: 0.5;
    transition: transform 0.22s;
}
.pill-row[data-state="open"] .v4-chev {
    transform: rotate(-135deg) translate(1px, 1px);
}

/* ── Drawer entry animation (pulls out from right of V avatar) ─────────── */
.pill-drawer {
    display: inline-block;
    overflow: hidden;
    max-width: 0;
    transform: translateX(-8px);
    opacity: 0;
    transition:
        max-width 1.2s cubic-bezier(0.22, 1, 0.36, 1) 0.25s,
        transform 1.2s cubic-bezier(0.22, 1, 0.36, 1) 0.25s,
        opacity 0.35s ease-out 0.25s;
}
.pill-drawer.is-open {
    max-width: 360px;
    transform: translateX(0);
    opacity: 1;
}

/* ── Swarm icon stack ──────────────────────────────────────────────────── */
.swarm-stack {
    position: relative;
    display: inline-block;
    width: calc((var(--agent-count, 5) * 13px) + 5px);
    height: 22px;
    vertical-align: middle;
}
.agent-slot {
    position: absolute;
    top: 2px;
    width: 18px; height: 18px;
    opacity: 0;
    transform: translateY(10px);
    animation: spawn-up 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-play-state: paused;
}
/* Each slot spawns immediately on mount — natural stagger comes from server
   event arrival times, not CSS delays.  Spawn is held until the drawer is
   fully open so the drawer reveal reads cleanly. */
.pill-drawer.is-open .agent-slot { animation-play-state: running; }
.agent-slot:nth-child(1) { left: 0; }
.agent-slot:nth-child(2) { left: 13px; }
.agent-slot:nth-child(3) { left: 26px; }
.agent-slot:nth-child(4) { left: 39px; }
.agent-slot:nth-child(5) { left: 52px; }
.agent-slot:nth-child(6) { left: 65px; } /* inspector slot */
@keyframes spawn-up {
    0%   { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.agent-icon {
    width: 18px; height: 18px;
    font-size: 10.5px;
    line-height: 1;
    border-radius: 4px;
    box-shadow: 0 0 0 1.5px var(--bg-1, #181420);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--agent-chip-bg, rgba(255,255,255,0.04));
    border: 1px solid var(--agent-chip-border, rgba(255,255,255,0.09));
    animation-duration: 5.5s;
    animation-delay: 2s;     /* kick in shortly after first slots land */
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}
/* Walking dance keyframes only apply when the stack has the full 5-icon
   choreography — otherwise icons walk past the stack edge and get clipped
   by the drawer's overflow:hidden.  data-mode="swarm" gates the names. */
.swarm-stack[data-mode="swarm"] .agent-slot:nth-child(1) .agent-icon { animation-name: v4-pos-icon-1; }
.swarm-stack[data-mode="swarm"] .agent-slot:nth-child(2) .agent-icon { animation-name: v4-pos-icon-2; }
.swarm-stack[data-mode="swarm"] .agent-slot:nth-child(3) .agent-icon { animation-name: v4-pos-icon-3; }
.swarm-stack[data-mode="swarm"] .agent-slot:nth-child(4) .agent-icon { animation-name: v4-pos-icon-4; }
.swarm-stack[data-mode="swarm"] .agent-slot:nth-child(5) .agent-icon { animation-name: v4-pos-icon-5; }
.agent-slot:nth-child(6) .agent-icon { animation-name: none; }
/* "few" mode (2–4 icons) — sit still; the choreography only reads with 5. */
.swarm-stack[data-mode="few"] .agent-icon { animation: none; }

.swarm-stack[data-motion="off"] .agent-icon { animation: none; }
.swarm-stack[data-motion="off"] .agent-slot {
    opacity: 1; transform: none; animation: none;
}

/* Solo mode — only one agent in the stack.  Kill the walking dance (no one
   to swap with) and add a soft pulse ring so the single icon reads as live,
   like the skill-glyph pulse.  Reverts automatically when a 2nd slot lands. */
.swarm-stack[data-mode="solo"] .agent-icon {
    animation: agent-solo-pulse 1.8s ease-in-out infinite;
}
@keyframes agent-solo-pulse {
    0%, 100% {
        box-shadow:
            0 0 0 1.5px var(--bg-1, #181420),
            0 0 0 0 var(--accent-line),
            0 0 0 0 var(--accent-line);
    }
    50% {
        box-shadow:
            0 0 0 1.5px var(--bg-1, #181420),
            0 0 0 2px var(--accent-line-strong),
            0 0 8px 0 var(--accent-line);
    }
}
/* If the solo icon is the inspector, prefer its own ring animation — don't
   stack two glow effects on the same element. */
.swarm-stack[data-mode="solo"] .agent-icon.is-inspector {
    animation: inspector-ring-pulse 2.4s ease-in-out infinite;
}

@keyframes v4-pos-icon-1 {
    0%     { transform: translateX(0); }
    16.66% { transform: translateX(13px); }
    33.33% { transform: translateX(26px); }
    50%    { transform: translateX(39px); }
    66.66% { transform: translateX(52px); }
    83.33% { transform: translateX(52px); }
    100%   { transform: translateX(0); }
}
@keyframes v4-pos-icon-2 {
    0%     { transform: translateX(0); }
    16.66% { transform: translateX(-13px); }
    83.33% { transform: translateX(-13px); }
    100%   { transform: translateX(0); }
}
@keyframes v4-pos-icon-3 {
    0%, 16.66% { transform: translateX(0); }
    33.33%     { transform: translateX(-13px); }
    83.33%     { transform: translateX(-13px); }
    100%       { transform: translateX(0); }
}
@keyframes v4-pos-icon-4 {
    0%, 33.33% { transform: translateX(0); }
    50%        { transform: translateX(-13px); }
    83.33%     { transform: translateX(-13px); }
    100%       { transform: translateX(0); }
}
@keyframes v4-pos-icon-5 {
    0%, 50%    { transform: translateX(0); }
    66.66%     { transform: translateX(-13px); }
    83.33%     { transform: translateX(-13px); }
    100%       { transform: translateX(0); }
}

/* ── Inspector ring (only the 🔧 icon glows) ───────────────────────────── */
.agent-icon.is-inspector {
    border-color: var(--accent-line-strong);
    background: var(--accent-soft-10);
    box-shadow:
        0 0 0 1.5px var(--bg-1, #181420),
        0 0 0 2.5px var(--accent-line),
        0 0 8px 0  var(--accent-line);
    animation: inspector-ring-pulse 2.4s ease-in-out infinite;
    z-index: 10;
}
@keyframes inspector-ring-pulse {
    0%, 100% {
        box-shadow:
            0 0 0 1.5px var(--bg-1, #181420),
            0 0 0 2.5px var(--accent-line),
            0 0 6px 0  var(--accent-line);
    }
    50% {
        box-shadow:
            0 0 0 1.5px var(--bg-1, #181420),
            0 0 0 3px var(--accent-line-strong),
            0 0 12px 0 var(--accent-line-strong);
    }
}
.agent-icon.is-inspector[data-audit="done"] {
    animation: none;
    box-shadow:
        0 0 0 1.5px var(--bg-1, #181420),
        0 0 0 2px var(--accent-line);
}

/* ── Skill glyph (single icon variant for Drawing / Filming) ───────────── */
.skill-glyph {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px; height: 20px;
    font-size: 12.5px;
    line-height: 1;
    border-radius: 5px;
    background: var(--accent-soft-10);
    border: 1px solid var(--accent-line);
    box-shadow: 0 0 0 1.5px var(--bg-1, #181420);
    vertical-align: middle;
}
.skill-glyph::before {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 7px;
    border: 1px solid var(--accent-line-strong);
    opacity: 0;
    animation: skill-pulse 1.8s ease-in-out infinite;
    pointer-events: none;
}
.skill-glyph .glyph-emoji {
    display: inline-block;
    animation: skill-bob 2.2s ease-in-out infinite;
}
@keyframes skill-pulse {
    0%   { opacity: 0;   transform: scale(0.9); }
    50%  { opacity: 0.8; transform: scale(1.15); }
    100% { opacity: 0;   transform: scale(1.3); }
}
@keyframes skill-bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-1.5px); }
}
.skill-glyph[data-motion="off"]::before { display: none; }
.skill-glyph[data-motion="off"] .glyph-emoji { animation: none; }

/* ── Expanded panel (grid-row reveal trick) ────────────────────────────── */
.panel-wrap {
    display: grid;
    grid-template-rows: 1fr;
    transition:
        grid-template-rows 0.32s cubic-bezier(0.16, 1, 0.3, 1),
        margin 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    margin-top: 12px;
    margin-bottom: 20px;     /* breathing room before the response below */
    /* Thought panel is intentionally narrower than the response below it —
       the thinking section is a sidebar-style aside, not a full-width block. */
    max-width: 720px;
}
.panel-wrap[data-state="collapsed"] {
    grid-template-rows: 0fr;
    margin-top: 0;
    margin-bottom: 0;        /* collapse cleanly — no phantom gap */
}
.panel-inner {
    overflow: hidden;
    min-height: 0;
}
.prose-panel {
    padding: 8px 0 4px 14px;
    border-left: 1px solid var(--accent-line);
}
.prose-body {
    color: rgba(232, 235, 240, 0.78);  /* softer than --text — gives the "thought" feel */
    font-style: italic;
    font-size: 13.5px;
    line-height: 1.78;
}
.agent-mark {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 4px;
    padding: 1px 6px 1px 5px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 5px;
    font-style: normal;       /* chip stays upright while prose is italic */
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.02em;
    line-height: 1;
    vertical-align: 1px;
}
.agent-mark-icon { font-size: 11px; line-height: 1; }
.agent-mark.is-inspector {
    background: var(--accent-soft-10);
    border-color: var(--accent-line);
    color: var(--accent-text);
}
.internal-chat-label {
    color: var(--text-2);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    margin: 16px 0 8px;
}

/* ── Research block (queries + sources, Google Deep Research style) ────── */
.research-block {
    padding: 12px 14px;
    margin-bottom: 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--accent-soft-18);
}
.research-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.research-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 12.5px;
    font-weight: 600;
}
.research-title-icon {
    width: 14px; height: 14px;
    color: var(--accent-text);
    display: inline-flex;
}
.research-title-icon svg { width: 100%; height: 100%; }
.research-meta {
    color: var(--text-2);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
.research-progress {
    height: 2px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1px;
    overflow: hidden;
    margin-bottom: 12px;
}
.research-progress-fill {
    height: 100%;
    background: linear-gradient(to right, var(--accent-text), transparent);
    transition: width 0.4s ease-out;
}
.research-progress.live .research-progress-fill {
    background: linear-gradient(
        90deg,
        var(--accent-text) 0%,
        var(--accent-text) 30%,
        rgba(255,255,255,0.4) 50%,
        var(--accent-text) 70%,
        var(--accent-text) 100%
    );
    background-size: 200% 100%;
    animation: v4-progress-shimmer 1.8s linear infinite;
}
@keyframes v4-progress-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.query-list { margin: 0 0 12px; padding: 0; list-style: none; }
.query-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 12.5px;
    color: var(--text);
}
.query-status {
    flex: 0 0 14px;
    width: 14px; height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-text);
    position: relative;
}
.query-status.done::before {
    content: "✓"; font-size: 11px; line-height: 1;
    color: var(--accent-text); opacity: 0.75;
}
.query-status.running::before {
    content: "";
    position: absolute;
    inset: 1px;
    border: 1.5px solid rgba(255,255,255,0.15);
    border-top-color: var(--accent-text);
    border-radius: 50%;
    animation: v4-spin 0.8s linear infinite;
}
.query-status.queued::before {
    content: "•";
    color: rgba(255,255,255,0.3);
    font-size: 14px;
    line-height: 1;
}
@keyframes v4-spin { to { transform: rotate(360deg); } }
.query-text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.query-text.queued { color: var(--text-2); }
.query-count {
    flex: 0 0 auto;
    color: var(--text-2);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
.theme-group {
    margin-bottom: 10px;
    padding-left: 8px;
    border-left: 2px solid var(--accent-line);
}
.theme-label {
    color: var(--accent-text);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.sources-label {
    color: var(--text-2);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    margin: 6px 0 6px;
}
.source-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0; padding: 0;
    list-style: none;
}
.source-list.scrollable {
    max-height: 200px;
    overflow-y: auto;
    padding-right: 4px;
}
.source-list.scrollable::-webkit-scrollbar { width: 4px; }
.source-list.scrollable::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}
.source-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 7px;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.05);
    transition: background 0.15s, border-color 0.15s;
    cursor: pointer;
    text-decoration: none;
}
.source-card:hover {
    background: rgba(255,255,255,0.045);
    border-color: var(--accent-line);
}
.source-favicon {
    flex: 0 0 16px;
    width: 16px; height: 16px;
    border-radius: 3px;
    background: rgba(255,255,255,0.06);
    object-fit: contain;
}
.source-body { flex: 1; min-width: 0; }
.source-title {
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.source-domain {
    color: var(--text-2);
    font-size: 10.5px;
    line-height: 1.3;
    margin-top: 1px;
}
.source-num {
    flex: 0 0 18px;
    text-align: right;
    color: var(--text-2);
    font-size: 10.5px;
    font-variant-numeric: tabular-nums;
}

/* Mobile — wrap pill chrome instead of overflowing the bubble */
@media (max-width: 400px) {
    .v4-pill { flex-wrap: wrap; row-gap: 4px; }
}

/* ════════════════════════════════════════════════════════════════════════
   Phase L — In-chat attachment viewer
   Chips/thumbnails rendered by buildAttachmentPreviewHtml become clickable
   (.attach-viewable) and open a full-screen lightbox.
   ════════════════════════════════════════════════════════════════════════ */

/* Clickable affordance on the existing chips inside chat bubbles. */
.attach-viewable { cursor: pointer; transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease; }
.attach-viewable:hover { transform: translateY(-1px); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-glow, rgba(120,160,255,0.25)); }
.attach-thumb.attach-viewable:hover img { filter: brightness(1.05); }

/* ── Lightbox overlay ──────────────────────────────────────────────────── */
.attach-lightbox {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
}
.attach-lightbox[hidden] { display: none; }
.attach-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(3px);
}
.attach-lightbox-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    max-width: min(1100px, 94vw);
    max-height: 90vh;
    width: auto;
    background: var(--bg, #14161c);
    border: 1px solid var(--border-bright, var(--border, #2a2e38));
    border-radius: 14px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    animation: attach-lb-in 0.14s ease;
}
@keyframes attach-lb-in {
    from { opacity: 0; transform: translateY(8px) scale(0.99); }
    to   { opacity: 1; transform: none; }
}
.attach-lightbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border, #2a2e38);
    flex: 0 0 auto;
}
.attach-lightbox-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text, #e8eaf0);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.attach-lightbox-tools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.attach-lb-zoom {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--border, #2a2e38);
    border-radius: 8px;
}
.attach-lb-zoom[hidden] { display: none; }
.attach-lb-zbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--text-dim, #aab);
    cursor: pointer;
}
.attach-lb-zbtn:hover { color: var(--text, #fff); background: var(--bg-hover, rgba(255, 255, 255, 0.06)); }
.attach-lb-zbtn svg { width: 17px; height: 17px; fill: currentColor; }
.attach-lb-zoom-level {
    min-width: 46px;
    padding: 0 4px;
    background: transparent;
    border: 0;
    color: var(--text-dim, #aab);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-align: center;
    cursor: pointer;
}
.attach-lb-zoom-level:hover { color: var(--accent, #8aa6ff); }
.attach-lb-pdfbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--border, #2a2e38);
    border-radius: 8px;
}
.attach-lb-pdfbar[hidden] { display: none; }
.attach-lb-page-input {
    width: 38px;
    height: 24px;
    padding: 0 4px;
    background: var(--bg-soft, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--border, #2a2e38);
    border-radius: 6px;
    color: var(--text, #fff);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-align: center;
}
.attach-lb-page-input:focus { outline: none; border-color: var(--accent, #8aa6ff); }
.attach-lb-page-total {
    min-width: 30px;
    padding: 0 4px 0 2px;
    color: var(--text-dim, #aab);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.attach-lb-zbtn:disabled { opacity: 0.35; cursor: default; }
.attach-lb-zbtn:disabled:hover { background: transparent; color: var(--text-dim, #aab); }
.attach-lb-pdf-layout svg { fill: none; }
.attach-lightbox-download {
    font-size: 12px;
    color: var(--text-dim, #aab);
    text-decoration: none;
    padding: 5px 10px;
    border: 1px solid var(--border, #2a2e38);
    border-radius: 7px;
}
.attach-lightbox-download:hover { color: var(--accent, #8aa6ff); border-color: var(--accent, #8aa6ff); }
.attach-lightbox-download[hidden] { display: none; }
.attach-lightbox-close {
    background: transparent;
    border: 1px solid var(--border, #2a2e38);
    color: var(--text-dim, #aab);
    width: 30px;
    height: 30px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}
.attach-lightbox-close:hover { color: var(--text, #fff); border-color: var(--accent, #8aa6ff); }
.attach-lightbox-body {
    flex: 1 1 auto;
    overflow: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ── Body renderers ────────────────────────────────────────────────────── */
.attach-lb-loading, .attach-lb-error {
    margin: auto;
    color: var(--text-dim, #aab);
    font-size: 13px;
    padding: 40px;
}
.attach-lb-error { color: #ff8585; }
.attach-lb-img {
    max-width: 100%;
    max-height: 78vh;
    margin: auto;
    object-fit: contain;
    border-radius: 8px;
}
.attach-lb-video { max-width: 100%; max-height: 78vh; margin: auto; border-radius: 8px; background: #000; }
.attach-lb-audio-wrap {
    margin: auto;
    text-align: center;
    padding: 26px 30px 30px;
    width: min(520px, 86vw);
}
.attach-lb-audio-art {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: var(--accent-glow, rgba(120, 140, 255, 0.16));
    border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
}
.attach-lb-audio-art svg { width: 34px; height: 34px; fill: var(--accent, #7c9cff); }
.attach-lb-audio-name { color: var(--text, #e8eaf0); margin-bottom: 18px; font-size: 14px; font-weight: 600; word-break: break-word; }
.attach-lb-audio { display: none; }

/* Custom themed audio transport */
.vox-aplayer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--bg, #14161c);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
}
.vox-aplayer-btn {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    background: transparent;
    color: var(--text, #e8eaf0);
    transition: background 0.15s ease, color 0.15s ease, filter 0.15s ease;
}
.vox-aplayer-btn svg { width: 20px; height: 20px; fill: currentColor; }
.vox-aplayer-btn:hover { background: var(--accent-glow, rgba(120, 140, 255, 0.16)); color: var(--accent, #7c9cff); }
.vox-aplayer-play { background: var(--accent, #7c9cff); color: #0b0d12; }
.vox-aplayer-play:hover { filter: brightness(1.1); background: var(--accent, #7c9cff); color: #0b0d12; }
.vox-aplayer-mute { width: 32px; height: 32px; }
.vox-aplayer-time {
    flex: 0 0 auto;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--text-dim, #aab);
    min-width: 34px;
    text-align: center;
}
.vox-aplayer input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 5px;
    border-radius: 999px;
    cursor: pointer;
    background: linear-gradient(
        to right,
        var(--accent, #7c9cff) 0%,
        var(--accent, #7c9cff) var(--vox-range-pct, 0%),
        var(--border-bright, rgba(255, 255, 255, 0.22)) var(--vox-range-pct, 0%),
        var(--border-bright, rgba(255, 255, 255, 0.22)) 100%
    );
}
.vox-aplayer-seek { flex: 1 1 auto; min-width: 60px; }
.vox-aplayer-vol { flex: 0 0 72px; }
.vox-aplayer input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--accent, #7c9cff);
    border: 2px solid var(--bg, #14161c);
    box-shadow: 0 0 0 1px var(--accent, #7c9cff);
}
.vox-aplayer input[type="range"]::-moz-range-thumb {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--accent, #7c9cff);
    border: 2px solid var(--bg, #14161c);
}
.vox-aplayer input[type="range"]::-moz-range-track { background: transparent; }
.attach-lb-pdf { width: 100%; height: 78vh; border: 0; border-radius: 8px; background: #fff; }
.attach-lb-pdf-pages {
    /* max-content + min-width:100% keeps pages centered at fit-zoom, yet lets
       the container grow with zoomed pages so the body scroller can reach the
       left edge (plain align-items:center clips the overflow side). */
    width: max-content;
    min-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 4px;
}
.attach-lb-pdf-pages.is-single {
    justify-content: flex-start;
}
.attach-lb-pdf-slot {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    border-radius: 6px;
    background: #f3f3f3;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}
.attach-lb-pdf-page {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    background: #fff;
}
.attach-lb-caption { color: var(--text-dim, #aab); font-size: 12px; margin-bottom: 10px; }
.attach-lb-pdf-err {
    color: var(--danger, #e06c75);
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 11px;
    max-width: 480px;
    word-break: break-word;
    margin: 6px auto 12px;
}

.attach-lb-code {
    margin: 0;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border, #2a2e38);
    border-radius: 8px;
    overflow: auto;
    max-height: 78vh;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--text, #e8eaf0);
    white-space: pre;
}

/* Sheet tables */
.attach-lb-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.attach-lb-tab {
    background: transparent;
    border: 1px solid var(--border, #2a2e38);
    color: var(--text-dim, #aab);
    padding: 5px 11px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12px;
}
.attach-lb-tab.is-active { color: var(--text, #fff); border-color: var(--accent, #8aa6ff); background: var(--accent-glow, rgba(120,160,255,0.12)); }
.attach-lb-table-scroll { overflow: auto; max-height: 74vh; border: 1px solid var(--border, #2a2e38); border-radius: 8px; }
.attach-lb-table { border-collapse: collapse; font-size: 12.5px; width: max-content; min-width: 100%; }
.attach-lb-table th, .attach-lb-table td {
    border: 1px solid var(--border, #2a2e38);
    padding: 6px 10px;
    text-align: left;
    color: var(--text, #e8eaf0);
    white-space: nowrap;
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.attach-lb-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg, #14161c);
    font-weight: 600;
    z-index: 1;
}
.attach-lb-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.02); }

/* Doc (docx) */
.attach-lb-doc {
    max-width: 760px;
    margin: 0 auto;
    color: var(--text, #e8eaf0);
    font-size: 14px;
    line-height: 1.7;
}
.attach-lb-doc h2 { font-size: 1.4em; margin: 1em 0 0.4em; }
.attach-lb-doc h3 { font-size: 1.15em; margin: 0.9em 0 0.35em; }
.attach-lb-doc p { margin: 0 0 0.7em; }
.attach-lb-doc ul { margin: 0 0 0.7em 1.2em; }
.attach-lb-doc table { border-collapse: collapse; margin: 0.6em 0; }
.attach-lb-doc td { border: 1px solid var(--border, #2a2e38); padding: 5px 9px; }

/* Generic file fallback */
.attach-lb-file { margin: auto; text-align: center; padding: 40px; }
.attach-lb-file-name { color: var(--text, #e8eaf0); font-size: 15px; margin-bottom: 10px; }
.attach-lb-file-dl {
    display: inline-block;
    margin-top: 8px;
    color: var(--accent, #8aa6ff);
    border: 1px solid var(--accent, #8aa6ff);
    padding: 7px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
}

body.attach-lightbox-open { overflow: hidden; }

/* ── Link previews in chat (Phase L.5) ─────────────────────────────────── */
.vox-link-card {
    display: flex;
    gap: 12px;
    margin: 10px 0;
    border: 1px solid var(--border, #2a2e38);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
    text-decoration: none;
    max-width: 520px;
    transition: border-color 0.12s ease;
}
.vox-link-card:hover { border-color: var(--accent, #8aa6ff); }
.vox-link-card-thumb { width: 120px; flex: 0 0 120px; object-fit: cover; background: #000; }
.vox-link-card-body { padding: 10px 12px; min-width: 0; }
.vox-link-card-title { color: var(--text, #e8eaf0); font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.vox-link-card-desc { color: var(--text-dim, #aab); font-size: 12px; line-height: 1.5; max-height: 3em; overflow: hidden; }
.vox-link-card-site { color: var(--text-dim, #889); font-size: 11px; margin-top: 6px; }
.vox-embed {
    position: relative;
    margin: 10px 0;
    max-width: 560px;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
}
.vox-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vox-embed-media { margin: 10px 0; max-width: 560px; }
.vox-embed-media img, .vox-embed-media video { max-width: 100%; border-radius: 10px; display: block; }
.vox-embed-media audio { width: 100%; }
