.studio-canvas-project-bar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 104px);
  min-height: 44px;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: var(--bg-panel);
  color: var(--fg-muted);
  box-shadow: var(--shadow-tight);
}

.studio-canvas .react-flow__attribution {
  display: none;
}

.canvas-page .studio-canvas-video-player {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  background: #050806;
}

.canvas-page .studio-canvas-video-player video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.canvas-page .studio-canvas-video-player__shade {
  position: absolute;
  inset: auto 0 0;
  height: 38%;
  background: rgba(0, 0, 0, 0.62);
  pointer-events: none;
}

.canvas-page .studio-canvas-video-player__center,
.canvas-page .studio-canvas-video-player__button {
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.48);
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    opacity 150ms ease,
    transform 150ms ease;
}

.canvas-page .studio-canvas-video-player__center {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 8;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  font-size: 22px;
  transform: translate(-50%, -50%);
}

.canvas-page .studio-canvas-video-player.is-playing:not(:hover) .studio-canvas-video-player__center {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.92);
}

.canvas-page .studio-canvas-video-player__controls {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 9;
  display: grid;
  grid-template-columns: 30px auto minmax(90px, 1fr) 30px;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(5, 9, 7, 0.58);
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: auto;
}

.canvas-page .studio-canvas-video-player__button {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  font-size: 14px;
}

.canvas-page .studio-canvas-video-player__center:hover,
.canvas-page .studio-canvas-video-player__button:hover {
  border-color: rgba(var(--accent-rgb), 0.48);
  background: rgba(var(--accent-rgb), 0.18);
  color: #fff;
  transform: translateY(-1px);
}

.canvas-page .studio-canvas-video-player__center:hover {
  transform: translate(-50%, -50%) scale(1.04);
}

.canvas-page .studio-canvas-video-player__time {
  color: rgba(255, 255, 255, 0.86);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.canvas-page .studio-canvas-video-player__seek {
  width: 100%;
  min-width: 0;
  height: 4px;
  accent-color: var(--accent);
  cursor: pointer;
}

.canvas-page .studio-canvas-video-player__seek::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.studio-canvas-project-bar__identity {
  display: grid;
  gap: 2px;
  min-width: 0;
  max-width: min(320px, 34vw);
}

.studio-canvas-project-bar__name {
  display: flex;
  align-items: center;
  min-width: 0;
  color: var(--fg-body);
  font-size: 13px;
  font-weight: 1000;
  line-height: 1.2;
}

.studio-canvas-project-bar__name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-canvas-project-bar__name-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: min(260px, 32vw);
}

.studio-canvas-project-bar__name-form input {
  width: min(220px, 28vw);
  height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(var(--accent-rgb), 0.42);
  border-radius: 9px;
  background: var(--bg-inset);
  color: var(--fg-body);
  font-size: 13px;
  font-weight: 900;
}

.studio-canvas-project-bar__name-form button,
.studio-canvas-project-bar__rename {
  display: inline-grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  background: var(--bg-inset);
  color: var(--fg-muted);
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.studio-canvas-project-bar__name-form button:hover,
.studio-canvas-project-bar__rename:hover {
  border-color: rgba(var(--accent-rgb), 0.42);
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
  transform: translateY(-1px);
}

.studio-canvas-project-bar__status {
  max-width: min(360px, 42vw);
  overflow: hidden;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-canvas-project-bar__status.is-success {
  color: var(--accent);
}

.studio-canvas-project-bar__status.is-error {
  color: var(--error);
}

.studio-canvas-project-bar__save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 84px;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--accent);
  border-radius: 11px;
  background: var(--accent);
  color: #061014;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.studio-canvas-project-bar__save:hover:not(:disabled) {
  border-color: var(--accent-hover, var(--accent));
  background: var(--accent-hover, var(--accent));
  transform: translateY(-1px);
}

.studio-canvas-project-bar__save:disabled {
  cursor: wait;
  opacity: 0.72;
}

