:root,
[data-theme="deep-canvas"] {
  color-scheme: dark;
  --color-background: #07090b;
  --color-canvas: #050708;
  --color-surface-default: #14181b;
  --color-surface-raised: #1b2024;
  --color-surface-overlay: #20262a;
  --color-border-subtle: rgba(221, 232, 236, 0.11);
  --color-border-strong: rgba(221, 232, 236, 0.22);
  --color-text-primary: #f3f7f8;
  --color-text-secondary: #c5cdd1;
  --color-text-muted: #89949b;
  --color-text-faint: #637079;
  --color-accent-primary: #22d6ad;
  --color-accent-primary-hover: #35e4bc;
  --color-accent-soft: rgba(34, 214, 173, 0.13);
  --color-accent-ring: rgba(34, 214, 173, 0.22);
  --color-accent-border: rgba(34, 214, 173, 0.34);
  --color-accent-selected-bg: rgba(34, 214, 173, 0.1);
  --color-accent-selected-text: #d8fff5;
  --color-success: #35d49f;
  --color-success-soft: rgba(53, 212, 159, 0.13);
  --color-success-text: #b7f6e0;
  --color-warning: #f1bd5f;
  --color-warning-soft: rgba(241, 189, 95, 0.14);
  --color-warning-text: #f8d89a;
  --color-danger: #ff6b86;
  --color-danger-soft: rgba(255, 107, 134, 0.11);
  --color-danger-border: rgba(255, 107, 134, 0.36);
  --color-danger-text: #ffcad3;
  --color-info: #79adff;
  --color-info-soft: rgba(121, 173, 255, 0.14);
  --color-info-border: rgba(121, 173, 255, 0.34);
  --color-info-text: #c6d9ff;
  --color-control-bg: #0c1012;
  --color-control-subtle: rgba(255, 255, 255, 0.045);
  --color-control-hover: rgba(255, 255, 255, 0.065);
  --color-overlay-backdrop: rgba(0, 0, 0, 0.66);
  --shadow-low: 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-raised: 0 16px 44px rgba(0, 0, 0, 0.38);
  --shadow-overlay: 0 24px 72px rgba(0, 0, 0, 0.46);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --control-height-sm: 30px;
  --control-height-md: 36px;
  --control-height-lg: 42px;
  --chrome-border: var(--color-border-subtle);
  --chrome-surface: var(--color-surface-default);
  --chrome-raised: var(--color-surface-raised);
  --chrome-overlay: var(--color-surface-overlay);
  --chrome-focus: var(--color-accent-ring);
  --node-port-size: 18px;
  --node-port-hit: 42px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --bg: var(--color-background);
  --panel: var(--color-surface-default);
  --panel-soft: var(--color-surface-raised);
  --panel-deep: #0d1012;
  --line: var(--color-border-subtle);
  --line-strong: var(--color-border-strong);
  --text: var(--color-text-primary);
  --muted: var(--color-text-muted);
  --faint: var(--color-text-faint);
  --green: var(--color-accent-primary);
  --pink: var(--color-danger);
  --blue: var(--color-info);
  --gold: var(--color-warning);
  --shadow: var(--shadow-overlay);
  --grid-size: 18px;
  --grid-x: 0px;
  --grid-y: 0px;
  --panorama-bg: rgba(0, 0, 0, 0.92);
  --panorama-btn-bg: rgba(255, 255, 255, 0.1);
  --panorama-btn-hover: rgba(255, 255, 255, 0.2);
  --panorama-btn-active: rgba(105, 167, 255, 0.3);
}

[data-theme="dark-admin"] {
  color-scheme: dark;
  --color-background: #080a0c;
  --color-canvas: #0b0e11;
  --color-surface-default: #12161a;
  --color-surface-raised: #171c21;
  --color-surface-overlay: #1d2329;
  --color-border-subtle: rgba(222, 232, 236, 0.1);
  --color-border-strong: rgba(222, 232, 236, 0.2);
  --color-text-primary: #f2f6f7;
  --color-text-secondary: #c4ccd1;
  --color-text-muted: #8f9aa2;
  --color-text-faint: #68737c;
  --color-accent-primary: #4fd3ad;
  --color-accent-primary-hover: #6be0bf;
  --color-accent-soft: rgba(79, 211, 173, 0.12);
  --color-accent-ring: rgba(79, 211, 173, 0.22);
  --color-accent-border: rgba(79, 211, 173, 0.34);
  --color-accent-selected-bg: rgba(79, 211, 173, 0.1);
  --color-accent-selected-text: #c7f8e8;
  --color-success: #4fd3ad;
  --color-success-soft: rgba(79, 211, 173, 0.12);
  --color-success-text: #baf2df;
  --color-warning: #e9ba63;
  --color-warning-soft: rgba(233, 186, 99, 0.12);
  --color-warning-text: #f1d59c;
  --color-danger: #ff6f86;
  --color-danger-soft: rgba(255, 111, 134, 0.1);
  --color-danger-border: rgba(255, 111, 134, 0.34);
  --color-danger-text: #ffb4c1;
  --color-info: #8aafff;
  --color-info-soft: rgba(138, 175, 255, 0.12);
  --color-info-border: rgba(138, 175, 255, 0.34);
  --color-info-text: #c9d8ff;
  --color-control-bg: #101419;
  --color-control-subtle: rgba(255, 255, 255, 0.04);
  --color-control-hover: rgba(255, 255, 255, 0.06);
  --color-overlay-backdrop: rgba(0, 0, 0, 0.66);
  --shadow-low: 0 8px 24px rgba(0, 0, 0, 0.24);
  --shadow-raised: 0 14px 38px rgba(0, 0, 0, 0.34);
  --shadow-overlay: 0 24px 70px rgba(0, 0, 0, 0.46);
  --bg: var(--color-background);
  --panel: var(--color-surface-default);
  --panel-soft: var(--color-surface-raised);
  --panel-deep: #0e1215;
  --line: var(--color-border-subtle);
  --line-strong: var(--color-border-strong);
  --text: var(--color-text-primary);
  --muted: var(--color-text-muted);
  --faint: var(--color-text-faint);
  --green: var(--color-accent-primary);
  --pink: var(--color-danger);
  --blue: var(--color-info);
  --gold: var(--color-warning);
  --shadow: var(--shadow-overlay);
}

html,
html.theme-deep-canvas,
html.theme-dark-admin,
[data-theme="deep-canvas"],
[data-theme="dark-admin"] {
  background: var(--color-background);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  cursor: pointer;
}

.app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 48% 40%, rgba(105, 167, 255, 0.04), transparent 28rem),
    var(--color-canvas);
}

.ui-layer {
  position: absolute;
  z-index: 10;
}

.topbar {
  z-index: 60;
  top: 12px;
  left: 32px;
  right: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.project-title,
.top-actions,
.bottom-bar,
.composer,
.context-panel,
.side-panel,
.inspector {
  pointer-events: auto;
}

.project-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.back-dashboard-btn {
  min-width: 28px;
  min-height: 28px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.back-dashboard-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
}

.project-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background:
    linear-gradient(90deg, transparent 40%, #050607 40% 54%, transparent 54%),
    linear-gradient(0deg, transparent 42%, #050607 42% 56%, transparent 56%),
    var(--green);
  transform: rotate(2deg);
}

.project-title input {
  width: min(320px, 44vw);
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 19px;
  font-weight: 700;
  outline: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.canvas-mode-pill {
  z-index: 45;
  left: 16px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(20, 24, 25, 0.82);
  color: var(--muted);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(18px);
}

.canvas-mode-pill strong {
  color: #dfe4e7;
  font-size: 11px;
  white-space: nowrap;
}

.canvas-mode-pill span {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-command-bar {
  z-index: 62;
  left: 50%;
  top: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  background: rgba(18, 21, 23, 0.9);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

.canvas-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.canvas-tool span {
  color: inherit;
  font-size: 12px;
  font-weight: 700;
}

.canvas-tool:hover,
.canvas-tool.is-active {
  background: rgba(24, 224, 176, 0.12);
  color: #c9fff0;
}

.canvas-path-bar {
  z-index: 56;
  left: 84px;
  top: 78px;
  display: grid;
  grid-template-columns: 30px auto minmax(180px, 390px);
  align-items: center;
  gap: 8px;
  max-width: min(560px, calc(100vw - 620px));
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(18, 21, 23, 0.84);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.canvas-path-bar.is-collapsed {
  width: 38px;
  height: 38px;
  grid-template-columns: 30px;
  gap: 0;
  padding: 4px;
  border-radius: 12px;
}

.canvas-path-toggle {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 13px;
}

.canvas-path-toggle:hover,
.canvas-path-bar:not(.is-collapsed) .canvas-path-toggle {
  background: rgba(24, 224, 176, 0.12);
  color: #c9fff0;
}

.canvas-path-bar.is-collapsed small,
.canvas-path-bar.is-collapsed strong {
  display: none;
}

.canvas-path-bar small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.canvas-path-bar strong {
  overflow: hidden;
  color: #dfe4e7;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.square-button,
.round-button,
.pill-button,
.ghost-button,
.run-button,
.thumb-add {
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  min-height: 26px;
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--text);
}

.pill-button.primary {
  background: var(--green);
  color: #03110e;
  font-weight: 900;
}

.square-button:hover,
.round-button:hover,
.pill-button:hover,
.ghost-button:hover,
.thumb-add:hover {
  background: rgba(255, 255, 255, 0.13);
}

.pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 8px;
  min-width: auto;
  font-size: 11px;
  font-weight: 700;
}

.balance {
  color: var(--text);
}

.balance span {
  color: var(--green);
}

.balance strong {
  color: var(--muted);
  font-size: 11px;
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  display: inline-grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
  background:
    radial-gradient(circle at 70% 28%, #f87f74 0 14%, transparent 15%),
    radial-gradient(circle at 35% 70%, #41d1ff 0 18%, transparent 19%),
    linear-gradient(135deg, #6d1e51, #111b20);
}

.canvas-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.04) 1px, transparent 1.4px);
  background-position: var(--grid-x) var(--grid-y);
  background-size: var(--grid-size) var(--grid-size);
}

.canvas-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-position: var(--grid-x) var(--grid-y);
  background-size: calc(var(--grid-size) * 8) calc(var(--grid-size) * 8);
  opacity: 0.45;
  pointer-events: none;
}

.canvas-stage.is-panning {
  cursor: grabbing;
}

.canvas-stage.hide-grid {
  background-image: none;
}

.canvas-stage.hide-grid::before {
  opacity: 0;
}

.world-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  transform-origin: 0 0;
  will-change: transform;
}

.nodes-layer {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
}

.edges-layer {
  position: absolute;
  z-index: 1;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: auto;
}

.edge-controls-layer {
  position: absolute;
  z-index: 3;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}

.edge-controls-layer > * {
  pointer-events: auto;
}

.edge-group {
  pointer-events: auto;
}

.edge-path {
  fill: none;
  stroke: rgba(176, 190, 199, 0.36);
  stroke-width: 1.15;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.edge-path.is-hot {
  stroke: rgba(190, 207, 216, 0.64);
}

.edge-path.is-drafting {
  stroke: rgba(24, 224, 176, 0.95);
  stroke-width: 1.4;
  stroke-dasharray: 8 8;
}

.edge-path.is-running {
  stroke: rgba(105, 167, 255, 0.88);
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-dasharray: 12 22;
  filter: drop-shadow(0 0 4px rgba(105, 167, 255, 0.36));
  animation: edge-flow 1.1s linear infinite;
}

.edge-path.is-running.is-hot {
  stroke: rgba(24, 224, 176, 0.94);
  filter: drop-shadow(0 0 5px rgba(24, 224, 176, 0.42));
}

.edge-flow-path {
  fill: none;
  stroke: rgba(87, 180, 255, 0.94);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 56 240;
  stroke-dashoffset: 0;
  filter:
    drop-shadow(0 0 4px rgba(87, 180, 255, 0.7))
    drop-shadow(0 0 10px rgba(24, 224, 176, 0.28));
  vector-effect: non-scaling-stroke;
  pointer-events: none;
  animation: edge-flow 1.45s linear infinite;
}

.edge-flow-path.is-running {
  stroke: rgba(24, 224, 176, 0.96);
  stroke-width: 2.2;
}

.edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 22;
  pointer-events: stroke;
}

.edge-cut {
  cursor: pointer;
  opacity: 0;
  pointer-events: all;
  transform-box: fill-box;
  transform-origin: center;
  transition:
    opacity 0.12s ease,
    transform 0.12s ease;
}

.edge-group:hover .edge-cut {
  opacity: 1;
}

.edge-cut circle {
  fill: rgba(24, 27, 29, 0.96);
  stroke: rgba(255, 255, 255, 0.38);
  stroke-width: 1.5;
}

.edge-cut:hover circle {
  fill: rgba(24, 224, 176, 0.18);
  stroke: var(--green);
}

.edge-cut text {
  fill: #f4f7f8;
  font-size: 13px;
  pointer-events: none;
}

.edge-cut-button {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  background: rgba(24, 27, 29, 0.96);
  color: #f4f7f8;
  font-size: 13px;
  line-height: 1;
  opacity: 0.18;
  transform: translate(-50%, -50%);
  transition:
    opacity 0.12s ease,
    border-color 0.12s ease,
    color 0.12s ease,
    background 0.12s ease;
  pointer-events: auto;
}

.edge-cut-button.is-hot,
.edge-cut-button:hover {
  border-color: var(--green);
  background: rgba(24, 224, 176, 0.16);
  color: var(--green);
  opacity: 1;
}

.edge-hit-zone {
  position: absolute;
  z-index: 3;
  width: 88px;
  height: 16px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: background 0.12s;
  pointer-events: auto;
}

.edge-hit-zone:hover {
  background: rgba(24, 224, 176, 0.08);
}

.edge-endpoint-handle {
  position: absolute;
  z-index: 6;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--green);
  border-radius: 50%;
  background: rgba(8, 10, 12, 0.16);
  cursor: grab;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 5px rgba(24, 224, 176, 0.08);
  transition: background 0.12s, box-shadow 0.12s, border-color 0.12s;
  pointer-events: auto;
}

.edge-endpoint-handle:hover {
  background: rgba(24, 224, 176, 0.22);
  box-shadow: 0 0 0 8px rgba(24, 224, 176, 0.12);
}

.edge-endpoint-handle:active {
  cursor: grabbing;
  background: rgba(24, 224, 176, 0.34);
}

[class~="left-dock"] {
  z-index: 60;
  top: 50%;
  left: 16px;
  display: grid;
  justify-items: start;
  gap: 6px;
  width: 36px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overflow: hidden;
  pointer-events: auto;
  transform: translateY(-50%);
  transition:
    width 160ms ease,
    transform 160ms ease;
}

[class~="left-dock"]:hover,
[class~="left-dock"]:focus-within {
  width: 108px;
  background: transparent;
  box-shadow: none;
}

[class~="dock-add"] {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(18, 19, 21, 0.78);
  color: var(--text);
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  transform: translateX(0);
  transition:
    width 160ms ease,
    padding 160ms ease,
    border-radius 160ms ease,
    background 140ms ease,
    color 140ms ease,
    transform 160ms ease;
}

[class~="dock-add"]::before,
[class~="dock-item"]::before {
  content: "";
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
  align-self: center;
  width: 15px;
  height: 15px;
  min-width: 15px;
  margin: 0;
  background: currentColor;
  transform: none;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 15px 15px;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: 15px 15px;
}

[class~="dock-add"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 5v14M5 12h14' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 5v14M5 12h14' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
}

[class~="dock-add"]::after {
  content: "添加";
  grid-column: 2;
  grid-row: 1;
  justify-self: start;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 120ms ease, transform 160ms ease;
}

[class~="dock-add"] {
  font-size: 0;
}

[class~="left-dock"]:hover [class~="dock-add"],
[class~="left-dock"]:focus-within [class~="dock-add"] {
  width: 96px;
  padding: 0;
  border-radius: 12px;
  transform: translateX(0);
}

[class~="left-dock"]:hover [class~="dock-add"]::after,
[class~="left-dock"]:focus-within [class~="dock-add"]::after {
  opacity: 1;
  transform: translateX(0);
}

[class~="dock-add"]:hover,
[class~="dock-add"].is-active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--green);
}

[class~="dock-add"]:active,
[class~="dock-item"]:active {
  background: rgba(34, 214, 173, 0.14);
  color: #d8fff5;
}

[class~="dock-add"]:disabled,
[class~="dock-item"]:disabled {
  background: transparent;
  color: var(--color-text-faint);
}

[class~="dock-add"]:hover::after,
[class~="dock-add"].is-active::after {
  color: #dffaf3;
}

[class~="dock-item"] {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(18, 19, 21, 0.78);
  color: var(--text);
  overflow: hidden;
  white-space: nowrap;
  transition:
    width 160ms ease,
    padding 160ms ease,
    background 140ms ease,
    color 140ms ease;
}

[class~="dock-item"][data-action="assets"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 6h14M5 12h14M5 18h14' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 6h14M5 12h14M5 18h14' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
}

[class~="dock-item"][data-action="queue"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 7h12M6 12h12M6 17h8' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3Ccircle cx='18' cy='17' r='2' fill='black'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 7h12M6 12h12M6 17h8' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3Ccircle cx='18' cy='17' r='2' fill='black'/%3E%3C/svg%3E");
}

[class~="dock-item"][data-action="workflow"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 7h10M7 17h10M8 7v10M16 7v10' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3Ccircle cx='7' cy='7' r='2.6' fill='black'/%3E%3Ccircle cx='17' cy='7' r='2.6' fill='black'/%3E%3Ccircle cx='7' cy='17' r='2.6' fill='black'/%3E%3Ccircle cx='17' cy='17' r='2.6' fill='black'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 7h10M7 17h10M8 7v10M16 7v10' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3Ccircle cx='7' cy='7' r='2.6' fill='black'/%3E%3Ccircle cx='17' cy='7' r='2.6' fill='black'/%3E%3Ccircle cx='7' cy='17' r='2.6' fill='black'/%3E%3Ccircle cx='17' cy='17' r='2.6' fill='black'/%3E%3C/svg%3E");
}

