/* ============================================================
   声像台 · AIRI Console — 设计系统
   主题：信号控制台。深墨蓝 + 信号琥珀(输出) + 语音青(输入)。
   圆角克制(6px)、细发丝线、单一辉光焦点(信号球)。
   ============================================================ */

:root {
  /* 色板 */
  --ink: #0b0f14;            /* 背景 */
  --panel: #10161f;          /* 面板 */
  --panel2: #16202c;         /* 抬升面板 */
  --panel3: #1b2735;         /* 悬停/输入 */
  --hairline: rgba(224, 236, 250, .08);
  --hairline-strong: rgba(224, 236, 250, .16);
  --text: #e9eef4;
  --mute: #8fa0b1;
  --faint: #5d6d7e;
  --amber: #ffb03a;          /* 信号输出（AI） */
  --amber-soft: rgba(255, 176, 58, .14);
  --teal: #43d9b3;           /* 语音输入（你） */
  --teal-soft: rgba(67, 217, 179, .13);
  --violet: #8f7bff;         /* 图像 */
  --violet-soft: rgba(143, 123, 255, .13);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, .12);

  /* 字体 */
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, "Cascadia Code", Consolas, "Courier New", monospace;

  /* 尺寸 */
  --rail-w: 58px;
  --radius: 6px;
  --radius-lg: 10px;
  --topbar-h: 64px;
  --glow-amber: 0 0 22px rgba(255, 176, 58, .35);
  --glow-teal: 0 0 22px rgba(67, 217, 179, .32);

  --ease: cubic-bezier(.22, .9, .28, 1);
}

* { box-sizing: border-box; }
/* 关键：任何 display 规则都不得覆盖 hidden 属性（灯箱/抽屉/附件行等） */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
::selection { background: var(--amber-soft); color: var(--text); }

/* 细滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--panel3) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--panel3); border-radius: 4px; }
*::-webkit-scrollbar-track { background: transparent; }

svg { display: block; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* ============ 应用框架 ============ */
#app { display: flex; height: 100vh; }

/* ---- 导航轨 ---- */
.rail {
  width: var(--rail-w);
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 0 12px;
  border-right: 1px solid var(--hairline);
  background: linear-gradient(180deg, var(--panel), #0d131b);
  z-index: 20;
}
.brand-mark { width: 30px; height: 30px; color: var(--amber); margin-bottom: 18px; filter: drop-shadow(0 0 8px rgba(255,176,58,.35)); }
.rail-nav { display: flex; flex-direction: column; gap: 6px; }
.rail-btn {
  position: relative;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--mute);
  cursor: pointer;
  transition: color .18s var(--ease), background .18s var(--ease), transform .18s var(--ease);
}
.rail-btn svg { width: 21px; height: 21px; }
.rail-btn:hover { color: var(--text); background: var(--panel3); }
.rail-btn.active { color: var(--amber); background: var(--amber-soft); border-color: rgba(255,176,58,.25); }
.rail-btn.active::before {
  content: ""; position: absolute; left: -9px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 2px; background: var(--amber);
}
.rail-label { display: none; }
.rail-bottom { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rail-led { display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--faint); font-family: var(--mono); font-size: 9px; letter-spacing: .04em; }
.led-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); box-shadow: none; transition: all .3s var(--ease); }
.rail-led.ok .led-dot { background: var(--teal); box-shadow: 0 0 8px rgba(67,217,179,.7); }
.rail-led.ok .led-text { color: var(--teal); }
.rail-led.bad .led-dot { background: var(--danger); box-shadow: 0 0 8px rgba(255,107,107,.7); }
.rail-led.bad .led-text { color: var(--danger); }

/* ---- 工作区 ---- */
.stage { flex: 1; min-width: 0; display: flex; flex-direction: column; background:
  radial-gradient(1200px 500px at 70% -10%, rgba(255,176,58,.045), transparent 60%),
  radial-gradient(900px 420px at 10% 110%, rgba(67,217,179,.035), transparent 60%),
  var(--ink);
}

