:root {
  --bg: #050506;
  --bg-elevated: #0b0d10;
  --panel: rgba(11, 13, 16, 0.78);
  --panel-strong: rgba(16, 18, 22, 0.94);
  --line: rgba(126, 255, 241, 0.18);
  --line-strong: rgba(126, 255, 241, 0.46);
  --text: #f5fbff;
  --muted: #8b98a5;
  --dim: #56616d;
  --cyan: #37f5ff;
  --lime: #d7ff41;
  --pink: #ff3df2;
  --amber: #ffb547;
  --red: #ff496d;
  --shadow-cyan: 0 0 24px rgba(55, 245, 255, 0.28);
  --shadow-pink: 0 0 28px rgba(255, 61, 242, 0.2);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 61, 242, 0.13), transparent 28%),
    radial-gradient(circle at 18% 88%, rgba(215, 255, 65, 0.1), transparent 28%),
    #050506;
  overflow: hidden;
}

button,
textarea,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button {
  color: inherit;
}

textarea,
input,
select {
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  outline: none;
}

select {
  color-scheme: dark;
  background-color: #101318;
}

select option,
select optgroup {
  color: var(--text);
  background-color: #101318;
}

select option:checked {
  color: var(--lime);
  background-color: #273137;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--cyan);
  box-shadow: var(--shadow-cyan);
}

.app-shell {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  height: 100vh;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 42px 42px;
}

.app-shell::after {
  position: fixed;
  inset: 0;
  content: "";
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.025) 0,
    rgba(255, 255, 255, 0.025) 1px,
    transparent 2px,
    transparent 5px
  );
  opacity: 0.42;
  mix-blend-mode: screen;
}

.side-rail {
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 16px 10px;
  border-right: 1px solid rgba(126, 255, 241, 0.16);
  background: rgba(4, 5, 6, 0.86);
  backdrop-filter: blur(22px);
}

.brand-mark,
.brand-dot {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(215, 255, 65, 0.72);
  border-radius: 50%;
  color: var(--lime);
  background: #070807;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 0 18px rgba(215, 255, 65, 0.24);
}

.brand-dot {
  width: 30px;
  height: 30px;
  font-size: 11px;
}

.rail-nav,
.rail-tools {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rail-nav {
  flex: 0 0 auto;
}

.rail-tools {
  flex: 1 1 auto;
  padding-top: 8px;
}

.rail-button,
.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  color: #c9d5de;
  background: rgba(255, 255, 255, 0.04);
  transition: transform 160ms ease, border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.rail-button {
  width: 36px;
  height: 36px;
}

.rail-button:hover,
.rail-button.active,
.tool-button:hover,
.tool-button.active {
  color: var(--cyan);
  border-color: rgba(55, 245, 255, 0.64);
  background: rgba(55, 245, 255, 0.08);
  box-shadow: var(--shadow-cyan);
}

.help-button {
  color: var(--lime);
  font-weight: 800;
}

.main-surface {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.view {
  position: absolute;
  inset: 0;
  display: none;
}

.view.is-visible {
  display: block;
}

.dashboard-view {
  padding: 38px clamp(24px, 5vw, 72px);
  overflow: auto;
}

.top-strip,
.studio-topbar,
.section-heading,
.console-actions,
.prompt-node footer,
.chat-box footer,
.agent-panel header,
.modal-card header,
.modal-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.top-strip {
  max-width: 1160px;
  margin: 0 auto 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--lime);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(34px, 5vw, 76px);
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 0 32px rgba(55, 245, 255, 0.18);
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

h3 {
  margin-bottom: 6px;
  font-size: 15px;
}

.credit-pill,
.credit-mini {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 8px 0 12px;
  border: 1px solid rgba(215, 255, 65, 0.28);
  border-radius: 999px;
  background: rgba(215, 255, 65, 0.08);
}

.account-button {
  color: var(--cyan);
  border-color: rgba(55, 245, 255, 0.38);
  background: rgba(55, 245, 255, 0.08);
}

.account-button.is-logged-in {
  color: var(--lime);
  border-color: rgba(215, 255, 65, 0.5);
  background: rgba(215, 255, 65, 0.1);
}

.credit-pill button,
.studio-meta button,
.agent-panel header button,
.section-heading button,
.notify-strip button,
.ghost-close,
.secondary-action {
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.credit-pill button,
.studio-meta button,
.agent-panel header button,
.section-heading button,
.notify-strip button {
  padding: 0 12px;
}

.bolt {
  width: 9px;
  height: 16px;
  background: var(--lime);
  clip-path: polygon(45% 0, 100% 0, 58% 43%, 100% 43%, 25% 100%, 44% 55%, 0 55%);
  box-shadow: 0 0 12px rgba(215, 255, 65, 0.8);
}

.hero-console {
  position: relative;
  max-width: 760px;
  min-height: 164px;
  margin: 0 auto;
  padding: 22px;
  border: 1px solid rgba(126, 255, 241, 0.2);
  border-radius: 8px;
  background: rgba(9, 10, 12, 0.82);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.44), var(--shadow-cyan);
  overflow: hidden;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 22px;
  width: min(1320px, 100%);
  margin: 0 auto;
  align-items: start;
}

.dashboard-main-column {
  min-width: 0;
}

.dashboard-main-column .hero-console {
  max-width: 760px;
}

.dashboard-main-column .quick-models {
  max-width: 840px;
}

.dashboard-main-column .recent-section {
  max-width: 1160px;
}

.commerce-agent-card {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 12;
  display: none;
  width: min(430px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  gap: 14px;
  padding: 12px;
  border: 1px solid rgba(126, 255, 241, 0.26);
  border-radius: 8px;
  background: rgba(7, 8, 10, 0.9);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.34), 0 0 28px rgba(55, 245, 255, 0.12);
  overflow: auto;
  cursor: default;
  touch-action: auto;
}

.commerce-agent-card.is-open {
  display: grid;
}

.commerce-agent-card.is-highlighted {
  border-color: rgba(215, 255, 65, 0.72);
  box-shadow: 0 0 0 1px rgba(215, 255, 65, 0.26), 0 24px 70px rgba(0, 0, 0, 0.45);
}

.commerce-agent-card.is-hidden {
  display: none !important;
}

.commerce-hide-button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  color: #b6bec7;
  background: rgba(55, 60, 66, 0.84);
  font-size: 15px;
  line-height: 1;
}

.commerce-hide-button:hover {
  color: #f5fbff;
  border-color: rgba(245, 251, 255, 0.22);
  background: rgba(86, 97, 109, 0.96);
}

.commerce-agent-card > header,
.commerce-template-card > header,
.commerce-template-card footer,
.commerce-agent-footer,
.commerce-editor-card header,
.commerce-editor-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.commerce-agent-card > header h2 {
  font-size: 16px;
}

.commerce-agent-card > header span,
.commerce-template-card small,
.commerce-editor-card header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.commerce-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.commerce-upload-tile {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-height: 78px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #dce7ef;
  background: rgba(255, 255, 255, 0.055);
}

.commerce-upload-tile.has-file {
  color: var(--lime);
  border-color: rgba(215, 255, 65, 0.48);
  background: rgba(215, 255, 65, 0.08);
}

.commerce-upload-tile small {
  max-width: 100%;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commerce-preview-groups {
  display: grid;
  gap: 10px;
}

.commerce-preview-group {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(126, 255, 241, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.commerce-preview-group[hidden] {
  display: none;
}

.commerce-preview-group header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.commerce-preview-group strong {
  color: #dce7ef;
  font-size: 12px;
}

.commerce-preview-group header button {
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid rgba(215, 255, 65, 0.32);
  border-radius: 999px;
  color: var(--lime);
  background: rgba(215, 255, 65, 0.08);
  font-size: 12px;
  font-weight: 800;
}

.commerce-preview-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.commerce-preview-item {
  position: relative;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: rgba(11, 13, 16, 0.92);
  overflow: hidden;
}

.commerce-preview-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.commerce-preview-item span {
  display: block;
  padding: 5px 6px 6px;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commerce-preview-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid rgba(245, 251, 255, 0.16);
  border-radius: 50%;
  color: #b6bec7;
  background: rgba(55, 60, 66, 0.9);
  font-size: 13px;
  line-height: 1;
}

.commerce-meta-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) repeat(3, minmax(78px, 0.7fr));
  gap: 7px;
}

.commerce-meta-grid input,
.commerce-meta-grid select {
  min-width: 0;
  min-height: 36px;
  padding: 0 10px;
  font-size: 13px;
}

.commerce-agent-card textarea {
  width: 100%;
  min-height: 108px;
  padding: 12px;
  resize: vertical;
  line-height: 1.55;
}

.commerce-role-field {
  display: grid;
  gap: 7px;
  color: #dce7ef;
  font-size: 12px;
  font-weight: 800;
}

.commerce-role-template-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(118px, 0.62fr) auto auto;
  gap: 8px;
}

.commerce-role-template-row select {
  min-width: 0;
  min-height: 36px;
  font-size: 13px;
}

.commerce-role-template-row .secondary-action {
  min-height: 36px;
  white-space: nowrap;
}

.commerce-role-field textarea {
  min-height: 84px;
  color: rgba(245, 251, 255, 0.78);
  font-size: 12px;
}

.commerce-template-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.commerce-template-card[hidden] {
  display: none;
}

.commerce-template-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.commerce-template-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  min-height: 54px;
  padding: 10px;
  border: 1px solid rgba(126, 255, 241, 0.16);
  border-radius: 8px;
  background: rgba(27, 31, 39, 0.82);
}

.commerce-template-item > div {
  min-width: 0;
}

.commerce-template-item input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--lime);
}

.commerce-template-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commerce-template-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commerce-template-item.is-done {
  border-color: rgba(215, 255, 65, 0.38);
}

.commerce-template-card footer {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.commerce-agent-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
}

.commerce-model-select {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 0 10px;
  border-color: rgba(245, 251, 255, 0.18);
  color: #f5fbff;
  background: rgba(255, 255, 255, 0.075);
  font-size: 12px;
  font-weight: 800;
}

.commerce-spec-button {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: #f5fbff;
  background: rgba(255, 255, 255, 0.09);
  font-size: 12px;
  font-weight: 800;
}

.commerce-spec-button {
  border: 1px solid rgba(215, 255, 65, 0.36);
  color: #fff;
  background: rgba(215, 255, 65, 0.11);
  white-space: nowrap;
}

.commerce-spec-button:hover {
  border-color: rgba(215, 255, 65, 0.78);
}

.commerce-send,
.commerce-analyze {
  display: grid;
  place-items: center;
  margin-left: auto;
  border: 0;
  border-radius: 999px;
  color: #080a0b;
  background: var(--lime);
  font-weight: 900;
  box-shadow: 0 0 20px rgba(215, 255, 65, 0.32);
}

.commerce-send {
  width: 40px;
  height: 40px;
  font-size: 22px;
}

.commerce-analyze {
  margin-left: 0;
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
}

.hero-console::before,
.agent-panel::before,
.modal-card::before {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  border: 1px solid rgba(126, 255, 241, 0.14);
  transform: translate(5px, 5px);
}

.console-glow {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(55, 245, 255, 0.12), transparent 28%, rgba(255, 61, 242, 0.13)),
    linear-gradient(135deg, transparent 0 46%, rgba(215, 255, 65, 0.18) 47%, transparent 49%);
  pointer-events: none;
}

.hero-console textarea {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 88px;
  padding: 0;
  resize: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 17px;
  line-height: 1.65;
}

.hero-console textarea::placeholder,
.chat-box textarea::placeholder,
.prompt-node textarea::placeholder {
  color: rgba(245, 251, 255, 0.36);
}

.console-actions {
  position: relative;
  z-index: 1;
}

