:root {
  color-scheme: dark;
  --bg: #050505;
  --surface: #202020;
  --surface-2: #2b2b2b;
  --surface-3: #353535;
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.46);
  --text: #f5f5f5;
  --muted: #a7a7a7;
  --soft: #737373;
  --blue: #2da7e7;
  --cyan: #55d8c2;
  --danger: #ff3333;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  user-select: none;
}

  button,
  textarea {
  font: inherit;
}

#app {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  cursor: default;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.18) 0 0.75px, transparent 0.9px) 0 0 / 16px 16px,
    radial-gradient(circle, rgba(255, 255, 255, 0.085) 0 0.7px, transparent 0.85px) 8px 8px / 16px 16px,
    #030303;
}

#app.space-ready {
  cursor: grab;
}

#app.panning {
  cursor: grabbing;
}

#grid,
#connections {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

#grid {
  z-index: 0;
}

#connections {
  z-index: 1;
  pointer-events: none;
  overflow: visible;
}

#world {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  z-index: 4;
  transform-origin: 0 0;
  will-change: transform;
}

.canvas-node {
  position: absolute;
  overflow: visible;
  touch-action: none;
  transform: translateZ(0);
  pointer-events: none;
}

.canvas-node.selected {
  z-index: 8;
}

.canvas-node.node-enter {
  animation: node-enter 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

.canvas-node.dragging {
  cursor: grabbing;
}

@keyframes node-enter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.canvas-node.linked-pop {
  animation: node-pop 420ms cubic-bezier(0.2, 1.6, 0.32, 1);
}

@keyframes node-pop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.028);
  }
  100% {
    transform: scale(1);
  }
}

.node-title {
  position: absolute;
  left: 0;
  top: -28px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: rgba(226, 232, 240, 0.82);
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  line-height: 1;
}

.node-title svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

.image-node {
  cursor: default;
}

.image-node:active,
.gen-node:active {
  cursor: default;
}

.image-frame,
.gen-preview {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: #202020;
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.34);
  isolation: isolate;
  contain: paint;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.gen-preview-status {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 54%;
  transform: translateY(-50%);
  z-index: 5;
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  padding: 14px 20px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  background: rgba(18, 18, 18, 0.78);
  color: #fff;
  font-size: 17px;
  font-weight: 780;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(14px);
  pointer-events: none;
}

.gen-preview-status.visible {
  display: flex;
}

.image-node.selected .image-frame,
.gen-node.selected .gen-preview {
  border-color: rgba(255, 255, 255, 0.58);
  box-shadow:
    0 18px 58px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(255, 255, 255, 0.16),
    0 0 28px rgba(85, 216, 194, 0.18);
}

.gen-node.selected .gen-panel {
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow:
    0 18px 58px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 34px rgba(85, 216, 194, 0.16);
}

.text-node {
  width: 900px;
  height: 830px;
  cursor: default;
  --text-card-left: 170px;
  --text-card-top: 0px;
  --text-card-w: 560px;
  --text-card-h: 560px;
  --text-panel-top: 578px;
  --gen-title-left: var(--text-card-left);
  --gen-preview-w: var(--text-card-w);
  --gen-preview-h: var(--text-card-h);
  --gen-panel-top: var(--text-panel-top);
}

.text-node > .node-title {
  left: var(--gen-title-left);
}

.text-card {
  position: absolute;
  left: var(--text-card-left);
  top: var(--text-card-top);
  width: var(--text-card-w);
  height: var(--text-card-h);
  display: flex;
  flex-direction: column;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 34px;
  background: #202020;
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.36);
  isolation: isolate;
  contain: paint;
  pointer-events: auto;
  cursor: grab;
  overflow: hidden;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.text-node .gen-preview.text-card {
  padding: 22px;
}

.text-board {
  flex: 1 1 auto;
  min-height: 0;
  border: 0;
  outline: 0;
  overflow: auto;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  line-height: 1.55;
  user-select: none;
  white-space: pre-wrap;
  cursor: grab;
}

.text-board:empty::before {
  content: attr(data-placeholder);
  color: rgba(255, 255, 255, 0.42);
  pointer-events: none;
}

.text-node.text-editing .text-board {
  cursor: text;
  user-select: text;
}

.text-node.text-editing .text-board:empty::before {
  content: attr(data-edit-placeholder);
}

.text-node.dragging .text-card,
.text-node.dragging .text-board {
  cursor: grabbing;
}

.text-panel {
  position: absolute;
  left: 0;
  top: var(--text-panel-top);
  width: 900px;
  height: 220px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 28px;
  background: rgba(28, 28, 28, 0.97);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.52);
  overflow: visible;
  pointer-events: auto;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.text-panel:hover {
  background: rgba(18, 18, 18, 0.99);
  border-color: rgba(255, 255, 255, 0.16);
}

.text-panel .panel-top {
  left: 18px;
  right: 18px;
  top: 18px;
}

.text-panel .panel-bottom {
  left: 20px;
  right: 20px;
  bottom: 18px;
}

.text-panel .model-menu {
  margin-left: 0;
}

.text-panel .model-current {
  max-width: 150px;
}

.text-model-price {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 58px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.018)),
    rgba(10, 11, 14, 0.66);
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 820;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 0 auto;
  cursor: default;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.24),
    0 12px 28px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(22px) saturate(1.25);
  -webkit-backdrop-filter: blur(22px) saturate(1.25);
}

.text-model-price::before {
  content: none;
}

.text-model-price svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.85;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.68;
  flex: 0 0 auto;
}

.text-model-menu .model-choice {
  align-items: center;
  min-height: 50px;
  padding: 8px 10px;
}

.text-model-menu .model-choice-body {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.text-model-menu .model-choice-body > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-choice-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.model-choice-price {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 46px;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(85, 216, 194, 0.13);
  color: rgba(195, 255, 244, 0.92);
  font-size: 10px;
  font-weight: 860;
  line-height: 1;
  white-space: nowrap;
  flex: 0 0 auto;
}

.text-panel .model-menu-popover {
  top: auto;
  bottom: 46px;
  min-width: 280px;
  max-height: 220px;
  z-index: 90;
}

.text-panel .model-menu.open {
  z-index: 140;
}

.text-panel .prompt-input.text-ai-input {
  height: 74px;
  user-select: text;
}

.text-ai-composer {
  position: absolute;
  left: 20px;
  right: 20px;
  top: 72px;
  bottom: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 8px 8px 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(18, 18, 18, 0.99);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  cursor: default;
}

.text-ai-input {
  width: 100%;
  height: 40px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  font-size: 18px;
  line-height: 1.35;
  user-select: text;
}

.text-ai-input::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.text-card > textarea:not(.text-ai-input) {
  display: none;
}

.text-ai-send {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.085);
  color: #fff;
  cursor: pointer;
  box-shadow: none;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.text-ai-send:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow: 0 0 22px rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.text-ai-send svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.text-node.ai-busy .text-ai-send {
  opacity: 0.58;
  cursor: wait;
}

.text-node.ai-busy .text-bottom-send {
  opacity: 0.58;
  cursor: wait;
}

.text-node.ai-busy .text-board {
  cursor: wait;
  user-select: none;
}

.text-node.ai-busy .text-card {
  cursor: wait;
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow:
    0 18px 58px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(255, 255, 255, 0.09),
    0 0 28px rgba(255, 255, 255, 0.08);
}

.text-node.ai-busy .text-card::before {
  content: "AI 正在整理";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 104px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.66);
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  font-weight: 820;
  pointer-events: none;
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
}

.text-node.ai-busy .text-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent 0 34%, rgba(255, 255, 255, 0.045) 43%, rgba(255, 255, 255, 0.22) 50%, rgba(255, 255, 255, 0.045) 57%, transparent 66% 100%);
  transform: translateX(-100%);
  animation: sweep 1.15s ease-in-out infinite;
  pointer-events: none;
  will-change: transform;
}

.text-node.selected .text-card {
  border-color: rgba(255, 255, 255, 0.58);
  box-shadow:
    0 18px 58px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(255, 255, 255, 0.16),
    0 0 28px rgba(85, 216, 194, 0.18);
}

.text-node.selected .text-panel {
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow:
    0 18px 58px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 34px rgba(85, 216, 194, 0.16);
}

.text-node.ai-busy.selected .text-card {
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow:
    0 18px 58px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(255, 255, 255, 0.09),
    0 0 28px rgba(255, 255, 255, 0.08);
}

.image-frame:hover,
.gen-preview:hover,
.gen-panel:hover,
.text-panel:hover,
.text-card:hover,
.tool-btn:hover,
.send-button:hover {
  box-shadow:
    0 18px 58px rgba(0, 0, 0, 0.48),
    0 0 30px rgba(255, 255, 255, 0.08);
}

.upload-replace-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 7;
  width: 46px;
  height: 46px;
  display: none;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  background: rgba(18, 25, 14, 0.74);
  color: rgba(255, 255, 255, 0.96);
  cursor: pointer;
  pointer-events: auto;
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: opacity 140ms ease, transform 160ms ease, border-color 140ms ease, background 140ms ease;
}

.upload-replace-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(18, 25, 14, 0.86);
}

.upload-replace-button svg {
  width: 23px;
  height: 23px;
  stroke: currentColor;
  stroke-width: 2.1;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.canvas-node.can-replace-upload .upload-replace-button {
  display: grid;
}

.image-node img,
.gen-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: transparent;
  pointer-events: none;
  -webkit-user-drag: none;
  transform-origin: center;
  transition: transform 180ms ease;
}

.gen-preview video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #050505;
  pointer-events: none;
}

.gen-node.failed .gen-preview {
  border-color: rgba(255, 136, 136, 0.28);
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 118, 118, 0.11), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012)),
    #141416;
}

.gen-node.failed .gen-preview video {
  background: #050505;
}

.placeholder-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  color: rgba(255, 255, 255, 0.24);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.placeholder-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
}

.node-badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
  display: none;
}

.image-node.generating .node-badge,
.image-node.failed .node-badge {
  display: block;
}

.image-node.generation-slot .image-frame {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.07), transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)),
    #202020;
}

.image-node.generation-slot img {
  display: none;
}

.image-node.generation-slot .image-frame::before {
  content: attr(data-loading-label);
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 18px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  min-height: 26px;
  padding: 0 0 10px 14px;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 3px 8px, rgba(214, 255, 249, 0.88) 0 2.5px, transparent 3px),
    linear-gradient(90deg, transparent, rgba(214, 255, 249, 0.82), transparent) -42% 100% / 42% 2px no-repeat,
    linear-gradient(90deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.028)) 0 100% / 100% 2px no-repeat;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  font-weight: 820;
  line-height: 1;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.72);
  animation: node-loading-rail 1.55s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.image-node.generation-slot .node-badge {
  display: none;
}

.image-node.generation-slot.failed .image-frame::before {
  content: attr(data-error-label);
  left: 18px;
  right: 18px;
  top: 50%;
  bottom: auto;
  justify-content: center;
  max-width: calc(100% - 36px);
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(255, 132, 132, 0.24);
  border-radius: 999px;
  white-space: normal;
  text-align: center;
  color: rgba(255, 235, 235, 0.92);
  background: rgba(18, 18, 20, 0.72);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transform: translateY(-50%);
  animation: none;
}

.image-node.generation-slot.failed .image-frame {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 116, 116, 0.08), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)),
    #1b1b1d;
}

.image-node.generating .image-frame::after,
.gen-node.busy .gen-preview::after,
.image-node.derived-loading .image-frame::after,
.grid-frame-node.derived-loading .grid-frame-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent 0 34%, rgba(255, 255, 255, 0.045) 43%, rgba(255, 255, 255, 0.22) 50%, rgba(255, 255, 255, 0.045) 57%, transparent 66% 100%);
  transform: translateX(-100%);
  animation: sweep 1.15s ease-in-out infinite;
  pointer-events: none;
  will-change: transform;
}

.gen-node.busy.has-image .gen-preview > img,
.gen-node.busy.has-video .gen-preview > video {
  filter: blur(8px) saturate(0.78) brightness(0.72);
  transform: scale(1.035);
}

.gen-node.busy.has-image .gen-preview::after,
.gen-node.busy.has-video .gen-preview::after {
  z-index: 6;
  background: linear-gradient(90deg, transparent 0 30%, rgba(255, 255, 255, 0.08) 42%, rgba(255, 255, 255, 0.26) 50%, rgba(255, 255, 255, 0.08) 58%, transparent 70% 100%);
  transform: translateX(-100%);
  animation: sweep 1.15s ease-in-out infinite;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.gen-node.busy.has-image .gen-preview-status,
.gen-node.busy.has-video .gen-preview-status {
  display: block;
  inset: 0;
  left: 0;
  right: 0;
  top: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: rgba(22, 24, 24, 0.42);
  box-shadow: none;
  transform: none;
  -webkit-backdrop-filter: blur(14px) saturate(1.12);
  backdrop-filter: blur(14px) saturate(1.12);
  z-index: 5;
}

.gen-node.busy:not(.has-image):not(.has-video) .gen-preview {
  background:
    radial-gradient(circle at 38% 30%, rgba(255, 255, 255, 0.12), transparent 30%),
    radial-gradient(circle at 68% 72%, rgba(214, 255, 249, 0.08), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025)),
    #202123;
}

.gen-node.busy:not(.has-image):not(.has-video) .gen-preview-status {
  display: block;
  inset: 0;
  left: 0;
  right: 0;
  top: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: rgba(22, 24, 24, 0.34);
  box-shadow: none;
  transform: none;
  -webkit-backdrop-filter: blur(14px) saturate(1.12);
  backdrop-filter: blur(14px) saturate(1.12);
  z-index: 5;
}

.image-node.derived-loading::after,
.grid-frame-node.derived-loading::after {
  content: none !important;
  display: none !important;
}

@keyframes sweep {
  to {
    transform: translateX(100%);
  }
}

@keyframes node-loading-rail {
  from {
    background-position: 0 8px, -42% 100%, 0 100%;
  }
  to {
    background-position: 0 8px, 142% 100%, 0 100%;
  }
}

@keyframes node-loading-icon-breathe {
  0%, 100% {
    opacity: 0.72;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.055);
  }
}

.node-port {
  position: absolute;
  top: 50%;
  width: 38px;
  height: 38px;
  border: 1.5px solid rgba(255, 255, 255, 0.56);
  border-radius: 50%;
  background: rgba(8, 8, 8, 0.7);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0.18;
  pointer-events: auto;
  --port-x: 0px;
  --port-y: 0px;
  --rest-x: 0px;
  transform: translate(calc(var(--rest-x) + var(--port-x)), calc(-50% + var(--port-y))) scale(0.72);
  transition: opacity 160ms ease, transform 180ms cubic-bezier(0.16, 1, 0.3, 1), border-color 120ms ease, box-shadow 120ms ease;
  z-index: 4;
}

.node-port.left {
  left: -78px;
  --rest-x: 34px;
}

.node-port.right {
  right: -78px;
  --rest-x: -34px;
}

.gen-node .node-port {
  top: 210px;
}

.gen-node .node-port.left {
  left: 62px;
  right: auto;
}

.gen-node .node-port.right {
  left: 602px;
  right: auto;
}

.text-node .node-port {
  top: 210px;
}

.text-node .node-port.left {
  left: 82px;
  right: auto;
}

.text-node .node-port.right {
  left: 580px;
  right: auto;
}

.marquee-active .node-port { opacity: 0; pointer-events: none; }

.node-port.near,
.node-port.dragging,
.canvas-node:hover .node-port,
.canvas-node.selected .node-port {
  opacity: 1;
  pointer-events: auto;
  --rest-x: 0px;
  transform: translate(var(--port-x), calc(-50% + var(--port-y))) scale(1);
}

body.multi-selected .canvas-node.selected .node-port {
  opacity: 0;
  pointer-events: none;
  transform: translate(calc(var(--rest-x) + var(--port-x)), calc(-50% + var(--port-y))) scale(0.72);
}

.node-port::before,
.node-port::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.74);
  border-radius: 999px;
}

.node-port::before {
  width: 18px;
  height: 2.5px;
}

.node-port::after {
  width: 2.5px;
  height: 18px;
}

.node-port:hover,
.node-port.dragging {
  border-color: rgba(255, 255, 255, 0.86);
  box-shadow: 0 0 26px rgba(255, 255, 255, 0.16);
}

.gen-node {
  width: 900px;
  height: 830px;
  cursor: default;
  --gen-preview-w: 560px;
  --gen-preview-h: 560px;
  --gen-panel-top: 578px;
}

.gen-preview {
  inset: auto;
  left: 170px;
  top: 0;
  width: var(--gen-preview-w);
  height: var(--gen-preview-h);
}

.image-node.preview-zoom img,
.gen-node.preview-zoom .gen-preview img {
  transform: scale(var(--preview-zoom, 1.18));
}

.gen-node.has-image .placeholder-icon,
.gen-node.has-video .placeholder-icon {
  display: none;
}

.gen-panel {
  position: absolute;
  left: 0;
  top: var(--gen-panel-top);
  width: 900px;
  height: 236px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 28px;
  background: rgba(31, 31, 31, 0.98);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.52);
  overflow: visible;
  pointer-events: auto;
}

.gen-node.has-refs:not(.compact-gen) .gen-panel {
  height: 294px;
}

.gen-node.panel-collapsed {
  height: var(--gen-preview-h);
}

.gen-node.panel-collapsed .gen-panel {
  display: none;
}

.gen-node.compact-gen {
  height: 746px;
}

.model-menu.hidden-model-menu,
.model-menu.hidden-model-menu + .divider {
  display: none;
}

.gen-node.compact-gen .gen-panel {
  height: 154px;
}

.gen-node.compact-gen .prompt-input {
  display: none;
}

.gen-node.compact-gen .gen-status {
  left: 22px;
  right: 82px;
  bottom: 70px;
}

.gen-node.compact-gen .panel-top,
.gen-node.compact-gen .quick-menu,
.gen-node.compact-gen .preset-menu,
.gen-node.compact-gen .ratio-menu,
.gen-node.compact-gen .quality-menu,
.gen-node.compact-gen .count-menu,
.gen-node.compact-gen .divider,
.gen-node.compact-gen .send-button,
.gen-node.compact-gen .light-row {
  display: none;
}

.gen-node[data-kind="video"].compact-gen .quick-menu,
.gen-node[data-kind="video"].compact-gen .preset-menu {
  display: inline-flex !important;
}

.gen-node[data-kind="video"] .quick-menu,
.gen-node[data-kind="video"].compact-gen .quick-menu {
  display: none !important;
}

.gen-node.compact-gen[data-kind="image"] .ratio-menu,
.gen-node.compact-gen[data-kind="image"] .quality-menu,
.gen-node.compact-gen[data-kind="image"] .send-button {
  display: inline-flex;
}

.panel-top {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 80;
}

.panel-icon-button {
  min-width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: #353535;
  color: #d8d8d8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  transition: background 120ms ease;
}

.panel-icon-button .panel-label {
  font-size: 13px;
  font-weight: 820;
  line-height: 1;
  white-space: nowrap;
}

.panel-icon-button.icon-only {
  width: 44px;
  min-width: 44px;
  padding: 0;
}

.panel-icon-button:hover {
  background: #414141;
}

.panel-menu {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.panel-bottom .panel-menu {
  z-index: 24;
}

.panel-bottom .panel-icon-button {
  width: 36px;
  height: 36px;
  border-radius: 999px;
}

.panel-top .quick-menu {
  z-index: 42;
}

.panel-top .preset-menu {
  z-index: 44;
}

.panel-top .quick-popover {
  top: 52px;
  left: 0;
  right: auto;
  transform-origin: top left;
}

.panel-top .preset-popover,
.panel-bottom .quick-popover {
  top: 46px;
  bottom: auto;
  left: 0;
  right: auto;
  transform-origin: top left;
}

.gen-node[data-kind="video"] .panel-bottom .quick-popover {
  top: 48px;
  bottom: auto;
  left: -58px;
  right: auto;
  transform-origin: top left;
  z-index: 90;
}

.panel-menu.open > .panel-icon-button,
.preset-menu.preset-active > .preset-button {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  box-shadow: 0 0 22px rgba(255, 255, 255, 0.08);
}

.quick-popover,
.preset-popover {
  position: absolute;
  top: 52px;
  right: 0;
  display: none;
  flex-direction: column;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(18, 18, 18, 0.97);
  box-shadow:
    0 20px 54px rgba(0, 0, 0, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px);
  z-index: 120;
  transform-origin: top right;
}

.quick-menu.open .quick-popover,
.preset-menu.open .preset-popover {
  display: flex;
  animation: pop-open 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.quick-popover {
  min-width: 168px;
}

.quick-preset-choice,
.preset-choice,
.preset-new,
.preset-create,
.preset-delete,
.preset-save {
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  background: transparent;
  color: #ededed;
  cursor: pointer;
  font-size: 14px;
  font-weight: 820;
  padding: 0 12px;
  text-align: left;
  white-space: nowrap;
}

.quick-preset-choice:hover,
.preset-choice:hover,
.preset-choice.active,
.preset-new:hover,
.preset-create:hover,
.preset-delete:hover,
.preset-save:hover {
  background: rgba(255, 255, 255, 0.11);
}

.preset-new:disabled,
.preset-create:disabled,
.preset-delete:disabled,
.preset-save:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.preset-popover {
  width: 344px;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(15, 15, 15, 0.98);
  backdrop-filter: none;
  box-shadow:
    0 22px 54px rgba(0, 0, 0, 0.56),
    inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.preset-head,
.preset-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.preset-head {
  align-items: center;
  padding-bottom: 2px;
}

.preset-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.preset-head strong {
  color: #fff;
  font-size: 15px;
  font-weight: 840;
}

.preset-head span,
.preset-section-label,
.preset-field-label {
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 720;
}

.preset-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 760;
  cursor: pointer;
  user-select: none;
}

.preset-toggle input {
  accent-color: #fff;
}

.preset-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: 86px;
  overflow: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.preset-choice {
  max-width: 100%;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.045);
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.preset-choice.active {
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.preset-empty {
  grid-column: 1 / -1;
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.46);
  font-size: 12px;
  font-weight: 720;
}

.preset-editor-fields {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.preset-name-input,
.preset-textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 11px;
  outline: none;
  padding: 10px;
  background: rgba(0, 0, 0, 0.24);
  color: #f6f6f6;
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
}

.preset-name-input {
  height: 38px;
}

.preset-textarea {
  min-height: 86px;
  resize: vertical;
}

.preset-name-input:focus,
.preset-textarea:focus {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.preset-save {
  margin-left: auto;
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(245, 245, 245, 0.92);
  color: #111;
  text-align: center;
}

.preset-create {
  background: rgba(255, 255, 255, 0.075);
  text-align: center;
}

.preset-delete {
  border-color: rgba(255, 120, 120, 0.22);
  color: #ffb4b4;
  background: rgba(255, 80, 80, 0.055);
  text-align: center;
}

.voice-button.listening {
  color: #111;
  background: #f4f4f4;
  box-shadow: 0 0 24px rgba(85, 216, 194, 0.28);
}

.voice-button.recording {
  color: #111;
  background: #7ff5df;
  box-shadow:
    0 0 0 0 rgba(127, 245, 223, 0.42),
    0 0 30px rgba(85, 216, 194, 0.36);
  animation: voice-pulse 1.1s ease-in-out infinite;
}

.voice-button.transcribing {
  color: #111;
  background: #f4f4f4;
  cursor: wait;
}

@keyframes voice-pulse {
  0% {
    box-shadow:
      0 0 0 0 rgba(127, 245, 223, 0.36),
      0 0 30px rgba(85, 216, 194, 0.28);
  }
  70% {
    box-shadow:
      0 0 0 12px rgba(127, 245, 223, 0),
      0 0 30px rgba(85, 216, 194, 0.32);
  }
  100% {
    box-shadow:
      0 0 0 0 rgba(127, 245, 223, 0),
      0 0 30px rgba(85, 216, 194, 0.28);
  }
}

.panel-icon-button svg,
.tool-btn svg,
.editor-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.prompt-input {
  position: absolute;
  left: 20px;
  right: 20px;
  top: 72px;
  height: 96px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: #f5f5f5;
  font-size: 18px;
  line-height: 1.38;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  user-select: text;
}

.prompt-typo-layer {
  position: absolute;
  left: 20px;
  right: 20px;
  top: 72px;
  height: 96px;
  padding: 0;
  border: 0;
  color: transparent;
  font-size: 18px;
  line-height: 1.38;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.prompt-typo-layer .typo-mark {
  color: transparent;
  text-decoration-line: underline;
  text-decoration-style: solid;
  text-decoration-color: #ff4f4f;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.prompt-typo-layer.has-mentions {
  z-index: 2;
  color: #f5f5f5;
  pointer-events: none;
}

.prompt-input.mention-overlay-active {
  color: transparent;
  caret-color: transparent;
}

.prompt-typo-layer .prompt-fake-caret {
  display: inline-block;
  width: 1px;
  height: 1.12em;
  margin: 0 -0.5px;
  vertical-align: -0.18em;
  background: #f5f5f5;
  animation: promptFakeCaretBlink 1s steps(1, end) infinite;
}

@keyframes promptFakeCaretBlink {
  50% { opacity: 0; }
}

.prompt-typo-layer .studio-inline-mention {
  pointer-events: auto;
  height: 26px;
  max-width: 116px;
  margin: 0;
  padding: 2px 8px 2px 4px;
  vertical-align: middle;
  line-height: 20px;
  overflow: hidden;
}

.prompt-typo-layer .studio-inline-mention img,
.prompt-typo-layer .studio-inline-mention-media {
  width: 18px;
  height: 18px;
  margin-right: 5px;
  border-radius: 6px;
}

.prompt-typo-layer .studio-inline-mention-label {
  max-width: 66px;
}

.gen-panel .prompt-input {
  z-index: 1;
}

.prompt-input::placeholder {
  color: #8a8a8a;
}

.ref-row {
  position: absolute;
  left: 128px;
  right: 20px;
  top: 18px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #b6b6b6;
  font-size: 14px;
  font-weight: 700;
  min-width: 0;
  height: 44px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.gen-node.has-refs:not(.compact-gen) .ref-row {
  left: 20px;
  top: 72px;
  z-index: 34;
}

.gen-node.has-refs:not(.compact-gen) .prompt-input,
.gen-node.has-refs:not(.compact-gen) .prompt-typo-layer {
  top: 126px;
  height: 104px;
}

.ref-row span {
  max-width: 148px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ref-thumb {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: #111;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.34);
}

.ref-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.ref-thumb.media-ref {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d8d8d8;
}

.ref-thumb.media-ref svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.ref-thumb .ref-thumb-label {
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 3px;
  z-index: 2;
  max-width: calc(100% - 6px);
  padding: 1px 3px 2px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.panel-bottom {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f5f5f5;
  font-size: 14px;
  font-weight: 700;
}

.panel-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.panel-actions > .count-menu {
  display: none;
}

.gen-panel .model-menu {
  margin-left: 0;
}

.gen-panel .panel-actions {
  margin-left: auto;
}

.gen-credit-cost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 52px;
  height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 820;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.22);
  white-space: nowrap;
  cursor: default;
  flex-shrink: 0;
}

.gen-credit-cost svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 1.85;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.92;
}

.panel-actions .send-button {
  margin-left: 0;
}

.bottom-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: #f2f2f2;
  white-space: nowrap;
}

button.bottom-chip {
  cursor: pointer;
  font: inherit;
  font-weight: 780;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

button.bottom-chip:hover,
.model-menu.open .bottom-chip {
  background: rgba(255, 255, 255, 0.105);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.model-menu {
  position: relative;
  z-index: 22;
  display: inline-flex;
}

.model-menu-popover {
  position: absolute;
  left: 0;
  top: 46px;
  display: none;
  flex-direction: column;
  gap: 4px;
  min-width: 248px;
  max-width: 320px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(22, 22, 22, 0.98);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
  transform-origin: top left;
  max-height: min(260px, calc(100vh - 180px));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.model-menu.open .model-menu-popover {
  display: flex;
  animation: pop-open 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.panel-bottom .model-menu-popover,
.gen-node[data-kind="video"] .panel-bottom .model-menu-popover {
  top: auto;
  bottom: 46px;
  transform-origin: bottom left;
}

.panel-bottom .model-menu.open .model-menu-popover {
  animation: menu-pop-up 140ms cubic-bezier(0.16, 1, 0.3, 1);
}

.gen-node[data-kind="video"] .panel-bottom .model-menu-popover {
  max-height: 212px;
}

.model-choice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: rgba(255, 255, 255, 0.84);
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  font-weight: 760;
}

.model-choice .yungou-mark {
  flex: 0 0 19px;
  margin-top: 1px;
}

.model-choice-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-choice-reason {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.28;
  white-space: normal;
}

.model-choice:hover,
.model-choice.active {
  background: rgba(255, 255, 255, 0.105);
  color: #fff;
}

.yungou-mark {
  display: inline-grid;
  place-items: center;
  width: 19px;
  height: 19px;
  color: #fff;
}

.yungou-mark svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  stroke-width: 1.65;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.yungou-mark .yungou-knot {
  stroke: none;
}

.yungou-mark .banana-icon {
  stroke-width: 1.45;
}

.yungou-mark .banana-peel {
  fill: #ffd45a;
  stroke: #ffe9a3;
}

.yungou-mark .banana-shadow {
  fill: #c98b18;
  stroke: none;
  opacity: 0.72;
}

.yungou-mark .yungou-knot,
.studio-model-icon .yungou-knot {
  fill: currentColor;
  stroke: none;
}

.studio-model-icon .banana-peel {
  fill: #ffd45a;
  stroke: #ffe9a3;
}

.studio-model-icon .banana-shadow {
  fill: #c98b18;
  stroke: none;
  opacity: 0.72;
}

.divider {
  width: 1px;
  height: 26px;
  background: rgba(255, 255, 255, 0.12);
}

.ratio-menu {
  position: relative;
  z-index: 20;
}

.ratio-menu.open,
.quality-menu.open,
.count-menu.open,
.reference-mode-menu.open,
.model-menu.open {
  z-index: 140;
}

.ratio-current {
  height: 36px;
  min-width: 68px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.26);
  color: #f2f2f2;
  cursor: pointer;
  font-size: 14px;
  font-weight: 850;
  padding: 0 14px;
  transition: background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.ratio-current:hover,
.ratio-menu.open .ratio-current {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.count-menu {
  position: relative;
  z-index: 20;
}

.reference-mode-menu {
  position: relative;
  z-index: 20;
}

.count-menu.open {
  z-index: 90;
}

.reference-mode-menu.open {
  z-index: 90;
}

.quality-menu {
  position: relative;
  z-index: 20;
}

.count-current {
  height: 36px;
  min-width: 48px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.26);
  color: #f2f2f2;
  cursor: pointer;
  font-size: 14px;
  font-weight: 850;
  padding: 0 13px;
  transition: background 120ms ease, box-shadow 120ms ease;
}

.reference-mode-current {
  height: 36px;
  min-width: 54px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.26);
  color: #f2f2f2;
  cursor: pointer;
  font-size: 14px;
  font-weight: 850;
  padding: 0 13px;
  transition: background 120ms ease, box-shadow 120ms ease;
}

.count-current:hover,
.count-menu.open .count-current {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.08);
}

.reference-mode-current:hover,
.reference-mode-menu.open .reference-mode-current {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.08);
}

.quality-current {
  height: 36px;
  min-width: 56px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.26);
  color: #f2f2f2;
  cursor: pointer;
  font-size: 14px;
  font-weight: 850;
  padding: 0 13px;
  transition: background 120ms ease, box-shadow 120ms ease;
}

.quality-current:hover,
.quality-menu.open .quality-current {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.08);
}

.ratio-popover,
.reference-mode-popover,
.count-popover,
.quality-popover,
.tool-popover {
  position: absolute;
  display: none;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(38, 38, 38, 0.96), rgba(19, 19, 19, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 20px 54px rgba(0, 0, 0, 0.54);
  backdrop-filter: blur(18px) saturate(1.15);
}

.ratio-popover {
  left: 0;
  bottom: 46px;
  width: 286px;
  grid-template-columns: repeat(3, 1fr);
  transform-origin: bottom left;
}

.count-popover {
  left: 50%;
  bottom: 42px;
  transform: translateX(-50%);
  flex-direction: column;
  min-width: 88px;
  z-index: 91;
}

.reference-mode-popover {
  left: 50%;
  bottom: 42px;
  transform: translateX(-50%);
  flex-direction: column;
  min-width: 112px;
  z-index: 91;
}

.quality-popover {
  left: 50%;
  bottom: 42px;
  transform: translateX(-50%);
  flex-direction: column;
  min-width: 104px;
  z-index: 80;
}

.ratio-menu.open .ratio-popover {
  display: grid;
  animation: pop-open 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.reference-mode-menu.open .reference-mode-popover,
.count-menu.open .count-popover,
.quality-menu.open .quality-popover,
.tool-popover.visible {
  display: flex;
  animation: pop-open 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pop-open {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.ratio-choice,
.reference-mode-choice,
.count-choice,
.quality-choice,
.tool-popover button {
  height: 38px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  font-size: 14px;
  font-weight: 840;
  padding: 0 15px;
  white-space: nowrap;
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.reference-mode-choice.active,
.count-choice.active,
.quality-choice.active {
  background: rgba(255, 255, 255, 0.92);
  color: #151515;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 10px 22px rgba(0, 0, 0, 0.28);
}

.ratio-choice.active {
  background: rgba(255, 255, 255, 0.92);
  color: #151515;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 10px 22px rgba(0, 0, 0, 0.28);
}

.ratio-choice:hover,
.count-choice:hover,
.quality-choice:hover,
.tool-popover button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: translateY(-1px);
}

.send-button {
  margin-left: auto;
  width: 46px;
  min-width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(244, 244, 244, 0.92);
  color: #101010;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  place-items: center;
  padding: 0;
  font-size: 0;
  font-weight: 880;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 10px 24px rgba(0, 0, 0, 0.28);
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.send-button:hover {
  transform: translateY(-1px);
  background: #fff;
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 12px 28px rgba(0, 0, 0, 0.34);
}

.send-button .send-arrow {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: transparent;
  color: #111;
  line-height: 1;
}

.send-button .send-arrow svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2.35;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.send-button:disabled {
  opacity: 0.62;
  cursor: wait;
}

.gen-status {
  position: absolute;
  left: 24px;
  right: 86px;
  bottom: 62px;
  max-height: 38px;
  overflow: hidden;
  color: #a5a5a5;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.34;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.light-row {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 62px;
  display: none;
  grid-template-columns: auto 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  color: #aaa;
  font-size: 12px;
  font-weight: 760;
}

.gen-node.compact-gen .light-row {
  display: none;
}

.light-row input {
  width: 100%;
  height: 3px;
  accent-color: #f4f4f4;
}

.gen-node.compact-gen .panel-bottom {
  bottom: 18px;
  right: auto;
  width: auto;
}

.gen-node.compact-gen[data-kind="image"] .panel-bottom {
  right: 20px;
  width: auto;
  max-width: calc(100% - 40px);
}

.gen-status.error {
  color: #ffb5b5;
}

.gen-status.error::before {
  content: "生成失败：";
  font-weight: 800;
}

.gen-status:empty {
  display: none;
}

.image-toolbar,
.edit-toolbar {
  position: fixed;
  z-index: 32;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background:
    radial-gradient(circle at 16% 0%, rgba(255, 255, 255, 0.09), transparent 36%),
    linear-gradient(180deg, rgba(34, 34, 34, 0.98), rgba(17, 17, 17, 0.98));
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
  transform: translate(-50%, -100%);
}

.image-toolbar.visible,
.edit-toolbar.visible {
  display: flex;
}

.image-toolbar.below {
  transform: translate(-50%, 0);
}

.image-toolbar [data-action="zoom-out-image"],
.image-toolbar [data-action="zoom-in-image"],
.image-toolbar [data-action="replace-upload"] {
  display: none;
}

.image-toolbar [data-action="merge"] {
  display: none;
}

.image-toolbar [data-action="bake-grid"] {
  display: none;
}

.image-toolbar.can-merge-grid [data-action="merge"] {
  display: inline-flex;
}

.image-toolbar.can-replace-upload [data-action="replace-upload"] {
  display: inline-flex;
}

.image-toolbar.grid-frame-selected [data-action="bake-grid"] {
  display: inline-flex;
}

.image-toolbar.grid-frame-selected [data-action]:not([data-action="download"]):not([data-action="fit"]):not([data-action="bake-grid"]),
.image-toolbar.grid-frame-selected .tool-divider {
  display: none;
}

body.multi-selected .image-toolbar {
  display: none !important;
}

.tool-btn,
.editor-btn {
  position: relative;
  min-width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #e8e8e8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  transition: background 120ms ease, color 120ms ease;
}

.tool-btn.icon-only {
  width: 36px;
  min-width: 36px;
  padding: 0;
}

.tool-label {
  font-size: 13px;
  font-weight: 820;
  line-height: 1;
  white-space: nowrap;
}

.tool-btn:hover,
.tool-btn.active,
.editor-btn:hover,
.editor-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: 0 0 22px rgba(255, 255, 255, 0.08);
}

.tool-btn::after,
.editor-btn::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  top: -48px;
  padding: 7px 12px;
  border-radius: 14px;
  background: #2c2c2c;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(4px);
  transition: opacity 100ms ease, transform 100ms ease;
}

.tool-btn:hover::after,
.editor-btn:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tool-divider {
  width: 1px;
  height: 32px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 4px;
}

.angle-editor {
  width: 690px;
  height: 400px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(22, 22, 22, 0.98);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.62);
  overflow: hidden;
}

.angle-editor {
  position: fixed;
  width: min(690px, calc(100vw - 32px));
  height: min(400px, calc(100vh - 32px));
  z-index: 57;
}

.angle-title {
  position: absolute;
  left: 22px;
  top: 18px;
  color: #f4f4f4;
  font-size: 18px;
  font-weight: 820;
}

.angle-subtitle {
  position: absolute;
  left: 24px;
  top: 50px;
  color: #8f8f8f;
  font-size: 14px;
  font-weight: 700;
}

.angle-close {
  position: absolute;
  right: 16px;
  top: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.angle-stage {
  position: absolute;
  left: 22px;
  top: 72px;
  width: 328px;
  height: 286px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  background:
    radial-gradient(circle at 52% 42%, rgba(255, 255, 255, 0.055), transparent 36%),
    linear-gradient(180deg, #202020, #191919);
  display: grid;
  place-items: center;
  perspective: 780px;
  perspective-origin: 50% 48%;
  overflow: hidden;
  cursor: grab;
}

.angle-stage.dragging {
  cursor: grabbing;
}

.angle-orbit {
  position: absolute;
  left: 50%;
  top: 58%;
  width: 160px;
  height: 75px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  transform: translate(-50%, -50%) rotateX(58deg);
}

.angle-beam {
  position: absolute;
  left: 50%;
  bottom: 44px;
  width: 96px;
  height: 94px;
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(calc(var(--rotation) * 0.28deg));
  opacity: 0.62;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  background: linear-gradient(0deg, rgba(255,255,255,0.18), rgba(255,255,255,0.025));
  pointer-events: none;
}

.angle-rig {
  position: relative;
  width: 170px;
  height: 170px;
  transform-style: preserve-3d;
  transform: rotateX(calc(var(--tilt) * 1deg)) rotateY(calc(var(--rotation) * -1deg)) scale(calc(0.74 + var(--zoom) * 0.044));
  transition: transform 120ms ease;
  z-index: 2;
  pointer-events: none;
}

.angle-card {
  position: absolute;
  left: 19px;
  top: 19px;
  width: 132px;
  height: 132px;
  border: 1.5px solid rgba(255, 255, 255, 0.42);
  border-radius: 18px;
  background: linear-gradient(135deg, #5a5a5a, #3a3a3a);
  box-shadow:
    0 28px 60px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transform: translateZ(66px);
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.75);
  overflow: hidden;
  backface-visibility: hidden;
}

.angle-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.96;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.angle-face {
  position: absolute;
  left: 19px;
  top: 19px;
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(255, 255, 255, 0.24);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.045)),
    rgba(42, 42, 43, 0.94);
  color: rgba(255, 255, 255, 0.44);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -22px 38px rgba(0, 0, 0, 0.24);
  backface-visibility: hidden;
}

.angle-face::before {
  content: attr(data-label);
}

.angle-top {
  transform: rotateX(90deg) translateZ(66px);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06)),
    rgba(54, 54, 55, 0.96);
}

.angle-bottom {
  transform: rotateX(-90deg) translateZ(66px);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.035)),
    rgba(30, 30, 31, 0.96);
}

.angle-left {
  transform: rotateY(-90deg) translateZ(66px);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.035)),
    rgba(34, 34, 35, 0.96);
}

.angle-right {
  transform: rotateY(90deg) translateZ(66px);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.19), rgba(255, 255, 255, 0.05)),
    rgba(48, 48, 49, 0.96);
}

.angle-back {
  transform: rotateY(180deg) translateZ(66px);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03)),
    rgba(27, 27, 28, 0.98);
}

.angle-reset {
  position: absolute;
  left: 22px;
  bottom: 18px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 820;
}

.angle-controls {
  position: absolute;
  right: 28px;
  top: 90px;
  width: 284px;
  display: grid;
  gap: 18px;
  padding: 18px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.angle-controls-left {
  position: absolute;
  left: 24px;
  bottom: 60px;
  width: 180px;
}

.angle-row-v {
  display: grid;
  grid-template-columns: 72px 1fr 54px;
  align-items: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 800;
}

.angle-row-v input[type="range"] {
  width: 100%;
  height: 3px;
  accent-color: #f4f4f4;
  cursor: pointer;
}

.angle-row-v output {
  color: #f5f5f5;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.angle-generation-row {
  position: absolute;
  right: 28px;
  bottom: 72px;
  width: 290px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.angle-generation-label {
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
  font-weight: 820;
  white-space: nowrap;
}

.angle-resolution-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
}

.angle-resolution-choice {
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  padding: 0 8px;
}

.angle-resolution-choice:hover,
.angle-resolution-choice.active {
  background: rgba(255, 255, 255, 0.92);
  color: #151515;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}

.angle-credit-cost {
  min-width: 48px !important;
  height: 30px !important;
  padding: 0 9px !important;
  font-size: 12px !important;
}

.angle-row {
  display: grid;
  grid-template-columns: 76px 1fr 50px;
  align-items: center;
  gap: 14px;
  color: #8f8f8f;
  font-size: 14px;
  font-weight: 800;
}

.angle-row output {
  color: #f5f5f5;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.angle-row input[type="range"] {
  width: 100%;
  height: 3px;
  accent-color: #f4f4f4;
  cursor: pointer;
}

.angle-switch {
  width: 62px;
  height: 34px;
  justify-self: start;
  border: 0;
  border-radius: 999px;
  background: #3a3a3a;
  padding: 3px;
  cursor: pointer;
}

.angle-switch::before {
  content: "";
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #080808;
  transition: transform 140ms ease, background 140ms ease;
}

.angle-switch.active::before {
  background: #fff;
  transform: translateX(28px);
}

.angle-submit {
  position: absolute;
  right: 28px;
  bottom: 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: #f4f4f4;
  color: #111;
  cursor: pointer;
  padding: 0 16px 0 18px;
  font-size: 14px;
  font-weight: 850;
}

.crop-editor {
  position: absolute;
  z-index: 24;
  pointer-events: auto;
}

.crop-dim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  border: 1px solid rgba(45, 167, 231, 0.5);
}

.crop-box {
  position: absolute;
  border: 2px solid #fff;
  border-radius: 16px;
  cursor: move;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
}

.crop-handle {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #111;
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.2);
}

.crop-handle.nw {
  left: -9px;
  top: -9px;
  cursor: nwse-resize;
}

.crop-handle.ne {
  right: -9px;
  top: -9px;
  cursor: nesw-resize;
}

.crop-handle.sw {
  left: -9px;
  bottom: -9px;
  cursor: nesw-resize;
}

.crop-handle.se {
  right: -9px;
  bottom: -9px;
  cursor: nwse-resize;
}

.crop-handle.n {
  left: 50%;
  top: -9px;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.crop-handle.s {
  left: 50%;
  bottom: -9px;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.crop-handle.e {
  right: -9px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.crop-handle.w {
  left: -9px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.crop-actions {
  position: absolute;
  left: 50%;
  bottom: -76px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 300px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(24, 24, 24, 0.97);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.45);
  transform: translateX(-50%);
}

.mode-button {
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #d5d5d5;
  cursor: pointer;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 760;
}

.mode-button.primary {
  background: #4a4a4a;
  color: #fff;
}

.drop-hint {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 15;
  max-width: min(760px, calc(100vw - 32px));
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(31, 31, 31, 0.82);
  color: #c8c8c8;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.3);
  transform: translateX(-50%);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.drop-hint.hidden {
  opacity: 0;
  transform: translate(-50%, 10px);
}

body.workspace-booting .drop-hint {
  opacity: 0;
  transform: translate(-50%, 10px);
}

.workspace-boot-preview {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  z-index: 3;
  pointer-events: none;
}

.workspace-boot-preview-node {
  position: absolute;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  background: #202020;
  color: rgba(255, 255, 255, 0.36);
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.34);
}

.workspace-boot-preview-node img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.workspace-boot-preview-node svg {
  width: 48px;
  height: 48px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 14;
  display: none;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 22px;
  font-weight: 850;
  pointer-events: none;
  backdrop-filter: blur(6px);
}

.drop-overlay.visible {
  display: grid;
}

body.view-generate .drop-overlay {
  z-index: 70;
  border: 1px dashed rgba(85, 216, 194, 0.58);
  background:
    radial-gradient(circle at 50% 42%, rgba(85, 216, 194, 0.16), transparent 34%),
    rgba(10, 12, 15, 0.42);
  color: rgba(255, 255, 255, 0.94);
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  padding: 42px;
  background: rgba(0, 0, 0, 0.86);
  backdrop-filter: blur(18px);
}

.preview-modal.visible {
  display: grid;
}

body.history-open .preview-modal.visible {
  z-index: 120;
}

.preview-modal img {
  max-width: min(94vw, 1440px);
  max-height: 88vh;
  border-radius: 24px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.72);
  object-fit: contain;
}

.preview-close {
  position: fixed;
  right: 28px;
  top: 24px;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
}

.context-menu {
  position: fixed;
  z-index: 40;
  min-width: 128px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(32, 32, 32, 0.98);
  box-shadow: var(--shadow);
  display: none;
}

.context-menu.visible {
  display: block;
}

.context-menu button {
  width: 100%;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  padding: 0 10px;
}

.context-menu button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.canvas-mode-switch {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 39;
  --mode-index: 0;
  --mode-button-width: 72px;
  display: none;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.02)),
    rgba(18, 18, 18, 0.9);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px) saturate(1.06);
  overflow: hidden;
}

body.view-canvas .canvas-mode-switch {
  display: inline-flex;
  right: 462px;
}

.canvas-mode-switch[data-mode="all"] {
  --mode-index: 1;
}

.canvas-mode-switch::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: var(--mode-button-width);
  height: 32px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  pointer-events: none;
  transform: translateX(calc(var(--mode-index) * (var(--mode-button-width) + 3px)));
  transition: transform 190ms cubic-bezier(0.16, 1, 0.3, 1), background 140ms ease;
}

.canvas-mode-switch button {
  height: 32px;
  width: var(--mode-button-width);
  min-width: var(--mode-button-width);
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  padding: 0 12px;
  box-shadow: none;
  backdrop-filter: none;
  transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.canvas-mode-switch button:focus,
.canvas-mode-switch button:focus-visible {
  outline: none;
}

.canvas-mode-switch button.active {
  background: transparent;
  color: #fff;
  box-shadow: none;
}

.canvas-mode-switch button:hover {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
}

.canvas-top-actions {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 41;
  display: none;
  align-items: center;
  gap: 8px;
}

body.view-canvas .canvas-top-actions,
body.view-generate .canvas-top-actions {
  display: inline-flex;
}

body.view-generate #canvasFitAllButton {
  display: none;
}

.canvas-action-pill,
.canvas-icon-action {
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.105);
  border-radius: 14px;
  background: rgba(18, 18, 18, 0.82);
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.canvas-action-pill:hover,
.canvas-icon-action:hover,
.history-btn:hover,
.side-rail-btn:hover,
.project-current:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.canvas-icon-action {
  min-width: 64px;
  padding: 0 12px;
}

#canvasFitAllButton:focus,
#canvasFitAllButton:focus-visible {
  outline: none;
}

.canvas-toolbar-label {
  line-height: 1;
  white-space: nowrap;
}

.canvas-action-pill svg,
.canvas-icon-action svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.canvas-credits-pill {
  min-width: 74px;
}

.canvas-account-menu {
  position: fixed;
  right: 18px;
  top: 66px;
  z-index: 64;
  display: none;
  width: 258px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(22, 22, 22, 0.98);
  color: rgba(255, 255, 255, 0.86);
  box-shadow: 0 22px 62px rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(18px);
}

.canvas-account-menu.open {
  display: grid;
  gap: 10px;
  animation: pop-open 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.account-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  padding: 0 2px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.58);
}

.account-line strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
}

.account-redeem {
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  font-size: 12px;
  font-weight: 820;
}

.account-redeem:hover {
  background: rgba(255, 255, 255, 0.14);
}

.account-ledger {
  display: grid;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.account-ledger-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 840;
}

.account-ledger-list {
  display: grid;
  gap: 6px;
  max-height: 188px;
  overflow-y: auto;
  padding-right: 2px;
}

.account-ledger-empty {
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.42);
  font-size: 12px;
  font-weight: 760;
}

.account-ledger-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
}

.account-ledger-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
  font-weight: 820;
}

.account-ledger-amount {
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.account-ledger-amount.positive {
  color: #a7f3d0;
}

.account-ledger-amount.negative {
  color: #fecaca;
}

.account-ledger-time {
  grid-column: 1 / -1;
  color: rgba(255, 255, 255, 0.42);
  font-size: 11px;
  font-weight: 720;
}

.canvas-chat-trigger {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 41;
  min-width: 74px;
  height: 44px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.105);
  border-radius: 14px;
  background: rgba(18, 18, 18, 0.82);
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
  transition: background 160ms ease, border-color 160ms ease;
}

body.view-canvas .canvas-chat-trigger {
  display: inline-flex;
}

body:not(.view-canvas) .canvas-chat-trigger,
body:not(.view-canvas) .canvas-chat-drawer {
  display: none !important;
}

.canvas-chat-trigger:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
  box-shadow:
    0 16px 42px rgba(0, 0, 0, 0.34),
    0 0 24px rgba(85, 216, 194, 0.12);
}

.canvas-chat-trigger svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.canvas-chat-trigger span {
  line-height: 1;
  white-space: nowrap;
}

body.canvas-chat-open .canvas-chat-trigger {
  display: none;
}

.canvas-chat-drawer {
  position: fixed;
  right: 0;
  top: 64px;
  bottom: 0;
  z-index: 70;
  width: min(var(--chat-width, 420px), calc(100vw - 8px));
  height: auto;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(22, 22, 22, 0.985), rgba(14, 14, 14, 0.995)),
    #141414;
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 18px 0 0 0;
  box-shadow: -24px 0 64px rgba(0, 0, 0, 0.42);
  transform: translateX(calc(100% + 24px));
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  overflow: hidden;
}

body.view-canvas.canvas-chat-open .canvas-chat-drawer {
  transform: translateX(0);
}

.canvas-chat-drawer.chat-dragover {
  border-left-color: rgba(255, 255, 255, 0.36);
  box-shadow: -24px 0 64px rgba(0, 0, 0, 0.42), 0 0 30px rgba(255, 255, 255, 0.16);
}

.canvas-chat-drawer.chat-dragover::after {
  content: "松开添加到对话";
  position: absolute;
  inset: 72px 18px 96px;
  z-index: 8;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.34);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.62);
  color: rgba(255, 255, 255, 0.94);
  font-size: 14px;
  font-weight: 850;
  pointer-events: none;
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
}

body.canvas-chat-open .canvas-top-actions,
body.canvas-chat-open .history-toggle,
body.canvas-chat-open .project-switcher,
body.canvas-chat-open .canvas-mode-switch {
  transform: none;
}

.chat-resize-handle {
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 8px;
  cursor: ew-resize;
  z-index: 4;
}

.chat-resize-handle::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 16px;
  bottom: 16px;
  width: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.chat-drawer-head {
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.chat-drawer-title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 860;
}

.chat-drawer-title-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.chat-drawer-title #canvasChatModelTitle {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-network-status {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.chat-drawer-title svg,
.chat-head-actions svg,
.chat-composer-tools svg,
.chat-send svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chat-head-agent-controls {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  position: relative;
  z-index: 180;
}

.chat-head-agent-controls .chat-select {
  width: 132px;
  max-width: min(132px, 30vw);
  flex: 0 0 132px;
}

.chat-head-agent-controls .chat-select-menu {
  top: calc(100% + 8px);
  bottom: auto;
  right: 0;
  left: auto;
  width: max(100%, 240px);
}

.chat-head-agent-controls #canvasChatAgentManage {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  padding: 0;
}

.chat-head-actions > button,
.chat-history-wrap > button,
.chat-composer-tools > button,
.chat-send {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
}

  .chat-head-actions > button:hover,
  .chat-history-wrap > button:hover,
  .chat-head-agent-controls #canvasChatAgentManage:hover,
  .chat-composer-tools > button:hover,
  .chat-send:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
  }

.chat-history-wrap {
  position: relative;
}

.chat-history-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 140;
  width: min(320px, calc(100vw - 44px));
  max-height: min(420px, calc(100vh - 160px));
  display: none;
  gap: 6px;
  padding: 8px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025)),
    rgba(16, 17, 20, 0.96);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
  backdrop-filter: blur(18px) saturate(1.08);
}

.chat-history-wrap.open .chat-history-popover {
  display: grid;
}

.chat-history-empty {
  padding: 18px 12px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 12px;
  text-align: center;
}

.chat-history-item {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  text-align: left;
}

.chat-history-item:hover,
.chat-history-item.active {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.chat-history-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 860;
}

.chat-history-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.48);
  font-size: 11px;
  font-weight: 760;
}

.chat-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 22px 18px;
  overflow: auto;
  user-select: text;
  -webkit-user-select: text;
}

.chat-message {
  max-width: 86%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  line-height: 1.45;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-message-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-width: 0;
}

.chat-message-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: -2px;
}

.chat-copy-button {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  opacity: 0.82;
  transition: opacity 140ms ease, transform 140ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
  flex: 0 0 auto;
}

.chat-copy-button:hover,
.chat-copy-button:focus-visible {
  opacity: 1;
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.95);
  outline: none;
}

.chat-copy-button.copied {
  background: rgba(85, 216, 194, 0.14);
  border-color: rgba(85, 216, 194, 0.28);
  color: rgba(85, 216, 194, 0.98);
  opacity: 1;
}

.chat-action-text-button {
  width: auto;
  min-width: 36px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.chat-copy-button svg {
  width: 11px;
  height: 11px;
  display: block;
  fill: currentColor;
}

.chat-message.user {
  align-self: flex-end;
  background: rgba(85, 216, 194, 0.16);
  border-color: rgba(85, 216, 194, 0.24);
}

.chat-message.assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
}

.chat-message.pending {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.72);
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

.chat-message.pending::after {
  content: "";
  width: 18px;
  height: 6px;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.92) 0 2px, transparent 2.5px) 0 50% / 6px 6px repeat-x;
  animation: chatTypingDots 920ms linear infinite;
  opacity: 0.72;
}

.chat-send.loading svg {
  animation: chatSendPulse 820ms ease-in-out infinite alternate;
}

@keyframes chatTypingDots {
  from { background-position-x: 0; }
  to { background-position-x: 6px; }
}

@keyframes chatSendPulse {
  from { opacity: 0.45; transform: translateX(-1px); }
  to { opacity: 1; transform: translateX(1px); }
}

.chat-welcome {
  width: 100%;
  display: grid;
  gap: 12px;
  padding-bottom: 8px;
}

.chat-kicker {
  color: rgba(255, 255, 255, 0.52);
  font-size: 13px;
  font-weight: 760;
}

.chat-welcome h2 {
  margin: 0;
  color: #f5f5f5;
  font-size: 25px;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: 0;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-suggestions button {
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 760;
}

.chat-suggestions button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.chat-composer {
  margin: 0 14px 14px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 22px;
  background: rgba(33, 33, 33, 0.96);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.42);
  display: grid;
  gap: 10px;
}

.chat-generate-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: min(100%, 520px);
  margin: 0;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
}

.chat-generate-modes.legacy-chat-modes {
  display: none !important;
}

.chat-generate-modes button {
  height: 30px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.62);
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
}

.chat-generate-modes button.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 22px rgba(0, 0, 0, 0.18);
}

.chat-generate-options {
  display: none;
  align-items: center;
  gap: 8px;
  width: auto;
  margin: 0;
  min-width: 0;
}

.chat-generate-options.active {
  display: inline-flex;
}

.chat-image-cost {
  display: none;
  min-width: 48px !important;
  height: 32px !important;
  padding: 0 10px !important;
  font-size: 12px !important;
  flex: 0 0 auto;
}

.chat-generate-options.active .chat-image-cost {
  display: inline-flex;
}

.chat-image-cost svg {
  width: 14px !important;
  height: 14px !important;
}

.chat-input {
  width: 100%;
  height: 82px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  line-height: 1.45;
  user-select: text;
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.chat-composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.chat-composer-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
}

.chat-composer-tools > button {
  flex: 0 0 36px;
}

.chat-mode-pill {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.chat-model-select {
  height: 36px;
  min-width: 158px;
  max-width: min(280px, 45vw);
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.82);
  padding: 0 28px 0 12px;
  font-size: 12px;
  font-weight: 800;
  outline: none;
}

.chat-model-select.chat-native-hidden {
  display: none !important;
}

#canvasChatModelSelect {
  display: inline-block !important;
  width: 180px;
  flex: 0 1 180px;
  cursor: pointer;
  appearance: auto;
}

.chat-generate-options .chat-model-select {
  width: 100%;
  max-width: none;
}

.chat-model-select option {
  background: #111318;
  color: #f5f5f5;
}

.chat-select {
  position: relative;
  min-width: 0;
  width: 220px;
  max-width: min(220px, calc(100% - 44px));
  flex: 0 1 220px;
}

.chat-generate-options .chat-select {
  width: 180px;
  max-width: min(180px, 32vw);
  flex: 0 1 180px;
}

.chat-composer .chat-composer-tools #canvasChatModelSelect + .chat-select,
.chat-composer .chat-composer-tools #canvasChatAgentSelect + .chat-select,
.chat-composer .chat-composer-tools #canvasChatImageModel + .chat-select,
.chat-composer .chat-composer-tools #canvasChatImageCount + .chat-select,
.chat-composer .chat-composer-tools #canvasChatImageResolution + .chat-select,
.chat-composer .chat-composer-tools #canvasChatVideoModel + .chat-select,
.chat-composer .chat-composer-tools #canvasChatVideoResolution + .chat-select,
.chat-composer .chat-composer-tools #canvasChatVideoDuration + .chat-select,
.chat-composer .chat-composer-tools #canvasChatImageRatio + .chat-select,
.chat-composer .chat-composer-tools #canvasChatVideoRatio + .chat-select {
  display: none;
}

.chat-composer[data-mode="text"] .chat-composer-tools #canvasChatAgentSelect + .chat-select,
.chat-composer[data-mode="text"] .chat-composer-tools #canvasChatImageModel + .chat-select,
.chat-composer[data-mode="text"] .chat-composer-tools #canvasChatVideoModel + .chat-select {
  display: inline-flex;
}

.chat-composer[data-mode="image"] .chat-composer-tools #canvasChatImageModel + .chat-select,
.chat-composer[data-mode="image"] .chat-composer-tools #canvasChatImageRatio + .chat-select,
.chat-composer[data-mode="image"] .chat-composer-tools #canvasChatImageResolution + .chat-select,
.chat-composer[data-mode="image"] .chat-composer-tools #canvasChatImageCount + .chat-select {
  display: inline-flex;
}

.chat-composer[data-mode="video"] .chat-composer-tools #canvasChatVideoModel + .chat-select,
.chat-composer[data-mode="video"] .chat-composer-tools #canvasChatVideoRatio + .chat-select,
.chat-composer[data-mode="video"] .chat-composer-tools #canvasChatVideoResolution + .chat-select,
.chat-composer[data-mode="video"] .chat-composer-tools #canvasChatVideoDuration + .chat-select {
  display: inline-flex;
}

.chat-composer-tools #canvasChatImageRatio + .chat-select,
.chat-composer-tools #canvasChatVideoRatio + .chat-select {
  width: 100px;
  max-width: 100px;
  flex-basis: 100px;
}

.chat-composer-tools #canvasChatImageResolution + .chat-select,
.chat-composer-tools #canvasChatVideoResolution + .chat-select {
  width: 92px;
  max-width: 92px;
  flex-basis: 92px;
}

.chat-composer-tools #canvasChatImageCount + .chat-select,
.chat-composer-tools #canvasChatVideoDuration + .chat-select {
  width: 78px;
  max-width: 78px;
  flex-basis: 78px;
}

.chat-select-trigger {
  width: 100%;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.055)),
    rgba(42, 42, 46, 0.88);
  color: rgba(255, 255, 255, 0.9);
  padding: 0 12px 0 14px;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 8px 22px rgba(0, 0, 0, 0.22);
  font-size: 12px;
  font-weight: 850;
  text-align: left;
}

.chat-select-trigger:hover,
.chat-select.open .chat-select-trigger {
  border-color: rgba(255, 255, 255, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.075)),
    rgba(52, 52, 57, 0.92);
  color: #fff;
  box-shadow:
    0 0 24px rgba(255, 255, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.chat-select-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-select-caret {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  opacity: 0.72;
  transition: transform 160ms ease;
}

.chat-select.open .chat-select-caret {
  transform: rotate(180deg);
}

.chat-select-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 120;
  width: max(100%, 260px);
  max-width: min(360px, calc(100vw - 48px));
  display: none;
  gap: 3px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025)),
    rgba(16, 17, 20, 0.96);
  box-shadow:
    0 20px 52px rgba(0, 0, 0, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
  backdrop-filter: blur(18px) saturate(1.08);
}

.chat-select.open .chat-select-menu {
  display: grid;
}

.chat-select.has-params .chat-select-menu {
  width: max(100%, 320px);
}

.chat-select-option {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.74);
  padding: 7px 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 820;
  text-align: left;
}

.chat-select-option-label {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-select-option-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.chat-select-option-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.48);
  font-size: 11px;
  font-weight: 760;
}

.chat-select-option-price {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.46);
  font-size: 11px;
  font-weight: 820;
}

.chat-select-option:hover,
.chat-select-option.active {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.07));
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.chat-select-option:disabled {
  color: rgba(255, 255, 255, 0.28);
  cursor: not-allowed;
  box-shadow: none;
}

.text-model-native-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-width: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
}

.text-model-select-control {
  position: relative;
  z-index: 160;
  display: inline-flex;
  flex: 0 1 180px;
  width: 180px;
  max-width: min(180px, 32vw);
  pointer-events: auto;
}

.text-model-select-trigger {
  width: 100%;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.045) 46%, rgba(255, 255, 255, 0.015) 100%),
    rgba(18, 18, 18, 0.88);
  color: rgba(255, 255, 255, 0.9);
  padding: 0 12px 0 14px;
  font-size: 12px;
  font-weight: 820;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 12px 32px rgba(0, 0, 0, 0.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
}

.text-model-select-trigger:hover,
.text-model-select-control.open .text-model-select-trigger {
  border-color: rgba(255, 255, 255, 0.24);
  background:
    radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.065) 46%, rgba(255, 255, 255, 0.02) 100%),
    rgba(22, 22, 22, 0.94);
}

.text-model-select-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-model-select-caret {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  transition: transform 160ms ease;
}

.text-model-select-caret svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.yungou-mark img,
.deepseek-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  background: transparent;
}

.deepseek-icon {
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 8px;
  font-weight: 850;
  line-height: 1;
  letter-spacing: 0;
}

.text-model-select-control.open .text-model-select-caret {
  transform: rotate(180deg);
}

.text-model-select-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 220;
  display: none;
  width: max(100%, 220px);
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.035)),
    rgba(14, 14, 14, 0.96);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  backdrop-filter: blur(18px) saturate(1.25);
}

.text-model-select-control.open .text-model-select-menu {
  display: grid;
  gap: 5px;
}

.text-model-select-option {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.text-model-select-option:hover,
.text-model-select-option.active {
  border-color: rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.text-model-select-option:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chat-model-param-panel {
  display: grid;
  gap: 9px;
  margin-top: 5px;
  padding: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.035);
  border-radius: 12px;
}

.chat-model-param-group {
  display: grid;
  gap: 6px;
}

.chat-model-param-title {
  color: rgba(255, 255, 255, 0.46);
  font-size: 11px;
  font-weight: 820;
}

.chat-model-param-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-model-param-choice {
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.74);
  padding: 0 10px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 840;
}

.chat-model-param-choice:hover,
.chat-model-param-choice.active {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.chat-context-strip {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 8px;
}

.chat-context-strip:not(:empty) {
  display: flex;
}

.chat-queue {
  display: none;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.chat-queue:not(:empty) {
  display: flex;
}

.chat-queue-item {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.84);
  font-size: 12px;
  line-height: 1.35;
}

.chat-queue-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-queue-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-queue-actions button {
  height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 760;
  cursor: pointer;
}

.chat-queue-actions button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.chat-context-chip {
  height: 34px;
  max-width: 190px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px 3px 4px;
  border: 1px solid rgba(85, 216, 194, 0.24);
  border-radius: 999px;
  background: rgba(85, 216, 194, 0.1);
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
  font-weight: 800;
}

.chat-context-chip img {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  object-fit: cover;
  background: #111;
}

.chat-context-chip .chat-ref-icon,
.ai-chat-ref .chat-ref-icon {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  font-weight: 900;
}

.chat-context-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-context-chip button {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  padding: 0;
  font-size: 13px;
  line-height: 1;
}

.deepseek-mark {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 68% 34%, rgba(255, 255, 255, 0.42) 0 10%, transparent 11%),
    linear-gradient(145deg, #29d3c2 0%, #1d6ef2 58%, #15337f 100%);
  color: rgba(255, 255, 255, 0.96);
  box-shadow: 0 0 18px rgba(45, 212, 191, 0.24);
}

.deepseek-mark svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: rgba(255, 255, 255, 0.24);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.deepseek-mark circle {
  fill: currentColor;
  stroke: none;
}

.deepseek-mark .deepseek-tail {
  fill: none;
}

.creation-choice {
  position: fixed;
  z-index: 55;
  display: none;
  flex-direction: column;
  gap: 4px;
  min-width: 176px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 24px;
  background: rgba(31, 31, 31, 0.98);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(32px) saturate(1.5);
}

.creation-choice.visible {
  display: flex;
  animation: pop-open 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.creation-choice .choice-header {
  display: none;
}

.creation-choice .choice-section-label {
  display: none;
}

.creation-choice button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 50px;
  padding: 0 12px;
  border: none;
  border-radius: 16px;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease;
}

.creation-choice .creation-upload-action {
  display: none;
}

.creation-choice[data-mode="upload"] {
  min-width: 136px;
  padding: 0;
  border-radius: 12px;
  background: rgba(28, 28, 28, 0.98);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}

.creation-choice[data-mode="upload"] button:not(.creation-upload-action) {
  display: none;
}

.creation-choice[data-mode="upload"] .creation-upload-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 136px;
  height: 52px;
  padding: 0 22px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.95);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

.creation-choice[data-mode="upload"] .creation-upload-action:hover {
  background: rgba(255, 255, 255, 0.08);
}

.creation-choice[data-mode="upload"] .creation-upload-action:active {
  background: rgba(255, 255, 255, 0.12);
}

.creation-choice[data-mode="upload"] .creation-upload-action::after {
  display: none;
}

.creation-choice[data-mode="upload"] .creation-upload-action .choice-label {
  align-items: center;
}

.creation-choice[data-mode="upload"] .creation-upload-action .choice-label span {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.creation-choice[data-mode="nodes"] {
  min-width: 136px;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(28, 28, 28, 0.98);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}

.creation-choice[data-mode="nodes"] button:not(.creation-upload-action) {
  width: 136px;
  height: 52px;
  justify-content: center;
  padding: 0 22px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.95);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

.creation-choice[data-mode="nodes"] button:not(.creation-upload-action)::after,
.creation-choice[data-mode="nodes"] button:not(.creation-upload-action) .choice-icon {
  display: none;
}

.creation-choice[data-mode="nodes"] button:not(.creation-upload-action) .choice-label {
  align-items: center;
}

.creation-choice[data-mode="nodes"] button:not(.creation-upload-action) .choice-label span {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.creation-choice button:hover {
  background: rgba(255, 255, 255, 0.055);
}

.creation-choice button:active {
  background: rgba(255, 255, 255, 0.08);
}

.creation-choice button .choice-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.creation-choice button:hover .choice-icon {
  background: rgba(255, 255, 255, 0.095);
}

.creation-choice button .choice-icon svg {
  width: 20px;
  height: 20px;
  stroke: rgba(255, 255, 255, 0.75);
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.creation-choice button:hover .choice-icon svg {
  stroke: #fff;
}

.creation-choice button::after {
  content: attr(data-description);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  max-width: 180px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 12px;
  background: rgba(31, 31, 31, 0.98);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.44);
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity 120ms ease 560ms, transform 120ms ease 560ms;
}

.creation-choice button:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.creation-choice button .choice-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.creation-choice button .choice-label span {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.92);
}

.creation-choice button .choice-label small {
  display: none;
}

.creation-choice button:hover .choice-label small {
  color: rgba(255, 255, 255, 0.5);
}

.creation-choice[data-mode="nodes"] {
  width: 192px;
  min-width: 192px;
  max-width: calc(100vw - 24px);
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 14px;
  background: rgba(32, 32, 32, 0.98);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.48);
  backdrop-filter: none;
}

.creation-choice[data-mode="nodes"] .choice-header {
  order: 0;
  display: block;
  padding: 1px 2px 8px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.1;
}

.creation-choice[data-mode="nodes"] .choice-resource-label {
  order: 20;
  display: none;
  margin: 8px 2px 3px;
  color: rgba(255, 255, 255, 0.42);
  font-size: 12px;
  font-weight: 720;
  line-height: 1.1;
}

.creation-choice[data-mode="nodes"] button:not(.creation-upload-action),
.creation-choice[data-mode="nodes"] .creation-upload-action {
  width: 100%;
  min-width: 0;
  height: 40px;
  justify-content: flex-start;
  gap: 10px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 800;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  transition:
    background 140ms ease,
    color 140ms ease;
}

.creation-choice[data-mode="nodes"] .creation-upload-action {
  order: 21;
  display: none;
}

.creation-choice[data-mode="nodes"] button[data-create-kind="text"] {
  order: 1;
}

.creation-choice[data-mode="nodes"] button[data-create-kind="image"] {
  order: 2;
}

.creation-choice[data-mode="nodes"] button[data-create-kind="video"] {
  order: 3;
}

.creation-choice[data-mode="nodes"] button:not(.creation-upload-action) + button:not(.creation-upload-action) {
  margin-top: 0;
}

.creation-choice[data-mode="nodes"] button:not(.creation-upload-action):hover,
.creation-choice[data-mode="nodes"] .creation-upload-action:hover {
  background: rgba(255, 255, 255, 0.065);
  color: #fff;
}

.creation-choice[data-mode="nodes"] button:not(.creation-upload-action):active,
.creation-choice[data-mode="nodes"] .creation-upload-action:active {
  background: rgba(255, 255, 255, 0.1);
}

.creation-choice[data-mode="nodes"] button:not(.creation-upload-action)::after,
.creation-choice[data-mode="nodes"] .creation-upload-action::after {
  display: none;
}

.creation-choice[data-mode="nodes"] button:not(.creation-upload-action) .choice-icon,
.creation-choice[data-mode="nodes"] .creation-upload-action .choice-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.84);
}

.creation-choice[data-mode="nodes"] button:not(.creation-upload-action):hover .choice-icon,
.creation-choice[data-mode="nodes"] .creation-upload-action:hover .choice-icon {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.creation-choice[data-mode="nodes"] button:not(.creation-upload-action) .choice-icon svg,
.creation-choice[data-mode="nodes"] .creation-upload-action .choice-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.05;
}

.creation-choice[data-mode="nodes"] button:not(.creation-upload-action) .choice-label,
.creation-choice[data-mode="nodes"] .creation-upload-action .choice-label {
  align-items: flex-start;
}

.creation-choice[data-mode="nodes"] button:not(.creation-upload-action) .choice-label span,
.creation-choice[data-mode="nodes"] .creation-upload-action .choice-label span {
  color: currentColor;
  font-size: 14px;
  font-weight: 780;
  line-height: 1;
}

.project-switcher {
  position: fixed;
  left: 194px;
  right: auto;
  top: 18px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
}

body.view-canvas .project-switcher {
  left: 194px;
  right: auto;
}

.app-rail:hover ~ .project-switcher,
.app-rail.expanded ~ .project-switcher {
  left: 194px;
}

@media (max-width: 680px) {
  .project-switcher,
  body.view-canvas .project-switcher,
  .app-rail:hover ~ .project-switcher,
  .app-rail.expanded ~ .project-switcher {
    left: 194px;
    top: 18px;
  }

  .project-current {
    min-width: 0;
    max-width: min(210px, calc(100vw - 234px));
  }
}

.project-current {
  height: 38px;
  min-width: 136px;
  max-width: 260px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.105);
  border-radius: 14px;
  background: rgba(18, 18, 18, 0.82);
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  padding: 0 12px 0 14px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.project-current span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-current svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.76;
}

/* History toggle & panel */
.history-toggle {
  position: fixed;
  left: 18px;
  right: auto;
  top: 18px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

body.view-canvas .history-toggle {
  left: 18px;
  right: auto;
}

body.view-chat .project-switcher {
  display: none;
}

body.view-generate .project-switcher {
  display: none !important;
}

.history-btn,
.side-rail-btn {
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.105);
  border-radius: 14px;
  background: rgba(18, 18, 18, 0.82);
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.history-btn svg,
.side-rail-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.76;
}

.history-panel {
  position: fixed;
  inset: 0;
  z-index: 88;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 42px;
  background: rgba(0, 0, 0, 0.5);
  border: 0;
  border-radius: 0;
  backdrop-filter: blur(18px);
}

body.history-open .project-switcher,
body.history-open .history-toggle,
body.history-open .canvas-mode-switch,
body.history-open .rail-toggle {
  filter: blur(8px);
  opacity: 0.24;
  pointer-events: none;
}

body.history-open #app,
body.history-open .generate-view,
body.history-open .studio-panel,
body.history-open .app-rail,
body.history-open .canvas-chat-drawer,
body.history-open .canvas-account-menu {
  filter: blur(10px);
  opacity: 0.34;
  pointer-events: none;
}

.gen-node.busy .gen-preview::before {
  content: attr(data-loading-label);
  position: absolute;
  left: 22px;
  right: 22px;
  top: auto;
  bottom: 18px;
  z-index: 7;
  transform: none;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  min-height: 26px;
  padding: 0 0 10px 14px;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 3px 8px, rgba(214, 255, 249, 0.88) 0 2.5px, transparent 3px),
    linear-gradient(90deg, transparent, rgba(214, 255, 249, 0.82), transparent) -42% 100% / 42% 2px no-repeat,
    linear-gradient(90deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.028)) 0 100% / 100% 2px no-repeat;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  font-weight: 820;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.72);
  pointer-events: none;
  animation: node-loading-rail 1.55s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.gen-node.busy .gen-preview[data-loading-label=""]::before,
.gen-node:not(.busy) .gen-preview[data-loading-label=""]::before {
  content: none;
}

.gen-node.busy .placeholder-icon {
  animation: node-loading-icon-breathe 1.8s ease-in-out infinite;
  color: rgba(255, 255, 255, 0.3);
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.42));
}

.image-node:not(.generation-slot) .image-frame:hover img,
.gen-node.has-image .gen-preview:hover > img {
  transform: scale(calc(var(--preview-zoom, 1) + 0.028));
}

.gen-node.has-variants .gen-preview {
  box-shadow:
    0 16px 38px rgba(0, 0, 0, 0.34),
    12px 10px 0 rgba(255, 255, 255, 0.055),
    24px 20px 0 rgba(255, 255, 255, 0.032),
    36px 30px 0 rgba(255, 255, 255, 0.018);
}

.gen-node.has-variants:not(.variant-expanded):not(.busy) .gen-preview::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 3;
  width: 66px;
  border-radius: inherit;
  background:
    linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.2)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012));
  pointer-events: none;
}

.gen-node.has-variants.variant-expanded .gen-preview {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  contain: none;
}

.gen-node.has-variants.variant-expanded .gen-preview > img {
  opacity: 0;
  transform: none !important;
}

.gen-node.variant-loading .placeholder-icon {
  display: none;
}

.gen-node.variant-loading .gen-preview::before {
  content: none;
}

.gen-variant-stack {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 9;
  display: none;
  color: #fff;
  pointer-events: auto;
}

.gen-node.has-variants .gen-variant-stack {
  display: block;
}

.gen-node.has-variants.variant-expanded .gen-variant-stack {
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 12;
}

.gen-variant-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  min-width: 50px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  background: rgba(32, 32, 32, 0.78);
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  font-weight: 850;
  backdrop-filter: blur(14px);
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.34);
}

.gen-node.has-variants.variant-expanded .gen-variant-trigger {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 3;
  height: 30px;
  min-width: 46px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(20, 21, 23, 0.62);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.32);
}

.gen-variant-trigger span::after {
  content: "张";
  margin-left: 2px;
  font-weight: 760;
  color: rgba(255, 255, 255, 0.72);
}

.gen-variant-trigger svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2.4;
  fill: none;
  transition: transform 150ms ease;
}

.gen-variant-stack.expanded .gen-variant-trigger svg {
  transform: rotate(180deg);
}

.gen-variant-tray {
  position: absolute;
  right: 0;
  top: 44px;
  display: none;
  width: min(360px, calc(var(--gen-preview-w, 420px) - 20px));
  margin-top: 0;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(24, 24, 24, 0.84);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.gen-variant-stack.expanded .gen-variant-tray {
  display: grid;
}

.gen-node.has-variants.variant-expanded .gen-variant-tray {
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  width: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  grid-auto-rows: minmax(0, 1fr);
  align-content: stretch;
}

.gen-variant-thumb {
  position: relative;
  height: 86px;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  background: #202020;
  cursor: pointer;
  transition: transform 150ms cubic-bezier(0.16, 1, 0.3, 1), border-color 140ms ease, box-shadow 140ms ease;
}

.gen-node.has-variants.variant-expanded .gen-variant-thumb {
  height: auto;
  min-height: 0;
  border-color: rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.32);
}

.gen-variant-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  transition: transform 160ms ease;
}

.gen-variant-thumb:hover {
  transform: scale(1.07);
  border-color: rgba(255, 255, 255, 0.34);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
}

.gen-variant-thumb:hover img {
  transform: scale(1.06);
}

.gen-node.has-variants.variant-expanded .gen-variant-thumb:hover {
  transform: none;
}

.gen-node.has-variants.variant-expanded .gen-variant-thumb:hover img {
  transform: scale(1.025);
}

.gen-variant-thumb.active {
  border-color: rgba(94, 234, 212, 0.68);
  box-shadow: 0 0 0 2px rgba(94, 234, 212, 0.16);
}

.gen-variant-index,
.gen-variant-thumb-label {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  min-width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(15, 16, 18, 0.68);
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 850;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

.gen-variant-thumb-label {
  left: 50%;
  top: 50%;
  min-width: 82px;
  transform: translate(-50%, -50%);
}

.gen-variant-thumb.loading {
  cursor: default;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0 34%, rgba(255, 255, 255, 0.08) 45%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.08) 55%, transparent 66% 100%),
    rgba(255, 255, 255, 0.045);
  background-size: 220% 100%, auto;
  animation: variant-loading-sweep 1.15s ease-in-out infinite;
}

@keyframes variant-loading-sweep {
  0% { background-position: 120% 0, 0 0; }
  100% { background-position: -120% 0, 0 0; }
}

.permission-modal,
.app-toast {
  position: fixed;
  z-index: 75;
  pointer-events: none;
}

.permission-modal {
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(8px);
}

.permission-modal.visible {
  display: grid;
  pointer-events: auto;
}

.permission-card {
  width: min(430px, calc(100vw - 44px));
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 28px;
  background: rgba(28, 28, 28, 0.96);
  padding: 26px;
  color: #f5f5f5;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.56);
  text-align: center;
}

.permission-card h3 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 860;
}

.permission-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 14px;
  line-height: 1.7;
  font-weight: 680;
}

.permission-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}

.permission-actions button {
  height: 40px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 840;
  cursor: pointer;
}

.permission-retry {
  background: #f5f5f5;
  color: #111;
}

.permission-close {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.78);
}

.app-toast {
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  min-width: 220px;
  max-width: calc(100vw - 40px);
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(24, 24, 24, 0.92);
  color: #fff;
  font-size: 14px;
  font-weight: 820;
  text-align: center;
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(14px);
}

.app-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.history-panel.visible {
  display: flex;
}

.history-card {
  width: min(1080px, calc(100vw - 84px));
  max-height: min(80vh, 760px);
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 28px 28px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 22px;
  background: rgba(24, 24, 24, 0.97);
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  min-height: 0;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-shrink: 0;
}

.history-title {
  color: #fff;
  font-size: 19px;
  font-weight: 880;
}

.history-subtitle {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.56);
  font-size: 12px;
  font-weight: 720;
}

.history-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.76);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.history-filters {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.history-filter {
  height: 32px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  font-weight: 780;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.history-filter:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
}

.history-filter.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.history-count {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
  padding: 0 5px;
  vertical-align: middle;
}

.history-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding-right: 4px;
}

.history-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.history-item:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
}

.history-item-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: rgba(255, 255, 255, 0.03);
}

.history-item-thumb.video-thumb {
  aspect-ratio: 16/9;
}

.history-video-placeholder {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.72);
}

.history-video-placeholder svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-item-info {
  padding: 8px 10px;
}

.history-item-model {
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item-time {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.42);
  font-size: 10px;
  font-weight: 680;
}

.history-item-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.85);
  font-size: 10px;
  font-weight: 780;
  backdrop-filter: blur(6px);
}

.history-item-badge.video {
  background: rgba(120, 80, 220, 0.6);
}

.history-empty {
  display: none;
  text-align: center;
  padding: 48px 0;
  color: rgba(255, 255, 255, 0.35);
  font-size: 13px;
  font-weight: 720;
}

.history-empty.visible {
  display: block;
}

.asset-card {
  width: min(1540px, calc(100vw - 48px));
  height: min(92vh, 960px);
  max-height: calc(100vh - 36px);
  flex: 0 1 auto;
  gap: 16px;
  padding: 0;
  border-radius: 26px;
}

.asset-dialog-head,
.asset-dialog-footer {
  padding: 18px 22px;
  flex-shrink: 0;
}

.asset-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.asset-dialog-title {
  color: #fff;
  font-size: 20px;
  font-weight: 900;
}

.asset-dialog-subtitle {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.54);
  font-size: 12px;
  font-weight: 720;
  line-height: 1.5;
}

.asset-dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: minmax(340px, 460px) minmax(560px, 1fr);
  grid-template-rows: auto minmax(220px, 1fr);
  align-items: start;
  gap: 18px;
  padding: 0 22px;
}

.asset-form-main,
.asset-audio-panel,
.asset-library {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
}

.asset-form-main,
.asset-audio-panel {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  padding: 14px;
}

.asset-section-title {
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  font-weight: 860;
}

.asset-section-note {
  color: rgba(255, 255, 255, 0.48);
  font-size: 12px;
  font-weight: 680;
  line-height: 1.5;
}

.asset-kind-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.2);
}

.asset-kind-tabs button {
  height: 34px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 820;
  cursor: pointer;
}

.asset-kind-tabs button.active {
  background: rgba(255, 255, 255, 0.92);
  color: #121212;
}

.asset-upload-card {
  width: 100%;
  height: clamp(240px, 30vh, 320px);
  min-height: 0;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.24);
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.22);
  color: rgba(255, 255, 255, 0.76);
  cursor: pointer;
  overflow: hidden;
  text-align: center;
}

.asset-upload-card.has-preview {
  border-style: solid;
  padding: 0;
  background: rgba(0, 0, 0, 0.32);
}

.asset-upload-card.dragover {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.92);
}

.asset-upload-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.88);
}

.asset-upload-icon svg,
.asset-reference-button svg,
.asset-audio-action svg,
.asset-preview-action svg,
.asset-item-edit svg,
.asset-item-delete svg,
.asset-picker-action svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.asset-upload-card strong {
  color: #fff;
  font-size: 14px;
  font-weight: 860;
}

.asset-upload-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.asset-upload-card small {
  max-width: 24em;
  color: rgba(255, 255, 255, 0.48);
  font-size: 12px;
  font-weight: 680;
  line-height: 1.5;
}

.asset-primary-preview {
  display: none;
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
  background: #111;
}

.asset-upload-card.has-preview .asset-primary-preview {
  display: block;
}

.asset-upload-card.has-preview .asset-upload-empty {
  display: none;
}

.asset-primary-preview img,
.asset-primary-preview video {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  object-fit: contain;
  background: #111;
}

.asset-preview-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: inline-flex;
  gap: 8px;
}

.asset-preview-action {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.58);
  color: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
}

.asset-preview-action:hover {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.asset-preview-action[data-asset-preview-action="remove"]:hover {
  border-color: rgba(255, 120, 120, 0.46);
  background: rgba(255, 80, 80, 0.18);
}

.asset-preview-action:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.72);
  outline-offset: 2px;
}

.asset-name-field {
  display: grid;
  gap: 7px;
}

.asset-name-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
  font-weight: 760;
}

.asset-name-input {
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  padding: 0 13px;
  font: inherit;
  outline: none;
}

.asset-name-input:focus {
  border-color: rgba(82, 209, 198, 0.42);
  background: rgba(0, 0, 0, 0.32);
  box-shadow: 0 0 0 3px rgba(82, 209, 198, 0.08);
}

.asset-name-input::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.asset-audio-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.asset-audio-slot {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 12px;
  aspect-ratio: 1 / 1;
  min-height: 0;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
}

.asset-audio-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.asset-audio-slot.dragover {
  border-color: rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.08);
}

.asset-audio-slot.is-loading {
  border-color: rgba(82, 209, 198, 0.36);
  background: rgba(82, 209, 198, 0.08);
}

.asset-audio-slot.has-error {
  border-color: rgba(255, 120, 120, 0.36);
  background: rgba(255, 80, 80, 0.08);
}

.asset-audio-slot strong,
.asset-audio-slot span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-audio-slot strong {
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
  font-weight: 820;
}

.asset-audio-slot span {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.46);
  font-size: 11px;
  font-weight: 680;
  white-space: normal;
  line-height: 1.35;
}

.asset-audio-slot.is-loading span {
  color: rgba(150, 238, 226, 0.88);
}

.asset-audio-slot.has-error span {
  color: rgba(255, 180, 190, 0.92);
}

.asset-audio-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.asset-audio-action,
.asset-reference-button,
.asset-picker-action {
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.78);
  padding: 0 11px;
  font-size: 12px;
  font-weight: 820;
  cursor: pointer;
}

.asset-audio-action:hover,
.asset-reference-button:hover,
.asset-picker-action:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.asset-audio-action.remove {
  display: none;
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  padding: 0;
  color: rgba(255, 180, 190, 0.9);
}

.asset-audio-slot.has-audio .asset-audio-action.remove,
.asset-audio-slot.has-error .asset-audio-action.remove {
  display: inline-flex;
}

.asset-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.asset-library {
  grid-column: 1 / -1;
  min-height: 0;
  align-self: stretch;
  padding-bottom: 18px;
}

.asset-library .history-list {
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  max-height: none;
  overflow-y: visible;
}

.asset-library .history-item-thumb,
.asset-picker-thumb img {
  object-fit: contain;
  background: rgba(0, 0, 0, 0.28);
}

.asset-library .history-item.is-editing {
  border-color: rgba(255, 255, 255, 0.34);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 14px 34px rgba(0, 0, 0, 0.32);
}

.asset-item-name {
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 840;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-item-edit,
.asset-item-delete {
  position: absolute;
  top: 6px;
  z-index: 2;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.58);
  color: rgba(255, 220, 220, 0.9);
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.asset-item-edit {
  right: 42px;
  color: rgba(255, 255, 255, 0.9);
}

.asset-item-delete {
  right: 6px;
  color: rgba(255, 220, 220, 0.9);
}

.asset-item-edit:hover {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.asset-item-delete:hover {
  border-color: rgba(255, 120, 120, 0.46);
  background: rgba(255, 80, 80, 0.2);
  color: #fff;
}

.asset-reference-button {
  flex-shrink: 0;
}

.studio-prompt-wrap .asset-reference-button {
  position: absolute;
  top: 8px;
  z-index: 5;
  width: 34px;
  height: 34px;
  padding: 0;
  background: rgba(255, 255, 255, 0.075);
}

.studio-prompt-wrap .asset-reference-button {
  right: 48px;
}

.studio-prompt-wrap .asset-reference-button span {
  display: none;
}

.studio-prompt-wrap .studio-prompt {
  padding-right: 96px !important;
}

.prompt-dialog-actions .asset-reference-button {
  margin-right: auto;
}

.asset-picker-card {
  width: min(760px, calc(100vw - 36px));
  max-height: min(78vh, 680px);
}

.asset-picker-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.asset-picker-item {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  color: inherit;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.asset-picker-item:hover {
  border-color: rgba(82, 209, 198, 0.36);
  background: rgba(82, 209, 198, 0.08);
}

.asset-picker-thumb {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.28);
  color: rgba(255, 255, 255, 0.74);
}

.asset-picker-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.asset-picker-thumb svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.asset-picker-name {
  padding: 9px 10px 3px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 840;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-picker-meta {
  padding: 0 10px 10px;
  color: rgba(255, 255, 255, 0.46);
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 760px) {
  .asset-card {
    width: calc(100vw - 20px);
    height: calc(100vh - 28px);
    max-height: calc(100vh - 28px);
  }

  .asset-dialog-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(160px, 1fr);
    padding: 0 14px;
  }

  .asset-upload-card {
    height: min(360px, 42vh);
  }

  .asset-audio-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .asset-dialog-head,
  .asset-dialog-footer {
    padding: 14px;
  }

  .studio-prompt-wrap .asset-reference-button span {
    display: none;
  }

  .studio-prompt-wrap .asset-reference-button {
    width: 34px;
    padding: 0;
  }

  .studio-prompt-wrap .studio-prompt {
    padding-right: 96px !important;
  }

}

/* History preview modal */
.history-preview {
  position: fixed;
  inset: 0;
  z-index: 96;
  display: none;
  place-items: center;
}

.history-preview.visible {
  display: grid;
}

.history-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
}

.history-preview-card {
  position: relative;
  max-width: min(800px, calc(100vw - 48px));
  max-height: min(85vh, 800px);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(27, 27, 27, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
}

.history-preview-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.5);
  color: rgba(255, 255, 255, 0.8);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.history-preview-img,
.history-preview-video {
  max-width: 100%;
  max-height: 65vh;
  display: block;
  object-fit: contain;
  background: #000;
}

.history-preview-info {
  padding: 14px 18px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 680;
  line-height: 1.6;
}

.history-preview-actions {
  padding: 0 18px 14px;
  display: flex;
  gap: 8px;
}

.history-preview-action {
  flex: 1;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: #f4f4f4;
  color: #111;
  font-size: 13px;
  font-weight: 860;
  cursor: pointer;
  transition: opacity 0.15s;
}

.history-preview-action.secondary {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.88);
}

.history-preview-action:hover {
  opacity: 0.82;
}

.project-modal {
  position: fixed;
  inset: 0;
  z-index: 88;
  display: none;
  place-items: start start;
  padding: 66px 18px 18px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
}

.project-modal.visible {
  display: grid;
}

.project-card {
  width: min(420px, calc(100vw - 36px));
  max-height: min(680px, calc(100vh - 86px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 18px;
  background: rgba(24, 24, 24, 0.98);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.68);
  overflow: hidden;
}

.project-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.project-title {
  color: #fff;
  font-size: 19px;
  font-weight: 880;
}

.project-subtitle {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.56);
  font-size: 12px;
  font-weight: 720;
}

.project-close,
.project-new,
.project-open,
.project-delete,
.share-close,
.share-primary,
.share-secondary,
.share-ghost,
.share-view-clone {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.project-close,
.share-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.76);
  font-size: 20px;
  line-height: 1;
}

.project-new {
  height: 42px;
  border-radius: 12px;
  background: #f4f4f4;
  color: #111;
  font-size: 13px;
  font-weight: 860;
}

.share-modal {
  position: fixed;
  inset: 0;
  z-index: 89;
  display: none;
  place-items: start end;
  padding: 66px 18px 18px;
  background: rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(16px);
}

.share-modal.visible {
  display: grid;
}

.share-card {
  width: min(430px, calc(100vw - 36px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 18px;
  background: rgba(24, 24, 24, 0.98);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.68);
}

.share-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.share-title {
  color: #fff;
  font-size: 18px;
  font-weight: 880;
}

.share-subtitle,
.share-hint {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.56);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.share-section {
  display: grid;
  gap: 8px;
}

.share-label {
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  font-weight: 820;
}

.share-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.share-input {
  min-width: 0;
  height: 40px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.9);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 720;
  outline: none;
}

.share-input:focus {
  border-color: rgba(85, 216, 194, 0.46);
  box-shadow: 0 0 0 3px rgba(85, 216, 194, 0.1);
}

.share-primary,
.share-secondary,
.share-ghost {
  height: 40px;
  border-radius: 12px;
  padding: 0 13px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 860;
}

.share-primary {
  width: 100%;
  background: #f4f4f4;
  color: #111;
}

.share-secondary {
  background: rgba(85, 216, 194, 0.14);
  color: rgba(161, 255, 240, 0.95);
  border: 1px solid rgba(85, 216, 194, 0.28);
}

.share-ghost {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.share-primary:disabled,
.share-secondary:disabled,
.share-ghost:disabled {
  cursor: default;
  opacity: 0.55;
}

.share-error {
  min-height: 16px;
  color: rgb(253, 164, 175);
  font-size: 12px;
  font-weight: 720;
}

.team-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-items: start end;
  padding: 66px 18px 18px;
  background: rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(16px);
}

.team-modal.visible {
  display: grid;
}

.team-card {
  width: min(430px, calc(100vw - 36px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(85, 216, 194, 0.2);
  border-radius: 18px;
  background: rgba(24, 24, 24, 0.98);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.68);
}

.team-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.team-title {
  color: #fff;
  font-size: 18px;
  font-weight: 880;
}

.team-subtitle,
.team-hint {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.56);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.team-close,
.team-primary,
.team-secondary,
.team-ghost {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.team-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.76);
  font-size: 20px;
  line-height: 1;
}

.team-section,
.team-active-panel {
  display: grid;
  gap: 8px;
}

.team-active-panel {
  display: none;
}

.team-active .team-active-panel {
  display: grid;
}

.team-label {
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  font-weight: 820;
}

.team-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.team-input {
  min-width: 0;
  height: 40px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.9);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 720;
  outline: none;
}

.team-input:focus {
  border-color: rgba(85, 216, 194, 0.46);
  box-shadow: 0 0 0 3px rgba(85, 216, 194, 0.1);
}

.team-primary,
.team-secondary,
.team-ghost {
  height: 40px;
  border-radius: 12px;
  padding: 0 13px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 860;
}

.team-primary {
  width: 100%;
  background: #f4f4f4;
  color: #111;
}

.team-secondary {
  background: rgba(85, 216, 194, 0.14);
  color: rgba(161, 255, 240, 0.95);
  border: 1px solid rgba(85, 216, 194, 0.28);
}

.team-ghost {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.team-primary:disabled,
.team-secondary:disabled,
.team-ghost:disabled {
  cursor: default;
  opacity: 0.55;
}

.team-error {
  min-height: 16px;
  color: rgb(253, 164, 175);
  font-size: 12px;
  font-weight: 720;
}

.team-status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid rgba(85, 216, 194, 0.2);
  border-radius: 12px;
  background: rgba(85, 216, 194, 0.08);
  color: rgba(224, 255, 250, 0.9);
  font-size: 12px;
  font-weight: 780;
}

.team-presence-bar {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 57;
  display: none;
  align-items: center;
  gap: 10px;
  max-width: min(620px, calc(100vw - 36px));
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid rgba(85, 216, 194, 0.2);
  border-radius: 999px;
  background: rgba(19, 22, 22, 0.84);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
  pointer-events: auto;
}

body.team-active .team-presence-bar {
  display: flex;
}

.team-presence-title {
  flex: 0 0 auto;
  color: rgba(232, 255, 251, 0.92);
  font-size: 12px;
  font-weight: 880;
}

.team-members {
  display: flex;
  min-width: 0;
  gap: 6px;
  overflow: hidden;
}

.team-member-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 132px;
  min-height: 26px;
  padding: 0 9px 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  font-size: 12px;
  font-weight: 780;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-member-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
  background: var(--member-color, #55d8c2);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.remote-presence-layer {
  position: fixed;
  inset: 0;
  z-index: 58;
  pointer-events: none;
}

.remote-cursor {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  grid-template-columns: 14px auto;
  align-items: start;
  gap: 4px;
  transform: translate(var(--cursor-x, 0px), var(--cursor-y, 0px));
  transition: transform 120ms linear;
}

.remote-cursor svg {
  width: 18px;
  height: 18px;
  fill: var(--cursor-color, #55d8c2);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.42));
}

.remote-cursor-label {
  max-width: 120px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--cursor-color, #55d8c2);
  color: #071010;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.share-view-bar {
  position: fixed;
  left: 50%;
  top: 18px;
  z-index: 70;
  display: none;
  align-items: center;
  gap: 12px;
  max-width: min(760px, calc(100vw - 36px));
  padding: 9px 10px 9px 14px;
  border: 1px solid rgba(85, 216, 194, 0.28);
  border-radius: 16px;
  background: rgba(16, 18, 18, 0.9);
  color: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 58px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

body.share-readonly .share-view-bar {
  display: flex;
}

.share-view-main {
  min-width: 0;
}

.share-view-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
  font-size: 13px;
  font-weight: 860;
}

.share-view-subtitle {
  margin-top: 1px;
  color: rgba(255, 255, 255, 0.54);
  font-size: 11px;
  font-weight: 720;
}

.share-view-clone {
  height: 34px;
  flex-shrink: 0;
  border-radius: 12px;
  padding: 0 12px;
  background: #f4f4f4;
  color: #111;
  font-size: 12px;
  font-weight: 860;
}

body.share-readonly .studio-panel,
body.share-readonly .app-rail,
body.share-readonly .rail-toggle,
body.share-readonly .canvas-mode-switch,
body.share-readonly .project-switcher,
body.share-readonly .history-toggle,
body.share-readonly .canvas-chat-trigger,
body.share-readonly .canvas-account-menu,
body.share-readonly .canvas-action-pill,
body.share-readonly #canvasAccountButton,
body.share-readonly .image-toolbar,
body.share-readonly .edit-toolbar,
body.share-readonly .context-menu,
body.share-readonly .creation-choice {
  display: none !important;
}

body.share-readonly .canvas-top-actions {
  display: inline-flex;
}

body.share-readonly .canvas-node,
body.share-readonly .node-port {
  pointer-events: none;
}

body.share-readonly #app {
  cursor: grab;
}

.project-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 2px;
}

.project-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.project-row.active {
  border-color: rgba(85, 216, 194, 0.45);
  background: rgba(85, 216, 194, 0.09);
}

.project-row-main {
  min-width: 0;
}

.project-row-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 820;
}

.project-row-time {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 11px;
  font-weight: 680;
}

.project-open,
.project-delete {
  height: 32px;
  border-radius: 9px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 800;
}

.project-open:hover,
.project-delete:hover,
.project-close:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.project-delete:disabled {
  opacity: 0.35;
  cursor: default;
}

.annotation-editor {
  position: fixed;
  inset: 0;
  z-index: 62;
  display: grid;
  place-items: center;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  padding: 14px 18px 20px;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  box-sizing: border-box;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(14px);
}

body.annotation-open {
  overflow: hidden;
}

.annotation-hint {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 0;
}

.annotation-stage {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(255, 255, 255, 0.09);
  background: rgba(18, 18, 18, 0.98);
}

.annotation-stage-scroll {
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: 0;
  min-width: 0;
  width: min(100%, calc(100vw - 36px));
  height: min(100%, calc(100vh - 96px));
  height: min(100%, calc(100dvh - 96px));
  padding: 0;
}

.annotation-stage-scroll .annotation-stage {
  margin: auto;
  flex-shrink: 0;
}

.annotation-stage img,
.annotation-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.annotation-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.annotation-toolbar {
  position: relative;
  left: auto;
  top: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100vw - 48px);
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  background: rgba(24, 24, 24, 0.97);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.48);
  flex-wrap: wrap;
  justify-content: center;
}

.annotation-toolbar button {
  height: 36px;
  min-width: 38px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  font-weight: 820;
  padding: 0 13px;
}

.annotation-toolbar button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.annotation-toolbar button.active,
.annotation-toolbar button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.annotation-toolbar [data-annot-action="save"] {
  background: #f4f4f4;
  color: #111;
  padding: 0 14px;
}

.annotation-toolbar [data-annot-action="save"]:hover {
  background: #fff;
  color: #111;
}

.annotation-toolbar input[type="color"] {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  overflow: hidden;
  cursor: pointer;
}

.annotation-toolbar input[type="range"] {
  width: 104px;
  height: 3px;
  accent-color: #f4f4f4;
}

.marquee {
  position: fixed;
  z-index: 28;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: 0 0 28px rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.selection-shell {
  position: fixed;
  z-index: 27;
  display: none;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow:
    0 0 0 1px rgba(85, 216, 194, 0.08),
    0 0 34px rgba(85, 216, 194, 0.12);
  pointer-events: none;
}

.selection-shell.visible {
  display: block;
}

.selection-actions {
  position: absolute;
  left: 50%;
  top: auto;
  bottom: -56px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 14px;
  background: rgba(21, 21, 21, 0.96);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  pointer-events: auto;
  transform: translateX(-50%);
  backdrop-filter: blur(16px);
}

.selection-shell.actions-above .selection-actions {
  top: -56px;
  bottom: auto;
}

.selection-actions button {
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 820;
  transition: background 120ms ease, color 120ms ease, transform 120ms ease;
}

.selection-actions button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: translateY(-1px);
}

.selection-actions button[data-group-action="merge"] {
  background: rgba(85, 216, 194, 0.16);
  color: #eafffb;
}

.selection-shell:not(.can-merge-grid) .selection-actions button[data-group-action="merge"] {
  display: none;
}

.group-port {
  position: absolute;
  right: -24px;
  top: 50%;
  width: 38px;
  height: 38px;
  border: 1.5px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: rgba(12, 12, 12, 0.88);
  transform: translateY(-50%);
  pointer-events: auto;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.1);
}

.group-port::before,
.group-port::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
}

.group-port::before {
  width: 18px;
  height: 2.5px;
}

.group-port::after {
  width: 2.5px;
  height: 18px;
}

.grid-frame-node {
  cursor: default;
}

.grid-frame-node .node-title {
  left: 0;
  top: -34px;
  transform: none;
}

.grid-frame-shell {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 1.5px solid rgba(190, 255, 247, 0.34);
  border-radius: 26px;
  background: #171717;
  box-shadow:
    0 22px 64px rgba(0, 0, 0, 0.46),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  pointer-events: auto;
  isolation: isolate;
}

.grid-frame-node.selected .grid-frame-shell {
  border-color: rgba(255, 255, 255, 0.58);
  box-shadow:
    0 20px 62px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.16),
    0 0 32px rgba(85, 216, 194, 0.18);
}

.grid-frame-cell {
  position: absolute;
  overflow: hidden;
  background: #202020;
  border-right: 2px solid rgba(190, 255, 247, 0.82);
  border-bottom: 2px solid rgba(190, 255, 247, 0.82);
  box-shadow:
    inset -1px 0 0 rgba(0, 0, 0, 0.55),
    inset 0 -1px 0 rgba(0, 0, 0, 0.55);
  touch-action: none;
  cursor: move;
}

.grid-frame-cell.empty {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(190, 255, 247, 0.11) 0,
      rgba(190, 255, 247, 0.11) 8px,
      rgba(255, 255, 255, 0.025) 8px,
      rgba(255, 255, 255, 0.025) 16px
    ),
    linear-gradient(135deg, rgba(190, 255, 247, 0.1), rgba(255, 255, 255, 0.025)),
    #151515;
}

.grid-frame-cell:active {
  cursor: grabbing;
}

.grid-frame-cell img {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  max-width: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center;
}

.grid-cell-extract {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 4;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(190, 255, 247, 0.72);
  border-radius: 14px;
  background: rgba(5, 12, 12, 0.84);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(255, 255, 255, 0.08);
  color: rgba(235, 255, 252, 0.98);
  cursor: grab;
  opacity: 0.92;
  transition: opacity 120ms ease, background 120ms ease, transform 120ms ease;
  backdrop-filter: blur(10px);
}

.grid-frame-cell:hover .grid-cell-extract {
  opacity: 1;
}

.grid-cell-extract:hover,
.grid-cell-extract:active {
  opacity: 1;
  background: rgba(24, 42, 42, 0.92);
  transform: scale(1.06);
}

.grid-cell-extract svg {
  width: 23px;
  height: 23px;
  stroke: currentColor;
  stroke-width: 2.35;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.grid-frame-cell.snap-active::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px dashed rgba(85, 216, 194, 0.62);
  border-radius: 16px;
  pointer-events: none;
}

.grid-frame-node.merge-frame .grid-frame-cell.snap-active::after {
  content: none;
}

.grid-frame-node.merge-frame .grid-frame-cell.reorder-source {
  opacity: 0.72;
}

.grid-frame-node.merge-frame .grid-frame-cell.reorder-target::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px solid rgba(190, 255, 247, 0.86);
  border-radius: 16px;
  pointer-events: none;
}

.grid-frame-node.merge-frame .grid-cell-extract {
  display: none;
}

.grid-cell-download {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(15, 15, 15, 0.78);
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 120ms ease, transform 120ms ease, background 120ms ease;
  backdrop-filter: blur(10px);
}

.grid-frame-cell:hover .grid-cell-download {
  opacity: 1;
  transform: translateY(0);
}

.grid-cell-download:hover {
  background: rgba(255, 255, 255, 0.14);
}

.grid-cell-download svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Interaction polish: stable ports, calmer menus, stronger preview/edit surfaces. */
#connections {
  z-index: 3;
  pointer-events: none;
}

.connection-hit {
  pointer-events: none;
}

.node-port {
  opacity: 0;
  pointer-events: none;
  --port-x: 0px;
  --port-y: 0px;
  --rest-x: 0px;
  transform: translate(calc(var(--rest-x) + var(--port-x)), calc(-50% + var(--port-y))) scale(0.78);
  transition:
    opacity 150ms ease,
    transform 90ms ease-out,
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

.node-port.left {
  left: -64px;
  --rest-x: 34px;
}

.node-port.right {
  right: -64px;
  --rest-x: -34px;
}

.gen-node .node-port.left {
  left: 82px;
}

.gen-node .node-port.right {
  left: 580px;
}

.text-node .node-port {
  top: 210px;
}

.text-node .node-port.left {
  left: 82px;
  right: auto;
}

.text-node .node-port.right {
  left: 580px;
  right: auto;
}

.node-port.near,
.node-port.dragging,
.canvas-node:hover .node-port,
.canvas-node.selected .node-port {
  opacity: 1;
  pointer-events: auto;
  transform: translate(calc(var(--rest-x) * 0.12 + var(--port-x)), calc(-50% + var(--port-y))) scale(1);
}

body.multi-selected .canvas-node.selected .node-port {
  opacity: 0;
  pointer-events: none;
  transform: translate(calc(var(--rest-x) + var(--port-x)), calc(-50% + var(--port-y))) scale(0.78);
}

.node-port.near {
  border-color: rgba(207, 255, 247, 0.82);
  background: rgba(12, 18, 17, 0.92);
  box-shadow: 0 0 24px rgba(85, 216, 194, 0.18);
}

.prompt-input {
  border-radius: 18px;
  padding: 10px 12px;
  background: rgba(18, 18, 18, 0.99);
  transition: background 160ms ease, box-shadow 160ms ease;
}

.gen-panel {
  background: rgba(28, 28, 28, 0.97);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.gen-panel:hover {
  background: rgba(18, 18, 18, 0.99);
  border-color: rgba(255, 255, 255, 0.16);
}

.gen-panel .prompt-input,
.gen-panel:hover .prompt-input {
  background: transparent;
}

.prompt-input:hover {
  background: transparent;
}

.prompt-input:focus {
  background: transparent;
  box-shadow: none;
}

.ratio-current,
.quality-current,
.count-current {
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.ratio-current:hover,
.ratio-menu.open .ratio-current,
.quality-current:hover,
.quality-menu.open .quality-current,
.count-current:hover,
.count-menu.open .count-current {
  transform: none;
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.22);
}

.ratio-popover,
.quality-popover,
.count-popover,
.tool-popover {
  border-radius: 20px;
  padding: 10px;
  background: rgba(18, 18, 18, 0.96);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow:
    0 20px 54px rgba(0, 0, 0, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px);
}

.ratio-popover {
  left: 0;
  bottom: 46px;
  width: max-content;
  min-width: 104px;
  grid-auto-flow: row;
  grid-auto-columns: auto;
  grid-template-columns: 1fr;
}

.gen-node[data-kind="image"] .ratio-popover {
  width: 318px;
  grid-auto-flow: row;
  grid-auto-columns: auto;
  grid-template-columns: repeat(4, 1fr);
}

.count-popover {
  left: 50%;
  right: auto;
  bottom: 46px;
  min-width: 74px;
  transform: translateX(-50%);
  overflow: hidden;
  z-index: 91;
}

.ratio-menu.open .ratio-popover {
  animation: menu-pop-up 140ms cubic-bezier(0.16, 1, 0.3, 1);
}

.reference-mode-menu.open .reference-mode-popover,
.count-menu.open .count-popover,
.quality-menu.open .quality-popover {
  animation: menu-pop-centered 140ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tool-popover.visible {
  animation: menu-pop-toolbar 140ms cubic-bezier(0.16, 1, 0.3, 1);
}

#splitPopover {
  flex-direction: row;
  gap: 8px;
  padding: 9px;
}

#splitPopover button {
  min-width: 58px;
  height: 38px;
  border-radius: 999px;
}

.tool-btn[data-action="enhance"] svg {
  stroke-width: 2.25;
}

.tool-btn[data-action="merge"] svg {
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes menu-pop-up {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes menu-pop-centered {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes menu-pop-toolbar {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.ratio-choice,
.count-choice,
.tool-popover button {
  border-radius: 13px;
  color: rgba(255, 255, 255, 0.78);
  transition: background 120ms ease, color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.ratio-choice:hover,
.count-choice:hover,
.tool-popover button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.07);
}

.ratio-choice.active,
.count-choice.active {
  background: rgba(245, 245, 245, 0.96);
  color: #101010;
}

.image-toolbar.menu-open .tool-btn::after {
  display: none;
}

.model-popover {
  position: fixed;
  z-index: 34;
  display: none;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(24, 24, 24, 0.985);
  color: rgba(255, 255, 255, 0.86);
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.52),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px);
  font-size: 14px;
  font-weight: 820;
  pointer-events: none;
}

.panel-icon-button {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 130ms ease, border-color 130ms ease, transform 130ms ease, box-shadow 130ms ease;
}

.panel-icon-button:hover,
.panel-icon-button.recording,
.panel-icon-button.transcribing {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 22px rgba(255, 255, 255, 0.08);
}

.send-button {
  width: 46px;
  min-width: 46px;
  height: 38px;
  padding: 0;
  gap: 0;
  border-color: rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.07);
}

.send-button span:first-child {
  display: inline-grid;
}

.send-button .send-arrow {
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  color: #f4f4f4;
  font-size: 20px;
  transform: translateY(-1px);
}

.send-button {
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.075);
}

.send-button:hover {
  background: rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 26px rgba(255, 255, 255, 0.1);
}

.send-button .send-arrow svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.model-popover.visible {
  display: inline-flex;
  animation: menu-pop-toolbar 140ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tool-btn.clicked {
  animation: tool-clicked 520ms cubic-bezier(0.2, 1.45, 0.36, 1);
}

@keyframes tool-clicked {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(0.86);
    background: #f4f4f4;
    color: #111;
  }
  100% {
    transform: scale(1);
  }
}

.gen-status {
  max-height: 22px;
  -webkit-line-clamp: 1;
  color: rgba(255, 255, 255, 0.52);
}

.gen-status.error {
  color: #ff9e9e;
}

.gen-node[data-kind="video"] .gen-status:not(.error) {
  display: none !important;
}

.gen-status.error::before {
  content: "";
}

.crop-editor,
.outpaint-editor {
  position: fixed;
  inset: 0;
  z-index: 58;
  pointer-events: auto;
  overflow: hidden;
  background: transparent;
  backdrop-filter: none;
  animation: editor-fade 180ms ease;
}

@keyframes editor-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.image-node.crop-source .image-frame,
.gen-node.crop-source .gen-preview {
  border-color: rgba(85, 216, 194, 0.88);
  box-shadow:
    0 18px 58px rgba(0, 0, 0, 0.46),
    0 0 0 2px rgba(85, 216, 194, 0.45),
    0 0 34px rgba(85, 216, 194, 0.32);
}

.image-node.outpaint-source .image-frame,
.gen-node.outpaint-source .gen-preview {
  opacity: 0;
}

.crop-work {
  position: fixed;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.62);
  animation: crop-work-zoom 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.outpaint-editor .crop-work {
  overflow: visible;
  box-shadow: none;
}

@keyframes crop-work-zoom {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.crop-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 24px;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

.outpaint-editor .crop-image {
  inset: auto;
  border-radius: 24px;
  box-shadow: none;
}

.crop-box {
  position: absolute;
  border: 2px solid rgba(86, 195, 255, 0.96);
  border-radius: 12px;
  cursor: move;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.42), 0 0 34px rgba(86, 195, 255, 0.18);
  background: transparent;
  transition: left 160ms ease, top 160ms ease, width 160ms ease, height 160ms ease, border-color 160ms ease;
}

.crop-box.resizing {
  transition: none;
}

.outpaint-editor .crop-box {
  border-color: rgba(86, 195, 255, 0.98);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.28),
    0 0 0 9999px rgba(0, 0, 0, 0.34);
  background: transparent;
}

.crop-handle {
  position: absolute;
  opacity: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  z-index: 2;
}

.crop-handle::after {
  display: none;
}

.crop-handle.n,
.crop-handle.s {
  left: 18px;
  right: 18px;
  width: auto;
  border: 0;
  height: 18px;
}

.crop-handle.e,
.crop-handle.w {
  top: 18px;
  bottom: 18px;
  width: 18px;
  height: auto;
}

.crop-handle.n {
  top: -9px;
  cursor: ns-resize;
}

.crop-handle.s {
  bottom: -9px;
  cursor: ns-resize;
}

.crop-handle.e {
  right: -9px;
  cursor: ew-resize;
}

.crop-handle.w {
  left: -9px;
  cursor: ew-resize;
}

.crop-handle.nw,
.crop-handle.ne,
.crop-handle.sw,
.crop-handle.se {
  width: 34px;
  height: 34px;
  z-index: 4;
}

.crop-handle.nw {
  left: -17px;
  top: -17px;
  cursor: nwse-resize;
}

.crop-handle.ne {
  right: -17px;
  top: -17px;
  cursor: nesw-resize;
}

.crop-handle.sw {
  left: -17px;
  bottom: -17px;
  cursor: nesw-resize;
}

.crop-handle.se {
  right: -17px;
  bottom: -17px;
  cursor: nwse-resize;
}

.crop-actions {
  position: fixed;
  left: 50%;
  bottom: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(24, 24, 24, 0.98);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.58);
  transform: translateX(-50%);
}

.crop-actions .bottom-chip {
  height: 40px;
  min-height: 40px;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.06);
}

.mode-button {
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 820;
}

.mode-button:hover,
.mode-button.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.mode-button.primary {
  background: #f4f4f4;
  color: #111;
  padding: 0 22px;
}

.preview-modal {
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 0;
  padding: 28px;
  background: rgba(0, 0, 0, 0.52);
  isolation: isolate;
}

.preview-modal.visible {
  display: grid;
}

.preview-modal::before {
  content: "";
  position: fixed;
  inset: -28px;
  z-index: -1;
  background:
    linear-gradient(rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.58)),
    var(--preview-bg, none) center / cover no-repeat;
  filter: blur(24px);
  transform: scale(1.08);
  opacity: 0.86;
}

.preview-stage {
  position: relative;
  width: 100%;
  height: calc(100vh - 56px);
  overflow: hidden;
  border-radius: 18px 0 0 18px;
  background: rgba(23, 23, 23, 0.82);
  cursor: grab;
}

.preview-stage:active {
  cursor: grabbing;
}

.preview-stage img {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: calc(100% - 32px);
  max-height: calc(100% - 32px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0;
  box-shadow: none;
  transform: translate(calc(-50% + var(--pan-x, 0px)), calc(-50% + var(--pan-y, 0px))) scale(var(--modal-scale, 1));
  transform-origin: center;
  transition: transform 80ms ease;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.preview-stage video {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(100%, 1180px);
  max-height: 100%;
  background: #000;
  transform: translate(-50%, -50%);
  outline: none;
}

.preview-side {
  height: calc(100vh - 56px);
  padding: 28px;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0 18px 18px 0;
  background: rgba(32, 32, 32, 0.9);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.preview-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #d7d7d7;
  font-size: 18px;
  font-weight: 840;
}

.preview-close {
  position: static;
  width: 34px;
  height: 34px;
  background: transparent;
  color: #bcbcbc;
  font-size: 28px;
}

.preview-prompt {
  min-height: 170px;
  padding: 18px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.18);
  color: rgba(255, 255, 255, 0.82);
  font-size: 16px;
  font-weight: 760;
  line-height: 1.55;
  transition: background 150ms ease;
  overflow: auto;
}

.preview-prompt:hover {
  background: rgba(0, 0, 0, 0.36);
}

.preview-info {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 720;
}

.preview-use,
.preview-download {
  margin-top: auto;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.42);
  color: #fff;
  cursor: pointer;
  font-weight: 860;
  transition: background 130ms ease, transform 130ms ease;
}

.preview-use {
  margin-top: 0;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.12);
}

.preview-use:hover {
  background: rgba(255, 255, 255, 0.22);
}

.preview-modal.history-result .preview-use {
  margin-top: auto;
}

.preview-modal.history-result .preview-download {
  margin-top: 0;
}

.preview-download:hover {
  background: rgba(255, 255, 255, 0.55);
}

.preview-download.clicked {
  transform: scale(0.97);
  background: #f4f4f4;
  color: #111;
}

.prompt-modal {
  position: fixed;
  inset: 0;
  z-index: 96;
  display: none;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(18px);
}

.prompt-modal.visible {
  display: grid;
}

.prompt-dialog {
  width: min(940px, calc(100vw - 44px));
  height: min(780px, calc(100vh - 44px));
  display: grid;
  grid-template-rows: auto minmax(420px, 1fr) auto;
  gap: 14px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  background: rgba(31, 31, 31, 0.98);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58);
}

.prompt-dialog-head,
.prompt-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.prompt-dialog-title {
  color: #fff;
  font-size: 16px;
  font-weight: 820;
}

.prompt-dialog-close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.78);
  font-size: 24px;
  cursor: pointer;
}

.prompt-modal-textarea {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 420px;
  resize: none;
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 0;
  outline: none;
  padding: 22px;
  background: transparent;
  color: #f5f5f5;
  font-size: var(--prompt-modal-font-size, 18px);
  line-height: 1.6;
  scrollbar-width: thin;
}

.prompt-modal-editor {
  position: relative;
  min-height: 420px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  background: rgba(8, 8, 8, 0.36);
  overflow: hidden;
}

.prompt-modal-editor:focus-within {
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.prompt-modal-ref-row {
  position: absolute;
  left: 20px;
  right: 20px;
  top: 18px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #b6b6b6;
  font-size: 14px;
  font-weight: 700;
  min-width: 0;
  height: 44px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.prompt-modal-ref-row[hidden] {
  display: none;
}

.prompt-modal-ref-row span {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-modal-editor.has-refs .prompt-modal-textarea,
.prompt-modal-editor.has-refs .prompt-modal-typo-layer {
  padding-top: 82px;
}

.prompt-modal-typo-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  min-height: 420px;
  padding: 22px;
  border: 0;
  border-radius: 0;
  color: transparent;
  font-size: var(--prompt-modal-font-size, 18px);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.prompt-modal-typo-layer .typo-mark {
  color: transparent;
  text-decoration-line: underline;
  text-decoration-style: solid;
  text-decoration-color: #ff4f4f;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.prompt-modal-textarea:focus {
  box-shadow: none;
}

.prompt-dialog-hint {
  color: rgba(255, 255, 255, 0.52);
  font-size: 12px;
  font-weight: 720;
}

.prompt-dialog-save {
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: rgb(245, 245, 245);
  color: #111;
  padding: 0 18px;
  font-weight: 820;
  cursor: pointer;
}

.prompt-modal.node-prompt-modal.panel-hosting {
  background: rgba(0, 0, 0, 0.34);
  backdrop-filter: none;
}

.prompt-modal.node-prompt-modal.panel-hosting .prompt-dialog {
  width: min(1480px, calc(100vw - 80px));
  height: auto;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.prompt-modal.node-prompt-modal.panel-hosting .prompt-dialog-head,
.prompt-modal.node-prompt-modal.panel-hosting .prompt-modal-editor,
.prompt-modal.node-prompt-modal.panel-hosting .prompt-dialog-actions {
  display: none;
}

.prompt-modal.node-prompt-modal.panel-hosting .gen-panel.modal-expanded-panel {
  position: relative;
  left: auto !important;
  top: auto !important;
  width: 100%;
  height: min(820px, calc(100vh - 104px));
  min-height: min(560px, calc(100vh - 96px));
  transform: none !important;
}

.prompt-modal.node-prompt-modal.panel-hosting .modal-expanded-panel .panel-top {
  left: 22px;
  right: 22px;
  top: 20px;
}

.prompt-modal.node-prompt-modal.panel-hosting .modal-expanded-panel .prompt-input,
.prompt-modal.node-prompt-modal.panel-hosting .modal-expanded-panel .prompt-typo-layer {
  left: 30px;
  right: 30px;
  top: 94px;
  height: calc(100% - 178px);
  box-sizing: border-box;
  padding: 8px 36px 12px 4px;
  font-size: var(--prompt-modal-font-size, 20px);
  line-height: 1.5;
  scrollbar-gutter: stable;
}

.prompt-modal.node-prompt-modal.panel-hosting .modal-expanded-panel .prompt-typo-layer .studio-inline-mention {
  height: 24px;
  margin: 0;
  padding: 2px 6px 2px 3px;
}

.prompt-modal.node-prompt-modal.panel-hosting .modal-expanded-panel .prompt-typo-layer .studio-inline-mention img,
.prompt-modal.node-prompt-modal.panel-hosting .modal-expanded-panel .prompt-typo-layer .studio-inline-mention-media {
  width: 16px;
  height: 16px;
  margin-right: 3px;
  border-radius: 5px;
}

.prompt-modal.node-prompt-modal.panel-hosting .modal-expanded-panel.modal-has-refs .ref-row {
  left: 30px;
  right: 30px;
  top: 78px;
}

.prompt-modal.node-prompt-modal.panel-hosting .modal-expanded-panel.modal-has-refs .prompt-input,
.prompt-modal.node-prompt-modal.panel-hosting .modal-expanded-panel.modal-has-refs .prompt-typo-layer {
  top: 136px;
  height: calc(100% - 220px);
}

.prompt-modal.node-prompt-modal.panel-hosting .modal-expanded-panel .panel-bottom {
  left: 24px;
  right: 24px;
  bottom: 20px;
}

.prompt-modal.node-prompt-modal.panel-hosting .modal-expanded-panel .gen-status:not(.error) {
  display: none !important;
}

.prompt-modal.node-prompt-modal.panel-hosting .modal-expanded-panel .ratio-popover,
.prompt-modal.node-prompt-modal.panel-hosting .modal-expanded-panel .reference-mode-popover,
.prompt-modal.node-prompt-modal.panel-hosting .modal-expanded-panel .quality-popover,
.prompt-modal.node-prompt-modal.panel-hosting .modal-expanded-panel .count-popover {
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
  transform-origin: bottom center !important;
}

.prompt-modal.node-prompt-modal.panel-hosting .modal-expanded-panel .ratio-menu.open .ratio-popover,
.prompt-modal.node-prompt-modal.panel-hosting .modal-expanded-panel .reference-mode-menu.open .reference-mode-popover,
.prompt-modal.node-prompt-modal.panel-hosting .modal-expanded-panel .quality-menu.open .quality-popover,
.prompt-modal.node-prompt-modal.panel-hosting .modal-expanded-panel .count-menu.open .count-popover {
  animation: menu-pop-centered 140ms cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.marquee {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.075);
  box-shadow: 0 0 28px rgba(255, 255, 255, 0.14);
}

.key-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(12px);
}

.key-modal.visible {
  display: grid;
}

.key-card {
  width: min(520px, calc(100vw - 40px));
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: rgba(28, 28, 28, 0.98);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.62);
}

.key-title {
  color: #fff;
  font-size: 20px;
  font-weight: 860;
  margin-bottom: 10px;
}

.key-desc {
  color: rgba(255, 255, 255, 0.62);
  font-size: 14px;
  font-weight: 650;
  margin-bottom: 16px;
}

.key-input {
  width: 100%;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.24);
  color: #fff;
  outline: none;
  padding: 0 14px;
  font-size: 14px;
}

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

.key-actions button {
  height: 40px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 820;
}

.key-cancel {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.78);
}

.key-save {
  background: #f4f4f4;
  color: #111;
}

.key-error {
  min-height: 20px;
  margin-top: 10px;
  color: #ffaaaa;
  font-size: 13px;
  font-weight: 760;
}

.studio-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  bottom: auto;
  z-index: 36;
  width: min(1040px, calc(100vw - 190px));
  min-height: 212px;
  max-height: 540px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(42, 45, 52, 0.98), rgba(28, 31, 38, 0.98)),
    linear-gradient(135deg, rgba(85, 216, 194, 0.08), rgba(45, 167, 231, 0.04));
  box-shadow:
    0 26px 80px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(255, 255, 255, 0.035),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
  transform: translate(-50%, -50%);
  transition: top 260ms cubic-bezier(0.16, 1, 0.3, 1), bottom 260ms cubic-bezier(0.16, 1, 0.3, 1), transform 260ms cubic-bezier(0.16, 1, 0.3, 1), width 260ms cubic-bezier(0.16, 1, 0.3, 1), height 260ms cubic-bezier(0.16, 1, 0.3, 1), min-height 260ms cubic-bezier(0.16, 1, 0.3, 1), border-radius 260ms cubic-bezier(0.16, 1, 0.3, 1), border-color 160ms ease, box-shadow 160ms ease, background 220ms ease;
  user-select: none;
}

body.has-results .studio-panel {
  top: auto;
  bottom: 28px;
  transform: translateX(-50%);
}

.studio-panel.studio-dragover {
  border-color: rgba(85, 216, 194, 0.68);
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.5),
    0 0 0 4px rgba(85, 216, 194, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.studio-panel.studio-dragover::after {
  content: "松开上传参考素材";
  position: absolute;
  inset: 10px;
  z-index: 8;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(85, 216, 194, 0.72);
  border-radius: 24px;
  background: rgba(19, 27, 30, 0.72);
  color: rgba(255, 255, 255, 0.9);
  font-size: 18px;
  font-weight: 860;
  pointer-events: none;
  backdrop-filter: blur(8px);
}

body.view-generate .studio-panel.studio-dragover::after {
  display: none;
}

.studio-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
}

.studio-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: #fff;
  font-size: 18px;
  font-weight: 880;
}

.studio-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(85, 216, 194, 0.92), rgba(45, 167, 231, 0.92));
  color: #07100f;
  box-shadow: 0 10px 26px rgba(85, 216, 194, 0.18);
}

.studio-mark svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.studio-key {
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 820;
}

.studio-scroll {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
  overflow: visible;
  padding-right: 2px;
}

.studio-section {
  display: grid;
  gap: 10px;
}

.studio-section:has(.studio-prompt) {
  order: 1;
  flex: 1 0 100%;
}

.studio-section:has(.studio-ref-bar) {
  order: 2;
  flex: 1 1 320px;
  min-width: min(100%, 280px);
}

.studio-section:has(#studioMode),
.studio-section:has(#studioModels),
.studio-section:has(#studioRatios),
.studio-section:has(#studioQualities),
.studio-section:has(.studio-utility-grid) {
  display: block;
}

.studio-section:has(.studio-utility-grid) {
  display: none;
}

.studio-label {
  color: rgba(255, 255, 255, 0.48);
  font-size: 11px;
  font-weight: 840;
  letter-spacing: 0;
  margin-bottom: 7px;
}

.studio-segment,
.studio-grid-options,
.studio-model-list,
.studio-utility-grid {
  display: grid;
  gap: 8px;
}

.studio-segment {
  display: inline-grid;
  grid-template-columns: auto auto;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.18);
}

.studio-segment button,
.studio-chip,
.studio-model,
.studio-utility,
.studio-generate {
  border: 0;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  font-weight: 820;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.studio-segment button {
  height: 34px;
  border-radius: 13px;
  background: transparent;
  font-size: 13px;
  padding: 0 16px;
}

.studio-segment button.active {
  background: rgba(255, 255, 255, 0.94);
  color: #111;
}

.studio-model-list {
  position: relative;
  display: grid;
  width: min(100%, 260px);
  gap: 6px;
  z-index: 24;
  overflow: visible;
}

.studio-model {
  min-height: 34px;
  display: none;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 0 11px 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.045);
  text-align: left;
}

.studio-model.active {
  display: grid !important;
  width: 100%;
  justify-content: flex-start;
}

.studio-model-list.open {
  width: min(100%, 320px);
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 18px;
  background: rgba(24, 26, 31, 0.98);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
  animation: studio-pop-open 120ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes studio-pop-open {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.studio-model-list[data-mode="image"].open .studio-model[data-kind="image"],
.studio-model-list[data-mode="video"].open .studio-model[data-kind="video"] {
  display: grid !important;
  width: 100%;
}

.studio-model-list[data-mode="video"].open .studio-model[data-kind="video"]:not([data-video-base="true"]) {
  display: none !important;
}

.studio-model.active {
  color: #fff;
  border-color: rgba(85, 216, 194, 0.42);
  background: rgba(85, 216, 194, 0.1);
  box-shadow: 0 0 24px rgba(85, 216, 194, 0.08);
}

.studio-model.active::after {
  content: "";
  grid-column: 3;
  grid-row: 1;
  width: 16px;
  height: 16px;
  background: currentColor;
  opacity: 0.7;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.studio-model-list.open .studio-model.active .studio-model-badge {
  display: inline-flex;
}

.studio-model-list.open .studio-model.active::after {
  display: none;
}

.studio-model.unavailable,
.model-choice.unavailable {
  opacity: 0.46;
  color: rgba(255, 255, 255, 0.52);
  filter: grayscale(1);
}

.studio-model.unavailable {
  cursor: not-allowed;
}

.studio-model.unavailable .studio-model-meta {
  color: rgba(255, 180, 180, 0.74);
}

.studio-model-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
}

.studio-model-icon svg,
.studio-utility svg,
.studio-generate svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.studio-model-name {
  display: block;
  color: inherit;
  font-size: 13px;
  line-height: 1.2;
}

.studio-model-meta {
  display: none;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 12px;
  font-weight: 720;
  line-height: 1.2;
}

.studio-model-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  grid-column: 3;
  grid-row: 1;
  min-width: 46px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(85, 216, 194, 0.13);
  color: rgba(195, 255, 244, 0.92);
  font-size: 11px;
  font-weight: 860;
  white-space: nowrap;
}

.studio-model.active .studio-model-badge {
  display: none;
}

.studio-prompt-wrap {
  position: relative;
  display: grid;
  gap: 8px;
}

body.view-generate .studio-section-prompt,
body.view-generate .studio-prompt-wrap {
  overflow: visible !important;
}

body.view-generate .studio-section-prompt:has(#studioMentionMenu.open),
body.view-generate .studio-prompt-wrap:has(#studioMentionMenu.open) {
  z-index: 140 !important;
  overflow: visible !important;
}

.studio-prompt-expand {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 5;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.studio-prompt-expand:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.studio-prompt-expand svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.studio-prompt {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 128px;
  display: block;
  resize: none;
  outline: none;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025)),
    rgba(0, 0, 0, 0.2);
  color: #fff;
  padding: 16px 58px 16px 18px;
  font-size: 15px;
  line-height: 1.48;
  user-select: text;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.studio-prompt:empty::before {
  content: attr(data-placeholder);
  color: rgba(255, 255, 255, 0.38);
  pointer-events: none;
}

.typo-mark {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-style: solid;
  text-decoration-color: #ff4f4f;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.studio-inline-mention {
  display: inline-flex;
  position: relative;
  align-items: center;
  max-width: min(230px, 78%);
  height: 30px;
  margin: 0 4px;
  padding: 3px 10px 3px 4px;
  vertical-align: middle;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)),
    rgba(255, 255, 255, 0.085);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2), 0 0 18px rgba(255, 255, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.94);
  cursor: default;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.studio-inline-mention img,
.studio-inline-mention-media {
  width: 22px;
  height: 22px;
  margin-right: 7px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
  font-size: 10px;
  font-weight: 900;
}

.studio-inline-mention-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.has-results .studio-prompt {
  min-height: 78px;
  max-height: 138px;
}

.studio-prompt:focus {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(0, 0, 0, 0.34);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.055);
}

.studio-prompt::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.studio-mention-row {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}

.studio-mention-row:not(:empty) {
  display: none;
}

body.view-generate .studio-mention-row,
body.view-generate .studio-mention-row:not(:empty) {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.studio-mention-chip {
  position: relative;
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 4px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  font-size: 12px;
  font-weight: 820;
}

.studio-mention-chip img {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  object-fit: cover;
}

.studio-mention-chip button {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0;
}

.studio-mention-chip button:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.studio-mention-menu {
  position: absolute;
  left: var(--studio-mention-left, 12px);
  top: var(--studio-mention-top, 12px);
  z-index: 80;
  display: none;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(27, 29, 35, 0.96);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(12px);
  width: min(260px, calc(100% - 24px));
  max-height: var(--studio-mention-max-height, 260px);
  overflow: auto;
  scrollbar-width: none;
}

.studio-mention-menu.open {
  display: flex;
  flex-direction: column;
  animation: studio-mention-open 120ms cubic-bezier(0.16, 1, 0.3, 1);
}

.canvas-prompt-mention-menu {
  position: fixed;
  left: var(--canvas-mention-left, 12px);
  top: var(--canvas-mention-top, 12px);
  width: 168px;
  max-height: var(--canvas-mention-max-height, 220px);
  z-index: 120;
}

@keyframes studio-mention-open {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.studio-mention-menu::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.studio-mention-option {
  position: relative;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 14px;
  padding: 0 10px 0 6px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  font-size: 13px;
  font-weight: 820;
}

.studio-mention-option:hover {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
}

.studio-mention-option.selected {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.studio-mention-option img {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  object-fit: cover;
}

.studio-mention-option-media {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
  font-size: 10px;
  font-weight: 900;
}

.studio-inline-mention-media svg,
.studio-mention-option-media svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.studio-grid-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.studio-chip {
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  font-size: 13px;
  white-space: nowrap;
  padding: 0 10px;
}

.studio-chip.active {
  background: rgba(255, 255, 255, 0.92);
  color: #101010;
  border-color: transparent;
}

.studio-ref-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding-right: 226px;
}

.studio-section:has(#studioMode),
.studio-section:has(#studioModels),
.studio-section:has(#studioRatios),
.studio-section:has(#studioQualities) {
  display: inline-block;
  order: 3;
  vertical-align: top;
  margin-right: 4px;
}

.studio-upload {
  width: 56px;
  height: 56px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.24);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.035));
  color: rgba(255, 255, 255, 0.76);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.studio-upload:hover {
  transform: translateY(-1px);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.08);
}

.studio-upload svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.studio-ref-list {
  display: flex;
  gap: 8px;
  min-width: 0;
  min-height: 58px;
  align-items: center;
  overflow-x: auto;
  overflow-y: visible;
  padding: 2px 6px 8px 0;
  scrollbar-width: none;
  max-width: min(100%, 760px);
}

.studio-audio-list {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 8px;
  scrollbar-width: none;
  max-width: min(100%, 430px);
}

.studio-ref-list::-webkit-scrollbar,
.studio-audio-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.studio-ref {
  position: relative;
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: #111;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.studio-ref.mentioned {
  border-color: rgba(255, 255, 255, 0.62);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.12),
    0 14px 34px rgba(0, 0, 0, 0.3),
    0 0 22px rgba(255, 255, 255, 0.18);
}

.studio-ref:not(.mentioned).has-mentions {
  opacity: 1;
  filter: none;
}

.studio-audio-ref {
  position: relative;
  width: 172px;
  height: 56px;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 9px;
  padding: 8px 32px 8px 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.035)),
    rgba(17, 19, 23, 0.94);
  color: rgba(255, 255, 255, 0.88);
  font-size: 12px;
  font-weight: 820;
  overflow: hidden;
}

.studio-audio-ref video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.72;
  cursor: pointer;
  border-radius: inherit;
  background: #08090b;
}

.studio-audio-ref audio {
  position: absolute;
  left: 8px;
  right: 30px;
  bottom: 4px;
  z-index: 3;
  width: calc(100% - 42px);
  height: 24px;
  opacity: 0.92;
}

.studio-audio-ref.is-video {
  grid-template-columns: 42px 1fr;
}

.studio-audio-ref.is-video::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.2) 68%, rgba(0, 0, 0, 0.58));
  pointer-events: none;
}

.studio-audio-ref.is-audio {
  width: 230px;
  height: 70px;
  align-items: start;
  padding-bottom: 32px;
}

.studio-audio-ref.is-video .studio-audio-icon,
.studio-audio-ref.is-video .studio-audio-text,
.studio-audio-ref.is-audio .studio-audio-icon,
.studio-audio-ref.is-audio .studio-audio-text,
.studio-audio-ref button {
  position: relative;
  z-index: 2;
}

.studio-audio-ref.is-video .studio-audio-icon,
.studio-audio-ref.is-video .studio-audio-text {
  pointer-events: none;
}

.studio-audio-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 0.9);
}

.studio-audio-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.studio-audio-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-audio-meta {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.46);
  font-size: 11px;
  font-weight: 760;
}

.studio-ref:hover {
  z-index: 20;
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.32);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.34);
}

.studio-ref img,
.studio-ref video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
  background: #08090b;
}

.studio-ref-label {
  position: absolute;
  left: 4px;
  top: 4px;
  z-index: 2;
  height: 18px;
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  font-size: 11px;
  font-weight: 860;
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.studio-ref button {
  position: absolute;
  right: -8px;
  top: -8px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(9, 10, 12, 0.78);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  font-weight: 760;
  line-height: 1;
  padding: 0;
  z-index: 4;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(12px);
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.studio-ref button:hover {
  transform: scale(1.08);
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(34, 36, 40, 0.92);
}

.studio-audio-ref button {
  position: absolute;
  right: -8px;
  top: -8px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(9, 10, 12, 0.78);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  font-weight: 760;
  line-height: 1;
  padding: 0;
  z-index: 5;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(12px);
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.studio-audio-ref button:hover {
  transform: scale(1.08);
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(34, 36, 40, 0.92);
}

.studio-ref.model-limited,
.studio-audio-ref.model-limited {
  opacity: 1;
  filter: none;
}

.studio-ref.model-limited::after,
.studio-audio-ref.model-limited::after {
  content: none;
  display: none;
}

.studio-ref-preview {
  display: none !important;
}

.studio-hover-preview {
  position: fixed;
  left: var(--studio-hover-preview-left, 24px);
  top: var(--studio-hover-preview-top, 24px);
  z-index: 1000;
  width: max-content;
  max-width: min(420px, calc(100vw - 32px));
  max-height: min(420px, calc(100vh - 32px));
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(40, 42, 46, 0.82), rgba(12, 13, 15, 0.82));
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px) scale(0.96);
  transform-origin: 50% 50%;
  transition: opacity 120ms ease, transform 120ms ease;
  backdrop-filter: blur(16px) saturate(1.08);
  -webkit-backdrop-filter: blur(16px) saturate(1.08);
}

.studio-hover-preview.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.studio-hover-preview img,
.studio-hover-preview video {
  display: block;
  width: auto;
  height: auto;
  max-width: min(408px, calc(100vw - 44px));
  max-height: min(408px, calc(100vh - 44px));
  border-radius: 13px;
  object-fit: contain;
  background: transparent;
}

.studio-count-menu {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.studio-count-current {
  height: 42px;
  min-width: 78px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  font-size: 13px;
  font-weight: 820;
  padding: 0 9px 0 11px;
  white-space: nowrap;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.studio-count-current svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 140ms ease;
}

.studio-count-menu.open .studio-count-current,
.studio-count-current:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.studio-count-menu.open .studio-count-current svg {
  transform: rotate(180deg);
}

.studio-count-popover {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 28;
  display: none;
  min-width: 92px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 18px;
  background: rgba(24, 26, 31, 0.98);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
}

.studio-count-menu.open .studio-count-popover {
  display: grid;
  gap: 4px;
  animation: pop-open-centered 140ms cubic-bezier(0.16, 1, 0.3, 1);
}

.studio-count-option {
  height: 32px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  font-size: 13px;
  font-weight: 820;
  padding: 0 12px;
  text-align: left;
}

.studio-count-option:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.studio-count-option.active {
  background: rgba(245, 245, 245, 0.95);
  color: #101010;
}

.studio-generate-bar {
  position: absolute;
  right: 20px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 12;
}

.studio-generate-bar::before {
  content: "";
  position: absolute;
  inset: -6px;
  z-index: -1;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.78);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(14px);
}

.studio-generate-bar .studio-count-menu {
  order: 2;
}

.studio-generate-bar .studio-generate {
  order: 3;
}

.studio-reset-materials {
  order: 0;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 820;
  line-height: 1;
  white-space: nowrap;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.studio-reset-materials.is-hidden {
  display: none !important;
}

.studio-reset-materials svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.studio-reset-materials span {
  display: inline-flex;
  align-items: center;
}

.studio-reset-materials:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

.studio-generate-bar .studio-credits {
  display: none !important;
}

.studio-cost {
  order: 1;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 0 12px;
  border: 1px solid rgba(85, 216, 194, 0.22);
  border-radius: 999px;
  background: rgba(85, 216, 194, 0.08);
  color: rgba(202, 255, 246, 0.92);
  font-size: 12px;
  font-weight: 860;
  white-space: nowrap;
  cursor: default;
}

.studio-credits {
  order: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  font-weight: 600;
  cursor: default;
  white-space: nowrap;
}

.studio-credits-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.studio-credits-num {
  font-variant-numeric: tabular-nums;
}

.studio-generate {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(42, 44, 47, 0.72), rgba(12, 13, 15, 0.62));
  color: rgba(255, 255, 255, 0.86);
  font-size: 15px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 10px 24px rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
}

.studio-generate span {
  display: none;
}

.studio-generate:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.22);
}

.studio-utility-grid {
  grid-template-columns: 1fr 1fr;
}

.studio-utility {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  font-size: 13px;
}

.studio-utility:hover,
.studio-model:hover,
.studio-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
}

.studio-status {
  min-height: 18px;
  color: rgba(255, 255, 255, 0.56);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.4;
  padding-right: 226px;
}

.studio-status.error {
  color: #ffb2b2;
}

.app-rail {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 42;
  width: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 84px 7px 14px;
  background: rgba(13, 13, 14, 0.76);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
  transition: background 160ms ease, border-color 160ms ease;
  overflow: hidden;
  opacity: 1;
  box-sizing: border-box;
  backdrop-filter: blur(14px);
}

.app-rail:hover,
.app-rail.expanded {
  width: 54px;
  padding: 84px 7px 14px;
  background: rgba(16, 16, 17, 0.84);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: none;
  backdrop-filter: blur(14px);
}

.rail-toggle {
  display: none;
  position: fixed;
  left: 10px;
  top: 18px;
  z-index: 43;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(18, 18, 18, 0.86);
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
  transition: background 160ms ease, border-color 160ms ease, opacity 200ms ease;
  white-space: nowrap;
}

.rail-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.rail-toggle svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-rail:hover ~ .rail-toggle,
.app-rail.expanded ~ .rail-toggle {
  opacity: 0;
  pointer-events: none;
}

.rail-vertical-label {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding-top: 4px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0;
  transition: opacity 160ms ease;
}

.rail-vertical-label span {
  display: block;
}

.app-rail:hover .rail-vertical-label,
.app-rail.expanded .rail-vertical-label {
  opacity: 0;
  pointer-events: none;
}

.app-rail:hover .rail-item,
.app-rail.expanded .rail-item {
  opacity: 1;
}

.rail-item {
  opacity: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  width: 40px;
  min-height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity 160ms ease, background 120ms ease, color 120ms ease;
}

.rail-logo {
  display: none;
}

.rail-item svg {
  display: block;
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.rail-item img {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 7px;
  object-fit: cover;
  flex: 0 0 auto;
}

.rail-item span {
  display: block;
  font-size: 11px;
  opacity: 1;
  transition: opacity 160ms ease;
}

.app-rail:hover .rail-item span,
.app-rail.expanded .rail-item span {
  opacity: 1;
}

.app-rail:hover .rail-item,
.app-rail.expanded .rail-item {
  opacity: 1;
}

.rail-item:hover,
.rail-item.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.app-rail.expanded,
.app-rail:hover {
  background: rgba(17, 17, 17, 0.78);
  border-right-color: rgba(255, 255, 255, 0.11);
  backdrop-filter: blur(18px);
}

.rail-item {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 780;
  box-shadow: none;
  transition: background 120ms ease, border-color 120ms ease;
}

.app-rail:hover .rail-item,
.app-rail.expanded .rail-item {
  border: 1px solid transparent;
  background: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.rail-item:hover,
.rail-item.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.16);
}

.app-rail:hover .rail-item:hover,
.app-rail.expanded .rail-item:hover,
.app-rail:hover .rail-item.active,
.app-rail.expanded .rail-item.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.16);
}

#studioComposeSection {
  display: none !important;
}

.rail-key {
  margin-top: auto;
}

.rail-link {
  text-decoration: none;
}

.app-rail {
  left: 0;
  top: 0;
  bottom: 0;
  width: 54px;
  height: auto;
  min-height: 100vh;
  gap: 8px;
  padding: 84px 7px 14px;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0;
  background: rgba(13, 13, 14, 0.78);
  box-shadow: none;
  opacity: 1;
  pointer-events: auto;
  transform: none;
  transition:
    width 180ms cubic-bezier(0.16, 1, 0.3, 1),
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
  backdrop-filter: blur(18px);
}

.app-rail.expanded,
.app-rail:hover {
  width: 172px;
  padding: 84px 12px 14px;
  opacity: 1;
  pointer-events: auto;
  transform: none;
  background: rgba(18, 18, 19, 0.96);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 18px 0 46px rgba(0, 0, 0, 0.34);
}

.rail-toggle {
  display: none;
}

.rail-toggle::before {
  content: none;
}

.rail-toggle svg {
  display: block;
}

.rail-toggle:hover,
.app-rail.expanded ~ .rail-toggle {
  width: auto;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
  opacity: 1;
  pointer-events: auto;
}

.app-rail:hover ~ .rail-toggle,
.app-rail.expanded ~ .rail-toggle {
  opacity: 0;
  pointer-events: none;
}

.app-rail .rail-item {
  width: 40px;
  min-height: 40px;
  flex-direction: row;
  justify-content: center;
  gap: 10px;
  padding: 0;
  border-radius: 13px;
  overflow: hidden;
  transition:
    width 180ms cubic-bezier(0.16, 1, 0.3, 1),
    justify-content 180ms ease,
    padding 180ms ease,
    background 120ms ease,
    border-color 120ms ease;
}

.app-rail:hover .rail-item,
.app-rail.expanded .rail-item {
  width: 148px;
  justify-content: flex-start;
  padding: 0 12px;
}

.app-rail .rail-item span {
  font-size: 12px;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-width 160ms ease, opacity 120ms ease;
}

.app-rail:hover .rail-item span,
.app-rail.expanded .rail-item span {
  max-width: 90px;
  opacity: 1;
}

.side-rail-btn {
  display: none !important;
}

.app-rail {
  display: none !important;
}

.ai-chat-view {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: #000;
  color: #fff;
  overflow: hidden;
  perspective: 900px;
}

.ai-chat-view::before {
  content: "";
  position: absolute;
  inset: -20vmax;
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.18) 0 1px, transparent 1.8px) 0 0 / 54px 54px,
    radial-gradient(circle, rgba(255,255,255,0.98) 0 1.2px, transparent 2px) 0 0 / 74px 74px,
    radial-gradient(circle, rgba(255,255,255,0.74) 0 1px, transparent 1.8px) 24px 38px / 122px 122px,
    radial-gradient(circle, rgba(255,255,255,1) 0 1.8px, transparent 3px) 0 0 / 148px 148px;
  animation: entry-depth-mid 18s linear infinite;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.42));
  opacity: 0.18;
  transform: rotateX(58deg) translateZ(-160px) scale(1.45);
  pointer-events: none;
  transform-style: preserve-3d;
}

.ai-chat-view::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at center, transparent 0 18%, rgba(0,0,0,0.38) 54%, rgba(0,0,0,0.9) 100%),
    radial-gradient(circle at 28% 42%, rgba(255,255,255,0.14), transparent 15%),
    linear-gradient(90deg, rgba(255,255,255,0.05), transparent 16%, transparent 84%, rgba(255,255,255,0.05));
  pointer-events: none;
}

.ai-chat-header,
.ai-chat-messages,
.ai-chat-composer {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100vw - 36px));
  margin-left: auto;
  margin-right: auto;
}

.ai-chat-sidebar {
  position: fixed;
  left: 34px;
  top: 96px;
  bottom: 118px;
  z-index: 2;
  width: 260px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 30px;
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.055) 42%, rgba(255, 255, 255, 0.018) 100%),
    rgba(255, 255, 255, 0.06);
  box-shadow:
    0 20px 56px rgba(0, 0, 0, 0.34),
    inset 0 1px 1px rgba(255, 255, 255, 0.22),
    inset 0 -1px 1px rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(24px) saturate(1.65) brightness(1.12);
  backdrop-filter: blur(24px) saturate(1.65) brightness(1.12);
  color: rgba(255, 255, 255, 0.9);
}

.ai-chat-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 8px;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.ai-chat-sidebar-head button {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
}

.ai-chat-thread-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-chat-thread {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 14px 15px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.82);
  text-align: left;
  cursor: pointer;
}

.ai-chat-thread-main {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.ai-chat-thread-actions {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.ai-chat-thread-action {
  height: 24px;
  min-width: 44px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  font-weight: 760;
  line-height: 1;
  cursor: pointer;
}

.ai-chat-thread-action.danger {
  color: rgba(255, 196, 196, 0.88);
}

.ai-chat-thread-action:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
}

.ai-chat-view.chat-dragover .ai-chat-composer {
  border-color: rgba(255, 255, 255, 0.62);
  box-shadow:
    0 20px 56px rgba(0, 0, 0, 0.34),
    0 0 34px rgba(255, 255, 255, 0.24),
    inset 0 1px 1px rgba(255, 255, 255, 0.28),
    inset 0 -1px 1px rgba(255, 255, 255, 0.12);
}

.ai-chat-view.chat-dragover .ai-chat-messages::before {
  content: "松开上传素材";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  transform: translate(-50%, -50%);
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: rgba(255, 255, 255, 0.94);
  font-size: 14px;
  font-weight: 850;
  pointer-events: none;
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  backdrop-filter: blur(18px) saturate(1.35);
}

.ai-chat-thread.active {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.16), 0 12px 30px rgba(0, 0, 0, 0.2);
}

.ai-chat-thread strong {
  font-size: 14px;
  font-weight: 900;
}

.ai-chat-thread span {
  color: rgba(255, 255, 255, 0.54);
  font-size: 12px;
}

@media (min-width: 1180px) {
  .ai-chat-header,
  .ai-chat-messages,
  .ai-chat-composer {
    margin-left: calc(34px + 260px + 34px);
    margin-right: 34px;
  }
}

@media (max-width: 980px) {
  .ai-chat-sidebar {
    display: none;
  }
}

.ai-chat-header {
  display: grid;
  grid-template-columns: 96px minmax(210px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 24px 0 14px;
}

.ai-chat-back,
.ai-chat-model,
.ai-chat-composer button {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0.055) 42%, rgba(255, 255, 255, 0.018) 100%),
    rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.92);
  font-weight: 840;
  box-shadow:
    0 16px 42px rgba(0, 0, 0, 0.28),
    inset 0 1px 1px rgba(255, 255, 255, 0.22),
    inset 0 -1px 1px rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(24px) saturate(1.65) brightness(1.12);
  backdrop-filter: blur(24px) saturate(1.65) brightness(1.12);
}

.ai-chat-back {
  height: 38px;
  cursor: pointer;
}

.ai-chat-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.ai-chat-title strong {
  font-size: 32px;
  line-height: 0.98;
  font-weight: 950;
  letter-spacing: -0.06em;
  background: linear-gradient(180deg, #fff 0%, #f2f2f2 42%, #9a9a9a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 34px rgba(255,255,255,0.16), 0 16px 44px rgba(0,0,0,0.8);
}

.ai-chat-title span,
.ai-chat-empty {
  color: rgba(255, 255, 255, 0.58);
  font-size: 13px;
}

.ai-chat-model {
  display: grid;
  place-items: center;
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
  cursor: pointer;
  outline: 0;
  appearance: auto;
  -webkit-appearance: menulist;
  text-align: center;
}

.ai-chat-model option {
  background: #151515;
  color: #f6f6f6;
}

.ai-chat-messages {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding: 22px 0 132px;
  overflow: hidden auto;
  scrollbar-gutter: stable;
}

.ai-chat-empty {
  margin: auto;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
}

.ai-chat-message {
  max-width: min(72%, 680px);
  padding: 13px 16px;
  border-radius: 22px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.62;
  font-size: 15px;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.28), inset 0 1px 1px rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(18px) saturate(1.45);
  backdrop-filter: blur(18px) saturate(1.45);
}

.ai-chat-message-content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ai-chat-avatar {
  display: none;
}

.ai-chat-message.user {
  align-self: flex-end;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-bottom-right-radius: 8px;
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.16) 42%, rgba(255, 255, 255, 0.08) 100%),
    rgba(255, 255, 255, 0.88);
  color: #101010;
}

.ai-chat-message.assistant {
  align-self: flex-start;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-bottom-left-radius: 8px;
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.055) 42%, rgba(255, 255, 255, 0.018) 100%),
    rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.92);
}

.ai-chat-message.thinking {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 132px;
  color: rgba(248, 250, 252, 0.78);
}

.ai-chat-message.thinking .ai-chat-message-content {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.ai-chat-thinking-dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.ai-chat-thinking-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.8);
  animation: ai-chat-thinking 900ms ease-in-out infinite;
}

.ai-chat-thinking-dots span:nth-child(2) {
  animation-delay: 120ms;
}

.ai-chat-thinking-dots span:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes ai-chat-thinking {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.38; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.ai-chat-composer {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 72px 1fr 82px;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 28px;
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.055) 42%, rgba(255, 255, 255, 0.018) 100%),
    rgba(255, 255, 255, 0.065);
  box-shadow:
    0 20px 56px rgba(0, 0, 0, 0.34),
    0 0 26px rgba(255, 255, 255, 0.08),
    inset 0 1px 1px rgba(255, 255, 255, 0.24),
    inset 0 -1px 1px rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(24px) saturate(1.65) brightness(1.12);
  backdrop-filter: blur(24px) saturate(1.65) brightness(1.12);
}

.ai-chat-refs {
  grid-column: 1 / -1;
  display: none;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-chat-refs:not(:empty) {
  display: flex;
}

.ai-chat-ref {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 180px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 250, 252, 0.82);
  font-size: 12px;
}

.ai-chat-ref img {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  object-fit: cover;
}

.ai-chat-ref span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-chat-ref button {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}

.ai-chat-message-attachments,
.chat-message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chat-message-attachment {
  max-width: min(240px, 100%);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  overflow: hidden;
}

.chat-message-attachment img,
.chat-message-attachment video {
  width: 132px;
  max-width: 40vw;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.28);
}

.chat-message-attachment span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-ref::before,
.studio-inline-mention::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 999px;
  background:
    radial-gradient(circle at 43% 43%, transparent 0 7px, rgba(255, 255, 255, 0.96) 7.5px 9px, transparent 9.5px),
    linear-gradient(45deg, transparent 56%, rgba(255, 255, 255, 0.96) 57% 66%, transparent 67%),
    rgba(9, 10, 12, 0.72);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.86);
  transition: opacity 140ms ease, transform 140ms ease;
  backdrop-filter: blur(8px);
}

.studio-ref:hover::before,
.studio-inline-mention:hover::before {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.studio-inline-mention::before {
  left: 14px;
  width: 22px;
  height: 22px;
  border-color: rgba(255, 255, 255, 0.72);
  background:
    radial-gradient(circle at 43% 43%, transparent 0 5px, rgba(255, 255, 255, 0.96) 5.5px 7px, transparent 7.5px),
    linear-gradient(45deg, transparent 55%, rgba(255, 255, 255, 0.96) 56% 66%, transparent 67%),
    rgba(9, 10, 12, 0.72);
}

.prompt-typo-layer .studio-inline-mention::before {
  content: none !important;
  display: none !important;
}

body.view-generate .studio-ref::before,
body.view-generate .studio-inline-mention::before {
  content: none !important;
  display: none !important;
}
.ai-chat-composer textarea {
  min-height: 46px;
  max-height: 140px;
  resize: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  outline: 0;
  border-radius: 20px;
  padding: 13px 14px;
  background: rgba(0, 0, 0, 0.34);
  color: #fff;
  line-height: 1.45;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.08);
}

.ai-chat-composer textarea::placeholder {
  color: rgba(226, 232, 240, 0.5);
}

.ai-chat-upload,
.ai-chat-send {
  cursor: pointer;
  background: #f8fafc;
  color: #0f172a;
}

.ai-chat-upload:disabled,
.ai-chat-send:disabled,
.ai-chat-composer textarea:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

/* Full-screen chat: keep the original visual skin, only use a 云构-like layout. */
body.view-chat {
  overflow: hidden;
}

.ai-chat-view {
  display: grid !important;
  grid-template-columns: 294px minmax(0, 1fr);
  grid-template-rows: 76px minmax(0, 1fr) auto;
}

.ai-chat-sidebar {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  bottom: auto !important;
  grid-column: 1;
  grid-row: 1 / -1;
  width: auto !important;
  margin: 24px 0 24px 24px;
  max-height: none;
  overflow: hidden auto;
}

.ai-chat-header {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  z-index: 90;
  width: min(920px, calc(100% - 56px)) !important;
  margin: 0 auto !important;
  padding: 22px 0 10px !important;
  overflow: visible;
}

.ai-chat-messages {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  z-index: 1;
  width: 100% !important;
  margin: 0 !important;
  padding: 26px max(28px, calc((100% - 920px) / 2)) 24px !important;
  overflow: hidden auto !important;
  scrollbar-gutter: auto !important;
  user-select: text;
}

.ai-chat-messages::-webkit-scrollbar {
  width: 10px;
}

.ai-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  background-clip: content-box;
}

.ai-chat-model {
  min-width: 116px;
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.07) 48%, rgba(255, 255, 255, 0.02) 100%),
    rgba(22, 22, 22, 0.92) !important;
  color: rgba(255, 255, 255, 0.96) !important;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.72);
}

.ai-chat-model {
  grid-column: 4;
  grid-row: 1;
  justify-self: end;
  position: relative;
  z-index: 12;
  display: block;
  width: min(220px, 34vw) !important;
  height: 38px !important;
  min-width: 176px !important;
  padding: 0 34px 0 14px;
  overflow: hidden;
  opacity: 1;
  pointer-events: auto !important;
  text-align: left;
  appearance: auto !important;
  -webkit-appearance: menulist !important;
}

#entryChatModel {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-width: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
}

.ai-chat-model-menu {
  grid-column: 4;
  grid-row: 1;
  justify-self: end;
  position: relative;
  z-index: 120;
  display: inline-flex !important;
  width: min(222px, 34vw);
  min-width: 182px;
  pointer-events: auto !important;
}

.ai-chat-agent-controls {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  transform: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  z-index: 12;
}

.ai-chat-agent-select,
.ai-chat-agent-manage {
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05) 42%, rgba(255, 255, 255, 0.014) 100%),
    rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.88);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.ai-chat-agent-select {
  width: 150px;
  max-width: 18vw;
  padding: 0 8px;
}

.ai-chat-agent-manage {
  padding: 0 12px;
}

.ai-chat-model-trigger {
  width: 100%;
  height: 40px;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.052) 46%, rgba(255, 255, 255, 0.016) 100%),
    rgba(18, 18, 18, 0.88);
  color: rgba(255, 255, 255, 0.94);
  font-size: 13px;
  font-weight: 860;
  cursor: pointer;
  box-shadow:
    0 16px 42px rgba(0, 0, 0, 0.28),
    inset 0 1px 1px rgba(255, 255, 255, 0.22),
    inset 0 -1px 1px rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(24px) saturate(1.65) brightness(1.12);
  backdrop-filter: blur(24px) saturate(1.65) brightness(1.12);
  transform-origin: left center;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.ai-chat-model-menu.open .ai-chat-model-trigger,
.ai-chat-model-trigger:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background:
    radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.068) 46%, rgba(255, 255, 255, 0.02) 100%),
    rgba(24, 24, 24, 0.94);
}

.ai-chat-model-trigger:active,
.ai-chat-model-trigger.model-tap {
  transform: translateY(1px) scale(0.975);
}

.ai-chat-model-menu.open .ai-chat-model-trigger {
  transform: translateY(-1px);
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.36),
    0 0 0 3px rgba(255, 255, 255, 0.055),
    inset 0 1px 1px rgba(255, 255, 255, 0.24),
    inset 0 -1px 1px rgba(255, 255, 255, 0.08);
}

.ai-chat-model-trigger.model-picked {
  animation: ai-chat-model-picked 420ms ease;
}

.ai-chat-model-label {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.ai-chat-model-caret {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  opacity: 0.82;
  transition: transform 160ms ease;
}

.ai-chat-model-caret svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.studio-prompt-expand span {
  font-size: 12px;
  font-weight: 820;
  line-height: 1;
  white-space: nowrap;
}

.ai-chat-model-menu.open .ai-chat-model-caret {
  transform: rotate(180deg);
}

.ai-chat-model-trigger .yungou-mark {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 18px;
}

.ai-chat-model-trigger .yungou-mark svg {
  width: 18px;
  height: 18px;
}

.ai-chat-model-options {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 260;
  width: 100%;
  min-width: 222px;
  display: none;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background:
    radial-gradient(circle at 30% 0%, rgba(255, 255, 255, 0.12), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.026)),
    rgba(14, 14, 14, 0.96);
  box-shadow:
    0 22px 58px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  backdrop-filter: blur(18px) saturate(1.35);
  transform-origin: 18px 0;
}

.ai-chat-model-menu.open .ai-chat-model-options {
  display: grid;
  gap: 5px;
  animation: ai-chat-model-menu-pop 190ms cubic-bezier(0.2, 0.9, 0.24, 1.16) both;
}

.ai-chat-model-menu.open {
  z-index: 240;
}

.ai-chat-model-option {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  text-align: left;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.ai-chat-model-option:hover,
.ai-chat-model-option.active {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.ai-chat-model-option:active {
  transform: scale(0.985);
}

.ai-chat-model-option.option-press {
  transform: scale(0.972);
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.ai-chat-model-option.option-picked {
  animation: ai-chat-model-option-picked 220ms ease both;
}

.ai-chat-model-menu.open .ai-chat-model-option {
  animation: ai-chat-model-option-rise 180ms ease both;
}

.ai-chat-model-menu.open .ai-chat-model-option:nth-child(2) {
  animation-delay: 24ms;
}

.ai-chat-model-menu.open .ai-chat-model-option:nth-child(3) {
  animation-delay: 48ms;
}

.ai-chat-model-menu.open .ai-chat-model-option.option-picked {
  animation: ai-chat-model-option-picked 220ms ease both;
  animation-delay: 0ms;
}

@keyframes ai-chat-model-menu-pop {
  from {
    opacity: 0;
    transform: translateY(-7px) scale(0.965);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ai-chat-model-option-rise {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ai-chat-model-option-picked {
  0% {
    transform: scale(0.97);
    background: rgba(255, 255, 255, 0.18);
  }
  58% {
    transform: scale(1.025);
    background: rgba(255, 255, 255, 0.2);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes ai-chat-model-picked {
  0% {
    transform: scale(1);
    box-shadow:
      0 16px 42px rgba(0, 0, 0, 0.28),
      inset 0 1px 1px rgba(255, 255, 255, 0.22),
      inset 0 -1px 1px rgba(255, 255, 255, 0.08);
  }
  38% {
    transform: scale(1.035);
    box-shadow:
      0 18px 48px rgba(0, 0, 0, 0.38),
      0 0 0 4px rgba(255, 255, 255, 0.08),
      inset 0 1px 1px rgba(255, 255, 255, 0.28),
      inset 0 -1px 1px rgba(255, 255, 255, 0.1);
  }
  100% {
    transform: scale(1);
    box-shadow:
      0 16px 42px rgba(0, 0, 0, 0.28),
      inset 0 1px 1px rgba(255, 255, 255, 0.22),
      inset 0 -1px 1px rgba(255, 255, 255, 0.08);
  }
}

.ai-chat-model-option span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-chat-model-option .yungou-mark {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 18px;
}

.ai-chat-model-option .yungou-mark svg {
  width: 18px;
  height: 18px;
}

.ai-chat-model:focus {
  border-color: rgba(255, 255, 255, 0.42);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.08),
    0 16px 42px rgba(0, 0, 0, 0.28),
    inset 0 1px 1px rgba(255, 255, 255, 0.22),
    inset 0 -1px 1px rgba(255, 255, 255, 0.08);
}

.ai-chat-message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
}

.ai-chat-message.user {
  max-width: min(58%, 560px);
  padding: 13px 17px;
  border-radius: 22px 22px 7px 22px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background:
    radial-gradient(circle at 80% 0%, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.13) 44%, rgba(255, 255, 255, 0.055) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.07)),
    rgba(38, 38, 38, 0.82);
  color: rgba(255, 255, 255, 0.94);
  box-shadow:
    0 16px 42px rgba(0, 0, 0, 0.32),
    inset 0 1px 1px rgba(255, 255, 255, 0.18),
    inset 0 -1px 1px rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  backdrop-filter: blur(18px) saturate(1.35);
}

.ai-chat-message.assistant {
  max-width: min(76%, 760px);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.ai-chat-message.assistant .ai-chat-message-content {
  padding: 13px 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px 22px 22px 8px;
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05) 44%, rgba(255, 255, 255, 0.016) 100%),
    rgba(28, 28, 28, 0.76);
  box-shadow:
    0 16px 42px rgba(0, 0, 0, 0.3),
    inset 0 1px 1px rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(18px) saturate(1.45);
  backdrop-filter: blur(18px) saturate(1.45);
}

.ai-chat-message-content {
  user-select: text;
}

.ai-chat-copy-button {
  position: absolute;
  right: 6px;
  bottom: -34px;
  z-index: 4;
  width: 28px;
  height: 28px;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.ai-chat-message.user .ai-chat-copy-button {
  right: 6px;
  bottom: -34px;
  transform: none;
}

.ai-chat-message.assistant .ai-chat-copy-button {
  right: 6px;
  bottom: -34px;
  transform: none;
}

.ai-chat-message:hover .ai-chat-copy-button,
.ai-chat-message:focus-within .ai-chat-copy-button,
.ai-chat-copy-button.copied {
  opacity: 1;
  pointer-events: auto;
}

.ai-chat-message-actions {
  position: absolute;
  right: 6px;
  bottom: -34px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-chat-message-actions .ai-chat-copy-button {
  position: static;
  right: auto;
  bottom: auto;
  transform: none;
}

.ai-chat-action-button {
  width: auto;
  min-width: 44px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.ai-chat-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.035)),
    rgba(16, 16, 18, 0.92);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.ai-chat-avatar .yungou-mark {
  width: 22px;
  height: 22px;
  display: block;
  color: rgba(255, 255, 255, 0.95);
}

.ai-chat-avatar .yungou-mark svg {
  width: 100%;
  height: 100%;
}

.ai-chat-composer {
  position: relative !important;
  left: auto !important;
  bottom: auto !important;
  transform: none !important;
  grid-column: 2;
  grid-row: 3;
  width: min(920px, calc(100% - 56px)) !important;
  margin: 0 auto 24px !important;
  grid-template-columns: auto minmax(0, 1fr) auto auto !important;
  align-items: center;
  gap: 10px !important;
  padding: 18px 18px 16px !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  border-radius: 28px !important;
  background:
    radial-gradient(circle at 22% 0%, rgba(255, 255, 255, 0.13), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.03)),
    rgba(31, 31, 31, 0.96) !important;
  box-shadow:
    0 24px 62px rgba(0, 0, 0, 0.46),
    inset 0 1px 1px rgba(255, 255, 255, 0.16),
    inset 0 -1px 1px rgba(255, 255, 255, 0.08) !important;
}

.ai-chat-refs {
  grid-column: 1 / -1;
  order: 0;
}

.ai-chat-queue {
  grid-column: 1 / -1;
  order: -1;
}

.ai-chat-composer textarea {
  grid-column: 1 / -1;
  order: 1;
  width: 100%;
  min-height: 50px;
  max-height: 128px;
  border-radius: 0;
  padding: 0 0 6px;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  -webkit-appearance: none;
  appearance: none;
}

.ai-chat-upload,
.ai-chat-voice,
.ai-chat-send {
  order: 2;
}

.ai-chat-upload {
  grid-column: 1;
  width: auto;
  min-width: 82px;
  height: 46px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 850;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.14), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.028)),
    rgba(12, 13, 16, 0.78) !important;
  color: rgba(255, 255, 255, 0.88) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.11),
    0 10px 24px rgba(0, 0, 0, 0.28) !important;
}

.ai-chat-upload::before {
  content: "+";
  font-size: 21px;
  line-height: 1;
  font-weight: 520;
}

.ai-chat-voice {
  width: 46px;
  min-width: 46px;
  height: 46px;
  padding: 0;
  font-size: 0;
  display: grid;
  place-items: center;
  grid-column: 3;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.14), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.028)),
    rgba(12, 13, 16, 0.78) !important;
  color: rgba(255, 255, 255, 0.88) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.11),
    0 10px 24px rgba(0, 0, 0, 0.28) !important;
}

.ai-chat-voice svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ai-chat-send {
  grid-column: 4;
  width: 46px;
  min-width: 46px;
  height: 46px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 0;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  background: rgba(244, 244, 244, 0.92) !important;
  color: #101010 !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 10px 24px rgba(0, 0, 0, 0.28) !important;
}

.ai-chat-send::before {
  content: none;
}

.ai-chat-upload:hover,
.ai-chat-voice:hover,
.ai-chat-send:hover {
  transform: translateY(-1px);
}

.ai-chat-send:hover {
  background: #fff !important;
  border-color: rgba(255, 255, 255, 0.55) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 12px 28px rgba(0, 0, 0, 0.34) !important;
}

.ai-chat-send svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2.35;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ai-chat-send.is-stopping svg,
.chat-send.is-stopping svg {
  display: none;
}

.ai-chat-send.is-stopping::after,
.chat-send.is-stopping::after {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: currentColor;
}

.ai-chat-swarm-toggle {
  order: 2;
  grid-column: 2;
  justify-self: start;
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 820;
  cursor: pointer;
  user-select: none;
}

.ai-chat-swarm-toggle-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.055);
}

.ai-chat-swarm-toggle.active {
  border-color: rgba(116, 232, 255, 0.28);
  background: rgba(116, 232, 255, 0.10);
  color: rgba(224, 252, 255, 0.96);
}

.ai-chat-swarm-toggle.active .ai-chat-swarm-toggle-dot {
  background: #8ff3ff;
  box-shadow: 0 0 0 4px rgba(116, 232, 255, 0.13), 0 0 18px rgba(116, 232, 255, 0.36);
}

.ai-chat-swarm-toggle:not(.active) {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 255, 255, 0.56);
}

.ai-chat-swarm-traces {
  width: min(100%, 720px);
  display: grid;
  gap: 7px;
  margin-top: 10px;
  padding: 9px;
  border: 1px solid rgba(116, 232, 255, 0.16);
  border-radius: 16px;
  background: rgba(4, 12, 18, 0.42);
}

.ai-chat-swarm-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: rgba(224, 252, 255, 0.92);
  font-size: 11px;
  font-weight: 860;
}

.ai-chat-swarm-title span:last-child {
  color: rgba(255, 255, 255, 0.48);
}

.ai-chat-swarm-trace {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 8px 9px;
  background: rgba(255, 255, 255, 0.035);
}

.ai-chat-swarm-trace summary {
  display: block;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  font-weight: 850;
  list-style-position: inside;
  white-space: normal;
  overflow-wrap: anywhere;
}

.ai-chat-swarm-trace summary small {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  font-weight: 620;
  line-height: 1.45;
}

.ai-chat-swarm-trace p,
.ai-chat-swarm-trace pre {
  margin: 7px 0 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
  line-height: 1.62;
  white-space: pre-wrap;
}

.ai-chat-swarm-trace pre {
  max-height: 180px;
  overflow: auto;
}

.ai-chat-swarm-findings {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.ai-chat-swarm-findings span {
  border: 1px solid rgba(116, 232, 255, 0.16);
  border-radius: 999px;
  padding: 2px 7px;
  background: rgba(116, 232, 255, 0.07);
  color: rgba(224, 252, 255, 0.86);
  font-size: 10px;
  line-height: 1.55;
}

.ai-chat-swarm-panel {
  position: fixed;
  top: 86px;
  right: 18px;
  bottom: 116px;
  z-index: 4;
  width: min(360px, calc(100vw - 36px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(116, 232, 255, 0.18);
  border-radius: 22px;
  background:
    radial-gradient(circle at 18% 0%, rgba(116, 232, 255, 0.13), transparent 38%),
    linear-gradient(180deg, rgba(26, 31, 34, 0.94), rgba(10, 11, 12, 0.94));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(18px) saturate(1.24);
  backdrop-filter: blur(18px) saturate(1.24);
  opacity: 0;
  transform: translateX(24px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.ai-chat-view.swarm-panel-open .ai-chat-swarm-panel {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.ai-chat-swarm-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ai-chat-swarm-panel-head span {
  display: block;
  color: rgba(116, 232, 255, 0.76);
  font-size: 11px;
  font-weight: 840;
  line-height: 1.3;
}

.ai-chat-swarm-panel-head strong {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.94);
  font-size: 18px;
  font-weight: 880;
  letter-spacing: 0;
}

.ai-chat-swarm-panel-head button {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
}

.ai-chat-swarm-panel-status {
  padding: 10px 11px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.ai-chat-swarm-panel-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: hidden auto;
  padding-right: 2px;
  scrollbar-gutter: stable;
}

.ai-chat-swarm-step {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 9px;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.ai-chat-swarm-step-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.045);
}

.ai-chat-swarm-step.running .ai-chat-swarm-step-dot {
  background: #8ff3ff;
  box-shadow: 0 0 0 5px rgba(116, 232, 255, 0.13), 0 0 16px rgba(116, 232, 255, 0.32);
  animation: swarm-step-pulse 980ms ease-in-out infinite;
}

.ai-chat-swarm-step.completed .ai-chat-swarm-step-dot {
  background: #86efac;
  box-shadow: 0 0 0 5px rgba(134, 239, 172, 0.12);
}

.ai-chat-swarm-step.failed .ai-chat-swarm-step-dot {
  background: #fb7185;
  box-shadow: 0 0 0 5px rgba(251, 113, 133, 0.12);
}

.ai-chat-swarm-step-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 860;
  line-height: 1.35;
}

.ai-chat-swarm-step-title small {
  color: rgba(255, 255, 255, 0.46);
  font-size: 10px;
  font-weight: 760;
  text-transform: uppercase;
}

.ai-chat-swarm-step-role,
.ai-chat-swarm-step-summary {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.ai-chat-swarm-step-summary {
  color: rgba(255, 255, 255, 0.72);
}

@keyframes swarm-step-pulse {
  0%, 100% { transform: scale(1); opacity: 0.78; }
  50% { transform: scale(1.18); opacity: 1; }
}

.chat-agent-modal {
  position: relative;
  z-index: 2;
  display: none;
  min-width: 0;
  min-height: 0;
  color: rgba(255, 255, 255, 0.9);
  overflow: hidden;
}

.chat-agent-modal.visible {
  display: grid;
}

.chat-agent-card {
  width: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(190px, 260px) minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 16px 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.chat-agent-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-agent-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 860;
  letter-spacing: 0;
}

.chat-agent-head button,
.chat-agent-actions button {
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.14), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.028)),
    rgba(12, 13, 16, 0.78);
  color: rgba(255, 255, 255, 0.88);
  font-weight: 820;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 10px 24px rgba(0, 0, 0, 0.28);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.chat-agent-head button {
  width: auto;
  min-width: 86px;
  padding: 0 14px;
  font-size: 13px;
  line-height: 1;
}

.chat-agent-head button:hover,
.chat-agent-actions button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.24);
  color: #fff;
}

.chat-agent-head button:focus-visible,
.chat-agent-actions button:focus-visible,
.chat-agent-list button:focus-visible,
.chat-agent-field input:focus,
.chat-agent-field textarea:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.075),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.chat-agent-list {
  grid-column: 1;
  grid-row: 2 / 5;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 8px;
  min-height: 0;
  max-height: none;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden auto;
}

.chat-agent-list button {
  height: 34px;
  width: 100%;
  max-width: none;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018)),
    rgba(18, 18, 20, 0.72);
  color: rgba(255, 255, 255, 0.78);
  font-weight: 760;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.chat-agent-list button.active {
  border-color: rgba(255, 255, 255, 0.22);
  background:
    radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.052) 46%, rgba(255, 255, 255, 0.016) 100%),
    rgba(28, 28, 30, 0.9);
  color: #fff;
}

.chat-agent-field {
  grid-column: 2;
  display: grid;
  gap: 8px;
  font-size: 12px;
  font-weight: 820;
  color: rgba(255, 255, 255, 0.72);
}

.chat-agent-field input,
.chat-agent-field textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.016)),
    rgba(8, 9, 11, 0.62);
  color: rgba(255, 255, 255, 0.92);
  padding: 12px 13px;
  outline: none;
  font: inherit;
  font-weight: 600;
  resize: vertical;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.045);
}

.chat-agent-field textarea {
  min-height: 176px;
  line-height: 1.55;
}

.chat-agent-card .chat-agent-field textarea {
  min-height: 280px;
  height: min(46vh, 520px);
}

.chat-agent-actions {
  grid-column: 2;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.chat-agent-actions button {
  padding: 0 15px;
}

.chat-agent-actions button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}

.canvas-chat-drawer.agent-page-open .chat-drawer-head,
.canvas-chat-drawer.agent-page-open .chat-thread,
.canvas-chat-drawer.agent-page-open .chat-composer {
  display: none !important;
}

.canvas-chat-drawer.agent-page-open .chat-agent-modal {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px;
  box-sizing: border-box;
  overflow: hidden auto;
}

.canvas-chat-drawer.agent-page-open .chat-agent-card {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto auto;
  gap: 14px;
  min-height: 0;
}

.canvas-chat-drawer.agent-page-open .chat-agent-list,
.canvas-chat-drawer.agent-page-open .chat-agent-field,
.canvas-chat-drawer.agent-page-open .chat-agent-actions {
  grid-column: 1;
}

.canvas-chat-drawer.agent-page-open .chat-agent-list {
  grid-row: auto;
  max-height: 170px;
}

.canvas-chat-drawer.agent-page-open .chat-agent-card .chat-agent-field textarea {
  min-height: 190px;
  height: min(34vh, 320px);
}

body.view-chat .ai-chat-agent-controls {
  display: inline-flex !important;
}

body.view-chat .ai-chat-view.agent-page-open .ai-chat-messages,
body.view-chat .ai-chat-view.agent-page-open .ai-chat-composer {
  display: none !important;
}

#entryHomeButton,
.app-rail .rail-item[data-href="/?entry=1"] {
  display: none !important;
}

#historyOpenButton {
  display: none !important;
}

body.view-generate #historyOpenButton,
body.view-canvas #historyOpenButton {
  display: inline-flex !important;
}

body.view-chat [data-assets-panel] {
  display: none !important;
}

body.view-chat #historyButton {
  display: none !important;
}

body.view-chat .ai-chat-view {
  grid-template-columns: 392px minmax(0, 1fr) !important;
  grid-template-rows: 80px minmax(0, 1fr) auto !important;
  background: #000;
}

body.view-chat .ai-chat-view::before {
  opacity: 0.07;
}

body.view-chat .ai-chat-view::after {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.94) 0 18%, transparent 34%),
    radial-gradient(circle at center, transparent 0 24%, rgba(0,0,0,0.62) 72%, rgba(0,0,0,0.94) 100%);
}

body.view-chat .ai-chat-sidebar {
  grid-column: 1 !important;
  grid-row: 1 / -1 !important;
  margin: 0 !important;
  width: 392px !important;
  border-radius: 0 !important;
  border-width: 0 1px 0 0 !important;
  padding: 24px 22px 24px !important;
  background: rgba(5, 5, 5, 0.95) !important;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.065) !important;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

body.view-chat .ai-chat-sidebar-head {
  padding: 0 2px 22px !important;
  align-items: center;
  font-size: 0;
}

body.view-chat .ai-chat-sidebar-head > span {
  font-size: 26px;
  font-weight: 880;
  letter-spacing: 0;
}

body.view-chat .ai-chat-sidebar-head > span::before {
  content: "智能助手";
}

body.view-chat .ai-chat-sidebar-head > span {
  color: transparent;
}

body.view-chat .ai-chat-sidebar-head > span::before {
  color: rgba(255, 255, 255, 0.94);
}

body.view-chat .ai-chat-sidebar-head button {
  width: 38px !important;
  min-width: 38px !important;
  height: 38px !important;
  padding: 0 !important;
  font-size: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.view-chat .ai-chat-sidebar-head button::before {
  content: "+";
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 26px;
  font-weight: 420;
  line-height: 1;
}

body.view-chat .ai-chat-sidebar-head button:hover::before {
  background: rgba(255, 255, 255, 0.09);
}

body.view-chat .ai-chat-thread-list {
  gap: 4px !important;
  padding-right: 10px;
  overflow: hidden auto;
}

body.view-chat .ai-chat-thread {
  min-height: 44px;
  gap: 2px !important;
  padding: 9px 12px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.view-chat .ai-chat-thread:hover,
body.view-chat .ai-chat-thread.active {
  background: rgba(255, 255, 255, 0.12) !important;
  transform: none !important;
}

body.view-chat .ai-chat-thread strong {
  font-size: 15px;
  font-weight: 680;
  line-height: 1.35;
}

body.view-chat .ai-chat-thread span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.48);
}

body.view-chat .ai-chat-thread-main {
  gap: 2px;
}

body.view-chat .ai-chat-thread-actions {
  justify-content: flex-start;
  gap: 5px;
  margin-top: 5px;
}

body.view-chat .ai-chat-thread-action {
  height: 23px;
  min-width: 42px;
  padding: 0 7px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.055);
}

body.view-chat .ai-chat-header {
  grid-column: 2 !important;
  grid-template-columns: minmax(0, 1fr) auto auto !important;
  width: min(1220px, calc(100% - 96px)) !important;
  padding: 24px 0 10px !important;
}

body.view-chat .ai-chat-back {
  display: none !important;
}

body.view-chat .ai-chat-title {
  min-width: 0;
}

body.view-chat .ai-chat-title strong {
  font-size: 0;
}

body.view-chat .ai-chat-title strong::before {
  content: "智能助手";
  font-size: 20px;
  font-weight: 760;
  color: rgba(255, 255, 255, 0.92);
}

body.view-chat .ai-chat-title span {
  display: none;
}

body.view-chat .ai-chat-agent-controls {
  grid-column: 2 !important;
}

body.view-chat .ai-chat-model-menu {
  grid-column: 3 !important;
}

body.view-chat .ai-chat-messages {
  grid-column: 2 !important;
  width: min(1220px, calc(100% - 96px)) !important;
  justify-self: center;
  padding: 24px 0 26px !important;
}

body.view-chat .ai-chat-composer {
  grid-column: 2 !important;
  width: min(1160px, calc(100% - 128px)) !important;
  margin: 0 auto 28px !important;
  grid-template-columns: 52px minmax(0, 1fr) 52px 52px !important;
  padding: 12px !important;
  border-radius: 28px !important;
  background: rgba(32, 32, 32, 0.96) !important;
}

body.view-chat .ai-chat-composer textarea {
  grid-column: 2 !important;
  order: 2 !important;
  align-self: center;
  min-height: 52px !important;
  max-height: 132px;
  padding: 14px 6px 12px !important;
}

body.view-chat .ai-chat-refs,
body.view-chat .ai-chat-queue {
  grid-column: 1 / -1 !important;
}

body.view-chat .ai-chat-upload {
  grid-column: 1 !important;
  width: 52px !important;
  min-width: 52px !important;
  padding: 0 !important;
  font-size: 0 !important;
}

body.view-chat .ai-chat-voice {
  grid-column: 3 !important;
}

body.view-chat .ai-chat-send {
  grid-column: 4 !important;
}

body.view-chat .ai-chat-sidebar {
  border-color: rgba(255, 255, 255, 0.105) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018)),
    rgba(13, 13, 14, 0.86) !important;
  box-shadow:
    18px 0 46px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.07) !important;
  -webkit-backdrop-filter: blur(20px) saturate(1.28);
  backdrop-filter: blur(20px) saturate(1.28);
}

body.view-chat .ai-chat-sidebar-head button,
body.view-chat .ai-chat-thread {
  border-color: rgba(255, 255, 255, 0.1) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.018)),
    rgba(20, 20, 22, 0.74) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055) !important;
}

body.view-chat .ai-chat-thread.active {
  border-color: rgba(255, 255, 255, 0.2) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.032)),
    rgba(26, 26, 28, 0.9) !important;
}

body.view-chat .ai-chat-thread {
  position: relative;
  overflow: hidden;
  transform-origin: 50% 0;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

body.view-chat .ai-chat-thread:hover {
  transform: translateY(-1px);
}

body.view-chat .ai-chat-thread.thread-enter {
  animation: ai-chat-thread-enter 460ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

body.view-chat .ai-chat-thread.thread-activate {
  animation: ai-chat-thread-activate 320ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

body.view-chat .ai-chat-thread.thread-enter::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.22) 42%, transparent 72%);
  transform: translateX(-120%);
  animation: ai-chat-thread-sheen 680ms ease-out both;
}

body.view-chat .ai-chat-messages.session-enter {
  animation: ai-chat-session-enter 360ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

body.view-chat .ai-chat-empty {
  transform-origin: 50% 50%;
}

body.view-chat .ai-chat-messages.session-enter .ai-chat-empty {
  animation: ai-chat-empty-pop 440ms cubic-bezier(0.16, 1, 0.3, 1) 70ms both;
}

body.view-chat .ai-chat-sidebar-head button.is-adding {
  animation: ai-chat-add-pop 360ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes ai-chat-thread-enter {
  from {
    opacity: 0;
    transform: translateY(-18px) scale(0.96);
    filter: blur(8px);
  }
  62% {
    opacity: 1;
    transform: translateY(3px) scale(1.01);
    filter: blur(0);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes ai-chat-thread-activate {
  from {
    transform: scale(0.985);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055), 0 0 0 rgba(255, 255, 255, 0);
  }
  58% {
    transform: scale(1.012);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.11), 0 0 26px rgba(255, 255, 255, 0.08);
  }
  to {
    transform: scale(1);
  }
}

@keyframes ai-chat-thread-sheen {
  to {
    transform: translateX(120%);
  }
}

@keyframes ai-chat-session-enter {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.992);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes ai-chat-empty-pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.94);
  }
  70% {
    opacity: 1;
    transform: translateY(0) scale(1.035);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ai-chat-add-pop {
  from {
    transform: scale(1);
  }
  42% {
    transform: scale(0.88) rotate(-8deg);
  }
  78% {
    transform: scale(1.12) rotate(6deg);
  }
  to {
    transform: scale(1) rotate(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.view-chat .ai-chat-thread.thread-enter,
  body.view-chat .ai-chat-thread.thread-activate,
  body.view-chat .ai-chat-thread.thread-enter::after,
  body.view-chat .ai-chat-messages.session-enter,
  body.view-chat .ai-chat-messages.session-enter .ai-chat-empty,
  body.view-chat .ai-chat-sidebar-head button.is-adding {
    animation: none !important;
  }
}

body.view-chat .ai-chat-messages {
  grid-column: 2 / -1;
  justify-self: stretch;
  box-sizing: border-box;
  padding: 26px max(34px, calc((100% - 920px) / 2)) 24px !important;
  scrollbar-gutter: stable !important;
  scrollbar-color: rgba(255, 255, 255, 0.26) transparent;
}

body.view-chat .ai-chat-composer {
  gap: 12px !important;
  padding: 16px 16px 14px !important;
  border-color: rgba(255, 255, 255, 0.13) !important;
  border-radius: 30px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.072), rgba(255, 255, 255, 0.022)),
    rgba(18, 18, 19, 0.88) !important;
  box-shadow:
    0 22px 58px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04) !important;
  -webkit-backdrop-filter: blur(22px) saturate(1.24);
  backdrop-filter: blur(22px) saturate(1.24);
}

body.view-chat .ai-chat-composer textarea {
  min-height: 54px;
  max-height: 132px;
  padding: 1px 2px 8px;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: rgba(255, 255, 255, 0.9);
}

body.view-chat .ai-chat-upload,
body.view-chat .ai-chat-voice,
body.view-chat .ai-chat-send {
  min-width: 52px;
  height: 52px;
  border-radius: 999px;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

body.view-chat .ai-chat-upload {
  width: auto;
  min-width: 90px;
  padding: 0 16px;
}

body.view-chat .ai-chat-voice,
body.view-chat .ai-chat-send {
  width: 52px;
}

body.view-chat .ai-chat-upload,
body.view-chat .ai-chat-voice {
  border-color: rgba(255, 255, 255, 0.13) !important;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.16), transparent 46%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.02)),
    rgba(12, 13, 15, 0.86) !important;
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.11),
    inset 0 -1px 0 rgba(255, 255, 255, 0.035) !important;
}

body.view-chat .ai-chat-upload::before {
  font-size: 22px;
  transform: translateY(-1px);
}

body.view-chat .ai-chat-voice {
  grid-column: 3;
  justify-self: end;
}

body.view-chat .ai-chat-voice svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.15;
}

body.view-chat .ai-chat-send {
  grid-column: 4;
  justify-self: end;
  border-color: rgba(255, 255, 255, 0.22) !important;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.78) 48%, rgba(221, 221, 221, 0.72) 100%) !important;
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    inset 0 -2px 4px rgba(0, 0, 0, 0.12) !important;
}

body.view-chat .ai-chat-send svg {
  width: 23px;
  height: 23px;
  stroke-width: 2.45;
}

body.view-chat .ai-chat-upload:hover,
body.view-chat .ai-chat-voice:hover,
body.view-chat .ai-chat-send:hover {
  transform: translateY(-2px);
}

body.view-chat .app-toast {
  display: none !important;
}

/* Final chat-page layout pass: remove global entry chrome and match a 智能助手-like shell. */
body.view-chat .ai-chat-view {
  grid-template-columns: 392px minmax(0, 1fr) !important;
  grid-template-rows: 80px minmax(0, 1fr) auto !important;
  background: #000 !important;
}

body.view-chat .ai-chat-view::before {
  opacity: 0.055 !important;
}

body.view-chat .ai-chat-view::after {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.98) 0 18%, transparent 34%),
    radial-gradient(circle at center, transparent 0 24%, rgba(0,0,0,0.58) 72%, rgba(0,0,0,0.94) 100%) !important;
}

body.view-chat .ai-chat-sidebar {
  grid-column: 1 !important;
  grid-row: 1 / -1 !important;
  width: 392px !important;
  margin: 0 !important;
  padding: 24px 22px !important;
  border-width: 0 1px 0 0 !important;
  border-radius: 0 !important;
  border-color: rgba(255, 255, 255, 0.09) !important;
  background: rgba(5, 5, 5, 0.97) !important;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.055) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

body.view-chat .ai-chat-sidebar-head {
  padding: 0 2px 22px !important;
  align-items: center;
  font-size: 0 !important;
  gap: 10px !important;
}

body.view-chat .ai-chat-sidebar-head > span,
body.view-chat .ai-chat-title,
body.view-chat .ai-chat-header {
  display: none !important;
}

body.view-chat .ai-chat-sidebar-head #entryChatModelMenu {
  display: inline-flex !important;
  position: relative !important;
  width: min(286px, calc(100% - 54px)) !important;
  min-width: 0 !important;
  z-index: 250 !important;
  margin-right: auto;
}

body.view-chat .ai-chat-sidebar-head .ai-chat-model-trigger {
  height: 42px !important;
  padding: 0 8px 0 0 !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  font-size: 24px !important;
  font-weight: 850 !important;
}

body.view-chat .ai-chat-sidebar-head .ai-chat-model-label {
  color: rgba(255, 255, 255, 0.94);
}

body.view-chat .ai-chat-sidebar-head .ai-chat-model-trigger:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}

body.view-chat .ai-chat-sidebar-head .ai-chat-model-trigger.model-tap {
  background: rgba(255, 255, 255, 0.13) !important;
  transform: translateY(1px) scale(0.975) !important;
}

body.view-chat .ai-chat-sidebar-head .ai-chat-model-trigger.model-picked {
  animation: ai-chat-sidebar-model-picked 420ms ease !important;
}

body.view-chat .ai-chat-sidebar-head .ai-chat-model-options {
  left: 0 !important;
  right: auto !important;
  width: 268px !important;
  min-width: 268px !important;
  top: calc(100% + 8px) !important;
}

@keyframes ai-chat-sidebar-model-picked {
  0% {
    background: transparent;
    transform: scale(1);
  }
  36% {
    background: rgba(255, 255, 255, 0.16);
    transform: scale(1.045);
  }
  100% {
    background: transparent;
    transform: scale(1);
  }
}

body.view-chat .ai-chat-model-trigger .yungou-mark,
body.view-chat .ai-chat-model-option .yungou-mark {
  width: 22px !important;
  height: 22px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.view-chat .ai-chat-model-trigger .yungou-mark svg,
body.view-chat .ai-chat-model-option .yungou-mark svg,
body.view-chat .ai-chat-model-trigger .yungou-mark img,
body.view-chat .ai-chat-model-option .yungou-mark img {
  width: 22px !important;
  height: 22px !important;
}

body.view-chat .ai-chat-sidebar-head button {
  width: 38px !important;
  min-width: 38px !important;
  height: 38px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 0 !important;
}

body.view-chat .ai-chat-agent-controls {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  grid-column: auto !important;
  width: 100%;
  margin: -8px 0 14px;
  z-index: 3;
}

body.view-chat .ai-chat-agent-select {
  width: 100% !important;
  max-width: none !important;
  height: 38px !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

body.view-chat .ai-chat-agent-manage {
  padding: 0 12px !important;
  height: 38px !important;
  border-radius: 10px !important;
}

body.view-chat .ai-chat-sidebar-head button::before {
  content: "+";
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 26px;
  font-weight: 420;
}

body.view-chat .ai-chat-sidebar-head button:hover::before {
  background: rgba(255, 255, 255, 0.09);
}

body.view-chat .ai-chat-thread-list {
  gap: 4px !important;
  padding-right: 10px;
  overflow: hidden auto;
}

body.view-chat .ai-chat-thread {
  min-height: 44px !important;
  gap: 2px !important;
  padding: 9px 12px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
}

body.view-chat .ai-chat-thread:hover,
body.view-chat .ai-chat-thread.active {
  background: rgba(255, 255, 255, 0.12) !important;
}

body.view-chat .ai-chat-thread strong {
  font-size: 15px !important;
  font-weight: 680 !important;
  line-height: 1.35 !important;
}

body.view-chat .ai-chat-thread span {
  font-size: 12px !important;
  color: rgba(255, 255, 255, 0.48) !important;
}

body.view-chat .ai-chat-back {
  display: none !important;
}

body.view-chat .ai-chat-messages {
  grid-column: 2 !important;
  grid-row: 1 / 3 !important;
  width: min(1220px, calc(100% - 96px)) !important;
  justify-self: center !important;
  padding: 80px 0 26px !important;
}

body.view-chat .ai-chat-composer {
  grid-column: 2 !important;
  width: min(1160px, calc(100% - 128px)) !important;
  margin: 0 auto 28px !important;
  grid-template-columns: 52px minmax(0, 1fr) 52px 52px !important;
  gap: 8px !important;
  padding: 12px !important;
  border-radius: 28px !important;
  background: rgba(32, 32, 32, 0.96) !important;
}

body.view-chat .ai-chat-composer textarea {
  grid-column: 2 !important;
  order: 2 !important;
  min-height: 52px !important;
  height: 52px;
  align-self: center;
  padding: 13px 6px 11px !important;
  line-height: 1.45 !important;
  overflow-y: auto;
  display: block;
}

body.view-chat .ai-chat-upload {
  grid-column: 1 !important;
  width: 52px !important;
  min-width: 52px !important;
  padding: 0 !important;
  font-size: 0 !important;
}

body.view-chat .ai-chat-upload::before {
  content: "+" !important;
  font-size: 26px !important;
  font-weight: 420 !important;
}

/* Chat layout corrections: keep plus only on create/upload, never on model items. */
body.view-chat .ai-chat-sidebar-head .ai-chat-model-trigger,
body.view-chat .ai-chat-sidebar-head .ai-chat-model-option {
  width: auto !important;
  min-width: 0 !important;
  height: auto !important;
  font-size: 14px !important;
}

body.view-chat .ai-chat-sidebar-head .ai-chat-model-trigger::before,
body.view-chat .ai-chat-sidebar-head .ai-chat-model-option::before {
  content: none !important;
  display: none !important;
}

body.view-chat #entryChatNew {
  width: auto !important;
  min-width: 76px !important;
  height: 38px !important;
  padding: 0 12px !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.035) !important;
  color: rgba(255, 255, 255, 0.88) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  font-size: 14px !important;
  font-weight: 760 !important;
}

body.view-chat #entryChatNew::before {
  content: "新聊天" !important;
  display: inline !important;
  width: auto;
  height: auto;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  box-shadow: none;
}

body.view-chat #entryChatNew:hover::before {
  background: transparent;
}

body.view-chat #entryChatNew:hover {
  border-color: rgba(255, 255, 255, 0.28) !important;
  background: rgba(255, 255, 255, 0.09) !important;
}

body.view-chat .ai-chat-model-trigger {
  min-height: 42px !important;
  align-items: center !important;
}

body.view-chat .ai-chat-model-label,
body.view-chat .ai-chat-model-option span:last-child {
  display: inline-block !important;
  color: rgba(255, 255, 255, 0.94) !important;
  font-size: 20px !important;
  font-weight: 780 !important;
  line-height: 1.15 !important;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.view-chat .ai-chat-model-option span:last-child {
  font-size: 14px !important;
  font-weight: 760 !important;
}

body.view-chat .ai-chat-agent-controls {
  display: block !important;
  margin: -6px 0 12px !important;
}

body.view-chat .ai-chat-agent-select {
  display: none !important;
}

body.view-chat .ai-chat-agent-manage {
  width: 100% !important;
  min-height: 58px !important;
  height: auto !important;
  display: grid !important;
  align-content: center;
  justify-items: start;
  gap: 3px;
  padding: 10px 12px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.92) !important;
  text-align: left;
  box-shadow: none !important;
  font-size: 15px !important;
  font-weight: 720 !important;
}

body.view-chat .ai-chat-agent-manage:hover {
  background: rgba(255, 255, 255, 0.12) !important;
}

body.view-chat .ai-chat-agent-manage::after {
  content: "选择或创建智能体";
  color: rgba(255, 255, 255, 0.48);
  font-size: 12px;
  font-weight: 520;
}

body.view-chat .ai-chat-view.agent-page-open .ai-chat-agent-manage {
  background: rgba(255, 255, 255, 0.12) !important;
}

body.view-chat .ai-chat-view.agent-page-open .chat-agent-modal {
  grid-column: 2 !important;
  grid-row: 1 / -1 !important;
  width: min(1160px, calc(100% - 96px)) !important;
  justify-self: center;
  align-self: stretch;
  padding: 72px 0 36px;
  box-sizing: border-box;
  overflow: hidden auto;
}

body.view-chat .ai-chat-view.agent-page-open .chat-agent-card {
  min-height: min(720px, calc(100vh - 108px));
}

body.view-chat .ai-chat-sidebar {
  border-right: 1px solid rgba(255, 255, 255, 0.16) !important;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008) 42%, transparent),
    #050607 !important;
  box-shadow:
    18px 0 46px rgba(0, 0, 0, 0.42),
    inset -1px 0 0 rgba(255, 255, 255, 0.045) !important;
  -webkit-backdrop-filter: blur(16px) saturate(1.16);
  backdrop-filter: blur(16px) saturate(1.16);
}

body.view-chat .ai-chat-thread-list {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding-top: 12px;
}

body.view-chat .ai-chat-agent-manage,
body.view-chat .ai-chat-thread {
  border: 1px solid rgba(255, 255, 255, 0.07) !important;
  background: rgba(255, 255, 255, 0.035) !important;
}

body.view-chat .ai-chat-thread:hover,
body.view-chat .ai-chat-thread.active,
body.view-chat .ai-chat-agent-manage:hover,
body.view-chat .ai-chat-view.agent-page-open .ai-chat-agent-manage {
  border-color: rgba(255, 255, 255, 0.14) !important;
  background: rgba(255, 255, 255, 0.105) !important;
}

body.view-chat .ai-chat-messages {
  width: 100% !important;
  justify-self: stretch !important;
  box-sizing: border-box;
  padding-left: max(28px, calc((100% - 920px) / 2)) !important;
  padding-right: max(28px, calc((100% - 920px) / 2)) !important;
  scrollbar-gutter: stable !important;
}

body.view-chat .ai-chat-view.agent-page-open .chat-agent-modal {
  display: grid;
  align-items: stretch;
}

body.view-chat .ai-chat-view.agent-page-open .chat-agent-card {
  grid-template-columns: minmax(250px, 310px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  min-height: min(720px, calc(100vh - 108px));
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.018)),
    #090a0c;
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.52),
    inset 0 1px 0 rgba(255, 255, 255, 0.075);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  backdrop-filter: blur(20px) saturate(1.15);
}

body.view-chat .chat-agent-head {
  grid-column: 1 / -1;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body.view-chat .chat-agent-list {
  grid-column: 1 / -1;
  grid-row: 2 / 4;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.105);
  border-radius: 14px;
  background: #0c0d10;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-list {
  grid-column: 1;
  grid-row: 2 / 4;
}

body.view-chat .chat-agent-create,
body.view-chat .chat-agent-use,
body.view-chat .chat-agent-row-action {
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
}

body.view-chat .chat-agent-create {
  width: 100%;
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

body.view-chat .chat-agent-list-title {
  margin: 8px 3px 2px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 12px;
  font-weight: 760;
}

body.view-chat .chat-agent-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: center;
}

body.view-chat .chat-agent-row.default {
  grid-template-columns: minmax(0, 1fr);
}

body.view-chat .chat-agent-use {
  width: 100%;
  padding: 0 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

body.view-chat .chat-agent-row-action {
  min-width: 44px;
  padding: 0 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.66);
}

body.view-chat .chat-agent-row-action.danger {
  color: rgba(255, 196, 196, 0.86);
}

body.view-chat .chat-agent-row.active .chat-agent-use,
body.view-chat .chat-agent-row.editing .chat-agent-use,
body.view-chat .chat-agent-create:hover,
body.view-chat .chat-agent-use:hover,
body.view-chat .chat-agent-row-action:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

body.view-chat .chat-agent-field,
body.view-chat .chat-agent-actions {
  display: none;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-field,
body.view-chat .chat-agent-modal.editor-open .chat-agent-actions {
  display: grid;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-actions {
  display: flex;
}

body.view-chat .chat-agent-field {
  grid-column: 2;
}

body.view-chat .chat-agent-field input,
body.view-chat .chat-agent-field textarea {
  background: #0b0c0f;
  border-color: rgba(255, 255, 255, 0.14);
  border-radius: 14px;
}

body.view-chat .chat-agent-actions {
  grid-column: 2;
}

body.view-chat .chat-agent-actions #chatAgentNew {
  display: none;
}

body.view-chat .ai-chat-view.agent-page-open .chat-agent-modal {
  width: min(1180px, calc(100% - 96px)) !important;
  padding: 66px 0 34px !important;
  overflow: hidden auto !important;
  scrollbar-gutter: stable !important;
  scrollbar-color: rgba(255, 255, 255, 0.26) transparent;
}

body.view-chat .ai-chat-view.agent-page-open .chat-agent-card {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  gap: 26px !important;
  min-height: auto !important;
  padding: 0 8px 28px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

body.view-chat .chat-agent-head {
  grid-column: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0 !important;
  border-bottom: 0 !important;
}

body.view-chat .chat-agent-head h3 {
  margin: 0 !important;
  color: rgba(255, 255, 255, 0.94) !important;
  font-size: 32px !important;
  font-weight: 760 !important;
  line-height: 1.1 !important;
  letter-spacing: 0 !important;
}

body.view-chat .chat-agent-head button {
  height: 40px !important;
  min-width: 78px !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.07) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  box-shadow: none !important;
}

body.view-chat .chat-agent-list {
  grid-column: 1 !important;
  grid-row: 2 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  align-content: start !important;
  gap: 34px !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  overflow: visible !important;
}

body.view-chat .chat-agent-section {
  display: grid;
  gap: 14px;
  min-width: 0;
}

body.view-chat .chat-agent-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

body.view-chat .chat-agent-section-head h4 {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 20px;
  font-weight: 760;
  line-height: 1.2;
  letter-spacing: 0;
}

body.view-chat .chat-agent-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

body.view-chat .chat-agent-preset-card {
  position: relative;
  min-height: 178px;
  display: grid !important;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-content: start;
  gap: 12px;
  padding: 18px 18px 16px !important;
  border: 1px solid rgba(255, 255, 255, 0.075) !important;
  border-radius: 18px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.072), rgba(255, 255, 255, 0.032)),
    rgba(255, 255, 255, 0.045) !important;
  color: rgba(255, 255, 255, 0.88) !important;
  text-align: left !important;
  box-shadow: none !important;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

body.view-chat .chat-agent-preset-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.102), rgba(255, 255, 255, 0.046)),
    rgba(255, 255, 255, 0.07) !important;
}

body.view-chat .chat-agent-preset-card strong {
  display: block;
  min-width: 0;
  color: #fff;
  font-size: 15px;
  font-weight: 760;
  line-height: 1.2;
}

body.view-chat .chat-agent-preset-card > span:not(.chat-agent-avatar-chip) {
  display: -webkit-box;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 560;
  line-height: 1.58;
  overflow: hidden;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

body.view-chat .chat-agent-preset-card em {
  position: absolute;
  top: 18px;
  left: 54px;
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-style: normal;
  font-weight: 720;
}

body.view-chat .chat-agent-preset-card em:empty {
  display: none;
}

body.view-chat .chat-agent-avatar-chip {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.28), transparent 52%),
    linear-gradient(135deg, #16b8c4, #1877df);
  color: #fff;
  font-size: 15px;
  font-weight: 820;
  line-height: 1;
}

body.view-chat .chat-agent-preset-card:nth-child(2) .chat-agent-avatar-chip,
body.view-chat .chat-agent-row:nth-child(3n + 2) .chat-agent-avatar-chip {
  background: linear-gradient(135deg, #f0722c, #b95721);
}

body.view-chat .chat-agent-preset-card:nth-child(3) .chat-agent-avatar-chip,
body.view-chat .chat-agent-row:nth-child(3n + 3) .chat-agent-avatar-chip {
  background: linear-gradient(135deg, #e9477d, #9b5fe8);
}

body.view-chat .chat-agent-preset-card:nth-child(4) .chat-agent-avatar-chip {
  background: linear-gradient(135deg, #2fb7d0, #5c84ff);
}

body.view-chat .chat-agent-create {
  width: auto !important;
  height: 42px !important;
  min-width: 126px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 0 18px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(211, 232, 255, 0.92) !important;
  color: rgba(20, 34, 54, 0.96) !important;
  font-size: 14px !important;
  font-weight: 780 !important;
  box-shadow: none !important;
}

body.view-chat .chat-agent-row-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

body.view-chat .chat-agent-row {
  min-height: 78px;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 64px 64px !important;
  gap: 10px !important;
  align-items: center !important;
  padding: 0 12px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.024)),
    rgba(255, 255, 255, 0.035);
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

body.view-chat .chat-agent-row:hover,
body.view-chat .chat-agent-row.active {
  border-color: rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.082), rgba(255, 255, 255, 0.034)),
    rgba(255, 255, 255, 0.055);
}

body.view-chat .chat-agent-use {
  width: 100% !important;
  height: 76px !important;
  display: flex !important;
  align-items: center;
  gap: 14px;
  padding: 0 16px !important;
  border: 0 !important;
  border-radius: 16px !important;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.92) !important;
  box-shadow: none !important;
  text-align: left !important;
  overflow: hidden;
}

body.view-chat .chat-agent-row-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

body.view-chat .chat-agent-row-copy strong {
  min-width: 0;
  overflow: hidden;
  color: #fff;
  font-size: 15px;
  font-weight: 760;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.view-chat .chat-agent-row-copy span {
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  font-weight: 560;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.view-chat .chat-agent-row-action {
  width: 56px !important;
  min-width: 56px !important;
  height: 36px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.72) !important;
  font-size: 13px !important;
  font-weight: 720 !important;
  box-shadow: none !important;
}

body.view-chat .chat-agent-row-action:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
}

body.view-chat .chat-agent-row-action.danger:hover {
  color: rgba(255, 210, 210, 0.96) !important;
}

body.view-chat .chat-agent-empty {
  min-height: 78px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 14px;
  font-weight: 650;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-card {
  grid-template-columns: minmax(420px, 600px) minmax(420px, 1fr) !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  column-gap: 48px !important;
  row-gap: 22px !important;
  min-height: calc(100vh - 112px) !important;
  padding: 0 8px 26px !important;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-head {
  grid-column: 1 / -1 !important;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto auto !important;
  gap: 14px !important;
  align-items: center !important;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-list {
  display: none !important;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-field,
body.view-chat .chat-agent-modal.editor-open .chat-agent-actions {
  grid-column: 1 !important;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-head h3::before {
  content: "S";
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  margin-right: 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #555, #252525);
  color: rgba(255, 255, 255, 0.9);
  font-size: 18px;
  font-weight: 780;
  vertical-align: middle;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-head h3 {
  font-size: 24px !important;
  font-weight: 760 !important;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-head h3::after {
  content: none !important;
  display: none !important;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-head #chatAgentClose {
  grid-column: 3;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-actions {
  grid-column: 4 !important;
  grid-row: 1 !important;
  display: flex !important;
  justify-content: end !important;
  gap: 10px !important;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-actions #chatAgentSave {
  min-width: 86px;
  height: 52px;
  padding: 0 24px;
  border-radius: 999px;
  border: 0;
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.96);
  font-size: 16px;
  font-weight: 760;
  box-shadow: none;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-actions #chatAgentDelete {
  order: -1;
  width: 52px;
  min-width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 210, 210, 0.82);
  font-size: 0;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-actions #chatAgentDelete::before {
  content: "删";
  font-size: 14px;
  font-weight: 760;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-field {
  display: grid !important;
  gap: 10px !important;
  margin: 0 !important;
  color: rgba(255, 255, 255, 0.86) !important;
  font-size: 15px !important;
  font-weight: 760 !important;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-field span {
  padding-left: 4px;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-field input,
body.view-chat .chat-agent-modal.editor-open .chat-agent-field textarea {
  width: 100% !important;
  box-sizing: border-box !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.065) !important;
  color: rgba(255, 255, 255, 0.94) !important;
  box-shadow: none !important;
  resize: vertical !important;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-field input {
  height: 66px !important;
  padding: 0 18px !important;
  font-size: 18px !important;
  line-height: 66px !important;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-description-field textarea {
  min-height: 86px !important;
  height: 86px !important;
  padding: 18px !important;
  font-size: 16px !important;
  line-height: 1.5 !important;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-field textarea#chatAgentPrompt {
  min-height: 250px !important;
  height: min(34vh, 320px) !important;
  padding: 18px !important;
  font-size: 16px !important;
  line-height: 1.55 !important;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-field::after {
  display: block;
  color: rgba(255, 255, 255, 0.42);
  font-size: 13px;
  font-weight: 560;
  line-height: 1.45;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-description-field::after {
  content: "用于在列表和预览中说明这个智能体的用途。";
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-field:has(#chatAgentPrompt)::after {
  content: "例如：你是一位分镜导演，擅长把想法拆成镜头、节奏、风格和执行步骤。";
}

body.view-chat .chat-agent-editor-extra {
  grid-column: 1 !important;
  display: none;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-editor-extra {
  display: flex;
}

body.view-chat .chat-agent-tool-card,
body.view-chat .chat-agent-knowledge-card {
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.86);
}

body.view-chat .chat-agent-tool-card div,
body.view-chat .chat-agent-knowledge-card div {
  min-width: 0;
  display: grid;
  gap: 7px;
}

body.view-chat .chat-agent-tool-card strong,
body.view-chat .chat-agent-knowledge-card strong {
  color: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  font-weight: 760;
  line-height: 1.2;
}

body.view-chat .chat-agent-tool-card span,
body.view-chat .chat-agent-knowledge-card span,
body.view-chat .chat-agent-knowledge-toggle {
  color: rgba(255, 255, 255, 0.58);
  font-size: 14px;
  font-weight: 560;
  line-height: 1.35;
}

body.view-chat .chat-agent-knowledge-card button {
  height: 38px;
  min-width: 64px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.6);
  font-weight: 720;
}

body.view-chat .chat-agent-knowledge-toggle {
  align-items: center;
  gap: 12px;
  padding: 0 4px;
}

body.view-chat .chat-agent-knowledge-toggle input {
  width: 18px;
  height: 18px;
  accent-color: rgba(255, 255, 255, 0.72);
}

body.view-chat .chat-agent-preview {
  display: none;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-preview {
  grid-column: 2 !important;
  grid-row: 2 / 5 !important;
  min-height: 0;
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-preview::before {
  content: "预览";
  align-self: start;
  color: rgba(255, 255, 255, 0.85);
  font-size: 16px;
  font-weight: 760;
}

body.view-chat .chat-agent-preview-card {
  min-height: min(58vh, 560px);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 20px;
  padding: 38px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.018)),
    rgba(255, 255, 255, 0.035);
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
}

body.view-chat .chat-agent-preview-avatar {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #5a5a5a, #2e2e2e);
  color: rgba(255, 255, 255, 0.92);
  font-size: 30px;
  font-weight: 760;
}

body.view-chat .chat-agent-preview-card strong {
  max-width: 420px;
  color: #fff;
  font-size: 24px;
  font-weight: 760;
  line-height: 1.3;
}

body.view-chat .chat-agent-preview-card span {
  max-width: 440px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 15px;
  font-weight: 560;
  line-height: 1.6;
}

body.view-chat .chat-agent-preview-composer {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 255, 255, 0.38);
  font-size: 16px;
  font-weight: 560;
}

body.view-chat .chat-agent-preview-composer em {
  color: rgba(255, 255, 255, 0.58);
  font-style: normal;
  font-size: 14px;
  font-weight: 650;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-card {
  position: relative !important;
  grid-template-columns: minmax(420px, 600px) minmax(420px, 1fr) !important;
}

body.view-chat .chat-agent-modal.editor-open .chat-agent-actions {
  position: absolute !important;
  top: 0 !important;
  right: 8px !important;
  grid-column: auto !important;
  grid-row: auto !important;
}

body.view-chat .ai-chat-sidebar-actions {
  display: grid;
  gap: 8px;
  margin: -8px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

body.view-chat #entryChatNew {
  width: 100% !important;
  min-width: 0 !important;
  height: 40px !important;
  display: flex !important;
  align-items: center;
  justify-content: flex-start;
  padding: 0 12px !important;
  border: 1px solid rgba(255, 255, 255, 0.11) !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.055) !important;
  color: rgba(255, 255, 255, 0.9) !important;
  font-size: 14px !important;
  font-weight: 760 !important;
  line-height: 1;
}

body.view-chat .ai-chat-search-trigger {
  width: 100% !important;
  min-width: 0 !important;
  height: 40px !important;
  display: flex !important;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  padding: 0 12px !important;
  border: 1px solid rgba(255, 255, 255, 0.11) !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.055) !important;
  color: rgba(255, 255, 255, 0.9) !important;
  font-size: 14px !important;
  font-weight: 760 !important;
  line-height: 1;
  cursor: pointer;
}

body.view-chat .ai-chat-search-trigger.active,
body.view-chat .ai-chat-search-trigger:hover {
  border-color: rgba(255, 255, 255, 0.22) !important;
  background: rgba(255, 255, 255, 0.1) !important;
}

body.view-chat .ai-chat-search-trigger span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.view-chat .ai-chat-search-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 1002;
  width: min(680px, calc(100vw - 40px));
  max-height: min(640px, calc(100vh - 80px));
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  background: rgba(18, 18, 20, 0.98);
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.54),
    0 26px 80px rgba(0, 0, 0, 0.62),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: translate(-50%, -50%);
}

body.view-chat .ai-chat-view.search-modal-open .ai-chat-sidebar {
  z-index: 1000 !important;
}

body.view-chat .ai-chat-search-panel > * {
  position: relative;
  z-index: 1;
}

body.view-chat .ai-chat-search-panel[hidden] {
  display: none !important;
}

body.view-chat .ai-chat-search-results {
  max-height: min(460px, calc(100vh - 220px));
  overflow: auto;
  display: grid;
  gap: 6px;
}

body.view-chat .ai-chat-search-result {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  text-align: left;
  cursor: pointer;
}

body.view-chat .ai-chat-search-result:hover,
body.view-chat .ai-chat-search-result.active {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
}

body.view-chat .ai-chat-search-result strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 720;
}

body.view-chat .ai-chat-search-result span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.54);
  font-size: 12px;
  font-weight: 560;
}

body.view-chat #entryChatNew::before {
  content: none !important;
  display: none !important;
}

body.view-chat .ai-chat-search {
  height: 40px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.105);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.68);
}

body.view-chat .ai-chat-search span {
  width: 18px;
  height: 18px;
  overflow: hidden;
  color: transparent;
  font-size: 0;
}

body.view-chat .ai-chat-search span::before {
  content: "";
  display: block;
  width: 12px;
  height: 12px;
  margin: 2px 0 0 2px;
  border: 2px solid rgba(255, 255, 255, 0.56);
  border-radius: 999px;
  box-shadow: 6px 6px 0 -4px rgba(255, 255, 255, 0.56);
  transform: rotate(-12deg);
}

body.view-chat .ai-chat-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  font: inherit;
  font-size: 14px;
  font-weight: 620;
}

body.view-chat .ai-chat-search input::placeholder {
  color: rgba(255, 255, 255, 0.48);
}

body.view-chat .ai-chat-sidebar-toggle,
body.view-chat .ai-chat-sidebar-restore {
  width: 40px !important;
  min-width: 40px !important;
  height: 40px !important;
  display: grid !important;
  place-items: center;
  padding: 0 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.045) !important;
  color: rgba(255, 255, 255, 0.86) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07) !important;
  cursor: pointer;
  font-size: 0 !important;
}

body.view-chat .ai-chat-sidebar-head .ai-chat-sidebar-toggle::before,
body.view-chat .ai-chat-sidebar-toggle::before,
body.view-chat .ai-chat-sidebar-restore::before {
  content: "" !important;
  display: block !important;
  place-items: initial !important;
  width: 17px !important;
  height: 15px !important;
  border: 1.5px solid currentColor !important;
  border-radius: 4px !important;
  background: transparent !important;
  box-shadow: inset 5px 0 0 rgba(255, 255, 255, 0.22);
  color: currentColor !important;
  font-size: 0 !important;
}

body.view-chat .ai-chat-sidebar-toggle:hover,
body.view-chat .ai-chat-sidebar-restore:hover,
body.view-chat #entryChatNew:hover,
body.view-chat .ai-chat-search-trigger:hover,
body.view-chat .ai-chat-search:focus-within {
  border-color: rgba(255, 255, 255, 0.24) !important;
  background: rgba(255, 255, 255, 0.09) !important;
}

body.view-chat .ai-chat-sidebar-restore {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  z-index: 4;
  margin: 24px 0 0 24px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

body.view-chat .ai-chat-view.sidebar-collapsed {
  grid-template-columns: 88px minmax(0, 1fr);
}

body.view-chat .ai-chat-view.sidebar-collapsed .ai-chat-sidebar {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-24px);
}

body.view-chat .ai-chat-view.sidebar-collapsed .ai-chat-sidebar-restore {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

body.view-chat .ai-chat-search-empty {
  padding: 14px 12px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 13px;
  font-weight: 650;
}

body.view-chat .ai-chat-view.chat-empty-state .ai-chat-messages {
  grid-row: 1 / 3 !important;
  display: grid !important;
  align-items: center !important;
  justify-items: center !important;
  padding: 0 max(28px, calc((100% - 920px) / 2)) 118px !important;
  overflow: hidden !important;
}

body.view-chat .ai-chat-view.chat-empty-state .ai-chat-empty {
  display: grid !important;
  place-items: center;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.94) !important;
  font-size: clamp(26px, 2.4vw, 40px) !important;
  font-weight: 640 !important;
  line-height: 1.2 !important;
  letter-spacing: 0 !important;
  box-shadow: none !important;
  text-shadow: 0 18px 54px rgba(0, 0, 0, 0.62);
}

body.view-chat .ai-chat-view.chat-empty-state .ai-chat-composer {
  grid-row: 2 !important;
  align-self: center !important;
  transform: translateY(76px);
  width: min(920px, calc(100% - 128px)) !important;
  max-width: min(920px, calc(100% - 128px)) !important;
  margin-bottom: 0 !important;
  box-shadow:
    0 18px 52px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

body.view-chat .ai-chat-sidebar {
  padding: 24px 14px 18px !important;
  background: #050505 !important;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.105) !important;
  opacity: 1 !important;
}

body.view-chat .ai-chat-sidebar-head {
  padding: 0 8px 24px !important;
  display: flex !important;
  justify-content: space-between;
}

body.view-chat .ai-chat-sidebar-head::before {
  content: none !important;
}

body.view-chat .ai-chat-sidebar-head #entryChatModelMenu {
  order: 1;
  display: inline-flex !important;
  width: min(220px, calc(100% - 52px)) !important;
  min-width: 0 !important;
  margin-right: auto;
}

body.view-chat .ai-chat-sidebar-head .ai-chat-model-trigger {
  height: 40px !important;
  padding: 0 8px 0 0 !important;
  font-size: 20px !important;
}

body.view-chat .ai-chat-sidebar-head .ai-chat-sidebar-toggle {
  order: 2;
}

body.view-chat .ai-chat-sidebar-actions {
  gap: 4px;
  margin: 0 0 22px;
  padding-bottom: 20px;
}

body.view-chat #entryChatNew,
body.view-chat .ai-chat-search-trigger,
body.view-chat .ai-chat-search,
body.view-chat .ai-chat-agent-manage {
  height: 44px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.94) !important;
  box-shadow: none !important;
  font-size: 17px !important;
  font-weight: 680 !important;
}

body.view-chat #entryChatNew {
  background: rgba(255, 255, 255, 0.16) !important;
}

body.view-chat #entryChatNew::before {
  content: "" !important;
  display: block !important;
  width: 18px !important;
  height: 18px !important;
  border: 2px solid currentColor;
  border-radius: 5px;
  box-shadow: 6px -6px 0 -5px currentColor;
  transform: rotate(-2deg);
  margin-right: 12px;
}

body.view-chat .ai-chat-search {
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 9px;
  padding: 0 12px;
}

body.view-chat .ai-chat-search input {
  font-size: 17px;
  font-weight: 680;
}

body.view-chat .ai-chat-search input::placeholder {
  color: rgba(255, 255, 255, 0.84);
}

body.view-chat .ai-chat-agent-manage {
  min-height: 44px !important;
  display: flex !important;
  align-items: center;
  padding: 0 12px !important;
}

body.view-chat .ai-chat-agent-manage::after {
  content: none !important;
}

body.view-chat .ai-chat-agent-manage::before {
  content: "";
  width: 22px;
  height: 16px;
  margin-right: 12px;
  border: 2px solid currentColor;
  border-radius: 7px;
  box-shadow:
    -7px 4px 0 -5px currentColor,
    7px 4px 0 -5px currentColor;
}

body.view-chat .ai-chat-thread-list::before {
  content: "最近";
  display: block;
  padding: 0 8px 10px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 17px;
  font-weight: 720;
}

body.view-chat .ai-chat-thread-list.empty::before {
  content: none;
  display: none;
}

body.view-chat .ai-chat-thread-list {
  gap: 2px !important;
  border-top: 0 !important;
  padding-top: 0 !important;
  padding-right: 4px !important;
}

body.view-chat .ai-chat-thread {
  min-height: 38px !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px !important;
  padding: 8px 9px !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
}

body.view-chat .ai-chat-thread:hover,
body.view-chat .ai-chat-thread.active {
  background: rgba(255, 255, 255, 0.105) !important;
}

body.view-chat .ai-chat-thread-main {
  min-width: 0;
  gap: 0 !important;
}

body.view-chat .ai-chat-thread strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px !important;
  font-weight: 540 !important;
}

body.view-chat .ai-chat-thread span {
  display: none !important;
}

body.view-chat .ai-chat-thread-actions {
  width: auto !important;
  display: none !important;
  align-self: center;
}

body.view-chat .ai-chat-thread:hover .ai-chat-thread-actions,
body.view-chat .ai-chat-thread.active .ai-chat-thread-actions {
  display: flex !important;
}

body.view-chat .ai-chat-thread-action {
  min-width: 28px !important;
  width: 28px;
  height: 28px;
  padding: 0 !important;
  overflow: hidden;
  color: transparent !important;
  border: 0 !important;
  background: transparent !important;
  font-size: 0 !important;
}

body.view-chat .ai-chat-thread-action::before {
  content: "...";
  color: rgba(255, 255, 255, 0.72);
  font-size: 16px;
  letter-spacing: 0;
}

body.view-chat .ai-chat-thread-action.danger::before {
  content: "×";
  font-size: 20px;
}

body.view-chat #entryChatNew {
  background: transparent !important;
}

body.view-chat #entryChatNew:hover {
  background: rgba(255, 255, 255, 0.105) !important;
}

body.view-chat .ai-chat-thread-list {
  gap: 8px !important;
  padding-right: 8px !important;
}

body.view-chat .ai-chat-thread {
  min-height: 56px !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center;
  gap: 10px !important;
  padding: 10px 10px 10px 12px !important;
  border: 1px solid rgba(255, 255, 255, 0.095) !important;
  border-radius: 10px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)),
    rgba(255, 255, 255, 0.022) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035) !important;
}

body.view-chat .ai-chat-thread:hover,
body.view-chat .ai-chat-thread.active {
  border-color: rgba(255, 255, 255, 0.18) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025)),
    rgba(255, 255, 255, 0.075) !important;
}

body.view-chat .ai-chat-thread-main {
  min-width: 0;
  gap: 3px !important;
}

body.view-chat .ai-chat-thread strong {
  max-width: 100%;
  color: rgba(255, 255, 255, 0.92) !important;
  font-size: 15px !important;
  font-weight: 680 !important;
}

body.view-chat .ai-chat-thread span {
  display: block !important;
  color: rgba(255, 255, 255, 0.48) !important;
  font-size: 12px !important;
  font-weight: 560 !important;
  line-height: 1.25 !important;
}

body.view-chat .ai-chat-thread-actions {
  width: auto !important;
  display: flex !important;
  align-items: center;
  gap: 5px !important;
  align-self: center;
  opacity: 0.72;
}

body.view-chat .ai-chat-thread:hover .ai-chat-thread-actions,
body.view-chat .ai-chat-thread.active .ai-chat-thread-actions {
  opacity: 1;
}

body.view-chat .ai-chat-thread-action {
  min-width: 52px !important;
  width: auto !important;
  height: 28px !important;
  padding: 0 8px !important;
  overflow: visible !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, 0.035) !important;
  color: rgba(255, 255, 255, 0.68) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 1 !important;
}

body.view-chat .ai-chat-thread-action:hover {
  border-color: rgba(255, 255, 255, 0.24) !important;
  background: rgba(255, 255, 255, 0.09) !important;
  color: #fff !important;
}

body.view-chat .ai-chat-thread-action::before,
body.view-chat .ai-chat-thread-action.danger::before {
  content: none !important;
  display: none !important;
}

body.view-chat .ai-chat-sidebar-head {
  gap: 8px !important;
}

body.view-chat .ai-chat-sidebar-head #entryChatModelMenu {
  width: min(232px, calc(100% - 50px)) !important;
}

body.view-chat .ai-chat-sidebar-head .ai-chat-model-trigger,
body.view-chat .ai-chat-sidebar-toggle {
  height: 40px !important;
  border: 1px solid rgba(255, 255, 255, 0.13) !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.035) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055) !important;
}

body.view-chat .ai-chat-sidebar-head .ai-chat-model-trigger:hover,
body.view-chat .ai-chat-sidebar-toggle:hover {
  border-color: rgba(255, 255, 255, 0.24) !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

body.view-chat .ai-chat-sidebar-head .ai-chat-model-trigger {
  padding: 0 10px !important;
}

body.view-chat #entryChatNew {
  justify-content: flex-start !important;
  text-align: left !important;
}

body.view-chat #entryChatNew span {
  justify-self: start;
  text-align: left;
}

body.view-chat .ai-chat-nav-icon,
body.view-chat .ai-chat-sidebar-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.view-chat #entryChatNew,
body.view-chat .ai-chat-agent-manage,
body.view-chat .ai-chat-search-trigger,
body.view-chat .ai-chat-search {
  display: grid !important;
  grid-template-columns: 24px minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 0 12px !important;
}

body.view-chat #entryChatNew span,
body.view-chat .ai-chat-search-trigger span,
body.view-chat .ai-chat-agent-manage span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.view-chat #entryChatNew::before,
body.view-chat .ai-chat-agent-manage::before,
body.view-chat .ai-chat-search span,
body.view-chat .ai-chat-search span::before {
  content: none !important;
  display: none !important;
}

body.view-chat .ai-chat-search input {
  grid-column: 2;
}

body.view-chat .ai-chat-sidebar-toggle,
body.view-chat .ai-chat-sidebar-restore {
  display: grid !important;
  place-items: center !important;
}

body.view-chat .ai-chat-sidebar-head .ai-chat-sidebar-toggle::before,
body.view-chat .ai-chat-sidebar-toggle::before,
body.view-chat .ai-chat-sidebar-restore::before {
  content: none !important;
  display: none !important;
}

body.view-chat .ai-chat-view.sidebar-collapsed {
  grid-template-columns: 72px minmax(0, 1fr) !important;
}

body.view-chat .ai-chat-view.sidebar-collapsed .ai-chat-sidebar {
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translateX(-18px) !important;
  overflow: hidden !important;
  box-shadow: none !important;
}

body.view-chat .ai-chat-view.sidebar-collapsed .ai-chat-sidebar-restore {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateX(0) !important;
}

body.view-chat .ai-chat-message.assistant {
  display: grid !important;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-rows: auto auto auto auto;
  column-gap: 10px;
  row-gap: 8px;
  align-items: start;
}

body.view-chat .ai-chat-message.assistant.has-swarm {
  width: min(76%, 760px) !important;
  max-width: min(76%, 760px) !important;
}

body.view-chat .ai-chat-messages {
  width: 100% !important;
  justify-self: stretch !important;
  box-sizing: border-box;
  padding: 80px max(28px, calc((100% - 920px) / 2)) 26px !important;
  scrollbar-gutter: stable !important;
}

body.view-chat .ai-chat-avatar {
  grid-column: 1;
  grid-row: 1;
  width: 22px !important;
  height: 22px !important;
  margin-top: 1px;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  color: rgba(255, 255, 255, 0.88);
}

body.view-chat .ai-chat-avatar .yungou-mark {
  width: 22px !important;
  height: 22px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.view-chat .ai-chat-avatar .yungou-mark svg {
  width: 22px !important;
  height: 22px !important;
}

body.view-chat .ai-chat-model-name {
  grid-column: 2;
  grid-row: 1;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  padding-left: 0;
}

body.view-chat .ai-chat-message.assistant .ai-chat-message-content {
  grid-column: 2;
  grid-row: 2;
}

body.view-chat .ai-chat-message.assistant .ai-chat-swarm-traces {
  grid-column: 2 !important;
  grid-row: 3 !important;
  width: min(100%, 720px) !important;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

body.view-chat .ai-chat-message.assistant .ai-chat-message-attachments {
  grid-column: 2;
  grid-row: 4;
}

body.view-chat .ai-chat-message .ai-chat-copy-button {
  right: 6px !important;
  bottom: -34px !important;
  transform: none !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

body.view-chat .ai-chat-message .ai-chat-message-actions {
  right: 6px !important;
  bottom: -34px !important;
}

body.view-chat .ai-chat-message .ai-chat-message-actions .ai-chat-copy-button {
  right: auto !important;
  bottom: auto !important;
}

body.view-chat .ai-chat-message.assistant .ai-chat-message-content {
  margin-top: 0;
}

body.view-chat .ai-chat-composer {
  min-height: 68px !important;
  align-items: end !important;
  grid-template-rows: minmax(48px, auto) !important;
  grid-template-columns: 48px auto minmax(0, 1fr) 48px 48px !important;
  gap: 8px !important;
  padding: 10px !important;
  border-radius: 26px !important;
  width: min(920px, calc(100% - 128px)) !important;
  max-width: min(920px, calc(100% - 128px)) !important;
  inline-size: min(920px, calc(100% - 128px)) !important;
  max-inline-size: min(920px, calc(100% - 128px)) !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

body.view-chat .ai-chat-composer textarea {
  grid-column: 3 !important;
  grid-row: 1 !important;
  height: 48px;
  min-height: 48px !important;
  max-height: 132px !important;
  align-self: end !important;
  padding: 11px 4px !important;
  font-size: 18px !important;
  line-height: 26px !important;
  font-weight: 540 !important;
  resize: none !important;
  overflow-y: hidden;
  width: 100% !important;
  min-width: 0 !important;
  min-inline-size: 0 !important;
  max-width: 100% !important;
  max-inline-size: 100% !important;
  box-sizing: border-box !important;
  white-space: pre-wrap !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  transition: height 140ms cubic-bezier(0.16, 1, 0.3, 1);
}

body.view-chat .ai-chat-upload,
body.view-chat .ai-chat-voice,
body.view-chat .ai-chat-send {
  width: 48px !important;
  min-width: 48px !important;
  height: 48px !important;
}

body.view-chat .ai-chat-swarm-toggle {
  grid-column: 2 !important;
  grid-row: 1 !important;
  height: 48px !important;
  min-width: 78px;
  padding: 0 14px !important;
  border-radius: 999px !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)),
    rgba(8, 8, 9, 0.72) !important;
  color: rgba(255, 255, 255, 0.5) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    0 10px 22px rgba(0, 0, 0, 0.24) !important;
  white-space: nowrap;
  align-self: end !important;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

body.view-chat .ai-chat-swarm-toggle[aria-disabled="true"] {
  cursor: not-allowed !important;
  opacity: 0.62;
}

body.view-chat .ai-chat-swarm-toggle span:last-child::after {
  content: none !important;
  display: none !important;
}

body.view-chat .ai-chat-swarm-toggle:hover {
  border-color: rgba(255, 255, 255, 0.24) !important;
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.062) 44%, rgba(255, 255, 255, 0.018) 100%),
    rgba(255, 255, 255, 0.082) !important;
  color: rgba(255, 255, 255, 0.92) !important;
  transform: translateY(-1px);
}

body.view-chat .ai-chat-swarm-toggle.active {
  border-color: rgba(255, 255, 255, 0.32) !important;
  background:
    radial-gradient(circle at 28% 16%, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.095) 46%, rgba(255, 255, 255, 0.024) 100%),
    rgba(255, 255, 255, 0.15) !important;
  color: rgba(255, 255, 255, 0.98) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 16px 34px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(255, 255, 255, 0.035) !important;
}

body.view-chat .ai-chat-swarm-toggle.active span:last-child::after {
  content: none !important;
  display: none !important;
}

body.view-chat .ai-chat-swarm-toggle-dot,
body.view-chat .ai-chat-swarm-toggle.active .ai-chat-swarm-toggle-dot {
  display: none !important;
}

body.view-chat .ai-chat-swarm-toggle:not(.active) .ai-chat-swarm-toggle-dot {
  opacity: 0.36;
}

body.view-chat .ai-chat-voice {
  grid-column: 4 !important;
}

body.view-chat .ai-chat-send {
  grid-column: 5 !important;
}

body.view-chat .ai-chat-view {
  background: #070707 !important;
  perspective: 900px;
}

body.view-chat .ai-chat-view > .entry-particle-canvas,
body.view-chat .ai-chat-view > .entry-aurora,
body.view-chat .ai-chat-view > .entry-particles,
body.view-chat .ai-chat-view > .entry-stars {
  position: fixed;
  z-index: 0;
  filter: blur(5px) saturate(0.82) brightness(0.72);
  transform: scale(1.018);
}

body.view-chat .ai-chat-view::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at center, rgba(0,0,0,0.16) 0 22%, rgba(0,0,0,0.42) 58%, rgba(0,0,0,0.72) 100%),
    linear-gradient(90deg, rgba(0,0,0,0.26), transparent 18%, transparent 82%, rgba(0,0,0,0.3)),
    rgba(0, 0, 0, 0.18) !important;
  opacity: 1 !important;
  filter: none !important;
  transform: none !important;
  animation: none !important;
  pointer-events: none;
}

body.view-chat .ai-chat-view::after {
  content: none !important;
}

body.view-chat .ai-chat-swarm-panel {
  top: 24px !important;
  right: 24px !important;
  bottom: 24px !important;
  width: min(372px, calc(100vw - 48px)) !important;
  z-index: 6 !important;
  border-radius: 18px !important;
}

@media (min-width: 1180px) {
  body.view-chat .ai-chat-view.swarm-panel-open .ai-chat-messages {
    padding-right: calc(396px + max(28px, calc((100% - 920px) / 2))) !important;
  }

  body.view-chat .ai-chat-view.swarm-panel-open .ai-chat-composer {
    --swarm-composer-side-gap: max(62px, calc(50% - 658px));
    width: min(920px, calc(100% - 520px)) !important;
    max-width: min(920px, calc(100% - 520px)) !important;
    inline-size: min(920px, calc(100% - 520px)) !important;
    max-inline-size: min(920px, calc(100% - 520px)) !important;
    justify-self: start !important;
    margin-left: var(--swarm-composer-side-gap) !important;
    margin-right: calc(396px + var(--swarm-composer-side-gap)) !important;
  }
}

@media (max-width: 1179px) {
  body.view-chat .ai-chat-view.swarm-panel-open .ai-chat-swarm-panel {
    top: auto !important;
    left: 16px !important;
    right: 16px !important;
    bottom: 108px !important;
    width: auto !important;
    max-height: min(58vh, 480px);
  }
}

body.view-chat .ai-chat-header,
body.view-chat .ai-chat-sidebar,
body.view-chat .ai-chat-messages,
body.view-chat .ai-chat-composer,
body.view-chat .chat-agent-modal {
  position: relative;
  z-index: 2;
}

@media (max-width: 980px) {
  .ai-chat-view {
    grid-template-columns: minmax(0, 1fr);
  }

  .ai-chat-sidebar {
    display: none !important;
  }

  .ai-chat-header,
  .ai-chat-messages,
  .ai-chat-composer {
    grid-column: 1;
    width: min(920px, calc(100% - 36px)) !important;
  }

  body.view-chat .ai-chat-messages {
    grid-column: 1;
    padding-left: 18px !important;
    padding-right: 18px !important;
  }

  body.view-chat .ai-chat-view.agent-page-open .chat-agent-modal {
    grid-column: 1 !important;
    width: min(920px, calc(100% - 36px)) !important;
    padding: 28px 0 28px;
  }

  .chat-agent-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-agent-list,
  .chat-agent-field,
  .chat-agent-actions {
    grid-column: 1;
  }

  .chat-agent-list {
    grid-row: auto;
    max-height: 160px;
  }

  body.view-chat .app-toast {
    display: none !important;
  }
}

@media (max-width: 560px) {
  .ai-chat-header {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .ai-chat-agent-controls {
    grid-column: 1 / -1;
    grid-row: 2;
    transform: none;
    justify-self: start;
  }

  .ai-chat-model {
    grid-column: 1 / -1;
    justify-self: stretch;
    width: 100% !important;
    min-width: 0 !important;
  }

  .ai-chat-model-menu {
    grid-column: 1 / -1;
    justify-self: stretch;
    width: 100%;
    min-width: 0;
  }

  .ai-chat-model-options {
    left: 0;
    right: 0;
    min-width: 0;
  }

  .ai-chat-message.user {
    max-width: 86%;
  }

  .ai-chat-composer {
    margin-bottom: 12px !important;
  }
}

.generate-view {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20vh 32px 160px;
  overflow: hidden auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  background: #070707;
  perspective: 900px;
}

.generate-view > .entry-particle-canvas,
.generate-view > .entry-aurora,
.generate-view > .entry-particles,
.generate-view > .entry-stars {
  position: fixed;
  z-index: 0;
  filter: blur(5px) saturate(0.82) brightness(0.72);
  transform: scale(1.018);
}

.generate-view::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(0,0,0,0.16) 0 22%, rgba(0,0,0,0.42) 58%, rgba(0,0,0,0.72) 100%),
    linear-gradient(90deg, rgba(0,0,0,0.26), transparent 18%, transparent 82%, rgba(0,0,0,0.3)),
    rgba(0, 0, 0, 0.18);
  pointer-events: none;
  z-index: 1;
}

.generate-welcome,
.generate-results {
  position: relative;
  z-index: 2;
}

@keyframes pop-open-centered {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

.generate-welcome {
  margin-bottom: 26px;
  color: #f7f9ff;
  font-size: 30px;
  line-height: 1.18;
  font-weight: 860;
  text-align: center;
  transition: opacity 180ms ease, transform 180ms ease;
}

.generate-results {
  width: min(860px, calc(100vw - 220px));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 46px;
  margin-bottom: 32px;
}

.generate-result {
  position: relative;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: default;
  transition: none;
  --result-max-media-height: min(68vh, 720px);
}

.generate-result:hover {
  transform: none;
  border-color: transparent;
  box-shadow: none;
}

.generate-result-media {
  position: relative;
  width: min(100%, var(--result-media-width, 720px));
  max-width: 100%;
  aspect-ratio: var(--result-aspect, 1 / 1);
  align-self: center;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: #050505;
  box-shadow:
    0 22px 68px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.generate-result:not(.video) .generate-result-media {
  cursor: zoom-in;
}

.generate-result img {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  object-fit: contain;
  background: #050505;
}

.generate-result.generating {
  width: min(100%, var(--result-media-width, 860px));
  align-self: center;
  aspect-ratio: var(--result-aspect, 16 / 9);
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 16px;
  cursor: wait;
  display: block;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.07), transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)),
    #202020;
  box-shadow:
    0 22px 68px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.generate-loading {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 0;
  display: block;
  padding: 0;
  overflow: hidden;
}

.generate-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent 0 34%, rgba(255, 255, 255, 0.045) 43%, rgba(255, 255, 255, 0.22) 50%, rgba(255, 255, 255, 0.045) 57%, transparent 66% 100%);
  transform: translateX(-100%);
  animation: sweep 1.15s ease-in-out infinite;
  pointer-events: none;
}

.generate-loading-inner {
  display: none;
}

.generate-spinner {
  display: none;
}

.generate-loading-text {
  position: absolute;
  left: 50%;
  right: auto;
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  min-height: 38px;
  max-width: calc(100% - 36px);
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(18, 18, 18, 0.66);
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  font-weight: 820;
  text-align: center;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.generate-loading-text small {
  display: none;
}

.generate-result.failed {
  width: min(100%, var(--result-media-width, 860px));
  align-self: center;
  aspect-ratio: var(--result-aspect, 16 / 9);
  min-height: 220px;
  overflow: hidden;
  border: 1px solid rgba(255, 136, 136, 0.24);
  border-radius: 16px;
  cursor: default;
  border-color: rgba(255, 136, 136, 0.24);
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 116, 116, 0.08), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)),
    #1b1b1d;
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.generate-result.failed:hover {
  transform: none;
  border-color: rgba(255, 136, 136, 0.26);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.generate-result.failed .generate-loading {
  min-height: 240px;
}

.generate-result.failed .generate-loading::after {
  display: none;
  animation: none;
}

.generate-result.failed .generate-loading-inner {
  width: min(142px, 60%);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.025);
  animation: none;
}

.generate-result.failed .generate-loading-inner::before {
  content: "!";
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 138, 138, 0.26);
  background: rgba(255, 110, 110, 0.1);
  color: rgba(255, 226, 226, 0.94);
  font-size: 18px;
  font-weight: 900;
}

.generate-result.failed .generate-loading-text {
  background: rgba(0, 0, 0, 0.36);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 238, 238, 0.92);
}

.generate-result.failed .generate-loading-text small {
  display: block;
  max-width: min(76vw, 640px);
  margin-top: 5px;
  color: rgba(255, 220, 220, 0.78);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

.generate-result[data-kind="video"].failed .generate-loading-text small {
  max-width: min(68vw, 560px);
}

@keyframes loading-breathe {
  0%, 100% { opacity: 0.72; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.generate-result-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.generate-result:hover .generate-result-actions {
  opacity: 1;
  transform: translateY(0);
}

.generate-result-action {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.generate-result-action:hover {
  background: rgba(255, 255, 255, 0.9);
  color: #111;
}

.generate-result-action svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.generate-result.video {
  cursor: default;
}

.generate-result.video.pending,
.generate-result[data-kind="video"].generating,
.generate-result[data-kind="video"].failed {
  width: min(100%, var(--result-media-width, 720px));
  height: var(--result-media-height, auto);
  flex: 0 0 auto;
  align-self: center;
  aspect-ratio: var(--result-aspect, 16 / 9);
  min-height: 0;
  overflow: hidden;
  border-radius: 16px;
}

.generate-result.video.pending,
.generate-result[data-kind="video"].generating {
  background:
    linear-gradient(135deg, rgba(85, 216, 194, 0.12), transparent 42%),
    linear-gradient(180deg, #25282d, #14161a);
}

.generate-result.video.pending .generate-loading,
.generate-result[data-kind="video"].generating .generate-loading {
  min-height: 260px;
}

.generate-result.video video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #050505;
}

.generate-result.video.ready {
  cursor: default;
}

.generate-result-meta {
  position: static;
  order: -1;
  align-self: flex-end;
  max-width: min(82%, 640px);
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px 18px 4px 18px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.88);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.35;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  word-break: break-word;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.16);
}

body.has-results .generate-view {
  padding-top: 94px;
  padding-bottom: 340px;
}

.rail-key,
.studio-key,
#keyModal,
body.key-setup-disabled .rail-key,
body.key-setup-disabled .studio-key,
body.key-setup-disabled #keyModal {
  display: none;
}

body.has-results .generate-welcome {
  opacity: 0;
  transform: translateY(-16px);
  pointer-events: none;
  margin-bottom: 0;
  height: 0;
}

.comic-workbench {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  overflow: hidden auto;
  padding: 72px 56px 48px;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.04), transparent 34%),
    radial-gradient(circle at 22% 18%, rgba(85, 216, 194, 0.14), transparent 34%),
    radial-gradient(circle at 86% 12%, rgba(255, 232, 125, 0.12), transparent 30%),
    #08090b;
  color: #f6f7f2;
}

body.view-comic .comic-workbench {
  display: block;
}

.comic-workbench::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 82%);
}

.comic-shell {
  position: relative;
  z-index: 1;
  width: min(1400px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(360px, 460px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.comic-panel,
.comic-preview {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025)),
    rgba(16, 17, 20, 0.92);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(18px);
}

.comic-panel {
  padding: 20px;
  display: grid;
  gap: 18px;
}

.comic-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.comic-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.comic-title strong {
  font-size: 24px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: 0;
}

.comic-title span,
.comic-label {
  color: rgba(246, 247, 242, 0.6);
  font-size: 12px;
  line-height: 1.5;
}

.comic-home {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
}

.comic-home svg,
.comic-ai-write svg,
.comic-upload svg,
.comic-generate svg,
.comic-result-action svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.comic-field {
  display: grid;
  gap: 8px;
}

.comic-field-head,
.comic-story-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.comic-story-count {
  color: rgba(246, 247, 242, 0.52);
  font-size: 12px;
  line-height: 1.5;
  text-align: right;
}

.comic-field textarea {
  width: 100%;
  min-height: 238px;
  resize: vertical;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(2, 3, 5, 0.58);
  color: #fff;
  font: 14px/1.6 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  outline: 0;
}

.comic-field textarea:focus {
  border-color: rgba(85, 216, 194, 0.58);
  box-shadow: 0 0 0 3px rgba(85, 216, 194, 0.12);
}

.comic-toolbar,
.comic-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.comic-upload,
.comic-ai-write,
.comic-ai-send,
.comic-ai-apply,
.comic-generate,
.comic-chip,
.comic-result-action {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.065);
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
}

.comic-upload,
.comic-ai-write,
.comic-ai-send,
.comic-ai-apply,
.comic-generate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 800;
}

.comic-upload:hover,
.comic-ai-write:hover,
.comic-ai-send:hover,
.comic-ai-apply:hover,
.comic-chip:hover,
.comic-result-action:hover,
.comic-home:hover {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.11);
}

.comic-ai-write {
  border-color: rgba(85, 216, 194, 0.24);
  color: rgba(195, 255, 244, 0.94);
}

.comic-ai-write:disabled {
  cursor: wait;
  opacity: 0.68;
}

.comic-ai-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(85, 216, 194, 0.18);
  border-radius: 8px;
  background: rgba(2, 3, 5, 0.42);
}

.comic-ai-panel[hidden] {
  display: none;
}

.comic-ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: rgba(195, 255, 244, 0.92);
  font-size: 13px;
  font-weight: 850;
}

.comic-ai-messages {
  display: grid;
  gap: 8px;
  max-height: 180px;
  overflow: auto;
  padding-right: 2px;
}

.comic-ai-message {
  padding: 9px 10px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.comic-ai-message.user {
  background: rgba(85, 216, 194, 0.12);
  color: rgba(229, 255, 250, 0.92);
}

.comic-ai-message.assistant {
  background: rgba(255, 255, 255, 0.06);
}

.comic-ai-input {
  width: 100%;
  min-height: 78px;
  resize: vertical;
  padding: 10px 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.34);
  color: #fff;
  font: 13px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  outline: 0;
}

.comic-ai-input:focus {
  border-color: rgba(85, 216, 194, 0.5);
  box-shadow: 0 0 0 3px rgba(85, 216, 194, 0.1);
}

.comic-ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.comic-ai-apply {
  border-color: rgba(255, 232, 125, 0.36);
  color: #fff2a6;
}

.comic-ai-send:disabled,
.comic-ai-apply:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.comic-generate {
  justify-content: center;
  width: 100%;
  height: 48px;
  border-color: rgba(85, 216, 194, 0.36);
  background: #55d8c2;
  color: #04110f;
  font-size: 15px;
}

.comic-generate:disabled {
  cursor: wait;
  opacity: 0.68;
}

.comic-options {
  display: grid;
  gap: 14px;
}

.comic-option-group {
  display: grid;
  gap: 8px;
}

.comic-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.comic-chip {
  padding: 0 13px;
  font-size: 12px;
  font-weight: 760;
}

.comic-chip.active {
  border-color: rgba(255, 232, 125, 0.52);
  background: rgba(255, 232, 125, 0.16);
  color: #fff2a6;
}

.comic-status {
  min-height: 20px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
  line-height: 1.45;
}

.comic-status.error {
  color: rgba(255, 177, 177, 0.92);
}

.comic-preview {
  min-height: calc(100vh - 120px);
  padding: 18px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
}

.comic-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px;
}

.comic-preview-title {
  display: grid;
  gap: 3px;
}

.comic-preview-title strong {
  font-size: 18px;
  font-weight: 880;
}

.comic-preview-title span {
  color: rgba(255, 255, 255, 0.52);
  font-size: 12px;
}

.comic-canvas {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
}

.comic-shotlist {
  display: grid;
  gap: 10px;
  align-content: start;
  overflow: auto;
  padding-right: 3px;
}

.comic-shot {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.comic-shot-num {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 232, 125, 0.16);
  color: #fff2a6;
  font-weight: 900;
  font-size: 13px;
}

.comic-shot strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 820;
  color: rgba(255, 255, 255, 0.9);
}

.comic-shot span {
  display: block;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  line-height: 1.45;
}

.comic-output {
  min-height: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    rgba(2, 3, 5, 0.46);
  background-size: 34px 34px;
  overflow: hidden;
}

.comic-output.has-results {
  place-items: start center;
  overflow: auto;
}

.comic-empty,
.comic-loading {
  width: min(460px, 86%);
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
  color: rgba(255, 255, 255, 0.58);
  font-size: 13px;
  line-height: 1.55;
}

.comic-empty-art {
  width: min(260px, 70%);
  aspect-ratio: 4 / 5;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  padding: 10px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-radius: 6px;
  transform: rotate(-2deg);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 16px 16px 0 rgba(255, 232, 125, 0.11);
}

.comic-empty-art span {
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-radius: 4px;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 232, 125, 0.28), transparent 26%),
    rgba(255, 255, 255, 0.045);
}

.comic-result {
  position: relative;
  width: min(100%, 760px);
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 18px;
}

.comic-result.comic-result-pages {
  width: 100%;
  max-width: 1080px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: start;
  justify-items: stretch;
}

.comic-page-result {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.comic-page-result.loading {
  min-height: 260px;
  align-content: center;
  justify-items: center;
  text-align: center;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  line-height: 1.55;
}

.comic-page-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 820;
}

.comic-result img {
  max-width: 100%;
  max-height: calc(100vh - 220px);
  display: block;
  border-radius: 6px;
  object-fit: contain;
  background: #050505;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.comic-result-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.comic-result-action {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
}

.comic-spinner {
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-top-color: #55d8c2;
  border-radius: 999px;
  animation: spin 0.9s linear infinite;
}

@media (max-width: 1100px) {
  .comic-workbench {
    padding: 60px 24px 36px;
  }

  .comic-shell,
  .comic-canvas {
    grid-template-columns: 1fr;
  }

  .comic-preview {
    min-height: auto;
  }

  .comic-shotlist {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .comic-workbench {
    padding: 24px 14px 28px;
  }

  .comic-shotlist {
    grid-template-columns: 1fr;
  }

  .comic-title strong {
    font-size: 21px;
  }
}

.canvas-zoom,
body.view-generate .ai-chat-view,
body.view-canvas .ai-chat-view,
body.view-comic .ai-chat-view {
  display: none !important;
}

body:not(.view-generate):not(.view-canvas):not(.view-chat):not(.view-comic):not(.director-embed-open) #app,
body:not(.view-generate):not(.view-canvas):not(.view-chat):not(.view-comic):not(.director-embed-open) .generate-view,
body:not(.view-generate):not(.view-canvas):not(.view-chat):not(.view-comic):not(.director-embed-open) .ai-chat-view,
body:not(.view-generate):not(.view-canvas):not(.view-chat):not(.view-comic):not(.director-embed-open) .comic-workbench,
body:not(.view-generate):not(.view-canvas):not(.view-chat):not(.view-comic):not(.director-embed-open) .studio-panel,
body:not(.view-generate):not(.view-canvas):not(.view-chat):not(.view-comic):not(.director-embed-open) .app-rail,
body:not(.view-generate):not(.view-canvas):not(.view-chat):not(.view-comic):not(.director-embed-open) .canvas-top-actions,
body:not(.view-generate):not(.view-canvas):not(.view-chat):not(.view-comic):not(.director-embed-open) .canvas-mode-switch,
body:not(.view-generate):not(.view-canvas):not(.view-chat):not(.view-comic):not(.director-embed-open) .canvas-account-menu,
body:not(.view-generate):not(.view-canvas):not(.view-chat):not(.view-comic):not(.director-embed-open) .canvas-chat-trigger,
body:not(.view-generate):not(.view-canvas):not(.view-chat):not(.view-comic):not(.director-embed-open) .canvas-chat-drawer,
body:not(.view-generate):not(.view-canvas):not(.view-chat):not(.view-comic):not(.director-embed-open) .drop-hint,
body:not(.view-generate):not(.view-canvas):not(.view-chat):not(.view-comic):not(.director-embed-open) .image-toolbar,
body:not(.view-generate):not(.view-canvas):not(.view-chat):not(.view-comic):not(.director-embed-open) .selection-shell {
  display: none !important;
}

body.view-generate #app,
body.view-generate .comic-workbench,
body.view-chat .entry-portal,
body.view-chat .app-rail,
body.view-chat #app,
body.view-chat .generate-view,
body.view-chat .comic-workbench,
body.view-chat .studio-panel,
body.view-chat .canvas-top-actions,
body.view-chat .canvas-mode-switch,
body.view-chat .canvas-account-menu,
body.view-chat .canvas-chat-trigger,
body.view-chat .canvas-chat-drawer,
body.view-chat .canvas-zoom,
body.view-chat .drop-hint,
body.view-chat .image-toolbar,
body.view-chat .selection-shell,
body.view-generate .canvas-zoom,
body.view-generate .drop-hint,
body.view-generate .image-toolbar,
body.view-generate .selection-shell,
body.view-comic .entry-portal,
body.view-comic #app,
body.view-comic .generate-view,
body.view-comic .studio-panel,
body.view-comic .canvas-top-actions,
body.view-comic .canvas-mode-switch,
body.view-comic .canvas-account-menu,
body.view-comic .canvas-chat-trigger,
body.view-comic .canvas-chat-drawer,
body.view-comic .canvas-zoom,
body.view-comic .drop-hint,
body.view-comic .image-toolbar,
body.view-comic .selection-shell {
  display: none !important;
}

body.view-canvas .generate-view,
body.view-canvas .comic-workbench,
body.view-canvas .studio-panel {
  display: none !important;
}

body.view-canvas #app {
  display: block;
}

.canvas-zoom {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 38;
  display: flex;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(24, 24, 24, 0.92);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(12px);
}

.canvas-zoom button {
  height: 34px;
  min-width: 62px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  font-weight: 840;
}

.video-node {
  cursor: default;
}

.video-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: auto;
  cursor: grab;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: #202020;
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.34);
  isolation: isolate;
  contain: paint;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.video-node.dragging .video-frame {
  cursor: grabbing;
}

.video-node-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  object-fit: cover;
  background: #050505;
  pointer-events: none;
}

.video-node.has-video .video-node-media {
  display: block;
}

.video-node.has-video .video-strip {
  display: none;
}

.video-node.has-video .video-frame {
  background: #050505;
}

.video-poster-overlay {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #050505;
  pointer-events: none;
  opacity: 1;
  visibility: visible;
  z-index: 2;
  transition: opacity 140ms ease, visibility 140ms ease;
}

.video-node.has-video .video-poster-overlay,
.gen-node.has-video .video-poster-overlay {
  display: block;
}

.video-poster-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.video-node-media,
.gen-preview video {
  z-index: 1;
}

.video-play,
.video-snapshot,
.video-progress,
.video-time,
.upload-replace-button {
  z-index: 4;
}

.video-strip {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 18px;
  opacity: 0.72;
}

.video-strip span {
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.035)),
    linear-gradient(135deg, rgba(45, 167, 231, 0.16), rgba(85, 216, 194, 0.08));
  animation: video-card-pulse 1.8s ease-in-out infinite;
}

.video-strip span:nth-child(2) {
  animation-delay: 0.18s;
}

.video-strip span:nth-child(3) {
  animation-delay: 0.36s;
}

.video-strip span:nth-child(4) {
  animation-delay: 0.54s;
}

@keyframes video-card-pulse {
  0%, 100% {
    opacity: 0.56;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

.video-play {
  position: absolute;
  left: 18px;
  top: auto;
  bottom: 18px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(18, 25, 14, 0.74);
  color: rgba(255, 255, 255, 0.96);
  cursor: pointer;
  transform: none;
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 140ms ease, transform 160ms ease, visibility 140ms ease;
}

.video-play:hover,
.video-snapshot:hover,
.video-download:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(18, 25, 14, 0.86);
}

.video-node.has-video .video-frame:hover .video-play,
.gen-node.has-video .gen-preview:hover .video-play,
.gen-node.selected.has-video .video-play {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.video-node.has-video.is-playing .video-play,
.gen-node.has-video.is-playing .video-play {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.gen-node.busy .video-play {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.video-progress {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 9px;
  height: 4px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.34);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
}

.video-node.has-video.is-playing .video-progress,
.gen-node.has-video.is-playing .video-progress,
.gen-node.has-video .gen-preview:hover .video-progress,
.gen-node.selected.has-video .video-progress {
  opacity: 1;
  pointer-events: auto;
}

.video-progress-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.95);
}

.video-snapshot {
  position: absolute;
  left: auto;
  right: 18px;
  bottom: 18px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(18, 25, 14, 0.74);
  color: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  opacity: 0;
  cursor: pointer;
  pointer-events: none;
  transition: opacity 140ms ease, transform 160ms ease, border-color 140ms ease, background 140ms ease;
}

.video-node.has-video .video-frame:hover .video-snapshot,
.video-node.has-video .video-frame:hover .video-download,
.video-node.has-video.is-playing .video-snapshot,
.video-node.has-video.is-playing .video-download,
.gen-node.has-video .gen-preview:hover .video-snapshot,
.gen-node.has-video .gen-preview:hover .video-download,
.gen-node.selected.has-video .video-snapshot,
.gen-node.selected.has-video .video-download,
.gen-node.has-video.is-playing .video-snapshot,
.gen-node.has-video.is-playing .video-download {
  opacity: 1;
  pointer-events: auto;
}


.video-node.has-video .video-download,
.gen-node.has-video .video-download {
  opacity: 1;
  pointer-events: auto;
}

.video-snapshot svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.video-time {
  position: absolute;
  right: 58px;
  bottom: 22px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(18, 25, 14, 0.74);
  color: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}

.video-node.has-video.is-playing .video-time,
.gen-node.has-video.is-playing .video-time,
.gen-node.has-video .gen-preview:hover .video-time,
.gen-node.selected.has-video .video-time {
  opacity: 1;
}

.video-play svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  transform: translateX(2px);
}

.video-play .pause-icon {
  display: none;
}

.video-node.has-video.is-playing .video-play svg,
.gen-node.has-video.is-playing .video-play svg {
  transform: none;
}

.video-node.has-video.is-playing .video-play .play-icon,
.gen-node.has-video.is-playing .video-play .play-icon {
  display: none;
}

.video-node.has-video.is-playing .video-play .pause-icon,
.gen-node.has-video.is-playing .video-play .pause-icon {
  display: block;
}

.video-meta {
  display: none;
}

.video-model {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 820;
}

.video-prompt {
  max-height: 64px;
  overflow: hidden;
  color: #fff;
  font-size: 15px;
  font-weight: 760;
  line-height: 1.38;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.video-char-count {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  pointer-events: none;
  white-space: nowrap;
}

.video-char-count:empty {
  display: none;
}

.gen-char-count {
  color: #a5a5a5;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  margin-left: auto;
  padding-right: 4px;
}

.gen-char-count:empty {
  display: none;
}

.video-node.selected .video-frame {
  border-color: rgba(255, 255, 255, 0.58);
  box-shadow:
    0 18px 58px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(255, 255, 255, 0.16),
    0 0 28px rgba(85, 216, 194, 0.18);
}

.audio-node {
  cursor: default;
}

.audio-card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 34px 38px 30px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, rgba(24, 24, 25, 0.96), rgba(12, 12, 13, 0.96));
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  pointer-events: auto;
}

.audio-node.selected .audio-card {
  border-color: rgba(255, 255, 255, 0.58);
  box-shadow:
    0 18px 58px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(255, 255, 255, 0.16);
}

.audio-card .audio-name {
  position: absolute;
  left: 26px;
  top: 20px;
  right: 26px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 760;
  color: rgba(255, 255, 255, 0.72);
}

.audio-card audio {
  display: none;
}

.audio-wave {
  width: 100%;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 10px;
  cursor: pointer;
}

.audio-wave span {
  width: 10px;
  height: calc(16px + var(--bar, 0.5) * 80px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  transition: background 120ms ease, transform 120ms ease, opacity 120ms ease;
}

.audio-wave span.done {
  background: rgba(255, 255, 255, 0.68);
}

.audio-wave span.active {
  width: 8px;
  height: 138px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.44));
  box-shadow: none;
}

.audio-controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 36px;
}

.audio-play {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.94);
  color: #111;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
  pointer-events: none;
}

.audio-play svg {
  width: 25px;
  height: 25px;
  fill: currentColor;
  transform: translateX(1px);
}

.audio-node.is-playing .audio-play svg {
  transform: none;
}

.audio-time {
  position: absolute;
  right: 26px;
  bottom: 22px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 15px;
  font-weight: 720;
}

.studio-generate-bar .studio-count-current {
  height: 42px;
  min-width: 78px;
  border-radius: 999px;
}

.studio-generate-bar .studio-count-popover {
  left: 50%;
  transform: translateX(-50%);
}

.image-node > .node-title,
.audio-node > .node-title,
.grid-frame-node > .node-title {
  left: 0;
  top: -34px;
  transform: none;
}

.gen-node > .node-title {
  left: var(--gen-title-left, 140px);
  top: -28px;
  transform: none;
}

body.multi-selected .image-toolbar:not(.below) {
  display: none !important;
}

body.multi-selected .image-toolbar.below {
  display: none !important;
}

@media (min-width: 821px) {
  body.view-generate .studio-panel {
    top: auto;
    bottom: 36px;
    width: min(700px, calc(100vw - 220px));
    height: 236px;
    min-height: 236px;
    max-height: none;
    gap: 0;
    padding: 0;
    border-radius: 28px;
    overflow: visible;
    background:
      radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.08), transparent 34%),
      linear-gradient(180deg, rgba(34, 34, 34, 0.98), rgba(17, 17, 17, 0.98));
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow:
      0 18px 52px rgba(0, 0, 0, 0.52),
      0 0 0 1px rgba(255, 255, 255, 0.035),
      inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px) saturate(1.12);
    -webkit-backdrop-filter: blur(18px) saturate(1.12);
    transform: translateX(-50%);
  }

  body.view-generate .studio-panel .studio-scroll,
  body.view-generate .studio-panel .studio-section:has(.studio-prompt),
  body.view-generate .studio-panel .studio-section:has(.studio-ref-bar),
  body.view-generate .studio-panel .studio-prompt,
  body.view-generate .studio-panel .studio-ref,
  body.view-generate .studio-panel .studio-audio-ref.is-video,
  body.view-generate .studio-panel .studio-upload {
    transition: all 260ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  body.view-generate .studio-panel:hover {
    background:
      radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.1), transparent 34%),
      linear-gradient(180deg, rgba(38, 38, 38, 0.99), rgba(15, 15, 15, 0.99));
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow:
      0 22px 60px rgba(0, 0, 0, 0.58),
      0 0 30px rgba(255, 255, 255, 0.055),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }

  body.view-generate .studio-scroll {
    position: relative;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 100%;
    min-height: 236px;
    overflow: visible;
    padding: 176px 20px 18px;
  }

  body.view-generate .studio-section {
    display: none;
    min-width: 0;
    margin: 0;
  }

  body.view-generate .studio-section:has(.studio-prompt),
  body.view-generate .studio-section:has(.studio-ref-bar),
  body.view-generate .studio-section:has(#studioMode),
  body.view-generate .studio-section:has(#studioModels),
  body.view-generate .studio-section:has(#studioRatios),
  body.view-generate .studio-section:has(#studioQualities) {
    display: block;
  }

  body.view-generate .studio-section:has(.studio-prompt) {
    position: absolute;
    left: 20px;
    right: 20px;
    top: 72px;
    z-index: 4;
    min-width: 0;
  }

  body.view-generate .studio-section:has(.studio-ref-bar) {
    position: absolute;
    left: 18px;
    right: 18px;
    top: 18px;
    z-index: 32;
    min-width: 0;
  }

  body.view-generate .studio-section:has(#studioMode) {
    order: 2;
    flex: 0 0 92px;
    width: 92px;
    min-height: 36px;
  }

  body.view-generate .studio-section:has(#studioModels) {
    order: 1;
    position: relative;
    flex: 0 0 auto;
    width: max-content;
    min-height: 36px;
  }

  body.view-generate .studio-section:has(#studioVideoReferenceMode) {
    display: none !important;
  }

  body.view-generate .studio-section:has(#studioRatios) {
    order: 3;
    position: relative;
    flex: 0 0 72px;
    width: 72px;
    min-height: 36px;
  }

  body.view-generate .studio-section:has(#studioQualities) {
    order: 4;
    position: relative;
    flex: 0 0 78px;
    width: 78px;
    min-height: 36px;
  }

  body.view-generate .studio-section:has(#studioCounts) {
    display: none;
  }

  body.view-generate .studio-section:has(.studio-utility-grid),
  body.view-generate #studioComposeSection,
  body.view-generate .studio-status {
    display: none !important;
  }

  body.view-generate .studio-label,
  body.view-generate .studio-head,
  body.view-generate .studio-status {
    display: none;
  }

  body.view-generate .studio-prompt {
    width: 100%;
    height: 74px;
    min-height: 74px;
    max-height: 74px;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0 42px 0 0;
    color: #f5f5f5;
    font-size: 18px;
    line-height: 1.38;
    box-shadow: none;
  }

  body.view-generate .studio-prompt-expand {
    right: -2px;
    top: -4px;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background:
      linear-gradient(180deg, rgba(64, 66, 70, 0.72), rgba(20, 21, 23, 0.68));
    color: rgba(255, 255, 255, 0.78);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.14),
      0 10px 24px rgba(0, 0, 0, 0.34);
  }

  body.view-generate .studio-prompt::placeholder {
    color: #8a8a8a;
  }

  body.view-generate .studio-prompt:focus {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
  }

  body.view-generate .studio-ref-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 44px;
    min-height: 44px;
    min-width: 0;
    padding-right: 0;
  }

  body.view-generate .studio-upload {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background:
      linear-gradient(180deg, rgba(64, 66, 70, 0.72), rgba(20, 21, 23, 0.68));
    color: #d8d8d8;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.16),
      0 12px 28px rgba(0, 0, 0, 0.36);
  }

  body.view-generate .studio-upload:hover {
    background:
      linear-gradient(180deg, rgba(82, 84, 88, 0.8), rgba(24, 25, 27, 0.72));
    border-color: rgba(255, 255, 255, 0.24);
    color: #fff;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.24),
      0 15px 34px rgba(0, 0, 0, 0.42),
      0 0 20px rgba(255, 255, 255, 0.08);
  }

  body.view-generate .studio-ref-list,
  body.view-generate .studio-audio-list {
    min-height: 44px;
    max-height: 44px;
    padding: 0;
    max-width: 492px;
  }

  body.view-generate .studio-ref {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  body.view-generate .studio-audio-ref {
    width: 178px;
    height: 40px;
    border-radius: 12px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  body.view-generate .studio-audio-ref.is-audio {
    width: 220px;
    height: 58px;
    padding-bottom: 28px;
  }

  body.view-generate .studio-audio-ref audio {
    height: 22px;
  }

  body.view-generate .studio-model-list {
    position: relative;
    left: auto;
    bottom: auto;
    width: max-content;
    min-width: 0;
    overflow: visible;
  }

  body.view-generate .studio-model {
    min-height: 36px;
    height: 36px;
    width: max-content;
    max-width: 176px;
    grid-template-columns: 18px minmax(0, auto) 16px;
    border-radius: 999px;
    background:
      linear-gradient(180deg, rgba(42, 44, 47, 0.72), rgba(12, 13, 15, 0.62));
    border-color: rgba(255, 255, 255, 0.16);
    color: #f2f2f2;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.16),
      0 10px 24px rgba(0, 0, 0, 0.32);
  }

  body.view-generate .studio-model.active {
    background:
      linear-gradient(180deg, rgba(48, 50, 54, 0.78), rgba(14, 15, 18, 0.66));
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.18),
      0 12px 26px rgba(0, 0, 0, 0.34);
  }

  body.view-generate .studio-model-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 112px;
  }

  body.view-generate .studio-model-list.open {
    width: max-content;
    min-width: 0;
    max-height: none;
    overflow: visible;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    z-index: 90;
  }

  body.view-generate .studio-model-list.open::before {
    content: "";
    position: absolute;
    left: var(--studio-popover-left, 0);
    bottom: 46px;
    width: min(270px, calc(100vw - 48px));
    height: var(--studio-open-height, 190px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    background:
      radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.08), transparent 36%),
      linear-gradient(180deg, rgba(31, 33, 37, 0.98), rgba(14, 15, 18, 0.98));
    box-shadow:
      0 18px 44px rgba(0, 0, 0, 0.42),
      inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px) saturate(1.08);
    -webkit-backdrop-filter: blur(16px) saturate(1.08);
    pointer-events: none;
    z-index: 90;
  }

  body.view-generate .studio-model-list.open .studio-model:not(.active) {
    position: absolute;
    left: var(--studio-popover-left, 0);
    bottom: calc(52px + var(--studio-option-index, 0) * 46px);
    width: min(270px, calc(100vw - 48px));
    height: 40px;
    min-height: 40px;
    border-radius: 15px;
    z-index: 91;
  }

  body.view-generate .studio-model-list.open .studio-model.active {
    height: 38px;
    min-height: 38px;
    border-radius: 999px;
    position: relative;
    z-index: 92;
  }

  body.view-generate .studio-section:has(#studioModels):has(.studio-model-list.open) {
    z-index: 98;
  }

  body.view-generate .studio-segment {
    height: 36px;
    padding: 0;
    border-radius: 999px;
    background:
      linear-gradient(180deg, rgba(42, 44, 47, 0.72), rgba(12, 13, 15, 0.62));
    border-color: rgba(255, 255, 255, 0.16);
    grid-template-columns: 1fr 1fr;
    width: 92px;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.16),
      0 10px 24px rgba(0, 0, 0, 0.32);
  }

  body.view-generate .studio-segment button {
    height: 34px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 13px;
    white-space: nowrap;
  }

  body.view-generate .studio-segment button.active {
    background: rgba(245, 245, 245, 0.94);
    color: #101010;
  }

  body.view-generate .studio-grid-options {
    position: absolute;
    left: 0;
    bottom: 0;
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 0;
    max-width: none;
    min-width: 0;
    overflow: visible;
  }

  body.view-generate .studio-chip {
    display: none;
    align-items: center;
    justify-content: center;
    height: 36px;
    min-width: 0;
    width: 100%;
    padding: 0 9px;
    border-radius: 999px;
    background:
      linear-gradient(180deg, rgba(42, 44, 47, 0.72), rgba(12, 13, 15, 0.62));
    border-color: rgba(255, 255, 255, 0.16);
    color: #f2f2f2;
    font-size: 13px;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.16),
      0 10px 24px rgba(0, 0, 0, 0.32);
  }

  body.view-generate .studio-chip.active {
    display: inline-flex;
    background:
      linear-gradient(180deg, rgba(48, 50, 54, 0.78), rgba(14, 15, 18, 0.66));
    border-color: rgba(255, 255, 255, 0.2);
    color: #f2f2f2;
  }

  body.view-generate .studio-grid-options.open {
    width: 100%;
    max-height: none;
    overflow: visible;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    z-index: 90;
  }

  body.view-generate .studio-grid-options.open::before {
    content: "";
    position: absolute;
    left: var(--studio-popover-left, 0);
    bottom: 42px;
    width: max(86px, 100%);
    height: var(--studio-open-height, 190px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    background:
      radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.08), transparent 36%),
      linear-gradient(180deg, rgba(31, 33, 37, 0.98), rgba(14, 15, 18, 0.98));
    box-shadow:
      0 18px 44px rgba(0, 0, 0, 0.42),
      inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px) saturate(1.08);
    -webkit-backdrop-filter: blur(16px) saturate(1.08);
    pointer-events: none;
    z-index: 90;
  }

  body.view-generate .studio-grid-options.open .studio-chip:not(.active) {
    position: absolute;
    left: var(--studio-popover-left, 0);
    bottom: calc(52px + var(--studio-option-index, 0) * 46px);
    display: inline-flex;
    width: max(86px, 100%);
    min-width: 86px;
    justify-content: flex-start;
    border-radius: 12px;
    background: rgba(24, 26, 31, 0.98);
    border-color: rgba(255, 255, 255, 0.13);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(14px);
    z-index: 91;
  }

  body.view-generate .studio-grid-options.open .studio-chip:not(.active):hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }

  body.view-generate .studio-grid-options.open .studio-chip.active {
    background: rgba(245, 245, 245, 0.95);
    color: #101010;
    position: relative;
    z-index: 92;
  }

  body.view-generate .studio-generate-bar {
    order: 10;
    position: static;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
    z-index: 24;
  }

  body.view-generate .studio-generate-bar::before {
    content: none;
  }

  body.view-generate .studio-count-current {
    height: 36px;
    min-width: 54px;
    border-radius: 999px;
    background:
      linear-gradient(180deg, rgba(42, 44, 47, 0.72), rgba(12, 13, 15, 0.62));
    border-color: rgba(255, 255, 255, 0.16);
    color: #f2f2f2;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.16),
      0 10px 24px rgba(0, 0, 0, 0.32);
  }

  body.view-generate .studio-count-popover {
    position: absolute;
    left: var(--studio-popover-left, 50%);
    right: auto;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
  }

  body.view-generate .studio-cost {
    height: 36px;
    min-width: 60px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.075);
    border-color: rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.08),
      0 10px 24px rgba(0, 0, 0, 0.22);
  }

  body.view-generate .studio-generate {
    width: 46px;
    min-width: 46px;
    height: 46px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(42, 44, 47, 0.72), rgba(12, 13, 15, 0.62));
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.86);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.16),
      0 10px 24px rgba(0, 0, 0, 0.32);
  }

  body.view-generate .studio-generate:hover {
    background: linear-gradient(180deg, rgba(52, 54, 58, 0.8), rgba(16, 17, 20, 0.68));
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.24),
      0 12px 28px rgba(0, 0, 0, 0.36);
  }

  body.view-generate .studio-generate svg {
    color: rgba(255, 255, 255, 0.9);
  }

  body.view-generate .generate-view {
    padding-bottom: 340px;
  }
}

  @media (max-width: 820px) {
  html,
  body {
    overflow: auto;
  }

  .app-rail {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: auto;
    height: 68px;
    min-height: 0;
    flex-direction: row;
    justify-content: center;
    gap: 10px;
    padding: 8px max(14px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    border-right: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 -14px 42px rgba(0, 0, 0, 0.28);
    opacity: 1;
    pointer-events: auto;
    transform: none;
    overflow: visible;
  }

.app-rail:hover,
.app-rail.expanded {
  width: auto;
  height: 68px;
  padding: 8px max(14px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  transform: none;
}

  .rail-toggle {
    display: none;
  }

  .rail-logo {
    display: none;
  }

  .rail-item {
    width: min(68px, 22vw);
    min-height: 50px;
    border-radius: 12px;
    padding: 0;
    justify-content: center;
  }

  .rail-item span {
    font-size: 11px;
  }

  .studio-panel {
    left: 12px;
    right: 12px;
    bottom: calc(80px + env(safe-area-inset-bottom));
    top: auto;
    width: auto;
    max-height: min(74vh, 620px);
    min-height: 0;
    border-radius: 20px;
    transform: none;
    overflow: hidden;
  }

  .studio-grid-options {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .studio-grid-options::-webkit-scrollbar {
    display: none;
  }

  .studio-scroll {
    overflow: auto;
  }

  body.has-results .studio-panel {
    bottom: calc(80px + env(safe-area-inset-bottom));
    transform: none;
  }

  .generate-view {
    padding: 10vh 14px 250px;
  }

  .generate-results {
    width: 100%;
    gap: 30px;
  }

  body.has-results .generate-view {
    padding-top: 24px;
    padding-bottom: calc(332px + env(safe-area-inset-bottom));
  }

  .generate-welcome {
    font-size: 25px;
    margin-bottom: 18px;
  }

  .preview-modal {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .preview-stage,
  .preview-side {
    height: auto;
    border-radius: 16px;
  }

  .preview-stage {
    min-height: 55vh;
  }

  .preview-side {
    max-height: 30vh;
    overflow: auto;
    border-left: 0;
  }

  .drop-hint {
    display: none;
  }
}

/* Polished editor surfaces: shared by large canvas overlays and compact action bars. */
.angle-editor,
.annotation-toolbar,
.crop-actions,
.outpaint-editor .crop-actions,
.preview-side,
.context-menu,
.project-modal-card,
.share-dialog {
  border-color: rgba(255, 255, 255, 0.16) !important;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.08), transparent 38%),
    linear-gradient(180deg, rgba(31, 31, 33, 0.96), rgba(17, 17, 18, 0.94)) !important;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(18px);
}

.angle-editor {
  width: min(720px, calc(100vw - 32px)) !important;
  height: min(384px, calc(100vh - 32px)) !important;
  border-radius: 22px !important;
  overflow: hidden;
  animation: editor-rise 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.angle-editor::after {
  content: none !important;
}

.angle-stage {
  left: 22px !important;
  top: 76px !important;
  width: 352px !important;
  height: 268px !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  border-radius: 18px !important;
  background:
    radial-gradient(circle at 48% 45%, rgba(255, 255, 255, 0.105), transparent 34%),
    linear-gradient(180deg, rgba(35, 35, 36, 0.8), rgba(20, 20, 21, 0.76)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 16px 42px rgba(0, 0, 0, 0.28);
}

.angle-beam {
  display: none !important;
}

.angle-controls {
  right: 28px !important;
  top: 96px !important;
  width: 290px !important;
  gap: 16px !important;
  padding: 18px !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  border-radius: 17px !important;
  background: rgba(255, 255, 255, 0.055) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 16px 42px rgba(0, 0, 0, 0.24) !important;
}

.angle-row-v {
  grid-template-columns: 78px 1fr 54px !important;
  gap: 14px !important;
  color: rgba(255, 255, 255, 0.64) !important;
}

.angle-row-v input[type="range"],
.annotation-toolbar input[type="range"] {
  appearance: none;
  height: 4px !important;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,0.9), rgba(255,255,255,0.18));
  outline: none;
}

.angle-row-v input[type="range"]::-webkit-slider-thumb,
.annotation-toolbar input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: #f7f7f7;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.angle-row-v input[type="range"]::-moz-range-thumb,
.annotation-toolbar input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: #f7f7f7;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.angle-close,
.angle-reset,
.angle-submit,
.annotation-toolbar button,
.mode-button,
.preview-use,
.preview-download,
.context-menu button,
.studio-generate,
.send-button {
  transition:
    transform 150ms cubic-bezier(0.16, 1, 0.3, 1),
    background 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    color 150ms ease;
}

.angle-close:hover,
.angle-reset:hover,
.annotation-toolbar button:hover,
.mode-button:hover,
.preview-use:hover,
.preview-download:hover,
.context-menu button:hover,
.studio-generate:hover,
.send-button:hover {
  transform: translateY(-1px);
}

.angle-close {
  right: 18px !important;
  top: 16px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.angle-reset {
  left: 22px !important;
  bottom: 22px !important;
  height: 36px !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  background: rgba(255, 255, 255, 0.075) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.angle-submit,
.mode-button.primary,
.annotation-toolbar [data-annot-action="save"],
.preview-download {
  border: 0 !important;
  background: linear-gradient(180deg, #ffffff, #e9eef4) !important;
  color: #0d0e11 !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 14px 32px rgba(255, 255, 255, 0.09),
    0 14px 34px rgba(0, 0, 0, 0.28) !important;
}

.angle-submit:hover,
.mode-button.primary:hover,
.annotation-toolbar [data-annot-action="save"]:hover,
.preview-download:hover {
  background: #fff !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 18px 40px rgba(255, 255, 255, 0.12),
    0 18px 42px rgba(0, 0, 0, 0.34) !important;
}

.annotation-editor {
  background: rgba(0, 0, 0, 0.64) !important;
  backdrop-filter: blur(18px);
}

.annotation-toolbar {
  padding: 9px 12px !important;
  border-radius: 20px !important;
  gap: 8px !important;
  animation: editor-rise 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.annotation-toolbar button {
  border: 1px solid transparent !important;
  background: rgba(255, 255, 255, 0.055) !important;
}

.annotation-toolbar button.active {
  border-color: rgba(85, 216, 194, 0.38) !important;
  background: rgba(85, 216, 194, 0.12) !important;
  color: #fff !important;
  box-shadow: 0 0 24px rgba(85, 216, 194, 0.08);
}

.annotation-toolbar input[type="color"] {
  width: 36px !important;
  height: 36px !important;
  border: 2px solid rgba(255, 255, 255, 0.58) !important;
  border-radius: 14px !important;
  padding: 3px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.045),
    0 8px 22px rgba(0, 0, 0, 0.24),
    0 0 0 1px rgba(255, 255, 255, 0.04) !important;
}

.annotation-stage {
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.04) !important;
}

.crop-actions {
  bottom: 34px !important;
  padding: 9px 11px !important;
  border-radius: 999px !important;
  gap: 8px !important;
  animation: editor-rise 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.mode-button {
  min-width: 48px;
  border: 1px solid transparent !important;
  background: transparent !important;
}

.mode-button:not(.primary):hover {
  border-color: rgba(255, 255, 255, 0.16) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
}

.mode-button.active {
  border-color: rgba(85, 216, 194, 0.24) !important;
  background: rgba(85, 216, 194, 0.12) !important;
  color: #fff !important;
  box-shadow: 0 0 22px rgba(85, 216, 194, 0.08);
}

.preview-modal {
  grid-template-columns: minmax(0, 1fr) 256px !important;
  padding: 24px !important;
  background: rgba(0, 0, 0, 0.58) !important;
  gap: 0 !important;
}

.preview-stage {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-right: 0;
  min-width: 0;
  box-sizing: border-box;
  background:
    radial-gradient(circle at 48% 42%, rgba(255, 255, 255, 0.06), transparent 38%),
    rgba(18, 19, 21, 0.82) !important;
}

.preview-stage img {
  max-width: calc(100% - 28px) !important;
  max-height: calc(100% - 28px) !important;
}

.preview-side {
  width: 256px;
  box-sizing: border-box;
  margin-left: 0 !important;
  padding: 22px !important;
  gap: 16px !important;
}

.preview-prompt,
.preview-info {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.045) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.context-menu {
  transform-origin: top left;
}

.context-menu.visible {
  display: block;
  animation: context-pop 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.context-menu button {
  border: 1px solid transparent;
}

.context-menu button:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.09) !important;
}

.canvas-open-feedback {
  position: fixed;
  z-index: 98;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(circle, rgba(255,255,255,0.20) 0 28%, transparent 29%),
    radial-gradient(circle, rgba(85,216,194,0.26), transparent 62%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  transform: translate(-50%, -50%) scale(0.45);
  opacity: 0;
  animation: click-ripple 560ms ease-out forwards;
}

.studio-upload.busy-feedback,
.project-current.busy-feedback {
  animation: busy-feedback 760ms ease-in-out infinite;
}

.studio-generate {
  width: 42px !important;
  min-width: 42px !important;
  height: 42px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.13) !important;
  color: rgba(255, 255, 255, 0.9) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 0 22px rgba(255,255,255,0.08) !important;
}

.studio-generate::before {
  content: none !important;
}

.studio-generate svg {
  width: 18px !important;
  height: 18px !important;
}

.studio-generate:hover {
  background: rgba(255, 255, 255, 0.22) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    0 0 26px rgba(255,255,255,0.1) !important;
}

.send-button {
  width: 46px !important;
  min-width: 46px !important;
  height: 38px !important;
  padding: 0 !important;
  gap: 0 !important;
  border-radius: 15px !important;
  background: rgba(255, 255, 255, 0.075) !important;
  color: #f4f4f4 !important;
  border-color: rgba(255, 255, 255, 0.13) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 0 22px rgba(255,255,255,0.08) !important;
}

.send-button::before {
  content: none !important;
}

.send-button:hover {
  background: rgba(255, 255, 255, 0.14) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 0 26px rgba(255,255,255,0.1) !important;
}

.send-button .send-arrow,
.send-button .send-arrow svg {
  color: #f4f4f4 !important;
}

.canvas-action-pill,
.canvas-icon-action,
.history-btn,
.side-rail-btn,
.project-current,
.tool-btn,
.panel-icon-button,
.bottom-chip,
.ratio-current,
.reference-mode-current,
.quality-current,
.count-current,
.grid-cell-download,
.selection-actions button {
  background:
    linear-gradient(180deg, rgba(42, 44, 47, 0.72), rgba(12, 13, 15, 0.62)) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  color: rgba(255, 255, 255, 0.94) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.28),
    0 12px 30px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(0, 0, 0, 0.18) !important;
  backdrop-filter: blur(24px) saturate(1.35) brightness(0.86) !important;
  -webkit-backdrop-filter: blur(24px) saturate(1.35) brightness(0.86) !important;
}

.canvas-action-pill:hover,
.canvas-icon-action:hover,
.history-btn:hover,
.side-rail-btn:hover,
.project-current:hover,
.tool-btn:hover,
.panel-icon-button:hover,
button.bottom-chip:hover,
.model-menu.open .bottom-chip,
.ratio-current:hover,
.ratio-menu.open .ratio-current,
.reference-mode-current:hover,
.reference-mode-menu.open .reference-mode-current,
.quality-current:hover,
.quality-menu.open .quality-current,
.count-current:hover,
.count-menu.open .count-current,
.grid-cell-download:hover,
.selection-actions button:hover {
  background:
    linear-gradient(180deg, rgba(74, 77, 82, 0.78), rgba(18, 20, 23, 0.66)) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  color: #fff !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3),
    0 16px 36px rgba(0, 0, 0, 0.48),
    0 0 22px rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(30px) saturate(1.55) brightness(0.9) !important;
  -webkit-backdrop-filter: blur(30px) saturate(1.55) brightness(0.9) !important;
}

.project-current,
.canvas-action-pill,
.side-rail-btn,
.history-btn {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.72);
}

.gen-panel,
.studio-panel {
  transition:
    transform 160ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.gen-panel:hover,
body:not(.view-generate) .studio-panel:hover {
  transform: translateY(-1px);
}

.gen-node.ratio-resizing {
  transition: height 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.gen-node.ratio-resizing .gen-preview {
  transition:
    left 220ms cubic-bezier(0.16, 1, 0.3, 1),
    width 220ms cubic-bezier(0.16, 1, 0.3, 1),
    height 220ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.gen-node.ratio-resizing .gen-panel {
  transition:
    top 220ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 160ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.gen-node.ratio-resizing > .node-title {
  transition: left 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.gen-node.ratio-resizing .node-port {
  transition:
    left 220ms cubic-bezier(0.16, 1, 0.3, 1),
    top 220ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 160ms ease,
    transform 180ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.gen-node.screen-readable-panel {
  z-index: 18;
}

.gen-node.screen-readable-panel .gen-panel {
  left: var(--gen-panel-screen-left, 0px);
  top: var(--gen-panel-screen-top, var(--gen-panel-top));
  transform: scale(var(--gen-panel-screen-scale, 1));
  transform-origin: 50% 0;
}

.gen-node.screen-readable-panel .gen-panel:hover {
  transform: scale(var(--gen-panel-screen-scale, 1)) translateY(-1px);
}

.canvas-node.center-pop {
  animation: center-node-pop 520ms cubic-bezier(0.2, 1.5, 0.32, 1);
}

.angle-stage.dragging .angle-card {
  box-shadow:
    0 30px 64px rgba(0, 0, 0, 0.48),
    0 0 34px rgba(255, 255, 255, 0.045);
}

.crop-handle {
  background: #f7f7f7 !important;
  border-color: rgba(14, 15, 18, 0.84) !important;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.8),
    0 8px 22px rgba(0, 0, 0, 0.42) !important;
}

.crop-box {
  border-color: rgba(255, 255, 255, 0.96) !important;
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.50),
    0 0 0 1px rgba(85, 216, 194, 0.32),
    0 0 36px rgba(85, 216, 194, 0.14) !important;
}

@keyframes editor-rise {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes context-pop {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes center-node-pop {
  0% {
    transform: scale(0.972);
    filter: brightness(1);
  }
  44% {
    transform: scale(1.038);
    filter: brightness(1.14);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes click-ripple {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.45);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.35);
  }
}

@keyframes busy-feedback {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 0 0 rgba(85,216,194,0);
  }
  50% {
    transform: translateY(-1px);
    box-shadow: 0 0 22px rgba(85,216,194,0.22);
  }
}

@media (max-width: 820px) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    background: #090a0c;
  }

  body.force-mobile-preview .app-rail,
  body.force-mobile-preview .rail-toggle,
  body.force-mobile-preview #app,
  body.force-mobile-preview #grid,
  body.force-mobile-preview #connections,
  body.force-mobile-preview #world,
  body.force-mobile-preview .canvas-zoom,
  body.force-mobile-preview .drop-hint,
  body.force-mobile-preview .drop-overlay,
  body.force-mobile-preview .image-toolbar,
  body.force-mobile-preview .edit-toolbar,
  body.force-mobile-preview .selection-shell,
  body.force-mobile-preview .canvas-mode-switch,
  body.force-mobile-preview .canvas-top-actions,
  body.force-mobile-preview .project-switcher,
  body.force-mobile-preview .history-toggle,
  body.force-mobile-preview .side-rail-btn,
  body.force-mobile-preview .canvas-chat-button,
  body.force-mobile-preview .canvas-chat-drawer {
    display: none !important;
  }

  body.force-mobile-preview.view-canvas .generate-view,
  body.force-mobile-preview.view-generate .generate-view {
    display: flex !important;
  }

  body.force-mobile-preview.view-canvas .studio-panel,
    body.force-mobile-preview.view-generate .studio-panel {
    display: flex !important;
  }

  .generate-view {
    inset: 0 !important;
    align-items: center;
    justify-content: center;
    padding: max(24px, env(safe-area-inset-top)) 18px calc(258px + env(safe-area-inset-bottom)) !important;
    overflow: hidden auto;
    background: #17191c;
    -webkit-overflow-scrolling: touch;
  }

  .generate-view::before {
    background:
      linear-gradient(105deg, transparent 0%, transparent 34%, rgba(255, 255, 255, 0.08) 45%, rgba(255, 255, 255, 0.022) 54%, transparent 66%, transparent 100%),
      radial-gradient(circle at 16% 18%, rgba(105, 116, 130, 0.2), transparent 36%),
      radial-gradient(circle at 78% 30%, rgba(76, 90, 104, 0.16), transparent 38%),
      radial-gradient(circle at 52% 88%, rgba(118, 124, 134, 0.12), transparent 42%),
      linear-gradient(120deg, #181a1e 0%, #25282d 38%, #16181b 70%, #282b30 100%);
    background-size: 180% 100%, 155% 155%, 150% 150%, 165% 165%, 230% 230%;
    animation: generate-bg-flow 36s ease-in-out infinite alternate;
  }

  .generate-view::after {
    opacity: 0.5;
    background-size: 44px 44px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.54), rgba(0, 0, 0, 0.18));
  }

  .generate-welcome {
    width: 100%;
    max-width: 360px;
    margin: 0 auto 18px;
    font-size: 25px;
    line-height: 1.2;
    text-align: center;
  }

  body.has-results .generate-welcome {
    display: none;
  }

  .generate-results {
    width: 100%;
    max-width: 420px;
    gap: 24px;
    margin: 0;
  }

  .generate-result {
    min-height: 0;
    --result-max-media-height: min(62vh, 560px);
  }

  .generate-loading {
    min-height: 220px;
  }

  .generate-result:hover {
    transform: none;
  }

  .generate-result-actions {
    opacity: 1;
    transform: none;
  }

  .studio-panel {
    left: 12px !important;
    right: 12px !important;
    bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    top: auto !important;
    width: auto !important;
    height: 236px !important;
    min-height: 0 !important;
    max-height: 236px !important;
    padding: 12px 13px !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 24px !important;
    overflow: hidden;
    transform: none !important;
    background:
      radial-gradient(circle at 16% 0%, rgba(255, 255, 255, 0.08), transparent 38%),
      linear-gradient(180deg, rgba(34, 34, 34, 0.98), rgba(16, 16, 17, 0.98));
    box-shadow:
      0 18px 52px rgba(0, 0, 0, 0.52),
      0 0 0 1px rgba(255, 255, 255, 0.035),
      inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }

  body.has-results .studio-panel {
    bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    transform: none !important;
  }

  .studio-head,
  .studio-label,
  .studio-section:has(.studio-utility-grid),
  #studioComposeSection,
  .studio-status {
    display: none !important;
  }

  .studio-scroll {
    display: grid !important;
    grid-template-columns: 38px 92px minmax(116px, 1fr) 58px;
    grid-template-rows: 88px 36px 48px;
    align-items: center;
    gap: 10px 8px;
    height: 100%;
    max-height: none;
    overflow: hidden;
    padding: 0 !important;
  }

  .studio-section {
    display: none !important;
    min-width: 0;
    margin: 0;
  }

  .studio-section:has(.studio-prompt),
  .studio-section:has(.studio-ref-bar),
  .studio-section:has(#studioMode),
  .studio-section:has(#studioModels),
  .studio-section:has(#studioRatios),
  .studio-section:has(#studioQualities),
  .studio-section:has(#studioCounts) {
    display: block !important;
  }

  .studio-section:has(.studio-prompt) {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .studio-section:has(.studio-ref-bar) {
    grid-column: 1;
    grid-row: 2;
    width: auto !important;
    min-width: 0 !important;
  }

  .studio-section:has(#studioMode) {
    grid-column: 2;
    grid-row: 2;
    width: auto !important;
    min-width: 0 !important;
  }

  .studio-section:has(#studioModels) {
    grid-column: 3;
    grid-row: 2;
    width: auto !important;
    min-width: 112px !important;
  }

  .studio-section:has(#studioRatios) {
    grid-column: 4;
    grid-row: 2;
    width: auto !important;
    min-width: 0 !important;
  }

  .studio-section:has(#studioQualities) {
    grid-column: 1;
    grid-row: 3;
    width: auto !important;
    min-width: 0 !important;
  }

  .studio-section:has(#studioCounts) {
    display: none !important;
    width: auto !important;
    min-width: 0 !important;
  }

  .studio-prompt {
    width: 100%;
    height: 88px !important;
    min-height: 88px !important;
    max-height: 88px !important;
    padding: 12px 14px !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 20px !important;
    background: rgba(0, 0, 0, 0.22) !important;
    font-size: 15px !important;
    line-height: 1.4 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
  }

  .studio-ref-bar {
    display: flex !important;
    align-items: center;
    gap: 6px;
    min-width: 0;
    height: 36px;
  }

  .studio-upload {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 14px;
  }

  .studio-ref-list,
  .studio-audio-list {
    display: none !important;
    min-height: 38px;
    max-height: 38px;
    max-width: 86px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .studio-ref-list::-webkit-scrollbar,
  .studio-audio-list::-webkit-scrollbar {
    display: none;
  }

  .studio-ref {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .studio-segment {
    width: 100%;
    height: 36px;
    grid-template-columns: 1fr 1fr;
    padding: 0;
    border-radius: 999px;
    background:
      linear-gradient(180deg, rgba(42, 44, 47, 0.72), rgba(12, 13, 15, 0.62));
    border-color: rgba(255, 255, 255, 0.16);
  }

  .studio-segment button {
    height: 34px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 13px;
    white-space: nowrap;
  }

  .studio-model-list {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .studio-model {
    min-height: 36px;
    height: 36px;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    border-radius: 999px;
  }

  .studio-model-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .studio-model-list.open {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(276px + env(safe-area-inset-bottom));
    width: auto !important;
    max-height: min(42vh, 320px);
    z-index: 96;
    overflow-y: auto;
  }

  .studio-grid-options {
    display: inline-flex !important;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
  }

  .studio-chip {
    display: none;
    align-items: center;
    justify-content: center;
    height: 36px;
    min-width: 0;
    width: 100%;
    padding: 0 10px;
    border-radius: 999px;
    white-space: nowrap;
  }

  .studio-chip.active {
    display: inline-flex !important;
  }

  .studio-grid-options.open {
    position: fixed;
    left: 12px;
    bottom: calc(276px + env(safe-area-inset-bottom));
    display: grid !important;
    gap: 5px;
    width: max-content;
    min-width: 112px;
    max-width: calc(100vw - 24px);
    max-height: min(42vh, 320px);
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 18px;
    overflow-y: auto;
    background: rgba(24, 26, 31, 0.98);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(14px);
    z-index: 96;
  }

  .studio-grid-options.open .studio-chip {
    display: inline-flex !important;
    width: 100%;
    justify-content: flex-start;
    border-radius: 12px;
  }

  .studio-generate-bar {
    grid-column: 2 / -1;
    grid-row: 3;
    position: static !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    width: 100% !important;
    display: flex !important;
    align-items: center;
    justify-content: flex-start !important;
    gap: 8px;
    min-width: 0;
    margin: 0 !important;
    overflow: visible;
    padding-bottom: 1px;
    z-index: 1 !important;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .studio-generate-bar::-webkit-scrollbar {
    display: none;
  }

  .studio-generate-bar::before {
    content: none !important;
  }

  .studio-credits,
  .studio-cost,
  .studio-count-current {
    height: 36px;
    border-radius: 999px;
    flex: 0 0 auto;
  }

  .studio-credits {
    display: none !important;
  }

  .studio-cost {
    min-width: 54px;
    padding: 0 8px;
    font-size: 13px;
  }

  .studio-count-menu {
    flex: 0 0 auto;
  }

  .studio-count-current {
    min-width: 58px;
    justify-content: center;
  }

  .studio-count-popover {
    right: 72px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    z-index: 96;
  }

  .studio-generate {
    width: 48px !important;
    min-width: 48px !important;
    height: 48px !important;
    margin-left: auto !important;
    border-radius: 999px !important;
    background: #f3f5f7 !important;
    color: #0d0e11 !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.8),
      0 14px 32px rgba(0, 0, 0, 0.32) !important;
  }

  .studio-generate svg {
    width: 20px !important;
    height: 20px !important;
    color: #0d0e11 !important;
  }

  .preview-modal {
    grid-template-columns: 1fr !important;
    padding: 10px !important;
  }

  .preview-stage {
    min-height: 58vh;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px 18px 0 0;
  }

  .preview-side {
    width: 100%;
    max-height: 32vh;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0 0 18px 18px;
    overflow: auto;
  }
}

@media (max-width: 820px) {
  .canvas-chat-trigger {
    display: none !important;
  }

  .generate-view {
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 20vh 16px 270px !important;
    background: #17191c !important;
  }

  .generate-view::before {
    background:
      linear-gradient(105deg, transparent 0%, transparent 34%, rgba(255, 255, 255, 0.08) 45%, rgba(255, 255, 255, 0.022) 54%, transparent 66%, transparent 100%),
      radial-gradient(circle at 16% 18%, rgba(105, 116, 130, 0.2), transparent 36%),
      radial-gradient(circle at 78% 30%, rgba(76, 90, 104, 0.16), transparent 38%),
      radial-gradient(circle at 52% 88%, rgba(118, 124, 134, 0.12), transparent 42%),
      linear-gradient(120deg, #181a1e 0%, #25282d 38%, #16181b 70%, #282b30 100%) !important;
  }

  .generate-view::after {
    opacity: 1 !important;
    background-image:
      linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px) !important;
    background-size: 44px 44px !important;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.34) 58%, rgba(0, 0, 0, 0.18)) !important;
  }

  .generate-welcome {
    width: 100% !important;
    max-width: none !important;
    margin: 0 auto 26px !important;
    font-size: 25px !important;
    line-height: 1.18 !important;
    text-align: center !important;
  }

  body.view-generate .studio-panel {
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    bottom: calc(16px + env(safe-area-inset-bottom)) !important;
    width: min(700px, calc(100vw - 22px)) !important;
    height: 236px !important;
    min-height: 236px !important;
    max-height: 236px !important;
    gap: 0 !important;
    padding: 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 28px !important;
    overflow: hidden !important;
    background:
      radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.08), transparent 34%),
      linear-gradient(180deg, rgba(34, 34, 34, 0.98), rgba(17, 17, 17, 0.98)) !important;
    box-shadow:
      0 18px 52px rgba(0, 0, 0, 0.52),
      0 0 0 1px rgba(255, 255, 255, 0.035),
      inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
    transform: translateX(-50%) !important;
  }

  body.has-results.view-generate .studio-panel {
    bottom: calc(16px + env(safe-area-inset-bottom)) !important;
    transform: translateX(-50%) !important;
  }

  body.view-generate .studio-scroll {
    position: relative !important;
    display: flex !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 236px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 182px 14px 16px !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch;
  }

  body.view-generate .studio-scroll::-webkit-scrollbar {
    display: none;
  }

  body.view-generate .studio-section {
    display: none !important;
    position: static !important;
    min-width: 0 !important;
    width: auto !important;
    margin: 0 !important;
  }

  body.view-generate .studio-section:has(.studio-prompt),
  body.view-generate .studio-section:has(.studio-ref-bar),
  body.view-generate .studio-section:has(#studioMode),
  body.view-generate .studio-section:has(#studioModels),
  body.view-generate .studio-section:has(#studioRatios),
  body.view-generate .studio-section:has(#studioQualities) {
    display: block !important;
  }

  body.view-generate .studio-section:has(.studio-prompt) {
    position: absolute !important;
    left: 20px !important;
    right: 20px !important;
    top: 72px !important;
    z-index: 4 !important;
  }

  body.view-generate .studio-section:has(.studio-ref-bar) {
    position: absolute !important;
    left: 18px !important;
    right: 18px !important;
    top: 18px !important;
    z-index: 32 !important;
  }

  body.view-generate .studio-section:has(#studioModels) {
    order: 1 !important;
    flex: 0 0 auto !important;
    width: max-content !important;
    min-height: 36px !important;
  }

  body.view-generate .studio-section:has(#studioMode) {
    order: 2 !important;
    flex: 0 0 92px !important;
    width: 92px !important;
    min-height: 36px !important;
  }

  body.view-generate .studio-section:has(#studioRatios),
  body.view-generate .studio-section:has(#studioQualities) {
    position: relative !important;
    flex: 0 0 72px !important;
    width: 72px !important;
    min-height: 36px !important;
  }

  body.view-generate .studio-section:has(#studioRatios) {
    order: 3 !important;
  }

  body.view-generate .studio-section:has(#studioQualities) {
    order: 4 !important;
  }

  body.view-generate .studio-prompt {
    width: 100% !important;
    height: 74px !important;
    min-height: 74px !important;
    max-height: 74px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding: 0 !important;
    color: #f5f5f5 !important;
    font-size: 18px !important;
    line-height: 1.38 !important;
    box-shadow: none !important;
  }

  body.view-generate .studio-ref-bar {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    height: 44px !important;
    min-height: 44px !important;
  }

  body.view-generate .studio-upload {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    border-radius: 12px !important;
  }

  body.view-generate .studio-ref-list,
  body.view-generate .studio-audio-list {
    display: flex !important;
    min-height: 44px !important;
    max-height: 44px !important;
    max-width: 250px !important;
  }

  body.view-generate .studio-model-list {
    position: static !important;
    width: max-content !important;
    min-width: 0 !important;
    overflow: visible !important;
  }

  body.view-generate .studio-model-list.open {
    position: static !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: max-content !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    z-index: 90 !important;
  }

  body.view-generate .studio-model-list.open .studio-model:not(.active) {
    position: absolute !important;
    left: var(--studio-popover-left, 0) !important;
    bottom: calc(42px + var(--studio-option-index, 0) * 42px) !important;
    width: min(270px, calc(100vw - 48px)) !important;
    height: 38px !important;
    min-height: 38px !important;
    border-radius: 14px !important;
    overflow: visible !important;
    z-index: 91 !important;
  }

  body.view-generate .studio-model {
    height: 36px !important;
    min-height: 36px !important;
    width: max-content !important;
    max-width: 176px !important;
    grid-template-columns: 18px minmax(0, auto) 16px !important;
    border-radius: 999px !important;
  }

  body.view-generate .studio-model-name {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 112px !important;
  }

  body.view-generate .studio-segment {
    width: 92px !important;
    height: 36px !important;
    padding: 0 !important;
    border-radius: 999px !important;
    grid-template-columns: 1fr 1fr !important;
  }

  body.view-generate .studio-segment button {
    height: 34px !important;
    padding: 0 6px !important;
    border-radius: 999px !important;
    font-size: 13px !important;
    white-space: nowrap !important;
  }

  body.view-generate .studio-grid-options {
    position: static !important;
    display: inline-flex !important;
    width: 72px !important;
    max-width: none !important;
    overflow: visible !important;
  }

  body.view-generate .studio-grid-options.open {
    position: static !important;
    left: auto !important;
    bottom: auto !important;
    display: inline-flex !important;
    width: 72px !important;
    min-width: 0 !important;
    max-width: none !important;
    overflow: visible !important;
    z-index: 90 !important;
  }

  body.view-generate .studio-grid-options.open::before {
    width: max(86px, 100%) !important;
    height: var(--studio-open-height, 232px) !important;
  }

  body.view-generate .studio-grid-options.open .studio-chip:not(.active) {
    position: absolute !important;
    left: var(--studio-popover-left, 0) !important;
    bottom: calc(52px + var(--studio-option-index, 0) * 46px) !important;
    display: inline-flex !important;
    width: max(86px, 100%) !important;
    min-width: 86px !important;
    justify-content: flex-start !important;
    border-radius: 12px !important;
    background: rgba(24, 26, 31, 0.98) !important;
    border-color: rgba(255, 255, 255, 0.13) !important;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42) !important;
    backdrop-filter: blur(14px);
    z-index: 91 !important;
  }

  body.view-generate .studio-chip {
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    height: 36px !important;
    min-width: 0 !important;
    width: 100% !important;
    padding: 0 9px !important;
    border-radius: 999px !important;
    font-size: 13px !important;
  }

  body.view-generate .studio-chip.active {
    display: inline-flex !important;
  }

  body.view-generate .studio-grid-options.open .studio-chip {
    display: inline-flex !important;
    justify-content: flex-start !important;
    border-radius: 12px !important;
  }

  body.view-generate .studio-grid-options.open .studio-chip.active {
    position: relative !important;
    z-index: 92 !important;
  }

  body.view-generate .studio-generate-bar {
    order: 5 !important;
    position: static !important;
    flex: 0 0 auto !important;
    width: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    margin: 0 !important;
    overflow: visible !important;
    z-index: 24 !important;
  }

  body.view-generate .studio-credits {
    display: none !important;
  }

  body.view-generate .studio-cost {
    height: 36px !important;
    min-width: 60px !important;
    padding: 0 10px !important;
    border-radius: 999px !important;
    font-size: 13px !important;
  }

  body.view-generate .studio-count-current {
    height: 36px !important;
    min-width: 54px !important;
    border-radius: 999px !important;
  }

  body.view-generate .studio-count-popover {
    bottom: calc(250px + env(safe-area-inset-bottom)) !important;
  }

  body.view-generate .studio-generate {
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    margin-left: 0 !important;
    border-radius: 999px !important;
  }
}

body.force-mobile-preview {
  --mobile-preview-width: min(390px, 100vw);
  overflow: hidden !important;
  background: #f4f6f9 !important;
}

body.force-mobile-preview .app-rail,
body.force-mobile-preview .rail-toggle,
body.force-mobile-preview #app,
body.force-mobile-preview #grid,
body.force-mobile-preview #connections,
body.force-mobile-preview #world,
body.force-mobile-preview .canvas-zoom,
body.force-mobile-preview .drop-hint,
body.force-mobile-preview .drop-overlay,
body.force-mobile-preview .image-toolbar,
body.force-mobile-preview .edit-toolbar,
body.force-mobile-preview .selection-shell,
body.force-mobile-preview .canvas-mode-switch,
body.force-mobile-preview .canvas-top-actions,
body.force-mobile-preview .project-switcher,
body.force-mobile-preview .history-toggle,
body.force-mobile-preview .canvas-chat-trigger,
body.force-mobile-preview .canvas-chat-drawer {
  display: none !important;
}

body.force-mobile-preview .generate-view {
  inset: 0 auto 0 50% !important;
  width: var(--mobile-preview-width) !important;
  transform: translateX(-50%) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  padding: 20vh 16px 270px !important;
  overflow: hidden auto !important;
  background: #17191c !important;
}

body.force-mobile-preview .generate-view::before {
  background:
    linear-gradient(105deg, transparent 0%, transparent 34%, rgba(255, 255, 255, 0.08) 45%, rgba(255, 255, 255, 0.022) 54%, transparent 66%, transparent 100%),
    radial-gradient(circle at 16% 18%, rgba(105, 116, 130, 0.2), transparent 36%),
    radial-gradient(circle at 78% 30%, rgba(76, 90, 104, 0.16), transparent 38%),
    radial-gradient(circle at 52% 88%, rgba(118, 124, 134, 0.12), transparent 42%),
    linear-gradient(120deg, #181a1e 0%, #25282d 38%, #16181b 70%, #282b30 100%) !important;
}

body.force-mobile-preview .generate-view::after {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px) !important;
  background-size: 44px 44px !important;
}

body.force-mobile-preview .generate-welcome {
  width: 100% !important;
  margin: 0 auto 26px !important;
  font-size: 25px !important;
  line-height: 1.18 !important;
  text-align: center !important;
}

body.force-mobile-preview.view-generate .studio-panel,
body.force-mobile-preview.view-canvas .studio-panel {
  left: 50% !important;
  right: auto !important;
  top: auto !important;
  bottom: calc(16px + env(safe-area-inset-bottom)) !important;
  width: calc(var(--mobile-preview-width) - 22px) !important;
  height: 236px !important;
  min-height: 236px !important;
  max-height: 236px !important;
  display: flex !important;
  gap: 0 !important;
  padding: 0 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 28px !important;
  overflow: hidden !important;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(34, 34, 34, 0.98), rgba(17, 17, 17, 0.98)) !important;
  box-shadow:
    0 18px 52px rgba(0, 0, 0, 0.52),
    0 0 0 1px rgba(255, 255, 255, 0.035),
    inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  transform: translateX(-50%) !important;
}

body.force-mobile-preview.view-generate .studio-scroll,
body.force-mobile-preview.view-canvas .studio-scroll {
  position: relative !important;
  display: flex !important;
  grid-template-columns: none !important;
  grid-template-rows: none !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 236px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding: 182px 14px 16px !important;
  scrollbar-width: none !important;
  -webkit-overflow-scrolling: touch;
}

body.force-mobile-preview .studio-scroll::-webkit-scrollbar {
  display: none;
}

body.force-mobile-preview.view-generate .studio-section,
body.force-mobile-preview.view-canvas .studio-section {
  display: none !important;
  position: static !important;
  min-width: 0 !important;
  width: auto !important;
  margin: 0 !important;
}

body.force-mobile-preview .studio-section:has(.studio-prompt),
body.force-mobile-preview .studio-section:has(.studio-ref-bar),
body.force-mobile-preview .studio-section:has(#studioMode),
body.force-mobile-preview .studio-section:has(#studioModels),
body.force-mobile-preview .studio-section:has(#studioRatios),
body.force-mobile-preview .studio-section:has(#studioQualities) {
  display: block !important;
}

body.force-mobile-preview .studio-section:has(.studio-prompt) {
  position: absolute !important;
  left: 20px !important;
  right: 20px !important;
  top: 72px !important;
  z-index: 4 !important;
}

body.force-mobile-preview .studio-section:has(.studio-ref-bar) {
  position: absolute !important;
  left: 18px !important;
  right: 18px !important;
  top: 18px !important;
  z-index: 32 !important;
}

  body.force-mobile-preview .studio-section:has(#studioModels) {
    order: 1 !important;
    flex: 0 0 182px !important;
    width: 182px !important;
    min-height: 36px !important;
  }

body.force-mobile-preview .studio-section:has(#studioMode) {
  order: 2 !important;
  flex: 0 0 92px !important;
  width: 92px !important;
  min-height: 36px !important;
}

  body.force-mobile-preview .studio-section:has(#studioRatios),
  body.force-mobile-preview .studio-section:has(#studioQualities) {
    position: relative !important;
    flex: 0 0 72px !important;
    width: 72px !important;
    min-height: 36px !important;
  }

body.force-mobile-preview .studio-section:has(#studioRatios) {
  order: 3 !important;
}

body.force-mobile-preview .studio-section:has(#studioQualities) {
  order: 4 !important;
}

body.force-mobile-preview .studio-prompt {
  width: 100% !important;
  height: 74px !important;
  min-height: 74px !important;
  max-height: 74px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  color: #f5f5f5 !important;
  font-size: 18px !important;
  line-height: 1.38 !important;
  box-shadow: none !important;
}

body.force-mobile-preview .studio-ref-bar {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  height: 44px !important;
  min-height: 44px !important;
}

body.force-mobile-preview .studio-upload {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  border-radius: 12px !important;
}

body.force-mobile-preview .studio-ref-list,
body.force-mobile-preview .studio-audio-list {
  display: flex !important;
  min-height: 44px !important;
  max-height: 44px !important;
  max-width: 250px !important;
}

  body.force-mobile-preview .studio-model-list {
    position: static !important;
    width: 182px !important;
    min-width: 182px !important;
    overflow: visible !important;
  }

body.force-mobile-preview .studio-model {
  height: 36px !important;
  min-height: 36px !important;
  border-radius: 999px !important;
}

body.force-mobile-preview .studio-model-name {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body.force-mobile-preview .studio-segment {
  width: 92px !important;
  height: 36px !important;
  padding: 0 !important;
  border-radius: 999px !important;
  grid-template-columns: 1fr 1fr !important;
}

body.force-mobile-preview .studio-segment button {
  height: 34px !important;
  padding: 0 6px !important;
  border-radius: 999px !important;
  font-size: 13px !important;
  white-space: nowrap !important;
}

  body.force-mobile-preview .studio-grid-options {
    position: static !important;
    display: inline-flex !important;
    width: 72px !important;
    max-width: none !important;
    overflow: visible !important;
  }

body.force-mobile-preview .studio-chip {
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  height: 36px !important;
  min-width: 0 !important;
  width: 100% !important;
  padding: 0 9px !important;
  border-radius: 999px !important;
  font-size: 13px !important;
}

body.force-mobile-preview .studio-chip.active {
  display: inline-flex !important;
}

body.force-mobile-preview .studio-generate-bar {
  order: 5 !important;
  position: static !important;
  flex: 0 0 auto !important;
  width: auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  margin: 0 !important;
  overflow: visible !important;
  z-index: 24 !important;
}

body.force-mobile-preview .studio-credits {
  display: none !important;
}

body.force-mobile-preview .studio-cost {
  height: 36px !important;
  min-width: 60px !important;
  padding: 0 10px !important;
  border-radius: 999px !important;
  font-size: 13px !important;
}

body.force-mobile-preview .studio-count-current {
  height: 36px !important;
  min-width: 54px !important;
  border-radius: 999px !important;
}

body.force-mobile-preview .studio-generate {
  width: 46px !important;
  min-width: 46px !important;
  height: 46px !important;
  margin-left: 0 !important;
  border-radius: 999px !important;
}

@media (max-width: 820px) {
  body.view-generate .studio-scroll > .studio-section:nth-of-type(1) {
    grid-column: 1 / 3 !important;
    grid-row: 3 !important;
    width: 100% !important;
    min-width: 0 !important;
    display: block !important;
  }

  body.view-generate .studio-scroll > .studio-section:nth-of-type(2) {
    grid-column: 3 !important;
    grid-row: 3 !important;
    width: 96px !important;
    min-width: 0 !important;
    display: block !important;
  }

  body.view-generate .studio-scroll > .studio-section:nth-of-type(3) {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    width: 100% !important;
    min-width: 0 !important;
    display: block !important;
  }

  body.view-generate .studio-scroll > .studio-section:nth-of-type(4) {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 44px !important;
    min-width: 0 !important;
    display: block !important;
  }

  body.view-generate .studio-scroll > .studio-section:nth-of-type(5) {
    grid-column: 1 !important;
    grid-row: 4 !important;
    width: 62px !important;
    min-width: 0 !important;
    display: block !important;
  }

  body.view-generate .studio-scroll > .studio-section:nth-of-type(6) {
    grid-column: 2 !important;
    grid-row: 4 !important;
    width: 74px !important;
    min-width: 0 !important;
    display: block !important;
  }

  body.view-generate .studio-scroll > .studio-section:nth-of-type(7) {
    display: none !important;
  }

  body.view-generate .studio-panel {
    height: 286px !important;
    min-height: 286px !important;
    max-height: 286px !important;
    overflow: visible !important;
  }

  body.view-generate .studio-scroll {
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) 96px;
    grid-template-rows: 44px 82px 40px 46px;
    gap: 10px 8px !important;
    min-height: 286px !important;
    height: 286px !important;
    overflow: visible !important;
    padding: 18px 14px 16px !important;
  }

  body.view-generate .studio-section:has(.studio-ref-bar) {
    position: static !important;
    grid-column: 1;
    grid-row: 1;
  }

  body.view-generate .studio-section:has(.studio-prompt) {
    position: static !important;
    grid-column: 1 / -1;
    grid-row: 2;
  }

  body.view-generate .studio-section:has(#studioModels) {
    grid-column: 1 / 3;
    grid-row: 3;
    width: max-content !important;
    min-width: 0 !important;
    flex: none !important;
  }

  body.view-generate .studio-section:has(#studioMode) {
    grid-column: 3;
    grid-row: 3;
    width: 96px !important;
    flex: none !important;
  }

  body.view-generate .studio-section:has(#studioRatios) {
    grid-column: 1;
    grid-row: 4;
    width: 62px !important;
    flex: none !important;
  }

  body.view-generate .studio-section:has(#studioQualities) {
    grid-column: 2;
    grid-row: 4;
    width: 74px !important;
    flex: none !important;
  }

  body.view-generate .studio-section:has(#studioCounts) {
    display: none !important;
  }

  body.view-generate .studio-ref-bar {
    height: 44px !important;
    min-height: 44px !important;
  }

  body.view-generate .studio-upload {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
  }

  body.view-generate .studio-ref-list,
  body.view-generate .studio-audio-list {
    display: none !important;
  }

  body.view-generate .studio-prompt {
    height: 82px !important;
    min-height: 82px !important;
    max-height: 82px !important;
    font-size: 17px !important;
    line-height: 1.42 !important;
  }

  body.view-generate .studio-model-list {
    width: max-content !important;
    min-width: 0 !important;
  }

  body.view-generate .studio-model.active {
    width: max-content !important;
    max-width: 168px !important;
    grid-template-columns: 18px minmax(0, auto) 16px !important;
  }

  body.view-generate .studio-model.active .studio-model-name {
    max-width: 104px !important;
  }

  body.view-generate .studio-segment {
    width: 96px !important;
  }

  body.view-generate .studio-grid-options {
    width: 100% !important;
  }

  body.view-generate .studio-generate-bar {
    grid-column: 2 / -1 !important;
    grid-row: 4 !important;
    justify-self: stretch;
    width: 100% !important;
    display: grid !important;
    grid-template-columns: minmax(54px, auto) minmax(54px, auto) 46px;
    gap: 6px !important;
    overflow: visible !important;
  }

  body.view-generate .studio-cost {
    min-width: 0 !important;
    width: 100% !important;
    padding: 0 8px !important;
  }

  body.view-generate .studio-count-current {
    min-width: 0 !important;
    width: 100% !important;
  }

  body.view-generate .studio-generate {
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
  }

  body.view-generate .generate-view {
    padding-bottom: calc(332px + env(safe-area-inset-bottom)) !important;
  }
}
/* Canvas polish overrides for compact glass controls. */
.app-rail {
  background:
    linear-gradient(90deg, rgba(22, 23, 26, 0.66), rgba(16, 17, 20, 0.48) 66%, rgba(11, 12, 14, 0.32)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012)),
    rgba(13, 14, 16, 0.42) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow:
    inset 1px 0 0 rgba(255, 255, 255, 0.05),
    18px 0 58px rgba(0, 0, 0, 0.2) !important;
  -webkit-backdrop-filter: blur(24px) saturate(1.08) brightness(0.8);
  backdrop-filter: blur(24px) saturate(1.08) brightness(0.8);
}

.app-rail.expanded,
.app-rail:hover {
  background:
    linear-gradient(90deg, rgba(22, 23, 26, 0.68), rgba(17, 18, 21, 0.52) 64%, rgba(12, 13, 15, 0.34)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012)),
    rgba(15, 16, 18, 0.44) !important;
  border-right-color: rgba(255, 255, 255, 0.13) !important;
  box-shadow:
    inset 1px 0 0 rgba(255, 255, 255, 0.055),
    18px 0 58px rgba(0, 0, 0, 0.2) !important;
  -webkit-backdrop-filter: blur(24px) saturate(1.08) brightness(0.78);
  backdrop-filter: blur(24px) saturate(1.08) brightness(0.78);
}

body.theme-light {
  color-scheme: light;
  --bg: #f4f6f9;
  --text: #171a20;
  --muted: #626a78;
  --line: rgba(17, 24, 39, 0.12);
}

body.theme-light #app {
  background: #f4f6f9;
}

body.theme-light .app-rail,
body.theme-light .app-rail.expanded,
body.theme-light .app-rail:hover {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.5) 66%, rgba(255, 255, 255, 0.34)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.18)),
    rgba(244, 247, 251, 0.52) !important;
  border-right-color: rgba(17, 24, 39, 0.12) !important;
  box-shadow:
    inset 1px 0 0 rgba(255, 255, 255, 0.68),
    18px 0 58px rgba(39, 49, 66, 0.14) !important;
  -webkit-backdrop-filter: blur(24px) saturate(1.18);
  backdrop-filter: blur(24px) saturate(1.18);
}

.app-rail .rail-item {
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: rgba(255, 255, 255, 0.045) !important;
  color: rgba(255, 255, 255, 0.74) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
  transition:
    width 180ms cubic-bezier(0.16, 1, 0.3, 1),
    justify-content 180ms ease,
    padding 180ms ease,
    background 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.app-rail .rail-item:hover,
.app-rail .rail-item.active,
.app-rail:hover .rail-item:hover,
.app-rail.expanded .rail-item:hover,
.app-rail:hover .rail-item.active,
.app-rail.expanded .rail-item.active {
  background: rgba(255, 255, 255, 0.13) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: #fff !important;
  box-shadow:
    0 0 24px rgba(255, 255, 255, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
  transform: translateY(-1px);
}

body.theme-light .app-rail .rail-item {
  border-color: rgba(17, 24, 39, 0.11) !important;
  background: rgba(255, 255, 255, 0.42) !important;
  color: rgba(20, 24, 31, 0.76) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72) !important;
}

body.theme-light .app-rail .rail-item:hover,
body.theme-light .app-rail .rail-item.active,
body.theme-light .app-rail:hover .rail-item:hover,
body.theme-light .app-rail.expanded .rail-item:hover,
body.theme-light .app-rail:hover .rail-item.active,
body.theme-light .app-rail.expanded .rail-item.active {
  background: rgba(255, 255, 255, 0.76) !important;
  border-color: rgba(17, 24, 39, 0.18) !important;
  color: #11141a !important;
  box-shadow:
    0 0 24px rgba(31, 41, 55, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.86) !important;
}

.canvas-action-pill,
.canvas-icon-action,
.history-btn,
.side-rail-btn,
.project-current {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.02)),
    rgba(18, 18, 18, 0.9) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: rgba(255, 255, 255, 0.9) !important;
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  -webkit-backdrop-filter: blur(14px) saturate(1.06);
  backdrop-filter: blur(14px) saturate(1.06);
}

.canvas-mode-switch {
  gap: 3px !important;
  padding: 3px !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.02)),
    rgba(18, 18, 18, 0.9) !important;
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  -webkit-backdrop-filter: blur(14px) saturate(1.06);
  backdrop-filter: blur(14px) saturate(1.06);
  overflow: hidden;
}

.canvas-mode-switch button {
  height: 32px !important;
  width: var(--mode-button-width) !important;
  min-width: var(--mode-button-width) !important;
  padding: 0 12px !important;
  border-radius: 9px !important;
  border: 0 !important;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.82) !important;
  box-shadow: none !important;
  transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.canvas-mode-switch button:focus,
.canvas-mode-switch button:focus-visible {
  outline: none !important;
}

.canvas-mode-switch button.active {
  background: transparent !important;
  color: #fff !important;
  box-shadow: none !important;
}

.canvas-mode-switch button:hover {
  background: rgba(255, 255, 255, 0.13) !important;
  color: #fff !important;
}

.canvas-action-pill:hover,
.canvas-icon-action:hover,
.history-btn:hover,
.side-rail-btn:hover,
.project-current:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.115), rgba(255, 255, 255, 0.04)),
    rgba(26, 26, 26, 0.96) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  box-shadow:
    0 16px 42px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}

body.theme-light .canvas-action-pill,
body.theme-light .canvas-icon-action,
body.theme-light .history-btn,
body.theme-light .project-current {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.42)),
    rgba(246, 248, 251, 0.64) !important;
  border-color: rgba(17, 24, 39, 0.13) !important;
  color: rgba(18, 22, 28, 0.84) !important;
  box-shadow:
    0 16px 44px rgba(39, 49, 66, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.82) !important;
}

body.theme-light .canvas-mode-switch {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.42)),
    rgba(246, 248, 251, 0.64) !important;
  border-color: rgba(17, 24, 39, 0.13) !important;
  box-shadow:
    0 16px 44px rgba(39, 49, 66, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.82) !important;
}

body.theme-light .canvas-mode-switch button {
  color: rgba(18, 22, 28, 0.72) !important;
}

body.theme-light .canvas-mode-switch button.active,
body.theme-light .canvas-mode-switch button:hover,
body.theme-light .canvas-action-pill:hover,
body.theme-light .canvas-icon-action:hover,
body.theme-light .history-btn:hover,
body.theme-light .project-current:hover {
  background: rgba(255, 255, 255, 0.82) !important;
  border-color: rgba(17, 24, 39, 0.18) !important;
  color: #11141a !important;
  box-shadow:
    0 18px 48px rgba(39, 49, 66, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

.gen-panel .panel-actions {
  gap: 6px !important;
  padding: 2px !important;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025)),
    rgba(8, 9, 12, 0.58);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    0 8px 22px rgba(0, 0, 0, 0.2);
}

.gen-credit-cost {
  min-width: 42px !important;
  height: 30px !important;
  padding: 0 9px !important;
  border: 1px solid rgba(255, 255, 255, 0.085) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.018)),
    rgba(10, 11, 14, 0.66) !important;
  color: rgba(255, 255, 255, 0.78) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    0 5px 14px rgba(0, 0, 0, 0.18) !important;
}

.gen-credit-cost svg {
  width: 15px !important;
  height: 15px !important;
  opacity: 0.68;
}

.gen-panel .panel-actions .send-button {
  width: 36px !important;
  min-width: 36px !important;
  height: 36px !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.13), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.026)),
    rgba(12, 13, 16, 0.78) !important;
  color: rgba(255, 255, 255, 0.86) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.075),
    0 9px 22px rgba(0, 0, 0, 0.28) !important;
}

.gen-panel .panel-actions .send-button:hover {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.2), transparent 46%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.04)),
    rgba(18, 19, 23, 0.82) !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.095),
    0 0 18px rgba(255, 255, 255, 0.055),
    0 12px 28px rgba(0, 0, 0, 0.3) !important;
  transform: translateY(-1px);
}

.gen-panel .panel-actions .send-button .send-arrow {
  width: 19px !important;
  height: 19px !important;
  color: rgba(255, 255, 255, 0.86) !important;
}

.canvas-chat-trigger {
  width: auto !important;
  min-width: 74px !important;
  height: 42px !important;
  border-radius: 14px !important;
  gap: 8px !important;
  padding: 0 14px !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.02)),
    rgba(18, 18, 18, 0.9) !important;
  color: rgba(255, 255, 255, 0.9) !important;
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  -webkit-backdrop-filter: blur(14px) saturate(1.06);
  backdrop-filter: blur(14px) saturate(1.06);
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.canvas-chat-trigger:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.115), rgba(255, 255, 255, 0.04)),
    rgba(26, 26, 26, 0.96) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  box-shadow:
    0 16px 42px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}

.canvas-chat-drawer {
  right: 12px !important;
  top: 8px !important;
  bottom: 12px !important;
  z-index: 120 !important;
  border: 1px solid rgba(255, 255, 255, 0.13) !important;
  border-radius: 22px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025)),
    rgba(24, 25, 29, 0.82) !important;
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  -webkit-backdrop-filter: blur(26px) saturate(1.12);
  backdrop-filter: blur(26px) saturate(1.12);
}

.chat-drawer-head {
  border-bottom-color: rgba(255, 255, 255, 0.09) !important;
  background: rgba(255, 255, 255, 0.025);
}

.chat-head-actions > button,
.chat-history-wrap > button,
.chat-composer-tools > button,
.chat-send,
.chat-suggestions button,
.chat-generate-modes button,
.chat-mode-pill,
.chat-model-select {
  border-color: rgba(255, 255, 255, 0.11) !important;
  background: rgba(255, 255, 255, 0.065) !important;
  color: rgba(255, 255, 255, 0.8) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.065);
}

.chat-head-actions > button:hover,
.chat-history-wrap > button:hover,
.chat-head-agent-controls #canvasChatAgentManage:hover,
.chat-composer-tools > button:hover,
.chat-send:hover,
.chat-generate-modes button:hover,
.chat-suggestions button:hover {
  background: rgba(255, 255, 255, 0.14) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: #fff !important;
  box-shadow:
    0 0 22px rgba(255, 255, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.chat-message.user,
.chat-context-chip {
  border-color: rgba(255, 255, 255, 0.16) !important;
  background: rgba(255, 255, 255, 0.105) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.chat-message.assistant {
  border-color: rgba(255, 255, 255, 0.1) !important;
  background: rgba(255, 255, 255, 0.06) !important;
}

.chat-composer {
  border-color: rgba(255, 255, 255, 0.13) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025)),
    rgba(30, 31, 35, 0.72) !important;
  box-shadow:
    0 18px 56px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  -webkit-backdrop-filter: blur(20px) saturate(1.08);
  backdrop-filter: blur(20px) saturate(1.08);
}

.chat-composer {
  display: grid !important;
  gap: 10px !important;
  padding: 12px !important;
}

.chat-generate-modes {
  width: min(100%, 520px) !important;
  margin: 0 !important;
}

.chat-generate-options {
  width: auto !important;
  margin: 0 !important;
}

.chat-input {
  height: 82px !important;
  min-height: 82px !important;
}

.chat-composer-foot {
  min-width: 0 !important;
  padding-top: 0 !important;
}

.chat-composer-tools {
  display: flex !important;
  flex-wrap: wrap !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
}

.chat-composer-tools > button {
  flex: 0 0 36px !important;
}

.chat-composer-tools .chat-select {
  min-width: 0 !important;
  width: 180px !important;
  max-width: min(180px, 32vw) !important;
  flex: 0 1 180px !important;
}

.chat-composer-tools .chat-select-trigger {
  width: 100% !important;
  height: 36px !important;
  display: inline-flex !important;
  flex: 0 1 auto !important;
  justify-content: space-between !important;
  border-radius: 999px !important;
  padding: 0 12px 0 14px !important;
}

.chat-composer-tools #canvasChatModelSelect {
  display: inline-block !important;
  width: 180px !important;
  max-width: min(180px, 32vw) !important;
  flex: 0 1 180px !important;
  cursor: pointer !important;
  appearance: auto !important;
}

.chat-composer .chat-composer-tools #canvasChatModelSelect + .chat-select,
.chat-composer .chat-composer-tools #canvasChatAgentSelect + .chat-select,
.chat-composer .chat-composer-tools #canvasChatImageModel + .chat-select,
.chat-composer .chat-composer-tools #canvasChatImageCount + .chat-select,
.chat-composer .chat-composer-tools #canvasChatImageResolution + .chat-select,
.chat-composer .chat-composer-tools #canvasChatVideoModel + .chat-select,
.chat-composer .chat-composer-tools #canvasChatVideoResolution + .chat-select,
.chat-composer .chat-composer-tools #canvasChatVideoDuration + .chat-select,
.chat-composer .chat-composer-tools #canvasChatImageRatio + .chat-select,
.chat-composer .chat-composer-tools #canvasChatVideoRatio + .chat-select {
  display: none !important;
}

.chat-composer[data-mode="text"] .chat-composer-tools #canvasChatAgentSelect + .chat-select,
.chat-composer[data-mode="text"] .chat-composer-tools #canvasChatImageModel + .chat-select,
.chat-composer[data-mode="text"] .chat-composer-tools #canvasChatVideoModel + .chat-select,
.chat-composer[data-mode="image"] .chat-composer-tools #canvasChatImageModel + .chat-select,
.chat-composer[data-mode="image"] .chat-composer-tools #canvasChatImageRatio + .chat-select,
.chat-composer[data-mode="image"] .chat-composer-tools #canvasChatImageResolution + .chat-select,
.chat-composer[data-mode="image"] .chat-composer-tools #canvasChatImageCount + .chat-select,
.chat-composer[data-mode="video"] .chat-composer-tools #canvasChatVideoModel + .chat-select,
.chat-composer[data-mode="video"] .chat-composer-tools #canvasChatVideoRatio + .chat-select,
.chat-composer[data-mode="video"] .chat-composer-tools #canvasChatVideoResolution + .chat-select,
.chat-composer[data-mode="video"] .chat-composer-tools #canvasChatVideoDuration + .chat-select {
  display: inline-flex !important;
}

.chat-composer-tools #canvasChatImageRatio + .chat-select,
.chat-composer-tools #canvasChatVideoRatio + .chat-select {
  width: 100px !important;
  max-width: 100px !important;
  flex-basis: 100px !important;
}

.chat-composer-tools #canvasChatImageResolution + .chat-select,
.chat-composer-tools #canvasChatVideoResolution + .chat-select {
  width: 92px !important;
  max-width: 92px !important;
  flex-basis: 92px !important;
}

.chat-composer-tools #canvasChatImageCount + .chat-select,
.chat-composer-tools #canvasChatVideoDuration + .chat-select {
  width: 78px !important;
  max-width: 78px !important;
  flex-basis: 78px !important;
}

.chat-send {
  flex: 0 0 36px !important;
}

.canvas-chat-trigger {
  border-color: rgba(255, 255, 255, 0.12) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.02)),
    rgba(18, 18, 18, 0.92) !important;
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  -webkit-backdrop-filter: blur(14px) saturate(1.06);
  backdrop-filter: blur(14px) saturate(1.06);
}

.canvas-chat-trigger:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.115), rgba(255, 255, 255, 0.04)),
    rgba(22, 22, 22, 0.94) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  box-shadow:
    0 16px 42px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}

.canvas-action-pill,
.canvas-icon-action,
.history-btn,
.side-rail-btn,
.project-current {
  border-radius: 12px !important;
}

.canvas-icon-action {
  width: auto !important;
  min-width: 66px !important;
  padding: 0 12px !important;
}

.canvas-credits-pill {
  min-width: 116px !important;
}

.canvas-chat-drawer {
  left: auto !important;
  right: 12px !important;
  top: 10px !important;
  bottom: 12px !important;
  transform: translateX(calc(100% + 24px)) !important;
  width: min(var(--chat-width, 420px), calc(100vw - 24px)) !important;
  min-width: min(360px, calc(100vw - 24px)) !important;
  max-width: calc(100vw - 24px) !important;
  border: 1px solid rgba(255, 255, 255, 0.105) !important;
  border-radius: 28px !important;
  background:
    radial-gradient(circle at 50% -12%, rgba(85, 216, 194, 0.11), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.032), rgba(255, 255, 255, 0.01)),
    rgba(18, 18, 18, 0.97) !important;
  box-shadow:
    0 18px 58px rgba(0, 0, 0, 0.54),
    0 0 0 1px rgba(255, 255, 255, 0.035),
    0 0 34px rgba(85, 216, 194, 0.1) !important;
  -webkit-backdrop-filter: blur(8px) saturate(1.02);
  backdrop-filter: blur(8px) saturate(1.02);
  isolation: isolate;
}

body.view-canvas.canvas-chat-open .canvas-chat-drawer {
  transform: translateX(0) !important;
}

.canvas-chat-drawer.dragging {
  transition: none !important;
  cursor: ew-resize;
  user-select: none;
}

.chat-resize-handle {
  position: absolute !important;
  left: 0 !important;
  top: 74px !important;
  bottom: 74px !important;
  z-index: 8 !important;
  width: 18px !important;
  display: block !important;
  cursor: ew-resize !important;
  touch-action: none;
}

.chat-resize-handle::before {
  content: "" !important;
  position: absolute !important;
  left: 5px !important;
  top: 50% !important;
  width: 3px !important;
  height: 74px !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 999px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.025)),
    rgba(12, 13, 16, 0.82) !important;
  box-shadow:
    0 0 18px rgba(85, 216, 194, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.045) !important;
  transform: translateY(-50%);
}

.chat-resize-handle:hover::before,
.canvas-chat-drawer.dragging .chat-resize-handle::before {
  border-color: rgba(85, 216, 194, 0.24) !important;
  background:
    linear-gradient(180deg, rgba(85, 216, 194, 0.16), rgba(85, 216, 194, 0.045)),
    rgba(12, 20, 19, 0.86) !important;
  box-shadow:
    0 0 22px rgba(85, 216, 194, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.055) !important;
}

.chat-drawer-head {
  height: 64px !important;
  padding: 0 14px 0 16px !important;
  border-bottom-color: rgba(255, 255, 255, 0.085) !important;
  background: rgba(18, 18, 18, 0.82) !important;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.3) !important;
}

.chat-drawer-title {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 5px !important;
  color: rgba(255, 255, 255, 0.88) !important;
}

.chat-drawer-title-row {
  max-width: 100% !important;
}

.chat-thread {
  gap: 9px !important;
  padding: 18px 14px 12px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.008), transparent 26%),
    transparent !important;
}

.chat-thread::-webkit-scrollbar,
.chat-history-popover::-webkit-scrollbar,
.chat-select-menu::-webkit-scrollbar {
  width: 8px;
}

.chat-thread::-webkit-scrollbar-thumb,
.chat-history-popover::-webkit-scrollbar-thumb,
.chat-select-menu::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  background-clip: padding-box;
}

.chat-welcome {
  gap: 10px !important;
  padding: 2px 2px 8px !important;
}

.chat-kicker {
  color: rgba(195, 255, 244, 0.68) !important;
  font-size: 12px !important;
  font-weight: 800 !important;
}

.chat-welcome h2 {
  color: rgba(255, 255, 255, 0.9) !important;
  font-size: 21px !important;
  line-height: 1.22 !important;
  font-weight: 860 !important;
}

.chat-message {
  max-width: 84% !important;
  padding: 11px 12px !important;
  border-color: rgba(255, 255, 255, 0.095) !important;
  border-radius: 18px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
    rgba(31, 31, 31, 0.97) !important;
  color: rgba(255, 255, 255, 0.88) !important;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.045) !important;
  font-size: 13px !important;
  line-height: 1.48 !important;
}

.chat-message.user {
  border-color: rgba(85, 216, 194, 0.22) !important;
  background:
    radial-gradient(circle at 90% 10%, rgba(85, 216, 194, 0.13), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
    rgba(22, 31, 30, 0.97) !important;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.28),
    0 0 18px rgba(85, 216, 194, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.045) !important;
}

.chat-message.assistant {
  border-color: rgba(255, 255, 255, 0.095) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.032), rgba(255, 255, 255, 0.01)),
    rgba(31, 31, 31, 0.98) !important;
}

.chat-message.pending {
  color: rgba(255, 255, 255, 0.66) !important;
}

.chat-message-body a {
  color: rgba(195, 255, 244, 0.95);
  text-decoration-color: rgba(85, 216, 194, 0.36);
}

.chat-message-actions {
  margin-top: 0 !important;
}

.chat-copy-button {
  border-color: rgba(255, 255, 255, 0.09) !important;
  background: rgba(12, 13, 16, 0.66) !important;
  color: rgba(255, 255, 255, 0.62) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.chat-copy-button:hover,
.chat-copy-button:focus-visible {
  border-color: rgba(255, 255, 255, 0.16) !important;
  background: rgba(24, 25, 28, 0.88) !important;
  color: rgba(255, 255, 255, 0.92) !important;
}

.chat-copy-button.copied {
  border-color: rgba(85, 216, 194, 0.28) !important;
  background: rgba(85, 216, 194, 0.13) !important;
  color: rgba(195, 255, 244, 0.94) !important;
}

.chat-action-text-button {
  width: auto !important;
  min-width: 36px;
  padding: 0 9px !important;
}

.chat-composer {
  margin: 0 12px 12px !important;
  display: grid !important;
  gap: 10px !important;
  padding: 12px !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  border-radius: 28px !important;
  background: rgba(28, 28, 28, 0.97) !important;
  box-shadow:
    0 18px 52px rgba(0, 0, 0, 0.52),
    0 0 26px rgba(85, 216, 194, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.045) !important;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.chat-input {
  height: 82px !important;
  min-height: 82px !important;
  padding: 2px 4px !important;
  color: rgba(255, 255, 255, 0.88) !important;
  font-size: 15px !important;
  line-height: 1.46 !important;
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, 0.36) !important;
}

.chat-composer-foot {
  min-width: 0 !important;
  padding-top: 0 !important;
  gap: 8px !important;
  align-items: flex-end !important;
}

.chat-composer-tools {
  display: flex !important;
  flex: 1 1 auto !important;
  flex-wrap: wrap !important;
  gap: 7px !important;
  min-width: 0 !important;
  overflow: visible !important;
}

.chat-head-actions > button,
.chat-history-wrap > button,
.chat-composer-tools > button,
.chat-send,
.chat-suggestions button,
.chat-generate-modes button,
.chat-mode-pill,
.chat-model-select,
.chat-select-trigger,
.chat-model-param-choice {
  border-color: rgba(255, 255, 255, 0.095) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018)),
    rgba(12, 13, 16, 0.7) !important;
  color: rgba(255, 255, 255, 0.76) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.045),
    0 7px 18px rgba(0, 0, 0, 0.18) !important;
}

.chat-head-actions > button:hover,
.chat-history-wrap > button:hover,
.chat-composer-tools > button:hover,
.chat-send:hover,
.chat-generate-modes button:hover,
.chat-suggestions button:hover,
.chat-select-trigger:hover,
.chat-select.open .chat-select-trigger,
.chat-model-param-choice:hover,
.chat-model-param-choice.active {
  border-color: rgba(255, 255, 255, 0.17) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.028)),
    rgba(18, 19, 22, 0.86) !important;
  color: rgba(255, 255, 255, 0.94) !important;
  box-shadow:
    0 0 20px rgba(85, 216, 194, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.065) !important;
}

.chat-generate-modes {
  padding: 3px !important;
  border-color: rgba(255, 255, 255, 0.075) !important;
  border-radius: 999px !important;
  background: rgba(8, 9, 12, 0.58) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}

.chat-generate-modes button {
  height: 30px !important;
  border-radius: 999px !important;
  box-shadow: none !important;
}

.chat-generate-modes button.active {
  border-color: rgba(85, 216, 194, 0.2) !important;
  background: rgba(85, 216, 194, 0.12) !important;
  color: rgba(195, 255, 244, 0.94) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

.chat-composer-tools > button,
.chat-send {
  width: 36px !important;
  height: 36px !important;
  flex: 0 0 36px !important;
  border-radius: 999px !important;
}

.chat-composer-tools #canvasChatAssetReference {
  width: auto !important;
  min-width: 76px !important;
  max-width: 92px !important;
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 0 12px !important;
  white-space: nowrap !important;
}

.chat-composer-tools #canvasChatAssetReference span {
  display: inline !important;
  writing-mode: horizontal-tb !important;
  white-space: nowrap !important;
  line-height: 1 !important;
}

.chat-send {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.13), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.026)),
    rgba(12, 13, 16, 0.78) !important;
  color: rgba(255, 255, 255, 0.86) !important;
}

.chat-queue-item,
.chat-context-chip,
.ai-chat-ref {
  border-radius: 14px !important;
}

.chat-send:hover {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.2), transparent 46%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.04)),
    rgba(18, 19, 23, 0.82) !important;
  box-shadow:
    0 0 18px rgba(85, 216, 194, 0.12),
    0 12px 28px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.095) !important;
}

.chat-suggestions {
  gap: 7px !important;
}

.chat-suggestions button {
  height: 32px !important;
  padding: 0 11px !important;
  font-size: 12px !important;
  font-weight: 780 !important;
}

.chat-select {
  min-width: 0 !important;
}

.chat-composer-tools .chat-select {
  width: 174px !important;
  min-width: 112px !important;
  max-width: min(174px, 100%) !important;
  flex: 1 1 132px !important;
}

.chat-composer-tools #canvasChatModeSelect + .chat-select {
  width: 104px !important;
  min-width: 104px !important;
  max-width: 104px !important;
  flex-basis: 104px !important;
}

.chat-composer-tools #canvasChatAgentSelect + .chat-select {
  width: 112px !important;
  min-width: 112px !important;
  max-width: 132px !important;
  flex: 0 0 112px !important;
}

.chat-head-agent-controls {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  min-width: 0 !important;
  position: relative !important;
  z-index: 260 !important;
}

.chat-head-agent-controls .chat-select {
  width: 132px !important;
  min-width: 112px !important;
  max-width: 132px !important;
  flex: 0 0 132px !important;
}

.chat-head-agent-controls .chat-select-menu,
.chat-head-agent-controls .text-model-select-menu {
  top: calc(100% + 8px) !important;
  bottom: auto !important;
  right: 0 !important;
  left: auto !important;
  width: max(100%, 240px) !important;
  z-index: 280 !important;
}

.chat-head-agent-controls #canvasChatAgentManage {
  width: 36px !important;
  height: 36px !important;
  flex: 0 0 36px !important;
  display: inline-grid !important;
  place-items: center !important;
  border-radius: 999px !important;
  padding: 0 !important;
}

.chat-composer-tools .chat-select-trigger {
  width: 100% !important;
  height: 36px !important;
  display: inline-flex !important;
  flex: 0 1 auto !important;
  justify-content: space-between !important;
  border-radius: 999px !important;
  padding: 0 12px 0 14px !important;
  font-size: 12px !important;
  font-weight: 820 !important;
}

.chat-composer-tools #canvasChatImageRatio + .chat-select,
.chat-composer-tools #canvasChatVideoRatio + .chat-select {
  width: 100px !important;
  min-width: 100px !important;
  max-width: 100px !important;
  flex-basis: 100px !important;
}

.chat-composer-tools #canvasChatImageResolution + .chat-select,
.chat-composer-tools #canvasChatVideoResolution + .chat-select {
  width: 92px !important;
  min-width: 92px !important;
  max-width: 92px !important;
  flex-basis: 92px !important;
}

.chat-composer-tools #canvasChatImageCount + .chat-select,
.chat-composer-tools #canvasChatVideoDuration + .chat-select {
  width: 78px !important;
  min-width: 78px !important;
  max-width: 78px !important;
  flex-basis: 78px !important;
}

@media (max-width: 430px) {
  .chat-composer-foot {
    align-items: flex-end !important;
  }

  .chat-composer-tools {
    flex: 1 1 calc(100% - 44px) !important;
  }

  .chat-composer-tools .chat-select {
    min-width: 126px !important;
  }
}

.chat-history-popover,
.chat-select-menu {
  border-color: rgba(255, 255, 255, 0.115) !important;
  border-radius: 16px !important;
  background:
    radial-gradient(circle at 50% 0, rgba(85, 216, 194, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012)),
    rgba(18, 18, 18, 0.98) !important;
  box-shadow:
    0 22px 58px rgba(0, 0, 0, 0.54),
    0 0 24px rgba(85, 216, 194, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.045) !important;
  -webkit-backdrop-filter: blur(8px) saturate(1.02);
  backdrop-filter: blur(8px) saturate(1.02);
}

.chat-select-option,
.chat-history-item {
  border-radius: 12px !important;
  color: rgba(255, 255, 255, 0.74) !important;
}

.chat-select-option:hover,
.chat-select-option.active,
.chat-history-item:hover,
.chat-history-item.active {
  border-color: rgba(85, 216, 194, 0.18) !important;
  background:
    linear-gradient(90deg, rgba(85, 216, 194, 0.12), rgba(255, 255, 255, 0.045)) !important;
  color: rgba(255, 255, 255, 0.94) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045) !important;
}

.chat-select-option-meta,
.chat-history-item span,
.chat-select-option-price {
  color: rgba(255, 255, 255, 0.48) !important;
}

.chat-model-param-panel {
  gap: 9px !important;
  border: 1px solid rgba(255, 255, 255, 0.075) !important;
  border-radius: 14px !important;
  background: rgba(8, 9, 12, 0.58) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035) !important;
}

.chat-model-param-title {
  color: rgba(195, 255, 244, 0.58) !important;
}

.chat-context-chip {
  border-color: rgba(85, 216, 194, 0.2) !important;
  background:
    linear-gradient(180deg, rgba(85, 216, 194, 0.13), rgba(85, 216, 194, 0.065)),
    rgba(12, 13, 16, 0.76) !important;
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.045) !important;
}

.chat-context-chip button {
  background: rgba(255, 255, 255, 0.085) !important;
  color: rgba(255, 255, 255, 0.72) !important;
}

body.view-canvas .canvas-chat-drawer {
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 28px !important;
  background: #202020 !important;
  box-shadow:
    0 18px 58px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(255, 255, 255, 0.16),
    0 0 28px rgba(85, 216, 194, 0.18) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

body.view-canvas .chat-drawer-head {
  height: 64px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  background: #202020 !important;
  box-shadow: none !important;
}

body.view-canvas .chat-drawer-title,
body.view-canvas .chat-drawer-title #canvasChatModelTitle {
  color: rgba(226, 232, 240, 0.82) !important;
  font-size: 14px !important;
  font-weight: 700 !important;
}

body.view-canvas .chat-thread {
  background: #202020 !important;
}

body.view-canvas .chat-message,
body.view-canvas .chat-composer,
body.view-canvas .chat-history-popover,
body.view-canvas .chat-select-menu,
body.view-canvas .text-model-select-menu {
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  background: rgba(31, 31, 31, 0.98) !important;
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.52) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

body.view-canvas .chat-message {
  border-radius: 24px !important;
  color: rgba(255, 255, 255, 0.9) !important;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 160ms ease !important;
}

body.view-canvas .chat-message.user {
  border-color: rgba(255, 255, 255, 0.18) !important;
  background: #202020 !important;
  box-shadow:
    0 18px 58px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 28px rgba(85, 216, 194, 0.12) !important;
}

body.view-canvas .chat-message.assistant,
body.view-canvas .chat-message.pending {
  background: rgba(31, 31, 31, 0.98) !important;
}

body.view-canvas .chat-composer {
  border-radius: 28px !important;
  background: rgba(28, 28, 28, 0.97) !important;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease !important;
}

body.view-canvas .chat-composer:focus-within {
  border-color: rgba(255, 255, 255, 0.2) !important;
  box-shadow:
    0 18px 58px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 34px rgba(85, 216, 194, 0.16) !important;
}

body.view-canvas .chat-input {
  background: transparent !important;
  color: rgba(255, 255, 255, 0.9) !important;
}

body.view-canvas .chat-input::placeholder {
  color: rgba(255, 255, 255, 0.42) !important;
}

body.view-canvas .chat-head-actions > button,
body.view-canvas .chat-history-wrap > button,
body.view-canvas .chat-head-agent-controls #canvasChatAgentManage,
body.view-canvas .chat-composer-tools > button,
body.view-canvas .chat-send,
body.view-canvas .chat-select-trigger,
body.view-canvas .text-model-select-trigger,
body.view-canvas .chat-model-param-choice {
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  background: #202020 !important;
  color: rgba(226, 232, 240, 0.82) !important;
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.34) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

body.view-canvas .chat-head-actions > button:hover,
body.view-canvas .chat-history-wrap > button:hover,
body.view-canvas .chat-head-agent-controls #canvasChatAgentManage:hover,
body.view-canvas .chat-composer-tools > button:hover,
body.view-canvas .chat-send:hover,
body.view-canvas .chat-select-trigger:hover,
body.view-canvas .chat-select.open .chat-select-trigger,
body.view-canvas .text-model-select-trigger:hover,
body.view-canvas .text-model-select-control.open .text-model-select-trigger,
body.view-canvas .chat-model-param-choice:hover,
body.view-canvas .chat-model-param-choice.active {
  border-color: rgba(255, 255, 255, 0.58) !important;
  background: #202020 !important;
  color: #fff !important;
  box-shadow:
    0 18px 58px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(255, 255, 255, 0.16),
    0 0 28px rgba(85, 216, 194, 0.18) !important;
}

body.view-canvas .chat-select-menu,
body.view-canvas .text-model-select-menu,
body.view-canvas .chat-history-popover {
  border-radius: 24px !important;
}

body.view-canvas .chat-select-option,
body.view-canvas .text-model-select-option,
body.view-canvas .chat-history-item {
  border-radius: 18px !important;
  color: rgba(226, 232, 240, 0.82) !important;
}

body.view-canvas .chat-select-option:hover,
body.view-canvas .chat-select-option.active,
body.view-canvas .text-model-select-option:hover,
body.view-canvas .text-model-select-option.active,
body.view-canvas .chat-history-item:hover,
body.view-canvas .chat-history-item.active {
  background: #202020 !important;
  color: #fff !important;
  box-shadow:
    0 14px 42px rgba(0, 0, 0, 0.34),
    inset 0 0 0 1px rgba(255, 255, 255, 0.16) !important;
}

@media (max-width: 780px) {
  .canvas-chat-drawer {
    right: 8px !important;
    top: 8px !important;
    bottom: 8px !important;
    left: auto !important;
    width: calc(100vw - 16px) !important;
    min-width: 0 !important;
    max-width: calc(100vw - 16px) !important;
    border-radius: 24px !important;
  }

  .chat-resize-handle {
    display: none !important;
  }

  .chat-thread {
    padding: 16px 12px 10px !important;
  }

  .chat-composer {
    margin: 0 10px 10px !important;
    border-radius: 24px !important;
  }
}

.deepseek-mark {
  background:
    radial-gradient(circle at 68% 34%, rgba(255, 255, 255, 0.46) 0 10%, transparent 11%),
    linear-gradient(145deg, #f5f5f5 0%, #9ca3af 56%, #50545d 100%) !important;
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.12) !important;
}

@media (max-width: 780px) {
  .app-rail,
  .app-rail.expanded,
  .app-rail:hover {
    background:
      linear-gradient(90deg, rgba(22, 23, 26, 0.66), rgba(16, 17, 20, 0.48) 66%, rgba(11, 12, 14, 0.32)),
      linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012)),
      rgba(13, 14, 16, 0.42) !important;
    border-top-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow:
      0 -18px 52px rgba(0, 0, 0, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
  }

  body.theme-light .app-rail,
  body.theme-light .app-rail.expanded,
  body.theme-light .app-rail:hover {
    background:
      linear-gradient(90deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.5) 66%, rgba(255, 255, 255, 0.34)),
      linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.18)),
      rgba(244, 247, 251, 0.52) !important;
    border-top-color: rgba(17, 24, 39, 0.12) !important;
    box-shadow:
      0 -18px 52px rgba(39, 49, 66, 0.14),
      inset 0 1px 0 rgba(255, 255, 255, 0.68) !important;
  }
}

@media (max-width: 820px) {
  body.view-generate .studio-panel {
    left: 50% !important;
    right: auto !important;
    bottom: calc(16px + env(safe-area-inset-bottom)) !important;
    width: calc(100vw - 22px) !important;
    max-width: calc(100vw - 22px) !important;
    height: 286px !important;
    min-height: 286px !important;
    max-height: 286px !important;
    overflow: hidden !important;
    transform: translateX(-50%) !important;
  }

  body.view-generate .studio-scroll {
    position: relative !important;
    display: grid !important;
    grid-template-columns: 62px minmax(0, 1fr) 96px !important;
    grid-template-rows: 44px 82px 40px 46px !important;
    gap: 10px 8px !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 286px !important;
    overflow: hidden !important;
    padding: 18px 14px 16px !important;
    box-sizing: border-box !important;
  }

  body.view-generate .studio-scroll > .studio-section {
    position: static !important;
    inset: auto !important;
    display: none !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  body.view-generate .studio-section-references {
    grid-column: 1 !important;
    grid-row: 1 !important;
    display: block !important;
    width: 44px !important;
  }

  body.view-generate .studio-section-prompt {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    display: block !important;
    width: 100% !important;
  }

  body.view-generate .studio-section-models {
    grid-column: 1 / 3 !important;
    grid-row: 3 !important;
    display: block !important;
    width: 100% !important;
  }

  body.view-generate .studio-section-mode {
    grid-column: 3 !important;
    grid-row: 3 !important;
    display: block !important;
    width: 96px !important;
  }

  body.view-generate .studio-section-ratios {
    grid-column: 1 !important;
    grid-row: 4 !important;
    display: block !important;
    width: 62px !important;
  }

  body.view-generate .studio-section-qualities {
    grid-column: 2 !important;
    grid-row: 4 !important;
    display: block !important;
    width: 74px !important;
  }

  body.view-generate .studio-section-video-reference,
  body.view-generate .studio-section-utilities,
  body.view-generate #studioComposeSection,
  body.view-generate .studio-status,
  body.view-generate .studio-ref-list,
  body.view-generate .studio-audio-list,
  body.view-generate .studio-credits {
    display: none !important;
  }

  body.view-generate .studio-prompt-wrap {
    width: 100% !important;
    height: 82px !important;
  }

  body.view-generate .studio-prompt {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 82px !important;
    min-height: 82px !important;
    max-height: 82px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    font-size: 17px !important;
    line-height: 1.42 !important;
    box-sizing: border-box !important;
  }

  body.view-generate .studio-ref-bar,
  body.view-generate .studio-upload {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
  }

  body.view-generate .studio-upload {
    display: grid !important;
    place-items: center !important;
    padding: 0 !important;
  }

  body.view-generate .studio-model-list,
  body.view-generate .studio-segment,
  body.view-generate .studio-grid-options {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  body.view-generate .studio-model-list {
    height: 40px !important;
    overflow: visible !important;
  }

  body.view-generate .studio-model-list.open::before {
    width: min(270px, calc(100vw - 48px)) !important;
    height: var(--studio-open-height, 190px) !important;
  }

  body.view-generate .studio-model {
    width: 100% !important;
    max-width: 100% !important;
    height: 40px !important;
    min-height: 40px !important;
    overflow: visible !important;
  }

  body.view-generate .studio-model-meta,
  body.view-generate .studio-label {
    display: none !important;
  }

  body.view-generate .studio-segment,
  body.view-generate .studio-grid-options {
    height: 40px !important;
    overflow: visible !important;
  }

  body.view-generate .studio-model-list.open .studio-model:not(.active) {
    position: absolute !important;
    left: var(--studio-popover-left, 0) !important;
    bottom: calc(52px + var(--studio-option-index, 0) * 46px) !important;
    width: min(270px, calc(100vw - 48px)) !important;
    height: 40px !important;
    min-height: 40px !important;
    border-radius: 14px !important;
    overflow: visible !important;
    z-index: 91 !important;
  }

  body.view-generate .studio-model-list.open .studio-model.active {
    position: relative !important;
    z-index: 92 !important;
  }

  body.view-generate .studio-model-list.open::before {
    left: var(--studio-popover-left, 0) !important;
    bottom: 46px !important;
    width: min(270px, calc(100vw - 48px)) !important;
    height: var(--studio-open-height, 190px) !important;
    z-index: 90 !important;
  }

  body.view-generate .studio-grid-options.open .studio-chip:not(.active) {
    position: absolute !important;
    left: var(--studio-popover-left, 0) !important;
    bottom: calc(48px + var(--studio-option-index, 0) * 44px) !important;
    display: inline-flex !important;
    width: max(86px, 100%) !important;
    min-width: 86px !important;
    justify-content: flex-start !important;
    border-radius: 12px !important;
    background: rgba(24, 26, 31, 0.98) !important;
    border-color: rgba(255, 255, 255, 0.13) !important;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42) !important;
    backdrop-filter: blur(14px);
    z-index: 91 !important;
  }

  body.view-generate .studio-segment button,
  body.view-generate .studio-chip {
    height: 40px !important;
    min-width: 0 !important;
    white-space: nowrap !important;
  }

  body.view-generate .studio-generate-bar {
    position: static !important;
    grid-column: 2 / -1 !important;
    grid-row: 4 !important;
    display: grid !important;
    grid-template-columns: minmax(56px, auto) minmax(56px, auto) 46px !important;
    align-items: center !important;
    gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 46px !important;
    margin: 0 !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  body.view-generate .studio-cost,
  body.view-generate .studio-count-current {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 36px !important;
    padding-inline: 8px !important;
    box-sizing: border-box !important;
  }

  body.view-generate .studio-generate {
    width: 46px !important;
    min-width: 46px !important;
    max-width: 46px !important;
    height: 46px !important;
    margin: 0 !important;
  }

  body.view-generate .generate-view {
    padding-bottom: calc(332px + env(safe-area-inset-bottom)) !important;
  }
}

body.view-generate .studio-ref-list,
body.view-generate .studio-audio-list {
  display: flex !important;
  overflow: visible !important;
  scrollbar-width: none !important;
  align-items: center !important;
  gap: 8px !important;
  max-width: min(520px, calc(100vw - 160px)) !important;
  max-height: 70px !important;
}

body.view-generate .studio-ref-list::-webkit-scrollbar,
body.view-generate .studio-audio-list::-webkit-scrollbar {
  display: none !important;
}

body.view-generate .studio-ref,
body.view-generate .studio-audio-ref {
  overflow: visible !important;
}

body.view-generate .studio-audio-ref.is-video {
  width: 40px !important;
  height: 40px !important;
  display: block !important;
  padding: 0 !important;
  border-radius: 10px !important;
  background: #111 !important;
  cursor: pointer;
  overflow: visible !important;
}

body.view-generate .studio-audio-ref.is-video::before,
body.view-generate .studio-audio-ref.is-video::after {
  display: none !important;
}

body.view-generate .studio-audio-ref.is-video video {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  border-radius: inherit !important;
  opacity: 1 !important;
  pointer-events: none;
}

body.view-generate .studio-audio-ref.is-video .studio-audio-icon {
  position: absolute;
  left: 4px;
  top: 4px;
  z-index: 3;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42) !important;
  color: #fff;
  backdrop-filter: blur(8px);
}

body.view-generate .studio-audio-ref.is-video .studio-audio-icon svg {
  width: 12px;
  height: 12px;
}

body.view-generate .studio-audio-ref.is-video .studio-audio-text {
  display: none !important;
}

body.view-generate .studio-audio-ref.is-video button {
  right: -8px !important;
  top: -8px !important;
  z-index: 4 !important;
}

body.view-generate .studio-audio-ref.is-audio {
  width: 40px !important;
  height: 40px !important;
  display: block !important;
  padding: 0 !important;
  border-radius: 10px !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  background: linear-gradient(180deg, rgba(24, 24, 25, 0.96), rgba(12, 12, 13, 0.96)) !important;
  cursor: default;
  overflow: visible !important;
}

body.view-generate .studio-audio-ref.is-audio audio {
  display: none !important;
}

body.view-generate .studio-audio-ref.is-audio::before {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 8px;
  z-index: 2;
  height: 14px;
  border-radius: 6px;
  background:
    linear-gradient(90deg,
      rgba(255, 255, 255, 0.2) 0 3px,
      transparent 3px 6px,
      rgba(255, 255, 255, 0.42) 6px 9px,
      transparent 9px 12px,
      rgba(255, 255, 255, 0.26) 12px 15px,
      transparent 15px 18px);
  background-size: 18px 100%;
  opacity: 0.74;
  mask: none;
  pointer-events: none;
}

body.view-generate .studio-audio-ref.is-audio .studio-audio-icon {
  position: absolute;
  left: 6px;
  top: 6px;
  z-index: 3;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1) !important;
  color: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(8px);
}

body.view-generate .studio-audio-ref.is-audio .studio-audio-icon svg {
  width: 12px;
  height: 12px;
}

body.view-generate .studio-audio-ref.is-audio .studio-audio-text {
  display: none !important;
}

body.view-generate .studio-audio-ref.is-audio button {
  right: -5px !important;
  top: -5px !important;
  z-index: 4 !important;
}

body.view-generate .studio-model-list.open,
body.view-generate .studio-grid-options.open {
  max-height: none !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
}

body.view-generate .studio-model-list.open .studio-model.active,
body.view-generate .studio-grid-options.open .studio-chip.active {
  position: relative !important;
  left: auto !important;
  bottom: auto !important;
  z-index: 92 !important;
}

@media (min-width: 821px) {
  body.view-generate .studio-model-list.open::before,
  body.view-generate .studio-grid-options.open::before {
    bottom: 42px !important;
    height: var(--studio-open-height, 90px) !important;
  }

  body.view-generate .studio-model-list[data-mode="video"].open::before {
    height: var(--studio-open-height, 190px) !important;
    min-height: 174px !important;
  }

  body.view-generate .studio-model-list.open .studio-model:not(.active),
  body.view-generate .studio-grid-options.open .studio-chip:not(.active) {
    bottom: calc(42px + var(--studio-option-index, 0) * 42px) !important;
    min-height: 38px !important;
    height: 38px !important;
  }

  body.view-generate .studio-count-menu.open .studio-count-popover {
    animation: studio-pop-open 120ms cubic-bezier(0.16, 1, 0.3, 1) !important;
  }
}

.preview-modal.video-preview {
  grid-template-columns: 1fr !important;
  padding: 0 !important;
  background: rgba(0, 0, 0, 0.92) !important;
  gap: 0 !important;
}

.preview-modal.video-preview .preview-stage {
  display: grid !important;
  place-items: center !important;
  width: 100vw !important;
  height: 100vh !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #050506 !important;
  cursor: default !important;
}

.preview-modal.video-preview .preview-stage:active {
  cursor: default !important;
}

.preview-modal.video-preview .preview-stage video {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  aspect-ratio: var(--preview-video-ratio, 16 / 9);
  object-fit: contain !important;
  transform: none !important;
  border-radius: 0;
  pointer-events: auto;
}

.preview-modal.video-preview .preview-side {
  position: fixed !important;
  inset: 24px 24px auto auto !important;
  width: auto !important;
  height: auto !important;
  max-height: none !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  backdrop-filter: none !important;
  gap: 0 !important;
  pointer-events: none;
}

.preview-modal.video-preview .preview-side-head {
  justify-content: flex-end !important;
  pointer-events: none;
}

.preview-modal.video-preview .preview-side-head span,
.preview-modal.video-preview .preview-prompt,
.preview-modal.video-preview .preview-info {
  display: none !important;
}

.preview-modal.video-preview .preview-close {
  width: 38px !important;
  height: 38px !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 999px !important;
  background: rgba(12, 13, 15, 0.72) !important;
  color: #fff !important;
  font-size: 26px !important;
  pointer-events: auto;
  backdrop-filter: blur(14px);
}

.preview-modal.video-preview .preview-use,
.preview-modal.video-preview .preview-download {
  position: fixed !important;
  bottom: 24px !important;
  width: 96px !important;
  margin: 0 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.9) !important;
  color: #111 !important;
  pointer-events: auto;
  backdrop-filter: blur(14px);
}

.preview-modal.video-preview .preview-use {
  right: 132px !important;
}

.preview-modal.video-preview .preview-download {
  right: 24px !important;
}

@media (min-width: 821px) {
  body.view-generate .studio-panel.studio-expanded {
    width: min(var(--studio-expanded-width, 1180px), calc(100vw - 96px)) !important;
    height: min(var(--studio-expanded-height, 420px), calc(100vh - 84px)) !important;
    min-height: min(var(--studio-expanded-height, 420px), calc(100vh - 84px)) !important;
    bottom: 42px !important;
    border-radius: 30px !important;
    overflow: visible !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-scroll {
    display: grid !important;
    grid-template-columns: minmax(190px, 220px) 92px 76px 82px minmax(220px, 1fr) !important;
    grid-template-rows: var(--studio-expanded-media-height, 140px) minmax(112px, 1fr) 46px !important;
    align-items: center !important;
    gap: 14px !important;
    min-height: 100% !important;
    height: 100% !important;
    padding: 20px !important;
    overflow: visible !important;
    scrollbar-width: none !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-section:has(.studio-ref-bar) {
    position: static !important;
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    display: block !important;
    align-self: stretch !important;
    min-width: 0 !important;
    overflow: visible !important;
    scrollbar-width: none !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-section:has(.studio-prompt) {
    position: static !important;
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    display: block !important;
    align-self: stretch !important;
    min-height: 0 !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-prompt-wrap {
    height: 100% !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-prompt {
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 18px 58px 18px 20px !important;
    border: 0 !important;
    border-radius: 20px !important;
    background: transparent !important;
    box-shadow: none !important;
    line-height: 1.48 !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-prompt:focus {
    border-color: transparent !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-prompt-expand {
    right: 12px !important;
    top: 12px !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-section:has(#studioModels) {
    grid-column: 1 !important;
    grid-row: 3 !important;
    position: relative !important;
    width: auto !important;
    flex: initial !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-section:has(#studioMode) {
    grid-column: 2 !important;
    grid-row: 3 !important;
    width: auto !important;
    flex: initial !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-section:has(#studioRatios) {
    grid-column: 3 !important;
    grid-row: 3 !important;
    width: auto !important;
    flex: initial !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-section:has(#studioQualities) {
    grid-column: 4 !important;
    grid-row: 3 !important;
    width: auto !important;
    flex: initial !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-generate-bar {
    grid-column: 5 !important;
    grid-row: 3 !important;
    justify-self: end !important;
    width: min(290px, 100%) !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-ref-list,
  body.view-generate .studio-panel.studio-expanded .studio-audio-list {
    display: contents !important;
    max-width: none !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    scrollbar-width: none !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-ref-bar {
    height: 100% !important;
    min-height: 0 !important;
    align-items: flex-start !important;
    align-content: flex-start !important;
    flex-wrap: wrap !important;
    gap: 14px !important;
    min-width: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
    scrollbar-width: none !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-scroll::-webkit-scrollbar,
  body.view-generate .studio-panel.studio-expanded .studio-section:has(.studio-ref-bar)::-webkit-scrollbar,
  body.view-generate .studio-panel.studio-expanded .studio-ref-bar::-webkit-scrollbar,
  body.view-generate .studio-panel.studio-expanded .studio-ref-list::-webkit-scrollbar,
  body.view-generate .studio-panel.studio-expanded .studio-audio-list::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-upload,
  body.view-generate .studio-panel.studio-expanded .studio-ref,
  body.view-generate .studio-panel.studio-expanded .studio-audio-ref.is-video,
  body.view-generate .studio-panel.studio-expanded .studio-audio-ref.is-audio {
    flex: 0 0 132px !important;
    width: 132px !important;
    height: 132px !important;
    border-radius: 20px !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-audio-ref.is-audio {
    padding: 0 !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-audio-ref.is-audio::before {
    left: 16px;
    right: 16px;
    bottom: 26px;
    height: 54px;
    border-radius: 14px;
    background:
      linear-gradient(90deg,
        rgba(255, 255, 255, 0.18) 0 4px,
        transparent 4px 8px,
        rgba(255, 255, 255, 0.42) 8px 13px,
        transparent 13px 17px,
        rgba(255, 255, 255, 0.24) 17px 22px,
        transparent 22px 27px,
        rgba(255, 255, 255, 0.55) 27px 32px,
        transparent 32px 37px);
    background-size: 37px 100%;
  }

  body.view-generate .studio-panel.studio-expanded .studio-audio-ref.is-audio .studio-audio-icon {
    left: 12px !important;
    top: 12px !important;
    width: 30px !important;
    height: 30px !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-audio-ref.is-audio .studio-audio-icon svg {
    width: 16px !important;
    height: 16px !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-ref-label {
    left: 8px !important;
    top: 8px !important;
    height: 24px !important;
    padding: 0 9px !important;
    font-size: 12px !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-ref button,
  body.view-generate .studio-panel.studio-expanded .studio-audio-ref.is-video button,
  body.view-generate .studio-panel.studio-expanded .studio-audio-ref.is-audio button {
    right: -9px !important;
    top: -9px !important;
    width: 30px !important;
    height: 30px !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-audio-ref.is-video .studio-audio-icon {
    left: 9px !important;
    top: 9px !important;
    width: 28px !important;
    height: 28px !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-audio-ref.is-video .studio-audio-icon svg {
    width: 16px !important;
    height: 16px !important;
  }
}

@media (max-width: 820px) {
  body.view-generate .studio-panel.studio-expanded {
    width: calc(100vw - 22px) !important;
    height: min(var(--studio-expanded-height, 520px), calc(100vh - 32px)) !important;
    min-height: min(var(--studio-expanded-height, 520px), calc(100vh - 32px)) !important;
    max-height: none !important;
    bottom: calc(16px + env(safe-area-inset-bottom)) !important;
    overflow: visible !important;
    border-radius: 26px !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-scroll {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 96px 74px !important;
    grid-template-rows: var(--studio-expanded-media-height, 92px) minmax(112px, 1fr) 40px 46px !important;
    gap: 10px !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    padding: 14px !important;
    overflow: visible !important;
    scrollbar-width: none !important;
    box-sizing: border-box !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-section-references {
    position: static !important;
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    display: block !important;
    width: auto !important;
    max-width: none !important;
    overflow: visible !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-section-prompt {
    position: static !important;
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    display: block !important;
    width: auto !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-section-models {
    grid-column: 1 !important;
    grid-row: 3 !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-section-mode {
    grid-column: 2 !important;
    grid-row: 3 !important;
    width: 96px !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-section-ratios {
    grid-column: 3 !important;
    grid-row: 3 !important;
    width: 74px !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-section-qualities {
    grid-column: 1 !important;
    grid-row: 4 !important;
    width: 74px !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-generate-bar {
    grid-column: 2 / -1 !important;
    grid-row: 4 !important;
    width: 100% !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-ref-bar {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    align-content: flex-start !important;
    gap: 10px !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-width: none !important;
    overflow: visible !important;
    padding: 0 !important;
    scrollbar-width: none !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-ref-list,
  body.view-generate .studio-panel.studio-expanded .studio-audio-list {
    display: contents !important;
    max-width: none !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    scrollbar-width: none !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-upload,
  body.view-generate .studio-panel.studio-expanded .studio-ref,
  body.view-generate .studio-panel.studio-expanded .studio-audio-ref.is-video,
  body.view-generate .studio-panel.studio-expanded .studio-audio-ref.is-audio {
    flex: 0 0 92px !important;
    width: 92px !important;
    min-width: 92px !important;
    max-width: 92px !important;
    height: 92px !important;
    border-radius: 16px !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-scroll::-webkit-scrollbar,
  body.view-generate .studio-panel.studio-expanded .studio-ref-bar::-webkit-scrollbar,
  body.view-generate .studio-panel.studio-expanded .studio-ref-list::-webkit-scrollbar,
  body.view-generate .studio-panel.studio-expanded .studio-audio-list::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
}

body.view-generate .studio-ref.model-limited,
body.view-generate .studio-audio-ref.model-limited {
  opacity: 1 !important;
  filter: none !important;
}

body.view-generate .studio-ref.model-limited::after,
body.view-generate .studio-audio-ref.model-limited::after {
  content: none !important;
  display: none !important;
}

body.view-generate .studio-section-ratios .studio-grid-options.open::before,
body.view-generate .studio-section-qualities .studio-grid-options.open::before {
  content: none !important;
  display: none !important;
}

body.view-generate .studio-section-ratios .studio-grid-options.open .studio-chip:not(.active),
body.view-generate .studio-section-qualities .studio-grid-options.open .studio-chip:not(.active) {
  left: 0 !important;
  width: 100% !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 12px 28px rgba(0, 0, 0, 0.36) !important;
}

@media (min-width: 821px) {
  body.view-generate .studio-panel:not(.studio-expanded) {
    height: var(--studio-compact-panel-height, 254px) !important;
    min-height: var(--studio-compact-panel-height, 254px) !important;
    max-height: none !important;
    overflow: visible !important;
  }

  body.view-generate .studio-panel:not(.studio-expanded) .studio-scroll {
    height: var(--studio-compact-panel-height, 254px) !important;
    min-height: var(--studio-compact-panel-height, 254px) !important;
    padding: var(--studio-compact-scroll-padding, 194px 20px 18px) !important;
    overflow: visible !important;
  }

  body.view-generate .studio-panel:not(.studio-expanded) .studio-section:has(.studio-prompt) {
    top: var(--studio-compact-prompt-top, 90px) !important;
  }

  body.view-generate .studio-panel:not(.studio-expanded) .studio-prompt-wrap {
    height: var(--studio-compact-prompt-height, 74px) !important;
  }

  body.view-generate .studio-panel:not(.studio-expanded) .studio-prompt {
    height: var(--studio-compact-prompt-height, 74px) !important;
    min-height: var(--studio-compact-prompt-height, 74px) !important;
    max-height: var(--studio-compact-prompt-height, 74px) !important;
  }

  body.view-generate .studio-panel:not(.studio-expanded) .studio-ref-bar {
    height: auto !important;
    min-height: 58px !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    align-content: flex-start !important;
    gap: 10px !important;
    overflow: visible !important;
  }

  body.view-generate .studio-panel:not(.studio-expanded) .studio-ref-list,
  body.view-generate .studio-panel:not(.studio-expanded) .studio-audio-list {
    display: contents !important;
    overflow: visible !important;
    max-width: none !important;
    max-height: none !important;
  }

  body.view-generate .studio-panel:not(.studio-expanded) .studio-upload,
  body.view-generate .studio-panel:not(.studio-expanded) .studio-ref,
  body.view-generate .studio-panel:not(.studio-expanded) .studio-audio-ref.is-video,
  body.view-generate .studio-panel:not(.studio-expanded) .studio-audio-ref.is-audio {
    flex: 0 0 58px !important;
    width: 58px !important;
    min-width: 58px !important;
    max-width: 58px !important;
    height: 58px !important;
    border-radius: 14px !important;
  }

  body.view-generate .studio-panel:not(.studio-expanded) .studio-audio-ref {
    padding: 0 !important;
    grid-template-columns: 1fr !important;
  }

  body.view-generate .studio-panel:not(.studio-expanded) .studio-audio-text {
    display: none !important;
  }

  body.view-generate .studio-panel:not(.studio-expanded) .studio-audio-icon {
    position: absolute !important;
    left: 8px !important;
    top: 8px !important;
    z-index: 2 !important;
    width: 24px !important;
    height: 24px !important;
    border-radius: 9px !important;
  }

  body.view-generate .studio-panel:not(.studio-expanded) .studio-ref-label {
    left: 6px !important;
    top: 6px !important;
    min-width: 20px !important;
    height: 20px !important;
    justify-content: center !important;
    padding: 0 6px !important;
    font-size: 12px !important;
  }
}

@media (min-width: 821px) {
  body.view-generate .studio-prompt-wrap {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) repeat(2, 68px) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    gap: 5px 10px !important;
    align-items: start !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  body.view-generate .studio-panel:not(.studio-expanded) .studio-prompt-wrap {
    height: var(--studio-compact-prompt-height, 78px) !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-prompt-wrap {
    height: 100% !important;
  }

  body.view-generate .studio-prompt {
    grid-column: 1 !important;
    grid-row: 1 / -1 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 !important;
    overflow: auto !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-prompt {
    padding: 0 !important;
  }

  body.view-generate .studio-prompt-wrap .asset-reference-button,
  body.view-generate .studio-prompt-expand {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    width: 68px !important;
    min-width: 68px !important;
    max-width: 68px !important;
    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    padding: 0 9px !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    border-radius: 12px !important;
    color: rgba(255, 255, 255, 0.86) !important;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.045)),
      rgba(12, 13, 16, 0.78) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.18),
      0 10px 22px rgba(0, 0, 0, 0.28) !important;
    backdrop-filter: blur(12px) saturate(1.08);
    -webkit-backdrop-filter: blur(12px) saturate(1.08);
  }

  body.view-generate .studio-prompt-wrap .asset-reference-button {
    grid-column: 2 !important;
    grid-row: 1 !important;
    border-color: rgba(255, 255, 255, 0.26) !important;
    color: rgba(255, 255, 255, 0.94) !important;
    background:
      radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.16), transparent 58%),
      linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.045)),
      rgba(14, 15, 18, 0.82) !important;
  }

  body.view-generate .studio-prompt-expand {
    grid-column: 3 !important;
    grid-row: 1 !important;
  }

  body.view-generate .studio-prompt-wrap .asset-reference-button:hover,
  body.view-generate .studio-prompt-expand:hover {
    transform: translateY(-1px) !important;
    border-color: rgba(255, 255, 255, 0.28) !important;
    color: #fff !important;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.07)),
      rgba(18, 20, 24, 0.9) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.22),
      0 12px 28px rgba(0, 0, 0, 0.34),
      0 0 18px rgba(255, 255, 255, 0.12) !important;
  }

  body.view-generate .studio-prompt-wrap .asset-reference-button span {
    display: inline !important;
    font-size: 12px !important;
    font-weight: 820 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  body.view-generate .studio-mention-menu {
    z-index: 95 !important;
    gap: 6px !important;
    padding: 8px !important;
    border-radius: 16px !important;
    border-color: rgba(255, 255, 255, 0.16) !important;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035)),
      rgba(18, 19, 23, 0.96) !important;
    box-shadow:
      0 18px 44px rgba(0, 0, 0, 0.42),
      inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
    backdrop-filter: blur(18px) saturate(1.1) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.1) !important;
  }

  body.view-generate .studio-mention-option {
    flex: 0 0 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    gap: 10px !important;
    padding: 0 12px 0 6px !important;
    border-radius: 12px !important;
    background: transparent !important;
    color: rgba(255, 255, 255, 0.78) !important;
    font-size: 13px !important;
    font-weight: 760 !important;
  }

  body.view-generate .studio-mention-option:hover,
  body.view-generate .studio-mention-option.selected {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12) !important;
  }

  body.view-generate .studio-mention-option img,
  body.view-generate .studio-mention-option-media {
    flex: 0 0 36px !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
    background: rgba(255, 255, 255, 0.09) !important;
    object-fit: cover !important;
  }

  body.view-generate .studio-mention-option .studio-ref-preview {
    display: none !important;
  }

  body.view-generate .studio-inline-mention {
    height: 24px !important;
    margin: 0 2px !important;
    padding: 2px 9px 2px 3px !important;
    border-radius: 999px !important;
    font-size: 13px !important;
    font-weight: 760 !important;
  }

  body.view-generate .studio-inline-mention img,
  body.view-generate .studio-inline-mention-media {
    width: 18px !important;
    height: 18px !important;
    margin-right: 6px !important;
    border-radius: 6px !important;
  }

  body.view-generate .studio-section:has(.studio-ref-bar),
  body.view-generate .studio-panel.studio-expanded .studio-section:has(.studio-ref-bar),
  body.view-generate .studio-panel:not(.studio-expanded) .studio-section:has(.studio-ref-bar) {
    overflow: visible !important;
  }

  body.view-generate .studio-ref-bar,
  body.view-generate .studio-panel.studio-expanded .studio-ref-bar,
  body.view-generate .studio-panel:not(.studio-expanded) .studio-ref-bar {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    align-content: center !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  body.view-generate .studio-panel:not(.studio-expanded) .studio-ref-bar {
    height: 70px !important;
    min-height: 70px !important;
    max-height: 70px !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-ref-bar {
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
  }

  body.view-generate .studio-ref-list,
  body.view-generate .studio-audio-list,
  body.view-generate .studio-panel.studio-expanded .studio-ref-list,
  body.view-generate .studio-panel.studio-expanded .studio-audio-list,
  body.view-generate .studio-panel:not(.studio-expanded) .studio-ref-list,
  body.view-generate .studio-panel:not(.studio-expanded) .studio-audio-list {
    display: flex !important;
    flex: 0 0 auto !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0 !important;
    width: max-content !important;
    max-width: none !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none !important;
  }

  body.view-generate .studio-panel:not(.studio-expanded) .studio-ref-list,
  body.view-generate .studio-panel:not(.studio-expanded) .studio-audio-list {
    height: 70px !important;
    min-height: 70px !important;
    max-height: 70px !important;
    padding: 6px 4px !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-ref-list,
  body.view-generate .studio-panel.studio-expanded .studio-audio-list {
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    padding: 6px 4px !important;
  }

  body.view-generate .studio-ref-list:empty,
  body.view-generate .studio-audio-list:empty {
    display: none !important;
  }

  body.view-generate .studio-ref-list::-webkit-scrollbar,
  body.view-generate .studio-audio-list::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }

  body.view-generate .studio-ref.mentioned {
    border-color: rgba(255, 255, 255, 0.82) !important;
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.36),
      0 0 12px rgba(255, 255, 255, 0.34),
      0 0 26px rgba(255, 255, 255, 0.2),
      0 10px 22px rgba(0, 0, 0, 0.32),
      inset 0 0 0 1px rgba(255, 255, 255, 0.28) !important;
  }

  body.view-generate .studio-ref.mentioned::after {
    content: "";
    position: absolute;
    inset: -2px;
    z-index: 3;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow:
      0 0 14px rgba(255, 255, 255, 0.22),
      inset 0 0 10px rgba(255, 255, 255, 0.16);
    pointer-events: none;
  }

  body.view-generate .studio-ref:hover,
  body.view-generate .studio-ref.is-hover-preview {
    transform: none !important;
    border-color: rgba(255, 255, 255, 0.95) !important;
    box-shadow:
      0 0 0 2px rgba(255, 255, 255, 0.56),
      0 0 14px rgba(255, 255, 255, 0.5),
      0 0 34px rgba(255, 255, 255, 0.3),
      0 16px 34px rgba(0, 0, 0, 0.42),
      inset 0 0 0 1px rgba(255, 255, 255, 0.34) !important;
  }

  body.view-generate .studio-ref.mentioned,
  body.view-generate .studio-ref.mentioned:hover,
  body.view-generate .studio-ref.mentioned.is-hover-preview {
    transform: translateY(-7px) !important;
    z-index: 24 !important;
  }

  body.view-generate .studio-ref:hover::after,
  body.view-generate .studio-ref.is-hover-preview::after {
    inset: -3px;
    border-color: rgba(255, 255, 255, 0.88);
    box-shadow:
      inset 0 0 14px rgba(255, 255, 255, 0.22),
      0 0 18px rgba(255, 255, 255, 0.42),
      0 0 34px rgba(255, 255, 255, 0.24);
  }

  body.view-generate .studio-ref::before {
    content: none !important;
    display: none !important;
  }

  body.view-generate .studio-ref:hover::before,
  body.view-generate .studio-ref.is-hover-preview::before {
    content: none !important;
    display: none !important;
  }

  body.view-generate .studio-ref:not(.mentioned).has-mentions {
    opacity: 1 !important;
    filter: none !important;
  }

  body.view-generate .studio-inline-mention {
    border-color: rgba(255, 255, 255, 0.92) !important;
    background:
      radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.42), transparent 46%),
      linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.1)),
      rgba(18, 19, 22, 0.92) !important;
    color: #fff !important;
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.58),
      0 0 0 4px rgba(255, 255, 255, 0.12),
      0 0 18px rgba(255, 255, 255, 0.42),
      0 0 34px rgba(255, 255, 255, 0.22),
      inset 0 1px 0 rgba(255, 255, 255, 0.28) !important;
  }
}






.entry-portal {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #000;
  color: #fff;
  perspective: 900px;
  transition: opacity 420ms ease, transform 420ms ease, visibility 420ms ease;
}

.entry-portal.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.04);
}

html.entry-route-active .entry-portal {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: none !important;
}

body.entry-transitioning .entry-portal {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: none !important;
  transition: none !important;
}

.entry-particle-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.entry-particles,
.entry-stars,
.entry-aurora {
  position: absolute;
  inset: -20vmax;
  pointer-events: none;
  transform-style: preserve-3d;
}

.entry-aurora {
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.18) 0 1px, transparent 1.8px) 0 0 / 54px 54px,
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.12) 0 1px, transparent 2px) 17px 29px / 92px 92px;
  animation: none;
  opacity: 0.22;
  transform: rotateX(62deg) translateZ(-420px) scale(2.2);
}

.entry-particles {
  background:
    radial-gradient(circle, rgba(255,255,255,0.98) 0 1.2px, transparent 2px) 0 0 / 74px 74px,
    radial-gradient(circle, rgba(255,255,255,0.74) 0 1px, transparent 1.8px) 24px 38px / 122px 122px,
    radial-gradient(circle, rgba(255,255,255,0.42) 0 1.5px, transparent 2.5px) 80px 18px / 180px 180px;
  animation: none;
  opacity: 0.18;
  transform: rotateX(58deg) translateZ(-160px) scale(1.45);
}

.entry-stars {
  background:
    radial-gradient(circle, rgba(255,255,255,1) 0 1.8px, transparent 3px) 0 0 / 148px 148px,
    radial-gradient(circle, rgba(255,255,255,0.9) 0 1px, transparent 2px) 48px 70px / 220px 220px;
  animation: none;
  filter: none;
  opacity: 0.16;
  transform: rotateX(54deg) translateZ(120px) scale(0.9);
}

.entry-portal::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, transparent 0 18%, rgba(0,0,0,0.38) 54%, rgba(0,0,0,0.9) 100%),
    linear-gradient(90deg, rgba(255,255,255,0.05), transparent 16%, transparent 84%, rgba(255,255,255,0.05));
  pointer-events: none;
  z-index: 1;
}

.entry-portal.is-interacting .entry-shell {
  transform: rotateX(var(--entry-tilt-y, 0deg)) rotateY(var(--entry-tilt-x, 0deg)) translateZ(90px);
}

.entry-shell {
  position: relative;
  z-index: 2;
  width: min(1040px, calc(100vw - 36px));
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  text-align: center;
  transform: rotateX(0deg) translateZ(90px);
  backface-visibility: hidden;
  will-change: transform;
}

.entry-shell::before {
  display: none;
}

.entry-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  background: rgba(255,255,255,0.055);
  color: rgba(255,255,255,0.78);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

.entry-kicker::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 18px rgba(255,255,255,0.95);
}

.entry-title {
  margin: 22px auto 14px;
  max-width: 820px;
  font-size: clamp(42px, 8vw, 98px);
  line-height: 0.94;
  font-weight: 950;
  letter-spacing: -0.075em;
  text-shadow: 0 0 34px rgba(255,255,255,0.18), 0 16px 44px rgba(0,0,0,0.8);
}

.entry-title span {
  display: block;
  background: linear-gradient(180deg, #fff 0%, #f2f2f2 42%, #8f8f8f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.entry-subtitle {
  margin: 0 auto 30px;
  max-width: 640px;
  color: rgba(255, 255, 255, 0.66);
  font-size: clamp(15px, 2vw, 19px);
  line-height: 1.7;
}

.entry-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  transform-style: preserve-3d;
}

.entry-action {
  position: relative;
  min-height: 138px;
  padding: 20px 18px;
  border: 1px solid rgba(255, 255, 255, 0.30);
  border-radius: 32px;
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.07) 42%, rgba(255, 255, 255, 0.035) 100%),
    rgba(28, 28, 28, 0.78);
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  box-shadow:
    0 16px 42px rgba(0, 0, 0, 0.28),
    0 0 18px rgba(255, 255, 255, 0.075),
    inset 0 1px 1px rgba(255, 255, 255, 0.24),
    inset 0 -1px 1px rgba(255, 255, 255, 0.08);
  opacity: 0.9;
  transition: opacity 140ms ease, transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  contain: paint;
}

.entry-action.entry-video-breaker {
  grid-column: 1 / -1;
  justify-self: center;
  width: calc((100% - 42px) / 4);
}

.entry-action.entry-comic {
  grid-column: 2;
  justify-self: stretch;
  width: auto;
}

.entry-action::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 34% 16%, rgba(255, 255, 255, 0.08), transparent 34%);
  opacity: 0.52;
  pointer-events: none;
}

.entry-action::after {
  content: "";
  position: absolute;
  inset: auto 18px 14px 18px;
  height: 1px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  opacity: 0.62;
  pointer-events: none;
}

.entry-action:hover {
  opacity: 1;
  transform: translateY(-8px) translateZ(48px) rotateX(4deg);
  border-color: rgba(255, 255, 255, 0.42);
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08) 42%, rgba(255, 255, 255, 0.04) 100%),
    rgba(34, 34, 34, 0.84);
  box-shadow:
    0 20px 56px rgba(0, 0, 0, 0.34),
    0 0 26px rgba(255, 255, 255, 0.11),
    inset 0 1px 1px rgba(255, 255, 255, 0.30),
    inset 0 -1px 1px rgba(255, 255, 255, 0.1);
}

.entry-action.is-coming-soon {
  cursor: not-allowed;
  opacity: 0.58;
}

.entry-action.is-coming-soon:hover {
  transform: none;
  border-color: rgba(255, 255, 255, 0.30);
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.07) 42%, rgba(255, 255, 255, 0.035) 100%),
    rgba(28, 28, 28, 0.78);
}

.entry-action.is-coming-soon small {
  color: rgba(255, 255, 255, 0.72);
  font-weight: 780;
}

.entry-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.07) 42%, rgba(255, 255, 255, 0.035) 100%),
    rgba(52, 52, 52, 0.82);
  color: rgba(255, 255, 255, 0.9);
  box-shadow:
    0 16px 42px rgba(0, 0, 0, 0.28),
    inset 0 1px 1px rgba(255, 255, 255, 0.24),
    inset 0 -1px 1px rgba(255, 255, 255, 0.08);
  backface-visibility: hidden;
}

.entry-icon svg {
  width: 23px;
  height: 23px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

.entry-action strong,
.entry-action small {
  position: relative;
  display: block;
}

.entry-action strong {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.entry-action small {
  margin-top: 7px;
  color: rgba(255,255,255,0.58);
  font-size: 13px;
  line-height: 1.45;
}

.entry-toast {
  position: absolute;
  left: 50%;
  bottom: 24px;
  z-index: 3;
  padding: 10px 16px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: rgba(255,255,255,0.86);
  font-size: 13px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(14px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.entry-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.director-embed-shell {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  background: #050505;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 160ms ease, visibility 160ms ease;
}

.director-embed-shell.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body.director-embed-open {
  overflow: hidden;
}

body.director-embed-open .entry-portal,
body.director-embed-open .generate-view,
body.director-embed-open .ai-chat-view,
body.director-embed-open .comic-workbench,
body.director-embed-open .studio-panel,
body.director-embed-open #app,
body.director-embed-open .app-rail,
body.director-embed-open .canvas-top-actions,
body.director-embed-open .canvas-mode-switch,
body.director-embed-open .canvas-account-menu,
body.director-embed-open .canvas-chat-trigger,
body.director-embed-open .canvas-chat-drawer,
body.director-embed-open .canvas-zoom,
body.director-embed-open .drop-hint,
body.director-embed-open .image-toolbar,
body.director-embed-open .selection-shell {
  display: none !important;
}

.director-embed-frame {
  width: 100vw;
  height: 100vh;
  border: 0;
  background: #050505;
  opacity: 0;
  transition: opacity 180ms ease;
}

.director-embed-shell.is-loaded .director-embed-frame {
  opacity: 1;
}

.director-embed-loading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  letter-spacing: 0.02em;
  pointer-events: none;
  transition: opacity 140ms ease;
}

.director-embed-shell.is-loaded .director-embed-loading {
  opacity: 0;
}

.director-embed-toolbar {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  gap: 8px;
}

.director-embed-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(14, 14, 14, 0.78);
  color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
  cursor: pointer;
}

.director-embed-button:hover {
  background: rgba(32, 32, 32, 0.92);
  border-color: rgba(255, 255, 255, 0.28);
}

.director-embed-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.ai-chat-back {
  display: none !important;
}

@keyframes entry-depth-far {
  from { background-position: 0 0, 17px 29px; }
  to { background-position: 0 620px, 17px 520px; }
}

@keyframes entry-depth-mid {
  from { background-position: 0 0, 24px 38px, 80px 18px; }
  to { background-position: 0 860px, 24px 720px, 80px 620px; }
}

@keyframes entry-depth-near {
  from { background-position: 0 0, 48px 70px; }
  to { background-position: 0 980px, 48px 840px; }
}

@media (max-width: 760px) {
  .entry-shell {
    width: calc(100vw - 24px);
    padding: 0;
    border-radius: 0;
  }

  .entry-actions {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .entry-action.entry-video-breaker {
    grid-column: auto;
    justify-self: stretch;
    width: auto;
  }

  .entry-action.entry-comic {
    grid-column: auto;
    justify-self: stretch;
    width: auto;
  }

  .entry-action {
    min-height: 122px;
    padding: 16px 14px;
    border-radius: 20px;
  }

  .entry-action strong {
    font-size: 20px;
  }
}

@media (min-width: 821px) {
  body.view-generate {
    overflow: hidden !important;
    overscroll-behavior: none !important;
  }

  body.view-generate .generate-view {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain !important;
  }

  body.view-generate .studio-panel {
    width: min(820px, calc(100vw - 220px)) !important;
    overflow: visible !important;
  }

  body.view-generate .studio-section-models:has(.studio-model-list[data-mode="video"]),
  body.view-generate .studio-section:has(#studioModels[data-mode="video"]) {
    flex: 0 0 auto !important;
    width: max-content !important;
    min-width: 0 !important;
  }

  body.view-generate .studio-model-list[data-mode="video"] {
    width: max-content !important;
    min-width: 0 !important;
    max-width: 204px !important;
  }

  body.view-generate .studio-model-list[data-mode="video"] .studio-model.active {
    width: max-content !important;
    max-width: 204px !important;
    grid-template-columns: 18px minmax(0, auto) 16px !important;
  }

  body.view-generate .studio-model-list[data-mode="video"] .studio-model.active .studio-model-name {
    max-width: 140px !important;
  }

  body.view-generate .studio-model-list[data-mode="video"].open .studio-model[data-kind="video"],
  body.view-generate .studio-model-list[data-mode="video"].open .studio-model[data-kind="video"]:not([data-video-base="true"]) {
    display: grid !important;
  }

  body.view-generate .studio-model-list[data-mode="video"].open::before,
  body.view-generate .studio-model-list[data-mode="video"].open .studio-model:not(.active) {
    width: min(320px, calc(100vw - 48px)) !important;
  }
}

@media (min-width: 821px) {
  body.view-generate .studio-model-badge {
    display: none !important;
  }

  body.view-generate .studio-model-list {
    display: inline-flex !important;
    align-items: center !important;
    width: max-content !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 36px !important;
    overflow: visible !important;
    z-index: 90 !important;
  }

  body.view-generate .studio-model {
    grid-template-columns: none !important;
    align-items: center !important;
    gap: 8px !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    color: rgba(255, 255, 255, 0.94) !important;
    background:
      linear-gradient(180deg, rgba(42, 44, 47, 0.72), rgba(12, 13, 15, 0.62)) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.18),
      inset 0 -1px 0 rgba(0, 0, 0, 0.28),
      0 12px 30px rgba(0, 0, 0, 0.42),
      0 0 0 1px rgba(0, 0, 0, 0.18) !important;
    backdrop-filter: blur(24px) saturate(1.35) brightness(0.86) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.35) brightness(0.86) !important;
  }

  body.view-generate .studio-model.active {
    display: inline-flex !important;
    width: max-content !important;
    max-width: 220px !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 10px !important;
    border-radius: 999px !important;
  }

  body.view-generate .studio-model-list.open .studio-model.active,
  body.view-generate .studio-model-list[data-mode].open .studio-model.active {
    display: inline-flex !important;
    grid-template-columns: none !important;
    width: max-content !important;
    max-width: 220px !important;
  }

  body.view-generate .studio-model.active::after {
    content: none !important;
    display: none !important;
  }

  body.view-generate .studio-model-name {
    max-width: 150px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 14px !important;
    font-weight: 780 !important;
  }

  body.view-generate .studio-model-icon {
    flex: 0 0 19px !important;
    width: 19px !important;
    height: 19px !important;
    color: #fff !important;
  }

  body.view-generate .studio-model-icon svg {
    width: 19px !important;
    height: 19px !important;
  }

  body.view-generate .studio-model:hover,
  body.view-generate .studio-model-list.open .studio-model.active {
    background:
      linear-gradient(180deg, rgba(74, 77, 82, 0.78), rgba(18, 20, 23, 0.66)) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #fff !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.28),
      inset 0 -1px 0 rgba(0, 0, 0, 0.3),
      0 16px 36px rgba(0, 0, 0, 0.48),
      0 0 22px rgba(255, 255, 255, 0.08) !important;
    transform: translateY(-1px) !important;
  }

  body.view-generate .studio-model-list.open {
    width: max-content !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 36px !important;
    max-height: none !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  body.view-generate .studio-model-list.open::before {
    content: "" !important;
    display: block !important;
    position: absolute !important;
    left: var(--studio-popover-left, 0) !important;
    bottom: 46px !important;
    width: min(300px, calc(100vw - 48px)) !important;
    height: var(--studio-open-height, 190px) !important;
    max-height: min(320px, calc(100vh - 180px)) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 16px !important;
    background: rgba(22, 22, 22, 0.98) !important;
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.42) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    pointer-events: none !important;
    z-index: 90 !important;
  }

  body.view-generate .studio-model-list.open .studio-model:not(.active) {
    position: absolute !important;
    left: calc(var(--studio-popover-left, 0px) + 8px) !important;
    bottom: calc(52px + var(--studio-option-index, 0) * 36px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 9px !important;
    width: min(284px, calc(100vw - 64px)) !important;
    max-width: min(284px, calc(100vw - 64px)) !important;
    height: 34px !important;
    min-height: 34px !important;
    padding: 6px 10px !important;
    border: 0 !important;
    border-radius: 11px !important;
    background: transparent !important;
    color: rgba(255, 255, 255, 0.84) !important;
    box-shadow: none !important;
    text-align: left !important;
    font-size: 13px !important;
    font-weight: 760 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    z-index: 91 !important;
  }

  body.view-generate .studio-model-list[data-mode].open .studio-model:not(.active) {
    display: flex !important;
    width: min(284px, calc(100vw - 64px)) !important;
    max-width: min(284px, calc(100vw - 64px)) !important;
    grid-template-columns: none !important;
  }

  body.view-generate .studio-model-list[data-mode="image"].open .studio-model:not([data-kind="image"]),
  body.view-generate .studio-model-list[data-mode="video"].open .studio-model:not([data-kind="video"]) {
    display: none !important;
    pointer-events: none !important;
  }

  body.view-generate .studio-model-list.open .studio-model:not(.active) .studio-model-name {
    max-width: 226px !important;
    font-size: 13px !important;
    font-weight: 760 !important;
  }

  body.view-generate .studio-model-list.open .studio-model-meta {
    display: none !important;
  }

  body.view-generate .studio-model-list.open .studio-model:not(.active):hover {
    background: rgba(255, 255, 255, 0.105) !important;
    color: #fff !important;
    transform: none !important;
  }

  body.view-generate .studio-segment,
  body.view-generate .studio-chip.active,
  body.view-generate .studio-count-current {
    background:
      linear-gradient(180deg, rgba(42, 44, 47, 0.72), rgba(12, 13, 15, 0.62)) !important;
    border-color: rgba(255, 255, 255, 0.18) !important;
    color: rgba(255, 255, 255, 0.94) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.18),
      inset 0 -1px 0 rgba(0, 0, 0, 0.28),
      0 12px 30px rgba(0, 0, 0, 0.42),
      0 0 0 1px rgba(0, 0, 0, 0.18) !important;
    backdrop-filter: blur(24px) saturate(1.35) brightness(0.86) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.35) brightness(0.86) !important;
  }

  body.view-generate .studio-chip.active,
  body.view-generate .studio-count-current {
    height: 36px !important;
    border-radius: 999px !important;
    font-size: 14px !important;
    font-weight: 850 !important;
  }

  body.view-generate .studio-chip.active {
    padding: 0 13px !important;
  }

  body.view-generate .studio-count-current {
    min-width: 48px !important;
    width: auto !important;
    max-width: none !important;
    padding: 0 13px !important;
  }

  body.view-generate .studio-chip.active:hover,
  body.view-generate .studio-count-current:hover,
  body.view-generate .studio-count-menu.open .studio-count-current {
    background:
      linear-gradient(180deg, rgba(74, 77, 82, 0.78), rgba(18, 20, 23, 0.66)) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #fff !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.28),
      inset 0 -1px 0 rgba(0, 0, 0, 0.3),
      0 16px 36px rgba(0, 0, 0, 0.48),
      0 0 22px rgba(255, 255, 255, 0.08) !important;
  }

  body.view-generate .studio-section-ratios .studio-grid-options.open::before,
  body.view-generate .studio-section-qualities .studio-grid-options.open::before {
    content: "" !important;
    display: block !important;
    position: absolute !important;
    left: var(--studio-popover-left, 0) !important;
    bottom: 46px !important;
    width: max(104px, 100%) !important;
    height: var(--studio-open-height, 138px) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 20px !important;
    background:
      linear-gradient(180deg, rgba(38, 38, 38, 0.96), rgba(19, 19, 19, 0.96)) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.09),
      0 20px 54px rgba(0, 0, 0, 0.54) !important;
    backdrop-filter: blur(18px) saturate(1.15) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.15) !important;
    pointer-events: none !important;
    z-index: 90 !important;
  }

  body.view-generate .studio-grid-options.open .studio-chip:not(.active) {
    height: 38px !important;
    min-height: 38px !important;
    padding: 0 15px !important;
    border: 0 !important;
    border-radius: 13px !important;
    background: transparent !important;
    color: rgba(255, 255, 255, 0.78) !important;
    box-shadow: none !important;
    font-size: 14px !important;
    font-weight: 840 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  body.view-generate .studio-grid-options.open .studio-chip:not(.active):hover {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #fff !important;
    transform: translateY(-1px) !important;
  }

  body.view-generate .studio-generate-bar {
    position: static !important;
    display: inline-flex !important;
    grid-template-columns: none !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 40px !important;
    margin: 0 0 0 auto !important;
    overflow: visible !important;
  }

  body.view-generate .studio-reset-materials {
    display: inline-flex !important;
    width: auto !important;
    min-width: 30px !important;
    height: 30px !important;
    padding: 0 10px !important;
    gap: 5px !important;
    border-color: rgba(255, 255, 255, 0.085) !important;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.018)),
      rgba(10, 11, 14, 0.66) !important;
    color: rgba(255, 255, 255, 0.78) !important;
    font-size: 12px !important;
    font-weight: 820 !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.055),
      0 5px 14px rgba(0, 0, 0, 0.18) !important;
  }

  body.view-generate .studio-reset-materials:hover {
    border-color: rgba(255, 255, 255, 0.22) !important;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.035)),
      rgba(18, 19, 23, 0.78) !important;
    color: #fff !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.12),
      0 10px 24px rgba(0, 0, 0, 0.28) !important;
  }

  body.view-generate .studio-reset-materials svg {
    width: 15px !important;
    height: 15px !important;
  }

  body.view-generate .studio-reset-materials.is-hidden {
    display: none !important;
  }

  @media (max-width: 820px) {
    body.view-generate .studio-reset-materials {
      display: none !important;
    }
  }

  body.view-generate .studio-cost {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    width: auto !important;
    min-width: 42px !important;
    max-width: none !important;
    height: 30px !important;
    padding: 0 9px !important;
    border: 1px solid rgba(255, 255, 255, 0.085) !important;
    border-radius: 999px !important;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.018)),
      rgba(10, 11, 14, 0.66) !important;
    color: rgba(255, 255, 255, 0.78) !important;
    font-size: 14px !important;
    font-weight: 820 !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.055),
      0 5px 14px rgba(0, 0, 0, 0.18) !important;
    white-space: nowrap !important;
    cursor: default !important;
  }

  body.view-generate .studio-cost svg {
    width: 15px !important;
    height: 15px !important;
    stroke: currentColor !important;
    stroke-width: 1.85 !important;
    fill: none !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    opacity: 0.68 !important;
  }

  body.view-generate .studio-count-popover {
    display: none !important;
    gap: 8px !important;
    min-width: 88px !important;
    padding: 10px !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 20px !important;
    background:
      linear-gradient(180deg, rgba(38, 38, 38, 0.96), rgba(19, 19, 19, 0.96)) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.09),
      0 20px 54px rgba(0, 0, 0, 0.54) !important;
    backdrop-filter: blur(18px) saturate(1.15) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.15) !important;
  }

  body.view-generate .studio-count-menu.open .studio-count-popover {
    display: flex !important;
    flex-direction: column !important;
  }

  body.view-generate .studio-count-option {
    height: 38px !important;
    padding: 0 15px !important;
    border: 0 !important;
    border-radius: 13px !important;
    background: transparent !important;
    color: rgba(255, 255, 255, 0.78) !important;
    font-size: 14px !important;
    font-weight: 840 !important;
    box-shadow: none !important;
  }

  body.view-generate .studio-count-option:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #fff !important;
    transform: translateY(-1px) !important;
  }

  body.view-generate .studio-count-option.active {
    background: rgba(245, 245, 245, 0.95) !important;
    color: #101010 !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.55),
      0 10px 22px rgba(0, 0, 0, 0.28) !important;
  }

  body.view-generate .studio-generate.send-button {
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 999px !important;
    background:
      radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.13), transparent 42%),
      linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.026)),
      rgba(12, 13, 16, 0.78) !important;
    color: rgba(255, 255, 255, 0.86) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.075),
      0 9px 22px rgba(0, 0, 0, 0.28) !important;
  }

  body.view-generate .studio-generate.send-button:hover {
    background:
      radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.2), transparent 46%),
      linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.04)),
      rgba(18, 19, 23, 0.82) !important;
    border-color: rgba(255, 255, 255, 0.16) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.095),
      0 0 18px rgba(255, 255, 255, 0.055),
      0 12px 28px rgba(0, 0, 0, 0.3) !important;
    transform: translateY(-1px) !important;
  }

  body.view-generate .studio-generate.send-button .send-arrow,
  body.view-generate .studio-generate.send-button .send-arrow svg {
    width: 19px !important;
    height: 19px !important;
    color: rgba(255, 255, 255, 0.86) !important;
  }

  body.view-generate .studio-ref-bar,
  body.view-generate .studio-panel.studio-expanded .studio-ref-bar,
  body.view-generate .studio-panel:not(.studio-expanded) .studio-ref-bar {
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    align-content: flex-start !important;
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
  }

  body.view-generate .studio-ref-list,
  body.view-generate .studio-audio-list,
  body.view-generate .studio-panel.studio-expanded .studio-ref-list,
  body.view-generate .studio-panel.studio-expanded .studio-audio-list,
  body.view-generate .studio-panel:not(.studio-expanded) .studio-ref-list,
  body.view-generate .studio-panel:not(.studio-expanded) .studio-audio-list {
    display: contents !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    max-height: none !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body.view-generate .studio-prompt {
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  body.view-generate .studio-audio-ref.mentioned {
    border-color: rgba(255, 255, 255, 0.98) !important;
    transform: translateY(-7px) !important;
    z-index: 24 !important;
    box-shadow:
      0 0 0 2px rgba(255, 255, 255, 0.62),
      0 0 12px rgba(255, 255, 255, 0.58),
      0 0 32px rgba(255, 255, 255, 0.36),
      0 16px 34px rgba(0, 0, 0, 0.42),
      inset 0 0 0 1px rgba(255, 255, 255, 0.34) !important;
  }

  body.view-generate .studio-audio-ref.mentioned::after {
    content: "";
    position: absolute;
    inset: -3px;
    z-index: 3;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.92);
    box-shadow:
      inset 0 0 14px rgba(255, 255, 255, 0.24),
      0 0 18px rgba(255, 255, 255, 0.46),
      0 0 34px rgba(255, 255, 255, 0.28);
    pointer-events: none;
  }

  body.view-generate .studio-audio-ref:not(.mentioned).has-mentions {
    opacity: 1 !important;
    filter: none !important;
  }

  body.view-generate .studio-audio-ref.is-audio .studio-audio-icon {
    display: grid !important;
  }

  body.view-generate .studio-inline-mention {
    margin: 0 3px !important;
    padding: 2px 8px 2px 3px !important;
    overflow: visible !important;
  }

  body.view-generate .studio-inline-mention img,
  body.view-generate .studio-inline-mention-media {
    margin-right: 4px !important;
  }

  body.view-generate .studio-hover-preview.visible {
    pointer-events: auto !important;
  }

  body.view-generate .studio-hover-preview.is-transient-preview {
    pointer-events: none !important;
  }

  body.view-generate .studio-hover-preview audio {
    width: min(320px, calc(100vw - 72px));
    height: 34px;
    display: block;
  }

  body.view-generate .studio-hover-audio {
    display: grid;
    gap: 10px;
    min-width: min(340px, calc(100vw - 56px));
    padding: 10px;
    color: rgba(255, 255, 255, 0.9);
  }

  body.view-generate .studio-hover-audio-head {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 820;
  }

  body.view-generate .studio-hover-audio-head svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  body.view-generate .studio-panel:not(.studio-expanded) .studio-section:has(.studio-ref-bar),
  body.view-generate .studio-panel:not(.studio-expanded) .studio-ref-bar {
    min-height: var(--studio-compact-ref-height, 58px) !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-section:has(.studio-ref-bar),
  body.view-generate .studio-panel.studio-expanded .studio-ref-bar {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scrollbar-width: none !important;
  }

  body.view-generate .studio-panel.studio-expanded .studio-section:has(.studio-ref-bar)::-webkit-scrollbar,
  body.view-generate .studio-panel.studio-expanded .studio-ref-bar::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }

  body.view-generate .studio-audio-ref.mentioned {
    overflow: visible !important;
    z-index: 24 !important;
  }

  body.view-generate .studio-audio-ref.mentioned > video {
    border-radius: inherit !important;
  }

  body.view-generate .studio-panel:not(.studio-expanded) .studio-audio-ref audio {
    display: none !important;
  }

  body.view-generate .studio-audio-ref.is-video {
    gap: 6px !important;
  }

  body.view-generate .studio-inline-mention {
    z-index: 3 !important;
    height: 25px !important;
    max-width: 92px !important;
    margin: 0 2px !important;
    padding: 2px 8px 2px 4px !important;
    vertical-align: middle !important;
    line-height: 20px !important;
    overflow: hidden !important;
    border-color: rgba(255, 255, 255, 0.36) !important;
    cursor: default !important;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.055)),
      rgba(18, 19, 22, 0.86) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.22),
      0 4px 10px rgba(0, 0, 0, 0.18) !important;
  }

  body.view-generate .studio-inline-mention img,
  body.view-generate .studio-inline-mention-media {
    width: 18px !important;
    height: 18px !important;
    margin-right: 5px !important;
    border-radius: 6px !important;
    cursor: default !important;
  }

  body.view-generate .studio-inline-mention-label {
    cursor: default !important;
  }

  body.view-generate .studio-inline-mention-label {
    max-width: 50px !important;
  }

  body.view-generate .studio-mention-menu {
    padding: 6px !important;
    gap: 4px !important;
  }

  body.view-generate .studio-mention-option {
    flex-basis: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    gap: 7px !important;
    padding: 0 8px 0 5px !important;
  }

  body.view-generate .studio-mention-option img,
  body.view-generate .studio-mention-option-media {
    flex-basis: 28px !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 8px !important;
  }
}

/* Canvas chat material pass: match the raised studio/node panel feel. */
body.view-canvas {
  --canvas-chat-panel-bg:
    radial-gradient(820px 520px at 12% -10%, rgba(255, 255, 255, 0.095), transparent 42%),
    radial-gradient(620px 480px at 98% 4%, rgba(85, 216, 194, 0.105), transparent 45%),
    linear-gradient(180deg, rgba(42, 45, 52, 0.985), rgba(28, 31, 38, 0.985));
  --canvas-chat-surface-bg:
    radial-gradient(440px 260px at 22% 0%, rgba(255, 255, 255, 0.07), transparent 48%),
    linear-gradient(180deg, rgba(43, 46, 53, 0.94), rgba(24, 27, 34, 0.95));
  --canvas-chat-control-bg:
    linear-gradient(180deg, rgba(255, 255, 255, 0.115), rgba(255, 255, 255, 0.035)),
    rgba(36, 38, 44, 0.92);
  --canvas-chat-control-hover:
    linear-gradient(180deg, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0.065)),
    rgba(48, 50, 57, 0.96);
  --canvas-chat-border: rgba(255, 255, 255, 0.155);
  --canvas-chat-border-soft: rgba(255, 255, 255, 0.095);
  --canvas-chat-shadow:
    0 30px 96px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.095),
    inset 0 -76px 110px rgba(0, 0, 0, 0.24);
  --canvas-chat-surface-shadow:
    0 22px 62px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.028),
    inset 0 1px 0 rgba(255, 255, 255, 0.095);
}

body.view-canvas .canvas-chat-drawer {
  right: 18px !important;
  top: 76px !important;
  bottom: 18px !important;
  border: 1px solid var(--canvas-chat-border) !important;
  border-radius: 30px !important;
  background: var(--canvas-chat-panel-bg) !important;
  box-shadow: var(--canvas-chat-shadow) !important;
  -webkit-backdrop-filter: blur(18px) saturate(1.12) !important;
  backdrop-filter: blur(18px) saturate(1.12) !important;
  overflow: hidden !important;
  isolation: isolate;
}

body.view-canvas .canvas-chat-drawer::before {
  content: "" !important;
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.07), transparent 18%, transparent 82%, rgba(255, 255, 255, 0.03)),
    radial-gradient(circle at 26% 0%, rgba(255, 255, 255, 0.105), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 20%, rgba(0, 0, 0, 0.17) 100%);
  pointer-events: none;
}

body.view-canvas .canvas-chat-drawer > * {
  position: relative;
  z-index: 1;
}

body.view-canvas .chat-resize-handle {
  z-index: 4;
}

body.view-canvas .chat-drawer-head {
  height: 66px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.085) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.012)),
    transparent !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.075) !important;
}

body.view-canvas .chat-thread {
  background:
    radial-gradient(520px 360px at 16% 0%, rgba(85, 216, 194, 0.045), transparent 48%),
    radial-gradient(520px 400px at 100% 82%, rgba(255, 255, 255, 0.035), transparent 54%),
    transparent !important;
}

body.view-canvas .chat-message {
  border: 1px solid var(--canvas-chat-border-soft) !important;
  border-radius: 24px !important;
  background: var(--canvas-chat-surface-bg) !important;
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.075) !important;
  color: rgba(255, 255, 255, 0.9) !important;
}

body.view-canvas .chat-message.user {
  border-color: rgba(255, 255, 255, 0.2) !important;
  background:
    radial-gradient(380px 240px at 8% 0%, rgba(85, 216, 194, 0.105), transparent 48%),
    linear-gradient(180deg, rgba(46, 50, 56, 0.96), rgba(29, 33, 39, 0.96)) !important;
  box-shadow:
    0 20px 58px rgba(0, 0, 0, 0.38),
    0 0 30px rgba(85, 216, 194, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.105) !important;
}

body.view-canvas .chat-message.assistant,
body.view-canvas .chat-message.pending {
  background:
    radial-gradient(420px 260px at 18% 0%, rgba(255, 255, 255, 0.055), transparent 48%),
    linear-gradient(180deg, rgba(38, 41, 48, 0.91), rgba(24, 27, 34, 0.93)) !important;
}

body.view-canvas .chat-composer {
  position: relative !important;
  border: 1px solid var(--canvas-chat-border) !important;
  border-radius: 30px !important;
  background:
    radial-gradient(620px 300px at 14% -18%, rgba(255, 255, 255, 0.105), transparent 43%),
    radial-gradient(520px 320px at 100% 0%, rgba(85, 216, 194, 0.095), transparent 46%),
    linear-gradient(180deg, rgba(43, 46, 53, 0.985), rgba(25, 28, 35, 0.985)) !important;
  box-shadow: var(--canvas-chat-surface-shadow) !important;
  overflow: visible !important;
  isolation: isolate;
  -webkit-backdrop-filter: blur(18px) saturate(1.08) !important;
  backdrop-filter: blur(18px) saturate(1.08) !important;
}

body.view-canvas .chat-composer::before {
  content: "" !important;
  position: absolute;
  inset: 1px;
  z-index: 0;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.065), transparent 28%),
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.08), transparent 34%);
  pointer-events: none;
}

body.view-canvas .chat-composer > * {
  position: relative;
  z-index: 1;
}

body.view-canvas .chat-composer:focus-within {
  border-color: rgba(255, 255, 255, 0.26) !important;
  box-shadow:
    0 26px 74px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(255, 255, 255, 0.055),
    0 0 36px rgba(85, 216, 194, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}

body.view-canvas .chat-input {
  color: rgba(255, 255, 255, 0.91) !important;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.28);
}

body.view-canvas .chat-generate-modes,
body.view-canvas .chat-model-param-panel {
  border-color: rgba(255, 255, 255, 0.085) !important;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(255, 255, 255, 0.022)),
    rgba(0, 0, 0, 0.16) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 12px 28px rgba(0, 0, 0, 0.18) !important;
}

body.view-canvas .chat-generate-modes button.active,
body.view-canvas .chat-model-param-choice.active {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(222, 226, 232, 0.9)) !important;
  color: #111 !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 12px 28px rgba(0, 0, 0, 0.24) !important;
}

body.view-canvas .chat-head-actions > button,
body.view-canvas .chat-history-wrap > button,
body.view-canvas .chat-head-agent-controls #canvasChatAgentManage,
body.view-canvas .chat-composer-tools > button,
body.view-canvas .chat-send,
body.view-canvas .chat-select-trigger,
body.view-canvas .text-model-select-trigger,
body.view-canvas .chat-model-param-choice {
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  background: var(--canvas-chat-control-bg) !important;
  color: rgba(255, 255, 255, 0.84) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 12px 28px rgba(0, 0, 0, 0.28) !important;
  -webkit-backdrop-filter: blur(14px) saturate(1.08) !important;
  backdrop-filter: blur(14px) saturate(1.08) !important;
}

body.view-canvas .chat-head-actions > button:hover,
body.view-canvas .chat-history-wrap > button:hover,
body.view-canvas .chat-head-agent-controls #canvasChatAgentManage:hover,
body.view-canvas .chat-composer-tools > button:hover,
body.view-canvas .chat-send:hover,
body.view-canvas .chat-select-trigger:hover,
body.view-canvas .chat-select.open .chat-select-trigger,
body.view-canvas .text-model-select-trigger:hover,
body.view-canvas .text-model-select-control.open .text-model-select-trigger,
body.view-canvas .chat-model-param-choice:hover {
  border-color: rgba(255, 255, 255, 0.28) !important;
  background: var(--canvas-chat-control-hover) !important;
  color: #fff !important;
  box-shadow:
    0 0 26px rgba(85, 216, 194, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 14px 34px rgba(0, 0, 0, 0.34) !important;
  transform: translateY(-1px);
}

body.view-canvas .chat-send {
  background:
    linear-gradient(180deg, rgba(245, 245, 245, 0.96), rgba(208, 214, 222, 0.94)) !important;
  color: #111 !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
}

body.view-canvas .chat-select-menu,
body.view-canvas .text-model-select-menu,
body.view-canvas .chat-history-popover {
  border: 1px solid rgba(255, 255, 255, 0.145) !important;
  border-radius: 22px !important;
  background:
    radial-gradient(420px 260px at 24% 0%, rgba(255, 255, 255, 0.075), transparent 44%),
    radial-gradient(360px 240px at 100% 0%, rgba(85, 216, 194, 0.06), transparent 48%),
    linear-gradient(180deg, rgba(36, 39, 46, 0.985), rgba(20, 23, 29, 0.985)) !important;
  box-shadow:
    0 24px 68px rgba(0, 0, 0, 0.54),
    0 0 0 1px rgba(255, 255, 255, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.09) !important;
  -webkit-backdrop-filter: blur(18px) saturate(1.12) !important;
  backdrop-filter: blur(18px) saturate(1.12) !important;
}

body.view-canvas .chat-select-option,
body.view-canvas .text-model-select-option,
body.view-canvas .chat-history-item {
  border-radius: 15px !important;
}

body.view-canvas .chat-select-option:hover,
body.view-canvas .chat-select-option.active,
body.view-canvas .text-model-select-option:hover,
body.view-canvas .text-model-select-option.active,
body.view-canvas .chat-history-item:hover,
body.view-canvas .chat-history-item.active {
  background:
    linear-gradient(90deg, rgba(85, 216, 194, 0.13), rgba(255, 255, 255, 0.055)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 12px 30px rgba(0, 0, 0, 0.18) !important;
}

body.view-canvas .chat-context-chip {
  border-color: rgba(85, 216, 194, 0.28) !important;
  background:
    radial-gradient(260px 140px at 0% 0%, rgba(85, 216, 194, 0.16), transparent 52%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.028)),
    rgba(26, 29, 35, 0.82) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 12px 28px rgba(0, 0, 0, 0.24) !important;
}

@media (max-width: 780px) {
  body.view-canvas .canvas-chat-drawer {
    right: 8px !important;
    top: 8px !important;
    bottom: 8px !important;
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    border-radius: 26px !important;
  }

  body.view-canvas .chat-composer {
    border-radius: 26px !important;
  }
}

/* Canvas chat cohesion pass: pull the drawer back into the node material system. */
body.view-canvas {
  --canvas-chat-node-bg:
    radial-gradient(520px 360px at 18% 0%, rgba(255, 255, 255, 0.065), transparent 44%),
    linear-gradient(180deg, rgba(34, 34, 34, 0.99), rgba(28, 28, 28, 0.99));
  --canvas-chat-node-flat: #202020;
  --canvas-chat-node-border: rgba(255, 255, 255, 0.12);
  --canvas-chat-node-border-strong: rgba(255, 255, 255, 0.2);
  --canvas-chat-node-shadow:
    0 18px 58px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(255, 255, 255, 0.10),
    0 0 28px rgba(85, 216, 194, 0.12);
  --canvas-chat-control-node:
    linear-gradient(180deg, rgba(42, 44, 47, 0.72), rgba(12, 13, 15, 0.62));
  --canvas-chat-control-node-hover:
    linear-gradient(180deg, rgba(74, 77, 82, 0.78), rgba(18, 20, 23, 0.66));
}

body.view-canvas .canvas-chat-drawer {
  border: 1px solid var(--canvas-chat-node-border) !important;
  background: var(--canvas-chat-node-bg) !important;
  box-shadow: var(--canvas-chat-node-shadow) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

body.view-canvas .canvas-chat-drawer::before {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 92px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035), transparent 18%, transparent 82%, rgba(255, 255, 255, 0.018)) !important;
}

body.view-canvas .chat-drawer-head {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.01)),
    transparent !important;
  box-shadow: none !important;
}

body.view-canvas .chat-thread {
  background: transparent !important;
}

body.view-canvas .chat-message,
body.view-canvas .chat-message.user,
body.view-canvas .chat-message.assistant,
body.view-canvas .chat-message.pending {
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.038), rgba(255, 255, 255, 0.012)),
    rgba(31, 31, 31, 0.98) !important;
  box-shadow:
    0 14px 42px rgba(0, 0, 0, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.055) !important;
}

body.view-canvas .chat-message.user {
  border-color: rgba(85, 216, 194, 0.20) !important;
  box-shadow:
    0 14px 42px rgba(0, 0, 0, 0.32),
    0 0 20px rgba(85, 216, 194, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

body.view-canvas .chat-composer {
  border: 1px solid var(--canvas-chat-node-border) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012)),
    var(--canvas-chat-node-flat) !important;
  box-shadow:
    0 18px 52px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.07) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

body.view-canvas .chat-composer::before {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 58px) !important;
}

body.view-canvas .chat-composer:focus-within {
  border-color: var(--canvas-chat-node-border-strong) !important;
  box-shadow:
    0 18px 58px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 34px rgba(85, 216, 194, 0.16) !important;
}

body.view-canvas .chat-head-actions > button,
body.view-canvas .chat-history-wrap > button,
body.view-canvas .chat-head-agent-controls #canvasChatAgentManage,
body.view-canvas .chat-composer-tools > button,
body.view-canvas .chat-select-trigger,
body.view-canvas .text-model-select-trigger,
body.view-canvas .chat-model-param-choice {
  border-color: rgba(255, 255, 255, 0.18) !important;
  background: var(--canvas-chat-control-node) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.28),
    0 12px 30px rgba(0, 0, 0, 0.32) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

body.view-canvas .chat-head-actions > button:hover,
body.view-canvas .chat-history-wrap > button:hover,
body.view-canvas .chat-head-agent-controls #canvasChatAgentManage:hover,
body.view-canvas .chat-composer-tools > button:hover,
body.view-canvas .chat-select-trigger:hover,
body.view-canvas .chat-select.open .chat-select-trigger,
body.view-canvas .text-model-select-trigger:hover,
body.view-canvas .text-model-select-control.open .text-model-select-trigger,
body.view-canvas .chat-model-param-choice:hover {
  border-color: rgba(255, 255, 255, 0.30) !important;
  background: var(--canvas-chat-control-node-hover) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 -1px 0 rgba(0, 0, 0, 0.30),
    0 14px 34px rgba(0, 0, 0, 0.38),
    0 0 18px rgba(255, 255, 255, 0.06) !important;
}

body.view-canvas .chat-send {
  border-color: rgba(255, 255, 255, 0.22) !important;
  background:
    linear-gradient(180deg, rgba(242, 242, 242, 0.96), rgba(198, 202, 208, 0.94)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 12px 30px rgba(0, 0, 0, 0.34) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

body.view-canvas .chat-select-menu,
body.view-canvas .text-model-select-menu,
body.view-canvas .chat-history-popover {
  border-color: rgba(255, 255, 255, 0.12) !important;
  background:
    linear-gradient(180deg, rgba(38, 38, 38, 0.96), rgba(19, 19, 19, 0.96)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 20px 54px rgba(0, 0, 0, 0.54) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

body.view-canvas .chat-context-chip {
  border-color: rgba(85, 216, 194, 0.20) !important;
  background:
    linear-gradient(180deg, rgba(85, 216, 194, 0.10), rgba(85, 216, 194, 0.045)),
    rgba(22, 23, 26, 0.96) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    0 8px 22px rgba(0, 0, 0, 0.20) !important;
}

.quick-resolution-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-bottom: 9px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.quick-resolution-title {
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  font-weight: 820;
  line-height: 1;
}

.quick-resolution-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.quick-resolution-choice {
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  padding: 0 8px;
  text-align: center;
  white-space: nowrap;
}

.quick-resolution-choice:hover,
.quick-resolution-choice.active {
  background: rgba(255, 255, 255, 0.92);
  color: #151515;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}


.video-download {
  position: absolute;
  left: auto;
  right: 62px;
  bottom: 18px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(18, 25, 14, 0.82);
  color: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  opacity: 1;
  cursor: pointer;
  pointer-events: auto;
  z-index: 4;
  transition: opacity 140ms ease, transform 160ms ease, border-color 140ms ease, background 140ms ease;
}

.video-download svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.video-node:not(.has-video) .video-download,
.gen-node:not(.has-video) .video-download,
.gen-node.busy .video-download {
  opacity: 0;
  pointer-events: none;
}

/* canvas video direct download 0100 */

/* canvas download lock 0101 */
.video-download.is-downloading,
.video-download:disabled {
  opacity: .58;
  cursor: wait;
  filter: saturate(.75);
}

/* canvas native video download links 0102 */
a.video-download {
  text-decoration: none;
}
.video-download.disabled,
.video-download[aria-disabled="true"] {
  opacity: .34;
  pointer-events: none;
}

/* canvas video anchors 0103 */

/* canvas visible video download feedback 0106 */
.video-download.is-pressed {
  transform: translateY(0) scale(.94);
  border-color: rgba(255, 255, 255, .42);
  background: rgba(255, 255, 255, .94);
  color: #151515;
}

.video-download.is-downloading,
.video-download[aria-busy="true"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  cursor: progress;
  filter: none;
  border-color: rgba(255, 255, 255, .5);
  background: rgba(255, 255, 255, .95);
  color: #151515;
}

.video-download.is-downloading svg,
.video-download[aria-busy="true"] svg {
  animation: video-download-feedback-spin 900ms linear infinite;
}

.video-download[data-download-label]::after {
  content: attr(data-download-label);
  position: absolute;
  right: -8px;
  bottom: 42px;
  min-width: 46px;
  max-width: 96px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .96);
  color: #151515;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .24);
  pointer-events: none;
}

.video-download-active .video-download {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

@keyframes video-download-feedback-spin {
  to { transform: rotate(360deg); }
}


/* toolbar video download state 0108 */
.tool-btn[data-action="download"].is-downloading,
.tool-btn[data-action="download"][aria-busy="true"] {
  background: rgba(255, 255, 255, 0.94);
  color: #151515;
  cursor: progress;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28), 0 10px 24px rgba(0, 0, 0, 0.3);
}

.tool-btn[data-action="download"].download-started {
  background: rgba(181, 255, 214, 0.94);
  color: #102417;
  box-shadow: 0 0 0 1px rgba(181, 255, 214, 0.42), 0 10px 24px rgba(0, 0, 0, 0.28);
}

.tool-btn[data-action="download"].is-downloading svg,
.tool-btn[data-action="download"][aria-busy="true"] svg {
  animation: video-download-feedback-spin 900ms linear infinite;
}

/* canvas video download overlay quiet mode 0108 */
.canvas-node.video-node.has-video .video-download,
.canvas-node.gen-node.has-video .video-download {
  opacity: 0;
  pointer-events: none;
}

.canvas-node.video-node.has-video .video-frame:hover .video-download,
.canvas-node.video-node.has-video .video-download:focus-visible,
.canvas-node.gen-node.has-video .gen-preview:hover .video-download,
.canvas-node.gen-node.has-video .video-download:focus-visible,
.canvas-node.video-download-active .video-download {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}


/* canvas video download overlay active override 0109 */
.canvas-node.video-node.has-video.video-download-active .video-download,
.canvas-node.gen-node.has-video.video-download-active .video-download,
.canvas-node.video-node.has-video .video-download.is-downloading,
.canvas-node.gen-node.has-video .video-download.is-downloading,
.canvas-node.video-node.has-video .video-download[aria-busy="true"],
.canvas-node.gen-node.has-video .video-download[aria-busy="true"] {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
