:root {
    --bg-primary: #f7f7f8;
    --bg-secondary: #ffffff;
    --bg-sidebar: #f9fafb;
    --bg-input: #ffffff;
    --bg-hover: #f3f4f6;
    --bg-active: #eff6ff;
    --border-color: #e5e7eb;
    --border-light: #f0f0f0;
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #dbeafe;
    --danger: #dc2626;
    --success: #10b981;
    --thinking-color: #f59e0b;
    --search-color: #10b981;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: 0.2s ease;
}

.app-container {
    display: flex;
    height: 100vh;
    background-color: var(--bg-primary);
}

.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.03) 0%, transparent 100%);
}

.logo {
    display: block;
    flex: 1;
    text-decoration: none;
}

.logo-img {
    width: 220px;
    height: auto;
    max-height: 50px;
    object-fit: contain;
    margin: 0 auto;
    display: block;
}

.toggle-sidebar {
    font-size: 20px;
    color: var(--text-secondary);
    display: none;
}

.apikey-section {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.key-config-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.key-config-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.03) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.key-config-btn:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.1), 0 0 0 3px rgba(37, 99, 235, 0.06);
    transform: translateY(-1px);
}

.key-config-btn:hover::before {
    opacity: 1;
}

.key-config-btn:active {
    transform: translateY(0);
}

.key-config-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent-light) 0%, rgba(37, 99, 235, 0.08) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.key-config-btn:hover .key-config-icon {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.key-config-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.key-config-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.key-config-btn:hover .key-config-title {
    color: var(--accent);
}

.key-config-status {
    font-size: 11px;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.key-config-btn:hover .key-config-status {
    color: var(--text-secondary);
}

.key-config-arrow {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.key-config-btn:hover .key-config-arrow {
    color: var(--accent);
    transform: translateX(2px);
}

.key-config-btn.has-key {
    border-color: rgba(16, 185, 129, 0.3);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.03) 0%, var(--bg-secondary) 100%);
}

.key-config-btn.has-key .key-config-icon {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
    color: var(--success);
}

.key-config-btn.has-key:hover .key-config-icon {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.key-config-btn.has-key:hover {
    border-color: var(--success);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.1), 0 0 0 3px rgba(16, 185, 129, 0.06);
}

.model-tabs {
    padding: 10px 12px;
    display: flex;
    gap: 4px;
    background: var(--bg-sidebar);
}

.tab-item {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background-color: transparent;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    border: none;
    flex: 1;
    text-align: center;
}

.tab-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.tab-item.active {
    background-color: var(--accent);
    color: white;
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.3);
}

.model-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    min-height: 0;
}

.model-list::-webkit-scrollbar {
    width: 4px;
}

.model-list::-webkit-scrollbar-track {
    background: transparent;
}

.model-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.model-list::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.model-list {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}

.model-item {
    padding: 10px 8px 10px 12px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
    background-color: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.model-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 60%;
    border-radius: 0 3px 3px 0;
    background: #2563eb;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.model-item:hover {
    background-color: var(--bg-hover);
}

.model-item:hover::before {
    transform: translateY(-50%) scaleY(1);
}

.model-item.active {
    background-color: var(--accent-light);
    border-color: transparent;
}

.model-item.active::before {
    transform: translateY(-50%) scaleY(1);
    background: var(--accent);
}

.model-icon-small {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
}

.model-item:hover .model-icon-small {
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.model-item.active .model-icon-small {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.model-icon-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.model-info {
    flex: 1;
    min-width: 0;
}

.model-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-desc {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-badge {
    font-size: 9px;
    padding: 2px 7px;
    border-radius: 10px;
    flex-shrink: 0;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    line-height: 1;
    white-space: nowrap;
}

.badge-icon {
    flex-shrink: 0;
}

.badge-fire {
    animation: fireFlicker 0.8s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 2px rgba(255, 100, 0, 0.6));
}

/* HOT - 靝劙姗欑孩 */
.badge-hot {
    background: linear-gradient(135deg, #ff4d4f, #ff7a45);
    color: #fff;
    box-shadow: 0 0 8px rgba(255, 77, 79, 0.4);
    animation: hotPulse 2s ease-in-out infinite;
}

/* NEW - 靄熸槦钃濈传 */
.badge-new {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #fff;
    box-shadow: 0 0 6px rgba(99, 102, 241, 0.35);
}

/* PICK - 鎺ㄨ崘閲戣壊 */
.badge-pick {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: #fff;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.35);
}

@keyframes fireFlicker {
    0% {
        transform: scale(1) rotate(0deg);
        filter: drop-shadow(0 0 2px rgba(255, 100, 0, 0.6));
    }

    25% {
        transform: scale(1.1) rotate(-3deg);
        filter: drop-shadow(0 0 4px rgba(255, 80, 0, 0.8));
    }

    50% {
        transform: scale(0.95) rotate(2deg);
        filter: drop-shadow(0 0 3px rgba(255, 120, 0, 0.7));
    }

    75% {
        transform: scale(1.05) rotate(-1deg);
        filter: drop-shadow(0 0 5px rgba(255, 60, 0, 0.9));
    }

    100% {
        transform: scale(1.1) rotate(3deg);
        filter: drop-shadow(0 0 4px rgba(255, 90, 0, 0.8));
    }

}

@keyframes hotPulse {
    0%, 100% {
        box-shadow: 0 0 6px rgba(255, 77, 79, 0.4);
    }

    50% {
        box-shadow: 0 0 12px rgba(255, 77, 79, 0.6);
    }

}

.model-caps {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    margin-top: 3px;
}

.cap-tag {
    font-size: 9px;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.4;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    background: linear-gradient(180deg, transparent 0%, rgba(37, 99, 235, 0.02) 100%);
}

/* ===== Sidebar Conversation List ===== */
.conv-section {
    border-top: 1px solid var(--border-color);
    max-height: 40vh;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.conv-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 6px;
}

.conv-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.conv-new-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.conv-new-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.conv-list {
    overflow-y: auto;
    padding: 4px 8px 8px;
    flex: 1;
}

.conv-list::-webkit-scrollbar {
    width: 3px;
}

.conv-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.conv-list {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}

.conv-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    gap: 8px;
    position: relative;
}

.conv-item:hover {
    background: var(--bg-hover);
}

.conv-item.active {
    background: var(--accent-light);
}

.conv-item-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.conv-item.active .conv-item-icon {
    color: var(--accent);
}

.conv-item-info {
    flex: 1;
    min-width: 0;
}

.conv-item-title {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.conv-item.active .conv-item-title {
    color: var(--accent);
    font-weight: 500;
}

.conv-item-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}

.conv-item-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 3px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all var(--transition);
    flex-shrink: 0;
}

.conv-item:hover .conv-item-delete {
    opacity: 1;
}

.conv-item-delete:hover {
    color: #ef4444;
    background: #fef2f2;
}

.conv-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #1e293b;
    color: #f1f5f9;
    border-radius: var(--radius-sm);
    font-size: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    pointer-events: auto;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 360px;
}

