/* ===== 基础重置 ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue',
               'Microsoft YaHei', sans-serif;
  color: #e9ecf3;
  background: #0a0b14;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; color: inherit;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .2s;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(124, 92, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18);
}
/* 隐藏 number 输入框的加减按钮 */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}
input[type=number] { -moz-appearance: textfield; }
.hidden { display: none !important; }
.muted { color: #8a8fa3; }
.small { font-size: 12px; }

/* ===== 背景 ===== */
.bg-gradient, .login-bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 600px at 12% -10%, rgba(120, 90, 255, 0.35), transparent 60%),
    radial-gradient(800px 500px at 95% 10%, rgba(64, 200, 255, 0.25), transparent 55%),
    radial-gradient(700px 500px at 80% 110%, rgba(255, 100, 200, 0.20), transparent 60%),
    linear-gradient(180deg, #0b0d18 0%, #07080f 100%);
}

/* ===== Glass ===== */
.glass {
  background: rgba(20, 22, 38, 0.55);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

/* ===== 按钮 ===== */
.btn-primary {
  background: linear-gradient(135deg, #7c5cff 0%, #4ab0ff 100%);
  border: none; color: #fff;
  padding: 12px 22px; border-radius: 12px;
  font-weight: 600; letter-spacing: .5px;
  transition: transform .15s, box-shadow .2s;
  box-shadow: 0 8px 24px rgba(124, 92, 255, 0.4);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(124, 92, 255, 0.55); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary.big { padding: 14px 28px; font-size: 15px; }
.btn-primary .bolt { margin-right: 6px; }

/* 紧凑尺寸（弹窗确认/取消）：文字不变，减小外框 */
.btn-primary.btn-sm { padding: 6px 14px; font-size: 13px; box-shadow: 0 4px 12px rgba(124, 92, 255, 0.3); }
.btn-ghost.btn-sm { padding: 6px 14px; font-size: 13px; }

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e9ecf3; padding: 8px 14px; border-radius: 10px;
  transition: background .2s;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }
#settings-btn {
  font-size: 20px;
  padding: 8px 12px;
  line-height: 1;
}

/* ===== 登录页 ===== */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  width: 380px; padding: 36px 32px;
  display: flex; flex-direction: column; gap: 18px;
}
.brand { text-align: center; }
.brand-logo {
  width: 56px; height: 56px; margin: 0 auto 10px;
  border-radius: 14px;
  background: conic-gradient(from 210deg at 50% 50%,
    #7c5cff, #4ab0ff, #ff6cc8, #7c5cff);
  box-shadow: 0 8px 30px rgba(124, 92, 255, 0.55);
}
.brand-logo.small { width: 30px; height: 30px; border-radius: 9px; box-shadow: 0 4px 14px rgba(124,92,255,.5); }
.brand-title { font-size: 22px; font-weight: 700; }
.brand-sub { color: #8a8fa3; font-size: 13px; margin-top: 4px; }

.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #b8bdcc; }
.login-form input { padding: 12px 14px; }
.err-msg { color: #ff7c7c; min-height: 18px; font-size: 13px; }
.login-tip { color: #6c7185; font-size: 12px; text-align: center; }

/* ===== 主应用顶栏 ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px;
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(12px);
  background: rgba(10, 11, 20, 0.6);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.brand-name { font-weight: 700; font-size: 18px; }
.brand-tag {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(124,92,255,.3), rgba(74,176,255,.3));
  border: 1px solid rgba(124,92,255,.4);
  color: #c5b8ff;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-info { font-size: 13px; color: #b8bdcc; }

/* ===== 主区域 ===== */
.main {
  max-width: 980px; margin: 0 auto;
  padding: 40px 24px 80px;
  display: flex; flex-direction: column; gap: 28px;
}
.hero { text-align: center; padding: 30px 0 6px; }
.hero-title { font-size: 38px; font-weight: 800; margin: 0; }
.grad-text {
  background: linear-gradient(135deg, #7c5cff, #4ab0ff 50%, #ff6cc8);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.hero-sub { color: #8a8fa3; margin: 12px 0 0; }

/* ===== Tabs ===== */
.tabs {
  display: inline-flex; align-self: center; padding: 6px;
  border-radius: 14px;
}
.tab-btn {
  background: transparent; border: none; color: #b8bdcc;
  padding: 10px 22px; border-radius: 10px;
  font-size: 14px; transition: all .2s;
}
.tab-btn:hover { color: #fff; }
.tab-btn.active {
  background: linear-gradient(135deg, rgba(124,92,255,.35), rgba(74,176,255,.35));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}

/* ===== Composer ===== */
.composer { padding: 22px; display: flex; flex-direction: column; gap: 16px; }

/* 提示词容器 */
.prompt-container {
}
.prompt {
  width: 100%; min-height: 120px; resize: vertical;
  font-size: 15px; line-height: 1.6;
  padding: 14px 16px;
}
/* 自动提示词：与原始 textarea 完全共享 .prompt 样式，仅多一个流式状态 */
.auto-prompt {
  /* 无额外定位，与原始 textarea 互斥显示，切换时视觉完全一致 */
}
/* 流式生成中：边框脉冲提示 */
.auto-prompt.streaming {
  border-color: rgba(124, 92, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.12);
  animation: stream-pulse 1.2s ease-in-out infinite;
}
@keyframes stream-pulse {
  0%, 100% { border-color: rgba(124, 92, 255, 0.5); }
  50% { border-color: rgba(124, 92, 255, 0.2); }
}

/* 提示词操作行 */
.prompt-tools {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.prompt-btn {
  background: rgba(124, 92, 255, 0.12);
  border: 1px solid rgba(124, 92, 255, 0.35);
  color: #c5b8ff;
  font-size: 12px; padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s, border-color .2s, opacity .2s;
  white-space: nowrap;
}
.prompt-btn:hover:not(:disabled) {
  background: rgba(124, 92, 255, 0.22);
  border-color: rgba(124, 92, 255, 0.6);
}
.prompt-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* 提示词切换开关 */
.prompt-toggle {
  display: inline-flex;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-left: auto;
}
.toggle-opt {
  background: rgba(255, 255, 255, 0.04);
  border: none;
  color: #8a8fa3;
  font-size: 11px;
  padding: 5px 12px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.toggle-opt.active {
  background: rgba(124, 92, 255, 0.25);
  color: #fff;
}
.toggle-opt:hover:not(.active) {
  background: rgba(255, 255, 255, 0.08);
  color: #d8dbe5;
}
.composer-bottom {
  display: flex; gap: 16px; align-items: flex-end;
  flex-wrap: wrap; justify-content: space-between;
}
.params { display: flex; gap: 12px; flex-wrap: wrap; }
.param { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: #8a8fa3; }
.param select, .param input { min-width: 130px; padding: 8px 10px; }

/* ===== 图片上传 ===== */
.image-area { display: flex; flex-direction: column; gap: 8px; }
.image-drop {
  position: relative;
  width: 100%; height: 200px;
  border: 1.5px dashed rgba(255,255,255,0.18);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; overflow: hidden;
  background: rgba(255,255,255,0.02);
  transition: border-color .2s, background .2s;
}
.image-drop:hover, .image-drop.dragover {
  border-color: rgba(124,92,255,.65);
  background: rgba(124,92,255,.06);
}
.image-placeholder { text-align: center; color: #8a8fa3; }
.upload-icon {
  font-size: 30px; line-height: 1;
  margin-bottom: 8px; color: #c5b8ff;
}
#image-preview {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: contain;
  background: #000;
  display: none;
}
#image-preview.show { display: block; }

/* ===== 历史 ===== */
.history { display: flex; flex-direction: column; gap: 14px; }
.history-head { display: flex; align-items: center; justify-content: space-between; }
.history-head h2 { margin: 0; font-size: 18px; }
.history-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.h-card {
  background: rgba(20, 22, 38, 0.55);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column;
  cursor: pointer;
  transition: transform .15s, border-color .2s, box-shadow .2s;
}
.h-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124, 92, 255, 0.35);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}
.h-media {
  position: relative; aspect-ratio: 16 / 9;
  background: #000;
  display: flex; align-items: center; justify-content: center;
}
.h-media video, .h-media img { width: 100%; height: 100%; object-fit: cover; }

/* 视频过期提示 */
.expired-hint {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  color: #8a8fa3; font-size: 13px;
  background: rgba(255,255,255,0.02);
}

/* ===== 全屏时全局切换为 contain，补黑边完整显示 =====
   ⚠️ 必须分别写，不能用逗号串起来。
   原因：selector list 中任何一个不被该浏览器识别的伪类
   会导致整条规则被丢弃。 */
video:fullscreen {
  object-fit: contain !important;
  background: #000;
  width: 100%;
  height: 100%;
}
video:-webkit-full-screen {
  object-fit: contain !important;
  background: #000;
  width: 100%;
  height: 100%;
}
video:-moz-full-screen {
  object-fit: contain !important;
  background: #000;
  width: 100%;
  height: 100%;
}
video:-ms-fullscreen {
  object-fit: contain !important;
  background: #000;
  width: 100%;
  height: 100%;
}
/* 全屏时背景补黑边（该伪元素在全屏时出现）*/
video::backdrop { background: #000; }
video::-webkit-backdrop { background: #000; }
.h-status {
  position: absolute; top: 10px; left: 10px;
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
  background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.15);
}
.h-status.PENDING { color: #ffd070; }
.h-status.RUNNING { color: #4ab0ff; }
.h-status.SUCCEEDED { color: #5fe0a0; }
.h-status.FAILED { color: #ff7c7c; }
.h-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: #7c5cff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.h-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }

/* 卡片操作按钮 */
.h-actions {
  display: flex; gap: 6px;
  padding: 0 14px 12px;
}
.h-act-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #b8bdcc;
  font-size: 11px;
  padding: 6px 0;
  border-radius: 8px;
  transition: background .2s, border-color .2s, color .2s;
  cursor: pointer;
}
.h-act-btn:hover {
  background: rgba(124, 92, 255, 0.12);
  border-color: rgba(124, 92, 255, 0.4);
  color: #e9ecf3;
}
.h-mode {
  font-size: 11px; color: #c5b8ff;
  text-transform: uppercase; letter-spacing: .5px;
}
.h-prompt {
  font-size: 13px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.h-meta { font-size: 11px; color: #6c7185; }
.h-thumb {
  position: absolute; right: 8px; top: 8px;
  width: 36px; height: 36px;
  border-radius: 6px; overflow: hidden;
  border: 1.5px solid rgba(255,255,255,0.4);
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
  background: #000;
}
.h-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ===== 详情模态框 ===== */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal.hidden { display: none; }
.modal-mask {
  position: absolute; inset: 0;
  background: rgba(5, 6, 12, 0.72);
  backdrop-filter: blur(6px);
  animation: fade-in .2s ease;
}
.modal-card {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 28px 28px 24px;
  animation: pop-in .2s ease;
}
@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop-in {
  from { opacity: 0; transform: translateY(8px) scale(.98) }
  to   { opacity: 1; transform: none }
}
.modal-close {
  position: absolute; top: 12px; right: 14px;
  width: 32px; height: 32px;
  border: none; border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: #b8bdcc; font-size: 14px;
  transition: background .2s, color .2s;
}
.modal-close:hover { background: rgba(255,255,255,0.12); color: #fff; }

.md-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px; padding-right: 32px;
}
.md-title { font-size: 16px; font-weight: 600; }
.md-badge {
  font-size: 11px; padding: 3px 10px; border-radius: 999px;
  background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.12);
}
.md-badge.PENDING { color: #ffd070; }
.md-badge.RUNNING { color: #4ab0ff; }
.md-badge.SUCCEEDED { color: #5fe0a0; }
.md-badge.FAILED { color: #ff7c7c; }

.md-media {
  display: grid; gap: 10px;
  grid-template-columns: 1fr;
  margin-bottom: 16px;
}
.md-media.has-both { grid-template-columns: 1fr 1fr; }
.md-media-box {
  position: relative;
  aspect-ratio: 16/9; background: #000;
  border-radius: 10px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.md-media-box video,
.md-media-box img { width: 100%; height: 100%; object-fit: contain; }
.md-media-label {
  position: absolute; top: 8px; left: 8px;
  font-size: 10px; padding: 2px 8px; border-radius: 999px;
  background: rgba(0,0,0,0.6); color: #c5b8ff;
  border: 1px solid rgba(255,255,255,0.1);
}
.md-media-error {
  color: #ff7c7c; padding: 16px; text-align: center; font-size: 13px;
}

.md-section { margin-bottom: 14px; }
.md-section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.md-section-title {
  font-size: 11px; color: #8a8fa3;
  text-transform: uppercase; letter-spacing: .8px;
}
.md-prompt {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word;
  max-height: 200px; overflow: auto;
  user-select: text;
}
.copy-btn {
  background: rgba(124,92,255,0.15);
  border: 1px solid rgba(124,92,255,0.4);
  color: #c5b8ff;
  font-size: 11px; padding: 4px 10px; border-radius: 6px;
  transition: background .2s;
}
.copy-btn:hover { background: rgba(124,92,255,0.28); }
.copy-btn.ok { background: rgba(95, 224, 160, 0.18); border-color: rgba(95, 224, 160, 0.5); color: #5fe0a0; }

.md-meta {
  display: grid; grid-template-columns: 110px 1fr;
  gap: 6px 14px;
  font-size: 13px;
}
.md-meta dt { color: #8a8fa3; }
.md-meta dd { margin: 0; color: #d8dbe5; word-break: break-all; }

.md-error {
  background: rgba(255, 124, 124, 0.08);
  border: 1px solid rgba(255, 124, 124, 0.25);
  border-radius: 10px;
  padding: 10px 14px;
  color: #ff9a9a; font-size: 13px;
  white-space: pre-wrap; word-break: break-word;
}

/* 模态框操作按钮 */
.md-actions {
  display: flex; gap: 10px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.md-act-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #d8dbe5;
  font-size: 13px;
  padding: 10px 0;
  border-radius: 10px;
  transition: background .2s, border-color .2s, transform .15s;
  cursor: pointer;
}
.md-act-btn:hover {
  background: rgba(124, 92, 255, 0.12);
  border-color: rgba(124, 92, 255, 0.5);
  transform: translateY(-1px);
}
.md-act-btn.re-edit:hover { border-color: rgba(74, 176, 255, 0.5); background: rgba(74, 176, 255, 0.1); }
.md-act-btn.re-gen:hover { border-color: rgba(95, 224, 160, 0.5); background: rgba(95, 224, 160, 0.08); }

@media (max-width: 640px) {
  .modal { padding: 12px; }
  .modal-card { padding: 22px 18px 18px; }
  .md-media.has-both { grid-template-columns: 1fr; }
  .md-meta { grid-template-columns: 90px 1fr; }
}

/* ===== 响应式 ===== */
@media (max-width: 640px) {
  .hero-title { font-size: 28px; }
  .topbar { padding: 12px 18px; }
  .composer-bottom { flex-direction: column; align-items: stretch; }
  .btn-primary.big { width: 100%; }
}

/* ===== r2v 多文件上传区 ===== */
.r2v-area { display: flex; flex-direction: column; gap: 8px; }
.r2v-drop { min-height: 120px; height: auto; }
.r2v-list {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.r2v-item {
  position: relative;
  width: 80px; height: 80px;
  border-radius: 10px; overflow: hidden;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
}
.r2v-item img,
.r2v-item video {
  width: 100%; height: 100%; object-fit: cover;
}
.r2v-item .r2v-tag {
  position: absolute; bottom: 2px; left: 2px;
  font-size: 9px; padding: 1px 5px; border-radius: 4px;
  background: rgba(0,0,0,0.7); color: #c5b8ff;
}
.r2v-item .r2v-remove {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px;
  border: none; border-radius: 50%;
  background: rgba(255,60,60,0.8);
  color: #fff; font-size: 11px; line-height: 18px;
  text-align: center; cursor: pointer;
  display: none;
}
.r2v-item:hover .r2v-remove { display: block; }
.r2v-uploading {
  opacity: 0.5;
}
.r2v-uploading::after {
  content: '';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}

/* ===== 悬浮 Toast（顶部居中）===== */
.toast-container {
  position: fixed; top: 20px; left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
  width: max-content; max-width: calc(100% - 40px);
}
.toast {
  pointer-events: auto;
  max-width: 420px;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13px; line-height: 1.5;
  color: #e9ecf3;
  text-align: center;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  animation: toast-in .25s ease;
  transition: opacity .3s, transform .3s;
}
.toast.info {
  background: rgba(20, 22, 38, 0.88);
  border: 1px solid rgba(124, 92, 255, 0.35);
}
.toast.warn {
  background: rgba(40, 22, 10, 0.88);
  border: 1px solid rgba(255, 160, 60, 0.4);
  color: #ffd080;
}
.toast.error {
  background: rgba(40, 15, 15, 0.88);
  border: 1px solid rgba(255, 100, 100, 0.4);
  color: #ffa0a0;
}
.toast.success {
  background: rgba(15, 35, 20, 0.88);
  border: 1px solid rgba(95, 224, 160, 0.4);
  color: #7affbb;
}
.toast.out {
  opacity: 0; transform: translateY(-12px);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: none; }
}

/* ===== 自定义下拉（与输入框风格统一）===== */
.custom-select {
  position: relative;
  min-width: 130px;
}
.custom-select > select {
  /* 隐藏原生 select，仅作为值存储器，保证现有 .value 读写逻辑不变 */
  position: absolute; left: 0; top: 0;
  width: 100%; height: 100%;
  opacity: 0; pointer-events: none;
}
.cs-trigger {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.4;
  color: inherit;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  user-select: none;
}
.cs-trigger:hover {
  background: rgba(255,255,255,0.06);
}
.custom-select.open > .cs-trigger,
.cs-trigger:focus {
  outline: none;
  border-color: rgba(124, 92, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18);
}
.cs-arrow {
  margin-left: 8px;
  width: 8px; height: 8px;
  border-right: 1.5px solid #b8bdcc;
  border-bottom: 1.5px solid #b8bdcc;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .2s;
}
.custom-select.open .cs-arrow {
  transform: translateY(2px) rotate(-135deg);
}
.cs-panel {
  padding: 6px;
  background: rgba(20, 22, 38, 0.96);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  max-height: 240px; overflow-y: auto;
  animation: cs-pop .15s ease;
}
.cs-option {
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.4;
  border-radius: 8px;
  color: #d8dbe5;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.cs-option:hover,
.cs-option.active {
  background: linear-gradient(135deg, rgba(124,92,255,.28), rgba(74,176,255,.22));
  color: #fff;
}
.cs-option.selected {
  color: #c5b8ff;
}
.cs-option.selected::after {
  content: '✓';
  float: right;
  color: #7c5cff;
}
@keyframes cs-pop {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

/* ===== 通用弹窗 ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(5, 6, 12, 0.72);
  backdrop-filter: blur(6px);
  animation: fade-in .2s ease;
}
.modal-box {
  position: relative;
  width: min(440px, 100%);
  background: rgba(20, 22, 38, 0.92);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  animation: pop-in .2s ease;
  overflow: hidden;
}
.modal-box.wide { width: min(680px, 100%); }
.modal-title {
  font-size: 16px; font-weight: 600;
  padding: 20px 24px 0;
}
.modal-body {
  padding: 16px 24px;
  font-size: 14px; line-height: 1.6;
  color: #d8dbe5;
}
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 24px 20px;
}

/* ===== 设置弹窗 ===== */
.settings-label {
  display: block;
  font-size: 12px; color: #8a8fa3;
  margin: 12px 0 6px;
}
.settings-label:first-child { margin-top: 0; }
.settings-textarea {
  width: 100%; min-height: 140px; max-height: 320px;
  resize: vertical;
  font-size: 13px; line-height: 1.5;
  padding: 10px 12px;
}