[class~="dock-item"][data-action="versions"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 5a7 7 0 1 1-6.3 4M5 5v4h4M12 8v4l3 2' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 5a7 7 0 1 1-6.3 4M5 5v4h4M12 8v4l3 2' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

[class~="dock-item"][data-action="stage"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='5' y='5' width='14' height='14' rx='1.8' fill='none' stroke='black' stroke-width='2.2'/%3E%3Crect x='9' y='9' width='6' height='6' rx='1' fill='black'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='5' y='5' width='14' height='14' rx='1.8' fill='none' stroke='black' stroke-width='2.2'/%3E%3Crect x='9' y='9' width='6' height='6' rx='1' fill='black'/%3E%3C/svg%3E");
}

[class~="dock-item"]:hover,
[class~="dock-item"].is-active {
  border-color: var(--color-border-strong);
  background: rgba(24, 26, 28, 0.92);
}

[class~="dock-item"].is-active {
  color: var(--green);
}

[class~="left-dock"]:hover [class~="dock-item"],
[class~="left-dock"]:focus-within [class~="dock-item"] {
  width: 96px;
  padding: 0;
}

[class~="dock-item"] span {
  display: none;
}

[class~="dock-item"] small {
  grid-column: 2;
  grid-row: 1;
  justify-self: start;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 120ms ease, transform 160ms ease;
}

[class~="left-dock"]:hover [class~="dock-item"] small,
[class~="left-dock"]:focus-within [class~="dock-item"] small {
  opacity: 1;
  transform: translateX(0);
}

[class~="dock-item"].is-active small,
[class~="dock-item"]:hover small {
  color: #dffaf3;
}

.context-panel,
.side-panel,
.inspector,
.composer,
.bottom-bar,
.modal-box {
  border: 1px solid var(--line);
  background:
    linear-gradient(140deg, rgba(34, 37, 39, 0.94), rgba(15, 32, 29, 0.88)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.context-panel {
  z-index: 70;
  width: 380px;
  max-width: calc(100vw - 40px);
  padding: 18px;
  border-radius: 8px;
}

.panel-title,
.inspector-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-title strong {
  font-size: 18px;
}

.panel-title small,
.inspector-head small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
}

.ghost-button {
  min-width: 32px;
  min-height: 32px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.upload-tile {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 142px;
  margin-top: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  cursor: pointer;
  text-align: center;
}

.upload-tile input {
  display: none;
}

.upload-tile span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
  font-size: 22px;
}

.upload-tile em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.quick-node {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  text-align: left;
}

.quick-node:hover {
  background: rgba(255, 255, 255, 0.12);
}

.quick-node span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 900;
}

.quick-node small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.asset-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin: 10px 0 12px;
  padding: 4px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

.asset-tabs button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.asset-tabs button:hover,
.asset-tabs button.is-active {
  background: rgba(24, 224, 176, 0.12);
  color: #c9fff0;
}

.asset-library-item,
.queue-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 10px;
  align-items: center;
}

.asset-library-preview,
.queue-icon {
  grid-row: 1 / 4;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #c8ddff;
  overflow: hidden;
  font-weight: 900;
}

.asset-library-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.queue-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.queue-summary div {
  display: grid;
  gap: 2px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.queue-summary strong {
  color: var(--text);
  font-size: 18px;
}

.queue-summary span {
  color: var(--muted);
  font-size: 12px;
}

.queue-section,
.workflow-group-list {
  display: grid;
  gap: 8px;
}

.queue-section h4,
.workflow-group-list h4 {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.queue-running {
  border-color: rgba(24, 224, 176, 0.22);
}

.queue-error {
  border-color: rgba(255, 92, 122, 0.28);
}

.workflow-path-card span {
  line-height: 1.45;
}

.side-panel {
  z-index: 50;
  top: 96px;
  left: 86px;
  width: 380px;
  max-width: calc(100vw - 112px);
  max-height: calc(100vh - 132px);
  overflow: auto;
  padding: 18px;
  border-radius: 8px;
}

.side-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.side-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

button.side-card {
  width: 100%;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

button.side-card:hover {
  border-color: rgba(28, 217, 185, 0.48);
  background: rgba(28, 217, 185, 0.1);
}

.side-card strong {
  font-size: 14px;
}

.side-card span,
.side-card small {
  color: var(--muted);
  font-size: 12px;
}

.drawer-upload {
  margin-top: 16px;
}

.version-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.version-restore-btn,
.version-delete-btn {
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.version-restore-btn:hover {
  border-color: var(--green);
  color: var(--green);
}

.version-delete-btn:hover {
  border-color: #ff6b8a;
  color: #ff6b8a;
}

.drawer-upload input {
  display: none;
}

.inspector {
  z-index: 40;
  top: 64px;
  right: 18px;
  width: 360px;
  max-width: calc(100vw - 108px);
  max-height: calc(100vh - 88px);
  overflow: auto;
  padding: 16px;
  border-radius: 8px;
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
}

.inspector-head h2 {
  margin: 2px 0 0;
  font-size: 20px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin: 16px 0;
  padding: 4px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
}

.tab {
  min-height: 32px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.tab.is-active {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
}

.inspector-tab {
  min-width: 46px;
  min-height: 26px;
  background: var(--panel-soft);
  font-size: 11px;
}

.inspector-tab.is-active {
  background: rgba(28, 217, 185, 0.18);
  color: #dffff7;
}

.api-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0 6px;
}

.api-action-row .pill-button {
  min-height: 36px;
  width: 100%;
  font-size: 13px;
  font-weight: 800;
}

.api-status {
  min-height: 30px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.api-status.is-ok {
  border-color: rgba(24, 224, 176, 0.34);
  color: #9df6df;
}

.api-status.is-error {
  border-color: rgba(255, 92, 122, 0.42);
  color: #ffadbd;
}

.global-model-summary {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 12px;
  color: var(--muted);
  max-height: 200px;
  overflow-y: auto;
}

.global-model-summary:empty {
  display: none;
}

.global-model-summary .model-group-title {
  color: #c5cbd0;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.global-model-summary .model-group-title:first-child {
  margin-top: 0;
}

.global-model-summary .model-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  color: #9ca3a8;
}

.global-model-summary .model-item .model-kind-tag {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.global-model-summary .model-item .model-kind-tag.kind-image { background: rgba(105, 167, 255, 0.2); color: #69a7ff; }
.global-model-summary .model-item .model-kind-tag.kind-video { background: rgba(255, 167, 84, 0.2); color: #ffa754; }
.global-model-summary .model-item .model-kind-tag.kind-audio { background: rgba(176, 132, 255, 0.2); color: #b084ff; }
.global-model-summary .model-item .model-kind-tag.kind-text { background: rgba(24, 224, 176, 0.2); color: #18e0b0; }
.global-model-summary .model-item .model-kind-tag.kind-ai { background: rgba(255, 92, 122, 0.2); color: #ff5c7a; }
.global-model-summary .model-item .model-kind-tag.kind-all { background: rgba(255, 255, 255, 0.1); color: #dfe4e7; }

.tab-panel {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: #c5cbd0;
  font-size: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.26);
  color: var(--text);
  outline: 0;
}

input,
select {
  min-height: 38px;
  padding: 0 10px;
  font-size: 13px;
}

textarea {
  resize: vertical;
  padding: 12px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
}

.inline-file input {
  padding-top: 9px;
}

.param-control {
  display: grid;
  gap: 7px;
}

.range-row {
  display: grid;
  grid-template-columns: 1fr 72px;
  gap: 10px;
  align-items: center;
}

.range-row input {
  min-height: 32px;
  padding: 0;
}

.range-row output {
  display: grid;
  place-items: center;
  min-height: 30px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 11px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
}

.toggle-row input {
  width: 18px;
  min-height: 18px;
}

pre {
  min-height: 280px;
  max-height: 48vh;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.32);
  color: #d9fce9;
  white-space: pre;
  font-size: 11px;
}

.workflow-node {
  position: absolute;
  width: var(--node-width, 280px);
  transform: translate(var(--node-x), var(--node-y));
  user-select: none;
  touch-action: none;
  pointer-events: auto;
  z-index: 2;
}

.workflow-node.is-selected .node-card {
  border-color: var(--green);
  box-shadow:
    0 0 0 calc(1.25px * var(--inverse-scale, 1)) rgba(24, 224, 176, 0.24),
    0 18px 48px rgba(0, 0, 0, 0.46);
}

.workflow-node.is-multi-selected .node-card {
  border-color: var(--blue);
  box-shadow:
    0 0 0 calc(1.25px * var(--inverse-scale, 1)) rgba(105, 167, 255, 0.24),
    0 18px 48px rgba(0, 0, 0, 0.36);
}

.workflow-node.is-running .node-card {
  border-color: rgba(105, 167, 255, 0.7);
  box-shadow:
    0 0 0 1px rgba(105, 167, 255, 0.22),
    0 0 24px rgba(105, 167, 255, 0.16),
    0 18px 48px rgba(0, 0, 0, 0.46);
}

.workflow-node.is-asset-node {
  --node-width: 520px;
  --preview-height: 292px;
}

.workflow-node.is-asset-node.node-video {
  --preview-height: 292px;
}

.workflow-node.is-asset-node.node-audio {
  --node-width: 360px;
  --preview-height: 118px;
}

.node-caption {
  display: none;
  align-items: center;
  gap: 6px;
  margin: 0 0 7px 4px;
  color: #d5d9dd;
  font-size: 12px;
}

.workflow-node:not(.is-asset-node) .node-caption {
  display: none;
}

.workflow-node.is-asset-node .node-caption {
  display: none;
}

.workflow-node.is-asset-node .node-kind {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-icon {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
  color: #101315;
  font-size: 10px;
  font-weight: 900;
}

.node-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 86px),
    rgba(25, 27, 29, 0.96);
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.38);
}

.workflow-node.node-image.has-media .node-card:has(.image-multi-preview) {
  overflow: visible;
}

.workflow-node.is-asset-node .node-card {
  background: rgba(25, 27, 29, 0.68);
}

.node-card-head {
  position: absolute;
  left: 0;
  top: -34px;
  z-index: 7;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 26px;
  pointer-events: none;
}

.node-card-head > div {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.node-type-label {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 24px;
  padding: 0 7px;
  border: 1px solid var(--color-border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: 6px;
  background: rgba(13, 16, 18, 0.82);
  color: var(--color-text-muted, #9ca3a8);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  pointer-events: auto;
  backdrop-filter: blur(10px);
}

.node-title-label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  min-height: 24px;
  overflow: hidden;
  padding: 0 9px;
  border: 1px solid var(--color-border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: 6px;
  background: rgba(13, 16, 18, 0.82);
  color: var(--color-text-secondary, #dfe4e7);
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: auto;
  backdrop-filter: blur(10px);
}

.node-status-badge {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--color-border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: 999px;
  background: rgba(13, 16, 18, 0.82);
  color: var(--color-text-muted, var(--muted));
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  pointer-events: auto;
  backdrop-filter: blur(10px);
}

.node-status-badge[data-status="ready"] {
  background: rgba(28, 217, 185, 0.16);
  color: #a9f7e5;
}

.node-status-badge[data-status="running"] {
  background: rgba(255, 207, 138, 0.16);
  color: #ffcf8a;
}

.node-status-badge[data-status="error"] {
  background: rgba(255, 92, 122, 0.16);
  color: #ffadbd;
}

.node-status-badge[data-status="linked"] {
  background: rgba(105, 167, 255, 0.16);
  color: #b8d4ff;
}

.node-quick-actions {
  position: absolute;
  z-index: 10;
  right: 8px;
  top: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.workflow-node:hover .node-quick-actions,
.workflow-node.is-selected .node-quick-actions {
  opacity: 1;
  transform: translateY(0);
}

.node-quick-actions button,
.preview-download {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.66);
  color: #dfe4e7;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.node-quick-actions button:hover,
.preview-download:hover {
  background: rgba(28, 217, 185, 0.24);
  color: #c9fff0;
  border-color: rgba(24, 224, 176, 0.5);
}

.workflow-node.is-asset-node .node-body,
.workflow-node.is-asset-node .node-run,
.workflow-node.is-asset-node [class~="port-in"] {
  display: none;
}


.workflow-node.is-asset-node [class~="port-out"] {
  right: calc(-17px * var(--inverse-scale, 1));
}

.asset-toolbar {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: -92px;
  display: none;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: min(1120px, calc(100vw - 140px));
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(31, 31, 32, 0.96);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.46);
  transform: translateX(-50%);
  pointer-events: auto;
}

.workflow-node.is-selected.is-asset-node .asset-toolbar {
  display: flex;
}

.asset-tool {
  min-height: 34px;
  padding: 0 8px;
  border-radius: 8px;
  color: #dfe4e7;
  white-space: nowrap;
  font-weight: 800;
}

.asset-tool:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--green);
}

.asset-toolbar-divider {
  width: 1px;
  height: 26px;
  margin: 0 4px;
  background: rgba(255, 255, 255, 0.16);
}

.node-run {
  display: none;
}

.node-preview {
  position: relative;
  min-height: var(--preview-height, 170px);
  overflow: hidden;
  background: #101416;
}

.workflow-node.is-empty .node-preview,
.workflow-node.is-media-missing .node-preview,
.workflow-node.node-audio.has-media .node-preview {
  background: #171b21;
}

.workflow-node.is-empty .node-card,
.workflow-node.is-media-missing .node-card {
  background: rgba(23, 27, 33, 0.98);
}

.workflow-node.is-media-missing .node-preview img {
  min-height: var(--preview-height, 170px);
  background: #171b21;
}

.workflow-node.node-audio.has-media .node-preview {
  display: grid;
  place-items: center;
  background: transparent;
}

.node-preview.is-panorama-preview {
  min-height: 0;
  aspect-ratio: 2 / 1;
  background: #0a0b0d;
  overflow: hidden;
}

.node-preview img,
.node-preview video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
  background: transparent;
}

/* 图片/视频节点：预览区域按媒体比例自适应 */
.workflow-node.node-image.has-media .node-preview,
.workflow-node.node-video.has-media .node-preview {
  min-height: auto;
  overflow: hidden;
  background: transparent;
  line-height: 0;
}

.workflow-node.node-image.has-media .node-preview:has(.image-multi-preview) {
  overflow: visible;
  background: transparent;
  aspect-ratio: var(--image-preview-ratio, auto);
}

.workflow-node.node-image.has-media:not(.is-media-missing) .node-preview img {
  max-height: none;
  height: 100%;
  object-fit: cover;
}

.image-multi-preview {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: var(--image-preview-ratio, auto);
  overflow: visible;
  background: transparent;
}

.image-stack-cards {
  position: absolute;
  inset: 0;
  perspective: 900px;
  pointer-events: none;
}

.image-stack-card {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #0f1417;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
  transform-origin: 50% 78%;
}

.image-stack-card.is-card-1 {
  z-index: 4;
  transform: rotate(0deg);
}

.image-stack-card.is-card-2 {
  z-index: 3;
  transform: translate(10px, 8px) rotate(1deg);
}

.image-stack-card.is-card-3 {
  z-index: 2;
  transform: translate(16px, 14px) rotate(-1.1deg);
}

.image-stack-card.is-card-4 {
  z-index: 1;
  transform: translate(22px, 20px) rotate(1.4deg);
}

.image-multi-preview figure {
  margin: 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #0f1417;
}

.workflow-node.node-image.has-media:not(.is-media-missing) .node-preview .image-multi-preview img,
.image-multi-preview img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  border-radius: inherit;
  background: transparent;
  border: 0;
}

.image-gallery-open {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 12;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(12, 16, 18, 0.78);
  color: #eef4f4;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
}

.image-gallery-open:hover {
  background: rgba(24, 31, 34, 0.9);
  border-color: rgba(45, 212, 191, 0.46);
}

.image-gallery-open strong {
  font-size: 13px;
}

.workflow-node.node-video.has-media:not(.is-media-missing) .node-preview video {
  max-height: none;
  height: 100%;
  object-fit: cover;
}

/* ── 预览区域四角缩放手柄 ── */

.preview-resize-handle {
  position: absolute;
  z-index: 10;
  width: 22px;
  height: 22px;
  cursor: nwse-resize;
  pointer-events: none;
  opacity: 0;
}

.node-preview:hover .preview-resize-handle {
  pointer-events: auto;
  opacity: 0;
}

.preview-resize-handle::before {
  content: none;
}

.preview-resize-handle::after {
  content: none;
}

.preview-resize-handle:hover::before,
.preview-resize-handle:active::before {
  content: none;
}

/* 左上角 */
.preview-resize-handle[data-handle="tl"] {
  top: 0;
  left: 0;
  cursor: nwse-resize;
}

/* 右上角 */
.preview-resize-handle[data-handle="tr"] {
  top: 0;
  right: 0;
  cursor: nesw-resize;
}

/* 左下角 */
.preview-resize-handle[data-handle="bl"] {
  bottom: 0;
  left: 0;
  cursor: nesw-resize;
}

/* 右下角 */
.preview-resize-handle[data-handle="br"] {
  bottom: 0;
  right: 0;
  cursor: nwse-resize;
}

.node-preview audio {
  width: min(260px, calc(100% - 44px));
  height: 36px;
  margin: 0;
  accent-color: var(--green);
  color-scheme: dark;
  filter: drop-shadow(0 0 10px rgba(24, 224, 176, 0.1));
}

.preview-download {
  position: absolute;
  z-index: 10;
  right: 128px;
  top: 8px;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease,
    background 0.18s,
    border-color 0.18s,
    color 0.18s;
  pointer-events: auto;
}

.node-preview.is-panorama-preview .preview-download {
  top: 8px;
  right: 156px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 14px;
}

.workflow-node:hover .preview-download,
.workflow-node.is-selected .preview-download,
.node-preview:hover .preview-download {
  opacity: 1;
  transform: translateY(0);
}

.empty-preview,
.video-result-preview,
.generating-preview {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: var(--preview-height, 170px);
  color: var(--muted);
  text-align: center;
}

.video-result-preview {
  background: #171b21;
}

.empty-preview span,
.video-result-preview span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 22px;
}

.empty-preview strong,
.video-result-preview strong {
  color: #dfe4e7;
}

.empty-preview em,
.video-result-preview em,
.generating-preview em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.generating-preview {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(115deg, rgba(23, 27, 33, 0.96), rgba(18, 45, 42, 0.86) 46%, rgba(15, 24, 31, 0.96)),
    #111820;
  color: #b8d4ff;
}

.generating-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, transparent 0 26%, rgba(105, 167, 255, 0.18) 43%, rgba(24, 224, 176, 0.16) 50%, transparent 68%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 26px);
  background-size: 220% 100%, 100% 100%;
  animation: generating-sheen 1.8s ease-in-out infinite;
}

.generating-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 1px solid rgba(105, 167, 255, 0.24);
  box-shadow: inset 0 0 28px rgba(105, 167, 255, 0.14);
  pointer-events: none;
}

.generating-preview strong {
  color: #e7f1ff;
}

.generating-orb {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(105, 167, 255, 0.34);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(24, 224, 176, 0.95) 0 3px, transparent 4px),
    conic-gradient(from 0deg, transparent, rgba(105, 167, 255, 0.1), rgba(24, 224, 176, 0.95), transparent 76%);
  box-shadow:
    0 0 18px rgba(105, 167, 255, 0.28),
    inset 0 0 18px rgba(24, 224, 176, 0.1);
  animation: spin 1.2s linear infinite, generating-pulse 1.6s ease-in-out infinite;
}

.generating-flow {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--blue), var(--green), transparent);
  background-size: 180% 100%;
  animation: generating-bar 1.15s linear infinite;
}