.toast.toast-out {
    animation: toastOut 0.25s ease forwards;
}

.toast-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.toast.success .toast-icon { color: #10b981; }
.toast.error .toast-icon { color: #ef4444; }
.toast.warning .toast-icon { color: #f59e0b; }
.toast.info .toast-icon { color: #3b82f6; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

/* ===== Confirm Modal ===== */
.confirm-modal {
    z-index: 2000 !important;
}

.confirm-modal-content {
    max-width: 420px;
    width: 90%;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 8px 24px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    z-index: 2001;
    animation: confirmModalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes confirmModalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.confirm-header {
    padding: 32px 32px 0;
    text-align: center;
}

.confirm-icon {
    margin: 0 auto 20px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f59e0b;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.2);
    animation: confirmIconIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.confirm-modal.danger .confirm-icon {
    color: #ef4444;
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.2);
}

@keyframes confirmIconIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.confirm-header h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    animation: confirmFadeIn 0.3s ease 0.15s both;
}

.confirm-body {
    padding: 0 32px 24px;
    text-align: center;
    animation: confirmFadeIn 0.3s ease 0.2s both;
}

.confirm-body p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.confirm-footer {
    display: flex;
    gap: 12px;
    padding: 0 32px 32px;
    animation: confirmFadeIn 0.3s ease 0.25s both;
}

@keyframes confirmFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.confirm-btn-cancel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.confirm-btn-cancel:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
    transform: translateY(-1px);
}

.confirm-btn-ok {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    border: none;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.confirm-btn-ok:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
}

.confirm-modal.danger .confirm-btn-ok {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.confirm-modal.danger .confirm-btn-ok:hover {
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35);
}

/* ===== Model Switch Transition ===== */
.content-area.fade-out {
    opacity: 0;
    transition: opacity 0.12s ease;
}

.content-area.fade-in {
    opacity: 1;
    transition: opacity 0.2s ease;
}

/* ===== Code Block Collapse ===== */
.code-block.collapsed pre {
    max-height: 300px;
    overflow: hidden;
    position: relative;
}

.code-block.collapsed pre::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(transparent, #1e293b);
    pointer-events: none;
}

.code-expand-btn {
    width: 100%;
    padding: 8px;
    background: #334155;
    color: #94a3b8;
    border: none;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: none;
}

.code-block.collapsed .code-expand-btn,
.code-block.expanded .code-expand-btn {
    display: block;
}

.code-expand-btn:hover {
    background: #475569;
    color: #f1f5f9;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    overflow: hidden;
    min-width: 0;
}

.toolbar {
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-secondary);
    position: relative;
}

.toolbar::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-light), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.toolbar:hover::after {
    opacity: 1;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.model-selector-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.current-model-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.current-model-type {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background-color: var(--bg-hover);
    color: var(--text-secondary);
    flex-shrink: 0;
    font-weight: 500;
}

.toolbar-right {
    display: flex;
    gap: 4px;
}

.toolbar-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--text-secondary);
}

.toolbar-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.toolbar-btn:active {
    transform: scale(0.92);
}

.mobile-menu-btn {
    display: none;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    position: relative;
    scroll-behavior: smooth;
}

.content-area::-webkit-scrollbar {
    width: 6px;
}

.content-area::-webkit-scrollbar-track {
    background: transparent;
}

.content-area::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 6px;
}

