/* ============ Studio layout ============ */
/* Full-bleed canvas; toolbar capsules, navigator, side panel and composer
   float above it as Liquid Glass. Insets are shared variables so overlays
   and React Flow panels stay aligned. */
.studio {
  --top: calc(var(--inset) + var(--toolbar-h) + var(--inset));
  --left-inset: var(--inset);
  --right-inset: var(--inset);
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--canvas);
}
.studio.nav-open {
  --left-inset: calc(var(--inset) * 2 + var(--studio-nav-w));
}
.studio.side-open {
  --right-inset: calc(var(--inset) * 2 + var(--studio-side-w));
}
.studio-stage {
  position: absolute;
  inset: 0;
}
.studio-loading,
.studio-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 10px;
  color: var(--label-2);
}
.studio-loading {
  display: flex;
  align-items: center;
  justify-content: center;
}
.studio-error {
  position: fixed;
}

/* Shared glass pane recipe for floating chrome */
.tb-capsule,
.studio-nav,
.studio-side,
.studio-zoom,
.vibe-composer,
.vibe-status {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-highlight), 0 0 0 0.5px var(--glass-edge), var(--shadow-2);
}

/* ============ Toolbar (three capsules) ============ */
.studio-toolbar {
  position: absolute;
  z-index: 20;
  top: var(--inset);
  left: var(--inset);
  right: var(--inset);
  height: var(--toolbar-h);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  pointer-events: none;
}
/* 标题胶囊与下方导航栏同宽,形成一条对齐的左列 */
.tb-capsule.tb-left {
  width: var(--studio-nav-w);
}
.tb-capsule {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 2px;
  height: var(--toolbar-h);
  padding: 0 8px;
  border-radius: var(--r-full);
  animation: drop-in var(--d-slow) var(--spring) both;
}
@keyframes drop-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.97);
  }
}
.tb-left {
  justify-self: start;
  min-width: 0;
  max-width: 100%;
}
.tb-center {
  padding: 0 6px;
  animation-delay: 60ms;
}
/* 右上角:积分与 Vibe 是两个独立按钮,不共用底板 */
.tb-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  animation: drop-in var(--d-slow) var(--spring) both;
  animation-delay: 120ms;
}
.tb-titlebox {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  margin: 0 2px;
}
.tb-title {
  min-width: 0;
  max-width: 240px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-full);
  background: transparent;
  font: 650 14.5px/1 var(--font-display);
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  transition: background var(--d-fast);
}
.tb-title:hover {
  background: var(--hover);
}
.tb-title:focus {
  background: var(--bg-secondary);
  box-shadow: var(--ring);
}
.tb-save {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding-right: 6px;
  font: 500 11.5px/1 var(--font);
  color: var(--label-3);
  white-space: nowrap;
}
.tb-save .spinner {
  width: 10px;
  height: 10px;
  border-width: 1.5px;
}
.tb-save.is-saved::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent);
}
.tb-save.is-error {
  color: var(--red);
}
.tb-sep {
  width: 0.5px;
  height: 22px;
  margin: 0 6px;
  background: var(--separator-strong);
  flex: none;
}
.tb-group {
  display: flex;
  gap: 1px;
}
.tb-insert {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 52px;
  height: 46px;
  border-radius: 14px;
  color: var(--label-2);
  font: 600 10px/1 var(--font);
  cursor: grab;
  transition: background var(--d-fast), color var(--d-fast);
}
.tb-insert-glyph {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  color: var(--tint);
  transition: transform var(--d) var(--spring), background var(--d-fast), color var(--d-fast), box-shadow var(--d);
}
.tb-insert-glyph .icon {
  width: 18px;
  height: 18px;
}
.tb-insert:hover {
  color: var(--label);
}
.tb-insert:hover .tb-insert-glyph {
  transform: translateY(-3px) scale(1.14);
  background: var(--tint);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 14px -4px color-mix(in srgb, var(--tint) 70%, transparent);
}
.tb-insert:hover .tb-insert-glyph .icon-duo {
  opacity: 0.32;
}
.tb-insert:active {
  cursor: grabbing;
}
.tb-insert:active .tb-insert-glyph {
  transform: translateY(-1px) scale(1.02);
}
.tb-credits {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--r-full);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-highlight), 0 0 0 0.5px var(--glass-edge);
  font: 700 12.5px/1 var(--font-round);
  color: var(--label-2);
  transition: background var(--d-fast), color var(--d-fast);
}
.tb-credits .icon {
  color: var(--orange);
}
.tb-credits .icon-duo {
  opacity: 0.4;
}
.tb-credits:hover {
  background: var(--glass-strong, var(--bg-elevated));
  color: var(--label);
}
.tb-more {
  width: 34px;
  height: 34px;
  border-radius: var(--r-full);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-highlight), 0 0 0 0.5px var(--glass-edge);
  color: var(--label-2);
}
.tb-more:hover {
  color: var(--label);
}
.tb-vibe {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  margin: 0 4px;
  border-radius: var(--r-full);
  background: var(--label);
  color: var(--bg);
  font: 650 13px/1 var(--font);
  transition: transform var(--d) var(--spring), box-shadow var(--d), background var(--d-fast);
}
.tb-vibe:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}
.tb-vibe:active {
  transform: scale(0.95);
}
.tb-vibe .icon {
  transition: transform var(--d-slow) var(--spring);
}
.tb-vibe:hover .icon {
  transform: rotate(18deg) scale(1.15);
}
.tb-vibe.is-on {
  background: var(--vibe-gradient);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), var(--glow);
}
.tb-vibe.is-busy .icon {
  animation: twinkle 1.6s var(--ease) infinite;
}

@media (max-width: 1240px) {
  .tb-insert-label {
    display: none;
  }
  .tb-insert {
    width: 38px;
    height: 40px;
  }
}
@media (max-width: 900px) {
  .tb-center {
    display: none;
  }
  .studio-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .tb-save {
    display: none;
  }
}