.compact-actions,
.mode-pills,
.quick-models,
.studio-meta,
.skill-cloud {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-button {
  width: 34px;
  height: 34px;
}

.tool-label {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.mode-pills {
  flex-wrap: wrap;
  justify-content: center;
}

.mode-pill,
.quick-models button,
.skill-cloud button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #c8d2dc;
  background: rgba(255, 255, 255, 0.04);
}

.mode-pill.active,
.quick-models button:hover,
.skill-cloud button:hover {
  color: var(--lime);
  border-color: rgba(215, 255, 65, 0.64);
  background: rgba(215, 255, 65, 0.08);
}

.primary-action,
.run-small {
  min-height: 38px;
  padding: 0 18px;
  border: 1px solid rgba(215, 255, 65, 0.78);
  border-radius: 999px;
  color: #080a0b;
  background: var(--lime);
  font-weight: 800;
  box-shadow: 0 0 24px rgba(215, 255, 65, 0.28);
}

.quick-models {
  flex-wrap: wrap;
  justify-content: center;
  max-width: 840px;
  margin: 26px auto 10vh;
}

.recent-section {
  max-width: 1160px;
  margin: 0 auto;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.recent-projects-toggle[hidden] {
  display: none;
}

.recent-projects-toggle::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 8px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.recent-projects-toggle[aria-expanded="true"]::after {
  transform: translateY(2px) rotate(225deg);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.project-card {
  min-height: 184px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  text-align: left;
  overflow: hidden;
}

.project-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.new-project {
  display: grid;
  place-items: center;
  border-style: dashed;
  text-align: center;
}

.plus-sign {
  width: 48px;
  height: 48px;
  color: var(--cyan);
  font-size: 42px;
  line-height: 42px;
}

.thumb {
  display: flex;
  align-items: flex-end;
  min-height: 118px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 6px;
  color: var(--bg);
  font-weight: 900;
  background:
    linear-gradient(135deg, rgba(55, 245, 255, 0.85), transparent 44%),
    linear-gradient(45deg, rgba(255, 61, 242, 0.82), transparent 50%),
    #111419;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.saved-project {
  position: relative;
  cursor: pointer;
}

.saved-project .project-open {
  display: grid;
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.saved-project .thumb {
  overflow: hidden;
}

.project-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(245, 251, 255, 0.16);
  border-radius: 50%;
  color: #b6bec7;
  background: rgba(55, 60, 66, 0.86);
  font-size: 16px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.saved-project:hover .project-delete,
.saved-project:focus-within .project-delete {
  opacity: 1;
}

.project-delete:hover {
  color: #f5fbff;
  background: rgba(86, 97, 109, 0.94);
}

.project-empty {
  display: grid;
  place-items: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
}

.thumb-product {
  background:
    repeating-linear-gradient(90deg, rgba(215, 255, 65, 0.75) 0 16px, transparent 16px 28px),
    linear-gradient(135deg, #ff496d, #14171d 60%);
}

.thumb-video {
  background:
    linear-gradient(90deg, transparent 0 46%, rgba(255, 255, 255, 0.18) 46% 48%, transparent 48%),
    repeating-linear-gradient(0deg, #111 0 28px, #1b2027 28px 54px);
  color: var(--cyan);
}

.studio-view {
  background: rgba(5, 5, 6, 0.52);
}

.studio-topbar {
  height: 54px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(126, 255, 241, 0.16);
  background: rgba(4, 5, 6, 0.78);
  backdrop-filter: blur(22px);
}

.studio-meta {
  flex: 0 0 auto;
}

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

.doc-title-input {
  width: min(34vw, 360px);
  min-width: 180px;
  height: 34px;
  padding: 0 8px;
  border-color: transparent;
  color: var(--text);
  background: transparent;
  font-size: 18px;
  font-weight: 900;
}

.doc-title-input:hover,
.doc-title-input:focus {
  border-color: rgba(245, 251, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: none;
}

.save-state,
.agent-panel header span,
.api-state {
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 388px;
  height: calc(100vh - 54px);
}

.workspace.agent-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.workspace.agent-hidden .agent-panel {
  display: none;
}

.canvas-zone {
  position: relative;
  overflow: hidden;
  cursor: default;
  touch-action: none;
  background:
    linear-gradient(rgba(126, 255, 241, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 255, 241, 0.055) 1px, transparent 1px),
    radial-gradient(circle at center, rgba(55, 245, 255, 0.08), transparent 42%),
    #08090b;
  background-size: 32px 32px, 32px 32px, auto, auto;
}

.canvas-zone.is-panning {
  cursor: grabbing;
}

.canvas-zone.space-pan-ready,
.canvas-zone.space-pan-ready .canvas-node,
.canvas-zone.space-pan-ready .prompt-node {
  cursor: grab;
}

.canvas-zone.is-dropping {
  outline: 1px solid rgba(215, 255, 65, 0.72);
  outline-offset: -10px;
}

.canvas-zone::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, rgba(255, 61, 242, 0.13), transparent 22%, transparent 76%, rgba(215, 255, 65, 0.1)),
    linear-gradient(0deg, rgba(0, 0, 0, 0.5), transparent 20%, transparent 76%, rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

.canvas-stage {
  position: absolute;
  inset: 0;
  transform: translate3d(var(--pan-x, 0px), var(--pan-y, 0px), 0) scale(var(--zoom, 1));
  transform-origin: 0 0;
  will-change: transform;
  backface-visibility: hidden;
}

.connection-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.connection-base,
.connection-line {
  fill: none;
  stroke: var(--cyan);
  stroke-linecap: round;
  cursor: pointer;
  pointer-events: stroke;
}

.connection-base {
  stroke-width: 2.2;
  stroke-opacity: 0.58;
  filter: drop-shadow(0 0 4px rgba(55, 245, 255, 0.9)) drop-shadow(0 0 14px rgba(55, 245, 255, 0.34));
}

.connection-line {
  stroke-width: 2.8;
  stroke-dasharray: 2 22;
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 6px rgba(215, 255, 65, 0.9)) drop-shadow(0 0 15px rgba(55, 245, 255, 0.68));
  animation: neon-flow 1.15s linear infinite;
}

.connection-hitbox {
  fill: none;
  stroke: rgba(255, 255, 255, 0);
  stroke-width: 34;
  stroke-linecap: round;
  cursor: pointer;
  pointer-events: stroke;
}

.connection-base.is-hidden,
.connection-line.is-hidden,
.connection-hitbox.is-hidden {
  display: none;
}

.connection-line.pending {
  stroke: var(--lime);
  stroke-width: 3;
  stroke-dasharray: 8 8;
  animation: neon-flow 0.8s linear infinite;
  pointer-events: none;
}

@keyframes neon-flow {
  to {
    stroke-dashoffset: -48;
  }
}

.disconnect-connection {
  position: absolute;
  z-index: 8;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(245, 251, 255, 0.18);
  border-radius: 999px;
  color: #c7d0d9;
  background: rgba(55, 60, 66, 0.9);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
  font-weight: 800;
  cursor: pointer;
  transform: translate(-50%, -50%);
}

.canvas-toast {
  position: absolute;
  left: 50%;
  top: 18px;
  z-index: 12;
  max-width: min(520px, calc(100% - 48px));
  padding: 10px 14px;
  border: 1px solid rgba(55, 245, 255, 0.36);
  border-radius: 999px;
  color: var(--text);
  background: rgba(8, 10, 12, 0.92);
  box-shadow: var(--shadow-cyan);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px);
  transition: opacity 160ms ease, transform 160ms ease;
  backdrop-filter: blur(18px);
}

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

.studio-topbar .canvas-toast {
  position: static;
  left: auto;
  top: auto;
  z-index: 1;
  flex: 0 1 min(460px, 38vw);
  margin-left: auto;
  margin-right: 4px;
  overflow: hidden;
  text-align: center;
  white-space: nowrap;
  text-overflow: ellipsis;
  transform: translateY(-6px);
}

.studio-topbar .canvas-toast.is-visible {
  transform: translateY(0);
}

.studio-topbar .canvas-toast-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-preview-window {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 60;
  display: none;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 360px;
  min-height: 260px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  border: 1px solid rgba(55, 245, 255, 0.5);
  border-radius: 10px;
  background:
    linear-gradient(rgba(126, 255, 241, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 255, 241, 0.04) 1px, transparent 1px),
    rgba(6, 8, 12, 0.96);
  background-size: 24px 24px;
  box-shadow: 0 0 0 1px rgba(255, 61, 242, 0.18), 0 24px 100px rgba(0, 0, 0, 0.72), var(--shadow-cyan);
  overflow: hidden;
  resize: both;
  transform: translate(-50%, -50%);
  backdrop-filter: blur(24px);
}

.media-preview-window.is-open {
  display: grid;
}

.media-preview-window::before {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(135deg, transparent 0 44%, rgba(215, 255, 65, 0.12) 45%, transparent 48%);
}

.media-preview-window header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 46px;
  padding: 8px 10px 8px 14px;
  border-bottom: 1px solid rgba(126, 255, 241, 0.16);
  background: rgba(3, 5, 7, 0.78);
}

.media-preview-window header div:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.media-preview-window strong {
  color: var(--lime);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.media-preview-title {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-preview-actions {
  display: inline-flex;
  gap: 8px;
}

.media-preview-actions button {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(126, 255, 241, 0.2);
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(255, 255, 255, 0.06);
}

.media-preview-close {
  min-height: 24px;
  width: 24px;
  height: 24px;
  padding: 0 !important;
  color: #b6bec7 !important;
  border-color: rgba(245, 251, 255, 0.16) !important;
  background: rgba(55, 60, 66, 0.84) !important;
  font-size: 15px;
}

.media-preview-body {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 14px;
  overflow: hidden;
  cursor: grab;
}

.media-preview-body.is-dragging {
  cursor: grabbing;
}

.media-preview-content {
  width: 100%;
  height: 100%;
  min-height: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.media-preview-content.is-image {
  width: auto;
  height: auto;
}

.media-preview-content img,
.media-preview-content video {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 8px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.42);
  -webkit-user-drag: none;
  user-select: none;
}

.selection-box {
  position: fixed;
  z-index: 30;
  border: 1px solid rgba(215, 255, 65, 0.85);
  background: rgba(215, 255, 65, 0.08);
  box-shadow: 0 0 22px rgba(215, 255, 65, 0.26), inset 0 0 18px rgba(55, 245, 255, 0.1);
  pointer-events: none;
}

.selection-action {
  position: absolute;
  z-index: 12;
  display: grid;
  padding: 7px;
  border: 1px solid rgba(215, 255, 65, 0.6);
  border-radius: 18px;
  background: rgba(6, 8, 12, 0.92);
  box-shadow: 0 0 28px rgba(215, 255, 65, 0.28), 0 0 44px rgba(55, 245, 255, 0.12);
  backdrop-filter: blur(18px);
}

.selection-action button {
  min-height: 46px;
  padding: 0 24px;
  border: 1px solid rgba(215, 255, 65, 0.9);
  border-radius: 999px;
  color: #050506;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.45), transparent 24%),
    var(--lime);
  box-shadow: 0 0 24px rgba(215, 255, 65, 0.42), inset 0 0 14px rgba(255, 255, 255, 0.22);
  font-size: 16px;
  font-weight: 900;
}

.selection-action button:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(215, 255, 65, 0.58), inset 0 0 16px rgba(255, 255, 255, 0.28);
}

.workflow-group {
  position: absolute;
  z-index: 0;
  min-width: 240px;
  min-height: 180px;
  border: 2px solid rgba(55, 245, 255, 0.78);
  border-radius: 12px;
  background:
    radial-gradient(circle at 70% 12%, rgba(55, 245, 255, 0.16), transparent 28%),
    linear-gradient(rgba(55, 245, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 255, 241, 0.045) 1px, transparent 1px),
    rgba(55, 245, 255, 0.035);
  background-size: 100% 100%, 26px 26px, 26px 26px, 100% 100%;
  box-shadow:
    inset 0 0 46px rgba(55, 245, 255, 0.12),
    0 0 0 1px rgba(126, 255, 241, 0.18),
    0 0 30px rgba(55, 245, 255, 0.26),
    0 0 56px rgba(28, 121, 255, 0.16);
  cursor: default;
  pointer-events: auto;
  user-select: none;
}

.workflow-group-title {
  position: absolute;
  left: 12px;
  top: -13px;
  padding: 2px 9px;
  border: 1px solid rgba(55, 245, 255, 0.58);
  border-radius: 999px;
  color: #fff;
  background: rgba(6, 8, 12, 0.94);
  box-shadow: 0 0 18px rgba(55, 245, 255, 0.28);
  font-size: 12px;
  font-weight: 900;
  pointer-events: none;
}

.workflow-group-actions {
  position: absolute;
  right: 12px;
  top: -24px;
  display: inline-flex;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.workflow-group:hover .workflow-group-actions,
.workflow-group:focus-within .workflow-group-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.workflow-group-actions button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid rgba(55, 245, 255, 0.68);
  border-radius: 999px;
  color: var(--lime);
  background: rgba(6, 8, 12, 0.94);
  box-shadow: 0 0 20px rgba(55, 245, 255, 0.22), inset 0 0 12px rgba(55, 245, 255, 0.08);
  font-size: 14px;
  font-weight: 900;
}

.workflow-group-actions button:hover {
  border-color: var(--lime);
  box-shadow: 0 0 26px rgba(215, 255, 65, 0.26), inset 0 0 12px rgba(55, 245, 255, 0.12);
}

.workflow-group-actions [data-group-delete] {
  width: 30px;
  min-height: 30px;
  padding: 0;
  border-color: rgba(245, 251, 255, 0.16);
  color: #b6bec7;
  background: rgba(55, 60, 66, 0.9);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  font-size: 17px;
  line-height: 1;
}

.workflow-group-actions [data-group-delete]:hover {
  border-color: rgba(245, 251, 255, 0.24);
  color: #f5fbff;
  background: rgba(86, 97, 109, 0.96);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
}

.workflow-group.is-collapsed {
  min-height: 54px !important;
  background: rgba(55, 245, 255, 0.08);
}

.workflow-group.is-active {
  border-color: rgba(215, 255, 65, 0.86);
  box-shadow:
    inset 0 0 42px rgba(215, 255, 65, 0.08),
    0 0 0 1px rgba(215, 255, 65, 0.32),
    0 0 26px rgba(215, 255, 65, 0.22);
}

.group-hidden {
  display: none !important;
}

.canvas-node,
.prompt-node {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(13, 15, 18, 0.84);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(12px);
  user-select: none;
  will-change: transform, left, top;
  contain: layout style;
  overflow: visible;
}

.canvas-node {
  width: min(34vw, 520px);
  min-width: 300px;
  aspect-ratio: 1;
}

.image-node {
  display: flex;
  flex-direction: column;
  aspect-ratio: auto;
}

.canvas-node,
.canvas-node header,
.placeholder-media,
.video-placeholder,
.prompt-node {
  cursor: default;
}

.canvas-node:active,
.prompt-node:active {
  cursor: grabbing;
}

.prompt-node textarea,
.text-node textarea,
.batch-node textarea,
.story-node textarea,
.story-node input,
.prompt-node select,
.batch-node select,
.story-node select,
.batch-node button,
.story-node button,
.prompt-node button,
.chat-box textarea,
.chat-box select,
.chat-box button {
  cursor: auto;
  user-select: text;
}

.prompt-node button,
.batch-node button,
.story-node button,
.chat-box button,
.prompt-node select,
.batch-node select,
.story-node select,
.chat-box select {
  cursor: pointer;
}

.canvas-node.selected,
.prompt-node.selected,
.canvas-node.multi-selected,
.prompt-node.multi-selected {
  z-index: 4;
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px rgba(55, 245, 255, 0.58), var(--shadow-cyan), 0 18px 42px rgba(0, 0, 0, 0.38);
}

.canvas-node.multi-selected,
.prompt-node.multi-selected {
  border-color: var(--lime);
  box-shadow: 0 0 0 1px rgba(215, 255, 65, 0.58), 0 0 24px rgba(215, 255, 65, 0.28), 0 18px 42px rgba(0, 0, 0, 0.38);
}

.resize-handle {
  position: absolute;
  right: -10px;
  bottom: -10px;
  z-index: 3;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(55, 245, 255, 0.82);
  border-radius: 4px;
  background:
    linear-gradient(135deg, transparent 0 46%, rgba(55, 245, 255, 0.9) 47% 55%, transparent 56%),
    rgba(8, 10, 12, 0.96);
  box-shadow: var(--shadow-cyan);
  cursor: nwse-resize;
  opacity: 0;
  pointer-events: none;
  transform: translate(4px, 4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.delete-node {
  position: absolute;
  top: -13px;
  right: -13px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(245, 251, 255, 0.16);
  border-radius: 50%;
  color: #b6bec7;
  background: rgba(55, 60, 66, 0.9);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.82);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.delete-node:hover {
  color: #f5fbff;
  background: rgba(86, 97, 109, 0.96);
}

.connect-handle {
  position: absolute;
  z-index: 5;
  width: 34px;
  height: 34px;
  border: 3px solid var(--cyan);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(215, 255, 65, 0.9) 0 18%, rgba(55, 245, 255, 0.2) 19% 44%, #07090b 45%);
  box-shadow: 0 0 0 5px rgba(55, 245, 255, 0.1), var(--shadow-cyan);
  cursor: crosshair;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.connect-handle.input {
  left: -21px;
  top: 50%;
  transform: translateY(-50%);
}

.connect-handle.output {
  right: -21px;
  top: 50%;
  transform: translateY(-50%);
}

.connect-handle:hover {
  border-color: var(--lime);
  box-shadow: 0 0 18px rgba(215, 255, 65, 0.45);
}

.canvas-node:hover > .delete-node,
.prompt-node:hover > .delete-node,
.canvas-node:focus-within > .delete-node,
.prompt-node:focus-within > .delete-node,
.canvas-node:hover > .connect-handle,
.prompt-node:hover > .connect-handle,
.canvas-node:focus-within > .connect-handle,
.prompt-node:focus-within > .connect-handle,
.canvas-node:hover > .resize-handle,
.prompt-node:hover > .resize-handle,
.canvas-node:focus-within > .resize-handle,
.prompt-node:focus-within > .resize-handle {
  opacity: 1;
  pointer-events: auto;
}

.canvas-node:hover > .delete-node,
.prompt-node:hover > .delete-node,
.canvas-node:focus-within > .delete-node,
.prompt-node:focus-within > .delete-node {
  transform: scale(1);
}

.canvas-node:hover > .resize-handle,
.prompt-node:hover > .resize-handle,
.canvas-node:focus-within > .resize-handle,
.prompt-node:focus-within > .resize-handle {
  transform: translate(0, 0);
}

.generated-node {
  width: min(26vw, 380px);
  min-width: 280px;
}

.uploaded-node {
  width: min(18vw, 280px);
  min-width: 180px;
}

.canvas-node header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
}

.canvas-node header span,
.canvas-node header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-node header span {
  flex: 1 1 auto;
}

.canvas-node header strong {
  flex: 0 1 auto;
}

.image-node header span {
  color: var(--muted);
}

.image-node header strong {
  color: var(--muted);
}

.placeholder-media,
.video-placeholder {
  display: grid;
  place-items: center;
  height: calc(100% - 34px);
  color: rgba(255, 255, 255, 0.24);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    rgba(255, 255, 255, 0.03);
}

.placeholder-media {
  position: relative;
  gap: 10px;
}

.image-node .placeholder-media {
  height: auto;
  aspect-ratio: var(--node-ratio, 1 / 1);
  overflow: hidden;
  border-radius: 0 0 var(--radius) var(--radius);
}

.upload-drop {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(55, 245, 255, 0.36);
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(55, 245, 255, 0.08);
}

.upload-drop:hover {
  border-color: var(--cyan);
  box-shadow: var(--shadow-cyan);
}

.generated-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
}

.video-node {
  display: flex;
  flex-direction: column;
  width: min(32vw, 480px);
  min-width: 280px;
  min-height: 330px;
  padding: 12px;
}

.video-placeholder {
  gap: 10px;
  height: auto;
  flex: 1 1 190px;
  min-height: 150px;
  border: 1px solid rgba(126, 255, 241, 0.16);
  border-radius: 8px;
  overflow: hidden;
}

.video-preview {
  position: relative;
}

.video-preview video {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 160px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.42);
}

.video-preview:hover .preview-download,
.video-preview .preview-download:focus-visible {
  opacity: 1;
  transform: translateY(0);
}

.video-node textarea {
  width: 100%;
  min-height: 72px;
  margin: 10px 0;
  resize: vertical;
  border: 1px solid rgba(126, 255, 241, 0.16);
  border-radius: 8px;
  background: rgba(5, 8, 12, 0.62);
}

.video-node footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.video-node select {
  min-height: 34px;
  padding: 0 8px;
}
.video-node .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.video-node .video-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(82px, auto) auto auto auto auto;
  align-items: center;
  gap: 8px;
}

.video-node .video-model {
  min-width: 190px;
}


.video-end-frame-toggle {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(245, 251, 255, 0.14);
  border-radius: 8px;
  color: rgba(245, 251, 255, 0.84);
  background: rgba(255, 255, 255, 0.04);
  font: inherit;
  font-weight: 800;
  white-space: nowrap;
}

.video-end-frame-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.video-end-frame-toggle input {
  width: 16px;
  height: 16px;
  accent-color: #d7ff41;
}

.video-node .generate-video {
  min-width: 48px;
  border-radius: 10px;
}

.video-mock-result {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 160px;
  color: var(--lime);
  font-weight: 900;
  text-shadow: 0 0 16px rgba(215, 255, 65, 0.46);
}

.agent-node {
  display: flex;
  flex-direction: column;
  width: min(34vw, 500px);
  min-width: 300px;
  min-height: 330px;
  padding: 12px;
}

.agent-node header strong {
  color: var(--lime);
}

.agent-node textarea {
  width: 100%;
  min-height: 82px;
  margin-bottom: 10px;
  resize: vertical;
  border: 1px solid rgba(215, 255, 65, 0.18);
  border-radius: 8px;
  background: rgba(5, 8, 12, 0.62);
}

.agent-output {
  flex: 1 1 150px;
  min-height: 120px;
  padding: 12px;
  overflow: auto;
  border: 1px solid rgba(55, 245, 255, 0.18);
  border-radius: 8px;
  color: #dce7ef;
  background:
    linear-gradient(rgba(126, 255, 241, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 255, 241, 0.045) 1px, transparent 1px),
    rgba(255, 255, 255, 0.025);
  background-size: 22px 22px;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.agent-output.is-loading {
  color: var(--cyan);
}

.text-node {
  display: flex;
  flex-direction: column;
  width: min(30vw, 420px);
  min-width: 260px;
  min-height: 220px;
  padding: 12px;
  aspect-ratio: auto;
}

.text-node header strong {
  color: var(--lime);
}

.text-node-input {
  flex: 1 1 auto;
  width: 100%;
  min-height: 150px;
  resize: none;
  border: 1px solid rgba(55, 245, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(rgba(126, 255, 241, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 255, 241, 0.04) 1px, transparent 1px),
    rgba(5, 8, 12, 0.62);
  background-size: 22px 22px;
  line-height: 1.65;
}

.agent-node footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.agent-preset-row {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.agent-preset-row.is-collapsible,
.prompt-prefix-tools.is-collapsible {
  max-height: 38px;
  overflow: hidden;
  padding-right: 2px;
}

.agent-preset-row.is-collapsible.is-expanded,
.prompt-prefix-tools.is-collapsible.is-expanded {
  max-height: none;
  overflow: visible;
}

.preset-row-toggle {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(55, 245, 255, 0.38);
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(55, 245, 255, 0.08);
  font-size: 12px;
  font-weight: 900;
  flex: 0 0 auto;
}

.preset-row-toggle:hover {
  color: #050506;
  border-color: rgba(215, 255, 65, 0.8);
  background: var(--lime);
}

.agent-preset-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(126, 255, 241, 0.18);
  border-radius: 999px;
  color: rgba(245, 251, 255, 0.78);
  background: rgba(255, 255, 255, 0.045);
  font-size: 12px;
  font-weight: 800;
}

.agent-preset-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(126, 255, 241, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  overflow: hidden;
}

.agent-preset-pill label {
  border: 0;
  background: transparent;
}

.agent-delete-role {
  width: 26px;
  min-height: 30px;
  border: 0;
  border-left: 1px solid rgba(245, 251, 255, 0.08);
  color: rgba(245, 251, 255, 0.58);
  background: transparent;
  font-size: 16px;
  font-weight: 900;
}

.agent-delete-role:hover {
  color: #ff6b7f;
  background: rgba(255, 82, 115, 0.12);
}

.agent-preset-row .agent-add-role {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(126, 255, 241, 0.18);
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(55, 245, 255, 0.06);
  font-size: 12px;
  font-weight: 900;
}

.agent-preset-row input {
  width: 14px;
  min-height: 14px;
  accent-color: var(--lime);
}

.agent-node select {
  min-height: 34px;
  padding: 0 8px;
}

.agent-node .agent-model {
  flex: 1 1 190px;
  min-width: 180px;
}

.agent-role-dialog {
  width: min(560px, calc(100vw - 32px));
  border: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
}

.agent-role-dialog::backdrop {
  background: rgba(0, 0, 0, 0.54);
  backdrop-filter: blur(5px);
}

.agent-role-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(55, 245, 255, 0.36);
  border-radius: 12px;
  background:
    linear-gradient(rgba(126, 255, 241, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 255, 241, 0.035) 1px, transparent 1px),
    rgba(8, 10, 13, 0.96);
  background-size: 22px 22px;
  box-shadow: var(--shadow-cyan), 0 24px 80px rgba(0, 0, 0, 0.56);
}

.agent-role-card header,
.agent-role-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.agent-role-card label {
  display: grid;
  gap: 8px;
  color: rgba(245, 251, 255, 0.82);
  font-size: 13px;
  font-weight: 800;
}

.agent-role-card textarea {
  min-height: 220px;
  resize: vertical;
  border-color: rgba(55, 245, 255, 0.26);
  background: rgba(5, 8, 12, 0.68);
  line-height: 1.55;
}

.agent-role-card input {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(55, 245, 255, 0.24);
  border-radius: 10px;
  color: #f5fbff;
  background: rgba(5, 8, 12, 0.68);
  font: inherit;
}

.ghost-button,
.story-dialog-close,
.story-dialog-cancel {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(245, 251, 255, 0.18);
  border-radius: 999px;
  color: #c8d2dc;
  background: rgba(55, 60, 66, 0.86);
  font-weight: 800;
}

.story-dialog-close {
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 50%;
}

.ghost-button:hover,
.story-dialog-close:hover,
.story-dialog-cancel:hover {
  color: #f5fbff;
  border-color: rgba(245, 251, 255, 0.28);
  background: rgba(86, 97, 109, 0.96);
}

.danger-action {
  min-height: 38px;
  padding: 0 18px;
  border: 1px solid rgba(255, 87, 112, 0.55);
  border-radius: 999px;
  color: #ff5d72;
  background: rgba(255, 87, 112, 0.08);
  font-weight: 900;
}

.danger-action:hover {
  color: #fff;
  background: rgba(255, 87, 112, 0.22);
}

.story-config-spacer {
  flex: 1 1 auto;
}

.story-config-dialog {
  width: min(780px, calc(100vw - 32px));
}

.story-config-card textarea {
  min-height: 300px;
}

.batch-node {
  display: flex;
  flex-direction: column;
  width: min(36vw, 540px);
  min-width: 320px;
  min-height: 410px;
  padding: 12px;
  aspect-ratio: auto;
}

.batch-node header strong {
  color: var(--lime);
}

.batch-json-input {
  width: 100%;
  flex: 1 1 150px;
  min-height: 150px;
  margin-bottom: 10px;
  resize: vertical;
  border: 1px solid rgba(55, 245, 255, 0.18);
  border-radius: 8px;
  background: rgba(5, 8, 12, 0.62);
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
  line-height: 1.55;
}

.batch-template-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 190px;
  margin-bottom: 10px;
  overflow: auto;
}

.batch-template-item {
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(126, 255, 241, 0.18);
  border-radius: 8px;
  background: rgba(27, 31, 39, 0.82);
}

.batch-template-item strong,
.batch-template-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-template-item strong {
  color: #f5fbff;
  font-size: 12px;
}

.batch-template-item span,
.batch-status,
.batch-empty {
  color: var(--muted);
  font-size: 11px;
}

.batch-node footer {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: auto;
}

.batch-node select {
  min-height: 34px;
  min-width: 72px;
  padding: 0 8px;
}

.batch-node .batch-model {
  flex: 1 1 150px;
  min-width: 120px;
}

.batch-status {
  display: block;
  min-height: 16px;
  margin-top: 6px;
}

.story-node {
  display: flex;
  flex-direction: column;
  width: min(34vw, 520px);
  min-width: 360px;
  min-height: 620px;
  padding: 14px;
  aspect-ratio: auto;
  border-color: rgba(215, 255, 65, 0.2);
  background:
    radial-gradient(circle at 12% 0, rgba(124, 92, 255, 0.16), transparent 36%),
    linear-gradient(rgba(126, 255, 241, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 255, 241, 0.035) 1px, transparent 1px),
    rgba(8, 10, 12, 0.9);
  background-size: auto, 22px 22px, 22px 22px, auto;
}

.story-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.story-icon {
  display: none;
}

.story-title-input {
  flex: 0 1 240px;
  min-width: 0;
  max-width: min(240px, 42vw);
  border: 0;
  color: #f5fbff;
  background: transparent;
  font-size: 18px;
  font-weight: 900;
}

.story-status {
  padding: 5px 10px;
  border: 1px solid rgba(40, 255, 156, 0.42);
  border-radius: 999px;
  color: #33f3a3;
  background: rgba(40, 255, 156, 0.08);
  font-size: 11px;
  letter-spacing: 0;
}

.story-stats,
.story-tabs,
.story-controls,
.story-node footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.story-stats {
  margin-bottom: 10px;
}

.story-stats span {
  padding: 5px 10px;
  border: 1px solid rgba(245, 251, 255, 0.1);
  border-radius: 999px;
  color: rgba(245, 251, 255, 0.7);
  background: rgba(245, 251, 255, 0.06);
  font-size: 12px;
  font-weight: 800;
}

.story-stats .story-shot-count {
  color: #ded7ff;
  border-color: rgba(160, 120, 255, 0.45);
  background: rgba(124, 92, 255, 0.16);
}

.story-tabs {
  margin-bottom: 12px;
}

.story-tab {
  min-height: 36px;
  padding: 0 18px;
  border: 1px solid rgba(245, 251, 255, 0.12);
  border-radius: 12px;
  color: rgba(245, 251, 255, 0.66);
  background: rgba(245, 251, 255, 0.06);
  font-weight: 900;
}

.story-tab.is-active {
  color: #f5fbff;
  border-color: rgba(160, 120, 255, 0.72);
  background: rgba(124, 92, 255, 0.24);
  box-shadow: 0 0 18px rgba(124, 92, 255, 0.22);
}

.story-panel {
  display: none;
  min-height: 220px;
  flex: 1 1 auto;
}

.story-panel.is-active {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.story-script-input,
.story-output {
  width: 100%;
  flex: 1 1 auto;
  min-height: 240px;
  resize: vertical;
  border: 1px solid rgba(55, 245, 255, 0.18);
  border-radius: 10px;
  background: rgba(5, 8, 12, 0.7);
  color: #f5fbff;
  font-size: 13px;
  line-height: 1.65;
}

.story-output {
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
}

.story-shot-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.story-shot-card {
  padding: 10px;
  border: 1px solid rgba(126, 255, 241, 0.16);
  border-radius: 10px;
  background: rgba(20, 24, 31, 0.82);
}

.story-shot-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.story-shot-card strong {
  overflow: hidden;
  color: #f5fbff;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-shot-card span,
.story-shot-card p,
.story-shot-card dd {
  color: rgba(245, 251, 255, 0.68);
  font-size: 11px;
  line-height: 1.5;
}

.story-shot-card p {
  margin: 0 0 8px;
}

.story-shot-card dl {
  display: grid;
  gap: 5px;
  margin: 0;
}

.story-shot-card div {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
}

.story-shot-card dt {
  color: var(--lime);
  font-size: 11px;
  font-weight: 900;
}

.story-shot-card dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-shot-card details {
  margin-top: 8px;
}

.story-shot-card summary {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.story-shot-card pre {
  max-height: 130px;
  margin: 8px 0 0;
  padding: 8px;
  overflow: auto;
  border: 1px solid rgba(55, 245, 255, 0.14);
  border-radius: 8px;
  color: rgba(245, 251, 255, 0.72);
  background: rgba(5, 8, 12, 0.72);
  font-family: Consolas, Monaco, monospace;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.story-empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 18px;
  border: 1px dashed rgba(245, 251, 255, 0.16);
  border-radius: 12px;
  color: rgba(245, 251, 255, 0.52);
  text-align: center;
  line-height: 1.6;
}

.story-controls {
  margin-top: 12px;
}

.story-controls label {
  display: grid;
  gap: 5px;
  flex: 1 1 150px;
  min-width: 130px;
}

.story-controls span {
  color: rgba(245, 251, 255, 0.56);
  font-size: 11px;
  font-weight: 900;
}

.story-controls select {
  min-height: 38px;
  width: 100%;
  padding: 0 10px;
}

.story-select-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.story-config-edit {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(55, 245, 255, 0.24);
  border-radius: 10px;
  color: var(--cyan);
  background: rgba(55, 245, 255, 0.08);
  font-size: 12px;
  font-weight: 900;
}

.story-config-edit:hover {
  border-color: rgba(55, 245, 255, 0.58);
  background: rgba(55, 245, 255, 0.14);
  box-shadow: 0 0 18px rgba(55, 245, 255, 0.18);
}

.story-role-row {
  flex-basis: 230px;
}

.story-node footer {
  margin-top: 12px;
  align-items: flex-end;
}

.story-footer-model {
  display: grid;
  gap: 5px;
  flex: 0 1 220px;
  min-width: 180px;
}

.story-footer-model span {
  color: rgba(245, 251, 255, 0.56);
  font-size: 11px;
  font-weight: 900;
}

.story-footer-model select {
  min-height: 38px;
  width: 100%;
  padding: 0 10px;
}

.story-node footer button {
  flex: 1 1 160px;
}

.shot-node {
  width: 340px;
  min-width: 280px;
  min-height: 158px;
  aspect-ratio: auto;
  padding: 14px 16px 16px;
  border-color: rgba(55, 245, 255, 0.36);
  background:
    linear-gradient(135deg, rgba(55, 245, 255, 0.08), transparent 42%),
    rgba(14, 16, 22, 0.9);
}

.shot-node header {
  padding: 0;
  margin-bottom: 8px;
}

.shot-node header strong {
  padding: 4px 8px;
  border: 1px solid rgba(40, 255, 156, 0.32);
  border-radius: 999px;
  color: #33f3a3;
  background: rgba(40, 255, 156, 0.08);
  font-size: 10px;
}

.shot-node-summary {
  min-height: 36px;
  margin: 0 0 10px;
  overflow: hidden;
  color: rgba(245, 251, 255, 0.72);
  font-size: 12px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.shot-node-meta,
.shot-node-duration {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin: 0 8px 12px 0;
  padding: 0 10px;
  border: 1px solid rgba(245, 251, 255, 0.1);
  border-radius: 999px;
  color: rgba(245, 251, 255, 0.72);
  background: rgba(245, 251, 255, 0.06);
  font-size: 11px;
  font-weight: 800;
}

.shot-node footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.shot-node footer button {
  min-height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(160, 120, 255, 0.34);
  color: #f5fbff;
  background: rgba(124, 92, 255, 0.2);
  font-weight: 900;
}

.shot-node footer button:first-child {
  color: #07100e;
  border-color: rgba(215, 255, 65, 0.2);
  background: linear-gradient(135deg, #b783ff, #ff7069);
}

.project-asset-library {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  flex-direction: column;
  width: min(1180px, calc(100vw - 72px));
  height: min(820px, calc(100vh - 72px));
  max-height: min(820px, calc(100vh - 72px));
  margin: auto;
  overflow: hidden;
  border: 1px solid rgba(55, 245, 255, 0.2);
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 0%, rgba(124, 92, 255, 0.16), transparent 28%),
    radial-gradient(circle at 78% 10%, rgba(55, 245, 255, 0.12), transparent 30%),
    rgba(9, 10, 13, 0.96);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.58), 0 0 0 9999px rgba(0, 0, 0, 0.54);
  backdrop-filter: blur(14px);
}

.project-asset-library.is-open {
  display: flex;
}

.asset-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 28px 20px;
  border-bottom: 1px solid rgba(245, 251, 255, 0.08);
}

.asset-library-header span {
  color: rgba(245, 251, 255, 0.54);
  font-size: 12px;
  font-weight: 800;
}

.asset-library-header h2 {
  margin: 4px 0 0;
  color: #f5fbff;
  font-size: 28px;
  letter-spacing: 0;
}

.asset-library-close {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(245, 251, 255, 0.12);
  border-radius: 9px;
  color: #b6bec7;
  background: rgba(245, 251, 255, 0.07);
  font-size: 22px;
  font-weight: 900;
}

.asset-library-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  padding: 18px 28px 14px;
}

.asset-library-filters button {
  min-height: 44px;
  border: 1px solid rgba(245, 251, 255, 0.12);
  border-radius: 10px;
  color: rgba(245, 251, 255, 0.68);
  background: rgba(245, 251, 255, 0.05);
  font-weight: 900;
}

.asset-library-filters button.is-active {
  color: #f5fbff;
  border-color: rgba(245, 251, 255, 0.22);
  background: rgba(245, 251, 255, 0.1);
}

.asset-library-filters b {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  margin-left: 8px;
  border-radius: 999px;
  color: #07100e;
  background: var(--lime);
  font-size: 12px;
}

.asset-library-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 14px;
  min-height: 0;
  flex: 1 1 auto;
  padding: 8px 28px 28px;
  overflow: auto;
}

.asset-card {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  gap: 18px;
  min-height: 190px;
  padding: 16px;
  border: 1px solid rgba(245, 251, 255, 0.1);
  border-radius: 12px;
  background: rgba(23, 25, 31, 0.86);
}

.asset-thumb {
  display: grid;
  place-items: center;
  min-height: 170px;
  overflow: hidden;
  border: 1px solid rgba(245, 251, 255, 0.08);
  border-radius: 10px;
  background: rgba(5, 7, 10, 0.58);
  color: rgba(245, 251, 255, 0.58);
}

.asset-thumb .icon {
  width: 34px;
  height: 34px;
}

.asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.asset-card-body {
  display: grid;
  min-width: 0;
  gap: 10px;
}

.asset-card-body header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.asset-card-body header span,
.asset-card-body footer small {
  color: rgba(245, 251, 255, 0.54);
  font-size: 12px;
  font-weight: 900;
}

.asset-card-body header strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: #f5fbff;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-card-body header em {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 8px;
  color: #33f3a3;
  background: rgba(40, 255, 156, 0.12);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.asset-card textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  border: 1px solid rgba(245, 251, 255, 0.08);
  border-radius: 8px;
  color: rgba(245, 251, 255, 0.82);
  background: rgba(5, 7, 10, 0.48);
  font-size: 12px;
  line-height: 1.55;
}

.asset-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.asset-card footer div {
  display: flex;
  gap: 8px;
}

.asset-card footer button {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  font-weight: 900;
}

.asset-card footer [data-asset-action="generate"] {
  color: #07100e;
  background: #f5fbff;
}

.asset-card footer [data-asset-action="delete"] {
  color: #ffd6d6;
  border-color: rgba(255, 88, 96, 0.36);
  background: rgba(255, 88, 96, 0.16);
}

.asset-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 260px;
  border: 1px dashed rgba(245, 251, 255, 0.14);
  border-radius: 14px;
  color: rgba(245, 251, 255, 0.52);
  background: rgba(245, 251, 255, 0.04);
  font-weight: 800;
}

.shot-detail-panel {
  position: absolute;
  z-index: 7;
  width: min(720px, 72vw);
  min-width: 560px;
  padding: 16px;
  border: 1px solid rgba(55, 245, 255, 0.28);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(55, 245, 255, 0.08), transparent 45%),
    rgba(14, 16, 22, 0.96);
  box-shadow: 0 22px 64px rgba(0, 0, 0, 0.45), 0 0 30px rgba(55, 245, 255, 0.12);
  backdrop-filter: blur(12px);
}

.shot-detail-panel header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.shot-detail-panel header span,
.shot-detail-panel label span {
  display: block;
  margin-bottom: 5px;
  color: rgba(245, 251, 255, 0.56);
  font-size: 12px;
  font-weight: 900;
}

.shot-detail-title-input {
  width: min(420px, 52vw);
  border: 0;
  color: #f5fbff;
  background: transparent;
  font-size: 22px;
  font-weight: 900;
}

.shot-detail-close {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(245, 251, 255, 0.12);
  border-radius: 50%;
  color: #b6bec7;
  background: rgba(245, 251, 255, 0.08);
  font-size: 18px;
  font-weight: 900;
}

.shot-detail-assets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.shot-detail-assets button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  min-height: 48px;
  padding: 9px 12px;
  border: 1px solid rgba(245, 251, 255, 0.1);
  border-radius: 10px;
  color: #f5fbff;
  background: rgba(245, 251, 255, 0.05);
  text-align: left;
}