.content-area::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.content-area {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}

.welcome-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-primary);
}

.welcome-content {
    text-align: center;
    max-width: 520px;
    padding: 40px;
    animation: welcomeFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes welcomeFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.welcome-logo-img {
    width: 160px;
    height: auto;
    margin-bottom: 20px;
    border-radius: var(--radius-lg);
    filter: drop-shadow(0 4px 12px rgba(37, 99, 235, 0.15));
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.welcome-content > p {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 28px;
}

.welcome-desc {
    font-size: 15px !important;
    color: var(--text-secondary) !important;
    margin-bottom: 32px !important;
    line-height: 1.7;
}

.welcome-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.welcome-feature-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: left;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: default;
}

.welcome-feature-item:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08), 0 0 0 1px rgba(37, 99, 235, 0.06);
    transform: translateY(-1px);
}

.feature-icon {
    font-size: 24px;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--accent-light);
}

.welcome-feature-item h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.welcome-feature-item p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.welcome-icon {
    font-size: 56px;
    margin-bottom: 20px;
}

.welcome-content h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.quick-tips {
    display: grid;
    gap: 10px;
    text-align: left;
}

.tip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.tip-icon {
    font-size: 18px;
}

.tip span:last-child {
    color: var(--text-primary);
    font-size: 14px;
}

.messages-container {
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.model-info-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 60vh;
    padding: 40px 24px;
    animation: msgFadeIn 0.3s ease;
}

.model-info-content {
    text-align: center;
    max-width: 400px;
}

.model-info-icon {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    border: 2px solid var(--border-color);
    background: white;
    padding: 8px;
}

.model-info-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.model-info-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.model-info-caps {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.model-info-cap {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.message {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    transition: background-color 0.15s;
    animation: msgFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    flex-direction: row-reverse;
}

.message.user .message-body {
    align-items: flex-end;
}

.message.editing .message-body {
    opacity: 0.5;
}

.message.editing .message-content {
    text-decoration: line-through;
    text-decoration-color: rgba(0,0,0,0.2);
}

.message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 2px;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 13px;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.message.assistant .message-avatar {
    background-color: white;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.msg-avatar-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.message-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.message-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.message-img {
    max-width: 200px;
    max-height: 200px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    border: 1px solid var(--border-color);
}

.message-img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.message-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.message-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.message-file-icon {
    width: 32px;
    height: 32px;
    background: var(--accent-light);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.message-file-name {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.message-content {
    padding: 4px 0;
    line-height: 1.7;
    font-size: 14px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    color: var(--text-primary);
}

.message.user .message-content {
    text-align: right;
}

/* === Message Timestamp === */
.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}
.message:hover .message-time {
    opacity: 1;
}
.message.user .message-time {
    text-align: right;
}
@media (hover: none) {
    .message-time { opacity: 0.7; }
    .conv-item-delete { opacity: 0.6; }
    .history-item-delete { opacity: 0.6; }
}

/* === User Message Bubble === */
.message.user .message-body {
    align-items: flex-end;
}
.message.user .message-content {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    padding: 10px 16px;
    border-radius: 18px 18px 4px 18px;
    display: inline-block;
    text-align: left;
    max-width: 100%;
}
.message.user .message-images + .message-content,
.message.user .message-files + .message-content {
    margin-top: 6px;
}

/* === Thinking Dots Animation === */
.thinking-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
}
.thinking-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: thinkingBounce 1.4s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.16s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes thinkingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

.message-content h2 { font-size: 18px; font-weight: 700; margin: 12px 0 6px; }

.message-content h3 { font-size: 16px; font-weight: 700; margin: 10px 0 5px; }

.message-content h4 { font-size: 15px; font-weight: 600; margin: 8px 0 4px; }

.message-content strong { font-weight: 700; }

.message-content em { font-style: italic; }

.message-content a { color: var(--accent); text-decoration: underline; }

.message-content ul { padding-left: 20px; margin: 4px 0; }

.message-content li { margin: 2px 0; }

.message-content .inline-code {
    background: #f1f5f9;
    padding: 1px 5px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    color: #e11d48;
}

.thinking-section {
    margin-bottom: 8px;
    border: 1px solid #fde68a;
    border-radius: var(--radius-sm);
    background: #fffbeb;
    overflow: hidden;
}

.thinking-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    color: var(--thinking-color);
    font-weight: 600;
    transition: background var(--transition);
}

.thinking-header:hover {
    background: #fef3c7;
}

.thinking-icon {
    font-size: 14px;
}

.thinking-toggle {
    margin-left: auto;
    font-size: 10px;
    transition: transform var(--transition);
}

.thinking-section.expanded .thinking-toggle {
    transform: rotate(180deg);
}

.thinking-content {
    padding: 0 12px 10px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    display: none;
    max-height: 300px;
    overflow-y: auto;
}

.thinking-section.expanded .thinking-content {
    display: block;
}

.search-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    margin-bottom: 8px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--search-color);
    font-weight: 500;
}

.search-indicator svg {
    flex-shrink: 0;
}

.message-actions {
    display: flex;
    gap: 2px;
    margin-top: 6px;
    opacity: 0;
    transition: opacity 0.15s;
}

.message:hover .message-actions {
    opacity: 1;
}