/* ============ Navigator ============ */
/* 底部为视图工具栏留出高度,工具栏贴在导航栏正下方 */
.studio-nav {
  position: absolute;
  z-index: 10;
  top: var(--top);
  left: var(--inset);
  bottom: calc(var(--inset) + 52px);
  width: var(--studio-nav-w);
  display: flex;
  flex-direction: column;
  border-radius: var(--r-2xl);
  overflow: hidden;
  animation: slide-in-left var(--d-slow) var(--spring);
}
/* 折叠手柄:挂在导航栏右缘垂直居中(收起入口移出头部) */
.nav-collapse {
  position: absolute;
  z-index: 26;
  left: calc(var(--inset) + var(--studio-nav-w) - 11px);
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  border-radius: 8px;
  background: var(--glass-strong, rgba(28, 27, 34, 0.92));
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-highlight), 0 0 0 0.5px var(--glass-edge), var(--shadow-2);
  color: var(--label-2);
  cursor: pointer;
  transition: color var(--d-fast);
}
.nav-collapse:hover {
  color: var(--label);
}
.nav-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 12px 6px;
}
.nav-head .search {
  flex: 1;
  min-width: 0;
}
/* 导航收起后,左缘悬浮手柄负责展开 */
.nav-expander {
  position: absolute;
  z-index: 25;
  left: var(--inset);
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  color: var(--label-2);
  cursor: pointer;
  animation: slide-in-left var(--d-slow) var(--spring);
  transition: color var(--d-fast), box-shadow var(--d-fast);
}
.nav-expander:hover {
  color: var(--label);
  box-shadow: var(--glass-highlight), 0 0 0 0.5px var(--glass-edge), var(--shadow-2);
}
.nav-body {
  flex: 1;
  padding: 0 8px 16px;
}
.nav-empty {
  padding: 28px 14px;
  font: var(--t-subhead);
  color: var(--label-3);
  text-align: center;
  line-height: 1.6;
}
.nav-section {
  margin-top: 10px;
}
.nav-section-head {
  display: flex;
  align-items: center;
  margin-left: -4px;
  padding-right: 2px;
}
.nav-section-toggle {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 4px 0 0;
  border-radius: 8px;
  font: 650 11.5px/1 var(--font);
  letter-spacing: 0.02em;
  color: var(--label-3);
}
.nav-list {
  /* 子项相对分组标题缩进,建立目录→条目的层级 */
  margin: 2px 0 0 26px;
}
.nav-section-toggle .icon {
  color: var(--label-4);
  transition: transform var(--d) var(--spring);
}
.nav-section-ico {
  width: 14px;
  height: 14px;
  color: var(--tint, var(--label-3));
}
.nav-select-all {
  flex: none;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--r-full);
  font: 500 10.5px/1 var(--font);
  color: var(--label-3);
  transition: color var(--d-fast), background var(--d-fast);
}
.nav-select-all:hover {
  color: var(--label);
  background: var(--hover);
}
.nav-select-all.is-on {
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 12%, transparent);
}
.nav-section-toggle:hover {
  color: var(--label-2);
}
.nav-count {
  margin-left: 4px;
  font-weight: 500;
  color: var(--label-4);
}
.nav-add {
  opacity: 0;
  transition: opacity var(--d-fast);
}
.nav-section:hover .nav-add,
.nav-add:focus-visible {
  opacity: 1;
}
.nav-list {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
}
.nav-list > li {
  animation: rise-in var(--d) var(--ease-out) both;
}
.nav-none {
  padding: 4px 32px;
  font: var(--t-footnote);
  color: var(--label-4);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 30px;
  padding: 3px 8px;
  border-radius: var(--r-md);
  text-align: left;
  transition: background var(--d-fast), transform var(--d) var(--spring);
}
.nav-item:hover {
  background: var(--hover);
}
.nav-item:active {
  transform: scale(0.98);
}
.nav-item.is-selected {
  background: var(--bg-elevated);
  box-shadow: inset 0 0 0 0.5px var(--separator);
}
/* 无封面条目:灰色裸图标(与彩色分组标题区分层级) */
.nav-kind-ico {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--label-3);
}
.nav-thumb {
  width: 22px;
  height: 22px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.15);
}
.nav-thumb img,
.nav-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.nav-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav-name {
  font: 500 12.5px/1.3 var(--font);
  color: var(--label-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item:hover .nav-name,
.nav-item.is-selected .nav-name {
  color: var(--label);
}
.nav-state {
  flex: none;
  width: 12px;
  height: 12px;
  color: var(--brand);
}
.nav-state.is-error {
  color: var(--red);
}

/* ============ Side panel ============ */
.studio-side {
  position: absolute;
  z-index: 10;
  top: var(--top);
  right: var(--inset);
  bottom: var(--inset);
  width: var(--studio-side-w);
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: var(--r-2xl);
  overflow: hidden;
  background: var(--glass-strong);
  animation: slide-in-right var(--d-slow) var(--spring);
}
.side-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 8px;
}
.side-tabs .seg {
  flex: 1;
}
.side-tabs-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  font: 650 12.5px/1 var(--font);
  color: var(--label-2);
}
.side-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  animation: fade-swap var(--d) var(--ease-out);
}
@keyframes fade-swap {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
.side-scroll {
  flex: 1;
  min-height: 0;
}
.side-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 16px 8px;
}
.side-head h2 {
  display: flex;
  align-items: center;
  gap: 7px;
  font: var(--t-headline);
}
.side-head h2 .icon {
  color: var(--brand);
}

@media (max-width: 1100px) {
  .studio.nav-open,
  .studio.side-open {
    --left-inset: var(--inset);
    --right-inset: var(--inset);
  }
  .studio-side,
  .studio-nav {
    box-shadow: var(--glass-highlight), 0 0 0 0.5px var(--glass-edge), var(--shadow-4);
  }
}
@media (max-width: 560px) {
  .studio-side {
    width: auto;
    left: var(--inset);
  }
}