.video-result-preview.is-error strong {
  color: #ffb4a9;
}

.video-result-preview.is-error span {
  color: #ff7c6b;
}

.node-body {
  display: grid;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(18, 20, 21, 0.82);
}

.node-body:empty {
  display: none;
}

.node-body h3 {
  margin: 0;
  font-size: 15px;
}

.node-body p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.node-meta,
.node-ref-row span {
  color: var(--faint);
  font-size: 11px;
}

.node-ref-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.node-ref-row span {
  padding: 4px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}

[class~="port"] {
  position: absolute;
  z-index: 8;
  top: var(--port-y, 50%);
  display: grid;
  place-items: center;
  width: calc(var(--node-port-hit) * var(--inverse-scale, 1));
  height: calc(var(--node-port-hit) * var(--inverse-scale, 1));
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-secondary, #e9eef1);
  font-size: 0;
  font-weight: 400;
  line-height: 1;
  transform: translateY(-50%);
  text-align: center;
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, color 0.12s ease;
}

[class~="port"]::before {
  content: "+";
  display: grid;
  place-items: center;
  width: calc(var(--node-port-size) * var(--inverse-scale, 1));
  height: calc(var(--node-port-size) * var(--inverse-scale, 1));
  border: 1px solid rgba(225, 234, 238, 0.8);
  border-radius: 50%;
  background: var(--color-canvas, rgba(8, 10, 12, 0.18));
  box-shadow: 0 0 0 calc(1px * var(--inverse-scale, 1)) rgba(0, 0, 0, 0.32);
  transform: translate(var(--port-magnet-x, 0), calc(var(--port-magnet-y, 0) - 1px));
  transition:
    transform 0.08s ease,
    border-color 0.12s ease,
    background-color 0.12s ease,
    box-shadow 0.12s ease;
}

.workflow-node:hover [class~="port"],
.workflow-node.is-selected [class~="port"],
.workflow-node.is-multi-selected [class~="port"],
.workflow-node:focus-within [class~="port"],
.workflow-node.is-port-magnet-in [class~="port-in"],
.workflow-node.is-port-magnet-out [class~="port-out"],
.workflow-node.is-port-snap-in [class~="port-in"],
.workflow-node.is-port-snap-out [class~="port-out"] {
  opacity: 1;
  pointer-events: auto;
}

.workflow-node.is-port-magnet-in [class~="port-in"],
.workflow-node.is-port-magnet-out [class~="port-out"],
.workflow-node.is-port-snap-in [class~="port-in"],
.workflow-node.is-port-snap-out [class~="port-out"] {
  color: var(--color-accent-selected-text, var(--green));
}

.workflow-node.is-port-magnet-in [class~="port-in"]::before,
.workflow-node.is-port-magnet-out [class~="port-out"]::before,
.workflow-node.is-port-snap-in [class~="port-in"]::before,
.workflow-node.is-port-snap-out [class~="port-out"]::before,
[class~="port"]:hover::before {
  border-color: var(--color-accent-primary, var(--green));
  background: var(--color-accent-soft, rgba(24, 224, 176, 0.18));
  box-shadow:
    0 0 0 calc(4px * var(--inverse-scale, 1)) rgba(34, 214, 173, 0.12),
    0 0 14px rgba(34, 214, 173, 0.22);
}

[class~="port"]:hover {
  color: var(--color-accent-selected-text, var(--green));
}

[class~="port-in"] {
  left: calc(-38px * var(--inverse-scale, 1));
}

[class~="port-out"] {
  right: calc(-38px * var(--inverse-scale, 1));
}

.node-text {
  --node-width: 360px;
  --preview-height: 188px;
}

.node-image {
  --node-width: 320px;
  --preview-height: 220px;
}

.node-video {
  --node-width: 340px;
  --preview-height: 190px;
}

.node-audio {
  --node-width: 310px;
  --preview-height: 154px;
}

.node-grid,
.node-ai {
  --node-width: 300px;
  --preview-height: 160px;
}

.workflow-node.is-asset-node.node-image,
.workflow-node.is-asset-node.node-video {
  --node-width: 520px;
  --preview-height: 292px;
}

.workflow-node.is-asset-node.node-audio {
  --node-width: 360px;
  --preview-height: 150px;
}

.text-preview {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: var(--preview-height);
  min-height: var(--preview-height);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 72px),
    #101416;
  color: #e7ecef;
}

.text-preview-scroll {
  min-height: 0;
  overflow: hidden;
  padding: 14px 14px 8px;
  mask-image: linear-gradient(180deg, #000 0 72%, transparent 100%);
}

.text-preview.is-placeholder .text-preview-scroll {
  display: grid;
  align-content: center;
  mask-image: none;
  color: var(--color-text-muted);
  font-size: 15px;
  font-weight: 800;
}

.text-preview-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(11, 14, 16, 0.92);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 800;
}

.text-preview-footer span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-preview-expand,
.text-preview-dialog-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--color-text-secondary);
  font-size: 15px;
  line-height: 1;
}

.text-preview-expand:hover,
.text-preview-dialog-close:hover {
  border-color: rgba(24, 224, 176, 0.4);
  background: rgba(24, 224, 176, 0.16);
  color: var(--color-accent-selected-text);
}

.markdown-body {
  color: #e5eaed;
  font-size: 13px;
  line-height: 1.58;
  user-select: text;
  word-break: break-word;
}

.markdown-body > *:first-child {
  margin-top: 0;
}

.markdown-body > *:last-child {
  margin-bottom: 0;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote,
.markdown-body pre,
.markdown-table-scroll {
  margin: 0 0 10px;
}

.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 12px 0 7px;
  color: #f5f7f8;
  font-size: 15px;
  line-height: 1.35;
}

.markdown-body h3 {
  font-size: 14px;
}

.markdown-body h4 {
  font-size: 13px;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 20px;
}

.markdown-body li + li {
  margin-top: 4px;
}

.markdown-body blockquote {
  padding: 8px 10px;
  border-left: 3px solid rgba(24, 224, 176, 0.46);
  border-radius: 0 7px 7px 0;
  background: rgba(24, 224, 176, 0.08);
  color: var(--color-text-secondary);
}

.markdown-body code {
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: #d9fce9;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.markdown-body pre {
  overflow: auto;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.28);
}

.markdown-body pre code {
  display: block;
  padding: 0;
  background: transparent;
  white-space: pre;
}

.markdown-body a {
  color: #8bd9ff;
  text-decoration: none;
}

.markdown-body a:hover {
  color: #bce9ff;
  text-decoration: underline;
}

.markdown-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
}

.markdown-body table {
  width: 100%;
  min-width: 360px;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.035);
}

.markdown-body th,
.markdown-body td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background: rgba(255, 255, 255, 0.07);
  color: #f5f7f8;
  font-weight: 900;
  white-space: nowrap;
}

.markdown-body tr:last-child td {
  border-bottom: 0;
}

.markdown-body th:last-child,
.markdown-body td:last-child {
  border-right: 0;
}

.text-preview-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 72;
  display: grid;
  place-items: center;
  padding: 34px;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.text-preview-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(940px, calc(100vw - 84px));
  height: min(760px, calc(100vh - 84px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 120px),
    rgba(17, 21, 23, 0.98);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.58);
}

.text-preview-dialog-head,
.text-preview-dialog-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.text-preview-dialog-head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.text-preview-dialog-head small,
.text-preview-dialog-head span {
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 800;
}

.text-preview-dialog-head strong {
  overflow: hidden;
  color: #f5f7f8;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-preview-dialog-body {
  min-height: 0;
  overflow: auto;
  padding: 18px 20px;
  font-size: 14px;
  line-height: 1.68;
}

.text-preview-dialog-foot {
  justify-content: flex-end;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 0;
  background: rgba(10, 13, 15, 0.62);
}

.image-gallery-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 74;
  display: grid;
  place-items: center;
  padding: 54px 88px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.image-gallery-dialog {
  position: relative;
  width: min(1540px, calc(100vw - 176px));
  max-height: calc(100vh - 108px);
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.image-gallery-close {
  position: absolute;
  top: -42px;
  right: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(12, 16, 18, 0.76);
  color: #eef4f4;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.image-gallery-close:hover {
  background: rgba(24, 31, 34, 0.9);
  border-color: rgba(45, 212, 191, 0.46);
}

.image-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: calc(100vh - 108px);
  overflow: auto;
}

.image-gallery-grid[data-image-gallery-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.image-gallery-grid[data-image-gallery-count="3"] .image-gallery-item:first-child {
  grid-row: span 2;
}

.image-gallery-item {
  position: relative;
  display: grid;
  min-width: 0;
  aspect-ratio: var(--gallery-image-ratio, 16 / 9);
  min-height: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: transparent;
}

.image-gallery-item.is-main {
  border-color: rgba(45, 212, 191, 0.68);
  box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.26);
}

.image-gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  background: transparent;
}

.image-gallery-item figcaption {
  position: absolute;
  top: 10px;
  right: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.image-gallery-item figcaption > span,
.image-gallery-item figcaption button {
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(12, 16, 18, 0.78);
  color: #eef4f4;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
}

.image-gallery-item figcaption > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  padding: 0 8px;
}

.image-gallery-item figcaption > div {
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.image-gallery-item figcaption button {
  padding: 0 10px;
  cursor: pointer;
}

.image-gallery-item figcaption button:hover {
  background: rgba(24, 31, 34, 0.9);
  border-color: rgba(45, 212, 191, 0.46);
}

@media (max-width: 860px) {
  .image-gallery-dialog-backdrop {
    padding: 18px;
  }

  .image-gallery-dialog {
    width: calc(100vw - 36px);
    max-height: calc(100vh - 36px);
  }

  .image-gallery-grid {
    grid-template-columns: 1fr;
  }

  .image-gallery-grid[data-image-gallery-count="3"] .image-gallery-item:first-child {
    grid-row: auto;
  }
}

.image-original-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 76;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.image-original-dialog {
  position: relative;
  display: grid;
  place-items: center;
  width: min(1500px, calc(100vw - 48px));
  height: min(940px, calc(100vh - 48px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: #050708;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.66);
}

.image-original-dialog img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-original-close,
.image-original-actions button,
.image-original-actions a {
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(12, 16, 18, 0.78);
  color: #eef4f4;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
}

.image-original-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 34px;
  cursor: pointer;
}

.image-original-actions {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  gap: 8px;
}

.image-original-actions button,
.image-original-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  cursor: pointer;
}

.image-original-close:hover,
.image-original-actions button:hover,
.image-original-actions a:hover {
  background: rgba(24, 31, 34, 0.9);
  border-color: rgba(45, 212, 191, 0.46);
}

.wave-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: var(--preview-height);
  background: transparent;
}

.wave-preview span {
  width: 5px;
  height: calc(16px + var(--i) * 6px);
  border-radius: 999px;
  background: linear-gradient(180deg, #69a7ff, #18e0b0);
  box-shadow: 0 0 10px rgba(24, 224, 176, 0.16);
}

.grid-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  min-height: var(--preview-height);
  padding: 14px;
  background: #111416;
}

.grid-preview span {
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(105, 167, 255, 0.22), rgba(24, 224, 176, 0.14)),
    rgba(255, 255, 255, 0.08);
}

.ai-preview {
  display: grid;
  align-content: center;
  gap: 10px;
  min-height: var(--preview-height);
  padding: 18px;
  background:
    radial-gradient(circle at 84% 22%, rgba(24, 224, 176, 0.28), transparent 48%),
    #101214;
}

.ai-preview span {
  width: fit-content;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #dfe9e5;
  font-size: 12px;
}

.bottom-bar {
  z-index: 58;
  left: auto;
  right: 16px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  width: 240px;
  min-height: 36px;
  padding: 5px 7px;
  border-radius: 18px;
  justify-content: flex-end;
}

#shortcutsBtn {
  margin-right: auto;
}

#shortcutsBtn[aria-expanded="true"],
#shortcutsBtn:hover {
  background: rgba(24, 224, 176, 0.18);
  color: #c9fff0;
}

#minimapBtn {
  order: 20;
}

#gridBtn,
#helpBtn {
  display: none;
}

.round-button {
  min-width: 26px;
  min-height: 26px;
  border-radius: 50%;
  font-size: 11px;
}

#zoomSlider {
  width: 64px;
  min-height: 20px;
  padding: 0;
  accent-color: var(--green);
}

#zoomReadout {
  min-width: 34px;
  color: var(--muted);
  font-size: 10px;
}

/* ── 快捷键总览 ── */

.shortcuts-panel {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  place-items: center;
  padding: 42px;
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(8px);
}

.shortcuts-panel.hidden {
  display: none;
}

.shortcuts-card {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(280px, 1fr));
  gap: 44px;
  width: min(1680px, calc(100vw - 72px));
  max-height: min(720px, calc(100vh - 72px));
  padding: 38px 56px 42px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(140deg, rgba(34, 37, 39, 0.98), rgba(15, 32, 29, 0.94)),
    var(--panel);
  box-shadow: 0 28px 96px rgba(0, 0, 0, 0.58);
  overflow: auto;
}

.shortcut-column {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  padding-right: 42px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.shortcut-column:last-child {
  border-right: 0;
  padding-right: 0;
}

.shortcut-column h3 {
  margin: 0 0 14px;
  color: var(--green);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0;
}

.shortcut-row {
  display: grid;
  grid-template-columns: minmax(112px, 1fr) max-content;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  align-items: center;
  column-gap: 12px;
  min-height: 34px;
  color: rgba(246, 247, 248, 0.64);
  font-size: 13px;
  font-weight: 700;
}

.shortcut-row > span:not(.mouse-glyph) {
  flex: 1 1 auto;
  min-width: 0;
  color: rgba(246, 247, 248, 0.52);
  white-space: nowrap;
}

.shortcut-row em {
  color: rgba(246, 247, 248, 0.45);
  font-style: normal;
  white-space: nowrap;
}

.shortcut-row kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
  color: #f4f7f8;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 6px 18px rgba(0, 0, 0, 0.16);
  font: inherit;
  font-weight: 900;
  white-space: nowrap;
}

.mouse-glyph {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 22px;
  height: 31px;
  min-width: 22px;
  border: 2px solid rgba(246, 247, 248, 0.8);
  border-radius: 12px;
  color: var(--green);
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.28));
}

.mouse-glyph::before {
  content: "";
  position: absolute;
  background: var(--green);
  box-shadow: 0 0 12px rgba(24, 224, 176, 0.42);
}

.mouse-glyph--left::before {
  top: 5px;
  left: 3px;
  width: 6px;
  height: 10px;
  border-radius: 6px 4px 5px 6px;
}

.mouse-glyph--wheel::before {
  top: 4px;
  left: 50%;
  width: 3px;
  height: 9px;
  border-radius: 4px;
  transform: translateX(-50%);
}

.mouse-glyph::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.mouse-glyph--drag::after {
  display: none;
}

.mouse-glyph--link::after {
  left: -19px;
  top: 7px;
  width: 18px;
  height: 12px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  border-radius: 8px 0 0;
}

.mouse-glyph--link {
  margin-left: 18px;
}

.shortcuts-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: transparent;
  color: rgba(246, 247, 248, 0.68);
  font-size: 30px;
  line-height: 1;
}

.shortcuts-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.canvas-toast {
  position: fixed;
  left: 50%;
  bottom: 60px;
  z-index: 99999;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(27, 29, 31, 0.94);
  color: #dfe4e7;
  font-size: 13px;
  font-weight: 800;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  transform: translateX(-50%) translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  backdrop-filter: blur(14px);
}

.canvas-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.canvas-toast.is-error {
  border-color: rgba(255, 209, 102, 0.34);
  background:
    linear-gradient(135deg, rgba(255, 209, 102, 0.18), rgba(212, 84, 136, 0.08)),
    rgba(32, 28, 22, 0.96);
  color: #ffdca0;
}

/* ── 小地图 ── */

.minimap {
  position: fixed;
  right: 16px;
  bottom: 56px;
  z-index: 61;
  width: 240px;
  height: 188px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 12, 13, 0.92);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  cursor: crosshair;
}

.minimap-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 28px;
  padding: 0 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 11px;
  cursor: default;
}

.minimap-head strong {
  color: #dfe4e7;
  font-size: 12px;
}

.minimap canvas {
  display: block;
  width: 100%;
  height: 160px;
}

.composer {
  z-index: 64;
  left: 50%;
  top: 50%;
  display: block;
  width: min(760px, calc(100vw - 420px));
  max-height: calc(100vh - 120px);
  overflow: visible;
  padding: 0;
  border-radius: 12px;
  transform: scale(var(--composer-scale, 1));
  transform-origin: top center;
}

.composer-content {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 120px);
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 12px;
  background: var(--chrome-overlay);
  box-shadow: var(--shadow-raised);
}

.editor-preview {
  display: none;
}

.editor-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.editor-main {
  flex: 1;
  display: grid;
  gap: 10px;
  padding: 10px 12px 12px;
  overflow-y: auto;
  min-height: 0;
}

.editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.editor-assets {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  min-width: 0;
  overflow-x: auto;
}

.prompt-shell {
  position: relative;
  min-height: 0;
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(4, 7, 8, 0.48);
}

.composer textarea,
.prompt-editor {
  display: block;
  width: 100%;
  min-height: 72px;
  max-height: 128px;
  border: 0;
  background: transparent;
  padding: 9px 10px;
  color: #d8dde0;
  font-size: 13px;
  line-height: 1.45;
  resize: vertical;
  overflow-y: auto;
}

.prompt-editor {
  outline: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.prompt-editor:empty::before {
  content: attr(data-placeholder);
  color: rgba(216, 221, 224, 0.42);
}

.prompt-mention {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  max-width: 160px;
  margin: 0 3px 2px;
  padding: 2px 7px 2px 3px;
  border: 1px solid rgba(24, 224, 176, 0.38);
  border-radius: 7px;
  background: rgba(24, 224, 176, 0.14);
  color: #d6fff5;
  vertical-align: middle;
  user-select: none;
}

.prompt-mention img,
.prompt-mention > span {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 5px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.1);
}

.prompt-mention > span {
  display: grid;
  place-items: center;
  font-size: 12px;
}

.reference-media-icon {
  display: grid;
  place-items: center;
  color: #d6fff5;
  font-weight: 900;
}

.reference-media-audio {
  background: linear-gradient(135deg, rgba(78, 184, 255, 0.22), rgba(24, 224, 176, 0.18));
}

.reference-media-video {
  background: linear-gradient(135deg, rgba(24, 224, 176, 0.2), rgba(255, 255, 255, 0.08));
}

.prompt-mention strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-controls {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
  padding-top: 2px;
}