.shot-detail-assets button span {
  grid-column: 1 / -1;
  color: rgba(245, 251, 255, 0.52);
  font-size: 11px;
  font-weight: 900;
}

.shot-detail-assets button strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.shot-detail-assets button b {
  padding: 2px 8px;
  border-radius: 999px;
  color: #ded7ff;
  background: rgba(124, 92, 255, 0.22);
  font-size: 12px;
}

.shot-detail-panel label {
  display: block;
  margin-bottom: 12px;
}

.shot-detail-panel textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  border: 1px solid rgba(245, 251, 255, 0.1);
  border-radius: 10px;
  color: rgba(245, 251, 255, 0.86);
  background: rgba(5, 7, 10, 0.52);
  font-size: 13px;
  line-height: 1.55;
}

.shot-detail-panel .shot-detail-video-prompt,
.shot-detail-panel .shot-detail-grid-prompt {
  min-height: 132px;
}

.shot-detail-panel footer {
  display: grid;
  grid-template-columns: 1fr 1fr 0.42fr;
  gap: 12px;
}

.shot-detail-panel footer button {
  min-height: 44px;
  border-radius: 12px;
  color: #f5fbff;
  font-weight: 900;
}

.shot-detail-image {
  color: #07100e !important;
  background: linear-gradient(135deg, #b783ff, #ff7069);
}

.shot-detail-video {
  border-color: rgba(40, 255, 156, 0.24);
  background: rgba(40, 255, 156, 0.1);
}

.shot-detail-delete {
  border-color: rgba(255, 88, 96, 0.34);
  color: #ffd6d6 !important;
  background: rgba(255, 88, 96, 0.18);
}

.shot-asset-picker {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 34px;
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(8px);
}

.shot-asset-card {
  display: flex;
  flex-direction: column;
  width: min(980px, calc(100vw - 72px));
  max-height: min(820px, calc(100vh - 72px));
  overflow: hidden;
  border: 1px solid rgba(55, 245, 255, 0.22);
  border-radius: 18px;
  background: rgba(14, 16, 22, 0.98);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.58);
}

