* { box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: #F8FAFC; color: #0f172a; margin: 0; padding: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column; }

/* ── Header ──────────────────────────────────── */
.app-header { background: #fff; padding: 0 20px; height: 56px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 100; }

.brand { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; color: #0f172a; letter-spacing: -0.02em; margin-left: 12px; user-select: none; }
.brand-icon { width: 26px; height: 26px; background: linear-gradient(135deg, #2563EB 0%, #7c3aed 100%); border-radius: 7px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-icon svg { display: block; }

.header-right { display: flex; align-items: center; gap: 10px; }

.usage { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #64748b; background: #f8fafc; border: 1px solid #e9ecef; padding: 5px 12px; border-radius: 20px; font-weight: 500; white-space: nowrap; }
.usage::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #22c55e; flex-shrink: 0; box-shadow: 0 0 0 2px #dcfce7; }

.lang-switch { display: flex; align-items: center; gap: 6px; background: #f1f5f9; padding: 4px; border-radius: 8px; }
.lang-btn { border: none; background: transparent; color: #64748b; font-size: 12px; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-weight: 500; }
.lang-btn.active { background: #2563EB; color: white; }

/* ── Avatar menu ──────────────────────────────── */
.avatar-menu { position: relative; }
.avatar-btn { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; height: 36px; background: #fff; border: 1px solid #e4e4e7; border-radius: 999px; cursor: pointer; transition: all 0.15s ease; color: #18181b; outline: none; }
.avatar-btn:hover { background: #f4f4f5; border-color: #d4d4d8; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.avatar-btn:focus-visible { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #2563EB; }
.avatar-circle { width: 28px; height: 28px; border-radius: 50%; background: #f4f4f5; border: 1px solid #e4e4e7; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #71717a; }
.avatar-initial { line-height: 1; }
.avatar-username { font-size: 13px; font-weight: 600; color: #18181b; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1; }
.avatar-chevron { color: #a1a1aa; flex-shrink: 0; transition: transform 0.2s ease; margin-left: 2px; }
.avatar-btn[aria-expanded="true"] .avatar-chevron { transform: rotate(180deg); }

.avatar-dropdown { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid #e4e4e7; border-radius: 14px; min-width: 220px; box-shadow: 0 8px 30px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.06); padding: 6px; display: none; z-index: 200; transform-origin: top right; }
.avatar-dropdown.open { display: block; animation: dropdownIn 0.15s ease; }
@keyframes dropdownIn { from { opacity:0; transform:scale(0.95) translateY(-4px);} to { opacity:1; transform:scale(1) translateY(0);} }

.avatar-user-card { padding: 10px 12px 12px; margin-bottom: 4px; border-bottom: 1px solid #f4f4f5; }
.avatar-user-card .card-name { font-size: 14px; font-weight: 600; color: #18181b; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar-user-card .card-meta { font-size: 11px; color: #71717a; }

.avatar-dropdown-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 12px; font-size: 13px; font-weight: 500; color: #3f3f46; background: none; border: none; border-radius: 8px; cursor: pointer; text-align: left; text-decoration: none; transition: background 0.12s; }
.avatar-dropdown-item:hover { background: #f4f4f5; color: #18181b; }
.avatar-dropdown-item svg { color: #a1a1aa; flex-shrink: 0; }
.avatar-dropdown-item.danger { color: #dc2626; }
.avatar-dropdown-item.danger:hover { background: #fef2f2; }
.avatar-dropdown-item.danger svg { color: #dc2626; }
.avatar-dropdown-sep { height: 1px; background: #f4f4f5; margin: 4px 0; }

/* 山 keep compat */
.avatar-name { font-size: 13px; color: #0f172a; font-weight: 500; padding: 8px 10px; border-bottom: 1px solid #f1f5f9; margin-bottom: 8px; }
.avatar-action button { width: 100%; padding: 10px 12px; border: none; background: #2563EB; color: white; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 500; }

/* 公告栏 */
.announcement-bar { display: flex; align-items: center; gap: 10px; padding: 10px 20px; font-size: 13px; font-weight: 500; border-bottom: 1px solid transparent; flex-shrink: 0; animation: slideDown 0.3s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-100%); } to { opacity: 1; transform: translateY(0); } }
.announcement-bar.type-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.announcement-bar.type-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.announcement-bar.type-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.announcement-bar.type-danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.announcement-icon { font-size: 15px; flex-shrink: 0; }
.announcement-text { flex: 1; line-height: 1.5; }
.announcement-close { flex-shrink: 0; background: none; border: none; cursor: pointer; font-size: 18px; line-height: 1; opacity: 0.45; padding: 0 4px; transition: opacity 0.15s; }
.announcement-close:hover { opacity: 1; }

/* 模型维护状态 */
.model-card.maintenance { opacity: 0.55; cursor: not-allowed; pointer-events: none; }
.model-maintenance-badge { display: inline-block; margin-top: 4px; font-size: 10px; font-weight: 600; color: #b45309; background: #fef3c7; border: 1px solid #fde68a; padding: 1px 6px; border-radius: 999px; }
.model-card.maintenance .model-cost { display: none; }

/* 聊天容器 */
.chat-container { display: flex; flex: 1; min-height: 0; width: 100%; max-width: none; margin: 0; gap: 0; padding: 0; }

/* 模型侧边栏 */
.model-sidebar { width: 290px; background: white; border-right: 1px solid #e2e8f0; padding: 20px 18px; overflow-y: auto; }
.model-sidebar::-webkit-scrollbar { width: 4px; }
.model-sidebar::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 99px; }
.sidebar-section { margin-bottom: 18px; }
.section-title { font-size: 11px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.section-title.with-action { gap: 8px; }
.icon-btn { background: none; border: none; font-size: 15px; color: #94a3b8; cursor: pointer; padding: 3px 6px; border-radius: 5px; }
.icon-btn:hover { background: #f1f5f9; color: #2563EB; }
.model-list { display: flex; flex-direction: column; gap: 10px; }
.model-card { display: flex; align-items: flex-start; gap: 10px; padding: 14px 14px; background: #f8fafc; border: 1.5px solid #e8ecf0; border-radius: 12px; cursor: pointer; transition: all 0.18s ease; text-align: left; width: 100%; }
.model-card:hover { background: #f1f5f9; border-color: #c7d2fe; }
.model-card.active { background: #eff6ff; border-color: #2563EB; box-shadow: 0 0 0 3px rgba(37,99,235,0.08); }
.model-card.active .model-name { color: #2563EB; }
.model-card.active .model-desc { color: #475569; }
.model-card.active .model-cost { background: white; }
.model-icon { font-size: 22px; margin-top: 1px; flex-shrink: 0; }
.model-info { flex: 1; min-width: 0; }
.model-name { font-weight: 700; font-size: 15px; color: #0f172a; margin-bottom: 4px; }
.model-desc { font-size: 12px; color: #64748b; line-height: 1.5; }
.model-cost { display: inline-block; margin-top: 7px; font-size: 11px; font-weight: 600; color: #2563EB; background: #eff6ff; border: 1px solid #dbeafe; padding: 3px 9px; border-radius: 999px; }

/* Recent projects */
.recent-list { display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow-y: auto; }
.recent-item { padding: 12px 14px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; cursor: pointer; transition: all 0.2s ease; }
.recent-item:hover { background: #f1f5f9; border-color: #cbd5e1; }
.recent-title { font-size: 13px; color: #0f172a; font-weight: 600; margin-bottom: 4px; }
.recent-sub { font-size: 12px; color: #64748b; margin-bottom: 6px; font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-meta { font-size: 11px; color: #94a3b8; display: flex; justify-content: space-between; align-items: center; }
.recent-link { color: #2563EB; text-decoration: none; margin-left: 8px; font-weight: 500; }
.recent-link:hover { text-decoration: underline; }
.recent-status { font-size: 11px; color: #0f172a; font-weight: 500; }
.recent-status.success { color: #2563EB; }
.recent-status.refunded { color: #64748b; }
.recent-status.pending { color: #d97706; }
.recent-loading, .recent-empty { text-align: center; padding: 16px; color: #94a3b8; font-size: 12px; }

/* 历史记录详情弹窗 */
.history-modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.48); backdrop-filter: blur(4px); z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 20px; }
.history-modal-card { background: white; border-radius: 16px; padding: 28px; width: 100%; max-width: 520px; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,0.18); animation: historyModalIn 0.2s ease; }
@keyframes historyModalIn { from { opacity: 0; transform: scale(0.96) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.history-modal-close { position: absolute; top: 14px; right: 14px; width: 28px; height: 28px; border: none; background: #f1f5f9; border-radius: 50%; cursor: pointer; font-size: 18px; line-height: 1; color: #64748b; display: flex; align-items: center; justify-content: center; transition: background 0.15s, color 0.15s; padding: 0; }
.history-modal-close:hover { background: #e2e8f0; color: #0f172a; }
.history-modal-header { margin-bottom: 18px; padding-right: 36px; }
.history-modal-title { font-size: 16px; font-weight: 600; color: #0f172a; margin-bottom: 8px; line-height: 1.4; }
.history-modal-status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 99px; }
.history-modal-status.success { background: #dcfce7; color: #16a34a; }
.history-modal-status.refunded { background: #fef9c3; color: #b45309; }
.history-modal-status.pending { background: #e0f2fe; color: #0369a1; }
.history-modal-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: #94a3b8; margin-bottom: 6px; }
.history-modal-section { margin-bottom: 16px; }
.history-modal-prompt { font-size: 13px; color: #374151; line-height: 1.65; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px 14px; word-break: break-word; max-height: 120px; overflow-y: auto; }
.history-modal-meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.history-modal-meta-item { background: #f8fafc; border-radius: 8px; padding: 10px 12px; border: 1px solid #f0f0f0; }
.history-modal-meta-val { font-size: 13px; font-weight: 600; color: #0f172a; }
.history-modal-video-wrap { margin-bottom: 16px; border-radius: 10px; overflow: hidden; border: 1px solid #e2e8f0; }
.history-modal-video-wrap video { width: 100%; display: block; max-height: 240px; background: #000; }
.history-modal-video-link { display: block; text-align: center; padding: 8px 12px; font-size: 12px; color: #2563eb; text-decoration: none; background: #f8fafc; border-top: 1px solid #e2e8f0; }
.history-modal-video-link:hover { text-decoration: underline; }
.history-modal-actions { display: flex; gap: 10px; }
.history-modal-use-btn { flex: 1; padding: 10px 16px; background: #2563EB; color: white; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; transition: background 0.15s; }
.history-modal-use-btn:hover { background: #1d4ed8; }
.history-modal-repoll-btn { padding: 10px 16px; background: #f59e0b; color: white; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; transition: background 0.15s; align-items: center; gap: 4px; }
.history-modal-repoll-btn:hover { background: #d97706; }
.history-modal-repoll-btn:disabled { background: #94a3b8; cursor: not-allowed; }

/* 聊天主区域 */
.chat-main { flex: 1; display: flex; flex-direction: column; background: #f8fafc; }
.chat-main.model-switch-animate { animation: modelSwitchIn 0.35s ease; }
@keyframes modelSwitchIn { from { opacity: 0.7; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.chat-messages { flex: 1; overflow-y: auto; padding: 28px 36px 24px; display: flex; flex-direction: column; gap: 20px; scroll-behavior: smooth; }
.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 99px; }
.chat-messages::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

/* 空状态 */
.empty-state { text-align: left; padding: 48px 16px 0; max-width: 600px; margin: 0 auto; width: 100%; }
.empty-state h2 { font-size: 26px; font-weight: 700; color: #0f172a; margin: 0 0 10px 0; letter-spacing: -0.02em; }
.empty-state p { font-size: 15px; color: #64748b; margin: 0 0 6px 0; line-height: 1.65; }

/* 消息气泡 */
.message { display: flex; gap: 10px; max-width: 76%; animation: slideUp 0.25s ease; }
.message.user { margin-left: auto; flex-direction: row-reverse; }
.message.assistant { margin-right: auto; }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.message-avatar { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
.message.user .message-avatar { background: #f4f4f5; border: 1px solid #e4e4e7; color: #52525b; }
.message.assistant .message-avatar { background: #18181b; border: 1px solid #18181b; color: #fff; }

.message-content { flex: 1; min-width: 0; }
.message-bubble { padding: 11px 15px; border-radius: 18px; font-size: 14px; line-height: 1.65; word-wrap: break-word; }
.message.user .message-bubble { background: #2563EB; color: white; border-bottom-right-radius: 5px; box-shadow: 0 1px 3px rgba(37,99,235,0.22); }
.message.assistant .message-bubble { background: white; color: #1e293b; border: 1px solid #e8ecf0; border-bottom-left-radius: 5px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }

/* 视频结果卡片 */
.video-result { margin-top: 10px; padding: 14px; background: white; border: 1px solid #e2e8f0; border-radius: 12px; max-width: 460px; box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
.video-status { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.status-title { font-size: 13px; color: #0f172a; font-weight: 600; }
.status-sub { font-size: 12px; color: #64748b; }
.status-id { font-size: 11px; color: #94a3b8; word-break: break-all; }
.status-steps { list-style: none; padding: 0; margin: 6px 0 0 0; display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: #94a3b8; }
.status-steps li { position: relative; padding-left: 14px; }
.status-steps li::before { content: "\2022"; position: absolute; left: 0; color: #94a3b8; }
.status-steps li.active { color: #2563EB; font-weight: 500; }
.status-steps li.active::before { color: #2563EB; }
.status-steps li.done { color: #94a3b8; text-decoration: line-through; }
.video-result.failed .status-title { color: #dc2626; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.video-preview { width: 100%; border-radius: 8px; overflow: hidden; background: #0f172a; margin-bottom: 10px; max-height: 260px; }
.video-preview video { width: 100%; height: 100%; max-height: 260px; display: block; object-fit: contain; }
.video-preview img.result-image { width: 100%; max-height: 260px; display: block; object-fit: contain; }
.video-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.video-btn { padding: 7px 14px; background: #2563EB; color: white; border: none; border-radius: 7px; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.18s ease; }
.video-btn:hover { background: #1d4ed8; transform: translateY(-1px); box-shadow: 0 3px 7px rgba(37, 99, 235, 0.25); }
.video-btn.secondary { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.video-btn.secondary:hover { background: #e8ecf0; border-color: #cbd5e1; transform: translateY(-1px); }
.video-btn.ghost { background: white; color: #2563EB; border: 1px solid #dbeafe; }
.video-btn.ghost:hover { background: #eff6ff; border-color: #bfdbfe; transform: translateY(-1px); }

/* 进度条 */
.progress-wrap { margin-top: 8px; }
.progress-bar { height: 5px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #2563EB, #60a5fa); width: 0%; transition: width 350ms ease; border-radius: 99px; }

/* 参数面板 */
.params-panel { padding: 14px 16px; background: #f8fafc; border: 1.5px solid #e2e8f0; border-radius: 12px; margin-bottom: 10px; }
.params-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 12px; }
.param-item { display: flex; flex-direction: column; gap: 6px; }
.param-item label { font-size: 13px; font-weight: 600; color: #475569; }
.param-item select { padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 8px; background: white; font-size: 14px; cursor: pointer; }
.params-extra { display: flex; gap: 12px; }
.params-extra input { flex: 1; padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 14px; }

/* 输入区域 */
.chat-input-area { border-top: 1px solid #e2e8f0; background: #f8fafc; padding: 14px 20px 18px; position: relative; }
.composer { display: flex; flex-direction: column; gap: 0; border: 1.5px solid #e2e8f0; border-radius: 14px; background: white; overflow: hidden; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.composer:focus-within { border-color: #2563EB; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08); }
.prompt-box textarea { width: 100%; padding: 14px 16px 10px; border: none; border-radius: 0; font-size: 14px; font-family: inherit; resize: none; min-height: 84px; max-height: 200px; overflow-y: auto; background: transparent; line-height: 1.7; color: #0f172a; }
.prompt-box textarea::placeholder { color: #94a3b8; }
.prompt-box textarea:focus { outline: none; box-shadow: none; }
.image-preview-chip { display: none; align-items: center; gap: 8px; padding: 6px 12px 8px; background: #eff6ff; border-top: 1px solid #dbeafe; font-size: 12px; color: #1e40af; }
.image-preview-chip.visible { display: flex; }
.image-preview-chip img { width: 30px; height: 30px; object-fit: cover; border-radius: 5px; border: 1px solid #bfdbfe; flex-shrink: 0; }
.image-preview-chip span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.image-preview-remove { background: none; border: none; color: #93c5fd; cursor: pointer; font-size: 16px; line-height: 1; padding: 0; flex-shrink: 0; }
.image-preview-remove:hover { color: #ef4444; }
.image-uploading { animation: pulse 1s ease infinite; }
@keyframes pulse { 0%,100%{ opacity:1 } 50%{ opacity:.5 } }
.quick-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: #f1f5f9; border: 1px solid #e2e8f0; color: #475569; font-size: 12px; padding: 5px 12px; border-radius: 999px; cursor: pointer; transition: all 0.18s ease; font-weight: 500; }
.tag:hover { background: #eff6ff; color: #2563EB; border-color: #bfdbfe; }
.composer-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px 10px; border-top: 1px solid #f1f5f9; background: #fafbfc; }
.footer-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.footer-field { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #6b7280; }
.footer-field select { padding: 4px 6px; border: 1px solid #e2e8f0; border-radius: 6px; background: white; font-size: 12px; color: #374151; cursor: pointer; font-weight: 500; }
.params-toggle { width: 28px; height: 28px; border: 1px solid #e2e8f0; background: white; border-radius: 7px; font-size: 13px; cursor: pointer; transition: all 0.18s ease; flex-shrink: 0; color: #64748b; display: flex; align-items: center; justify-content: center; }
.params-toggle:hover { background: #f1f5f9; border-color: #cbd5e1; color: #374151; }
.params-toggle.active { background: #eff6ff; border-color: #2563EB; color: #2563EB; }
.send-btn { min-width: 120px; height: 38px; border: none; background: linear-gradient(135deg, #2563EB, #1d4ed8); color: white; border-radius: 9px; cursor: pointer; transition: all 0.2s ease; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; padding: 0 18px; box-shadow: 0 1px 4px rgba(37,99,235,0.2); }
.send-btn:hover:not(:disabled) { background: linear-gradient(135deg, #1d4ed8, #1e40af); box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35); transform: translateY(-1px); }
.send-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; background: #2563EB; }
.send-icon { font-size: 15px; display: block; }

/* 响应式 */
@media (max-width: 768px) {
  .chat-container { flex-direction: column; }
  .model-sidebar { width: 100%; height: auto; max-height: 150px; border-right: none; border-bottom: 1px solid #e2e8f0; overflow-y: visible; }
  .model-list { flex-direction: row; overflow-x: auto; }
  .model-card { min-width: 180px; }
  .params-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar-section:last-child { display: none; }
  .send-btn { min-width: 88px; }
}

/* 旧样式保留（用于登录等页面） */
.auth-page { background: #F8FAFC; padding: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center; position: relative; }
.auth-page::before { content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: radial-gradient(circle at 20% 30%, rgba(37, 99, 235, 0.03) 0%, transparent 40%), radial-gradient(circle at 80% 70%, rgba(37, 99, 235, 0.02) 0%, transparent 40%); pointer-events: none; }
.auth-shell { display: flex; width: 100%; max-width: 460px; margin: 20px auto; justify-content: center; align-items: center; position: relative; z-index: 1; }
.auth-hero { flex: 1; color: #0f172a; display: flex; flex-direction: column; justify-content: center; padding: 44px; background: rgba(255, 255, 255, 0.7); border-radius: 20px; border: 1px solid rgba(148, 163, 184, 0.35); position: relative; overflow: hidden; backdrop-filter: blur(16px); box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08); }
.auth-hero::before { content: ""; position: absolute; inset: -40% 30% auto -30%; height: 280px; background: radial-gradient(circle, rgba(56, 189, 248, 0.25), transparent 60%); z-index: 0; }
.auth-hero::after { content: ""; position: absolute; right: -80px; bottom: -60px; width: 220px; height: 220px; background: radial-gradient(circle, rgba(59, 130, 246, 0.18), transparent 65%); z-index: 0; }
.auth-hero > * { position: relative; z-index: 1; }
.auth-badge { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; background: rgba(15, 23, 42, 0.06); border-radius: 999px; font-size: 12px; font-weight: 600; margin-bottom: 22px; width: fit-content; color: #0f172a; border: 1px solid rgba(148, 163, 184, 0.4); letter-spacing: 0.08em; text-transform: uppercase; }
.auth-hero h1 { font-size: 44px; font-weight: 700; margin: 0 0 14px 0; line-height: 1.15; color: #0f172a; letter-spacing: -0.03em; }
.auth-hero > p { font-size: 16px; margin: 0 0 28px 0; color: #475569; line-height: 1.7; max-width: 420px; }
.hero-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 26px; }
.metric { padding: 12px 14px; background: rgba(255, 255, 255, 0.65); border-radius: 14px; border: 1px solid rgba(148, 163, 184, 0.3); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4); }
.metric-value { font-size: 20px; font-weight: 700; color: #0f172a; letter-spacing: -0.02em; }
.metric-label { font-size: 12px; color: #64748b; margin-top: 4px; }
.auth-benefits { list-style: none; padding: 0; margin: 0 0 26px 0; display: grid; gap: 10px; }
.auth-benefits li { padding: 10px 12px 10px 40px; position: relative; font-size: 15px; color: #475569; background: rgba(255, 255, 255, 0.6); border-radius: 12px; border: 1px solid rgba(148, 163, 184, 0.28); }
.auth-benefits li:before { content: ""; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle, rgba(14, 165, 233, 0.9), rgba(59, 130, 246, 0.6)); box-shadow: 0 0 10px rgba(56, 189, 248, 0.45); }
.hero-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hero-mini-card { padding: 14px 16px; border-radius: 14px; border: 1px solid rgba(148, 163, 184, 0.3); background: rgba(15, 23, 42, 0.04); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4); }
.hero-mini-title { font-size: 14px; font-weight: 700; color: #0f172a; margin-bottom: 6px; }
.hero-mini-sub { font-size: 12px; color: #64748b; }
.hero-glass-orb { position: absolute; border-radius: 999px; background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8), rgba(148, 163, 184, 0.2)); border: 1px solid rgba(255, 255, 255, 0.6); box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08); z-index: 0; }
.hero-glass-orb.orb-one { width: 120px; height: 120px; top: -30px; right: 20px; }
.hero-glass-orb.orb-two { width: 160px; height: 160px; bottom: -60px; left: 40px; opacity: 0.8; }
.auth-card { background: white; border-radius: 16px; padding: 40px; box-shadow: 0 4px 20px rgba(0,0,0,0.07); flex: 1; width: 100%; animation: slideIn 0.5s ease-out; border: 1px solid #e2e8f0; }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 32px; border-bottom: 2px solid #f1f5f9; padding-bottom: 0; }
.auth-tab { flex: 1; padding: 12px 24px; background: transparent; border: none; border-bottom: 3px solid transparent; font-size: 16px; font-weight: 600; color: #64748b; cursor: pointer; transition: all 0.3s ease; position: relative; bottom: -2px; }
.auth-tab.active { color: #2563EB; border-bottom-color: #2563EB; }
.auth-tab:hover { color: #2563EB; }
.auth-panel { display: none; animation: fadeIn 0.3s ease; }
.auth-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.auth-panel h2 { font-size: 28px; margin: 0 0 8px 0; color: #0f172a; font-weight: 600; letter-spacing: -0.01em; }
.auth-sub { color: #64748b; font-size: 15px; margin: 0 0 28px 0; }
.auth-form label { display: block; margin-bottom: 20px; font-size: 14px; font-weight: 500; color: #475569; }
.auth-form input { width: 100%; padding: 12px 16px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 15px; margin-top: 6px; transition: all 0.3s ease; background: #f8fafc; }
.auth-form input:focus { outline: none; border-color: #2563EB; background: white; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.auth-primary { width: 100%; padding: 14px; background: #2563EB; color: white; border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; margin-top: 8px; }
.auth-primary:hover:not(:disabled) { background: #1d4ed8; box-shadow: 0 4px 8px rgba(37, 99, 235, 0.2); }
.auth-primary:active:not(:disabled) { transform: translateY(0); }
.auth-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.auth-footer { margin-top: 24px; text-align: center; color: #64748b; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.auth-link { background: none; border: none; color: #2563EB; font-weight: 600; cursor: pointer; padding: 0; text-decoration: none; font-size: 14px; }
.auth-link:hover { text-decoration: underline; }
.auth-error { background: #fee2e2; color: #dc2626; padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; border-left: 4px solid #dc2626; }
.auth-success { background: #dcfce7; color: #166534; padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; border-left: 4px solid #16a34a; }
.password-field { position: relative; margin-top: 6px; }
.password-field input { margin-top: 0; padding-right: 44px; }
.pw-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: #94a3b8; padding: 4px; display: flex; align-items: center; justify-content: center; transition: color 0.2s ease; border-radius: 4px; }
.pw-toggle:hover { color: #2563EB; }
@media (max-width: 960px) { 
  .auth-shell { flex-direction: column; max-width: 500px; }
  .auth-hero { padding: 32px 22px; text-align: left; }
  .auth-hero h1 { font-size: 32px; }
  .hero-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-card-grid { grid-template-columns: 1fr; }
  .auth-benefits li { padding-left: 40px; text-align: left; display: block; width: 100%; }
  .auth-card { flex: 1; padding: 32px 24px; }
}
@media (max-width: 600px) { 
  .auth-shell { margin: 0; border-radius: 0; }
  .auth-card { border-radius: 0; padding: 24px 20px; }
  .auth-hero { display: none; }
}

/* index.html - 左侧导航栏样式 */
.chat-main-wrapper { flex: 1; display: flex; }


/* 导航侧栏（index.html中使用） */
.chat-container .dashboard-sidebar { width: 260px; background: white; border-right: 1px solid #e2e8f0; padding: 18px; overflow-y: auto; transition: all 0.3s ease; position: relative; z-index: 5; }
.chat-container .dashboard-sidebar.collapsed { width: 0; padding: 0; border-right: none; overflow: hidden; }

/* 导航项样式 */
.nav-section { margin-bottom: 20px; }
.nav-title { font-size: 12px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 12px; display: block; }
.nav-menu { display: flex; flex-direction: column; gap: 8px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #f7fafc; border: 2px solid transparent; border-radius: 12px; cursor: pointer; transition: all 0.3s ease; text-align: left; width: 100%; border: none; font-size: 15px; color: #4b5563; font-weight: 500; }
.nav-item:hover { background: #f8fafc; }
.nav-item.active { background: #2563EB; color: white; box-shadow: 0 1px 2px rgba(37, 99, 235, 0.1); }
.nav-icon { width: 20px; text-align: center; flex-shrink: 0; }

/* 侧边栏切换按钮 */
.sidebar-toggle-btn { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid #E4E4E0; background: #F4F4F2; cursor: pointer; padding: 0; margin-bottom: 16px; border-radius: 5px; transition: all 0.15s ease; flex-shrink: 0; position: relative; }
.sidebar-toggle-btn::before { content: ""; display: block; width: 14px; height: 1.5px; background: #71717A; border-radius: 99px; box-shadow: 0 -4.5px 0 #71717A, 0 4.5px 0 #71717A; transition: all 0.15s; }
.sidebar-toggle-btn:hover { background: #EBEBE8; border-color: #D0D0CC; }
.sidebar-toggle-btn:hover::before { background: #18181B; box-shadow: 0 -4.5px 0 #18181B, 0 4.5px 0 #18181B; }

/* 展开侧边栏按钮（折叠状态时显示在左边缘） */
.sidebar-expand-btn { position: fixed; left: 0; top: 50%; transform: translateY(-50%); width: 18px; height: 52px; background: white; border: 1px solid #e2e8f0; border-left: none; border-radius: 0 8px 8px 0; cursor: pointer; display: none; align-items: center; justify-content: center; z-index: 200; box-shadow: 2px 0 8px rgba(0,0,0,0.06); padding: 0; transition: width 0.15s ease, background 0.15s ease; }
.sidebar-expand-btn::after { content: "›"; font-size: 16px; color: #6b7280; line-height: 1; }
.sidebar-expand-btn:hover { width: 24px; background: #f8fafc; }
.sidebar-expand-btn:hover::after { color: #374151; }
.chat-container.sidebar-collapsed .sidebar-expand-btn,
.dashboard-layout.sidebar-collapsed .sidebar-expand-btn { display: flex; }

/* 侧边栏折叠状态 */
.chat-container.sidebar-collapsed .dashboard-sidebar { width: 0; padding: 0; border-right: none; }

@media (max-width: 768px) { 
  .chat-container { flex-direction: column; }
  .chat-container .dashboard-sidebar { width: 100%; max-height: 120px; border-right: none; border-bottom: 1px solid #e2e8f0; padding: 12px; }
  .chat-container .model-sidebar { width: 100%; max-height: 150px; border-right: none; border-bottom: 1px solid #e2e8f0; padding: 12px; }
  .model-list { flex-direction: row; overflow-x: auto; }
  .model-card { min-width: 180px; white-space: nowrap; }
}

/* GPT-style monochrome product layer */
:root {
  --ink: #0d0d0d;
  --ink-2: #2f2f2f;
  --muted: #6b6b6b;
  --line: #e5e5e5;
  --line-strong: #d4d4d4;
  --surface: #ffffff;
  --surface-2: #f7f7f7;
  --surface-3: #f1f1f1;
  --danger: #b42318;
}

html { background: var(--surface); }
body {
  background: var(--surface);
  color: var(--ink);
  letter-spacing: 0;
}

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
}

.usage {
  background: var(--surface);
  color: var(--ink-2);
  border-color: var(--line-strong);
  border-radius: 8px;
  font-size: 13px;
}
.usage::before {
  background: var(--ink);
  box-shadow: none;
}

.avatar-btn,
.avatar-circle,
.avatar-dropdown,
.auth-card,
.model-card,
.module-card,
.video-result,
.message.assistant .message-bubble,
.composer,
.params-panel,
.recent-item,
.history-modal-card {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: none;
}

.avatar-btn,
.nav-item,
.model-card,
.module-card,
.auth-card,
.composer,
.params-panel,
.home-action,
.quota-panel {
  border-radius: 10px;
}

.avatar-btn:hover,
.avatar-dropdown-item:hover,
.nav-item:hover,
.model-card:hover,
.recent-item:hover,
.tag:hover,
.params-toggle:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
  color: var(--ink);
  box-shadow: none;
  transform: none;
}

.dashboard-sidebar,
.chat-container .dashboard-sidebar,
.model-sidebar,
.dashboard-main,
.chat-main,
.chat-input-area,
.composer-footer {
  background: var(--surface);
  border-color: var(--line);
}

.nav-title,
.section-title,
.dashboard-subtitle,
.auth-sub,
.model-desc,
.module-description,
.empty-state p,
.card-meta,
.recent-sub,
.status-sub,
.footer-field,
.metric-label {
  color: var(--muted);
}

.nav-item {
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid transparent;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.nav-item.active,
.lang-btn.active {
  background: var(--ink);
  color: var(--surface);
  box-shadow: none;
}

.model-card {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 12px 12px;
  transition: background 120ms ease, border-color 120ms ease;
}
.model-card.active {
  background: var(--ink);
  border-color: var(--ink);
  box-shadow: none;
}
.model-card.active .model-name,
.model-card.active .model-desc,
.model-card.active .model-cost {
  color: var(--surface);
}
.model-cost,
.module-cost,
.tag,
.video-btn.secondary,
.params-toggle,
.footer-field select {
  background: var(--surface-2);
  color: var(--ink-2);
  border-color: var(--line);
  border-radius: 8px;
}

.send-btn,
.auth-primary,
.module-cta,
.home-primary,
.history-modal-use-btn,
.video-btn {
  background: var(--ink);
  color: var(--surface);
  border: 1px solid var(--ink);
  border-radius: 10px;
  box-shadow: none;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.send-btn:hover:not(:disabled),
.auth-primary:hover:not(:disabled),
.module-cta:hover:not(:disabled),
.home-primary:hover {
  background: #2b2b2b;
  box-shadow: none;
  transform: none;
}
.send-btn:disabled,
.auth-primary:disabled,
.module-cta:disabled {
  background: var(--ink) !important;
  color: var(--surface) !important;
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none !important;
}

.message.user .message-bubble {
  background: var(--ink);
  color: var(--surface);
  box-shadow: none;
}
.message.assistant .message-avatar {
  background: var(--ink);
  border-color: var(--ink);
}
.progress-fill,
.quota-fill {
  background: var(--ink);
}

.auth-page {
  min-height: 100vh;
  background: var(--surface);
  align-items: center;
  justify-content: center;
  overflow: auto;
}
.auth-page::before,
.auth-hero,
.hero-glass-orb {
  display: none;
}
.auth-shell {
  max-width: 420px;
  margin: 0 auto;
  padding: 24px;
}
.auth-card {
  width: 100%;
  padding: 36px;
  border: 1px solid var(--line);
  animation: none;
}
.auth-brand {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 28px;
}
.auth-panel h2 {
  font-size: 28px;
  font-weight: 650;
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: 0;
  white-space: normal;
}
.auth-form label {
  color: var(--ink-2);
}
.auth-form input {
  background: var(--surface);
  border-color: var(--line-strong);
  border-radius: 10px;
  color: var(--ink);
}
.auth-form input:focus,
.composer:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.08);
}
.auth-error,
.auth-success {
  border-left: none;
  border: 1px solid currentColor;
  border-radius: 10px;
}

.home-shell {
  width: min(1040px, 100%);
  margin: 0 auto;
}
.home-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.home-head h1 {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.2;
  font-weight: 650;
  color: var(--ink);
  letter-spacing: 0;
}
.home-head p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}
.home-primary {
  height: 40px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}
.quota-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(260px, 0.9fr);
  gap: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
}
.quota-main {
  padding: 32px;
  border-right: 1px solid var(--line);
}
.quota-label,
.quota-unit,
.quota-side span,
.quota-progress-row span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.quota-main strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 52px;
  line-height: 1;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.quota-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.quota-side > div {
  padding: 32px 28px;
}
.quota-side > div + div {
  border-left: 1px solid var(--line);
}
.quota-side strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.quota-progress {
  grid-column: 1 / -1;
  padding: 22px 32px 28px;
  border-top: 1px solid var(--line);
}
.quota-progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.quota-progress-row strong {
  font-size: 14px;
  color: var(--ink);
}
.quota-track {
  height: 8px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}
.quota-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 180ms ease;
}
.home-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.home-action {
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  padding: 18px 20px;
  cursor: pointer;
}
.home-action span {
  display: block;
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  margin-bottom: 6px;
}
.home-action strong {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
}

.chat-main.model-switch-animate {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 860px) {
  .home-head,
  .home-actions {
    grid-template-columns: 1fr;
  }
  .home-head {
    display: grid;
  }
  .quota-panel {
    grid-template-columns: 1fr;
  }
  .quota-main {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 600px) {
  .auth-shell {
    padding: 16px;
  }
  .auth-card {
    border-radius: 12px;
    padding: 28px 20px;
  }
  .quota-main strong {
    font-size: 42px;
  }
  .quota-side {
    grid-template-columns: 1fr;
  }
  .quota-side > div + div {
    border-left: none;
    border-top: 1px solid var(--line);
  }
  .nav-menu,
  .nav-item {
    min-width: 0;
    max-width: 100%;
  }
  .nav-item {
    white-space: normal;
  }
}

/* Remove legacy blue inline fragments across older pages. */
[style*="#2563EB"],
[style*="#1d4ed8"],
[style*="#eff6ff"],
[style*="#60a5fa"] {
  border-color: var(--line) !important;
}
[style*="color:#2563EB"],
[style*="color: #2563EB"],
[style*="color:#1d4ed8"],
[style*="color: #1d4ed8"] {
  color: var(--ink) !important;
}
[style*="background:#2563EB"],
[style*="background: #2563EB"],
[style*="background:#1d4ed8"],
[style*="background: #1d4ed8"],
[style*="background:linear-gradient"],
[style*="background: linear-gradient"] {
  background: var(--ink) !important;
  color: var(--surface) !important;
}
[style*="background:#eff6ff"],
[style*="background: #eff6ff"] {
  background: var(--surface-2) !important;
}
svg[stroke="#2563EB"] {
  stroke: var(--ink) !important;
}
a[style*="#2563EB"] {
  color: var(--ink) !important;
}

.announcement-bar,
.announcement-bar.type-info,
.announcement-bar.type-warning,
.announcement-bar.type-success,
.announcement-bar.type-danger {
  background: #fafafa !important;
  border-color: var(--line) !important;
  color: var(--ink) !important;
}
.announcement-close {
  color: var(--muted) !important;
}
.announcement-icon {
  filter: grayscale(1) contrast(1.2);
}
.model-maintenance-badge,
.module-maintenance-badge,
.history-modal-status.success,
.history-modal-status.refunded,
.history-modal-status.pending {
  background: var(--surface-2) !important;
  border: 1px solid var(--line) !important;
  color: var(--muted) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}
.model-card.active,
.model-card.active:focus,
.model-card.active:focus-visible {
  background: var(--ink) !important;
  border-color: var(--ink) !important;
  outline: 2px solid var(--ink) !important;
  outline-offset: 2px;
}
.model-card:focus-visible,
.nav-item:focus-visible,
.home-action:focus-visible,
.home-primary:focus-visible,
.send-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.model-card.active .model-cost {
  background: #2b2b2b !important;
  border-color: #2b2b2b !important;
  color: var(--surface) !important;
}

/* Immersive chat surface: controls live with the composer, content stays clear. */
.chat-container {
  display: block;
  min-height: calc(100vh - 56px);
  background: transparent;
}
.chat-container .dashboard-sidebar,
.chat-container .model-sidebar,
.chat-container .sidebar-expand-btn {
  display: none !important;
}
.chat-main-wrapper {
  display: block;
  width: 100%;
  min-height: calc(100vh - 56px);
}
.chat-main {
  min-height: calc(100vh - 56px);
  background: transparent !important;
}
.chat-messages {
  width: min(960px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0 230px;
  background: transparent !important;
}
.chat-input-area {
  position: fixed;
  left: 50%;
  bottom: 18px;
  width: min(1120px, calc(100vw - 32px));
  transform: translateX(-50%);
  z-index: 90;
  padding: 34px 28px 8px;
  border-top: 0 !important;
  background: transparent !important;
  pointer-events: none;
}
.chat-input-area > * {
  pointer-events: auto;
}
.top-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0 18px;
  pointer-events: none;
  transform: translateY(8px);
  transition: max-height 240ms ease, padding 240ms ease, opacity 160ms ease, transform 220ms ease;
}
.chat-input-area:hover .top-controls,
.chat-input-area:focus-within .top-controls {
  max-height: 76px;
  opacity: 1;
  padding: 0 18px 10px;
  pointer-events: auto;
  transform: translateY(0);
}
.model-select,
.footer-field select,
.param-item select {
  height: 38px;
  border-radius: 999px !important;
  border: 1px solid var(--line) !important;
  background-color: var(--surface-2) !important;
  color: var(--ink) !important;
  padding: 0 36px 0 14px !important;
  font-size: 13px !important;
  outline: none;
  cursor: pointer;
  appearance: none;
  font-family: inherit;
  background-image:
    linear-gradient(45deg, transparent 50%, #525252 50%),
    linear-gradient(135deg, #525252 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 16px,
    calc(100% - 12px) 16px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.model-select {
  min-width: 245px;
  max-width: min(360px, 100%);
}
.model-select:hover,
.footer-field select:hover,
.param-item select:hover {
  background-color: var(--surface-3) !important;
  border-color: var(--line-strong) !important;
}
.model-select:focus-visible,
.footer-field select:focus-visible,
.param-item select:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.inline-params {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.inline-hint {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
.params-panel,
#favPanel {
  width: min(100%, 760px);
  margin: 0 auto 10px !important;
  background: var(--surface) !important;
}
.params-extra {
  flex-wrap: wrap;
}
.params-extra input {
  min-width: min(220px, 100%);
}
.composer {
  width: min(622px, calc(100vw - 32px));
  margin: 0 auto;
  background: var(--surface) !important;
}
.chat-input-area:hover .composer,
.chat-input-area:focus-within .composer {
  width: min(100%, 1064px);
}
.composer-footer {
  gap: 12px;
  background: var(--surface) !important;
}
.footer-left {
  gap: 10px;
}
.legacy-footer-controls {
  display: none !important;
}
.footer-field {
  color: var(--muted);
  font-size: 13px;
}
.footer-field select {
  min-width: 112px;
}
.params-toggle {
  border-radius: 999px !important;
}
.prompt-box textarea {
  background: transparent !important;
}

@media (max-width: 760px) {
  .chat-messages {
    width: calc(100vw - 24px);
    padding-bottom: 260px;
  }
  .chat-input-area {
    width: calc(100vw - 16px);
    bottom: 8px;
    padding: 24px 8px 8px;
  }
  .top-controls {
    flex-direction: column;
    align-items: stretch;
    padding-left: 8px;
    padding-right: 8px;
  }
  .chat-input-area:hover .top-controls,
  .chat-input-area:focus-within .top-controls {
    max-height: 120px;
  }
  .model-select {
    width: 100%;
    min-width: 0;
  }
  .inline-hint {
    white-space: normal;
  }
  .composer-footer {
    align-items: stretch;
    flex-direction: column;
  }
  .footer-left {
    width: 100%;
  }
}

/* Bottom hover composer integrated from optimized-hover-chatbox-v2.html. */
:root {
  --chat-collapsed-width: 622px;
  --chat-collapsed-height: 72px;
  --chat-expanded-width: min(1120px, calc(100vw - 32px));
}

.chat-container {
  display: block;
  min-height: calc(100vh - 56px);
  background: transparent;
}

.chat-container .dashboard-sidebar,
.chat-container .model-sidebar,
.chat-container .sidebar-expand-btn {
  display: none !important;
}

.chat-main-wrapper,
.chat-main {
  display: block;
  width: 100%;
  min-height: calc(100vh - 56px);
  background: transparent !important;
}

.chat-messages {
  width: min(960px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0 230px;
  background: transparent !important;
}

.bottom-hover-zone {
  position: fixed;
  left: 50%;
  bottom: 22px;
  width: var(--chat-expanded-width);
  padding: 34px 28px 10px;
  transform: translateX(-50%);
  z-index: 90;
  border: 0 !important;
  background: transparent !important;
  pointer-events: none;
}

.bottom-hover-zone * {
  box-sizing: border-box;
}

.chat-wrapper {
  width: min(var(--chat-collapsed-width), calc(100vw - 32px));
  height: var(--chat-collapsed-height);
  margin: 0 auto;
  opacity: 0.84;
  filter: saturate(0.92);
  transform: translateY(10px) scale(0.98);
  transform-origin: bottom center;
  transition:
    width 0.46s cubic-bezier(.2,.8,.2,1),
    height 0.46s cubic-bezier(.2,.8,.2,1),
    transform 0.42s cubic-bezier(.2,.8,.2,1),
    opacity 0.28s ease,
    filter 0.28s ease;
  pointer-events: auto;
  will-change: width, height, transform, opacity;
}

.bottom-hover-zone:hover .chat-wrapper,
.bottom-hover-zone:focus-within .chat-wrapper,
.chat-wrapper:focus-within {
  width: 100%;
  height: auto;
  opacity: 1;
  filter: saturate(1);
  transform: translateY(0) scale(1);
}

.chat-box {
  width: 100%;
  max-height: var(--chat-collapsed-height);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.06);
  transition:
    max-height 0.46s cubic-bezier(.2,.8,.2,1),
    border-color 0.25s ease,
    box-shadow 0.36s ease,
    border-radius 0.28s ease;
}

.bottom-hover-zone:hover .chat-box,
.bottom-hover-zone:focus-within .chat-box,
.chat-box:focus-within {
  max-height: 390px;
  border-radius: 30px;
  border-color: var(--line-strong);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.13),
    0 0 0 4px rgba(0, 0, 0, 0.018);
}

.bottom-hover-zone .top-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  max-height: 0;
  padding: 0 18px;
  opacity: 0;
  pointer-events: none;
  background: var(--surface);
  flex-wrap: wrap;
  overflow: hidden;
  transform: translateY(8px);
  transition:
    max-height 0.34s cubic-bezier(.2,.8,.2,1),
    padding 0.34s cubic-bezier(.2,.8,.2,1),
    opacity 0.2s ease,
    transform 0.32s cubic-bezier(.2,.8,.2,1);
}

.bottom-hover-zone:hover .top-controls,
.bottom-hover-zone:focus-within .top-controls,
.chat-wrapper:focus-within .top-controls {
  max-height: 86px;
  padding: 14px 18px 10px;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.model-select,
.inline-param select {
  height: 38px;
  border-radius: 999px !important;
  border: 1px solid var(--line) !important;
  background-color: var(--surface-2) !important;
  color: var(--ink) !important;
  padding: 0 36px 0 14px !important;
  font-size: 13px !important;
  outline: none;
  cursor: pointer;
  appearance: none;
  font-family: inherit;
  transition: background 0.18s ease, border-color 0.18s ease;
  background-image:
    linear-gradient(45deg, transparent 50%, #555 50%),
    linear-gradient(135deg, #555 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 16px,
    calc(100% - 12px) 16px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.model-select {
  min-width: 245px;
}

.model-select:hover,
.inline-param select:hover {
  background-color: var(--surface-3) !important;
  border-color: var(--line-strong) !important;
}

.inline-params {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.inline-param {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.inline-param label,
.inline-param span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.inline-param select {
  min-width: 106px;
  max-width: 190px;
}

.auto-retry-control input {
  margin: 0;
  accent-color: var(--ink);
}

.bottom-hover-zone .params-panel,
.bottom-hover-zone #favPanel {
  display: none !important;
}

.input-area {
  padding: 0;
  background: var(--surface);
  transition: padding 0.36s cubic-bezier(.2,.8,.2,1);
}

.bottom-hover-zone:hover .input-area,
.bottom-hover-zone:focus-within .input-area,
.chat-wrapper:focus-within .input-area {
  padding: 0 16px 16px;
}

.input-shell {
  position: relative;
  height: var(--chat-collapsed-height);
  min-height: var(--chat-collapsed-height);
  border: 0 solid transparent;
  background: var(--surface);
  border-radius: 999px;
  overflow: hidden;
  transition:
    height 0.42s cubic-bezier(.2,.8,.2,1),
    min-height 0.42s cubic-bezier(.2,.8,.2,1),
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    border-radius 0.28s ease;
}

.bottom-hover-zone:hover .input-shell,
.bottom-hover-zone:focus-within .input-shell,
.input-shell:focus-within {
  height: auto;
  min-height: 176px;
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.025);
}

.upload-stack-wrap {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 172px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  z-index: 5;
  opacity: 0.86;
  transform: translateY(-50%) scale(0.56);
  transform-origin: left center;
  transition:
    left 0.36s cubic-bezier(.2,.8,.2,1),
    top 0.36s cubic-bezier(.2,.8,.2,1),
    transform 0.36s cubic-bezier(.2,.8,.2,1),
    opacity 0.25s ease;
}

.bottom-hover-zone:hover .upload-stack-wrap,
.bottom-hover-zone:focus-within .upload-stack-wrap,
.input-shell:focus-within .upload-stack-wrap {
  left: 16px;
  top: 50%;
  transform: translateY(-50%) scale(1);
  opacity: 1;
}

.upload-stack-canvas {
  position: relative;
  width: 172px;
  height: 98px;
}

.stack-card {
  position: absolute;
  width: 62px;
  height: 84px;
  border-radius: 14px;
  background: #f3f3f3;
  border: 1px solid #e4e4e4;
  overflow: visible;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.stack-card-inner {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #f3f3f3;
}

.stack-card.image-card:hover {
  transform: translateY(-6px) scale(1.04);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  z-index: 999 !important;
}

.stack-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.stack-card.add-card {
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #8d98a3;
  background: #f3f3f3;
  overflow: hidden;
}

.stack-card.add-card:hover {
  background: #efefef;
  border-color: #d8d8d8;
  transform: translateY(-3px);
  z-index: 800 !important;
}

.stack-card.uploading {
  opacity: 0.72;
}

.add-plus {
  font-size: 34px;
  line-height: 1;
  font-weight: 300;
  transform: translateY(-1px);
  pointer-events: none;
}

.remove-btn {
  position: absolute;
  right: -7px;
  top: -7px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.9);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.85);
  transition: 0.16s ease;
  z-index: 1000;
  display: grid;
  place-items: center;
}

.image-card:hover .remove-btn,
.remove-btn:focus-visible {
  opacity: 1;
  transform: scale(1);
}

.image-tag {
  position: absolute;
  left: 5px;
  bottom: 5px;
  max-width: calc(100% - 10px);
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.upload-count {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  padding-left: 4px;
  user-select: none;
  opacity: 0;
  transition: opacity 0.22s ease, color 0.2s ease;
}

.bottom-hover-zone:hover .upload-count,
.bottom-hover-zone:focus-within .upload-count,
.input-shell:focus-within .upload-count {
  opacity: 1;
}

.prompt-input {
  width: 100%;
  height: var(--chat-collapsed-height);
  min-height: var(--chat-collapsed-height);
  max-height: 260px;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  padding: 24px 72px 18px 108px;
  font-family: inherit;
  display: block;
  overflow: hidden;
  transition:
    height 0.36s cubic-bezier(.2,.8,.2,1),
    min-height 0.36s cubic-bezier(.2,.8,.2,1),
    padding 0.36s cubic-bezier(.2,.8,.2,1),
    font-size 0.2s ease,
    line-height 0.2s ease;
}

.bottom-hover-zone:hover .prompt-input,
.bottom-hover-zone:focus-within .prompt-input,
.prompt-input:focus {
  height: auto;
  min-height: 174px;
  font-size: 16px;
  line-height: 1.7;
  padding: 24px 72px 22px 198px;
  overflow: auto;
}

.prompt-input::placeholder {
  color: transparent !important;
}

.bottom-hover-zone .send-btn {
  position: absolute;
  right: 14px;
  bottom: 50%;
  transform: translateY(50%) scale(0.9);
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: var(--ink);
  color: var(--surface);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition:
    right 0.22s ease,
    width 0.22s ease,
    height 0.22s ease,
    transform 0.22s ease,
    background 0.18s ease,
    opacity 0.2s ease,
    bottom 0.32s cubic-bezier(.2,.8,.2,1);
  z-index: 6;
  opacity: 0.76;
}

.bottom-hover-zone:hover .send-btn,
.bottom-hover-zone:focus-within .send-btn,
.input-shell:focus-within .send-btn {
  right: 16px;
  bottom: 16px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  transform: translateY(0) scale(1);
  opacity: 1;
}

.bottom-hover-zone .send-btn:hover:not(:disabled) {
  background: #000;
  transform: translateY(0) scale(1.04);
}

.bottom-hover-zone .send-btn:active {
  transform: translateY(0) scale(0.96);
}

.bottom-hover-zone .send-btn svg {
  width: 19px;
  height: 19px;
}

.bottom-hover-zone .send-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.hidden-input {
  display: none;
}

@media (max-width: 900px) {
  :root {
    --chat-expanded-width: calc(100vw - 20px);
  }

  .bottom-hover-zone {
    bottom: 10px;
    padding: 24px 0 8px;
  }

  .chat-wrapper {
    width: min(var(--chat-collapsed-width), calc(100vw - 20px));
  }
}

@media (max-width: 768px) {
  .bottom-hover-zone {
    width: calc(100vw - 20px);
    padding: 16px 0 4px;
  }

  .chat-wrapper {
    width: 100%;
    height: auto;
    transform: none;
    opacity: 1;
    filter: none;
  }

  .chat-box {
    max-height: none;
    border-radius: 24px;
  }

  .bottom-hover-zone .top-controls {
    max-height: none;
    padding: 14px 18px 10px;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    align-items: stretch;
  }

  .model-select {
    width: 100%;
    min-width: 100%;
  }

  .inline-params {
    width: 100%;
  }

  .inline-param {
    flex: 1;
    min-width: 150px;
  }

  .inline-param select {
    width: 100%;
    max-width: none;
  }

  .input-area {
    padding: 0 16px 16px;
  }

  .input-shell {
    height: auto;
    min-height: 230px;
    border: 1px solid var(--line);
    border-radius: 26px;
  }

  .bottom-hover-zone:hover .input-shell,
  .bottom-hover-zone:focus-within .input-shell,
  .input-shell:focus-within {
    min-height: 230px;
  }

  .upload-stack-wrap {
    left: 16px;
    top: 20px;
    transform: none;
    opacity: 1;
  }

  .bottom-hover-zone:hover .upload-stack-wrap,
  .bottom-hover-zone:focus-within .upload-stack-wrap,
  .input-shell:focus-within .upload-stack-wrap {
    transform: scale(1.02);
  }

  .upload-count {
    opacity: 1;
  }

  .prompt-input {
    height: auto;
    min-height: 230px;
    padding: 128px 64px 22px 18px;
    font-size: 15px;
    line-height: 1.7;
    overflow: auto;
  }

  .bottom-hover-zone:hover .prompt-input,
  .bottom-hover-zone:focus-within .prompt-input,
  .prompt-input:focus {
    min-height: 230px;
    padding: 128px 64px 22px 18px;
  }

  .bottom-hover-zone .send-btn {
    right: 14px;
    bottom: 14px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    transform: none;
    opacity: 1;
  }

  .bottom-hover-zone:hover .send-btn,
  .bottom-hover-zone:focus-within .send-btn,
  .input-shell:focus-within .send-btn {
    bottom: 14px;
    transform: none;
  }
}
