:root {
  --bg-primary: #212121;
  --bg-secondary: #171717;
  --bg-surface: #2f2f2f;
  --bg-surface-hover: #383838;
  --bg-surface-active: #424242;
  --bg-input: #2f2f2f;
  
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);
  
  --text-primary: #ececec;
  --text-secondary: #b4b4b4;
  --text-tertiary: #8e8e8e;
  --text-placeholder: #666666;
  
  --brand: #ffffff;
  --brand-invert: #000000;
  --accent: #10a37f;
  --accent-hover: #1a7f64;
  --accent-subtle: rgba(16, 163, 127, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.5);
  
  --sidebar-width: 260px;
  --topbar-height: 56px;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f9f9f9;
  --bg-surface: #f3f3f3;
  --bg-surface-hover: #e8e8e8;
  --bg-surface-active: #dddddd;
  --bg-input: #f4f4f4;
  
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);
  
  --text-primary: #111111;
  --text-secondary: #555555;
  --text-tertiary: #888888;
  --text-placeholder: #a0a0a0;
  
  --brand: #000000;
  --brand-invert: #ffffff;
  --accent: #10a37f;
  --accent-hover: #1a7f64;
  --accent-subtle: rgba(16, 163, 127, 0.1);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.1);
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  overflow: hidden;
  user-select: none;
}

/* 布局结构 */
.app-layout {
  display: flex;
  width: 100vw;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.25s ease, margin-left 0.25s ease;
  z-index: 50;
}

.sidebar.collapsed {
  margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.brand-btn:hover {
  background-color: var(--bg-surface);
}

.brand-icon {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

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

.new-chat-btn {
  margin: 4px 16px 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.new-chat-btn:hover {
  background-color: var(--bg-surface);
  border-color: var(--border-strong);
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  padding: 12px 10px 6px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  group: hover;
}

.history-item:hover,
.history-item.active {
  background-color: var(--bg-surface);
  color: var(--text-primary);
}

.history-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.history-item-del {
  display: none;
  color: var(--text-tertiary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
}

.history-item:hover .history-item-del {
  display: flex;
}

.history-item-del:hover {
  color: var(--danger);
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-user-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}

.sidebar-user-pill:hover {
  background-color: var(--bg-surface);
}

/* 主内容工作区 */
.main-workspace {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--bg-primary);
  overflow: hidden;
}

/* 顶栏 */
.top-nav {
  min-height: var(--topbar-height);
  padding: env(safe-area-inset-top, 0px) 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-primary);
  z-index: 20;
  flex-shrink: 0;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.model-badge-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.model-badge-btn:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.model-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent);
}

.top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 聊天与内容展示区 */
.chat-container {
  flex: 1;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  padding-bottom: 180px; /* 留出底部悬浮输入框空间 */
  scroll-behavior: smooth;
}

/* 欢迎页空状态 */
.welcome-view {
  max-width: 820px;
  margin: 0 auto;
  padding: 48px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  min-height: 100%;
  justify-content: center;
}

.welcome-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.welcome-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.welcome-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 36px;
  max-width: 480px;
  line-height: 1.5;
}

.prompts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 760px;
}

.prompt-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prompt-card:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.prompt-card-tag {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent);
}

.prompt-card-text {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-primary);
}

/* 消息流组件 */
.messages-stream {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.turn-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 用户 Prompt 泡泡 */
.user-turn {
  align-self: flex-end;
  max-width: 80%;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 12px 18px;
  border-radius: 20px 20px 4px 20px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  user-select: text;
  word-break: break-word;
  display: flex;
  flex-direction: column;
}

.user-ref-img-card {
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-width: 140px;
  max-height: 140px;
  border: 1px solid var(--border-strong);
  background-color: #000;
  cursor: zoom-in;
  transition: var(--transition);
}

.user-ref-img-card:hover {
  transform: scale(1.02);
}

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

/* 助手生成结果 */
.assistant-turn {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.turn-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.turn-model-name {
  font-weight: 500;
  color: var(--text-secondary);
}

/* 图片展示卡片 */
.image-result-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  max-width: 640px;
  width: 100%;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.image-result-card:hover {
  border-color: var(--border-strong);
}

.image-box {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #121212;
  cursor: zoom-in;
}

.image-box img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  max-height: 600px;
}

/* 加载态骨架 */
.image-box.loading {
  height: 380px;
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-surface-hover) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.8s infinite;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  cursor: default;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.loading-text {
  font-size: 13px;
  color: var(--text-secondary);
}

.card-actions-bar {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  font-size: 13px;
}

.card-action-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}

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

/* 底部浮动控制台 */
.floating-bottom-dock {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(33, 33, 33, 0) 0%, var(--bg-primary) 35%, var(--bg-primary) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 30;
  pointer-events: none;
}

[data-theme="light"] .floating-bottom-dock {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, var(--bg-primary) 35%, var(--bg-primary) 100%);
}

.dock-content {
  width: 100%;
  max-width: 820px;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 参数调节浮窗 / 药丸快捷条与自定义下拉 */
.params-quick-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: visible;
  padding: 4px 6px;
  position: relative;
  z-index: 40;
}