/* ============ Inspector ============ */
.insp {
  display: flex;
  flex-direction: column;
  padding: 0 14px 28px;
}
.insp-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 10px;
  flex-wrap: wrap;
}
.insp-head h2 {
  flex: 1;
  min-width: 0;
  font: var(--t-title3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.insp-kind {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 650 11.5px/1 var(--font);
  color: var(--label-3);
}
.insp-section {
  padding: 14px 0;
  border-top: 0.5px solid var(--separator);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.insp-section:first-of-type {
  border-top: 0;
}
.insp-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.insp-section-head h3 {
  flex: 1;
  font: 600 12.5px/1.3 var(--font);
  color: var(--label-2);
}
.insp-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.insp-label {
  font: 500 12px/1.2 var(--font);
  color: var(--label-3);
}
.insp-textarea {
  min-height: 0;
  font: var(--t-callout);
  line-height: 1.6;
}
.insp-hint {
  font: var(--t-footnote);
  color: var(--label-3);
  line-height: 1.5;
}
.insp-error {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  font: var(--t-footnote);
  color: var(--red);
}
.insp-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.insp-gen {
  display: flex;
  align-items: center;
  gap: 10px;
}
.insp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.insp-actions--col {
  flex-direction: column;
}
.insp-actions--col .btn {
  justify-content: flex-start;
}
.insp-kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font: var(--t-callout);
  color: var(--label-2);
}
.insp-kv strong {
  color: var(--label);
}
.insp-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.insp-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border-radius: var(--r-lg);
  background: var(--fill-4);
  box-shadow: inset 0 0 0 0.5px var(--separator);
}
.insp-stat .app-icon .icon {
  color: #fff;
}
.insp-stat strong {
  font: 600 20px/1.2 var(--font-display);
}
.insp-stat span {
  font: var(--t-caption);
  color: var(--label-3);
}
.insp-tips {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font: var(--t-subhead);
  color: var(--label-2);
  line-height: 1.55;
}
.insp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.insp-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  font: var(--t-subhead);
}
.insp-list li .icon {
  color: var(--label-3);
}
.insp-list li > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.insp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.insp-refs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.insp-refs li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.insp-ref-thumb {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: color-mix(in srgb, var(--tint) 14%, transparent);
  color: var(--tint);
}
.insp-ref-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.insp-ref-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.insp-ref-text strong {
  font: 500 13px/1.3 var(--font);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.insp-ref-text small {
  font: var(--t-caption);
  color: var(--label-3);
}
.insp-ref-role {
  width: auto;
  height: 28px;
  padding: 0 26px 0 8px;
  font-size: 12.5px;
  border-radius: 6px;
  background-position: right 6px center;
}
.insp-versions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.insp-version {
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 8px;
  border: 0.5px solid var(--separator);
  background: var(--fill-4);
}
.insp-version img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.insp-version:hover {
  box-shadow: 0 0 0 2px var(--brand);
}
.insp-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.insp-slots.is-scene {
  grid-template-columns: 1fr;
}
.insp-slot {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.insp-slot-img {
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--r-md);
  background: var(--fill-4);
  border: 0.5px solid var(--separator);
  font: var(--t-footnote);
}
.insp-slots.is-scene .insp-slot-img {
  aspect-ratio: 16 / 9;
}
.insp-slot-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.insp-slot-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  font: 500 12.5px/1 var(--font);
}
.insp-slot-versions {
  display: flex;
  gap: 4px;
}
.insp-slot-versions button {
  width: 28px;
  height: 28px;
  overflow: hidden;
  border-radius: 6px;
  border: 0.5px solid var(--separator);
}
.insp-slot-versions img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.insp-shots {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.insp-shot {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px;
  border-radius: var(--r-sm);
  text-align: left;
}
.insp-shot:hover {
  background: var(--hover);
}
.insp-shot-thumb {
  width: 56px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: var(--fill-3);
  font: 600 12px/1 var(--font);
  color: var(--label-3);
}
.insp-shot-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.insp-shot-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.insp-shot-text strong {
  font: 500 12.5px/1.3 var(--font);
}
.insp-shot-text small {
  font: var(--t-caption);
  color: var(--label-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.insp-ok {
  color: var(--green);
}
.insp-dim {
  display: grid;
  grid-template-columns: 36px 1fr 30px;
  align-items: center;
  gap: 8px;
  font: var(--t-footnote);
  color: var(--label-2);
}
.insp-dim .num {
  text-align: right;
}
.insp-votes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.insp-vote {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--bg-secondary);
  border: 0.5px solid var(--separator);
}
.insp-vote header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.insp-vote-who {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.insp-vote-who strong {
  font: 600 13px/1.3 var(--font);
}
.insp-vote-who small {
  font: var(--t-caption);
  color: var(--label-3);
}
.insp-vote-score {
  font: 650 17px/1 var(--font-display);
  min-width: 30px;
  text-align: right;
}
.insp-vote-eps {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.insp-mood {
  padding: 2px 6px;
  border-radius: 5px;
  font: 500 11px/1.4 var(--font);
  background: var(--fill-4);
  color: var(--label-2);
}
.mood-hooked,
.mood-moved {
  background: color-mix(in srgb, var(--green) 14%, transparent);
  color: var(--green);
}
.mood-laugh {
  background: color-mix(in srgb, var(--yellow) 18%, transparent);
  color: color-mix(in srgb, var(--yellow) 70%, var(--label));
}
.mood-bored,
.mood-confused {
  background: var(--fill-3);
  color: var(--label-2);
}
.mood-angry {
  background: color-mix(in srgb, var(--red) 14%, transparent);
  color: var(--red);
}
.insp-vote-quote {
  display: flex;
  gap: 6px;
  font: var(--t-subhead);
  color: var(--label);
}
.insp-vote-quote .icon {
  color: var(--label-4);
  flex: none;
}
.insp-vote-fix {
  font: var(--t-footnote);
  color: var(--label-2);
  line-height: 1.5;
}
.insp-vote-fix strong {
  color: var(--label);
  font-weight: 600;
}

/* ============ Canvas ============ */
.studio-canvas {
  position: absolute;
  inset: 0;
}
.studio-canvas .react-flow {
  --xy-background-color: var(--canvas);
  --xy-edge-stroke: var(--separator-strong);
  --xy-selection-background-color: color-mix(in srgb, var(--brand) 7%, transparent);
  --xy-selection-border: 1px solid var(--brand-line);
  background:
    radial-gradient(70vmax 60vmax at 50% 40%, transparent 40%, color-mix(in srgb, var(--canvas) 60%, #000) 140%),
    var(--canvas);
  /* hidden still allows focus-driven scrolling when a panel overflows;
     clip forbids it, so the canvas chrome can never drift. */
  overflow: clip !important; /* beats the inline overflow React Flow sets */
}
/* React Flow panels follow the floating chrome instead of the window edge */
.studio-canvas .react-flow__panel.bottom.left {
  left: var(--inset);
  bottom: var(--inset);
  margin: 0;
  transition: left var(--d-slow) var(--spring);
}
.studio-canvas .react-flow__panel.bottom.right {
  right: var(--right-inset);
  bottom: var(--inset);
  margin: 0;
  transition: right var(--d-slow) var(--spring);
}
.studio-canvas.is-panning .react-flow__pane {
  cursor: grab;
}
.studio-canvas.is-panning .react-flow__pane:active {
  cursor: grabbing;
}
.studio-canvas .react-flow__node {
  border-radius: var(--r-lg);
}
.studio-canvas .react-flow__node:focus-visible {
  outline: none;
}
.studio-canvas .react-flow__node.selected,
.studio-canvas .react-flow__node:focus {
  box-shadow: none;
}
.rf-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 18;
}
.rf-ref {
  fill: none;
  stroke: var(--separator-strong);
  stroke-width: 1.6;
  transition: stroke var(--d-fast);
}
.react-flow__edge:hover .rf-ref {
  stroke: var(--label-3);
}
/* New wires draw themselves in from the source handle. */
.rf-ref:not(.is-live) {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: edge-draw 700ms var(--ease-out);
}
@keyframes edge-draw {
  from {
    stroke-dashoffset: 1;
  }
}
.rf-ref.is-selected {
  stroke: var(--brand);
  stroke-width: 2;
}
.rf-ref.is-live {
  stroke: var(--brand);
  stroke-dasharray: 6 6;
  animation: edge-flow 0.8s linear infinite;
}
@keyframes edge-flow {
  to {
    stroke-dashoffset: -12;
  }
}
.rf-edge-label {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: all;
}
.rf-edge-label span {
  padding: 2px 7px;
  border-radius: var(--r-full);
  background: var(--bg-elevated);
  border: 0.5px solid var(--separator-strong);
  box-shadow: var(--shadow-1);
  font: 600 10.5px/1.3 var(--font);
  color: var(--label-2);
}
.rf-edge-label button {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 0.5px solid var(--separator-strong);
  box-shadow: var(--shadow-2);
  color: var(--label-2);
}
.rf-edge-label button:hover {
  background: var(--red);
  color: #fff;
  border-color: transparent;
}
.studio-minimap {
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--glass-highlight), 0 0 0 0.5px var(--glass-edge), var(--shadow-2);
  background: var(--glass-strong) !important;
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  animation: pop-in var(--d-slow) var(--spring);
}

/* zoom + tool controls */
.studio-zoom {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 44px;
  padding: 0 6px;
  border-radius: var(--r-full);
}
.studio-zoom .seg {
  background: transparent;
}
.studio-zoom .seg button {
  display: grid;
  place-items: center;
  width: 28px;
  padding: 0;
}
.studio-zoom-sep {
  width: 0.5px;
  height: 18px;
  margin: 0 4px;
  background: var(--separator-strong);
}
.studio-zoom-value {
  min-width: 48px;
  height: 24px;
  border-radius: 6px;
  font: 500 12px/1 var(--font);
  color: var(--label-2);
}
.studio-zoom-value:hover {
  background: var(--hover);
}

.studio-empty {
  position: absolute;
  top: var(--top);
  bottom: 120px;
  left: var(--left-inset);
  right: var(--right-inset);
  display: grid;
  place-items: center;
  pointer-events: none;
  padding: 24px;
  transition: left var(--d-slow) var(--spring), right var(--d-slow) var(--spring);
}
.studio-empty-card {
  pointer-events: auto;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 34px 32px 28px;
  border-radius: var(--r-2xl);
  text-align: center;
  box-shadow: var(--glass-highlight), 0 0 0 0.5px var(--glass-edge), var(--shadow-3);
  animation: rise-in var(--d-slow) var(--ease-out);
}
.studio-empty-card h2 {
  font: var(--t-title2);
}
.studio-empty-card p {
  font: var(--t-subhead);
  color: var(--label-2);
  line-height: 1.6;
}
.studio-empty-icon {
  margin-bottom: 4px;
  animation: float-y 5s var(--ease) infinite;
}
.studio-drop {
  position: absolute;
  top: var(--top);
  bottom: var(--inset);
  left: var(--left-inset);
  right: var(--right-inset);
  z-index: 30;
  display: grid;
  place-items: center;
  border: 2px dashed var(--brand-line);
  border-radius: var(--r-2xl);
  background: color-mix(in srgb, var(--brand) 6%, transparent);
  pointer-events: none;
  animation: fade-in var(--d-fast);
}
.studio-drop span {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-full);
  background: var(--material-thick);
  box-shadow: var(--shadow-2);
  font: var(--t-headline);
}

/* ============ Vibe composer ============ */
.vibe-composer-wrap {
  position: absolute;
  z-index: 15;
  /* clears the zoom capsule pinned under the navigator at the bottom-left */
  left: calc(var(--inset) + 372px);
  right: calc(var(--right-inset) + 24px);
  bottom: calc(var(--inset) + 6px);
  max-width: 660px;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  transition: left var(--d-slow) var(--spring), right var(--d-slow) var(--spring), width var(--d-slow) var(--spring);
  animation: rise-in var(--d-slow) var(--spring) 160ms both;
}
.vibe-composer-wrap > * {
  pointer-events: auto;
}
/* 面板内停靠:对话流与输入框同处一栏(旧版 Vibe Video 布局) */
.vibe-composer-wrap.is-docked {
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0 10px 12px;
}
.vibe-skill-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0 4px;
}
.vibe-skill-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--fill-3);
  box-shadow: inset 0 0 0 0.5px var(--separator);
  text-align: left;
  transition: background var(--d-fast), box-shadow var(--d-fast);
}
.vibe-skill-card:hover {
  background: var(--fill-4);
  box-shadow: inset 0 0 0 0.5px var(--separator-strong);
}
.vibe-skill-card strong {
  font: 600 12.5px/1.3 var(--font);
  color: var(--label);
}
.vibe-skill-card small {
  font: 400 11px/1.45 var(--font);
  color: var(--label-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* 历史会话列表:header 下的折叠面板 */
.vibe-history {
  max-height: 200px;
  overflow-y: auto;
  padding: 4px 10px 8px;
  border-bottom: 0.5px solid var(--separator);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.vibe-history-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 9px;
  text-align: left;
  transition: background var(--d-fast);
}
.vibe-history-item:hover {
  background: var(--hover);
}
.vibe-history-item.is-current {
  background: var(--fill-3);
}
.vibe-history-title {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 500 12.5px/1.35 var(--font);
  color: var(--label-2);
}
.vibe-history-empty {
  padding: 4px 2px;
  font: var(--t-footnote);
}
@media (max-width: 900px) {
  .vibe-composer-wrap {
    width: auto;
    left: var(--inset);
    right: var(--inset);
    bottom: 62px;
  }
}
.vibe-status {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 14px;
  border-radius: var(--r-full);
  font: 500 12px/1.3 var(--font);
  color: var(--label-2);
  animation: pop-in var(--d) var(--spring);
}
.vibe-status .spinner {
  width: 12px;
  height: 12px;
  color: var(--brand);
}
.vibe-composer {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 26px;
  transition: box-shadow var(--d) var(--ease), transform var(--d) var(--spring);
}
.vibe-expand {
  position: absolute;
  top: 8px;
  right: 10px;
  color: var(--label-3);
  opacity: 0;
  transition: opacity var(--d-fast);
}
.vibe-composer:hover .vibe-expand,
.vibe-composer:focus-within .vibe-expand {
  opacity: 1;
}
.vibe-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 4px;
}
.vibe-input-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.vibe-input-row > .icon-btn {
  flex: none;
  color: var(--label-3);
}
.vibe-input-row > .icon-btn:hover {
  color: var(--brand);
}
.vibe-input {
  display: block;
  width: 100%;
  min-height: 64px;
  max-height: 320px;
  padding: 8px 2px 6px;
  border: 0;
  background: transparent;
  resize: none;
  font: var(--t-body);
  line-height: 1.45;
}
.vibe-input:focus-visible {
  box-shadow: none;
}
.vibe-input::placeholder {
  color: var(--label-3);
}
.vibe-send {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: var(--on-brand);
  transition: transform var(--d-fast), opacity var(--d-fast);
}
.vibe-send:disabled {
  background: var(--fill-2);
  color: var(--label-3);
}
.vibe-send:not(:disabled):active {
  transform: scale(0.92);
}
.vibe-send.is-stop {
  background: var(--label);
  color: var(--bg);
}
.vibe-expand-input {
  display: block;
  width: 100%;
  min-height: 380px;
  padding: 14px 16px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--fill-4);
  box-shadow: inset 0 0 0 0.5px var(--separator);
  resize: vertical;
  font: var(--t-body);
  line-height: 1.6;
  color: var(--label);
}
.vibe-expand-input:focus-visible {
  box-shadow: inset 0 0 0 1px var(--brand);
}
.vibe-expand-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.vibe-skill {
  align-items: flex-start;
}
.vibe-skill-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.vibe-skill-text strong {
  font: 600 13.5px/1.3 var(--font);
}
.vibe-skill-text small {
  font: var(--t-footnote);
  opacity: 0.75;
}