.message-actions.user-actions {
    justify-content: flex-end;
}

/* 视频生成进度条 - 现代浅色设计 */
.video-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
    color: #475569;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
        transform: scale(1);
    }
    50% {
        box-shadow: 0 4px 16px rgba(99, 102, 241, 0.12), 0 0 0 1px rgba(99, 102, 241, 0.1) inset;
        transform: scale(1.01);
    }
}

.video-result {
    padding: 8px 0;
}

.video-result video {
    width: 100%;
    max-width: 640px;
    border-radius: var(--radius-md);
    background: #f8fafc;
}

.download-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--accent);
    color: white;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s;
}

.download-link:hover {
    background: var(--accent-hover);
}

.error-message {
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    color: #dc2626;
    font-size: 14px;
}

.msg-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.msg-action-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.msg-action-btn svg {
    width: 14px;
    height: 14px;
}

.img-edit-btn {
    color: #8b5cf6 !important;
}

.img-edit-btn:hover {
    color: #7c3aed !important;
    background: #f3f0ff !important;
}

.code-block {
    margin: 8px 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #1e293b;
    border: 1px solid #334155;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: #334155;
}

.code-lang {
    color: #94a3b8;
    font-size: 12px;
    font-family: 'Consolas', 'Monaco', monospace;
}

.code-copy-btn {
    background: none;
    border: 1px solid #64748b;
    color: #94a3b8;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.code-copy-btn:hover {
    background: #475569;
    color: #f1f5f9;
}

.code-block pre {
    margin: 0;
    padding: 12px;
    overflow-x: auto;
}

.code-block code {
    color: #e2e8f0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.5;
}

.images-container {
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.image-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    animation: msgFadeIn 0.3s ease;
}

.image-card img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
}

.image-card-info {
    padding: 12px 16px;
}

.image-prompt {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.image-actions {
    display: flex;
    gap: 8px;
}

.image-action-btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    background-color: var(--bg-hover);
    color: var(--text-primary);
    transition: all var(--transition);
}

.image-action-btn:hover {
    background-color: var(--border-color);
}

.input-area {
    padding: 0 24px 20px;
    background-color: var(--bg-primary);
}

.input-container {
    max-width: 800px;
    margin: 0 auto;
}

.preview-area {
    display: none;
    margin-bottom: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    border: 1px solid var(--border-color);
    border-bottom: none;
}

.preview-area:empty {
    display: none;
}

.preview-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: var(--bg-hover);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-primary);
}

.preview-item img {
    max-height: 48px;
    border-radius: 4px;
}

.preview-item .img-ref {
    background: var(--accent);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.preview-item .img-ref:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.preview-item .preview-name {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-item .file-icon {
    width: 32px;
    height: 32px;
    background: var(--accent-light);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 14px;
    font-weight: 700;
}

.preview-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid white;
    line-height: 1;
}

.chat-input-box {
    background: var(--bg-input);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.img-ref-autocomplete {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10000;
}

.img-ref-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background var(--transition);
}

.img-ref-item:hover {
    background: var(--bg-hover);
}

.img-ref-item img {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
}

.img-ref-item .img-ref-name {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
}

.img-ref-item .img-ref-tag {
    background: var(--accent);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.drag-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(37, 99, 235, 0.08);
    border: 2px dashed var(--accent);
    border-radius: var(--radius-lg);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.drag-overlay.active {
    display: flex;
}

.drag-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 500;
}

.chat-input-box.dragging {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.voice-btn-active {
    color: #dc2626 !important;
    animation: voicePulse 1.5s ease-in-out infinite;
}

@keyframes voicePulse {
    0%, 100% { opacity: 1; }

    50% { opacity: 0.5; }

}

.chat-input-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1), 0 2px 8px rgba(37, 99, 235, 0.08);
}

.chat-input-box textarea {
    width: 100%;
    padding: 14px 16px 4px;
    border: none;
    resize: none;
    font-size: 15px;
    line-height: 1.5;
    max-height: 200px;
    min-height: 24px;
    background: transparent;
    color: var(--text-primary);
}

.chat-input-box textarea:focus {
    outline: none;
}

.chat-input-box textarea::placeholder {
    color: var(--text-muted);
}

.input-hint {
    font-size: 11px;
    color: var(--text-muted);
    padding: 0 12px 4px;
    opacity: 0.6;
    transition: opacity var(--transition);
}

.chat-input-box:focus-within .input-hint {
    opacity: 1;
}

.input-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px 8px;
}

.input-toolbar-left {
    display: flex;
    align-items: center;
    gap: 2px;
}

.input-toolbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tool-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
}

.tool-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.toggle-tool {
    border: 1px solid var(--border-color);
    background: transparent;
}

.toggle-tool:hover {
    background-color: var(--bg-hover);
}