.custom-dropdown {
  position: relative;
}

.quick-select-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.quick-select-pill:hover,
.quick-select-pill.open {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.pill-label {
  color: var(--text-tertiary);
  font-size: 11px;
}

.pill-value {
  font-weight: 500;
  color: var(--text-primary);
}

.dropdown-chevron {
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.quick-select-pill.open .dropdown-chevron {
  transform: rotate(180deg);
}

/* 下拉菜单面板（向上弹出） */
.dropdown-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 175px;
  background-color: #262626;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 100;
  animation: dropUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .dropdown-menu {
  background-color: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

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

.dropdown-menu.show {
  display: flex;
}

.dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #cfcfcf;
  cursor: pointer;
  transition: var(--transition);
}

[data-theme="light"] .dropdown-item {
  color: #333333;
}

.dropdown-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

[data-theme="light"] .dropdown-item:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: #000000;
}

.dropdown-item.active {
  background-color: var(--accent-subtle);
  color: var(--accent);
  font-weight: 500;
}

.check-icon {
  display: none;
  color: var(--accent);
}

.dropdown-item.active .check-icon {
  display: block;
}

/* 主输入胶囊框 */
.input-capsule {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition);
}

.input-capsule:focus-within {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 1px var(--border-strong), var(--shadow-lg);
}

/* 参考图待发预览条 */
.ref-image-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 4px;
}

.ref-image-thumb-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background-color: #000000;
  flex-shrink: 0;
}

.ref-image-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ref-image-del-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.ref-image-del-btn:hover {
  background-color: var(--danger);
  transform: scale(1.1);
}

.ref-image-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.ref-image-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ref-image-name {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.prompt-textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  max-height: 180px;
  min-height: 24px;
}

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

.capsule-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.capsule-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 5px 10px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.tool-btn:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.hint-text {
  font-size: 11px;
  color: var(--text-tertiary);
}

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--brand);
  color: var(--brand-invert);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

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

.send-btn:not(:disabled):hover {
  transform: scale(1.05);
}

/* 模态弹窗 Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 16px;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-card {
  transform: scale(1);
}

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

.modal-title {
  font-size: 16px;
  font-weight: 600;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 75vh;
  overflow-y: auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-input, .form-select {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}

.form-select option {
  background-color: #262626;
  color: #ececec;
  padding: 8px 12px;
}

[data-theme="light"] .form-select option {
  background-color: #ffffff;
  color: #111111;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent);
}

.form-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.4;
}

.modal-footer {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border-subtle);
}

.btn-secondary {
  padding: 8px 16px;
  background-color: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
}

.btn-primary {
  padding: 8px 18px;
  background-color: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
}

/* 灯箱 Lightbox */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  user-select: none;
}

.lightbox-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Toast 提示通知 */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 300;
  pointer-events: none;
}

.toast {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.error {
  border-color: var(--danger);
  background-color: #2a1515;
  color: #fca5a5;
}

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

/* 响应式支持 */
@media (max-width: 768px) {
  #mobileToggleSidebarBtn {
    display: flex !important;
  }

  .top-nav {
    min-height: 52px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .model-badge-btn {
    padding: 4px 10px;
    font-size: 12px;
    max-width: 170px;
  }

  #currentModelText {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .welcome-view {
    padding: 32px 16px 20px;
    min-height: auto;
    justify-content: flex-start;
  }

  .welcome-title {
    font-size: 22px;
    margin-bottom: 6px;
    line-height: 1.3;
  }

  .welcome-subtitle {
    font-size: 13px;
    margin-bottom: 24px;
  }

  .prompts-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .prompt-card {
    padding: 12px 14px;
  }

  .chat-container {
    padding-bottom: calc(210px + env(safe-area-inset-bottom, 0px));
  }

  .floating-bottom-dock {
    padding: 6px 12px calc(14px + env(safe-area-inset-bottom, 0px));
  }

  /* 移动端参数条：让三个药丸均匀平分容器宽度，自适应任何窄屏，绝不溢出或遮挡 */
  .params-quick-bar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    overflow-x: visible;
    padding: 4px 0;
  }

  .custom-dropdown {
    flex: 1;
    min-width: 0;
  }

  .quick-select-pill {
    width: 100%;
    padding: 6px 8px;
    font-size: 11px;
    gap: 4px;
    white-space: nowrap;
    justify-content: space-between;
  }

  .pill-label {
    font-size: 10px;
    flex-shrink: 0;
  }

  .pill-value {
    max-width: none;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
  }

  .dropdown-chevron {
    flex-shrink: 0;
  }

  /* 移动端弹出菜单定位防护：根据屏幕防止边缘超出 */
  .dropdown-menu {
    min-width: 160px;
    max-width: 85vw;
  }

  #dropdownStyle .dropdown-menu {
    left: auto;
    right: 0;
  }

  .input-capsule {
    padding: 10px 14px;
  }

  .prompt-textarea {
    font-size: 16px; /* 防止 iOS Safari 自动缩放页面 */
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    margin-left: 0 !important;
  }
  
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 45;
  }
  
  .sidebar-backdrop.active {
    display: block;
  }
}