/* ---- 顶栏 ---- */
.topbar {
  height: var(--topbar-h);
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  border-bottom: 1px solid var(--hairline);
}
.chain {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 11px; color: var(--faint);
  cursor: default; user-select: none; min-width: 0; flex-wrap: nowrap;
}
.chain-node {
  padding: 3px 9px;
  border: 1px solid var(--hairline);
  border-radius: 20px;
  white-space: nowrap;
  transition: all .2s var(--ease);
}
.chain-fx { color: var(--mute); }
.chain-fx.lit {
  color: var(--amber);
  border-color: rgba(255,176,58,.4);
  background: var(--amber-soft);
  box-shadow: var(--glow-amber);
}
.chain-fx.lit.teal { color: var(--teal); border-color: rgba(67,217,179,.4); background: var(--teal-soft); box-shadow: var(--glow-teal); }
.chain-arrow { opacity: .5; }

/* 信号球 */
.orb-wrap {
  position: relative;
  width: 92px; height: 64px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
#orbCanvas { width: 64px; height: 64px; cursor: pointer; }
.orb-label {
  position: absolute; bottom: -1px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em;
  color: var(--faint); white-space: nowrap;
  transition: color .25s var(--ease);
}
.orb-wrap[data-state="live"] .orb-label { color: var(--teal); }
.orb-wrap[data-state="think"] .orb-label, .orb-wrap[data-state="speak"] .orb-label { color: var(--amber); }
.orb-wrap[data-state="error"] .orb-label { color: var(--danger); }
.orb-wrap[data-state="muted"] .orb-label { color: var(--faint); }

.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  max-width: 260px;
  padding: 6px 12px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  color: var(--mute);
  font-family: var(--mono); font-size: 11px;
  cursor: pointer;
  transition: border-color .2s var(--ease), color .2s var(--ease);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pill:hover { border-color: var(--hairline-strong); color: var(--text); }
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.pill.ok .pill-dot { background: var(--teal); box-shadow: 0 0 7px rgba(67,217,179,.7); }
.pill.bad .pill-dot { background: var(--danger); box-shadow: 0 0 7px rgba(255,107,107,.7); }
.pill.warn .pill-dot { background: var(--amber); box-shadow: 0 0 7px rgba(255,176,58,.7); }

.icon-btn {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius);
  color: var(--mute); cursor: pointer;
  transition: all .18s var(--ease);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--text); background: var(--panel3); border-color: var(--hairline); }

/* ============ 页签容器 ============ */
.tab { display: none; flex: 1; min-height: 0; }
.tab.active { display: flex; flex-direction: column; animation: tabIn .28s var(--ease); }
@keyframes tabIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ============ 对话页 ============ */
.chat-head {
  flex: none;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 10px 20px 0;
}
.chat-head-left, .chat-head-right { display: flex; align-items: center; gap: 8px; }

.ghost-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  color: var(--mute);
  font-size: 12.5px; font-family: inherit;
  cursor: pointer;
  transition: all .18s var(--ease);
}
.ghost-btn svg { width: 14px; height: 14px; }
.ghost-btn:hover { color: var(--text); border-color: var(--hairline-strong); background: var(--panel3); }

.ghost-select { position: relative; display: inline-flex; }
.ghost-select select {
  appearance: none; -webkit-appearance: none;
  max-width: 180px;
  padding: 6px 26px 6px 12px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  color: var(--mute);
  font-size: 12.5px; font-family: inherit;
  cursor: pointer;
  transition: all .18s var(--ease);
}
.ghost-select select:hover { color: var(--text); border-color: var(--hairline-strong); }
.ghost-select::after {
  content: ""; position: absolute; right: 10px; top: 50%;
  width: 6px; height: 6px;
  border-right: 1.5px solid var(--mute); border-bottom: 1.5px solid var(--mute);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 20px 10px; }