.composer-run-cluster {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-height: 34px;
  min-width: 0;
  padding: 0 0 0 8px;
  border-left: 1px solid var(--color-border-subtle);
}

.composer-credit-state {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  max-width: 86px;
  min-width: 0;
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: right;
  white-space: nowrap;
  overflow: visible;
  text-overflow: ellipsis;
}

.editor-mode-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
}

.editor-mode {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
  font-weight: 700;
}

.editor-mode.is-active {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.1);
}

.editor-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  max-width: 220px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

.editor-control:hover,
.editor-control.is-active {
  border-color: rgba(24, 224, 176, 0.32);
  background: rgba(24, 224, 176, 0.1);
}

.editor-control strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-control em {
  color: var(--muted);
  font-style: normal;
  font-size: 11px;
}

.editor-model-control {
  max-width: 250px;
}

.editor-image-settings-control {
  max-width: 300px;
}

.editor-video-settings-control {
  max-width: 360px;
}

.editor-function-control {
  max-width: 140px;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.065);
  color: var(--text);
}

.editor-function-control.has-function {
  border-color: rgba(24, 224, 176, 0.42);
  background: rgba(24, 224, 176, 0.09);
  color: #d6fff5;
}

.editor-settings-icon {
  width: 14px;
  height: 10px;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-radius: 3px;
  opacity: 0.82;
}

.icon-control {
  width: 34px;
  min-width: 34px;
  justify-content: center;
  padding: 0;
  color: var(--green);
}

.editor-add-ref,
.reference-chip {
  display: grid;
  place-items: center;
  min-width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.reference-chip {
  position: relative;
  overflow: hidden;
  width: 52px;
  padding: 0;
}

.reference-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reference-chip .reference-media-icon {
  width: 100%;
  height: 100%;
}

.reference-chip span {
  font-size: 20px;
}

.reference-chip strong {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 4px;
  padding: 2px 4px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.54);
  color: var(--text);
  font-size: 11px;
}

[class~="price-button"] {
  margin-left: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 56px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--color-accent-border);
  border-radius: var(--radius-pill);
  background: var(--color-accent-primary);
  color: #03110e;
  box-shadow: 0 4px 10px rgba(34, 214, 173, 0.12);
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

[class~="price-button"] strong {
  display: inline;
  width: auto;
  height: auto;
  color: inherit;
  line-height: 1;
  white-space: nowrap;
  writing-mode: horizontal-tb;
}

[class~="price-button"]:hover {
  background: var(--color-accent-primary-hover);
  color: #03110e;
  transform: translateY(-1px);
}

[class~="price-button"].is-insufficient {
  border-color: var(--color-danger-border);
  background: var(--color-danger-soft);
  color: var(--color-danger-text);
  box-shadow: none;
}

[class~="price-button"].is-cancel {
  border-color: var(--color-danger-border);
  background: var(--color-danger-soft);
  color: var(--color-danger-text);
  box-shadow: none;
}

@keyframes cancel-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.editor-popover {
  position: absolute;
  z-index: 76;
  box-sizing: border-box;
  display: grid;
  gap: 10px;
  min-width: min(160px, calc(100vw - 28px));
  width: max-content;
  max-width: calc(100vw - 28px);
  height: max-content;
  max-height: min(520px, calc(100vh - 28px));
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--chrome-border);
  border-radius: 12px;
  background: var(--chrome-overlay);
  box-shadow: var(--shadow-overlay);
  overscroll-behavior: contain;
}

.editor-popover > * {
  min-width: 0;
}

.editor-popover.is-spatial-popover {
  gap: 0;
  overflow: auto;
  padding: 12px;
}

.editor-popover.is-above {
  transform-origin: bottom center;
}

.editor-popover.is-below {
  transform-origin: top center;
}

.editor-popover.is-left {
  transform-origin: right center;
}

.editor-popover.is-right {
  transform-origin: left center;
}

.mention-popover {
  position: static;
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  margin: 0 8px 8px;
  padding: 8px;
  border: 1px solid rgba(24, 224, 176, 0.24);
  border-radius: 8px;
  background: rgba(18, 22, 22, 0.98);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.36);
}

.mention-choice {
  display: grid;
  grid-template-columns: 34px minmax(58px, auto) 1fr;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  text-align: left;
}

.mention-choice:hover {
  border-color: rgba(24, 224, 176, 0.42);
  background: rgba(24, 224, 176, 0.12);
}

.mention-choice img,
.mention-choice > span {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
}

.mention-choice > span {
  display: grid;
  place-items: center;
}

.mention-choice strong,
.mention-choice em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-choice strong {
  color: #d6fff5;
  font-size: 12px;
}

.mention-choice em,
.mention-empty {
  color: var(--muted);
  font-size: 12px;
}

.editor-popover-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.editor-popover-title strong {
  color: var(--text);
  font-size: 13px;
}

.editor-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
}

.editor-choice-model {
  grid-template-columns: 1fr;
  align-content: start;
  overflow: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.38) rgba(255, 255, 255, 0.08);
}

.editor-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  text-align: left;
}

.editor-choice-model .editor-choice {
  min-height: 48px;
  padding: 7px 10px;
}

.editor-choice-model .editor-choice span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
}

.editor-choice-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.editor-choice strong,
.editor-choice small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-choice small {
  color: var(--muted);
  font-size: 10px;
}

.editor-choice strong {
  font-size: 12px;
  font-weight: 750;
}

.editor-choice.is-active {
  border-color: rgba(24, 224, 176, 0.46);
  background: rgba(24, 224, 176, 0.12);
  color: #c9fff0;
}

.editor-popover[data-panel="copies"] {
  min-width: 72px;
  padding: 6px;
  border-radius: 10px;
}

.editor-popover[data-panel="imageSettings"] {
  gap: 6px;
  padding: 10px;
  border-radius: 10px;
}

.editor-popover[data-panel="copies"] .editor-popover-title {
  display: none;
}

.editor-choice-copies {
  grid-template-columns: 1fr;
  gap: 3px;
}

.editor-choice-copies .editor-choice {
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-color: transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-muted);
}

.editor-choice-copies .editor-choice:hover,
.editor-choice-copies .editor-choice.is-active {
  border-color: transparent;
  background: var(--color-control-hover);
  color: var(--color-text-primary);
}

.editor-choice-copies .editor-choice.is-active {
  background: var(--color-accent-selected-bg);
  color: var(--color-accent-selected-text);
}

.editor-choice-copies .editor-choice-text {
  display: block;
}

.editor-choice-copies .editor-choice strong {
  font-size: 12px;
  font-weight: 750;
}

.function-menu {
  display: grid;
  gap: 10px;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.function-menu-main {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  overflow: auto;
}

.function-menu-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.function-menu-footer span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.function-menu-confirm {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 14px;
  border: 1px solid rgba(24, 224, 176, 0.42);
  border-radius: 8px;
  background: rgba(24, 224, 176, 0.16);
  color: #d6fff5;
  font-size: 12px;
  font-weight: 900;
}

.function-menu-confirm:hover {
  border-color: rgba(24, 224, 176, 0.62);
  background: rgba(24, 224, 176, 0.24);
}

.function-menu-spatial {
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 0;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.38) rgba(255, 255, 255, 0.08);
}

.function-menu-spatial::-webkit-scrollbar {
  width: 5px;
}

.function-menu-spatial::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.function-menu-spatial::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
}

.function-menu-group {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.function-menu-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(112px, 1fr));
  gap: 7px;
  min-width: 0;
}

.function-menu-choice {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 42px;
  padding: 6px 10px 6px 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  text-align: left;
}

.function-menu-choice:hover,
.function-menu-choice.is-active {
  border-color: rgba(24, 224, 176, 0.42);
  background: rgba(24, 224, 176, 0.12);
}

.function-menu-choice.is-active::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(24, 224, 176, 0.14);
}

.function-menu-icon,
.function-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.function-menu-icon {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  color: #d6fff5;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.function-menu-label {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.function-chip {
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(24, 224, 176, 0.38);
  border-radius: 999px;
  background: rgba(24, 224, 176, 0.12);
  color: #d6fff5;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.spatial-camera-controller {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: auto;
  min-height: 0;
  min-width: 0;
  overflow: visible;
}

.spatial-function-tabs {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
  min-width: 0;
  overflow: visible;
}

.spatial-function-tab {
  flex: 1 1 0;
  min-width: 0;
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spatial-function-tab:hover,
.spatial-function-tab.is-active {
  border-color: rgba(24, 224, 176, 0.42);
  background: rgba(24, 224, 176, 0.12);
  color: #d6fff5;
}

.spatial-controller-head,
.spatial-controller-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.spatial-controller-head > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.spatial-controller-head strong {
  overflow: hidden;
  color: #f2f7f8;
  font-size: 14px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spatial-controller-head span,
.spatial-controller-foot span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spatial-controller-head em {
  flex: 0 0 auto;
  padding: 3px 8px;
  border: 1px solid rgba(24, 224, 176, 0.26);
  border-radius: 999px;
  background: rgba(24, 224, 176, 0.1);
  color: #c9fff0;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.spatial-submode-row,
.spatial-inline-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.spatial-submode-row {
  flex: 0 0 auto;
  flex-wrap: wrap;
  overflow: visible;
}

.spatial-menu-strip {
  max-height: none;
  overflow: visible;
  padding-bottom: 1px;
}

.spatial-category-row {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(118px, 164px));
  gap: 6px;
  justify-content: start;
}

.spatial-category-choice,
.spatial-preset-choice {
  display: grid;
  gap: 2px;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  text-align: left;
}

.spatial-category-choice {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-height: 30px;
  padding: 5px 10px;
}

.spatial-category-choice span,
.spatial-preset-choice strong {
  overflow: hidden;
  color: #f1f6f6;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spatial-category-choice span {
  font-size: 12px;
}

.spatial-category-choice small,
.spatial-preset-choice small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spatial-category-choice small {
  font-size: 10px;
}

.spatial-category-choice:hover,
.spatial-category-choice.is-active,
.spatial-preset-choice:hover,
.spatial-preset-choice.is-active {
  border-color: rgba(24, 224, 176, 0.42);
  background: rgba(24, 224, 176, 0.12);
}

.spatial-preset-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(94px, 1fr));
  flex: 0 0 auto;
  gap: 8px;
  min-height: 54px;
  overflow: visible;
  padding: 0;
}

.spatial-preset-choice {
  min-width: 0;
  min-height: 50px;
  padding: 8px 10px;
}

.spatial-controller-body {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(440px, 1.2fr);
  align-items: stretch;
  gap: 22px;
  flex: 0 0 auto;
  height: 360px;
  min-height: 0;
}

.spatial-camera-sphere {
  position: relative;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.spatial-camera-globe {
  display: grid;
  place-items: center;
  min-height: 360px;
  isolation: isolate;
}

.spatial-globe-canvas {
  position: absolute;
  inset: 12px;
  z-index: 2;
}

.spatial-globe-webgl {
  display: block;
  width: 100%;
  height: 100%;
}

.spatial-globe-thumbnail {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  width: 86px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(18, 24, 25, 0.94);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  pointer-events: none;
}

.spatial-globe-camera-axis {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  width: var(--camera-axis-length, 0px);
  height: 1px;
  transform: translateY(-50%) rotate(var(--camera-axis-angle, 0deg));
  transform-origin: left center;
  background: rgba(24, 224, 176, 0.82);
  box-shadow: 0 0 8px rgba(24, 224, 176, 0.2);
  pointer-events: none;
}

.spatial-globe-center-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 8;
  width: 13px;
  height: 13px;
  transform: translate(-50%, -50%);
  border: 3px solid rgba(24, 224, 176, 0.96);
  border-radius: 50%;
  background: rgba(7, 12, 12, 0.74);
  box-shadow:
    0 0 0 2px rgba(7, 12, 12, 0.36),
    0 0 12px rgba(24, 224, 176, 0.36);
  pointer-events: none;
}

.spatial-globe-thumbnail img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.spatial-globe-thumbnail strong {
  color: rgba(237, 246, 244, 0.92);
  font-size: 14px;
  font-weight: 900;
}

.spatial-globe-thumbnail small {
  color: rgba(237, 246, 244, 0.58);
  font-size: 11px;
  font-weight: 700;
}

.spatial-globe-camera-badge {
  position: absolute;
  left: var(--camera-x, 78%);
  top: var(--camera-y, 50%);
  z-index: 7;
  width: 42px;
  height: 30px;
  transform: translate(-50%, -50%) scale(var(--camera-scale, 1));
  border: 1px solid rgba(237, 246, 244, 0.2);
  border-radius: 7px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 45%),
    #101518;
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.34),
    0 0 0 2px rgba(24, 224, 176, 0.08);
  opacity: var(--camera-opacity, 1);
  pointer-events: none;
}

.spatial-globe-camera-badge::before {
  content: "";
  position: absolute;
  inset: 5px 4px 5px auto;
  width: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.spatial-globe-camera-handle {
  position: absolute;
  left: 12px;
  top: -7px;
  width: 18px;
  height: 8px;
  border: 2px solid rgba(237, 246, 244, 0.24);
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  background: #0d1113;
}

.spatial-globe-camera-screen {
  position: absolute;
  left: 10px;
  top: 8px;
  width: 17px;
  height: 12px;
  border: 1px solid rgba(135, 255, 240, 0.55);
  border-radius: 3px;
  background:
    linear-gradient(135deg, rgba(135, 255, 240, 0.16), rgba(35, 89, 106, 0.85)),
    #16313a;
}

.spatial-globe-camera-lens {
  position: absolute;
  right: -11px;
  top: 8px;
  width: 14px;
  height: 14px;
  border-radius: 4px 8px 8px 4px;
  background: #090d0f;
  border: 1px solid rgba(237, 246, 244, 0.16);
  box-shadow: inset -3px 0 0 rgba(24, 224, 176, 0.18);
}

.spatial-globe-camera-badge.is-right-side .spatial-globe-camera-lens {
  left: -11px;
  right: auto;
  border-radius: 8px 4px 4px 8px;
  box-shadow: inset 3px 0 0 rgba(24, 224, 176, 0.18);
}

.spatial-globe-status {
  position: absolute;
  left: 12px;
  bottom: 10px;
  z-index: 5;
  color: rgba(237, 246, 244, 0.58);
  font-size: 11px;
  font-weight: 800;
  pointer-events: none;
}

.spatial-camera-sphere[data-globe-status="ready"] .spatial-globe-status {
  opacity: 0;
}

.spatial-camera-sphere.is-dragging {
  cursor: grabbing;
  border-color: rgba(24, 224, 176, 0.36);
}

.spatial-globe-fallback {
  position: absolute;
  inset: 12px;
  display: none;
  place-items: center;
  z-index: 1;
}

.spatial-camera-sphere.is-fallback .spatial-globe-fallback {
  display: grid;
}

.spatial-camera-sphere.is-fallback .spatial-globe-canvas {
  display: none;
}

.spatial-globe-fallback-sphere {
  position: relative;
  width: min(78%, 280px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background:
    repeating-radial-gradient(ellipse at center, transparent 0 23px, rgba(255, 255, 255, 0.14) 24px 25px),
    repeating-linear-gradient(90deg, transparent 0 38px, rgba(255, 255, 255, 0.12) 39px 40px),
    radial-gradient(circle, rgba(24, 224, 176, 0.08), rgba(0, 0, 0, 0.08) 68%);
}

.spatial-axis {
  position: absolute;
  color: rgba(255, 255, 255, 0.55);
  font-size: 26px;
  font-weight: 900;
  z-index: 4;
}

.spatial-axis-top { top: 28px; left: 50%; transform: translateX(-50%); }
.spatial-axis-bottom { bottom: 24px; left: 50%; transform: translateX(-50%); }
.spatial-axis-left { left: 28px; top: 50%; transform: translateY(-50%); }
.spatial-axis-right { right: 28px; top: 50%; transform: translateY(-50%); }

.spatial-camera-marker {
  position: absolute;
  left: var(--camera-x, 50%);
  top: var(--camera-y, 50%);
  width: 46px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(58, 72, 76, 0.98), rgba(12, 16, 18, 0.98));
  box-shadow:
    0 0 0 4px rgba(24, 224, 176, 0.18),
    0 0 22px rgba(24, 224, 176, 0.46);
  opacity: var(--camera-opacity, 1);
  transform: translate(-50%, -50%) scale(var(--camera-scale, 1)) rotate(calc(var(--orbit-deg, 0deg) * 0.04));
  z-index: 5;
  pointer-events: none;
}

.spatial-camera-marker::before {
  content: "";
  position: absolute;
  left: 8px;
  top: -7px;
  width: 24px;
  height: 9px;
  border-radius: 5px 5px 2px 2px;
  background: rgba(18, 22, 24, 0.98);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.spatial-camera-marker::after {
  content: "";
  position: absolute;
  right: -9px;
  top: 10px;
  width: 10px;
  height: 16px;
  border-radius: 0 4px 4px 0;
  background: rgba(33, 44, 48, 0.96);
  box-shadow: inset -1px 0 rgba(255, 255, 255, 0.18);
}

.spatial-camera-marker i {
  position: absolute;
  left: 12px;
  top: 10px;
  width: 18px;
  height: 13px;
  border: 2px solid rgba(24, 224, 176, 0.78);
  border-radius: 3px;
  background: rgba(5, 8, 9, 0.9);
}

.spatial-camera-ray {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40%;
  height: 2px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.64), rgba(24, 224, 176, 0.18), transparent);
  opacity: 0.66;
  transform: translateY(-50%) rotate(var(--orbit-deg, 0deg));
  transform-origin: left center;
  z-index: 2;
  pointer-events: none;
}

.spatial-camera-sphere.is-dragging .spatial-camera-marker {
  box-shadow:
    0 0 0 6px rgba(24, 224, 176, 0.22),
    0 0 30px rgba(24, 224, 176, 0.58);
}

.spatial-sphere-preview {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  gap: 2px;
  width: 96px;
  aspect-ratio: 1;
  min-height: 0;
  padding: 6px;
  border: 1px solid rgba(24, 224, 176, 0.24);
  border-radius: 10px;
  background: rgba(14, 18, 18, 0.72);
  color: var(--text);
  transform: translate(-50%, -50%);
  overflow: hidden;
  z-index: 1;
}

.spatial-sphere-preview.has-image {
  padding: 0;
  border-color: rgba(255, 255, 255, 0.22);
}

.spatial-sphere-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.spatial-sphere-preview strong {
  font-size: 12px;
  font-weight: 900;
}

.spatial-sphere-preview small {
  max-width: 62px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spatial-control-stack {
  display: grid;
  align-content: center;
  gap: 17px;
  min-width: 0;
}

.spatial-range-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.spatial-range-row span,
.spatial-toggle-row span,
.spatial-option-group strong,
.spatial-virtual-fields span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.spatial-range-row output {
  color: #f2f7f8;
  font-size: 13px;
  font-weight: 900;
  text-align: right;
}

.spatial-range-row input[type="range"] {
  width: 100%;
  accent-color: var(--green);
}

.spatial-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 250px;
}