/* ============ Vibe panel ============ */
.vibe-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.vibe-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 14px 24px;
}
.vibe-intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px 2px;
}
.vibe-intro-mark {
  margin-bottom: 4px;
}
.vibe-intro-mark .app-icon {
  animation: float-y 5s var(--ease) infinite;
}
.vibe-intro h3 {
  font: var(--t-title3);
}
.vibe-intro p {
  font: var(--t-subhead);
  color: var(--label-2);
  line-height: 1.6;
}
.vibe-suggest {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.vibe-suggest-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  background: var(--fill-4);
  box-shadow: inset 0 0 0 0.5px var(--separator);
  font: 500 13px/1.4 var(--font);
  text-align: left;
  transition: background var(--d-fast), transform var(--d) var(--spring), box-shadow var(--d);
}
.vibe-suggest-item:hover .icon {
  transform: translateX(3px);
  color: var(--brand);
}
.vibe-suggest-item .icon {
  transition: transform var(--d) var(--spring), color var(--d-fast);
}
.vibe-suggest-item .icon {
  color: var(--label-3);
}
.vibe-suggest-item:hover {
  border-color: var(--brand-line);
}
.vibe-msg {
  display: flex;
}
.vibe-msg.is-user {
  justify-content: flex-end;
}
.vibe-bubble {
  max-width: 86%;
  padding: 9px 13px;
  border-radius: 18px 18px 5px 18px;
  background: var(--label);
  color: var(--bg);
  font: var(--t-callout);
  line-height: 1.5;
  white-space: pre-wrap;
  box-shadow: var(--shadow-1);
  animation: bubble-in var(--d-slow) var(--spring);
  transform-origin: bottom right;
}
@keyframes bubble-in {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(6px);
  }
}
.vibe-text {
  font: var(--t-callout);
  line-height: 1.65;
  color: var(--label);
}
.vibe-text p + p,
.vibe-text ul {
  margin-top: 6px;
}
.vibe-text ul {
  margin-bottom: 0;
  padding-left: 18px;
}
.vibe-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 11px 13px;
  border-radius: var(--r-lg);
  background: var(--fill-4);
  box-shadow: inset 0 0 0 0.5px var(--separator);
}
.vibe-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font: var(--t-footnote);
  color: var(--label-2);
  line-height: 1.45;
}
.vibe-step .icon {
  color: var(--green);
  margin-top: 1px;
  animation: pop-in var(--d) var(--spring);
}
.vibe-step .spinner {
  width: 12px;
  height: 12px;
  margin-top: 1px;
  color: var(--brand);
}
.vibe-step.is-live {
  color: var(--label);
}
.vibe-created {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.vibe-created .chip .icon {
  color: var(--tint);
}
.vibe-ask {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: var(--r-xl);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 0.5px var(--separator-strong), var(--shadow-2);
  animation: rise-in var(--d-slow) var(--spring);
}
.vibe-ask.is-confirm {
  border-color: var(--brand-line);
}
.vibe-ask.is-answered {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 9px 14px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--separator);
  font: var(--t-footnote);
  animation: none;
}
.vibe-ask-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font: var(--t-headline);
}
.vibe-cost {
  width: 100%;
  border-collapse: collapse;
  font: var(--t-footnote);
}
.vibe-cost td {
  padding: 5px 0;
  border-bottom: 0.5px solid var(--separator);
}
.vibe-cost td:last-child {
  text-align: right;
}
.vibe-cost tfoot td {
  border-bottom: 0;
  padding-top: 8px;
}
.vibe-options {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
/* 问询选项:长文案(带路径/编号)整行换行展示,不再溢出卡片 */
.vibe-option {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border-radius: 9px;
  border: 0.5px solid var(--separator);
  background: var(--fill-3);
  font: 500 12.5px/1.5 var(--font);
  color: var(--label-2);
  text-align: left;
  word-break: break-all;
  transition: background var(--d-fast), color var(--d-fast), border-color var(--d-fast);
}
.vibe-option:first-child {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--separator));
  color: var(--label);
}
.vibe-option:hover {
  background: var(--fill-4);
  border-color: var(--separator-strong);
  color: var(--label);
}
.vibe-skip {
  align-self: flex-start;
  font: var(--t-footnote);
  color: var(--label-3);
}
.vibe-skip:hover {
  color: var(--label);
  text-decoration: underline;
}
.vibe-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: var(--t-caption);
  color: var(--label-3);
  text-align: center;
}
.vibe-note.is-error {
  color: var(--red);
}
.vibe-typing {
  display: flex;
  gap: 4px;
  padding: 4px 2px;
}
.vibe-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--label-3);
  animation: typing 1.2s infinite;
}
.vibe-typing i:nth-child(2) {
  animation-delay: 0.15s;
}
.vibe-typing i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes typing {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* In the studio the composer owns the bottom edge, so banners drop from the top. */
body.in-studio .toasts {
  top: calc(var(--toolbar-h) + 12px);
  bottom: auto;
  flex-direction: column;
}

/* ============ 生成坞 + 节点工具栏 ============ */
/* 复刻旧版做法:两者都是节点 DOM 内部的绝对定位子元素——工具栏贴节点顶边
   上方(nd-toolbox),提示词坞贴节点底边下方(nd-dock),拖动缩放天然跟随,
   面板随画布缩放(与旧版 jh-dock/infinite-canvas-operation-panel 一致)。
   仅节点 sole-selected 时渲染(见 MediaNode/CardNode)。 */
.nd-toolbox {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 10px;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  border-radius: 12px;
  white-space: nowrap;
  background: var(--glass-strong, rgba(28, 27, 34, 0.92));
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-highlight), 0 0 0 0.5px var(--glass-edge), var(--shadow-2);
}
.nd-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 7px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--label-2);
  font: 500 12px/1 var(--font);
  cursor: pointer;
  transition: background var(--d-fast), color var(--d-fast);
}
.nd-tool-btn:hover {
  background: var(--hover);
  color: var(--label);
}
.nd-tool-btn.is-danger:hover {
  background: color-mix(in srgb, var(--red) 18%, transparent);
  color: var(--red);
}
.nd-tool-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.nd-tool-btn:disabled:hover {
  background: transparent;
  color: var(--label-2);
}
.nd-dock {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
}
.gen-dock {
  width: 620px;
  max-width: 92vw;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 26px;
}
.gen-dock-input {
  position: relative;
}
.gen-dock-input .nd-refs {
  margin: 2px 4px 8px;
}
/* 展开阅读/编辑按钮:悬浮在输入框右上角 */
.gen-dock-expand {
  position: absolute;
  top: 6px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--label-3);
  cursor: pointer;
  transition: color var(--d-fast), background var(--d-fast);
}
.gen-dock-expand:hover {
  color: var(--label);
  background: var(--hover);
}
.gen-dock-input .nd-textarea {
  width: 100%;
  font: 400 14px/1.6 var(--font);
  padding: 10px 40px 10px 12px;
  border-radius: 14px;
}
.gen-dock-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
/* ============ 超分专用坞(「视频高清」,对齐旧 UI/LibTV) ============ */
/* 无提示词编辑器:模型 + 分辨率分段 + 时长说明 + 积分与提交 */
.superres-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 2px 2px 4px;
}
.superres-title {
  margin: 0;
  font: 600 13px/1.4 var(--font);
  color: var(--label);
}
.superres-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
}
.superres-row > label {
  flex: none;
  width: 60px;
  font: 400 12px/1.4 var(--font);
  color: var(--label-3);
}
.superres-segments {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}
.superres-segments .seg {
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--label-2);
  font: 500 12px/1.4 var(--font);
  cursor: pointer;
  transition: border-color var(--d-fast), background var(--d-fast), color var(--d-fast);
}
.superres-segments .seg:hover {
  color: var(--label);
  border-color: var(--label-3);
}
.superres-segments .seg.is-on {
  color: var(--label);
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 14%, transparent);
}
.nd-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