/* 空状态 */
.chat-empty {
  max-width: 560px; margin: 4vh auto 0;
  text-align: center;
  color: var(--mute);
  animation: fadeUp .5s var(--ease);
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.empty-glyph { color: var(--amber); width: 64px; height: 64px; margin: 0 auto 18px; animation: breathe 4.5s ease-in-out infinite; }
.empty-glyph svg { width: 100%; height: 100%; }
@keyframes breathe {
  0%, 100% { opacity: .55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.07); }
}
.chat-empty h2 { margin: 0 0 10px; font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: .01em; }
.empty-sub { margin: 0 0 26px; font-size: 13.5px; }
.empty-sub b { color: var(--amber); font-weight: 600; }
.empty-hints { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.hint {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  font-size: 12.5px;
}
.hint-k {
  font-family: var(--mono); font-size: 10px; color: var(--amber);
  border: 1px solid rgba(255,176,58,.3);
  padding: 2px 6px; border-radius: 4px;
  flex: none;
}

/* 消息 */
.msg { display: flex; gap: 12px; margin: 0 0 18px; animation: msgIn .3s var(--ease); }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg-avatar {
  flex: none;
  width: 30px; height: 30px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  margin-top: 2px;
}
.msg.user .msg-avatar { background: var(--teal-soft); color: var(--teal); border: 1px solid rgba(67,217,179,.3); }
.msg.assistant .msg-avatar { background: var(--amber-soft); color: var(--amber); border: 1px solid rgba(255,176,58,.3); }
.msg.system .msg-avatar { background: var(--panel3); color: var(--faint); border: 1px solid var(--hairline); }
.msg-body { min-width: 0; flex: 1; }
.msg-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.msg-role { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--faint); }
.msg-time { font-family: var(--mono); font-size: 10px; color: var(--faint); opacity: .7; }
.msg-actions { margin-left: auto; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-actions { opacity: 1; }
.msg-act {
  padding: 2px 8px;
  background: transparent; border: 1px solid var(--hairline); border-radius: 4px;
  color: var(--faint); font-size: 11px; font-family: var(--mono);
  cursor: pointer; transition: all .15s var(--ease);
}
.msg-act:hover { color: var(--text); border-color: var(--hairline-strong); }
.msg-content { font-size: 14px; overflow-wrap: anywhere; }
.msg-content > :first-child { margin-top: 0; }
.msg-content > :last-child { margin-bottom: 0; }
.msg.user .msg-content {
  display: inline-block;
  background: var(--panel2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  max-width: 92%;
}
.msg-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.msg-attach {
  width: 108px; height: 108px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--hairline);
  cursor: zoom-in;
  background: var(--panel2);
}
.msg-attach img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 流式光标 */
.caret {
  display: inline-block; width: 7px; height: 15px;
  margin-left: 2px; vertical-align: -2px;
  background: var(--amber);
  animation: caretBlink .9s steps(2) infinite;
}
@keyframes caretBlink { 50% { opacity: 0; } }

/* 听写浮条 */
.asr-chip {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0 0 18px;
  padding: 8px 14px;
  background: var(--teal-soft);
  border: 1px solid rgba(67,217,179,.35);
  border-radius: 20px;
  color: var(--teal);
  font-size: 12.5px;
  animation: msgIn .25s var(--ease);
}
.asr-chip .pulse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal);
  animation: dotPulse 1s ease-in-out infinite;
}
@keyframes dotPulse { 50% { transform: scale(1.6); opacity: .5; } }
.asr-chip .interim { color: var(--mute); }
.asr-chip .chip-act {
  margin-left: 6px;
  background: transparent; border: 1px solid rgba(67,217,179,.4); border-radius: 4px;
  color: var(--teal); font-size: 11px; font-family: var(--mono);
  padding: 2px 8px; cursor: pointer;
}
.asr-chip .chip-act:hover { background: var(--teal); color: var(--ink); }

/* ---- 输入区 ---- */
.composer {
  flex: none;
  padding: 10px 20px 14px;
}
.composer-main {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--panel);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-lg);
  padding: 8px 10px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.composer-main:focus-within { border-color: rgba(255,176,58,.45); box-shadow: 0 0 0 3px rgba(255,176,58,.08); }