.shot-asset-card > header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 26px 18px;
  border-bottom: 1px solid rgba(245, 251, 255, 0.08);
}

.shot-asset-card header span {
  color: rgba(245, 251, 255, 0.54);
  font-size: 12px;
  font-weight: 900;
}

.shot-asset-card h2 {
  margin: 4px 0;
  color: #f5fbff;
  font-size: 28px;
}

.shot-asset-card p {
  max-width: 760px;
  margin: 0;
  overflow: hidden;
  color: rgba(245, 251, 255, 0.62);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shot-asset-close {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(245, 251, 255, 0.12);
  border-radius: 9px;
  color: #b6bec7;
  background: rgba(245, 251, 255, 0.08);
  font-size: 22px;
  font-weight: 900;
}

.shot-asset-search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 20px 26px 12px;
}

.shot-asset-search {
  min-height: 46px;
  border: 1px solid rgba(245, 251, 255, 0.1);
  border-radius: 12px;
  color: #f5fbff;
  background: rgba(5, 7, 10, 0.48);
}

.shot-asset-count {
  display: inline-grid;
  place-items: center;
  min-width: 94px;
  min-height: 46px;
  border: 1px solid rgba(245, 251, 255, 0.12);
  border-radius: 999px;
  color: rgba(245, 251, 255, 0.74);
}