/* ============ 提示词全屏阅读/编辑窗 ============ */
.prompt-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 4vh 4vw;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  animation: pop-in var(--d) var(--spring);
}
.prompt-modal-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(880px, 100%);
  height: min(640px, 100%);
  padding: 16px 18px;
  border-radius: 28px;
}
.prompt-modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.prompt-modal-title {
  font: 600 15px/1.3 var(--font);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prompt-modal-count {
  font: 500 12px/1 var(--font);
  color: var(--label-3);
}
.prompt-modal-textarea {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: var(--fill);
  border-radius: 16px;
  padding: 14px 16px;
  font: 400 15px/1.7 var(--font);
  color: var(--label);
}
.prompt-modal-textarea:focus {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 35%, transparent);
}
.prompt-modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  font: 500 12px/1 var(--font);
}

/* ============ 音频合成坞(DockAudio) ============ */
.audio-dock-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}
.audio-dock-count {
  margin-left: auto;
  font: 500 11px/1 var(--font-num, var(--font));
  color: var(--label-3);
}
.audio-dock-count.is-hot {
  color: var(--danger, #e5484d);
}
.audio-dock-textarea {
  width: 100%;
  font: 400 14px/1.6 var(--font);
  padding: 10px 12px;
  border-radius: 14px;
}
.audio-voice-btn span {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audio-dock-send {
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 999px;
}
.audio-dock-speed-presets {
  display: inline-flex;
  gap: 6px;
  margin-top: 8px;
}
.audio-dock-speed-presets .seg {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--label-2);
  font: 500 12px/1.4 var(--font);
  cursor: pointer;
  transition: border-color var(--d-fast), background var(--d-fast), color var(--d-fast);
}
.audio-dock-speed-presets .seg:hover {
  color: var(--label);
  border-color: var(--label-3);
}
.audio-dock-speed-presets .seg.is-on {
  color: var(--label);
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 14%, transparent);
}

