/* ============================================================
   Composer — floating creation panel under the selected node
   ============================================================ */

.composer {
  position: fixed;
  z-index: 88;
  width: 664px;
  max-width: calc(100vw - 96px);
  padding: 11px 13px 10px;
  border-radius: 12px;
  background: #19191b;
  box-shadow: 0 26px 70px rgba(0,0,0,0.62), inset 0 0 0 1px rgba(255,255,255,0.085);
  backdrop-filter: blur(22px);
  animation: composer-in 0.16s var(--ease);
  transition: opacity 0.14s;
}
@keyframes composer-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.composer.is-busy { pointer-events: none; }

/* ---------- video mode tabs ---------- */
.composer-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 2px 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.055);
}
.composer-tab {
  height: 24px;
  padding: 0 9px;
  border-radius: 5px;
  font-size: 11px;
  color: #7f7f87;
  transition: background 0.13s, color 0.13s;
  white-space: nowrap;
}
.composer-tab:hover { color: #d0d0d6; }
.composer-tab.is-active { background: #2a2a2e; color: #f0f0f2; }
.composer-tabs .spacer { flex: 1; }
.composer-tabs .icon-btn { width: 24px; height: 24px; }

/* ---------- head chips ---------- */
.composer-head {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-bottom: 9px;
}
.chip-grid { display: flex; gap: 6px; }
.feat-chip {
  width: 52px;
  height: 50px;
  border-radius: 6px;
  background: #202023;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.075);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 10px;
  color: #b9b9c0;
  transition: background 0.14s, box-shadow 0.14s, color 0.14s;
  position: relative;
  overflow: hidden;
}
.feat-chip .ic { color: #8f8f97; }
.feat-chip:hover { background: #26262a; color: #e6e6ea; }
.feat-chip:hover .ic { color: #c8c8ce; }
.feat-chip.is-active {
  box-shadow: inset 0 0 0 1px rgba(110,168,255,0.85), 0 0 0 1px rgba(110,168,255,0.18);
  color: #dfe9fb;
}
.feat-chip.is-active .ic { color: #9dc2ff; }
.feat-chip.has-thumb { color: #fff; }
.feat-chip.has-thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.42;
}
.feat-chip.has-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.55), rgba(0,0,0,0.1));
}
.feat-chip.has-thumb span, .feat-chip.has-thumb .ic { position: relative; z-index: 2; }
.feat-chip .dot-badge {
  position: absolute;
  top: 3px; right: 4px;
  z-index: 3;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: #6ea8ff;
}

/* reference thumbnails */
.ref-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  padding-top: 1px;
}
.ref-thumb {
  position: relative;
  width: 44px;
  height: 50px;
  border-radius: 6px;
  overflow: hidden;
  background: #111;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
  flex: none;
}
.ref-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.92; }
.ref-thumb .badge {
  position: absolute;
  top: 3px; right: 3px;
  min-width: 12px;
  height: 12px;
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(10,10,11,0.7);
  font-size: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #e8e8ec;
}
.ref-empty {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  border: 1px dashed rgba(255,255,255,0.13);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #56565d;
}
.composer-expand {
  margin-left: auto;
  width: 24px; height: 24px;
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  color: #6f6f77;
}
.composer-expand:hover { color: #d8d8dd; background: rgba(255,255,255,0.06); }

/* ---------- input ---------- */
.composer-input-wrap {
  position: relative;
  padding: 2px 1px 8px;
  min-height: 40px;
}
.composer-input {
  width: 100%;
  min-height: 42px;
  max-height: 132px;
  padding: 3px 2px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 13px;
  line-height: 1.65;
  color: #e7e7ea;
  overflow-y: auto;
}
.composer-input::placeholder { color: #62626a; }

.mention-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.mention {
  height: 22px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 6px 0 3px;
  border-radius: 4px;
  background: #26262a;
  font-size: 10.5px;
  color: #c6c9cf;
  max-width: 260px;
}
.mention img { width: 16px; height: 16px; border-radius: 3px; object-fit: cover; }
.mention .lab { color: #8fa7c7; white-space: nowrap; flex: none; }
.mention .txt {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- footer ---------- */
.composer-foot {
  display: flex;
  align-items: center;
  gap: 3px;
  min-height: 30px;
}
.foot-btn {
  height: 28px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 6px;
  font-size: 11.5px;
  color: #c3c3ca;
  white-space: nowrap;
  transition: background 0.13s, color 0.13s;
}
.foot-btn .ic { color: #8f8f97; }
.foot-btn:hover { background: #26262a; color: #f0f0f2; }
.foot-btn:hover .ic { color: #d6d6dc; }
.foot-btn .model-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: conic-gradient(from 210deg, #7fb0ff, #b78cff, #ffb07f, #7fb0ff);
  flex: none;
}
.foot-sep { width: 1px; height: 15px; background: rgba(255,255,255,0.09); margin: 0 2px; }
.composer-foot .spacer { flex: 1; }
.icon-foot {
  width: 26px; height: 26px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #9a9aa2;
  font-size: 12px;
  font-weight: 600;
}
.icon-foot:hover { background: #26262a; color: #eee; }
.credit-inline {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 26px;
  padding: 0 3px;
  font-size: 10.5px;
  color: #85858d;
  font-variant-numeric: tabular-nums;
}
.send-btn {
  width: 29px; height: 29px;
  border-radius: 50%;
  background: #f1f1f3;
  color: #131314;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
  transition: background 0.14s, transform 0.14s, opacity 0.14s;
}
.send-btn:hover { background: #fff; transform: translateY(-1px); }
.send-btn:active { transform: none; }
.send-btn[disabled] { opacity: 0.35; pointer-events: none; }
.send-btn.is-stop { background: #2a2a2e; color: #fff; }

/* ---------- generating state ---------- */
.composer.is-busy .composer-input { color: #8b8b93; }
.busy-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: #a8c6f2;
}
.busy-line .mini-spin {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(140,190,255,0.3);
  border-top-color: #8fc0ff;
  animation: spin 0.8s linear infinite;
}

/* ---------- small drop menu attached ---------- */
.composer .menu { z-index: 950; }

/* ---------- empty composer (no selection) ---------- */
.composer-empty {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  background: rgba(23,23,24,0.9);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.07);
  font-size: 11px;
  color: #77777f;
  z-index: 55;
  backdrop-filter: blur(12px);
}
.composer-empty .kbd {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 4px;
  background: #26262a;
  color: #b4b4bb;
}

/* ---------- busy overlay on composer ---------- */
.composer-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: rgba(255,255,255,0.07);
  overflow: hidden;
  border-radius: 0 0 12px 12px;
}
.composer-progress i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6ea8ff, #b58cff);
  transition: width 0.3s var(--ease);
}

/* ---------- popover internals ---------- */
.param-pop { padding: 8px; }
.pop-row { padding: 7px 6px; }
.pop-label {
  font-size: 10.5px;
  color: #78787f;
  margin-bottom: 7px;
}
.pop-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.pop-chip {
  height: 26px;
  padding: 0 9px;
  border-radius: 5px;
  font-size: 11px;
  color: #b9b9c0;
  background: #232326;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
}
.pop-chip:hover { background: #2c2c30; color: #fff; }
.pop-chip.is-active {
  background: #e9e9ec;
  color: #141415;
  box-shadow: none;
  font-weight: 600;
}
.pop-hint {
  padding: 8px 7px 4px;
  font-size: 10px;
  line-height: 1.5;
  color: #68686f;
}
.pop-field { padding: 7px 6px; }
.pop-field label {
  display: block;
  font-size: 10.5px;
  color: #78787f;
  margin-bottom: 6px;
}
.pop-field textarea, .pop-field input {
  width: 100%;
  background: #101011;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 7px 8px;
  font-size: 11.5px;
  outline: none;
  resize: none;
}
.pop-field textarea:focus, .pop-field input:focus { border-color: rgba(110,168,255,0.6); }
.pop-row-btns { display: flex; justify-content: flex-end; padding: 8px 6px 2px; }

.model-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border-radius: 7px;
  text-align: left;
}
.model-item:hover { background: #2a2a2d; }
.model-item.is-active { background: #26262a; }
.model-item .m-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.model-item .m-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.model-item .m-name { font-size: 12px; color: #e4e4e8; }
.model-item .m-note { font-size: 9.5px; color: #6f6f77; }
.model-item .m-cost { margin-left: auto; font-size: 10px; color: #8b8b93; }
.model-item.is-active .m-name::after { content: " ·"; color: #6ea8ff; }

.style-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
}
.style-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 6px;
  font-size: 10.5px;
  color: #b9b9c0;
  text-align: left;
}
.style-item:hover { background: #2a2a2d; color: #fff; }
.style-item.is-active { box-shadow: inset 0 0 0 1px rgba(110,168,255,0.9); }
.style-thumb {
  width: 28px; height: 28px;
  border-radius: 4px;
  flex: none;
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}


.style-clear {
  width: calc(100% - 8px);
  margin: 4px;
  height: 26px;
  border-radius: 5px;
  font-size: 10.5px;
  color: #90909a;
}
.style-clear:hover { background: #2a2a2d; color: #fff; }


.ref-empty { position: relative; padding: 0; }
.ref-empty.has-frame { border-style: solid; border-color: rgba(255,255,255,0.14); }
.ref-empty.has-frame img { width: 100%; height: 100%; object-fit: cover; border-radius: 5px; }
.frame-badge {
  position: absolute;
  left: 3px; bottom: 3px;
  padding: 1px 3px;
  border-radius: 2px;
  font-size: 7px;
  color: #e8eef8;
  background: rgba(0,0,0,0.55);
}

/* ---------- 参考节点（本轮新增） ---------- */
.ref-thumb.is-plain {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, #1d2432, #14161c);
}
.ref-glyph { font-size: 13px; color: #9dc2ff; }
.ref-add-btn {
  width: 34px;
  height: 50px;
  border-radius: 6px;
  border: 1px dashed rgba(255,255,255,0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6a6a72;
  flex: none;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.ref-add-btn:hover { color: #dfe6f2; border-color: rgba(110,168,255,0.55); background: rgba(110,168,255,0.08); }
.ment-ic {
  width: 18px; height: 18px;
  border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px;
  color: #9dc2ff;
  background: rgba(110,168,255,0.14);
  flex: none;
}
.pop-mode { align-items: center; }
.pop-mode-val { font-size: 11px; color: #b9c8dc; }

/* ---------- 参数滑杆 / 模型标签 / 声音库 ---------- */
.pop-slider { align-items: center; gap: 8px; }
.pop-slider input[type="range"] {
  flex: 1;
  height: 3px;
  appearance: none;
  background: #33333a;
  border-radius: 2px;
  outline: none;
}
.pop-slider input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #cfd8e6;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.pop-range-val { font-size: 10px; color: #b9b9c1; min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.m-vip {
  font-style: normal;
  font-size: 8px;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 5px;
  color: #f0c184;
  background: rgba(240,193,132,0.14);
  vertical-align: middle;
}
.m-tag {
  font-style: normal;
  font-size: 8px;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 4px;
  color: #9dc2ff;
  background: rgba(110,168,255,0.14);
  vertical-align: middle;
}
.m-cost i { display: block; font-style: normal; font-size: 8px; color: #5f5f67; }
.pop-search {
  width: 100%;
  height: 26px;
  margin: 0 0 6px;
  padding: 0 8px;
  border-radius: 6px;
  background: #101011;
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 11px;
  color: #e6e6ea;
  outline: none;
}
.voice-list { max-height: 210px; overflow-y: auto; margin-top: 4px; display: flex; flex-direction: column; gap: 2px; }
.voice-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 7px;
  border-radius: 6px;
  text-align: left;
}
.voice-row:hover { background: #26262a; }
.voice-row.is-active { background: rgba(110,168,255,0.12); }
.v-ico { width: 20px; height: 20px; border-radius: 5px; display: flex; align-items: center; justify-content: center; background: #202024; color: #9dc2ff; font-size: 10px; flex: none; }
.v-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.v-main b { font-size: 11px; color: #e2e2e8; font-weight: 500; }
.v-main i { font-style: normal; font-size: 9px; color: #6f6f77; }
.v-check { color: #9dc2ff; }