.composer-main.recording { border-color: rgba(67,217,179,.55); box-shadow: 0 0 0 3px rgba(67,217,179,.1); }
#chatInput {
  flex: 1; min-width: 0;
  background: transparent; border: none; outline: none;
  color: var(--text);
  font-family: inherit; font-size: 14px; line-height: 1.5;
  padding: 6px 4px;
  resize: none; max-height: 160px;
}
#chatInput::placeholder { color: var(--faint); }
.tool-btn, .mic-btn, .send-btn {
  flex: none;
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--mute);
  cursor: pointer;
  transition: all .18s var(--ease);
}
.tool-btn svg, .mic-btn svg, .send-btn svg { width: 18px; height: 18px; }
.tool-btn:hover { color: var(--violet); background: var(--violet-soft); border-color: rgba(143,123,255,.3); }
.mic-btn:hover { color: var(--teal); background: var(--teal-soft); }
.mic-btn.recording {
  color: var(--ink); background: var(--teal);
  box-shadow: var(--glow-teal);
  animation: micPulse 1.1s ease-in-out infinite;
}
@keyframes micPulse { 50% { box-shadow: 0 0 0 7px rgba(67,217,179,.18), 0 0 22px rgba(67,217,179,.4); } }
.send-btn { color: var(--amber); }
.send-btn:hover { background: var(--amber-soft); border-color: rgba(255,176,58,.35); }
.send-btn.busy { color: var(--danger); }
.send-btn.busy:hover { background: var(--danger-soft); border-color: rgba(255,107,107,.35); }
.composer-hint {
  margin-top: 6px; padding-left: 4px;
  font-family: var(--mono); font-size: 10.5px; color: var(--faint);
}
.attach-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.attach-item {
  position: relative;
  width: 64px; height: 64px; border-radius: var(--radius);
  border: 1px solid var(--hairline-strong);
  overflow: hidden;
}
.attach-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-x {
  position: absolute; top: 3px; right: 3px;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(11,15,20,.8);
  border: 1px solid var(--hairline-strong); border-radius: 4px;
  color: var(--text); font-size: 11px; line-height: 1;
  cursor: pointer;
}
.attach-x:hover { color: var(--danger); }

/* ============ 图像 / 语音 工作室 ============ */
.studio { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 20px 26px; }
.studio-nav { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--hairline); }
.studio-tab {
  padding: 8px 16px;
  background: transparent; border: none; border-bottom: 2px solid transparent;
  color: var(--mute); font-size: 13.5px; font-family: inherit;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color .18s var(--ease);
}
.studio-tab:hover { color: var(--text); }
.studio-tab.active { color: var(--amber); border-bottom-color: var(--amber); }
.studio-pane { display: none; }
.studio-pane.active { display: block; animation: tabIn .28s var(--ease); }

#studio-gen { display: none; }
#studio-gen.active {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 900px) { #studio-gen.active { grid-template-columns: 1fr; } }

.gen-left { display: flex; flex-direction: column; gap: 14px; }
.gen-right { min-height: 320px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em;
  color: var(--mute);
}
.field-label span { color: var(--amber); }
.field input, .field select, .field textarea {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit; font-size: 13.5px;
  padding: 9px 12px;
  outline: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: rgba(255,176,58,.45);
  box-shadow: 0 0 0 3px rgba(255,176,58,.08);
}
.field textarea { resize: vertical; min-height: 44px; }
.field select {
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--mute) 50%), linear-gradient(135deg, var(--mute) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat;
  padding-right: 30px; cursor: pointer;
}
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; min-width: 0; }
.field-row .field:first-child:last-child { flex: 1; }
.field-note { margin: 0; font-size: 11.5px; color: var(--faint); line-height: 1.6; }
.field-note + .field-note { margin-top: 6px; }

.primary-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  background: var(--amber);
  color: var(--ink);
  border: none; border-radius: var(--radius);
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), opacity .2s;
}
.primary-btn svg { width: 15px; height: 15px; }
.primary-btn:hover { transform: translateY(-1px); box-shadow: var(--glow-amber); }
.primary-btn:active { transform: translateY(0); }
.primary-btn:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }

/* 生成加载 */
.gen-loading {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  color: var(--mute); font-size: 12.5px;
}
.spinner {
  width: 16px; height: 16px; flex: none;
  border: 2px solid var(--panel3);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 图库 */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gallery-empty {
  grid-column: 1 / -1;
  padding: 40px 20px; text-align: center;
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius-lg);
  color: var(--mute);
}
.gallery-empty p { margin: 4px 0; }
.g-card {
  position: relative;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  cursor: zoom-in;
  transition: transform .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
  animation: fadeUp .4s var(--ease);
}
.g-card:hover { transform: translateY(-2px); border-color: rgba(255,176,58,.4); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.g-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.g-card-meta {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 16px 8px 6px;
  background: linear-gradient(transparent, rgba(8,11,15,.9));
  font-family: var(--mono); font-size: 9.5px; color: var(--mute);
  display: flex; justify-content: space-between; gap: 6px;
  opacity: 0; transition: opacity .18s;
}
.g-card:hover .g-card-meta { opacity: 1; }
.g-card-meta .model { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 识别 / ASR 拖放区 */
.dropzone {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 34px 20px;
  border: 1.5px dashed var(--hairline-strong);
  border-radius: var(--radius-lg);
  color: var(--mute);
  text-align: center;
  cursor: pointer;
  transition: all .2s var(--ease);
  margin-bottom: 16px;
}
.dropzone svg { width: 28px; height: 28px; color: var(--faint); transition: color .2s; }
.dropzone p { margin: 0; font-size: 13px; }
.dropzone b { color: var(--text); font-weight: 600; }
.dropzone:hover, .dropzone.over { border-color: var(--violet); background: var(--violet-soft); }
.dropzone:hover svg, .dropzone.over svg { color: var(--violet); }
.dropzone.has-file { border-style: solid; border-color: rgba(67,217,179,.5); }
.recog-preview {
  max-width: 220px; max-height: 160px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--hairline-strong);
}
.recog-preview img { width: 100%; display: block; }
.asr-filename { font-family: var(--mono); font-size: 11px; color: var(--teal); }

/* 结果框 */
.result-box {
  margin-top: 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--panel);
  overflow: hidden;
}
.result-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em;
  color: var(--mute);
}
.result-actions { display: flex; gap: 6px; }
.result-body {
  padding: 14px;
  max-height: 320px; overflow-y: auto;
  font-size: 13.5px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.mini-btn {
  padding: 3px 10px;
  background: var(--panel2);
  border: 1px solid var(--hairline-strong);
  border-radius: 4px;
  color: var(--mute);
  font-size: 11px; font-family: var(--mono);
  cursor: pointer;
  transition: all .15s var(--ease);
}
.mini-btn:hover { color: var(--text); border-color: rgba(255,176,58,.4); }
.mini-btn:disabled { opacity: .4; cursor: default; }

/* 语音页 */
.voice-studio {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  align-items: start;
}
.studio-card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex; flex-direction: column; gap: 14px;
}
.studio-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.studio-card-title { font-size: 15px; font-weight: 700; }
.studio-card-sub { font-family: var(--mono); font-size: 10px; color: var(--faint); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px;
  background: var(--panel3);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--amber);
  border: none;
  box-shadow: 0 0 8px rgba(255,176,58,.4);
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--amber); border: none;
}
.check-field { flex-direction: row; align-items: center; gap: 8px; cursor: pointer; }
.check-field input { width: 15px; height: 15px; accent-color: var(--amber); cursor: pointer; }

/* ============ 设置抽屉 ============ */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(5,8,12,.55);
  backdrop-filter: blur(2px);
  z-index: 40;
  animation: fadeIn .2s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(430px, 100vw);
  background: var(--panel);
  border-left: 1px solid var(--hairline-strong);
  z-index: 41;
  display: flex; flex-direction: column;
  animation: drawerIn .3s var(--ease);
}
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head {
  flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--hairline);
}
.drawer-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.drawer-body { flex: 1; overflow-y: auto; padding: 6px 18px 30px; }
.set-group { padding: 18px 0; border-bottom: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 12px; }
.set-group:last-child { border-bottom: none; }
.set-title {
  margin: 0;
  font-family: var(--mono); font-size: 11px; letter-spacing: .18em;
  color: var(--amber);
}
.preset-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.preset-chip {
  padding: 6px 12px;
  background: var(--panel2);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  color: var(--mute);
  font-size: 12px; font-family: inherit;
  cursor: pointer;
  transition: all .18s var(--ease);
}
.preset-chip:hover { color: var(--text); border-color: var(--hairline-strong); }
.preset-chip.active {
  color: var(--amber);
  border-color: rgba(255,176,58,.45);
  background: var(--amber-soft);
}
.key-row { display: flex; gap: 6px; }
.key-row input { flex: 1; min-width: 0; }
.test-out {
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 12.5px;
  font-family: var(--mono);
  line-height: 1.6;
}
.test-out.ok { background: var(--teal-soft); border: 1px solid rgba(67,217,179,.35); color: var(--teal); }
.test-out.bad { background: var(--danger-soft); border: 1px solid rgba(255,107,107,.35); color: var(--danger); overflow-wrap: anywhere; }