.spatial-prompt-preview {
  display: grid;
  gap: 8px;
  min-height: 90px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.spatial-prompt-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.spatial-prompt-preview p {
  margin: 0;
  color: #edf6f4;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.42;
}

.spatial-prompt-preview.is-muted p {
  color: var(--muted);
}

@media (max-width: 980px) {
  .spatial-preset-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .spatial-controller-body {
    grid-template-columns: 1fr;
    height: auto;
  }

  .spatial-camera-sphere {
    min-height: 330px;
  }

  .spatial-control-stack {
    align-content: start;
  }
}

@media (max-width: 760px) {
  .spatial-preset-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .spatial-category-row,
  .spatial-virtual-fields {
    grid-template-columns: 1fr;
  }

  .spatial-controller-options {
    grid-template-columns: 1fr;
  }

  .spatial-range-row {
    grid-template-columns: 76px minmax(0, 1fr) 62px;
    gap: 8px;
  }
}

.spatial-toggle {
  position: relative;
  width: 34px;
  height: 20px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.spatial-toggle i {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
}

.spatial-toggle.is-active {
  background: rgba(24, 224, 176, 0.32);
}

.spatial-toggle.is-active i {
  left: 18px;
  background: var(--green);
}

.spatial-controller-options {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.8fr) minmax(0, 1.05fr);
  gap: 8px;
  min-width: 0;
}

.spatial-advanced-options {
  display: grid;
  flex: 0 0 auto;
  min-width: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding-top: 7px;
}

.spatial-advanced-options summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
  color: #f1f6f6;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  list-style: none;
}

.spatial-advanced-options summary::-webkit-details-marker {
  display: none;
}