.toggle-tool.active {
    background-color: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

.toggle-tool.active.web-search {
    background-color: #ecfdf5;
    color: var(--search-color);
    border-color: var(--search-color);
}

.toggle-tool.active.thinking-mode {
    background-color: #fffbeb;
    color: var(--thinking-color);
    border-color: var(--thinking-color);
}

.send-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.send-btn:hover:not(:disabled) {
    background-color: var(--accent-hover);
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.send-btn:disabled {
    background-color: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
}

.stop-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: var(--danger);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.stop-btn:hover {
    background-color: #b91c1c;
}

.image-options-popup {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    min-width: 140px;
    max-height: 280px;
    overflow-y: auto;
    animation: popupFadeIn 0.15s ease;
}

@keyframes popupFadeIn {
    from { opacity: 0; transform: translateY(4px); }

    to { opacity: 1; transform: translateY(0); }

}

.image-option-item {
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.image-option-item:hover {
    background-color: var(--bg-hover);
}

.image-option-item.active {
    color: var(--accent);
    background-color: var(--accent-light);
    font-weight: 500;
}

.image-result-card {
    border-radius: var(--radius-md);
    overflow: hidden;
    display: inline-block;
    max-width: 768px;
}

/* 视频结果卡片 - 现代浅色设计 */
.video-result-card {
    border-radius: 16px;
    overflow: hidden;
    display: inline-block;
    max-width: 100%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
}

.video-wrapper {
    position: relative;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    background: #f8fafc;
    aspect-ratio: 16/9;
    max-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #f8fafc;
}

/* 播放按钮覆盖层 */
.video-play-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(248, 250, 252, 0.6);
    backdrop-filter: blur(2px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}
.video-wrapper:hover .video-play-overlay {
    background: rgba(248, 250, 252, 0.4);
}
.video-play-overlay.is-playing {
    opacity: 0;
    pointer-events: none;
}
.video-play-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(226, 232, 240, 0.8);
}
.video-wrapper:hover .video-play-btn {
    transform: scale(1.08);
    box-shadow: 0 8px 28px rgba(99, 102, 241, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.9) inset;
    border-color: rgba(167, 139, 250, 0.5);
}
.video-play-btn svg {
    margin-left: 3px;
    color: #6366f1;
}

/* 加载遮罩 */
.video-loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(248, 250, 252, 0.8);
    backdrop-filter: blur(4px);
    border-radius: 16px 16px 0 0;
    z-index: 3;
}
.video-loading-overlay .video-loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid #e2e8f0;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* 视频操作按钮区域 - 现代浅色设计 */
.video-card-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 12px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}
.video-card-actions .video-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}
.video-card-actions .video-action-btn:hover {
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    color: #6366f1;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}
.video-card-actions .video-action-btn svg {
    flex-shrink: 0;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.video-card-actions .video-action-btn:hover svg {
    transform: scale(1.1);
}
.video-card-actions .video-action-spacer {
    flex: 1;
}

.video-thumbnail {
    max-width: 100%;
    max-height: 420px;
    display: block;
    object-fit: contain;
    transition: opacity 0.2s;
}

.video-wrapper:hover .video-thumbnail {
    opacity: 0.85;
}

.video-placeholder {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: rgba(255, 255, 255, 0.3);
}

.video-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-lightbox .lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
}

.video-lightbox .lightbox-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-lightbox .lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.video-lightbox .lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.video-lightbox .lightbox-download {
    position: absolute;
    top: -40px;
    right: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.video-lightbox .lightbox-download:hover {
    background: rgba(255, 255, 255, 0.2);
}

.video-progress {
    padding: 16px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    color: #475569;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(255, 255, 255, 0.9) inset;
    max-width: 480px;
}
.video-progress-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.video-progress-icon svg {
    color: #7c3aed;
}
.video-progress-body {
    flex: 1;
    min-width: 0;
}
.video-progress-text {
    font-weight: 500;
    font-size: 13px;
    color: #334155;
}
.video-progress-bar-track {
    height: 4px;
    border-radius: 2px;
    background: #e2e8f0;
    margin-top: 8px;
    overflow: hidden;
}
.video-progress-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

.extend-video-modal .modal-content {
    max-width: 480px;
    padding: 24px;
}

.extend-video-modal h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: var(--text-primary);
}

.extend-video-tip {
    margin: 0 0 16px 0;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-hover);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
}

.extend-video-form .form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

.extend-video-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.extend-video-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.extend-video-form label {
    font-size: 14px;
    color: var(--text-secondary);
}

.extend-video-form textarea,
.extend-video-form input {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    resize: none;
    transition: border-color 0.2s;
}

.extend-video-form textarea:focus,
.extend-video-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.extend-video-form input[type="number"] {
    width: 120px;
}

.extend-video-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.btn-secondary {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

#deleteVideoModal.confirm-modal .confirm-icon {
    color: #ef4444;
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.2);
}

#deleteVideoModal.confirm-modal .confirm-btn-ok {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

#deleteVideoModal.confirm-modal .confirm-btn-ok:hover {
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35);
}

.image-result-img {
    max-width: 100%;
    max-height: 768px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.4s ease;
    display: block;
    opacity: 0;
}

.image-result-img.loaded {
    opacity: 1;
}

.image-loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 50%, #fef2f2 100%);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
    transition: background 0.4s ease, min-height 0.4s ease;
}

.image-loading-placeholder.image-loaded {
    background: transparent;
    min-height: 0;
}

.image-loading-placeholder.image-loaded::before {
    display: none;
}