.shot-asset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 26px 12px;
}

.shot-asset-chips button {
  min-height: 34px;
  padding: 0 12px;
  border-color: rgba(55, 245, 255, 0.28);
  border-radius: 999px;
  color: #ded7ff;
  background: rgba(124, 92, 255, 0.22);
  font-weight: 900;
}

.shot-asset-list {
  display: grid;
  gap: 12px;
  min-height: 0;
  padding: 0 26px 20px;
  overflow: auto;
}

.shot-asset-item {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid rgba(245, 251, 255, 0.1);
  border-radius: 12px;
  background: rgba(245, 251, 255, 0.045);
}

.shot-asset-item.is-selected {
  border-color: rgba(55, 245, 255, 0.38);
  background: rgba(55, 245, 255, 0.08);
}

.shot-asset-thumb {
  display: grid;
  place-items: center;
  width: 80px;
  height: 80px;
  overflow: hidden;
  border: 1px solid rgba(55, 245, 255, 0.16);
  border-radius: 10px;
  color: rgba(245, 251, 255, 0.62);
  background: rgba(55, 245, 255, 0.08);
}

.shot-asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shot-asset-item strong {
  color: #f5fbff;
  font-size: 18px;
}

.shot-asset-item p {
  margin-top: 6px;
  color: rgba(245, 251, 255, 0.62);
  white-space: nowrap;
}

.shot-asset-item button {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 900;
}

.shot-asset-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed rgba(245, 251, 255, 0.14);
  border-radius: 12px;
  color: rgba(245, 251, 255, 0.56);
}

.shot-asset-card > footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 18px 26px 24px;
  border-top: 1px solid rgba(245, 251, 255, 0.08);
}

.shot-asset-card > footer button {
  min-height: 46px;
  min-width: 88px;
  border-radius: 12px;
  font-weight: 900;
}

.shot-asset-confirm {
  color: #07100e;
  background: linear-gradient(135deg, #b783ff, #ff7069);
}

.video-label {
  color: rgba(245, 251, 255, 0.42);
  font-size: 13px;
  font-weight: 800;
}

.play-shape {
  width: 58px;
  height: 58px;
  background: rgba(245, 251, 255, 0.16);
  clip-path: polygon(30% 18%, 30% 82%, 82% 50%);
}

.prompt-node {
  display: flex;
  flex-direction: column;
  width: min(35vw, 530px);
  min-width: 80px;
  min-height: 420px;
  padding: 12px;
}

.prompt-preview {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 180px;
  min-height: 64px;
  margin-bottom: 12px;
  border: 1px solid rgba(55, 245, 255, 0.22);
  border-radius: 8px;
  color: rgba(245, 251, 255, 0.44);
  background:
    linear-gradient(rgba(126, 255, 241, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 255, 241, 0.055) 1px, transparent 1px),
    rgba(255, 255, 255, 0.03);
  background-size: 24px 24px;
  overflow: hidden;
}

.prompt-preview strong {
  font-size: 13px;
}

.prompt-preview img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
}

.prompt-preview.has-image {
  display: block;
  flex: 0 0 auto;
  min-height: 0;
  margin-bottom: 10px;
  aspect-ratio: var(--preview-ratio, 1 / 1);
}

.prompt-node.has-generated-preview {
  min-height: 420px;
}

.prompt-node.has-generated-preview textarea {
  flex: 1 1 180px;
  min-height: var(--prompt-text-height, 160px);
  margin: 8px 0;
}

.prompt-node.has-generated-preview footer {
  margin-top: 6px;
}

.prompt-preview.is-loading {
  flex: 0 0 180px;
}

.generation-loading {
  display: grid;
  place-items: center;
  gap: 8px;
  color: var(--cyan);
  font-size: 14px;
  font-weight: 800;
}

.generation-loading strong {
  color: var(--lime);
  font-size: 22px;
  text-shadow: 0 0 18px rgba(215, 255, 65, 0.45);
}

.preview-download {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid rgba(215, 255, 65, 0.72);
  border-radius: 999px;
  color: #080a0b;
  background: var(--lime);
  font-weight: 800;
  box-shadow: 0 0 18px rgba(215, 255, 65, 0.34);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.prompt-preview:hover .preview-download,
.preview-download:focus-visible {
  opacity: 1;
  transform: translateY(0);
}

.prompt-node.collapsed {
  padding: 10px;
  min-height: 0;
}

.prompt-node.collapsed .reference-button,
.prompt-node.collapsed .prompt-reference-tray,
.prompt-node.collapsed .prompt-prefix-tools,
.prompt-node.collapsed textarea,
.prompt-node.collapsed footer {
  display: none;
}

.prompt-node.collapsed .prompt-preview {
  margin-bottom: 0;
}

.reference-button {
  display: block;
  width: 48px;
  height: 48px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
}

.prompt-reference-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 0;
  margin: 4px 0 0;
}

.prompt-reference-tray.is-drop-target {
  border-radius: 10px;
  background: rgba(42, 255, 246, 0.06);
  outline: 1px dashed rgba(42, 255, 246, 0.28);
  outline-offset: 4px;
}

.prompt-reference-tray.is-empty {
  display: none;
}

.prompt-prefix-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 0;
}

.prompt-prefix-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(126, 255, 241, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  overflow: hidden;
}

.prompt-prefix-toggle {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(126, 255, 241, 0.18);
  border-radius: 999px;
  color: #c7d4dc;
  background: rgba(255, 255, 255, 0.045);
  font-size: 12px;
  font-weight: 800;
}

.prompt-prefix-pill .prompt-prefix-toggle {
  border: 0;
  background: transparent;
}

.prompt-prefix-toggle:hover,
.prompt-prefix-toggle.is-active {
  color: #050506;
  border-color: rgba(215, 255, 65, 0.8);
  background: var(--lime);
  box-shadow: 0 0 18px rgba(215, 255, 65, 0.28);
}

.prompt-prefix-edit,
.prompt-prefix-delete,
.prompt-prefix-add {
  min-height: 30px;
  border: 1px solid rgba(126, 255, 241, 0.18);
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(55, 245, 255, 0.06);
  font-size: 12px;
  font-weight: 900;
}

.prompt-prefix-edit,
.prompt-prefix-delete {
  width: 34px;
  padding: 0;
  border: 0;
  border-left: 1px solid rgba(245, 251, 255, 0.08);
  border-radius: 0;
  color: rgba(245, 251, 255, 0.58);
  background: transparent;
}

.prompt-prefix-edit {
  width: 42px;
}

.prompt-prefix-delete:hover {
  color: #ff6b7f;
  background: rgba(255, 82, 115, 0.12);
}

.prompt-prefix-edit:hover,
.prompt-prefix-add:hover {
  color: #050506;
  border-color: rgba(215, 255, 65, 0.8);
  background: var(--lime);
}

.reference-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 58px;
  height: 58px;
  padding: 4px;
  border: 1px solid rgba(55, 245, 255, 0.24);
  border-radius: 10px;
  color: var(--cyan);
  background: rgba(55, 245, 255, 0.08);
  overflow: hidden;
}

.reference-chip:hover {
  border-color: var(--cyan);
  box-shadow: var(--shadow-cyan);
}

.reference-chip.is-dragging {
  opacity: 0.55;
}

.reference-chip.is-drop-target {
  border-color: var(--lime);
  box-shadow: 0 0 0 2px rgba(215, 255, 65, 0.36), var(--shadow-cyan);
}

.reference-chip img {
  width: 100%;
  height: 100%;
  border-radius: 7px;
  object-fit: cover;
}

.reference-chip span {
  position: absolute;
  right: 4px;
  top: 4px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 1px solid rgba(215, 255, 65, 0.8);
  border-radius: 999px;
  color: #050506;
  background: var(--lime);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.prompt-node textarea {
  width: 100%;
  flex: 1 1 180px;
  min-height: var(--prompt-text-height, 160px);
  margin: 12px 0;
  resize: none;
  border: 0;
  background: transparent;
}

.prompt-node select,
.chat-box select {
  min-height: 34px;
  padding: 0 8px;
}

.prompt-node footer select {
  min-width: 56px;
  max-width: 116px;
  border-color: rgba(245, 251, 255, 0.22);
  color: rgba(245, 251, 255, 0.88);
  background: rgba(9, 10, 14, 0.86);
}

.prompt-node footer .model-select {
  flex: 1 1 180px;
  max-width: 230px;
}

.spec-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  max-width: 240px;
  padding: 0 10px;
  border: 1px solid rgba(215, 255, 65, 0.34);
  border-radius: 8px;
  color: #eef7f9;
  background: rgba(215, 255, 65, 0.08);
  font-size: 12px;
  font-weight: 800;
}

.spec-button span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spec-button:hover {
  border-color: rgba(215, 255, 65, 0.76);
  box-shadow: 0 0 18px rgba(215, 255, 65, 0.12);
}

.prompt-spec-fields {
  display: contents;
}

.run-small {
  min-height: 34px;
}

.prompt-node footer {
  margin-top: auto;
  gap: 7px;
  flex-wrap: wrap;
}

.floating-toolbar {
  position: absolute;
  left: 50%;
  bottom: 24px;
  z-index: 4;
  display: flex;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(126, 255, 241, 0.18);
  border-radius: 12px;
  background: rgba(9, 10, 12, 0.88);
  box-shadow: var(--shadow-cyan);
  transform: translateX(-50%);
  backdrop-filter: blur(22px);
}

.history-panel {
  position: absolute;
  left: 72px;
  top: 78px;
  bottom: 18px;
  z-index: 8;
  display: none;
  width: min(380px, calc(100% - 96px));
  padding: 10px 8px 12px;
  border: 1px solid rgba(245, 251, 255, 0.08);
  border-radius: 18px;
  background: rgba(14, 15, 19, 0.96);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.46), 0 0 0 1px rgba(55, 245, 255, 0.06);
  backdrop-filter: blur(22px);
}

.history-panel.is-open {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

.history-panel header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 42px;
  padding: 2px 6px 8px;
  border-bottom: 1px solid rgba(245, 251, 255, 0.06);
}

.history-panel header span,
.history-card small {
  color: var(--muted);
  font-size: 12px;
}

.history-panel header button,
.history-close {
  min-height: 28px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  color: rgba(245, 251, 255, 0.56);
  background: transparent;
  box-shadow: none;
  font-size: 18px;
  line-height: 1;
}

.history-panel header button:hover,
.history-close:hover {
  color: #f5fbff;
  background: rgba(245, 251, 255, 0.08);
}

.history-list {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 16px;
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  padding: 0 10px 0 0;
  scrollbar-color: rgba(245, 251, 255, 0.48) rgba(255, 255, 255, 0.08);
  scrollbar-gutter: stable;
  scrollbar-width: auto;
}

.history-list::-webkit-scrollbar {
  width: 10px;
}

