/* ===== 基础 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* 确保 hidden 属性始终生效（避免被 display 样式覆盖） */
[hidden] { display: none !important; }

:root {
  --bg: #0f1117;
  --bg-soft: #161a23;
  --card: #1c212c;
  --card-hover: #232937;
  --border: #2a3142;
  --text: #e8ecf4;
  --text-dim: #9aa4b5;
  --accent: #6c8cff;
  --accent-2: #9d6cff;
  --gradient: linear-gradient(135deg, #6c8cff, #9d6cff);
  --green: #3ecf8e;
  --red: #ff6b6b;
  --radius: 14px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(109, 140, 255, .12), transparent 60%),
    radial-gradient(900px 420px at 10% 110%, rgba(157, 108, 255, .10), transparent 60%),
    var(--bg);
}

.app {
  height: 100vh;
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
}

/* ===== 左侧菜单栏 ===== */
.sidebar {
  width: 208px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 18px 12px 14px;
  border-right: 1px solid var(--border);
  background: rgba(12, 14, 20, .55);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 14px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 500;
  padding: 11px 14px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: all .2s;
  font-family: inherit;
}

.menu-item:hover { background: var(--card); color: var(--text); }
.menu-item.active {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 5px 14px rgba(109, 140, 255, .3);
}

.menu-icon { font-size: 16px; line-height: 1; }

.sidebar-footer { margin-top: auto; padding: 8px 6px 0; }

/* ===== 右侧主区域 ===== */
.main-view {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 0 24px;
}

.view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ===== 头部 ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 12px;
  border-bottom: 1px solid var(--border);
}

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

.logo {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  font-size: 20px; color: #fff;
  background: var(--gradient);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(109, 140, 255, .35);
}

.brand-text h1 { font-size: 17px; font-weight: 700; letter-spacing: .3px; }
.brand-text p { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.header-meta { display: flex; gap: 8px; }

.header-title h1 { font-size: 17px; font-weight: 700; letter-spacing: .3px; }
.header-title p { font-size: 12px; color: var(--text-dim); margin-top: 3px; }

.badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: var(--card);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-model { color: #b9c6ff; border-color: rgba(108, 140, 255, .35); }

.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

/* ===== 对话区 ===== */
.chat {
  flex: 1;
  overflow-y: auto;
  padding: 20px 4px 12px;
  scroll-behavior: smooth;
}

.chat::-webkit-scrollbar { width: 6px; }
.chat::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* 欢迎面板 */
.welcome {
  text-align: center;
  padding: 48px 20px 20px;
  animation: fadeUp .5s ease;
}

.welcome-icon { font-size: 46px; margin-bottom: 14px; }
.welcome h2 { font-size: 22px; font-weight: 700; }
.welcome p { color: var(--text-dim); font-size: 13px; margin-top: 8px; }

.suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
}

.chip {
  font-size: 12.5px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  transition: all .2s;
  max-width: 100%;
}

.chip:hover { border-color: var(--accent); color: #fff; transform: translateY(-1px); }

/* ===== 消息 ===== */
.msg { display: flex; gap: 12px; margin-bottom: 22px; animation: fadeUp .35s ease; }

.msg-avatar {
  width: 34px; height: 34px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 10px;
  font-size: 16px;
  user-select: none;
}

.msg.user { flex-direction: row-reverse; }
.msg.user .msg-avatar { background: var(--card); border: 1px solid var(--border); }
.msg.ai .msg-avatar { background: var(--gradient); }

.msg-body { max-width: 78%; display: flex; flex-direction: column; gap: 6px; }

.msg.user .msg-body { align-items: flex-end; }

.bubble {
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
  white-space: pre-wrap;
}

.msg.user .bubble {
  background: var(--gradient);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.msg.ai .bubble {
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 5px;
  color: var(--text);
}

/* 状态步骤卡片 */
.steps { display: flex; flex-direction: column; gap: 8px; width: 100%; }

.step {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-dim);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  transition: all .25s;
}

.step.active { border-color: rgba(108, 140, 255, .5); color: var(--text); }
.step.done { border-color: rgba(62, 207, 142, .4); color: var(--text); }

.step-icon { width: 22px; height: 22px; flex-shrink: 0; display: grid; place-items: center; }
.step-icon.spin { border: 2px solid rgba(108, 140, 255, .25); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.step-icon.check { color: var(--green); }

.step-status { margin-left: auto; font-size: 12px; }
.step-status .percent { color: var(--accent); font-variant-numeric: tabular-nums; }

/* 点阵动画 */
.dots::after {
  content: '';
  animation: dots 1.4s steps(4, end) infinite;
}
@keyframes dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* 提示词编辑面板（DeepSeek 扩写后，用户确认前可修改） */
.editor {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 2px;
  animation: fadeUp .3s ease;
}

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  margin-bottom: 10px;
}

.editor-head b { font-weight: 600; color: var(--text); }

.editor-ratio {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.editor-ratio b {
  color: #b9c6ff;
  font-weight: 600;
  background: rgba(108, 140, 255, .12);
  border-radius: 999px;
  padding: 2px 9px;
  margin-left: 4px;
}

.prompt-ta, .neg-ta {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}

.prompt-ta { min-height: 130px; }
.neg-ta { min-height: 56px; margin-top: 6px; }

.prompt-ta:focus, .neg-ta:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 140, 255, .15);
}

.prompt-ta::placeholder, .neg-ta::placeholder { color: #5f6a7e; }

.editor-neg { margin-top: 8px; }

.editor-neg summary {
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  transition: color .2s;
}

.editor-neg summary:hover { color: var(--text); }

.editor-neg[open] summary { color: var(--text); }

.editor-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.gen-btn {
  padding: 10px 24px;
  font-size: 13.5px;
}

.gen-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

.gen-btn.busy { pointer-events: none; }

.gen-spin {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -1px;
  margin-right: 7px;
}

/* 图片结果 */
.result-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.result-meta {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text-dim);
}

.result-meta .tag {
  background: rgba(108, 140, 255, .12);
  color: #b9c6ff;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
}

.img-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; padding: 12px; }