.image-loading-placeholder::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(99,102,241,0.06) 0%, transparent 50%),
                radial-gradient(circle at 70% 60%, rgba(168,85,247,0.06) 0%, transparent 50%),
                radial-gradient(circle at 50% 80%, rgba(236,72,153,0.04) 0%, transparent 50%);
    animation: placeholder-bg-drift 8s ease-in-out infinite;
}

.image-loading-placeholder .placeholder-logo {
    width: 88px;
    height: 88px;
    object-fit: contain;
    animation: placeholder-breathe 2s ease-in-out infinite;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 0 20px rgba(99,102,241,0.2));
}

.image-loading-placeholder .placeholder-text {
    margin-top: 12px;
    font-size: 13px;
    color: #9ca3af;
}

.image-progress-bar {
    width: 180px;
    height: 4px;
    background: rgba(99,102,241,0.12);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 16px;
    position: relative;
    z-index: 1;
}

.image-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.image-progress-text {
    font-size: 12px;
    color: #8b8fa3;
    margin-top: 8px;
    position: relative;
    z-index: 1;
    font-variant-numeric: tabular-nums;
}

.image-loading-placeholder.image-loaded .image-progress-bar,
.image-loading-placeholder.image-loaded .image-progress-text {
    display: none;
}

@keyframes placeholder-breathe {
    0%, 100% { opacity: 0.6; transform: scale(1); filter: drop-shadow(0 0 20px rgba(99,102,241,0.15)); }

    50% { opacity: 1; transform: scale(1.08); filter: drop-shadow(0 0 30px rgba(99,102,241,0.3)); }

}

@keyframes placeholder-bg-drift {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }

    33% { transform: translate(2%, -1%) rotate(1deg); }

    66% { transform: translate(-1%, 2%) rotate(-1deg); }

}

.image-result-img:hover {
    transform: scale(1.02);
}

.image-result-grid {
    display: grid;
    gap: 8px;
    max-width: 100%;
}

.image-result-grid.image-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.image-result-grid.image-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.image-result-grid.image-grid-4 {
    grid-template-columns: repeat(2, 1fr);
}

.image-grid-item {
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
}

.image-grid-item .image-result-img {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
    aspect-ratio: 1;
}

.image-grid-item:hover .image-result-img {
    transform: scale(1.03);
}

.image-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.image-loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.bg-generating {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
}

.gen-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #10b981;
    animation: genPulse 1.2s ease-in-out infinite;
}

@keyframes genPulse {
    0%, 100% { opacity: 0.4; transform: scale(0.8); }

    50% { opacity: 1; transform: scale(1.2); }

}

.revised-prompt {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--bg-hover);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.image-option-btn.active {
    color: var(--accent);
    background-color: var(--accent-light);
    border-color: var(--accent);
}

.history-panel {
    position: absolute;
    top: 100%;
    right: 0;
    width: 280px;
    max-height: 420px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    display: flex;
    flex-direction: column;
    animation: popupFadeIn 0.15s ease;
}

.history-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.history-panel-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.history-panel-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.history-panel-list {
    overflow-y: auto;
    flex: 1;
    padding: 6px;
}

.history-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.history-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    gap: 8px;
}

.history-item:hover {
    background: var(--bg-hover);
}

.history-item.active {
    background: var(--accent-light);
}

.history-item-info {
    flex: 1;
    min-width: 0;
}

.history-item-title {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.history-item.active .history-item-title {
    color: var(--accent);
    font-weight: 500;
}

.history-item-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.history-item-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all var(--transition);
    flex-shrink: 0;
}

.history-item:hover .history-item-delete {
    opacity: 1;
}

.history-item-delete:hover {
    color: #ef4444;
    background: #fef2f2;
}

.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: lightboxFadeIn 0.2s ease;
}

@keyframes lightboxFadeIn {
    from { opacity: 0; }

    to { opacity: 1; }

}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
}

.lightbox-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.lightbox-close {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-download {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
}

.lightbox-download:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 600;
}

.close-modal {
    font-size: 24px;
    color: var(--text-secondary);
    line-height: 1;
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.setting-item label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.setting-hint {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 4px;
}

.setting-input {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color var(--transition);
}

.setting-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    resize: vertical;
    font-family: inherit;
    transition: border-color var(--transition);
}

.setting-textarea:focus,
.setting-input:focus {
    outline: none;
    border-color: var(--accent);
}

.setting-range {
    width: 100%;
}

.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.btn-block {
    width: 100%;
    text-align: center;
}

.modal-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 8px;
    transition: border-color var(--transition);
}

.modal-input:focus {
    outline: none;
    border-color: var(--accent);
}

.modal-input-label {
    margin-bottom: 0;
}

.welcome-modal-content {
    text-align: center;
    padding-top: 28px;
}

.welcome-modal-icon {
    font-size: 44px;
    margin-bottom: 10px;
}

.welcome-modal-logo {
    width: 180px;
    height: auto;
    margin-bottom: 16px;
}

.welcome-modal-content h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.welcome-steps {
    text-align: left;
    padding: 0 24px;
}

.welcome-step {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
    align-items: flex-start;
}