/* MiMo 风格指令面板:正文与底部工具条之间的内联展开区。 */
.audio-style-panel {
  margin-top: 8px;
  border: 1px solid color-mix(in srgb, var(--brand) 26%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--brand) 5%, var(--bg-2, transparent));
  padding: 8px 10px 10px;
}
.audio-style-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.audio-style-title {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: 600 12px/1.4 var(--font);
  color: var(--label-2);
}
.audio-style-count {
  margin-left: auto;
  font: 500 11px/1 var(--font-num, var(--font));
  color: var(--label-3);
}
.audio-style-count.is-hot {
  color: var(--danger, #e5484d);
}
.audio-style-close {
  border: 0;
  background: transparent;
  color: var(--label-3);
  font: 500 12px/1.4 var(--font);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}
.audio-style-close:hover {
  color: var(--label);
  background: color-mix(in srgb, var(--label) 8%, transparent);
}
.audio-style-textarea {
  width: 100%;
  font: 400 13px/1.6 var(--font);
  padding: 8px 10px;
  border-radius: 10px;
}
.audio-style-director {
  margin-top: 8px;
}
.audio-style-director > .seg {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--label-2);
  font: 500 12px/1.4 var(--font);
  cursor: pointer;
}
.audio-style-director > .seg.is-on {
  color: var(--label);
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 14%, transparent);
}
.audio-style-director-fields {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}
.audio-style-director-fields .nd-input {
  width: 100%;
  font: 400 12.5px/1.4 var(--font);
  padding: 6px 10px;
  border-radius: 8px;
}
.audio-style-director-fields .btn {
  justify-self: start;
}