.history-list::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.history-list::-webkit-scrollbar-thumb {
  border: 2px solid rgba(14, 15, 19, 0.96);
  border-radius: 999px;
  background: rgba(245, 251, 255, 0.48);
}

.history-list::-webkit-scrollbar-thumb:hover {
  background: rgba(55, 245, 255, 0.72);
}

.history-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: var(--text);
  background: rgba(28, 29, 34, 0.82);
  text-align: left;
  overflow: hidden;
  min-height: 286px;
}

.history-card:hover {
  background: rgba(34, 36, 42, 0.92);
  box-shadow: 0 0 0 1px rgba(55, 245, 255, 0.18), 0 16px 34px rgba(0, 0, 0, 0.32);
}

.history-thumb {
  position: relative;
  display: block;
  width: 100%;
  height: 210px !important;
  min-height: 210px !important;
  aspect-ratio: auto !important;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
  background:
    linear-gradient(rgba(126, 255, 241, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 255, 241, 0.035) 1px, transparent 1px),
    rgba(10, 12, 16, 0.96);
  background-size: 18px 18px;
}

.history-card img {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.04);
}

.history-card-missing-image .history-thumb::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(245, 251, 255, 0.42);
  font-size: 13px;
  font-weight: 800;
  content: "预览图缓存丢失";
}

.history-cache-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  color: #d9fff0;
  background: linear-gradient(135deg, rgba(0, 190, 126, 0.96), rgba(0, 140, 100, 0.9));
  box-shadow: 0 0 14px rgba(0, 190, 126, 0.24);
  font-size: 12px;
  font-weight: 900;
}

.history-card-actions {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 4px;
}

.history-card-actions button {
  min-height: 24px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: rgba(245, 251, 255, 0.46);
  background: transparent;
  box-shadow: none;
  font-size: 15px;
  font-weight: 700;
}

.history-card-actions [data-history-action="delete"] {
  color: rgba(245, 251, 255, 0.44);
}

.history-card-body {
  display: grid;
  gap: 10px;
  padding: 10px 10px 12px;
  min-width: 0;
}

.history-card-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.history-prompt {
  min-width: 0;
  flex: 1 1 auto;
  color: rgba(245, 251, 255, 0.88);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-meta {
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 0;
  min-width: 0;
}

.history-meta span {
  color: rgba(245, 251, 255, 0.42);
  font-size: 12px;
  font-weight: 600;
}

.history-meta small {
  display: inline-flex;
  color: rgba(245, 251, 255, 0.42);
  font-size: 12px;
}

.history-meta [data-history-duration] {
  color: #34f67c;
  font-weight: 900;
}

.history-meta b {
  color: rgba(245, 251, 255, 0.52);
  font-weight: 700;
}

.history-meta em {
  color: var(--lime);
  font-style: normal;
  font-weight: 900;
}

.history-empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.node-create-menu {
  position: absolute;
  z-index: 9;
  display: grid;
  min-width: 170px;
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(126, 255, 241, 0.18);
  border-radius: 10px;
  background: rgba(13, 14, 18, 0.96);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34), var(--shadow-cyan);
}

.node-create-menu strong {
  padding: 6px 8px 4px;
  color: var(--text);
  font-size: 12px;
}

.node-create-menu button {
  justify-content: flex-start;
  gap: 9px;
  min-height: 34px;
  padding: 0 10px;
  color: #dce7ef;
  border: 0;
  border-radius: 7px;
  background: transparent;
  text-align: left;
}

.node-create-menu button:hover {
  color: var(--cyan);
  background: rgba(55, 245, 255, 0.1);
}

.canvas-tool-menu {
  min-width: 184px;
  border-color: rgba(215, 255, 65, 0.24);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42), 0 0 22px rgba(215, 255, 65, 0.16);
}

.agent-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: 16px;
  padding: 72px 18px 18px;
  border-left: 1px solid rgba(126, 255, 241, 0.16);
  background: rgba(7, 8, 10, 0.86);
  backdrop-filter: blur(24px);
  overflow: hidden;
}

.agent-panel > header {
  position: relative;
  z-index: 2;
  min-width: 0;
}

.agent-panel h2,
.agent-panel h3 {
  margin-bottom: 4px;
}

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

#closeAgentPanel {
  min-height: 24px;
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 0;
  border-color: rgba(245, 251, 255, 0.16);
  color: #b6bec7;
  background: rgba(55, 60, 66, 0.84);
  font-size: 15px;
  line-height: 1;
  display: inline-grid;
  place-items: center;
}

#closeAgentPanel:hover {
  color: #f5fbff;
  background: rgba(86, 97, 109, 0.96);
}

.skill-cloud {
  flex-wrap: wrap;
  align-items: flex-start;
}

.skill-cloud h3 {
  width: 100%;
  margin-bottom: 2px;
  color: var(--text);
  text-align: center;
}

.chat-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding-right: 4px;
  overflow: auto;
}

.message {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.message span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--bg);
  background: var(--cyan);
  font-size: 11px;
  font-weight: 900;
}

.message.user span {
  background: var(--pink);
}

.message p {
  margin-bottom: 0;
  color: #dce7ef;
  line-height: 1.6;
}

.message-attachments {
  margin-top: 8px;
  color: var(--cyan);
  font-size: 12px;
  line-height: 1.4;
  word-break: break-all;
}

.notify-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(55, 245, 255, 0.16);
  border-radius: var(--radius);
  color: #dce7ef;
  background: rgba(55, 245, 255, 0.07);
  font-size: 13px;
}

.notify-strip button {
  margin-left: auto;
  color: var(--cyan);
}

.chat-box {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.attachment-tray {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.attachment-tray.has-items {
  display: flex;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid rgba(126, 255, 241, 0.18);
  border-radius: 999px;
  color: #dce7ef;
  background: rgba(255, 255, 255, 0.055);
  font-size: 12px;
}

.attachment-chip img {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  object-fit: cover;
}

.attachment-chip strong {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip button {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
}

.attachment-chip button:hover {
  color: #f5fbff;
  background: rgba(86, 97, 109, 0.74);
}

.chat-box textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 0;
  background: transparent;
}

.voice-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(215, 255, 65, 0.56);
  border-radius: 50%;
  background: var(--lime);
}

.voice-button span {
  width: 16px;
  height: 16px;
  background:
    linear-gradient(90deg, #050506 2px, transparent 2px 5px, #050506 5px 7px, transparent 7px 10px, #050506 10px 12px, transparent 12px 15px, #050506 15px);
}

.modal {
  width: min(620px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid rgba(126, 255, 241, 0.28);
  border-radius: 8px;
  background: rgba(8, 10, 12, 0.96);
  box-shadow: var(--shadow-cyan), var(--shadow-pink);
}

.image-spec-modal {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
}

.image-spec-modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
}

.image-spec-card {
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid rgba(215, 255, 65, 0.26);
  border-radius: 8px;
  background: rgba(8, 10, 12, 0.97);
  box-shadow: var(--shadow-cyan);
}

.image-spec-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.image-spec-grid label {
  display: grid;
  gap: 7px;
  color: rgba(245, 251, 255, 0.78);
  font-size: 12px;
  font-weight: 800;
}

.image-spec-grid select {
  min-width: 0;
  min-height: 38px;
}

.image-spec-card footer {
  justify-content: flex-end;
}

.commerce-spec-modal {
  position: fixed;
  width: min(304px, calc(100vw - 36px));
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
}

.commerce-spec-modal::backdrop {
  background: transparent;
}

.commerce-spec-card {
  display: grid;
  gap: 14px;
  padding: 14px 12px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  background: rgba(51, 51, 51, 0.98);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.commerce-spec-card section {
  display: grid;
  gap: 8px;
}

.commerce-spec-card strong {
  color: rgba(245, 251, 255, 0.78);
  font-size: 13px;
}

.commerce-ratio-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 10px;
  padding: 9px;
  border-radius: 14px;
  background: rgba(27, 27, 27, 0.78);
}

.commerce-ratio-grid button {
  display: grid;
  place-items: center;
  gap: 5px;
  min-height: 46px;
  padding: 5px 4px;
  border: 0;
  border-radius: 10px;
  color: rgba(245, 251, 255, 0.82);
  background: transparent;
  font-size: 12px;
}

.commerce-ratio-grid button.active {
  color: #1b1b1b;
  background: #fff;
}

.ratio-icon {
  display: block;
  border: 1.5px solid currentColor;
  border-radius: 3px;
}

.ratio-auto {
  width: 14px;
  height: 14px;
  position: relative;
}

.ratio-auto::before {
  position: absolute;
  inset: 3px;
  content: "";
  border-left: 1.5px solid currentColor;
  border-top: 1.5px solid currentColor;
  transform: rotate(45deg);
}

.ratio-1-1 { width: 13px; height: 13px; }
.ratio-2-3 { width: 10px; height: 15px; }
.ratio-3-2 { width: 17px; height: 11px; }
.ratio-3-4 { width: 11px; height: 15px; }
.ratio-4-3 { width: 16px; height: 12px; }
.ratio-4-5 { width: 12px; height: 15px; }
.ratio-5-4 { width: 17px; height: 12px; }
.ratio-9-16 { width: 9px; height: 16px; }
.ratio-16-9 { width: 18px; height: 10px; }
.ratio-21-9 { width: 20px; height: 8px; }

.commerce-segment {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(27, 27, 27, 0.82);
}

.commerce-segment button {
  min-height: 30px;
  border: 0;
  border-radius: 7px;
  color: rgba(245, 251, 255, 0.78);
  background: transparent;
  font-weight: 800;
}

.commerce-segment button.active {
  color: #202020;
  background: #fff;
}

.commerce-editor-modal {
  width: min(1200px, calc(100vw - 40px));
  max-height: min(760px, calc(100vh - 42px));
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
}

.commerce-editor-modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
}

.commerce-editor-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(760px, calc(100vh - 42px));
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(31, 32, 33, 0.98);
  overflow: hidden;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.56);
}

.commerce-editor-card header,
.commerce-editor-card footer {
  padding: 16px;
  background: rgba(255, 255, 255, 0.035);
}

.commerce-editor-card h2 {
  font-size: 18px;
}

.commerce-editor-card footer {
  justify-content: flex-end;
}

.commerce-editor-table-wrap {
  min-height: 0;
  overflow: auto;
}

.commerce-editor-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  table-layout: fixed;
}

.commerce-editor-table th,
.commerce-editor-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  vertical-align: top;
  text-align: left;
}

.commerce-editor-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: rgba(245, 251, 255, 0.76);
  background: rgba(31, 32, 33, 0.98);
  font-size: 13px;
}

.commerce-editor-table th:nth-child(1) {
  width: 210px;
}

.commerce-editor-table th:nth-child(2),
.commerce-editor-table th:nth-child(3) {
  width: 350px;
}

.commerce-editor-table th:nth-child(4),
.commerce-editor-table th:nth-child(5) {
  width: 124px;
}

.commerce-editor-table label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #f5fbff;
  font-weight: 800;
}

.commerce-editor-table input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--lime);
}

.commerce-editor-table textarea {
  width: 100%;
  min-height: 92px;
  padding: 10px;
  resize: vertical;
  color: #f5fbff;
  line-height: 1.45;
}

.commerce-editor-table select {
  width: 100%;
  min-height: 36px;
  padding: 0 9px;
}

.modal-card label {
  display: grid;
  gap: 8px;
  color: #dce7ef;
  font-size: 13px;
}

.modal-card input,
.modal-card select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
}

.account-card {
  width: min(460px, calc(100vw - 32px));
}

.account-card section {
  display: grid;
  gap: 14px;
}

.account-profile {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(55, 245, 255, 0.18);
  border-radius: 10px;
  background: rgba(55, 245, 255, 0.06);
}

.account-profile p,
.account-hint,
.account-message {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.account-message {
  min-height: 18px;
  color: var(--lime);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.toggle-line {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 10px !important;
}

.toggle-line input {
  width: 18px;
  min-height: 18px;
}

.setting-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.ghost-close {
  min-height: 24px;
  width: 24px;
  height: 24px;
  padding: 0;
  border-color: rgba(245, 251, 255, 0.16);
  color: #b6bec7;
  background: rgba(55, 60, 66, 0.84);
  font-size: 15px;
  line-height: 1;
}

.ghost-close:hover {
  color: #f5fbff;
  border-color: rgba(245, 251, 255, 0.24);
  background: rgba(86, 97, 109, 0.96);
}

.secondary-action {
  padding: 0 16px;
}

.hidden {
  display: none !important;
}

.icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
}

.icon-home::before,
.icon-home::after,
.icon-cursor::before,
.icon-spark::before,
.icon-gear::before,
.icon-stack-images::before,
.icon-stack-images::after,
.icon-history::before,
.icon-history::after,
.icon-plus::before,
.icon-plus::after,
.icon-book::before,
.icon-bell::before,
.icon-image::before,
.icon-target::before,
.icon-target::after,
.icon-grid::before,
.icon-video::before,
.icon-text::before,
.icon-story::before,
.icon-story::after,
.icon-assets::before,
.icon-assets::after,
.icon-user::before,
.icon-map::before,
.icon-cube::before,
.icon-sliders::before {
  position: absolute;
  content: "";
}

.icon-home::before {
  inset: 5px 3px 2px;
  border: 2px solid currentColor;
  border-top: 0;
}

.icon-home::after {
  left: 3px;
  top: 2px;
  width: 12px;
  height: 12px;
  border-left: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
}

.icon-cursor::before {
  left: 4px;
  top: 1px;
  width: 10px;
  height: 15px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 48%, 58% 55%, 78% 100%, 58% 100%, 40% 61%, 8% 86%);
}