.step-num {
    width: 26px;
    height: 26px;
    background-color: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.step-body {
    flex: 1;
}

.step-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.step-btn {
    font-size: 13px;
    padding: 8px 16px;
}

.welcome-skip {
    display: block;
    margin: 10px auto 18px;
    color: var(--text-muted);
    font-size: 13px;
    transition: color var(--transition);
}

.welcome-skip:hover {
    color: var(--text-secondary);
}

.key-manager-modal {
    max-width: 480px;
}

.key-add-modal {
    max-width: 440px;
}

.key-manager-modal .modal-header,
.key-add-modal .modal-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-light) 0%, rgba(37, 99, 235, 0.08) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}

.modal-header-text {
    flex: 1;
    min-width: 0;
}

.modal-header-text h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.modal-header-text p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.key-status-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.06) 0%, rgba(16, 185, 129, 0.02) 100%);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.key-status-bar.no-key {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.06) 0%, rgba(245, 158, 11, 0.02) 100%);
    border-color: rgba(245, 158, 11, 0.15);
}

.key-status-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
    flex-shrink: 0;
}

.key-status-bar.no-key .key-status-icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--thinking-color);
}

.key-status-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.key-status-label {
    font-size: 12px;
    color: var(--text-muted);
}

.key-status-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.key-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

.key-list-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 24px;
    font-size: 14px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-color);
}

.key-list-empty::before {
    content: '🔑';
    display: block;
    font-size: 32px;
    margin-bottom: 8px;
}

.key-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}

.key-list-item:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
    transform: translateY(-1px);
}

.key-list-item.active {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--accent-light) 0%, rgba(37, 99, 235, 0.04) 100%);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.key-list-item.active .key-list-label::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

.key-list-info {
    flex: 1;
    min-width: 0;
}

.key-list-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.key-list-key {
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'Consolas', 'Monaco', monospace;
    letter-spacing: 0.5px;
}

.key-list-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
    margin-left: 12px;
}

.key-active-tag {
    font-size: 11px;
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
    border-radius: 20px;
    font-weight: 500;
}

.key-switch-btn {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
    color: var(--text-primary);
    transition: all var(--transition);
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.key-switch-btn:hover {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.key-delete-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-muted);
    transition: all var(--transition);
    border: none;
    background: transparent;
    cursor: pointer;
}

.key-delete-btn:hover {
    background-color: #fef2f2;
    color: var(--danger);
}

.key-list-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

.key-help-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition);
}

.key-help-link:hover {
    color: var(--accent);
}

.key-help-link svg {
    flex-shrink: 0;
}