/* ============ 音色选择弹窗 ============ */
/* 克隆新音色的青色强调钮(克隆上线前的占位入口) */
.btn--accent {
  background: var(--teal);
  color: #fff;
}
.btn--accent:hover {
  background: color-mix(in srgb, var(--teal) 86%, #fff);
}
.voice-picker {
  position: fixed;
  inset: 0;
  z-index: 92;
  display: grid;
  place-items: center;
  padding: 4vh 4vw;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  animation: pop-in var(--d) var(--spring);
}
.voice-picker-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(760px, 100%);
  height: min(680px, 100%);
  /* grid item 的自动最小尺寸会把列表内容高传进轨道,把行撑到超出视口、
     面板被"居中"到视口外——显式清零让 height 真正生效。 */
  min-height: 0;
  padding: 16px 18px;
  border-radius: 28px;
}
.voice-picker-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.voice-picker-title {
  flex: 1;
  font: 600 15px/1.3 var(--font);
}
.voice-picker-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.voice-picker-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--fill);
}
.vp-tab {
  padding: 6px 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--label-3);
  font: 500 13px/1.3 var(--font);
  cursor: pointer;
  transition: color var(--d-fast), background var(--d-fast);
}
.vp-tab:hover {
  color: var(--label-2);
}
.vp-tab.is-on {
  color: var(--label);
  background: var(--hover);
}
.voice-picker-clone {
  border-radius: 999px;
}
.voice-picker-search {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 160px;
  max-width: 260px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--label-3);
}
.voice-picker-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--label);
  font: 400 13px/1.4 var(--font);
}
.voice-picker-search input::placeholder {
  color: var(--label-3);
}
.voice-picker-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  min-height: 0;
  padding: 2px;
}
.vp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--fill);
  transition: background var(--d-fast), box-shadow var(--d-fast);
}
.vp-row:hover {
  background: var(--hover);
}
.vp-row.is-selected {
  background: var(--hover);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--brand) 55%, transparent);
}
.vp-tile {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  color: var(--tint-audio, var(--brand));
  background: color-mix(in srgb, var(--tint-audio, var(--brand)) 14%, transparent);
}
.vp-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 500 13.5px/1.4 var(--font);
  color: var(--label);
}
.vp-meta {
  display: inline-flex;
  gap: 6px;
  margin-left: auto;
  flex: none;
}
.vp-meta i {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font: 400 11px/1.2 var(--font);
  font-style: normal;
  color: var(--label-3);
  white-space: nowrap;
}
.vp-pick {
  flex: none;
  min-width: 58px;
}
.vp-pick.is-selected {
  opacity: 0.72;
}
.vp-fav.is-on {
  color: #e8b339;
}
.voice-picker-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.voice-picker-pager {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.vp-page-btn {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--label-2);
  font: 500 12.5px/1 var(--font);
  cursor: pointer;
  transition: background var(--d-fast), color var(--d-fast);
}
.vp-page-btn:hover:not(:disabled) {
  background: var(--hover);
  color: var(--label);
}
.vp-page-btn.is-on {
  background: var(--brand);
  color: var(--brand-contrast, #fff);
}
.vp-page-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.vp-page-ellipsis {
  color: var(--label-3);
  font: 500 12.5px/1 var(--font);
  padding: 0 2px;
}
.voice-picker-count {
  font: 500 12px/1 var(--font);
  color: var(--label-3);
}
.voice-picker-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--label-3);
  font: 400 13px/1.6 var(--font);
  padding: 30px 0;
}
.voice-picker-empty p {
  margin: 0;
}
.vp-empty-ico {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: var(--fill);
  color: var(--label-3);
}