.icon-spark::before {
  inset: 1px;
  background: currentColor;
  clip-path: polygon(50% 0, 61% 38%, 100% 50%, 61% 62%, 50% 100%, 39% 62%, 0 50%, 39% 38%);
}

.icon-gear::before {
  inset: 2px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 -7px 0 -5px currentColor, 0 7px 0 -5px currentColor, 7px 0 0 -5px currentColor, -7px 0 0 -5px currentColor;
}

.icon-stack-images::before {
  left: 3px;
  top: 5px;
  width: 11px;
  height: 9px;
  border: 2px solid currentColor;
  border-radius: 2px;
  background: rgba(9, 10, 12, 0.92);
  box-shadow: 4px -4px 0 -1px rgba(9, 10, 12, 0.92), 4px -4px 0 0 currentColor;
}

.icon-stack-images::after {
  left: 6px;
  top: 9px;
  width: 5px;
  height: 3px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: skewX(-28deg);
}

.icon-history::before {
  inset: 3px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  transform: rotate(-18deg);
}

.icon-history::after {
  left: 2px;
  top: 3px;
  width: 7px;
  height: 7px;
  border-left: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(-35deg);
}

.icon-plus::before {
  left: 8px;
  top: 3px;
  width: 2px;
  height: 12px;
  background: currentColor;
}

.icon-plus::after {
  left: 3px;
  top: 8px;
  width: 12px;
  height: 2px;
  background: currentColor;
}

.icon-book::before {
  inset: 3px 2px;
  border: 2px solid currentColor;
  border-radius: 2px;
  box-shadow: inset 7px 0 0 -6px currentColor;
}

.icon-bell::before {
  left: 4px;
  top: 2px;
  width: 10px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 8px 8px 4px 4px;
  border-bottom-width: 3px;
}

.icon-image::before {
  inset: 3px 2px;
  border: 2px solid currentColor;
  border-radius: 2px;
  background: linear-gradient(135deg, transparent 55%, currentColor 56% 68%, transparent 69%);
}

.icon-video::before {
  left: 4px;
  top: 3px;
  width: 12px;
  height: 12px;
  background: currentColor;
  clip-path: polygon(20% 10%, 20% 90%, 88% 50%);
}

.icon-target::before {
  inset: 2px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.icon-target::after {
  inset: 7px;
  background: currentColor;
  border-radius: 50%;
}

.icon-grid::before {
  inset: 2px;
  background:
    linear-gradient(currentColor 0 0) 50% 0 / 2px 100% no-repeat,
    linear-gradient(currentColor 0 0) 0 50% / 100% 2px no-repeat;
  border: 2px solid currentColor;
}

.icon-text::before {
  left: 2px;
  top: 2px;
  width: 14px;
  height: 3px;
  background: currentColor;
  box-shadow: 6px 0 0 -1px currentColor, 5px 3px 0 -1px currentColor, 5px 6px 0 -1px currentColor, 5px 9px 0 -1px currentColor;
}

.icon-story::before {
  left: 3px;
  top: 2px;
  width: 12px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 2px;
  box-shadow: inset 0 4px 0 -2px currentColor;
}

.icon-story::after {
  left: 6px;
  top: 8px;
  width: 7px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 4px 0 currentColor;
}

.icon-assets::before {
  inset: 3px;
  border: 2px solid currentColor;
  border-radius: 3px;
  box-shadow: 5px -5px 0 -2px rgba(9, 10, 12, 0.92), 5px -5px 0 -1px currentColor;
}

.icon-assets::after {
  left: 5px;
  top: 10px;
  width: 8px;
  height: 4px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: skewX(-24deg);
}

.icon-user::before {
  left: 4px;
  top: 2px;
  width: 10px;
  height: 14px;
  background:
    radial-gradient(circle at 50% 28%, transparent 0 3px, currentColor 3.5px 4.5px, transparent 5px),
    radial-gradient(ellipse at 50% 90%, transparent 0 5px, currentColor 5.5px 6.5px, transparent 7px);
}

.icon-map::before {
  inset: 3px 2px;
  border: 2px solid currentColor;
  border-radius: 2px;
  transform: skewX(-8deg);
  box-shadow: inset 5px 0 0 -4px currentColor, inset -5px 0 0 -4px currentColor;
}

.icon-cube::before {
  inset: 3px;
  border: 2px solid currentColor;
  border-radius: 3px;
  transform: rotate(45deg) scale(0.82);
}

.icon-sliders::before {
  left: 1px;
  top: 3px;
  width: 16px;
  height: 12px;
  background:
    linear-gradient(currentColor 0 0) 0 2px / 16px 2px no-repeat,
    linear-gradient(currentColor 0 0) 0 10px / 16px 2px no-repeat,
    radial-gradient(circle, currentColor 0 3px, transparent 3.5px) 3px 0 / 8px 8px no-repeat,
    radial-gradient(circle, currentColor 0 3px, transparent 3.5px) 8px 8px / 8px 8px no-repeat;
}

.app-shell {
  grid-template-columns: minmax(0, 1fr);
}

.side-rail {
  position: fixed;
  left: 14px;
  top: 70px;
  bottom: 16px;
  z-index: 30;
  width: 58px;
  padding: 10px 8px;
  gap: 9px;
  border: 1px solid rgba(245, 251, 255, 0.1);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(245, 251, 255, 0.04), transparent 42%),
    rgba(12, 14, 18, 0.82);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.42), 0 0 26px rgba(55, 245, 255, 0.08);
  backdrop-filter: blur(20px);
}

.side-rail .brand-mark {
  display: none;
}

.rail-nav,
.rail-tools {
  gap: 9px;
}

.rail-tools {
  padding-top: 0;
}

.help-button {
  margin-top: auto;
}

.studio-topbar {
  position: fixed;
  left: 86px;
  right: 18px;
  top: 12px;
  z-index: 28;
  height: 44px;
  padding: 0 12px 0 14px;
  border: 1px solid rgba(245, 251, 255, 0.1);
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(55, 245, 255, 0.08), transparent 38%, rgba(215, 255, 65, 0.06)),
    rgba(7, 8, 10, 0.78);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.34), 0 0 26px rgba(55, 245, 255, 0.08);
  backdrop-filter: blur(20px);
}

.workspace {
  height: 100vh;
}

.canvas-zone {
  padding-top: 54px;
}

.rail-button {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: #b8c2cc;
  background: transparent;
}

.rail-button:hover,
.rail-button.active {
  color: var(--cyan);
  border-color: rgba(55, 245, 255, 0.72);
  background: rgba(55, 245, 255, 0.1);
  box-shadow: 0 0 0 1px rgba(55, 245, 255, 0.16), 0 0 18px rgba(55, 245, 255, 0.24);
}

.rail-button.active::after {
  position: absolute;
  right: 3px;
  top: 3px;
  width: 7px;
  height: 7px;
  content: "";
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 12px rgba(215, 255, 65, 0.88);
}

.rail-button .icon {
  width: 20px;
  height: 20px;
  filter: drop-shadow(0 0 8px rgba(55, 245, 255, 0.08));
}

.prompt-node {
  width: min(54vw, 900px);
  min-width: 520px;
  min-height: 0;
  padding: 12px;
}

.video-node {
  width: min(44vw, 680px);
  min-width: 430px;
  min-height: 0;
  padding: 12px;
}

.prompt-preview,
.video-preview {
  width: min(100%, 320px);
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
  min-height: 0;
  margin: 0 auto 14px;
  border: 1px solid rgba(245, 251, 255, 0.16);
  border-radius: 18px;
  color: rgba(245, 251, 255, 0.42);
  background:
    linear-gradient(rgba(126, 255, 241, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 255, 241, 0.05) 1px, transparent 1px),
    rgba(18, 19, 22, 0.72);
  background-size: 24px 24px;
  box-shadow: none;
}

.prompt-preview.has-image {
  width: 100%;
  max-width: none;
  aspect-ratio: var(--preview-ratio, 1 / 1);
  background: transparent;
}

.video-node.has-video-result .video-preview {
  width: 100%;
  max-width: none;
  aspect-ratio: var(--video-ratio, 16 / 9);
  background: transparent;
}

.prompt-node textarea,
.video-node textarea {
  position: static;
  display: block;
  width: 100%;
  min-height: 170px;
  margin: 0 0 10px;
  padding: 22px;
  resize: vertical;
  opacity: 1;
  pointer-events: auto;
  border: 1px solid rgba(245, 251, 255, 0.1);
  border-radius: 18px;
  color: rgba(245, 251, 255, 0.9);
  background: rgba(13, 15, 18, 0.9);
  line-height: 1.55;
}

.video-node textarea {
  min-height: 126px;
}

.prompt-node.has-generated-preview textarea {
  flex: 0 0 auto;
  min-height: 138px;
  margin: 0 0 10px;
}

.prompt-node textarea:focus,
.video-node textarea:focus {
  border-color: rgba(55, 245, 255, 0.5);
  box-shadow: 0 0 0 1px rgba(55, 245, 255, 0.16), 0 0 22px rgba(55, 245, 255, 0.16);
}

.prompt-editor-button {
  display: none;
}

.prompt-node footer,
.video-node footer {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  padding-top: 0;
  overflow-x: auto;
  overflow-y: visible;
}

.prompt-node footer select,
.video-node footer select,
.spec-button {
  min-height: 38px;
  border-color: rgba(245, 251, 255, 0.18);
  border-radius: 9px;
  background: rgba(13, 15, 18, 0.92);
}

.prompt-node footer .model-select {
  flex: 1 1 170px;
  max-width: none;
}

.spec-button {
  flex: 0 1 auto;
}

.prompt-node .spec-button {
  display: none;
}

.prompt-node footer .prompt-spec-fields select {
  flex: 0 0 auto;
  min-width: 58px;
  max-width: 108px;
}

.run-small {
  min-height: 38px;
  border-radius: 999px;
}

.prompt-text-dialog,
.agent-role-dialog {
  width: min(860px, calc(100vw - 44px));
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
}

.prompt-text-dialog::backdrop,
.agent-role-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(10px);
}

.prompt-text-card,
.agent-role-card {
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid rgba(245, 251, 255, 0.12);
  border-radius: 18px;
  background: rgba(18, 19, 22, 0.96);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.58);
}

.prompt-text-card header,
.agent-role-card header,
.prompt-text-card footer,
.agent-role-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.prompt-text-card textarea,
.agent-role-card textarea {
  width: 100%;
  min-height: 320px;
  padding: 16px;
  resize: vertical;
  line-height: 1.65;
  background: rgba(5, 8, 12, 0.72);
}

.agent-role-card label {
  display: grid;
  gap: 8px;
}

.select-popover {
  position: fixed;
  z-index: 120;
  display: grid;
  gap: 4px;
  padding: 7px;
  overflow: auto;
  border: 1px solid rgba(245, 251, 255, 0.12);
  border-radius: 12px;
  background: rgba(17, 18, 22, 0.98);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
}

.select-popover button {
  justify-content: space-between;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: #eef7f9;
  background: transparent;
  text-align: left;
}

.select-popover button:hover,
.select-popover button.is-active {
  color: #f5fbff;
  background: rgba(245, 251, 255, 0.1);
}

.select-popover button.is-active::after {
  content: "✓";
  color: var(--lime);
  font-weight: 900;
}

.canvas-help-overlay {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 70;
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px 18px;
  width: min(1160px, calc(100vw - 120px));
  padding: 18px 22px;
  border: 1px solid rgba(245, 251, 255, 0.1);
  border-radius: 18px;
  background: rgba(18, 19, 22, 0.94);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.canvas-help-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.canvas-help-overlay div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 8px;
}

.canvas-help-overlay strong {
  color: var(--text);
  font-size: 13px;
}

.canvas-help-overlay span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.canvas-help-overlay kbd {
  padding: 2px 7px;
  border: 1px solid rgba(245, 251, 255, 0.12);
  border-radius: 6px;
  color: #dce7ef;
  background: rgba(255, 255, 255, 0.06);
  font-size: 11px;
}

.api-guide {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(55, 245, 255, 0.18);
  border-radius: 12px;
  background: rgba(55, 245, 255, 0.06);
}

.api-guide strong {
  color: var(--lime);
}

.api-guide p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.api-guide code {
  color: #dce7ef;
}

.settings-model-library {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(215, 255, 65, 0.18);
  border-radius: 12px;
  background: rgba(215, 255, 65, 0.045);
}

.settings-model-library strong {
  color: var(--lime);
}

.settings-model-library p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.custom-model-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.api-key-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: -6px;
}

.api-key-history-row select {
  min-width: 0;
}

.custom-model-row input,
.custom-model-row select {
  min-width: 0;
}

.danger-inline {
  color: #ff9aa8;
  border-color: rgba(255, 82, 115, 0.34);
  background: rgba(255, 82, 115, 0.08);
}

.danger-inline:hover {
  color: #fff;
  border-color: rgba(255, 82, 115, 0.64);
  background: rgba(255, 82, 115, 0.2);
}

.danger-text-action {
  border: 0;
  color: #ff6b7f;
  background: transparent;
  font-size: 16px;
  font-weight: 900;
}

.danger-text-action:hover {
  color: #fff;
}

.preview-download.is-downloading,
.media-preview-download.is-downloading {
  min-width: 90px;
  color: #050506;
  background: #f5fbff;
}

.floating-toolbar {
  display: none;
}