.img-item { position: relative; border-radius: 10px; overflow: hidden; background: var(--bg-soft); }
.img-item img { width: 100%; display: block; aspect-ratio: 1 / 1; object-fit: cover; transition: transform .3s; }

.img-item:hover img { transform: scale(1.04); }

.img-actions {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: rgba(9, 11, 16, .45);
  opacity: 0;
  transition: opacity .2s;
}

.img-item:hover .img-actions { opacity: 1; }

.img-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: #fff;
  background: rgba(255, 255, 255, .16);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px;
  padding: 8px 15px;
  cursor: pointer;
  transition: background .2s;
}

.img-btn:hover { background: rgba(255, 255, 255, .3); }
.img-btn.download:hover { background: var(--gradient); border-color: transparent; }

/* 生成中骨架 */
.skeleton-img {
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: 10px;
  background: linear-gradient(110deg, var(--bg-soft) 30%, #232937 50%, var(--bg-soft) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  display: grid;
  place-items: center;
  color: var(--text-dim);
  font-size: 13px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ===== 设置栏 ===== */
.controls { padding: 12px 0; border-top: 1px solid var(--border); }

.control-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

.control-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.control-label { font-size: 12px; color: var(--text-dim); }

.seg {
  display: inline-flex;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  overflow-x: auto;
  max-width: 100%;
}
.seg::-webkit-scrollbar { display: none; }

.seg button {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .18s;
}

.seg button:hover { color: var(--text); }
.seg button.active { background: var(--gradient); color: #fff; box-shadow: 0 3px 10px rgba(109, 140, 255, .35); }

/* ===== 输入栏（dock 样式，仿成熟产品） ===== */
.input-bar { padding: 8px 0 16px; }

.dock { width: 100%; }

/* 输入框主体：大圆角胶囊 + focus 光晕 */
.dock-input {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 12px 12px 12px 20px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .22);
  transition: border-color .2s, box-shadow .2s;
}

.dock-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 140, 255, .14), 0 8px 28px rgba(0, 0, 0, .22);
}

.dock-input textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.6;
  font-family: inherit;
  max-height: 120px;
  min-height: 24px;
  padding: 0;
}

.dock-input textarea::placeholder { color: #5f6a7e; }

/* 发送按钮：渐变圆形 */
.dock-send {
  width: 40px; height: 40px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .15s, opacity .2s, box-shadow .2s;
  box-shadow: 0 5px 16px rgba(109, 140, 255, .4);
}

.dock-send:hover { transform: translateY(-1px) scale(1.03); }
.dock-send:active { transform: scale(.92); }
.dock-send:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }

/* 附加图片按钮：圆形图标 */
.dock-add {
  width: 40px; height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border);
  background: var(--bg-soft);
  color: var(--text-dim);
  border-radius: 50%;
  cursor: pointer;
  transition: all .2s;
}

.dock-add:hover {
  color: #fff;
  border-color: var(--accent);
  border-style: solid;
  background: rgba(108, 140, 255, .14);
  box-shadow: 0 4px 14px rgba(108, 140, 255, .25);
}

.dock-add.has-image { display: none; }

/* 输入栏底部：提示 + 模型标签 */
.dock-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  padding: 0 6px;
}