.btn-add-key {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.btn-add-key:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-add-key svg {
    flex-shrink: 0;
}

.key-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-label svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.form-input::placeholder {
    color: var(--text-muted);
    font-size: 13px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.key-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.key-input-wrapper .form-input {
    padding-right: 44px;
}

.key-toggle-visible {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.key-toggle-visible:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.key-add-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border-light);
}

.key-add-modal .modal-footer .btn-secondary {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.key-add-modal .modal-footer .btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.key-add-modal .modal-footer .btn-primary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.key-add-modal .modal-footer .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.loading-indicator {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.stream-cursor {
    animation: blink 0.8s ease-in-out infinite;
    color: var(--text-secondary);
    font-weight: 400;
}

@keyframes blink {
    0%, 100% { opacity: 1; }

    50% { opacity: 0; }

}

@keyframes spin {
    to { transform: rotate(360deg); }

}

.prompt-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.prompt-preset {
    padding: 10px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.prompt-preset:hover {
    border-color: var(--accent);
    color: var(--accent);
    background-color: var(--accent-light);
}

.prompt-preset.active {
    border-color: var(--accent);
    color: var(--accent);
    background-color: var(--accent-light);
}

.prompt-preset-delete {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    font-size: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    line-height: 1;
}

.prompt-preset.custom:hover .prompt-preset-delete {
    display: flex;
}

.prompt-section-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.prompt-section-hint {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
}

.prompt-custom-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-end;
}

.prompt-btn-active {
    color: var(--accent) !important;
}

.tts-player {
    position: fixed;
    bottom: 100px;
    right: 24px;
    z-index: 500;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    animation: msgFadeIn 0.3s ease;
}

.tts-player-inner {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 260px;
}

.tts-close {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.tts-close:hover {
    color: var(--text-primary);
}

.tts-info {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.tts-player audio {
    width: 100%;
    height: 36px;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 200;
        transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 199;
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .toggle-sidebar {
        display: block;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .message-content {
        max-width: 90%;
    }

    .message-body {
        max-width: 90%;
    }

    .input-area {
        padding: 0 12px 12px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .messages-container {
        padding: 12px 0;
    }

    .message {
        padding: 10px 12px;
    }

    .message-actions {
        opacity: 1;
    }

    .input-toolbar {
        flex-wrap: wrap;
    }

    .input-toolbar-left {
        flex-wrap: wrap;
        gap: 2px;
    }

    .input-toolbar-right {
        margin-left: auto;
    }

    .tool-btn {
        padding: 4px 8px;
        font-size: 11px;
    }

    .toolbar {
        padding: 10px 14px;
    }

    .welcome-logo-img {
        width: 110px;
    }

    .welcome-content {
        padding: 24px 16px;
    }

    .chat-input-box textarea {
        font-size: 16px;
    }

    .input-hint {
        display: none;
    }

    .toast-container {
        top: auto;
        bottom: 80px;
        right: 12px;
        left: 12px;
    }

    .toast {
        max-width: 100%;
        font-size: 13px;
        padding: 10px 16px;
    }
}

@media (max-width: 480px) {
    .message {
        padding: 8px 8px;
        gap: 8px;
    }

    .message-body {
        max-width: 92%;
    }

    .message.user .message-content {
        padding: 8px 12px;
        font-size: 13px;
    }

    .welcome-logo-img {
        width: 80px;
    }

    .welcome-desc {
        font-size: 13px;
    }

    .welcome-feature-item h4 {
        font-size: 13px;
    }

    .welcome-feature-item p {
        font-size: 11px;
    }

    .model-selector h2 {
        font-size: 14px;
    }

    .msg-action-btn {
        padding: 3px 6px;
        font-size: 10px;
    }

    .msg-action-btn svg {
        width: 12px;
        height: 12px;
    }
}

@media (hover: none) {
    .message-actions {
        opacity: 1;
    }

}


/* Frame Upload Panel (首尾�? */
.frame-upload-panel {
    display: none;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    border: 1px solid var(--border-color);
    border-bottom: none;
    margin-bottom: -1px;
}

.frame-upload-panel.visible {
    display: flex;
}

.frame-slot {
    position: relative;
    width: 80px;
    height: 80px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    overflow: hidden;
    background: var(--bg-primary);
}

.frame-slot:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.frame-slot.has-image {
    border-style: solid;
    border-color: var(--accent);
}

.frame-slot-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.frame-slot-placeholder svg {
    opacity: 0.5;
}

.frame-slot-placeholder span {
    font-size: 11px;
    font-weight: 500;
}

.frame-slot-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.frame-slot-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    z-index: 2;
    transition: background 0.2s;
}

.frame-slot-remove:hover {
    background: var(--danger);
}

.frame-slot-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 10px;
    font-weight: 500;
    color: white;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    padding: 2px 0;
    border-radius: 0 0 6px 6px;
    pointer-events: none;
}

.frame-slot.has-image .frame-slot-label {
    display: block;
}

.frame-slot:not(.has-image) .frame-slot-label {
    display: none;
}

.frame-slot-arrow {
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    opacity: 0.4;
}

/* === Badge + wrapper (GitHub style) === */
.badge-wrap {
    position: relative;
    display: inline-flex;
}
.badge-count {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 2px solid var(--bg-primary);
    box-sizing: border-box;
    box-shadow: 0 0 0 1px rgba(239,68,68,0.2);
    pointer-events: none;
    user-select: none;
}

/* === Notice panel (ChatGPT/GitHub dropdown style) === */
.notice-panel {
    position: fixed;
    top: 52px;
    right: 12px;
    width: 400px;
    max-height: 75vh;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.05) inset;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: notice-panel-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes notice-panel-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.notice-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
}
.notice-panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}
.notice-panel-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    transition: all 0.15s;
}
.notice-panel-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.notice-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 0 8px;
}
.notice-panel-loading,
.notice-panel-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-tertiary);
    font-size: 13px;
}

/* Notice item in panel */
.notice-panel-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}
.notice-panel-item:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    background: var(--border-color);
}
.notice-panel-item:hover {
    background: var(--bg-hover);
}
.notice-panel-item.unread {
    background: rgba(59,130,246,0.03);
}
.notice-panel-item.unread:hover {
    background: rgba(59,130,246,0.06);
}
.notice-panel-item-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.notice-panel-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.02em;
}
.notice-panel-badge.new {
    background: rgba(59,130,246,0.1);
    color: #60a5fa;
}
.notice-panel-badge.update {
    background: rgba(16,185,129,0.1);
    color: #34d399;
}
.notice-panel-badge.notice {
    background: rgba(245,158,11,0.1);
    color: #fbbf24;
}
.notice-panel-badge.urgent {
    background: rgba(239,68,68,0.1);
    color: #f87171;
}
.notice-panel-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.notice-panel-unread-dot {
    width: 7px;
    height: 7px;
    background: #3b82f6;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}
.notice-panel-content {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.notice-panel-date {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 6px;
}

/* Expanded notice detail */
.notice-panel-detail {
    padding: 20px;
    animation: notice-detail-in 0.2s ease;
}
@keyframes notice-detail-in {
    from { opacity: 0; transform: translateX(8px); }
    to { opacity: 1; transform: translateX(0); }
}
.notice-panel-detail-back {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    padding: 4px 0;
    margin-bottom: 16px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: gap 0.15s;
}
.notice-panel-detail-back:hover {
    gap: 6px;
}
.notice-panel-detail h4 {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}
.notice-panel-detail p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
    white-space: pre-wrap;
}
.notice-panel-detail .notice-panel-date {
    margin-top: 16px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .notice-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
        animation: none;
    }
    .video-play-btn {
        width: 52px;
        height: 52px;
    }
    .video-play-btn svg {
        width: 20px;
        height: 20px;
    }
    .video-card-actions .video-action-btn {
        padding: 5px 8px;
        font-size: 11px;
    }
    .video-progress {
        padding: 12px 14px;
    }
}