.studio-canvas-project-bar__autosave-status {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  padding: 0 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.studio-canvas-project-bar__autosave-status--saving {
  opacity: 1;
  color: var(--fg-muted, #888);
}

.studio-canvas-project-bar__autosave-status--saved {
  opacity: 1;
  color: #10b981;
}

.studio-canvas-project-bar__autosave-status--error {
  opacity: 1;
  color: #ef4444;
}

.studio-canvas-project-bar__export,
.studio-canvas-project-bar__publish {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}

.studio-canvas-project-bar__export {
  border: 1px solid var(--border-subtle);
  background: var(--bg-inset);
  color: var(--fg-body);
}

.studio-canvas-project-bar__export:hover {
  border-color: rgba(var(--accent-rgb), 0.44);
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
  transform: translateY(-1px);
}

.studio-canvas-project-bar__publish {
  border: 1px solid #35d27d;
  background: #35d27d;
  color: #06140b;
}

.studio-canvas-project-bar__publish:hover:not(:disabled) {
  border-color: #4ade80;
  background: #4ade80;
  transform: translateY(-1px);
}

.studio-canvas-project-bar__publish:disabled {
  cursor: wait;
  opacity: 0.72;
}

.studio-canvas-project-bar__recent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  background: var(--bg-inset);
  color: var(--fg-body);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.studio-canvas-project-bar__recent em {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #061014;
  font-size: 11px;
  font-style: normal;
  font-weight: 1000;
}

.studio-canvas-project-bar__recent:hover,
.studio-canvas-project-bar__recent.is-active {
  border-color: rgba(var(--accent-rgb), 0.44);
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
  transform: translateY(-1px);
}

.studio-canvas-recent-drawer {
  position: absolute;
  top: 72px;
  right: 14px;
  z-index: 82;
  display: grid;
  grid-template-rows: 1fr;
  width: min(360px, calc(100vw - 104px));
  height: min(284px, calc(100vh - 92px));
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg-panel) 94%, transparent);
  color: var(--fg-body);
  box-shadow: none;
  backdrop-filter: none;
}

.studio-canvas-recent-drawer__list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  height: 100%;
  padding: 12px;
  overflow-y: auto;
}

.studio-canvas-recent-project {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  width: 100%;
  min-height: 84px;
  padding: 9px;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: var(--bg-inset);
  color: var(--fg-body);
  text-align: left;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.studio-canvas-recent-project:hover:not(:disabled) {
  border-color: rgba(var(--accent-rgb), 0.46);
  background: rgba(var(--accent-rgb), 0.1);
  transform: translateX(-2px);
}

.studio-canvas-recent-project:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.studio-canvas-recent-project img,
.studio-canvas-recent-project__thumb {
  width: 76px;
  height: 66px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-elevated);
}

.studio-canvas-recent-project img {
  object-fit: cover;
}

.studio-canvas-recent-project__thumb {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 22px;
}

.studio-canvas-recent-project__body {
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 0;
}

.studio-canvas-recent-project__body strong,
.studio-canvas-recent-project__body small,
.studio-canvas-recent-project__body em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-canvas-recent-project__body strong {
  color: var(--fg-body);
  font-size: 13px;
  font-weight: 1000;
}

.studio-canvas-recent-project__body small {
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 800;
}

.studio-canvas-recent-project__body em {
  color: var(--fg-soft);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.studio-canvas-recent-drawer__empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 54px 20px;
  color: var(--fg-muted);
  text-align: center;
}

.studio-canvas-recent-drawer__empty .anticon {
  color: var(--accent);
  font-size: 30px;
}

.studio-canvas-recent-drawer__empty strong {
  color: var(--fg-body);
  font-size: 15px;
}

.studio-canvas-recent-drawer__empty span {
  font-size: 12px;
  font-weight: 800;
}

.studio-canvas-recent-drawer__community {
  display: none;
  min-height: 42px;
  margin: 0 12px 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.44);
  border-radius: 12px;
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
  font-size: 13px;
  font-weight: 1000;
  cursor: pointer;
}

.studio-canvas-recent-drawer__community:hover {
  background: var(--accent);
  color: #061014;
}

.studio-tool-layout--canvas-empty {
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "canvas";
}

.studio-canvas.is-empty-projects {
  overflow: hidden;
}

.studio-canvas.is-empty-projects .react-flow__controls {
  display: none;
}

.studio-canvas-empty-projects {
  position: absolute;
  inset: 0;
  z-index: 84;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  padding: 32px;
  color: var(--fg-body);
  text-align: center;
  pointer-events: none;
}

.studio-canvas-empty-projects strong {
  max-width: min(560px, calc(100vw - 180px));
  color: var(--fg-body);
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 1000;
  line-height: 1.35;
}

.studio-canvas-empty-projects__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  min-height: 42px;
  padding: 0 22px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--accent);
  color: #061014;
  font-size: 14px;
  font-weight: 1000;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: none;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.studio-canvas-empty-projects__button:hover {
  border-color: var(--accent-hover, var(--accent));
  background: var(--accent-hover, var(--accent));
  box-shadow: none;
  transform: translateY(-1px);
}

.studio-canvas-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(var(--accent-rgb), 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: canvas-spin 0.8s linear infinite;
}