.dock-hint { font-size: 11px; color: #5f6a7e; }

.dock-model {
  font-size: 11px;
  color: var(--text-dim);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* 首帧图预览条（图片选择后出现在输入框上方） */
.frame-strip {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  padding: 0 4px;
}

.frame-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 5px 8px 5px 5px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
  animation: fadeUp .25s ease;
}

.frame-chip img {
  width: 36px; height: 36px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
  border: 1px solid var(--border);
}

.chip-name { font-size: 12px; color: var(--text-dim); }

.chip-x {
  width: 20px; height: 20px;
  border: none;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all .15s;
}

.chip-x:hover { background: var(--red); color: #fff; }

/* 错误提示 */
.error-bubble {
  background: rgba(255, 107, 107, .12) !important;
  border-color: rgba(255, 107, 107, .4) !important;
  color: #ffb4b4 !important;
}

/* ===== 设置弹窗 ===== */
.icon-btn {
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-dim);
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all .2s;
}

.icon-btn:hover { color: #fff; border-color: var(--accent); transform: rotate(12deg); }

.modal-mask {
  position: fixed; inset: 0;
  background: rgba(6, 8, 13, .62);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  width: 100%;
  max-width: 430px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
  animation: fadeUp .25s ease;
}

.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 16px; }

.modal-close {
  border: none; background: transparent;
  color: var(--text-dim); font-size: 15px;
  cursor: pointer; padding: 4px;
  border-radius: 8px;
}
.modal-close:hover { color: #fff; background: var(--bg-soft); }

.modal-tip { font-size: 12px; color: var(--text-dim); line-height: 1.7; margin: 12px 0 16px; }

.model-info {
  font-size: 12px;
  color: #b9c6ff;
  background: rgba(108, 140, 255, .08);
  border: 1px dashed rgba(108, 140, 255, .35);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
  line-height: 1.6;
}

.field { margin-bottom: 16px; }

.field label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-bottom: 7px; }

.key-status {
  font-size: 11px; font-weight: 400;
  padding: 2px 8px; border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.key-status.ok { color: var(--green); border-color: rgba(62, 207, 142, .4); background: rgba(62, 207, 142, .1); }
.key-status.warn { color: #e8b86b; border-color: rgba(232, 184, 107, .4); background: rgba(232, 184, 107, .1); }

.key-input { display: flex; align-items: center; gap: 6px; }

.key-input input {
  flex: 1;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13.5px;
  padding: 10px 12px;
  border-radius: 10px;
  outline: none;
  font-family: inherit;
  transition: border-color .2s;
}

.key-input input:focus { border-color: var(--accent); }

.eye {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-dim);
  border-radius: 10px;
  width: 38px; height: 40px;
  cursor: pointer;
  font-size: 14px;
}
.eye:hover { color: #fff; }

.field-tip { font-size: 11px; color: #5f6a7e; margin-top: 5px; }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

.btn {
  border: none; border-radius: 10px;
  font-size: 13px; font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
  transition: all .2s;
}

.btn.ghost { background: var(--bg-soft); color: var(--text-dim); border: 1px solid var(--border); }
.btn.ghost:hover { color: #ffb4b4; border-color: rgba(255, 107, 107, .4); }
.btn.primary { background: var(--gradient); color: #fff; box-shadow: 0 5px 14px rgba(109, 140, 255, .35); }
.btn.primary:hover { transform: translateY(-1px); }

/* ===== Toast 轻提示 ===== */
.toast {
  position: fixed; top: 18px; left: 50%;
  transform: translateX(-50%) translateY(-14px);
  background: rgba(22, 26, 35, .94);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 999px;
  z-index: 300;
  opacity: 0;
  transition: all .25s;
  pointer-events: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 动画 ===== */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 打字机光标 ===== */
.typing-caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--accent);
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* 文字视图的思考状态 */
.thinking-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-dim);
  margin: 4px 0 8px;
}

/* ===== 视频结果 ===== */
.video-result {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  animation: fadeUp .3s ease;
}

.video-meta {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text-dim);
}

.video-meta .tag {
  background: rgba(108, 140, 255, .12);
  color: #b9c6ff;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
}

.video-wrap { padding: 12px; }

.video-player {
  width: 100%;
  max-height: 440px;
  background: #000;
  border-radius: 10px;
  display: block;
  outline: none;
}

.video-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* 图片结果 → 发送到视频 */
.img-btn.video { background: linear-gradient(135deg, rgba(157, 108, 255, .8), rgba(108, 140, 255, .8)); border-color: transparent; }
.img-btn.video:hover { filter: brightness(1.15); }

/* ===== 响应式 ===== */
@media (max-width: 760px) {
  .sidebar { width: 64px; padding: 18px 8px 14px; }
  .sidebar-brand { justify-content: center; padding: 0 0 14px; }
  .sidebar-brand .brand-text { display: none; }
  .menu-item { justify-content: center; padding: 12px 0; }
  .menu-label { display: none; }
  .main-view { padding: 0 14px; }
}

@media (max-width: 620px) {
  .msg-body { max-width: 88%; }
  .control-row { gap: 10px; }
}