/* 检查器里的提示词字段:输入框 + 展开按钮纵排 */
.insp-prompt-row {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.insp-prompt-row .textarea {
  width: 100%;
}

/* 模型品牌 tile(web/icons.js 的 JhIcons 渐变 SVG) */
.nd-model-ico,
.menu-item-ico {
  display: inline-flex;
  align-items: center;
  flex: none;
}
.nd-model-ico svg,
.menu-item-ico svg {
  display: block;
  border-radius: 5px;
}

/* 生成坞定位已改为节点 DOM 内部绝对定位(.nd-dock),fixed 锚点方案废弃 */

/* ---------- 画布快捷设置(右上角齿轮) ---------- */

.qs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px;
}
.qs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.qs-title {
  font: 600 12px/1.2 var(--font);
  color: var(--label-2);
}
.qs-sep {
  height: 1px;
  margin: -2px -8px;
  background: var(--separator);
}
.qs-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font: 500 12px/1.2 var(--font);
  color: var(--label-2);
}
/* 模型选择按钮:与 .select 同框型的整行按钮,带品牌图标 */
.qs-model-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 5px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--separator-strong);
  background: color-mix(in srgb, var(--bg-secondary) 82%, transparent);
  font: var(--t-body);
  color: var(--label);
  text-align: left;
  transition: border-color var(--d-fast), box-shadow var(--d), background var(--d-fast);
}
.qs-model-btn:hover {
  border-color: color-mix(in srgb, var(--separator-strong), var(--label) 10%);
}
.qs-model-btn[aria-expanded="true"] {
  border-color: var(--brand);
  box-shadow: var(--ring);
}
.qs-model-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qs-model-chev {
  color: var(--label-3);
  flex: none;
}
.qs-tiers {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.qs-tier-note {
  font: 400 11.5px/1.5 var(--font);
  color: var(--label-3);
}

/* ── 3D 导演台 ────────────────────────────────────────────────────────────── */
/* 画布上的导演台节点:排片工程占位 + 打开入口 */
.nd-director {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 18px 16px 16px;
  text-align: center;
}
.nd-director-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--tint) 16%, transparent);
  color: var(--tint);
}
.nd-director-hint {
  margin: 0;
  font: 400 12px/1.6 var(--font);
  color: var(--label-2);
}
.nd-director-meta {
  font-size: 11px;
}

.nd-director .btn + .btn { margin-top: 8px; }

/* Generation history: compact, scrollable rows with fixed-size media previews. */
.tb-history-settings { display: flex; align-items: center; gap: 3px; }
.studio-side.is-history { width: min(960px, calc(100% - var(--inset) * 2)); }
.canvas-history { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.history-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 20px 18px; color: var(--label-2); font-size: 12px; }
.history-count { color: var(--label-3); margin-left: 8px; }
.history-toolbar a { display: inline-flex; align-items: center; gap: 4px; color: var(--label); }
.history-table-wrap { min-height: 0; overflow: auto; padding: 0 12px 12px; }
.history-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
.history-table th { position: sticky; top: 0; z-index: 1; background: var(--bg-elevated); color: var(--label-2); font-size: 11px; font-weight: 500; white-space: nowrap; }
.history-table th, .history-table td { padding: 12px 10px; border-bottom: 1px solid var(--separator); vertical-align: middle; }
.history-table tbody tr:hover { background: var(--fill-4); }
.history-product { display: flex; gap: 10px; align-items: center; min-width: 150px; }
.history-product-info { min-width: 0; }
.history-product-info > span { display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.history-product-info small, .history-date small { display: block; font-size: 11px; color: var(--label-3); margin-top: 4px; }
.history-product-info details { max-width: 150px; margin-top: 5px; font-size: 11px; }
.history-product-info details p { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 180px; overflow: auto; }
.history-thumb { flex: 0 0 56px; width: 56px; height: 42px; border-radius: 6px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--fill-3); color: var(--label-3); }
.history-thumb img, .history-thumb video { width: 100%; height: 100%; object-fit: cover; }
.history-thumb.is-failed { background: color-mix(in srgb, var(--red) 6%, transparent); color: var(--red); }
.history-wave { display: flex; align-items: center; gap: 3px; color: var(--label-2); }
.history-wave i { width: 2px; border-radius: 2px; background: currentColor; }
.history-date, .history-duration { white-space: nowrap; }
.history-cost { text-align: right; padding-right: 20px !important; }
.history-status { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.history-status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.history-status.is-success { color: var(--green); }
.history-status.is-failed { color: var(--red); }
.canvas-history-failure { display: inline-block; color: var(--label-2); font: inherit; text-align: left; white-space: nowrap; cursor: help; border-bottom: 1px dotted var(--label-3); padding: 2px 0; background: none; }
.canvas-history-failure:hover, .canvas-history-failure:focus-visible { color: var(--label); }
.history-reason-popover { max-width: calc(100vw - 24px); padding: 0; }
.history-reason-popover > div { padding: 16px; max-height: 65vh; overflow-y: auto; }
.history-reason-title { color: var(--red); font-size: 12px; font-weight: 500; }
.history-reason-popover p { font-size: 12px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; margin: 8px 0 0; }
.history-resume { display: inline-flex; align-items: center; gap: 4px; padding: 5px 7px; border: 1px solid var(--separator); border-radius: 6px; font: 500 11px var(--font); white-space: nowrap; background: var(--bg-elevated); color: var(--label); }
.history-resume:hover { background: var(--fill-3); border-color: var(--label-3); }
.history-dash { color: var(--label-3); }