@keyframes canvas-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 640px) {
  .studio-canvas-project-bar {
    right: 10px;
    left: 10px;
    gap: 6px;
    justify-content: space-between;
  }

  .studio-canvas-project-bar__status {
    max-width: calc(100vw - 140px);
  }

  .studio-canvas-project-bar__identity {
    max-width: none;
  }

  .studio-canvas-project-bar__name-form {
    min-width: 0;
  }

  .studio-canvas-project-bar__name-form input {
    width: min(180px, 42vw);
  }

  .studio-canvas-project-bar__recent span,
  .studio-canvas-project-bar__export span,
  .studio-canvas-project-bar__publish span {
    display: none;
  }

  .studio-canvas-project-bar__export,
  .studio-canvas-project-bar__publish,
  .studio-canvas-project-bar__save,
  .studio-canvas-project-bar__recent {
    min-width: 34px;
    padding: 0 9px;
  }

  .studio-canvas-recent-drawer {
    top: 68px;
    right: 10px;
    left: 10px;
    width: auto;
  }

  .studio-canvas-empty-projects strong {
    max-width: calc(100vw - 48px);
    font-size: 20px;
  }
}

.studio-canvas-zoom-controls {
  position: absolute;
  bottom: 16px;
  left: 16px;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-panel);
  pointer-events: auto;
}

.studio-canvas-zoom-controls button {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 30px;
  padding: 0 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-muted);
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.studio-canvas-zoom-controls button:hover {
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
}

.studio-canvas-zoom-controls__pct {
  min-width: 48px !important;
  font-size: 12px !important;
  font-variant-numeric: tabular-nums;
}

.studio-canvas-align-guides {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 15;
}

.studio-canvas-align-guide {
  position: absolute;
  background: var(--accent);
  opacity: 0.6;
}

.studio-canvas-align-guide--x {
  top: -9999px;
  bottom: -9999px;
  width: 1px;
}

.studio-canvas-align-guide--y {
  left: -9999px;
  right: -9999px;
  height: 1px;
}

/* ── Canvas drag-and-drop visual feedback ─────────────────────────── */
.studio-canvas.is-canvas-dragging::after {
  content: "释放以上传图片";
  position: absolute;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(33, 242, 154, 0.12);
  border: 3px dashed #21f29a;
  color: #111;
  font-size: 20px;
  font-weight: 700;
  pointer-events: none;
}

.studio-canvas-text-composer.is-drag-over {
  outline: 2px dashed #21f29a;
  outline-offset: 2px;
  background: rgba(33, 242, 154, 0.06);
}

.studio-canvas-text-composer.is-drag-over::after {
  content: "释放图片以创建节点";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  color: #333;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
}

/* Tool Modal Overlay */
.studio-canvas-tool-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.studio-canvas-tool-modal {
  position: relative;
  width: 90vw;
  max-width: 720px;
  max-height: 80vh;
  overflow-y: auto;
  border-radius: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-heavy, 0 12px 40px rgba(0,0,0,0.4));
  padding: 24px;
}

.studio-canvas-tool-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.studio-canvas-tool-modal__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg-default);
}

.studio-canvas-tool-modal__close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--bg-subtle);
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.studio-canvas-tool-modal__close:hover {
  background: var(--bg-hover);
}

/* Tool Panel Components */
.studio-canvas-tool-panel {
  display: flex;
  gap: 20px;
  min-height: 280px;
}

.studio-canvas-tool-panel--inpaint {
  flex-direction: column;
}

.studio-canvas-tool-panel__preview {
  flex: 0 0 260px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.studio-canvas-tool-panel__preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.studio-canvas-tool-panel__controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.studio-canvas-tool-panel__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
}

.studio-canvas-tool-panel__options {
  display: flex;
  gap: 8px;
}

.studio-canvas-tool-panel__options button {
  padding: 6px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  color: var(--fg-default);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}

.studio-canvas-tool-panel__options button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.studio-canvas-tool-panel__textarea {
  width: 100%;
  min-height: 60px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  color: var(--fg-default);
  font-size: 13px;
  resize: vertical;
}

.studio-canvas-tool-panel__submit {
  margin-top: auto;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}

.studio-canvas-tool-panel__submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.studio-canvas-tool-panel__actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.studio-canvas-tool-panel__reset {
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  color: var(--fg-default);
  font-size: 13px;
  cursor: pointer;
}

.studio-canvas-tool-panel__canvas-wrap {
  position: relative;
  width: 100%;
  max-height: 320px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-subtle);
}

.studio-canvas-tool-panel__canvas-bg {
  width: 100%;
  height: auto;
  display: block;
}

.studio-canvas-tool-panel__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}