/* ============ 灯箱 ============ */
.lightbox {
  position: fixed; inset: 0;
  z-index: 50;
  background: rgba(5,8,12,.82);
  backdrop-filter: blur(4px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 30px;
  animation: fadeIn .2s var(--ease);
}
.lightbox img {
  max-width: min(860px, 92vw);
  max-height: 74vh;
  border-radius: var(--radius-lg);
  border: 1px solid var(--hairline-strong);
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
}
.lightbox-actions { display: flex; gap: 8px; }

/* ============ Toast ============ */
.toast-wrap {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 9px 18px;
  background: var(--panel2);
  border: 1px solid var(--hairline-strong);
  border-radius: 20px;
  font-size: 12.5px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  animation: toastIn .25s var(--ease);
  max-width: min(560px, 88vw);
}
.toast.err { border-color: rgba(255,107,107,.5); color: var(--danger); }
.toast.ok { border-color: rgba(67,217,179,.5); color: var(--teal); }
.toast.info { border-color: rgba(255,176,58,.5); color: var(--amber); }
.toast.leaving { opacity: 0; transform: translateY(8px); transition: all .3s var(--ease); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============ Markdown ============ */
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { margin: 14px 0 8px; line-height: 1.4; }
.markdown h1 { font-size: 18px; } .markdown h2 { font-size: 16.5px; } .markdown h3 { font-size: 15px; } .markdown h4 { font-size: 14px; }
.markdown p { margin: 8px 0; }
.markdown ul, .markdown ol { margin: 8px 0; padding-left: 22px; }
.markdown li { margin: 3px 0; }
.markdown code {
  font-family: var(--mono); font-size: .88em;
  background: var(--panel3);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 1px 5px;
}
.markdown pre {
  position: relative;
  background: #0a0f16;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 10px 0;
  overflow-x: auto;
}
.markdown pre code { background: none; border: none; padding: 0; font-size: 12.5px; line-height: 1.6; color: #cfe3d9; }
.markdown blockquote {
  margin: 10px 0; padding: 4px 14px;
  border-left: 3px solid var(--amber);
  color: var(--mute);
}
.markdown a { color: var(--teal); text-decoration: none; border-bottom: 1px solid rgba(67,217,179,.35); }
.markdown a:hover { border-bottom-color: var(--teal); }
.markdown hr { border: none; border-top: 1px solid var(--hairline-strong); margin: 14px 0; }
.markdown table { border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.markdown th, .markdown td { border: 1px solid var(--hairline); padding: 6px 10px; }
.markdown th { background: var(--panel2); }
.markdown img { max-width: 100%; border-radius: var(--radius); }

/* ============ 响应式 ============ */
@media (max-width: 860px) {
  .chain { display: none; }
  .topbar { grid-template-columns: 1fr auto; }
  .pill { max-width: 170px; }
}
@media (max-width: 640px) {
  body { overflow: auto; }
  #app { flex-direction: column; height: 100dvh; }
  .rail {
    width: 100%; height: 54px;
    flex-direction: row;
    padding: 0 10px;
    border-right: none;
    border-bottom: 1px solid var(--hairline);
  }
  .brand-mark { width: 26px; height: 26px; margin: 0 8px 0 0; }
  .rail-nav { flex-direction: row; gap: 4px; }
  .rail-btn { width: 40px; height: 40px; }
  .rail-btn.active::before { left: 50%; top: auto; bottom: -7px; transform: translateX(-50%); width: 18px; height: 3px; }
  .rail-bottom { margin: 0 0 0 auto; flex-direction: row; gap: 8px; }
  .rail-led { display: none; }
  .chat-scroll { padding: 12px 12px 8px; }
  .composer { padding: 8px 10px 12px; }
  .chat-empty { margin-top: 2vh; }
  .msg.user .msg-content { max-width: 100%; }
}

/* ============ 动效偏好 ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}