.cursor-click-burst {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 200;
  width: 10px;
  height: 10px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.cursor-click-burst::before,
.cursor-click-burst::after,
.cursor-click-burst i,
.cursor-click-burst b {
  position: absolute;
  content: "";
  left: 50%;
  top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.cursor-click-burst::before {
  width: 12px;
  height: 12px;
  border: 1px solid var(--cyan);
  animation: cursor-ring 560ms ease-out forwards;
  box-shadow: 0 0 16px rgba(55, 245, 255, 0.72);
}

.cursor-click-burst::after {
  width: 5px;
  height: 5px;
  background: var(--lime);
  box-shadow: 0 0 16px rgba(215, 255, 65, 0.88);
  animation: cursor-dot 480ms ease-out forwards;
}

.cursor-click-burst i {
  width: 54px;
  height: 54px;
  border: 1px solid transparent;
  border-top-color: var(--lime);
  border-right-color: rgba(215, 255, 65, 0.45);
  animation: cursor-arc 560ms ease-out forwards;
}

.cursor-click-burst b {
  width: 66px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--pink), transparent);
  transform: translate(-50%, -50%) rotate(-42deg);
  animation: cursor-sparkline 560ms ease-out forwards;
}

@keyframes cursor-ring {
  to {
    width: 62px;
    height: 62px;
    opacity: 0;
  }
}

@keyframes cursor-dot {
  to {
    transform: translate(20px, -24px) scale(0.2);
    opacity: 0;
  }
}

@keyframes cursor-arc {
  to {
    transform: translate(-50%, -50%) rotate(145deg) scale(1.18);
    opacity: 0;
  }
}

@keyframes cursor-sparkline {
  to {
    transform: translate(-50%, -50%) rotate(-42deg) scaleX(1.25);
    opacity: 0;
  }
}

@media (max-width: 1080px) {
  body {
    overflow: auto;
  }

  .app-shell {
    min-height: 100vh;
    height: auto;
  }

  .workspace {
    grid-template-columns: 1fr;
    height: auto;
  }

  .studio-view {
    overflow: auto;
  }

  .canvas-zone {
    min-height: 680px;
  }

  .agent-panel {
    min-height: 620px;
    border-left: 0;
    border-top: 1px solid rgba(126, 255, 241, 0.16);
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .commerce-agent-card {
    position: absolute;
    top: 14px;
    left: 14px;
    width: min(430px, calc(100% - 28px));
  }

  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-rail {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 20;
    flex-direction: row;
    justify-content: space-between;
    height: 58px;
    border: 1px solid rgba(126, 255, 241, 0.18);
    border-radius: 12px;
  }

  .rail-nav {
    flex: 0;
    flex-direction: row;
  }

  .dashboard-view {
    padding: 24px 16px 92px;
  }

  .top-strip {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 24px;
  }

  .commerce-meta-grid,
  .commerce-template-list {
    grid-template-columns: 1fr;
  }

  .console-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .quick-models {
    justify-content: flex-start;
    margin-bottom: 42px;
  }

  .project-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .studio-topbar {
    padding-left: 12px;
  }

  .workspace {
    padding-bottom: 86px;
  }

  .canvas-node,
  .prompt-node {
    left: 50% !important;
    width: calc(100vw - 48px);
    min-width: 0;
    transform: translateX(-50%);
  }

  .image-node {
    top: 70px !important;
  }

  .video-node {
    top: 410px !important;
  }

  .prompt-node {
    top: 585px !important;
  }

  .floating-toolbar {
    max-width: calc(100vw - 32px);
    overflow-x: auto;
  }
}

/* 1.0.12 layout and interaction refinements */
.rail-mode-button,
.rail-open-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: #b8c2cc;
  background: rgba(255, 255, 255, 0.035);
}

.rail-mode-button:hover,
.rail-open-button:hover {
  color: var(--cyan);
  background: rgba(55, 245, 255, 0.1);
  box-shadow: 0 0 18px rgba(55, 245, 255, 0.22);
}

.rail-open-button {
  position: fixed;
  left: 14px;
  top: 72px;
  z-index: 31;
  display: none;
  border: 1px solid rgba(55, 245, 255, 0.34);
  background: rgba(12, 14, 18, 0.88);
  backdrop-filter: blur(18px);
}

body[data-rail-mode="compact"] .side-rail {
  bottom: auto;
  min-height: 0;
  padding-bottom: 10px;
}

body[data-rail-mode="compact"] .side-rail .rail-tools,
body[data-rail-mode="compact"] .side-rail .help-button {
  display: none;
}

body[data-rail-mode="hidden"] .side-rail {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-92px);
}

body[data-rail-mode="hidden"] .rail-open-button {
  display: inline-grid;
}

.studio-topbar {
  position: static;
  display: contents;
  height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.studio-topbar .doc-title,
.studio-topbar .studio-meta,
.studio-topbar .canvas-toast {
  position: fixed;
  z-index: 32;
  min-height: 42px;
  border: 1px solid rgba(245, 251, 255, 0.1);
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(55, 245, 255, 0.07), transparent 56%),
    rgba(7, 8, 10, 0.78);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.32), 0 0 22px rgba(55, 245, 255, 0.08);
  backdrop-filter: blur(20px);
}

.studio-topbar .doc-title {
  left: 14px;
  top: 12px;
  max-width: min(620px, calc(50vw - 26px));
  padding: 0 12px;
}

.studio-topbar .studio-meta {
  right: 18px;
  top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
}

.studio-topbar .canvas-toast {
  left: 50%;
  top: 12px;
  display: grid;
  place-items: center;
  width: min(520px, 38vw);
  max-width: min(520px, calc(100vw - 260px));
  margin: 0;
  padding: 0 18px;
  opacity: 0;
  transform: translateX(-50%) translateY(-8px);
}

.studio-topbar .canvas-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.doc-title-input {
  max-width: 420px;
}

.commerce-agent-card.is-docked {
  top: 68px;
  left: 86px;
  max-height: calc(100vh - 86px);
}

body[data-rail-mode="compact"] .commerce-agent-card.is-docked {
  left: 76px;
}

body[data-rail-mode="hidden"] .commerce-agent-card.is-docked {
  left: 18px;
}

.commerce-agent-card.is-unlocked > header {
  cursor: move;
}

.commerce-agent-card.is-dragging {
  user-select: none;
  box-shadow: 0 0 0 1px rgba(215, 255, 65, 0.34), 0 30px 84px rgba(0, 0, 0, 0.52), var(--shadow-cyan);
}

.commerce-window-actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.commerce-lock-button {
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid rgba(245, 251, 255, 0.14);
  border-radius: 999px;
  color: #b6bec7;
  background: rgba(55, 60, 66, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.commerce-lock-button:hover {
  color: var(--cyan);
  border-color: rgba(55, 245, 255, 0.38);
}

.select-popover button.is-active::after {
  width: 9px;
  height: 9px;
  content: "";
  border: 2px solid var(--lime);
  border-radius: 50%;
  background: radial-gradient(circle, var(--lime) 0 42%, transparent 44%);
  box-shadow: 0 0 12px rgba(215, 255, 65, 0.72);
}

.prompt-preview,
.video-preview {
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
}

.prompt-preview.has-image img,
.video-preview video {
  border-radius: 12px;
}

.node-create-menu {
  z-index: 82;
  transform: none !important;
  transform-origin: center;
}

.canvas-node textarea,
.prompt-node textarea,
.commerce-agent-card textarea,
.commerce-editor-card textarea,
.agent-role-card textarea,
.prompt-text-card textarea,
.hero-console textarea,
.chat-box textarea,
.agent-output {
  direction: ltr;
  text-align: left;
  unicode-bidi: plaintext;
  scrollbar-color: rgba(245, 251, 255, 0.5) rgba(255, 255, 255, 0.08);
  scrollbar-width: auto;
}

.canvas-node textarea::placeholder,
.prompt-node textarea::placeholder,
.commerce-agent-card textarea::placeholder,
.hero-console textarea::placeholder,
.chat-box textarea::placeholder {
  text-align: left;
}

.canvas-node textarea::-webkit-scrollbar,
.prompt-node textarea::-webkit-scrollbar,
.commerce-agent-card textarea::-webkit-scrollbar,
.commerce-editor-card textarea::-webkit-scrollbar,
.agent-role-card textarea::-webkit-scrollbar,
.prompt-text-card textarea::-webkit-scrollbar,
.hero-console textarea::-webkit-scrollbar,
.chat-box textarea::-webkit-scrollbar,
.agent-output::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

.canvas-node textarea::-webkit-scrollbar-thumb,
.prompt-node textarea::-webkit-scrollbar-thumb,
.commerce-agent-card textarea::-webkit-scrollbar-thumb,
.commerce-editor-card textarea::-webkit-scrollbar-thumb,
.agent-role-card textarea::-webkit-scrollbar-thumb,
.prompt-text-card textarea::-webkit-scrollbar-thumb,
.hero-console textarea::-webkit-scrollbar-thumb,
.chat-box textarea::-webkit-scrollbar-thumb,
.agent-output::-webkit-scrollbar-thumb {
  border: 4px solid rgba(8, 10, 12, 0.96);
  border-radius: 999px;
  background: rgba(245, 251, 255, 0.58);
}

.canvas-node textarea::-webkit-scrollbar-track,
.prompt-node textarea::-webkit-scrollbar-track,
.commerce-agent-card textarea::-webkit-scrollbar-track,
.commerce-editor-card textarea::-webkit-scrollbar-track,
.agent-role-card textarea::-webkit-scrollbar-track,
.prompt-text-card textarea::-webkit-scrollbar-track,
.hero-console textarea::-webkit-scrollbar-track,
.chat-box textarea::-webkit-scrollbar-track,
.agent-output::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.07);
}

/* 1.0.13 prompt split layout */
.select-popover button.is-active::after {
  display: none !important;
  content: none !important;
}

.select-popover button.is-active {
  color: var(--lime);
}

.prompt-node {
  align-items: center;
  width: min(58vw, 940px);
  min-width: 560px;
  gap: 18px;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.prompt-node.selected,
.prompt-node.multi-selected {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.prompt-preview-shell {
  display: grid;
  place-items: center;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  pointer-events: auto;
}

.prompt-preview {
  width: min(320px, 72%);
  max-width: 360px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border: 1px solid rgba(126, 255, 241, 0.24) !important;
  border-radius: 12px;
  background:
    linear-gradient(rgba(126, 255, 241, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 255, 241, 0.045) 1px, transparent 1px),
    rgba(13, 15, 18, 0.72) !important;
  background-size: 24px 24px;
  box-shadow: none !important;
}

.prompt-preview.has-image {
  width: min(100%, 520px);
  max-width: 520px;
  aspect-ratio: var(--preview-ratio, 1 / 1);
}

.prompt-control-panel {
  display: grid;
  width: 100%;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(55, 245, 255, 0.56);
  border-radius: 10px;
  background:
    linear-gradient(rgba(126, 255, 241, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 255, 241, 0.035) 1px, transparent 1px),
    rgba(7, 9, 12, 0.9);
  background-size: 24px 24px;
  box-shadow: 0 0 0 1px rgba(55, 245, 255, 0.12), var(--shadow-cyan), 0 20px 48px rgba(0, 0, 0, 0.32);
}

.prompt-control-panel .prompt-reference-tray {
  margin: 0;
}

.prompt-control-panel textarea {
  min-height: 160px;
  margin: 0;
}

.prompt-control-panel footer {
  margin: 0;
}

.prompt-node.collapsed {
  width: min(34vw, 360px) !important;
  min-width: 220px;
  min-height: 0;
  gap: 0;
  padding: 8px;
}

.prompt-node.collapsed .prompt-control-panel {
  display: none;
}

.prompt-node.collapsed .prompt-preview {
  width: min(100%, 320px);
  max-width: 320px;
  margin: 0 auto;
}

.prompt-node.collapsed .prompt-preview.has-image {
  width: min(100%, 320px);
  max-width: 320px;
}

/* 1.0.15: keep preview as the node, attach controls underneath */
.prompt-node {
  --prompt-preview-size: clamp(300px, 28vw, 420px);
  --prompt-panel-width: clamp(620px, 64vw, 980px);
  width: var(--prompt-node-width, var(--prompt-preview-size));
  min-width: 260px;
  min-height: 0;
  padding: 0 !important;
  overflow: visible !important;
  transition: none;
}

.prompt-preview-shell {
  position: relative;
  width: 100%;
  aspect-ratio: var(--preview-ratio, 1 / 1);
  height: auto;
}

.prompt-preview {
  width: 100% !important;
  max-width: none !important;
  height: 100%;
  margin: 0 !important;
}

.prompt-preview.has-image {
  width: 100% !important;
  max-width: none !important;
  height: auto;
  min-height: 0;
  aspect-ratio: var(--preview-ratio, 1 / 1);
}

.prompt-control-panel {
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  width: var(--prompt-panel-width);
  transform: translateX(-50%);
}

.prompt-node.collapsed {
  width: var(--prompt-node-width, var(--prompt-preview-size)) !important;
  min-width: 260px;
  min-height: 0 !important;
  padding: 0 !important;
}

.prompt-node.collapsed .prompt-preview,
.prompt-node.collapsed .prompt-preview.has-image {
  width: 100% !important;
  max-width: none !important;
}

.prompt-node > .delete-node {
  top: -18px;
  right: -18px;
}

.prompt-node > .connect-handle.input {
  left: -21px;
  top: 50%;
}

.prompt-node > .connect-handle.output {
  right: -21px;
  top: 50%;
}

.prompt-node > .resize-handle {
  right: -10px;
  bottom: -10px;
}

.video-node .prompt-reference-tray.is-limited {
  box-shadow: inset 0 0 0 1px rgba(215, 255, 65, 0.28);
}