.spatial-advanced-options summary::after {
  content: "展开";
  flex: 0 0 auto;
  min-width: 38px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.spatial-advanced-options[open] summary::after {
  content: "收起";
}

.spatial-advanced-options summary small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spatial-advanced-options:not([open]) .spatial-controller-options {
  display: none;
}

.spatial-advanced-options[open] .spatial-controller-options {
  margin-top: 7px;
  max-height: none;
  overflow: visible;
}

.spatial-option-group {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}

.spatial-pill {
  flex: 0 1 auto;
  min-height: 28px;
  max-width: 180px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spatial-pill:hover,
.spatial-pill.is-active {
  border-color: rgba(24, 224, 176, 0.42);
  background: rgba(24, 224, 176, 0.14);
  color: #d6fff5;
}

.spatial-virtual-fields {
  display: none;
  flex: 0 0 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  min-width: 0;
}

.spatial-virtual-fields.is-open {
  display: grid;
}

.spatial-virtual-fields label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.spatial-virtual-fields input {
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
}

.spatial-reset {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.spatial-reset:hover {
  border-color: rgba(24, 224, 176, 0.34);
  color: #d6fff5;
}

.spatial-confirm {
  margin-left: auto;
}

.video-settings-menu {
  display: grid;
  gap: 12px;
  min-width: min(460px, calc(100vw - 40px));
}

.image-settings-menu {
  display: grid;
  gap: 7px;
  min-width: min(296px, calc(100vw - 40px));
}

.video-setting-group {
  display: grid;
  gap: 8px;
}

.image-setting-group {
  display: grid;
  gap: 5px;
}

.video-setting-options {
  display: grid;
  grid-template-columns: repeat(6, minmax(62px, 1fr));
  gap: 6px;
  padding: 4px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.image-setting-options {
  display: grid;
  gap: 5px;
}

.image-setting-quality,
.image-setting-resolution {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.image-setting-size {
  grid-template-columns: repeat(5, minmax(44px, 1fr));
}

.video-setting-audio,
.video-setting-search {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
}

.video-setting-ratio {
  grid-template-columns: repeat(6, minmax(64px, 1fr));
}

.video-setting-choice {
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.image-setting-choice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 26px;
  padding: 0 6px;
  border: 1px solid var(--color-border-subtle);
  border-radius: 7px;
  background: var(--color-control-subtle);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 750;
}

.image-setting-group-size .image-setting-choice {
  min-height: 39px;
  flex-direction: column;
}

.image-setting-ratio-icon {
  width: 15px;
  height: 9px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  opacity: 0.82;
}

.image-setting-ratio-icon[data-ratio="1:1"] {
  width: 11px;
  height: 11px;
}

.image-setting-ratio-icon[data-ratio="9:16"],
.image-setting-ratio-icon[data-ratio="3:4"],
.image-setting-ratio-icon[data-ratio="2:3"],
.image-setting-ratio-icon[data-ratio="4:5"],
.image-setting-ratio-icon[data-ratio="9:21"] {
  width: 8px;
  height: 15px;
}

.image-setting-ratio-icon[data-ratio="16:9"],
.image-setting-ratio-icon[data-ratio="4:3"],
.image-setting-ratio-icon[data-ratio="3:2"],
.image-setting-ratio-icon[data-ratio="5:4"],
.image-setting-ratio-icon[data-ratio="21:9"] {
  width: 18px;
  height: 9px;
}

.image-setting-ratio-icon[data-ratio="自适应"] {
  width: 11px;
  height: 11px;
}

.video-setting-choice.is-active {
  background: rgba(255, 255, 255, 0.13);
  color: var(--text);
}

.image-setting-choice:hover,
.image-setting-choice.is-active {
  border-color: var(--color-accent-border);
  background: var(--color-accent-selected-bg);
  color: var(--color-accent-selected-text);
}

.editor-status {
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.editor-status.is-ok {
  border-color: rgba(24, 224, 176, 0.34);
  color: #9df6df;
}

.editor-status.is-error {
  border-color: rgba(255, 92, 122, 0.42);
  color: #ffadbd;
}

.modal-overlay {
  z-index: 99999;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(10px);
}

.modal-box {
  width: min(600px, calc(100vw - 56px));
  max-height: min(760px, calc(100vh - 56px));
  overflow: auto;
  padding: 22px;
  border-radius: 8px;
}

.modal-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.modal-title small,
.mc-section-title {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.modal-title strong {
  display: block;
  margin-top: 2px;
  font-size: 20px;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 18px;
}

.mc-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.mc-section-title {
  margin-bottom: 4px;
}

.mc-item {
  position: relative;
  display: block;
  padding: 11px;
  padding-right: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  text-align: left;
}

.mc-item:hover,
.mc-item.is-active {
  border-color: rgba(24, 224, 176, 0.42);
  background: rgba(24, 224, 176, 0.08);
}

.mc-item strong,
.mc-item span,
.mc-item small {
  display: block;
}

.mc-item span,
.mc-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

.mc-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 13px;
  font-family: inherit;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  box-sizing: border-box;
}

.mc-delete:hover {
  background: rgba(255, 92, 122, 0.3);
  color: #ffadbd;
}

.mc-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mc-form .mc-section-title,
.mc-form .mc-actions,
.mc-form .api-status,
.mc-form [class*="hidden"] {
  grid-column: 1 / -1;
}

.mc-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.mc-form input,
.mc-form select {
  width: 100%;
}

.mc-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.drop-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 9;
  padding: 16px 22px;
  border: 1px solid rgba(24, 224, 176, 0.52);
  border-radius: 8px;
  background: rgba(18, 28, 26, 0.92);
  box-shadow: var(--shadow);
  color: var(--green);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.prompt-expand-btn {
  position: absolute;
  z-index: 4;
  right: 6px;
  top: 6px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 15px;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.prompt-shell:hover .prompt-expand-btn {
  opacity: 1;
}

.prompt-expand-btn:hover {
  background: rgba(24, 224, 176, 0.2);
  color: var(--green);
}

.prompt-expand-backdrop {
  position: fixed;
  inset: 0;
  z-index: 63;
  background: rgba(0, 0, 0, 0.55);
}

.composer.is-prompt-expanded {
  z-index: 65;
  left: 50% !important;
  top: 50% !important;
  right: auto !important;
  bottom: auto !important;
  width: min(960px, calc(100vw - 120px)) !important;
  max-height: calc(100vh - 100px) !important;
  transform: translate(-50%, -50%) !important;
  transform-origin: center center !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.composer.is-prompt-expanded .composer-content {
  max-height: calc(100vh - 100px);
  min-height: calc(100vh - 100px);
}

.composer.is-prompt-expanded .editor-main {
  grid-template-rows: auto auto 1fr auto;
  max-height: calc(100vh - 100px);
}

.composer.is-prompt-expanded .prompt-shell {
  flex: 1;
  min-height: 0;
  overflow: visible;
}

.composer.is-prompt-expanded .prompt-editor {
  min-height: 320px;
  max-height: none !important;
  height: 100%;
  font-size: 15px;
  line-height: 1.6;
  padding: 14px 16px;
}

.composer.is-prompt-expanded .prompt-expand-btn {
  opacity: 1;
  width: 32px;
  height: 32px;
  font-size: 17px;
}

.composer.is-prompt-expanded .prompt-expand-btn::after {
  content: "收起";
  position: absolute;
  right: 36px;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}

.composer.is-prompt-expanded .editor-mode-row {
  flex-wrap: wrap;
}

.composer.is-prompt-expanded .composer-controls {
  flex-wrap: wrap;
}

.hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .inspector {
    width: 320px;
  }

  .composer {
    width: min(540px, calc(100vw - 116px));
    max-height: calc(100vh - 140px);
  }

  .composer-content {
    max-height: calc(100vh - 140px);
  }
}

@media (max-width: 820px) {
  .topbar {
    left: 16px;
    right: 16px;
  }

  .project-title input {
    width: min(220px, 32vw);
    font-size: 18px;
  }

  #saveProjectBtn,
  #shareBtn {
    display: none;
  }

  .inspector-tab {
    min-width: 56px;
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }

  .canvas-command-bar {
    left: 16px;
    right: 16px;
    top: 58px;
    justify-content: flex-start;
    overflow-x: auto;
    transform: none;
  }

  .canvas-path-bar {
    left: 16px;
    right: auto;
    top: 104px;
    max-width: calc(100vw - 32px);
  }

  .canvas-path-bar:not(.is-collapsed) {
    right: 16px;
    width: auto;
  }

  .side-panel {
    top: 150px;
    bottom: 218px;
    left: 86px;
    right: 16px;
    width: auto;
    max-width: none;
    max-height: none;
  }

  .inspector {
    top: 64px;
    bottom: auto;
    left: auto;
    right: 16px;
    width: min(360px, calc(100vw - 102px));
    max-width: calc(100vw - 102px);
    max-height: calc(100vh - 88px);
  }

  .composer {
    right: auto;
    bottom: auto;
    width: calc(100vw - 116px);
    max-height: calc(100vh - 180px);
  }

  .composer-content {
    max-height: calc(100vh - 180px);
  }

  .editor-preview {
    max-height: 32vh;
  }

  .editor-preview img {
    max-height: 32vh;
  }

  .bottom-bar {
    right: 16px;
  }
}

@media (max-width: 1180px) {
  .composer.is-prompt-expanded {
    width: min(820px, calc(100vw - 80px)) !important;
  }
}

@media (max-width: 820px) {
  .composer.is-prompt-expanded {
    width: calc(100vw - 40px) !important;
    max-height: calc(100vh - 60px) !important;
  }

  .composer.is-prompt-expanded .composer-content {
    max-height: calc(100vh - 60px);
    min-height: calc(100vh - 60px);
  }

  .composer.is-prompt-expanded .prompt-editor {
    min-height: 220px;
    font-size: 14px;
  }
}

/* ── 登录/注册页面 ── */

.login-page {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background:
    radial-gradient(circle at 30% 18%, rgba(28, 217, 185, 0.08), transparent 22rem),
    radial-gradient(circle at 82% 70%, rgba(105, 167, 255, 0.055), transparent 26rem),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    var(--bg, #050607);
  background-size: 100% 100%, 100% 100%, 48px 48px, 48px 48px;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  width: min(1120px, 100%);
  min-height: 640px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(12, 15, 16, 0.72);
  box-shadow: 0 30px 120px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(26px);
}

.login-showcase,
.login-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(22, 26, 28, 0.72);
}

.login-showcase {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 20px;
  padding: 28px;
}

.login-showcase::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.7;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.86), transparent 86%);
  pointer-events: none;
}

.login-showcase::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 42%;
  background: linear-gradient(180deg, transparent, rgba(28, 217, 185, 0.045));
  pointer-events: none;
}

.login-brand,
.login-copy,
.login-canvas-preview,
.login-feature-row {
  position: relative;
  z-index: 1;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand .project-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.login-brand h1,
.login-copy h2,
.login-logo h2 {
  margin: 0;
  color: var(--text, #f6f7f8);
}

.login-brand h1 {
  font-size: 21px;
  font-weight: 900;
}

.login-brand p,
.login-copy p,
.login-logo p,
.login-copy small {
  color: var(--muted, #9aa2a9);
}

.login-brand p {
  margin: 2px 0 0;
  font-size: 12px;
  letter-spacing: 0;
}

.login-copy {
  max-width: 560px;
}

.login-copy small {
  display: block;
  margin-bottom: 9px;
  color: #93f5dc;
  font-size: 12px;
}

.login-copy h2 {
  max-width: 560px;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.16;
  font-weight: 900;
}

.login-copy p {
  max-width: 500px;
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.7;
}

.login-canvas-preview {
  position: relative;
  min-height: 330px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    radial-gradient(circle at 58% 44%, rgba(28, 217, 185, 0.12), transparent 18rem),
    rgba(2, 6, 7, 0.48);
  background-size: 34px 34px, 34px 34px, 100% 100%, 100% 100%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.preview-topbar {
  position: absolute;
  left: 16px;
  top: 14px;
  display: flex;
  gap: 6px;
}

.preview-topbar span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.preview-toolbar {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(223, 228, 231, 0.62);
  font-size: 11px;
}

.preview-node {
  position: absolute;
  display: grid;
  gap: 6px;
  width: 158px;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(18, 22, 24, 0.96);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
}

.preview-node small {
  color: #9df6df;
  font-size: 11px;
}

.preview-node strong {
  color: var(--text);
  font-size: 14px;
}

.preview-node em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.preview-node-text {
  left: 9%;
  top: 35%;
}

.preview-node-image {
  left: 40%;
  top: 23%;
  width: 176px;
}

.preview-node-video {
  right: 8%;
  bottom: 16%;
}

.preview-thumb {
  height: 74px;
  border-radius: 7px;
  background:
    linear-gradient(135deg, rgba(28, 217, 185, 0.34), rgba(105, 167, 255, 0.14)),
    rgba(255, 255, 255, 0.06);
}

.preview-link {
  position: absolute;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(28, 217, 185, 0.2), rgba(28, 217, 185, 0.72));
  transform-origin: left center;
}

.preview-link-a {
  left: 30%;
  top: 43%;
  width: 110px;
  transform: rotate(-18deg);
}

.preview-link-b {
  left: 61%;
  top: 50%;
  width: 130px;
  transform: rotate(28deg);
}

.login-feature-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.login-feature-row span {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #c5cbd0;
  font-size: 12px;
}

.login-card {
  align-self: center;
  padding: 30px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025)),
    rgba(16, 20, 21, 0.86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.login-logo {
  margin-bottom: 24px;
}

.login-logo .project-mark {
  display: inline-block;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 40%, #050607 40% 54%, transparent 54%),
    linear-gradient(0deg, transparent 42%, #050607 42% 56%, transparent 56%),
    var(--green, #18e0b0);
  transform: rotate(2deg);
  margin-bottom: 12px;
}

.login-logo h2 {
  font-size: 22px;
  font-weight: 900;
}

.login-logo p {
  margin: 6px 0 0;
  font-size: 14px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 22px;
  padding: 5px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.26);
}

.auth-tab-btn {
  min-height: 38px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #9aa2a9);
  font-size: 14px;
  font-weight: 700;
}

.auth-tab-btn.is-active {
  background: rgba(255, 255, 255, 0.11);
  color: var(--text, #f6f7f8);
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: #c5cbd0;
  font-size: 13px;
}

.login-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(7, 11, 12, 0.52);
  color: var(--text, #f6f7f8);
  font-size: 14px;
  outline: 0;
  box-sizing: border-box;
}

.login-form input:focus {
  border-color: var(--green, #18e0b0);
  box-shadow: 0 0 0 3px rgba(28, 217, 185, 0.09);
}

.login-submit-btn {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #24dfb7, #14cfa6);
  color: #03110e;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  margin-top: 4px;
}

.login-submit-btn:hover {
  filter: brightness(1.04);
}

.login-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-error {
  min-height: 20px;
  color: #ffadbd;
  font-size: 13px;
  text-align: center;
}

.login-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
}

.login-note span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.login-note p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

/* ── 项目仪表盘 ── */

.dashboard-page {
  position: fixed;
  inset: 0;
  z-index: 9998;
  overflow-y: auto;
  background:
    radial-gradient(circle at 94% 90%, rgba(24, 224, 176, 0.1), transparent 18rem),
    radial-gradient(circle at 48% 40%, rgba(105, 167, 255, 0.04), transparent 28rem),
    var(--bg, #050607);
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dashboard-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dashboard-logo .project-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 40%, #050607 40% 54%, transparent 54%),
    linear-gradient(0deg, transparent 42%, #050607 42% 56%, transparent 56%),
    var(--green, #18e0b0);
  transform: rotate(2deg);
}

.dashboard-logo h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--text, #f6f7f8);
}

.dashboard-user {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted, #9aa2a9);
  font-size: 14px;
}

.dashboard-top-tools {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  --dashboard-tool-size: 36px;
  --dashboard-tool-gap: 10px;
  --dashboard-tool-shadow: 0 14px 38px rgba(0, 0, 0, 0.42);
  --dashboard-tool-hover-shadow: 0 18px 48px rgba(0, 0, 0, 0.48);
  --dashboard-tool-hover-shift: -1px;
}

.dashboard-tool-button {
  display: grid;
  place-items: center;
  width: var(--dashboard-tool-size);
  height: var(--dashboard-tool-size);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  cursor: pointer;
  box-shadow: var(--dashboard-tool-shadow);
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.dashboard-tool-button:hover,
.dashboard-tool-button.is-active {
  border-color: rgba(24, 224, 176, 0.46);
  background: rgba(24, 224, 176, 0.1);
  color: #c9fff0;
  transform: translateY(var(--dashboard-tool-hover-shift));
  box-shadow: var(--dashboard-tool-hover-shadow);
}

.dashboard-tool-button span {
  width: 17px;
  height: 17px;
  background: currentColor;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 17px 17px;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: 17px 17px;
}

#dashboardTaskToggle span {
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 7h10M7 12h10M7 17h6' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3Ccircle cx='4' cy='7' r='1.4' fill='black'/%3E%3Ccircle cx='4' cy='12' r='1.4' fill='black'/%3E%3Ccircle cx='4' cy='17' r='1.4' fill='black'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 7h10M7 12h10M7 17h6' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3Ccircle cx='4' cy='7' r='1.4' fill='black'/%3E%3Ccircle cx='4' cy='12' r='1.4' fill='black'/%3E%3Ccircle cx='4' cy='17' r='1.4' fill='black'/%3E%3C/svg%3E");
}

#dashboardActivityToggle span {
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 6v6l4 2M19 12a7 7 0 1 1-2.1-5M19 4v5h-5' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 6v6l4 2M19 12a7 7 0 1 1-2.1-5M19 4v5h-5' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.dashboard-tool-popover {
  position: absolute;
  top: calc(100% + var(--dashboard-tool-gap));
  right: auto;
  left: auto;
  z-index: 10020;
  width: clamp(220px, 34vw, 420px);
  max-width: min(420px, calc(100vw - 24px));
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(140deg, rgba(22, 25, 28, 0.98), rgba(10, 29, 25, 0.96)),
    rgba(22, 25, 28, 0.98);
  box-shadow: var(--dashboard-tool-shadow);
  backdrop-filter: blur(22px);
}

.dashboard-tool-popover-wide {
  width: clamp(260px, 42vw, 520px);
  max-width: min(520px, calc(100vw - 24px));
}

.dashboard-tool-popover.is-above {
  transform-origin: bottom right;
}

.dashboard-tool-popover.is-below {
  transform-origin: top right;
}

.dashboard-tool-popover.is-left {
  transform-origin: center right;
}

.dashboard-tool-popover.is-right {
  transform-origin: center left;
}

.logout-btn {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #9aa2a9);
  font-size: 13px;
  cursor: pointer;
}

.dashboard-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 900;
  color: #fff;
}

.dashboard-credit-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(24, 224, 176, 0.28);
  border-radius: 8px;
  background: rgba(24, 224, 176, 0.08);
  color: #c9fff0;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.dashboard-recharge-btn {
  cursor: pointer;
}

.dashboard-recharge-btn:hover {
  border-color: rgba(24, 224, 176, 0.48);
  background: rgba(24, 224, 176, 0.14);
}

.billing-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.64);
}

.billing-modal.hidden {
  display: none;
}

.billing-modal-card {
  width: min(560px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: #101415;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.billing-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.billing-modal-head small,
.billing-order-note {
  color: var(--muted);
}

.billing-modal-head strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 18px;
}

.billing-modal-head button {
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
}

.billing-plan-grid {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.billing-plan-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.billing-plan-card:hover {
  border-color: rgba(24, 224, 176, 0.4);
  background: rgba(24, 224, 176, 0.07);
}

.billing-plan-card:disabled {
  opacity: 0.62;
  cursor: wait;
}

.billing-plan-card strong,
.billing-plan-card span {
  color: var(--text);
}

.billing-plan-card em {
  color: #c9fff0;
  font-style: normal;
  font-weight: 800;
}

.billing-plan-card small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.billing-contact-recharge {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  align-items: center;
  gap: 24px;
  margin: 0 18px 14px;
  padding: 20px 24px;
  border: 1px solid rgba(24, 224, 176, 0.22);
  border-radius: 8px;
  background: rgba(24, 224, 176, 0.055);
}

.billing-contact-copy {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 6px;
}

.billing-contact-copy strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.billing-contact-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.billing-contact-qr-frame {
  justify-self: center;
  align-self: center;
  width: 150px;
  height: 150px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #fff;
}

.billing-contact-qr {
  display: block;
  width: 190px;
  height: 190px;
  max-width: none;
  object-fit: cover;
  transform: translate(-20px, -8px);
}

.billing-order-list {
  display: grid;
  gap: 8px;
  padding: 0 18px 12px;
}

.billing-order-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.billing-order-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 12px;
}

.billing-order-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.billing-order-row em {
  color: #c9fff0;
  font-style: normal;
  font-weight: 800;
}

.billing-order-note {
  min-height: 22px;
  padding: 0 18px 18px;
  font-size: 13px;
}

.logout-btn:hover {
  border-color: rgba(255, 92, 122, 0.4);
  color: #ffadbd;
}

.dash-api-popover {
  position: fixed;
  top: 60px;
  right: 32px;
  z-index: 100;
  width: 320px;
}

.dash-api-popover-inner {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(22, 25, 28, 0.97);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(22px);
}

.dash-api-popover-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #f6f7f8);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dash-api-popover-inner label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--muted);
}

.dash-api-popover-inner input {
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text, #f6f7f8);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.dash-api-popover-inner input:focus {
  border-color: rgba(24, 224, 176, 0.5);
}

.dash-api-popover-inner input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.dash-api-popover-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.dash-api-popover-status {
  font-size: 11px;
  color: var(--muted);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.dashboard-main {
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px 32px 40px;
}

.dashboard-main h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  color: var(--text, #f6f7f8);
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}

.dashboard-hero small,
.dashboard-section-head small,
.dashboard-side-title small,
.project-create-head small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-hero p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(96px, 1fr));
  gap: 10px;
}

.dashboard-metrics div,
.dashboard-side-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.dashboard-metrics div {
  display: grid;
  gap: 3px;
  min-height: 66px;
  padding: 12px 14px;
}

.dashboard-metrics strong {
  color: var(--text);
  font-size: 20px;
}

.dashboard-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.workflow-template-section {
  margin-bottom: 26px;
}

.workflow-template-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.workflow-template-card {
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 3px 11px;
  min-height: 82px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(105, 167, 255, 0.08), rgba(24, 224, 176, 0.04)),
    rgba(255, 255, 255, 0.035);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.workflow-template-card:hover {
  border-color: rgba(105, 167, 255, 0.34);
  background: rgba(105, 167, 255, 0.08);
}

.workflow-template-card span {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(105, 167, 255, 0.14);
  color: #c8ddff;
  font-weight: 900;
}

.workflow-template-card strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

.workflow-template-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.dashboard-workspace {
  display: block;
}

.dashboard-projects {
  width: 100%;
}

.dashboard-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.dashboard-section-head h3,
.dashboard-side-title strong,
.project-create-head strong {
  display: block;
  margin: 2px 0 0;
  color: var(--text);
  font-size: 18px;
}

.dashboard-controls {
  display: none;
  align-items: center;
  gap: 8px;
}

.dashboard-controls.is-visible {
  display: flex;
}

.dashboard-all-projects-link {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.dashboard-all-projects-link:hover {
  color: #dfe4e7;
}

.dashboard-controls input,
.dashboard-controls select {
  width: auto;
  min-height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.dashboard-controls input {
  width: 220px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.project-grid.is-all-projects {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  row-gap: 28px;
}

.project-preview-card {
  position: relative;
  display: grid;
  grid-template-rows: minmax(116px, auto) auto;
  gap: 0;
  width: 100%;
  min-height: 214px;
  padding: 8px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: inherit;
  text-align: left;
  transition: transform 0.15s;
}

.project-preview-card:hover {
  transform: translateY(-1px);
}

.project-preview-thumb {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  width: 100%;
  min-height: 116px;
  max-height: 168px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(105, 167, 255, 0.12), rgba(24, 224, 176, 0.1)),
    rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.project-preview-thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent);
}

.project-preview-thumb.has-image::before {
  display: none;
}

.project-preview-thumb img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  color: transparent;
  font-size: 0;
  object-fit: cover;
  background: transparent;
  text-indent: -9999px;
}

.project-preview-thumb > span {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 30px;
  font-weight: 800;
}

.project-preview-thumb em {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 3;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(3, 14, 14, 0.72);
  color: #bffff1;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.project-preview-add {
  display: grid;
  align-content: start;
  color: var(--text);
}

.project-preview-add .project-preview-thumb {
  align-content: center;
  justify-items: center;
  gap: 12px;
  border-style: solid;
  background: var(--color-surface-raised);
}

.project-preview-add .project-preview-thumb strong {
  display: block;
  margin-top: 0;
  color: #dfe4e7;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 800;
}

.project-preview-add .project-preview-thumb span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: #dfe4e7;
  font-size: 26px;
  text-align: center;
}

.project-preview-add .project-preview-info {
  min-height: 66px;
  padding: 10px 2px 0;
}

.project-preview-info strong {
  display: block;
  overflow: hidden;
  color: var(--text, #f6f7f8);
  font-size: 14px;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-preview-info small {
  display: block;
  margin-top: 4px;
  color: var(--muted, #9aa2a9);
  font-size: 12px;
  line-height: 16px;
}

.project-card-status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.project-card-status span {
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  font-size: 11px;
}

.project-preview-actions {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
}

.project-preview-menu {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(10, 12, 13, 0.34);
  color: rgba(229, 236, 238, 0.72);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  opacity: 0.78;
  transition: opacity 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.project-preview-menu-popover {
  position: absolute;
  right: 0;
  top: 24px;
  z-index: 10;
  display: none;
  min-width: 112px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(20, 22, 24, 0.98);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.38);
}

.project-preview-actions:hover .project-preview-menu-popover,
.project-preview-actions:focus-within .project-preview-menu-popover {
  display: grid;
}

.project-preview-menu-popover button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.project-preview-menu-popover button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.project-preview-menu-popover .is-danger {
  color: #ffadbd;
}

.dashboard-loading,
.dashboard-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--muted, #9aa2a9);
  font-size: 14px;
}

.featured-workflow-section {
  margin-top: 34px;
}

.homepage-section-stack {
  display: grid;
  gap: 34px;
}

.homepage-section-stack .featured-workflow-section {
  margin-top: 0;
}

.featured-category-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.featured-category-tabs button {
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: 0 12px;
  font-size: 12px;
  cursor: pointer;
}

.featured-category-tabs button.is-active,
.featured-category-tabs button:hover {
  border-color: rgba(24, 224, 176, 0.45);
  color: var(--text);
}

.featured-workflow-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.featured-workflow-grid.is-rail {
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 1fr);
  grid-template-columns: none;
  overflow-x: auto;
  padding-bottom: 4px;
}

.featured-workflow-card {
  display: grid;
  gap: 10px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.featured-workflow-thumb {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(24, 224, 176, 0.05)),
    rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.featured-workflow-thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent);
}

.featured-workflow-thumb.has-image::before {
  display: none;
}

.featured-workflow-thumb img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  color: transparent;
  font-size: 0;
  object-fit: cover;
  text-indent: -9999px;
}

.featured-workflow-thumb span {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 30px;
  font-weight: 900;
}

.featured-workflow-meta strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.featured-workflow-meta span,
.featured-empty {
  color: var(--muted);
  font-size: 12px;
}

.featured-empty {
  grid-column: 1 / -1;
  padding: 34px 0;
}

.dashboard-side-card {
  padding: 14px;
}

.task-status-list,
.model-status-list,
.recent-assets-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.task-status-list div,
.model-status-list div,
.recent-assets-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.task-status-list strong,
.model-status-list strong {
  color: var(--text);
  font-size: 13px;
  text-align: right;
  word-break: normal;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-status-list span,
.model-status-list span,
.recent-assets-list span,
.recent-assets-list p {
  color: var(--muted);
  font-size: 12px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-status-list .is-ok {
  color: #9df6df;
}

.model-status-list .is-warn {
  color: #ffcf8a;
}

.recent-assets-list button {
  width: 100%;
  border: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.recent-assets-list button:hover {
  background: rgba(28, 217, 185, 0.1);
}

.recent-assets-list button strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.project-create-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(10px);
}

.project-create-card {
  display: grid;
  gap: 16px;
  width: min(620px, calc(100vw - 48px));
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(22, 25, 28, 0.98);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.5);
}

.project-create-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.project-template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.project-template-option {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-rows: auto auto;
  gap: 2px 10px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
}

.project-template-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.project-template-option span {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: #dfe4e7;
  font-weight: 900;
}

.project-template-option strong {
  color: var(--text);
  font-size: 13px;
}

.project-template-option small {
  color: var(--muted);
  font-size: 12px;
}

.project-template-option:has(input:checked) {
  border-color: rgba(28, 217, 185, 0.48);
  background: rgba(28, 217, 185, 0.1);
}

.project-template-option:has(input:checked) span {
  background: rgba(28, 217, 185, 0.18);
  color: #c9fff0;
}

.project-create-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 1360px) {
  .shortcuts-card {
    grid-template-columns: repeat(2, minmax(300px, 1fr));
    gap: 34px 44px;
    width: min(880px, calc(100vw - 64px));
  }

  .shortcut-column:nth-of-type(2n) {
    border-right: 0;
    padding-right: 0;
  }
}

@media (max-width: 1080px) {
  .login-page {
    align-items: flex-start;
    padding: 24px;
  }

  .login-shell {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .login-card {
    align-self: stretch;
  }

  .login-showcase {
    min-height: 520px;
  }

  .dashboard-hero {
    grid-template-columns: 1fr;
  }

  .dashboard-metrics,
  .workflow-template-grid,
  .project-grid,
  .project-grid.is-all-projects,
  .featured-workflow-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 760px) {
  .login-page {
    padding: 16px;
  }

  .login-showcase {
    min-height: auto;
    gap: 18px;
    padding: 22px;
  }

  .login-copy h2 {
    font-size: 28px;
  }

  .login-copy p {
    font-size: 14px;
  }

  .login-canvas-preview {
    min-height: 230px;
  }

  .preview-node {
    width: 138px;
    padding: 10px;
  }

  .preview-node-image {
    width: 150px;
  }

  .preview-node-video {
    right: 5%;
  }

  .preview-link-a,
  .preview-link-b {
    width: 76px;
  }

  .login-card {
    padding: 26px 20px;
  }

  .dashboard-main {
    padding: 22px 18px 32px;
  }

  .dashboard-header {
    padding: 14px 18px;
  }

  .dashboard-logo h1 {
    display: none;
  }

  .dashboard-user {
    gap: 8px;
  }

  .dashboard-top-tools {
    --dashboard-tool-size: 34px;
    --dashboard-tool-gap: 9px;
    --dashboard-tool-hover-shift: -1px;
  }

  .dashboard-tool-button {
    width: var(--dashboard-tool-size);
    height: var(--dashboard-tool-size);
  }

  .dashboard-metrics,
    .workflow-template-grid,
    .project-grid,
    .project-grid.is-all-projects,
    .featured-workflow-grid,
    .project-template-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .featured-category-tabs {
    justify-content: flex-start;
  }

  .dashboard-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-controls input {
    grid-column: 1 / -1;
    width: 100%;
  }

  .shortcuts-panel {
    padding: 18px;
  }

  .shortcuts-card {
    grid-template-columns: 1fr;
    gap: 20px;
    width: calc(100vw - 36px);
    max-height: calc(100vh - 36px);
    padding: 24px 20px;
  }

  .shortcut-column {
    border-right: 0;
    padding-right: 0;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .shortcut-column:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .shortcut-row {
    flex-wrap: wrap;
  }
}

/* ── 头像下拉菜单 ── */

.avatar-dropdown {
  position: fixed;
  z-index: 99999;
  min-width: 200px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(27, 29, 31, 0.96);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(22px);
}

.avatar-dropdown-header {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 6px;
}

.avatar-dropdown-header strong {
  display: block;
  font-size: 14px;
  color: var(--text, #f6f7f8);
}

.avatar-dropdown-header small {
  display: block;
  color: var(--muted, #9aa2a9);
  font-size: 12px;
  margin-top: 2px;
}

.avatar-dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text, #f6f7f8);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.avatar-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.avatar-dropdown-item:last-child {
  color: #ffadbd;
}

.avatar-dropdown-item:last-child:hover {
  background: rgba(255, 92, 122, 0.15);
}

/* ── 多选框选 ── */

.selection-box {
  position: absolute;
  z-index: 5;
  border: 1.5px solid rgba(24, 224, 176, 0.7);
  background: rgba(24, 224, 176, 0.08);
  border-radius: 2px;
  pointer-events: none;
}

/* ── 节点组 ── */

.node-group {
  position: absolute;
  z-index: 1;
  border: 1.5px dashed rgba(105, 167, 255, 0.45);
  border-radius: 10px;
  background: rgba(105, 167, 255, 0.04);
  pointer-events: none;
  cursor: default;
  transition: border-color 0.15s, background 0.15s;
}

.node-group:hover {
  border-color: rgba(105, 167, 255, 0.65);
  background: rgba(105, 167, 255, 0.07);
}

.node-group:active {
  cursor: grabbing;
}

.node-group-label {
  position: absolute;
  bottom: 100%;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 2px;
  border-radius: 6px 6px 0 0;
  background: rgba(10, 12, 14, 0.96);
  border: 1px solid rgba(105, 167, 255, 0.4);
  border-bottom: none;
  pointer-events: auto;
  cursor: default;
  user-select: none;
  white-space: nowrap;
}

.node-group-drag {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  min-height: 18px;
  border-radius: 4px;
  color: #9ac4ff;
  cursor: grab;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: -1px;
}

.node-group-drag:hover {
  background: rgba(105, 167, 255, 0.16);
  color: #c8ddff;
}

.node-group-drag:active {
  cursor: grabbing;
}

.node-group-label span:not(.node-group-drag) {
  color: #9ac4ff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.node-group-label input {
  width: auto;
  min-width: 40px;
  max-width: 220px;
  min-height: 22px;
  padding: 0 4px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #c8ddff;
  font-size: 12px;
  font-weight: 700;
  outline: none;
}

.node-group-label input:focus {
  border-color: rgba(105, 167, 255, 0.5);
  background: rgba(0, 0, 0, 0.3);
}

.node-group-delete {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: transparent;
  color: rgba(154, 196, 255, 0.5);
  font-size: 12px;
  pointer-events: auto;
  cursor: pointer;
}

.node-group-delete:hover {
  background: rgba(255, 92, 122, 0.25);
  color: #ffadbd;
}

/* ── 右键菜单 ── */

.context-menu {
  position: fixed;
  z-index: 99999;
  min-width: 160px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(27, 29, 31, 0.97);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.context-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.context-menu-item.is-danger {
  color: #ffadbd;
}

.context-menu-item.is-danger:hover {
  background: rgba(255, 92, 122, 0.15);
}

.context-menu-item.is-disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.context-menu-item.is-disabled:hover {
  background: transparent;
}

.context-menu-separator {
  height: 1px;
  margin: 4px 12px;
  background: rgba(255, 255, 255, 0.08);
}

.context-menu-shortcut {
  margin-left: auto;
  font-size: 11px;
  opacity: 0.45;
  letter-spacing: 0.02em;
}

/* ── 全景图查看器 ── */

.panorama-overlay {
  position: fixed;
  inset: 0;
  z-index: 99998;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.panorama-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.panorama-container {
  position: relative;
  width: min(calc(100vw - 40px), calc((100vh - 40px) * 2));
  aspect-ratio: 2 / 1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.6);
}

.panorama-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
}

.panorama-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

.panorama-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panorama-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: var(--panorama-btn-bg);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.panorama-btn:hover {
  background: var(--panorama-btn-hover);
  border-color: rgba(255, 255, 255, 0.3);
}

.panorama-btn.is-active {
  background: var(--panorama-btn-active);
  border-color: var(--blue);
  color: var(--blue);
}

.panorama-close-btn {
  margin-left: 8px;
  background: rgba(255, 59, 48, 0.2);
  border-color: rgba(255, 59, 48, 0.4);
  color: #ffadbd;
}

.panorama-close-btn:hover {
  background: rgba(255, 59, 48, 0.35);
  border-color: rgba(255, 59, 48, 0.6);
}

.panorama-viewer {
  width: 100%;
  height: 100%;
  cursor: grab;
}

.panorama-viewer:active {
  cursor: grabbing;
}

.panorama-viewer canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.panorama-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
  opacity: 0.7;
}

/* ── 全景图按钮样式 ── */

.panorama-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.panorama-action-btn:hover {
  border-color: rgba(105, 167, 255, 0.4);
  background: rgba(105, 167, 255, 0.12);
  color: var(--blue);
}

.panorama-action-btn .icon {
  font-size: 16px;
}

/* ── 全景图生成中状态 ── */

.panorama-generating {
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 24px;
  color: var(--muted);
  font-size: 14px;
}

.panorama-generating::before {
  content: "";
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes edge-flow {
  to {
    stroke-dashoffset: -296;
  }
}

@keyframes generating-sheen {
  0% {
    background-position: 130% 0, 0 0;
  }
  100% {
    background-position: -130% 0, 0 0;
  }
}

@keyframes generating-pulse {
  0%, 100% {
    opacity: 0.82;
    transform: scale(0.96);
  }
  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}

@keyframes generating-bar {
  from {
    background-position: 180% 0;
  }
  to {
    background-position: -180% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .edge-path.is-running,
  .edge-flow-path,
  .generating-preview::before,
  .generating-orb,
  .generating-flow,
  .panorama-generating::before {
    animation: none;
  }
}

/* ── 内嵌全景查看器 ── */

.panorama-inline-viewer {
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: 2 / 1;
  background: #0a0b0d;
  overflow: hidden;
}

.panorama-inline-fallback {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  background: #0a0b0d;
  pointer-events: none;
}

.panorama-inline-fallback[hidden],
.panorama-inline-viewer.is-ready .panorama-inline-fallback {
  display: none;
}

.panorama-inline-canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.panorama-inline-canvas:active {
  cursor: grabbing;
}

.panorama-inline-canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.panorama-inline-message {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 16px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  pointer-events: none;
}

.panorama-inline-message[hidden] {
  display: none;
}

.panorama-inline-message.is-error {
  color: #ffadbd;
}

.panorama-inline-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  z-index: 30;
  pointer-events: auto;
}

.workflow-node:has(.node-preview.is-panorama-preview) .node-quick-actions {
  top: 44px;
  right: 8px;
}

.panorama-inline-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.5);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: all 0.15s ease;
}

.panorama-inline-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.panorama-inline-btn.is-active {
  background: rgba(105, 167, 255, 0.3);
  border-color: var(--blue);
  color: var(--blue);
}

/* ── 响应式调整 ── */

@media (max-width: 820px) {
  .panorama-container {
    width: min(calc(100vw - 16px), calc((100vh - 16px) * 2));
    border-radius: 8px;
  }

  .panorama-header {
    padding: 12px 16px;
  }

  .panorama-header h3 {
    font-size: 14px;
  }

  .panorama-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
}

@media (max-width: 640px) {
  .topbar {
    left: 12px;
    right: 12px;
    gap: 8px;
  }

  .project-title {
    min-width: 0;
    flex: 1 1 auto;
  }

  .project-title input {
    width: 100%;
    min-width: 0;
    font-size: 15px;
  }

  .top-actions {
    flex: 0 0 auto;
    max-width: 156px;
    justify-content: flex-end;
    overflow: hidden;
  }

  #saveProjectBtn,
  #shareBtn,
  .top-actions .inspector-tab {
    display: none;
  }

  .top-actions .balance {
    max-width: 96px;
    min-height: 30px;
    padding: 0 8px;
  }

  .balance span {
    max-width: 58px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .balance strong {
    display: none;
  }

  .top-actions .avatar {
    width: 26px;
    min-width: 26px;
    height: 26px;
  }

  .canvas-command-bar {
    top: 58px;
    max-width: calc(100vw - 24px);
    overflow-x: auto;
  }

  .canvas-tool {
    justify-content: center;
    min-width: 34px;
    width: 34px;
    padding: 0;
  }

  .canvas-tool span {
    display: none;
  }
}

/* Theme tokens and base canvas surfaces */

.app-shell {
  background:
    radial-gradient(circle at 50% 36%, rgba(121, 173, 255, 0.035), transparent 30rem),
    var(--color-canvas);
}

.canvas-stage {
  background-color: var(--color-canvas);
}

.canvas-stage::before {
  opacity: 0.32;
}

.project-title input {
  color: var(--color-text-primary);
}

.project-title input:focus-visible {
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 3px rgba(34, 214, 173, 0.18);
}

.back-dashboard-btn,
.square-button,
.round-button,
.pill-button,
.ghost-button,
.thumb-add,
.canvas-tool,
.billing-modal-head button,
.project-preview-menu-popover button {
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    opacity 0.15s ease;
}

button:disabled,
.billing-plan-card:disabled,
.login-submit-btn:disabled {
  cursor: not-allowed;
  opacity: 0.54;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(34, 214, 173, 0.2);
}

.canvas-mode-pill,
.canvas-command-bar,
.context-panel,
.side-panel,
.inspector,
.composer,
.bottom-bar,
.modal-box,
.minimap,
.avatar-dropdown,
.context-menu {
  border-color: var(--color-border-subtle);
  background: var(--color-surface-default);
  box-shadow: var(--shadow-raised);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.canvas-mode-pill {
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-low);
}

.canvas-command-bar {
  padding: 4px;
  border-radius: var(--radius-lg);
}

.context-panel,
.side-panel,
.inspector,
.composer-content,
.billing-modal-card,
.project-create-card,
.shortcuts-card {
  background: var(--color-surface-overlay);
  border-color: var(--color-border-subtle);
  box-shadow: var(--shadow-overlay);
}

.side-card,
.quick-node,
.queue-summary div,
.global-model-summary,
.api-status,
.project-template-option,
.dashboard-metrics div,
.dashboard-side-card,
.billing-order-row,
.dashboard-tool-popover,
.project-preview-menu-popover,
.task-status-list div,
.model-status-list div,
.recent-assets-list button {
  border-color: var(--color-border-subtle);
  background: var(--color-surface-raised);
}

.side-card:hover,
button.side-card:hover,
.quick-node:hover,
.recent-assets-list button:hover,
.project-preview-menu-popover button:hover {
  border-color: rgba(34, 214, 173, 0.28);
  background: rgba(34, 214, 173, 0.085);
}

input,
select,
textarea,
.prompt-shell {
  border-color: var(--color-border-subtle);
  background: #0c1012;
  color: var(--color-text-primary);
}

input:focus,
select:focus,
textarea:focus,
.prompt-shell:focus-within {
  border-color: rgba(34, 214, 173, 0.55);
  box-shadow: 0 0 0 3px rgba(34, 214, 173, 0.12);
}

.workflow-node.is-multi-selected .node-card {
  border-color: var(--color-info);
  box-shadow:
    0 0 0 calc(1.25px * var(--inverse-scale, 1)) rgba(121, 173, 255, 0.22),
    var(--shadow-raised);
}

.node-card,
.workflow-node.is-asset-node .node-card,
.workflow-node.is-empty .node-card,
.workflow-node.is-media-missing .node-card {
  border-color: var(--color-border-subtle);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-low);
}

.node-preview,
.workflow-node.is-empty .node-preview,
.workflow-node.is-media-missing .node-preview,
.workflow-node.node-audio.has-media .node-preview {
  background: #0f1417;
}

.node-status-badge,
.tag-like-status {
  border-color: var(--color-border-subtle);
  background: #11161a;
  color: var(--color-text-muted);
}

.node-status-badge[data-status="ready"],
.model-status-list .is-ok {
  background: rgba(53, 212, 159, 0.13);
  color: #b7f6e0;
}

.node-status-badge[data-status="running"],
.model-status-list .is-warn {
  background: rgba(241, 189, 95, 0.14);
  color: #f8d89a;
}

.node-status-badge[data-status="error"],
.api-status.is-error,
.editor-status.is-error,
.video-result-preview.is-error strong {
  border-color: rgba(255, 107, 134, 0.36);
  color: #ffb6c4;
}

.node-status-badge[data-status="linked"] {
  background: rgba(121, 173, 255, 0.14);
  color: #c6d9ff;
}

.node-quick-actions button,
.preview-download,
.asset-toolbar,
.panorama-inline-btn,
.panorama-btn {
  border-color: var(--color-border-subtle);
  background: #11161a;
  color: var(--color-text-secondary);
  box-shadow: var(--shadow-low);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.node-quick-actions button:hover,
.preview-download:hover,
.asset-tool:hover,
.panorama-inline-btn:hover,
.panorama-btn:hover {
  border-color: rgba(34, 214, 173, 0.35);
  background: rgba(34, 214, 173, 0.11);
  color: #d8fff5;
}

.bottom-bar {
  width: 244px;
  min-height: var(--control-height-md);
  padding: 5px 7px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-low);
}

.round-button {
  background: transparent;
  color: var(--color-text-secondary);
}

.round-button:hover,
#shortcutsBtn[aria-expanded="true"] {
  background: var(--color-accent-soft);
  color: #d8fff5;
}

.editor-mode,
.editor-control {
  border-color: var(--color-border-subtle);
  background: var(--color-surface-raised);
  color: var(--color-text-secondary);
}

.editor-mode:hover,
.editor-mode.is-active,
.editor-control:hover,
.editor-control.is-active {
  border-color: rgba(34, 214, 173, 0.32);
  background: rgba(34, 214, 173, 0.11);
  color: var(--color-text-primary);
}

.billing-modal {
  background: rgba(0, 0, 0, 0.66);
}

.billing-plan-card {
  border-color: var(--color-border-subtle);
  background: var(--color-surface-raised);
}

.billing-plan-card:hover {
  border-color: rgba(34, 214, 173, 0.34);
  background: rgba(34, 214, 173, 0.08);
}

.billing-plan-card em,
.billing-order-row em {
  color: #d8fff5;
}

.billing-order-note {
  color: var(--color-text-muted);
}

.canvas-toast {
  border-color: var(--color-border-subtle);
  background: var(--color-surface-overlay);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-raised);
  backdrop-filter: none;
}

.canvas-toast.is-error {
  border-color: rgba(255, 107, 134, 0.36);
  background: #2b171c;
  color: #ffcad3;
}

.dashboard-page {
  background: var(--color-background);
}

.dashboard-header,
.login-card,
.login-showcase {
  border-color: var(--color-border-subtle);
  background-color: var(--color-surface-default);
  box-shadow: var(--shadow-low);
}

.dashboard-tool-button,
.dashboard-credit-pill,
.dashboard-recharge-btn,
.workflow-template-card,
.project-preview-thumb,
.featured-workflow-thumb,
.project-template-option {
  border-color: var(--color-border-subtle);
  background: var(--color-surface-raised);
}

.workflow-template-card:hover,
.project-preview-card:hover .project-preview-thumb,
.featured-category-tabs button:hover,
.featured-category-tabs button.is-active,
.project-template-option:has(input:checked) {
  border-color: rgba(34, 214, 173, 0.34);
  background: rgba(34, 214, 173, 0.08);
}

.dashboard-loading,
.dashboard-empty,
.featured-empty {
  color: var(--color-text-muted);
}

.empty-state,
.dashboard-empty,
.dashboard-loading,
.featured-empty {
  min-height: 44px;
}

/* Component sizing and responsive safeguards */

.top-actions,
.dashboard-user,
.dashboard-controls,
.bottom-bar {
  min-width: 0;
}

.topbar {
  align-items: center;
}

.top-actions {
  max-width: min(720px, calc(100vw - 430px));
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill-button,
.dashboard-credit-pill,
.dashboard-recharge-btn,
.editor-mode,
.editor-control,
.billing-modal-head button,
.project-preview-menu-popover button {
  min-height: var(--control-height-sm);
  border: 1px solid var(--color-border-subtle);
  box-shadow: none;
}

.pill-button:hover,
.dashboard-credit-pill:hover,
.dashboard-recharge-btn:hover,
.billing-modal-head button:hover {
  border-color: rgba(34, 214, 173, 0.3);
}

.pill-button.primary,
.dashboard-recharge-btn,
.billing-plan-card:focus-visible {
  border-color: rgba(34, 214, 173, 0.42);
  background: var(--color-accent-soft);
  color: #d8fff5;
}

.editor-mode-row::-webkit-scrollbar,
.editor-assets::-webkit-scrollbar {
  display: none;
}

.canvas-tool:active,
.round-button:active {
  background: rgba(34, 214, 173, 0.14);
  color: #d8fff5;
}

.canvas-tool:disabled,
.round-button:disabled,
.editor-control:disabled {
  background: transparent;
  color: var(--color-text-faint);
}

.bottom-bar,
.composer-content,
.inspector,
.side-panel,
.context-panel {
  outline: 1px solid rgba(255, 255, 255, 0.015);
}

.inspector {
  width: min(340px, calc(100vw - 96px));
}

.inspector-head h2,
.node-title-label,
.project-preview-info strong,
.billing-order-row span,
.billing-plan-card strong,
.editor-control strong,
.editor-mode {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-status-badge,
.tag-like-status {
  min-width: max-content;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.node-status-badge[data-status="draft"] {
  background: #11161a;
  color: var(--color-text-muted);
}

.node-status-badge[data-status="running"] {
  border-color: rgba(121, 173, 255, 0.34);
  background: rgba(121, 173, 255, 0.13);
  color: #c6d9ff;
}

.workflow-node .node-card {
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.workflow-node:hover .node-card {
  border-color: rgba(221, 232, 236, 0.2);
  background: #1e2429;
}

.workflow-node:focus-visible .node-card {
  box-shadow:
    0 0 0 calc(1.5px * var(--inverse-scale, 1)) rgba(34, 214, 173, 0.42),
    var(--shadow-raised);
}

.asset-toolbar {
  max-width: min(1120px, calc(100vw - 96px));
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.asset-tool {
  min-height: 28px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.composer {
  width: min(780px, calc(100vw - 420px));
}

.composer-content {
  border-radius: var(--radius-lg);
}

.editor-main {
  gap: 10px;
  padding: 12px;
}

.editor-head {
  align-items: center;
}

.editor-mode-row {
  padding-bottom: 1px;
}

.editor-mode {
  color: var(--color-text-muted);
}

.editor-mode:hover {
  color: var(--color-text-secondary);
}

.editor-mode.is-active {
  border-color: rgba(34, 214, 173, 0.36);
  background: var(--color-accent-soft);
  color: #d8fff5;
}

.prompt-shell {
  background: #0c1012;
}

.prompt-editor {
  min-height: 86px;
  max-height: 150px;
}

.editor-status {
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  background: #10161a;
}

.billing-modal-card {
  width: min(680px, calc(100vw - 32px));
}

.billing-plan-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.billing-plan-card {
  min-width: 0;
}

.billing-order-list {
  padding-inline: 18px;
}

.billing-order-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  background: var(--color-control-bg);
}

.billing-status-chip {
  min-width: max-content;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(34, 214, 173, 0.28);
  background: rgba(34, 214, 173, 0.1);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.billing-status-chip.is-debit,
.billing-order-row--failed .billing-status-chip,
.billing-order-row--canceled .billing-status-chip {
  border-color: rgba(255, 107, 134, 0.3);
  background: rgba(255, 107, 134, 0.09);
  color: #ffcad3;
}

.canvas-toast {
  max-width: min(420px, calc(100vw - 32px));
  overflow-wrap: anywhere;
}

.project-preview-card {
  min-width: 0;
}

.project-preview-thumb {
  border-radius: var(--radius-md);
}

.project-preview-info {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 66px;
  padding: 10px 2px 0;
}

.project-preview-info small {
  display: flex;
  align-items: center;
  min-height: 16px;
  gap: 8px;
  color: var(--color-text-muted);
  overflow: hidden;
  line-height: 16px;
}

.project-preview-info small span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-controls {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dashboard-controls input,
.dashboard-controls select {
  max-width: 100%;
}

@media (max-width: 1280px) {
  .topbar {
    right: 16px;
  }

  .canvas-command-bar {
    max-width: calc(100vw - 360px);
  }

  .composer {
    width: min(720px, calc(100vw - 360px));
  }

  .project-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .dashboard-header,
  .dashboard-section-head {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .dashboard-user,
  .dashboard-controls {
    justify-content: flex-start;
  }

  .dashboard-controls input,
  .dashboard-controls select {
    flex: 1 1 160px;
    width: auto;
  }

  .canvas-command-bar {
    left: 84px;
    right: 16px;
    top: 56px;
    max-width: none;
    transform: none;
  }

  .composer {
    left: 50%;
    width: min(640px, calc(100vw - 48px));
  }

  .composer-controls {
    gap: 8px;
  }

  .composer-run-cluster {
    flex: 1 0 100%;
    margin-left: 0;
    justify-content: space-between;
    border-left: 0;
    border-top: 1px solid var(--color-border-subtle);
    padding: 10px 0 0;
  }

  .composer-credit-state {
    max-width: none;
  }

  .billing-plan-grid,
  .project-grid,
  .project-grid.is-all-projects {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .dashboard-header {
    gap: 12px;
  }

  .dashboard-user {
    width: 100%;
    flex-wrap: wrap;
  }

  .workflow-template-grid,
  .project-grid,
  .project-grid.is-all-projects,
  .featured-workflow-grid,
  .billing-plan-grid {
    grid-template-columns: 1fr;
  }

  .canvas-mode-pill {
    display: none;
  }

  [class~="left-dock"] {
    left: 10px;
  }

  .bottom-bar {
    left: 50%;
    right: auto;
    bottom: 10px;
    max-width: calc(100vw - 24px);
    transform: translateX(-50%);
  }

  .composer {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 112px);
  }

  .composer-content {
    max-height: calc(100vh - 112px);
  }

  .editor-control,
  .editor-mode {
    min-width: 0;
  }

  .billing-modal {
    padding: 12px;
  }

  .billing-modal-card {
    max-height: calc(100vh - 24px);
  }

  .billing-order-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .billing-contact-recharge {
    grid-template-columns: 1fr;
  }

  .billing-contact-qr-frame {
    width: min(160px, 100%);
    height: min(160px, calc(100vw - 80px));
    aspect-ratio: 1;
  }

  .billing-contact-qr {
    width: 128%;
    height: 128%;
    transform: translate(-11%, -4%);
  }
}

/* Avatar menu and canvas state rules */

.avatar-menu-global {
  position: fixed;
  z-index: 9000;
  min-width: 220px;
  max-width: min(300px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-surface-overlay);
  box-shadow: var(--shadow-overlay);
}

.avatar-menu-head {
  display: grid;
  gap: 3px;
  min-width: 0;
  margin-bottom: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border-subtle);
}

.avatar-menu-head strong,
.avatar-menu-head small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-menu-head strong {
  color: var(--color-text-primary);
  font-size: 14px;
}

.avatar-menu-head small {
  color: var(--color-text-muted);
  font-size: 12px;
}

.avatar-menu-head #_amCredits {
  color: #c9fff0;
}

.avatar-menu-global button {
  display: block;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 13px;
  text-align: left;
}

.avatar-menu-global button:hover {
  border-color: var(--color-border-subtle);
  background: rgba(255, 255, 255, 0.045);
  color: var(--color-text-primary);
}

.avatar-menu-global button.is-danger {
  color: #ffb6c4;
}

.modal-overlay {
  position: fixed;
  z-index: 9000;
  overflow: auto;
}

.profile-modal-box {
  width: min(440px, calc(100vw - 32px));
}

.profile-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.profile-avatar-preview {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--color-border-strong);
  border-radius: 50%;
  background: var(--color-surface-raised);
}

.profile-upload-label {
  color: var(--color-accent-primary);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.profile-upload-label + small,
.profile-username {
  color: var(--color-text-muted);
  font-size: 13px;
}

.profile-username strong {
  display: block;
  min-width: 0;
  margin-top: 4px;
  overflow: hidden;
  color: var(--color-text-primary);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.billing-modal {
  z-index: 8500;
}

.billing-modal-card {
  width: min(720px, calc(100vw - 32px));
}

.billing-order-title {
  padding-top: 2px;
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 900;
}

.billing-order-row span,
.billing-order-note,
.dashboard-tool-popover span,
.recent-assets-list span,
.featured-workflow-meta span {
  overflow-wrap: anywhere;
}

.billing-plan-card strong,
.billing-plan-card small,
.recent-assets-list strong,
.featured-workflow-meta strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-tool-popover {
  z-index: 90;
}

.project-preview-menu-popover {
  z-index: 95;
}

.shortcuts-panel {
  z-index: 8200;
}

.minimap {
  z-index: 70;
}

.canvas-toast {
  z-index: 9200;
}

.workflow-node.is-media-missing .node-card {
  border-color: rgba(255, 107, 134, 0.4);
}

.workflow-node.is-media-missing .node-status-badge {
  border-color: rgba(255, 107, 134, 0.34);
  background: rgba(255, 107, 134, 0.09);
  color: #ffcad3;
}

.editor-status.is-ok {
  border-color: rgba(53, 212, 159, 0.34);
  background: rgba(53, 212, 159, 0.09);
  color: #b7f6e0;
}

/* Theme selector and auth responsive rules */

.theme-select,
.theme-select-inline {
  min-width: 0;
}

.theme-select {
  display: grid;
  gap: 7px;
  margin-bottom: 18px;
  color: var(--color-text-muted);
  font-size: 13px;
}

.theme-select span {
  color: var(--color-text-secondary);
  font-weight: 800;
}

.theme-select select,
.theme-select-inline {
  min-height: var(--control-height-md);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-control-bg);
  color: var(--color-text-primary);
}

.theme-select select {
  width: 100%;
  padding: 0 12px;
}

.theme-select-inline {
  width: auto;
  max-width: 148px;
  padding: 0 10px;
  font-size: 13px;
}

.login-page {
  overflow-x: hidden;
}

.login-shell {
  width: min(1120px, calc(100vw - 32px));
  max-width: 100%;
  min-width: 0;
  border-color: var(--color-border-subtle);
  background: var(--color-surface-default);
  box-shadow: var(--shadow-overlay);
}

.login-showcase,
.login-card,
.login-copy,
.login-logo,
.login-form,
.auth-tabs {
  min-width: 0;
}

.login-card {
  width: 100%;
  max-width: 100%;
  background:
    linear-gradient(180deg, var(--color-control-subtle), transparent),
    var(--color-surface-default);
}

.login-showcase {
  background: var(--color-surface-raised);
}

.login-feature-row {
  flex-wrap: wrap;
}

.auth-tabs {
  background: var(--color-control-bg);
}

.auth-tab-btn.is-active,
.canvas-tool:hover,
.avatar-menu-global button:hover {
  background: var(--color-control-hover);
}

.login-form label {
  color: var(--color-text-secondary);
}

.login-form input,
input,
select,
textarea,
.prompt-shell {
  background: var(--color-control-bg);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
.project-title input:focus-visible,
.login-form input:focus {
  border-color: var(--color-accent-primary);
  box-shadow: 0 0 0 3px var(--color-accent-ring);
}

.login-submit-btn,
.dashboard-recharge-btn {
  background: var(--color-accent-primary);
  color: #03110e;
}

.pill-button.primary,
.billing-plan-card:focus-visible,
.canvas-tool.is-active,
.editor-mode.is-active,
.round-button:hover,
#shortcutsBtn[aria-expanded="true"] {
  border-color: var(--color-accent-border);
  background: var(--color-accent-selected-bg);
  color: var(--color-accent-selected-text);
}

.node-status-badge[data-status="ready"],
.model-status-list .is-ok,
.editor-status.is-ok {
  background: var(--color-success-soft);
  color: var(--color-success-text);
}

.node-status-badge[data-status="running"],
.model-status-list .is-warn {
  background: var(--color-warning-soft);
  color: var(--color-warning-text);
}

.node-status-badge[data-status="linked"],
.workflow-node.is-running .node-card {
  border-color: var(--color-info-border);
}

.node-status-badge[data-status="linked"] {
  background: var(--color-info-soft);
  color: var(--color-info-text);
}

.billing-modal,
.modal-overlay {
  background: var(--color-overlay-backdrop);
}

.canvas-toast.is-error,
.workflow-node.is-media-missing .node-status-badge {
  border-color: var(--color-danger-border);
  background: var(--color-danger-soft);
  color: var(--color-danger-text);
}

@media (max-width: 980px) {
  .dashboard-tool-popover,
  .dashboard-tool-popover-wide {
    position: fixed;
    top: 74px;
    right: 16px;
    left: auto;
  }

  .profile-actions .pill-button {
    flex: 1 1 140px;
  }
}

@media (max-width: 760px) {
  .avatar-menu-global {
    right: 12px !important;
    left: 12px !important;
    width: auto;
  }

  .dashboard-credit-pill,
  .dashboard-recharge-btn,
  .theme-select-inline {
    min-width: 0;
    max-width: 100%;
  }

  .dashboard-tool-popover,
  .dashboard-tool-popover-wide {
    position: fixed;
    top: 74px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .billing-modal-card {
    width: 100%;
  }

  .login-page {
    padding: 10px;
  }

  .login-shell {
    width: 100%;
    padding: 10px;
    gap: 12px;
    border-radius: var(--radius-lg);
  }

  .login-card,
  .login-showcase {
    border-radius: var(--radius-md);
  }

  .login-card {
    padding: 22px 16px;
  }

  .login-copy h2 {
    font-size: 24px;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .login-canvas-preview {
    min-height: 210px;
  }

  .theme-select-inline {
    flex: 1 1 136px;
    width: 100%;
  }
}

@media (max-width: 420px) {
  .login-page {
    align-items: flex-start;
    padding: 8px;
  }

  .login-showcase {
    padding: 18px 14px;
  }

  .login-card {
    padding: 20px 14px;
  }

  .auth-tabs {
    gap: 4px;
    padding: 4px;
  }

  .login-submit-btn,
  .login-form input,
  .auth-tab-btn {
    min-height: 42px;
  }
}

/* Dashboard, editor chrome, and billing components */

.dashboard-header,
.topbar,
.dashboard-hero,
.workflow-template-section,
.dashboard-projects,
.featured-workflow-section,
.billing-modal-card,
.project-create-card {
  border-color: var(--color-border-subtle);
}

.dashboard-header,
.topbar {
  gap: var(--space-3);
  min-height: 66px;
  backdrop-filter: blur(18px);
}

.dashboard-logo h1,
.project-title input {
  letter-spacing: 0;
}

.dashboard-user,
.top-actions {
  align-items: center;
  row-gap: 8px;
}

.dashboard-tool-button,
.round-button,
.canvas-tool,
.billing-modal-head button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border-subtle);
  background: var(--color-control-bg);
  color: var(--color-text-secondary);
}

.dashboard-tool-button,
.round-button {
  inline-size: var(--dashboard-tool-size, 34px);
  block-size: var(--dashboard-tool-size, 34px);
  flex: 0 0 var(--dashboard-tool-size, 34px);
}

.dashboard-tool-button:hover,
.dashboard-tool-button.is-active,
.round-button:hover,
.ghost-button:hover {
  border-color: var(--color-accent-border);
  background: var(--color-control-hover);
  color: var(--color-text-primary);
}

.dashboard-credit-pill,
.dashboard-recharge-btn,
.pill-button,
.theme-select-inline {
  min-height: var(--control-height-md);
  align-items: center;
  white-space: nowrap;
}

.dashboard-credit-pill,
.pill-button.balance {
  border-color: var(--color-border-subtle);
  background: var(--color-control-bg);
  color: var(--color-text-secondary);
}

.dashboard-recharge-btn,
.pill-button.primary {
  border-color: var(--color-accent-border);
  background: var(--color-accent-soft);
  color: var(--color-accent-selected-text);
  font-weight: 900;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--space-4);
  background: transparent;
}

.dashboard-hero h2,
.dashboard-section-head h3 {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.dashboard-metrics {
  align-items: stretch;
}

.dashboard-metrics > div,
.task-status-list > div {
  min-width: 112px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-control-bg);
}

.workflow-template-grid,
.project-grid,
.featured-workflow-grid,
.billing-plan-grid {
  align-items: stretch;
}

.workflow-template-card,
.billing-plan-card,
.project-template-option {
  min-width: 0;
  border: 1px solid var(--color-border-subtle);
  background: var(--color-surface-raised);
  box-shadow: none;
}

.workflow-template-card:hover,
.billing-plan-card:hover,
.project-template-option:hover {
  transform: translateY(-1px);
  border-color: var(--color-accent-border);
  background: var(--color-control-hover);
}

.project-preview-card,
.featured-workflow-card {
  min-width: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.project-preview-card:hover,
.featured-workflow-card:hover {
  transform: translateY(-1px);
  border-color: transparent;
  background: transparent;
}

.workflow-template-card span,
.featured-workflow-thumb span,
.project-preview-thumb span {
  border: 1px solid var(--color-border-subtle);
  background: var(--color-control-bg);
  color: var(--color-text-secondary);
}

.project-preview-card:not(.project-preview-add) .project-preview-thumb.is-fallback > span,
.featured-workflow-thumb.is-fallback > span {
  display: none;
}

.project-preview-add .project-preview-thumb span {
  display: grid;
  place-items: center;
  border-color: var(--color-border-subtle);
  background: var(--color-control-bg);
  color: var(--color-text-primary);
}

.project-preview-info strong,
.featured-workflow-meta strong,
.workflow-template-card strong {
  line-height: 1.3;
}

.project-preview-info small,
.featured-workflow-meta span,
.workflow-template-card small {
  color: var(--color-text-muted);
}

.project-preview-thumb,
.featured-workflow-thumb {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--color-surface-raised);
}

.project-preview-actions {
  top: 10px;
  right: 10px;
}

.project-preview-menu-popover {
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-surface-overlay);
  box-shadow: var(--shadow-overlay);
}

.canvas-command-bar,
.bottom-bar,
.context-panel,
.side-panel,
.inspector {
  border: 1px solid var(--chrome-border);
  background: var(--chrome-surface);
  box-shadow: var(--shadow-low);
  backdrop-filter: blur(18px);
}

.composer-content {
  border: 1px solid var(--chrome-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 118px),
    var(--chrome-overlay);
  box-shadow: var(--shadow-raised);
}

.canvas-command-bar,
.bottom-bar {
  align-items: center;
  min-height: 44px;
}

.canvas-command-bar {
  gap: 5px;
  max-width: min(680px, calc(100vw - 420px));
  overflow-x: auto;
  padding: 5px;
  scrollbar-width: none;
}

.canvas-command-bar::-webkit-scrollbar {
  display: none;
}

.canvas-tool {
  min-width: 46px;
  height: 34px;
  gap: 5px;
  border-color: transparent;
  border-radius: var(--radius-md);
  background: transparent;
  font-weight: 800;
}

.canvas-tool span {
  max-width: 42px;
}

.canvas-tool:hover {
  border-color: var(--color-border-subtle);
  background: var(--color-control-hover);
  color: var(--color-text-primary);
}

.canvas-tool.is-active {
  border-color: var(--color-accent-border);
  background: var(--color-accent-selected-bg);
  color: var(--color-accent-selected-text);
  box-shadow: inset 0 0 0 1px rgba(34, 214, 173, 0.06);
}

.canvas-mode-pill {
  border: 1px solid var(--color-border-subtle);
  background: var(--color-surface-overlay);
  box-shadow: var(--shadow-low);
}

.workflow-node .node-card {
  border: 1px solid var(--color-border-subtle);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 86px),
    var(--chrome-raised);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.32);
}

.workflow-node:hover .node-card {
  border-color: var(--color-border-strong);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.38);
  transform: translateY(-1px);
}

.workflow-node.is-selected .node-card {
  border-color: var(--color-accent-primary);
  box-shadow:
    0 0 0 calc(1.5px * var(--inverse-scale, 1)) var(--color-accent-ring),
    0 18px 48px rgba(0, 0, 0, 0.42);
}

.workflow-node.is-running .node-card {
  border-color: var(--color-info-border);
  box-shadow:
    0 0 0 calc(1px * var(--inverse-scale, 1)) rgba(121, 173, 255, 0.18),
    0 18px 48px rgba(0, 0, 0, 0.42);
}

.node-caption {
  color: var(--color-text-muted);
}

.node-quick-actions button,
.asset-tool {
  border-color: var(--color-border-subtle);
  background: var(--color-control-bg);
  color: var(--color-text-secondary);
}

.node-quick-actions button:hover,
.asset-tool:hover {
  border-color: var(--color-accent-border);
  color: var(--color-text-primary);
}

.composer {
  max-width: calc(100vw - 32px);
}

.composer-content {
  overflow: visible;
  border: 1px solid var(--chrome-border);
  background: var(--chrome-overlay);
  box-shadow: var(--shadow-raised);
}

.editor-head strong,
.editor-control strong,
.composer-credit-state {
  min-width: 0;
}

.editor-control,
.editor-mode,
.prompt-shell,
.mention-popover {
  border-color: var(--color-border-subtle);
  background: var(--color-control-bg);
}

.editor-popover {
  border-color: var(--chrome-border);
  background: var(--chrome-overlay);
  box-shadow: var(--shadow-overlay);
}

.billing-modal-card {
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
}

.billing-modal-head {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--color-border-subtle);
  background: var(--color-surface-overlay);
}

.billing-plan-grid,
.billing-order-list,
.billing-contact-recharge,
.billing-order-note {
  flex: 0 0 auto;
}

.billing-plan-card {
  text-align: left;
}

.billing-plan-card span {
  color: var(--color-accent-selected-text);
}

.billing-order-row {
  min-width: 0;
}

.billing-order-row span {
  min-width: 0;
}

@media (max-width: 1100px) {
  .top-actions {
    max-width: min(620px, calc(100vw - 300px));
  }

  .canvas-command-bar {
    max-width: min(520px, calc(100vw - 260px));
  }

  .dashboard-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .dashboard-header,
  .topbar {
    align-items: stretch;
  }

  .dashboard-logo,
  .project-title {
    width: 100%;
  }

  .dashboard-user,
  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .dashboard-tool-button,
  .round-button {
    inline-size: 38px;
    block-size: 38px;
    flex-basis: 38px;
  }

  .canvas-command-bar {
    left: 12px;
    right: 12px;
    max-width: none;
    width: auto;
  }

  .canvas-tool {
    flex: 1 0 64px;
  }

  [class~="left-dock"] {
    max-height: calc(100vh - 180px);
  }

  .composer {
    top: auto !important;
    bottom: 12px !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    max-height: calc(100vh - 104px) !important;
    transform: none !important;
  }

  .composer-content {
    max-height: calc(100vh - 104px) !important;
  }

  .composer-controls {
    gap: 7px;
  }

  .composer-run-cluster {
    flex: 1 0 100%;
    margin-left: 0;
    justify-content: space-between;
    border-left: 0;
    border-top: 1px solid var(--color-border-subtle);
    padding: 8px 0 0;
  }

  [class~="price-button"] {
    min-width: 56px;
  }

  .minimap {
    display: none;
  }

  .billing-modal-card,
  .project-create-card {
    max-height: calc(100vh - 20px);
  }

  .billing-plan-grid {
    grid-template-columns: 1fr;
  }
}

.editor-main {
  grid-template-rows: auto auto minmax(96px, 1fr) auto;
  gap: 12px;
  padding: 16px;
}

.editor-head {
  min-height: 48px;
}

.editor-assets {
  min-width: 0;
}

.editor-mode-row {
  gap: 8px;
}

.editor-mode,
.editor-control {
  min-height: 36px;
  border-color: var(--color-border-subtle);
  background: var(--color-control-bg);
}

.editor-mode.is-active,
.editor-control.is-active,
.editor-control:hover {
  border-color: var(--color-accent-border);
  background: var(--color-accent-selected-bg);
  color: var(--color-accent-selected-text);
}

.prompt-shell {
  min-height: 96px;
  border-color: var(--color-border-subtle);
  background: var(--color-control-bg);
}

.prompt-editor {
  min-height: 96px;
  max-height: 184px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.55;
}

.prompt-shell:focus-within {
  border-color: var(--color-accent-border);
  box-shadow: 0 0 0 3px var(--chrome-focus);
}

.minimap {
  width: 244px;
  height: 190px;
  background: var(--chrome-surface);
}

.minimap-head {
  background: var(--color-surface-raised);
}

.canvas-toast {
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 14px;
  color: var(--color-text-primary);
}

.canvas-toast.is-error {
  border-color: var(--color-danger-border);
  background:
    linear-gradient(180deg, var(--color-danger-soft), transparent),
    var(--chrome-overlay);
  color: var(--color-danger-text);
}
