/* AI改图（交互编辑 + 图层拆分） */

.ic-canvas-tools {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 28;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  width: 64px;
  padding: 6px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.ic-canvas-tools[hidden] {
  display: none !important;
}

.ic-canvas-tools .ic-tool-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ic-canvas-tool {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  min-height: 52px;
  padding: 6px 2px 7px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #64748b;
  font-size: 0.64rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.ic-canvas-tool svg {
  width: 18px;
  height: 18px;
}

.ic-canvas-tool:hover {
  background: #f1f5f9;
  color: #334155;
}

.ic-canvas-tool.is-selected {
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.ic-canvas-tool-aux {
  min-height: 44px;
  color: #94a3b8;
}

.ic-canvas-tool-divider {
  height: 1px;
  margin: 4px 8px;
  background: #e2e8f0;
}

.ic-brush-flyout {
  position: absolute;
  left: calc(100% + 8px);
  bottom: 6px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 168px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
  font-size: 0.72rem;
  color: #64748b;
}

.ic-brush-flyout[hidden] {
  display: none !important;
}

.ic-brush-flyout input[type="range"] {
  flex: 1;
  min-width: 0;
}

.ic-text-btn {
  border: none;
  background: none;
  color: var(--ws-primary);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0;
}

.ic-marks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.ic-mark-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.7rem;
  cursor: pointer;
}

.ic-mark-chip button {
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.ic-mark-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.4rem;
}

.ic-help {
  margin: 0.4rem 0 0.85rem;
  padding: 0.55rem 0.7rem;
  border: 1px dashed var(--ws-line);
  border-radius: 10px;
  font-size: 0.72rem;
  color: var(--ws-muted);
}

.ic-help summary {
  cursor: pointer;
  color: var(--ws-ink);
  font-weight: 600;
}

.ic-help ul {
  margin: 0.45rem 0 0;
  padding-left: 1.1rem;
  line-height: 1.55;
}

.ic-canvas-hint {
  position: absolute;
  left: 50%;
  bottom: 4.6rem;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  pointer-events: none;
}

.ic-canvas-hint strong {
  font-size: 0.78rem;
}

.ic-canvas-hint span {
  font-size: 0.68rem;
  opacity: 0.86;
}

.ic-canvas-hint[hidden] {
  display: none !important;
}

.ic-thumb.is-main {
  box-shadow: 0 0 0 2px var(--ws-primary);
}

.ic-thumb.is-main .ic-thumb-tag {
  display: none;
}

.ic-thumb .ic-thumb-main {
  position: absolute;
  left: 4px;
  top: 4px;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--ws-primary);
  color: #fff;
  font-size: 0.58rem;
}

.ic-layer-move {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.ic-prompt {
  width: 100%;
  min-height: 108px;
  max-height: 220px;
  overflow: auto;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--ws-line);
  border-radius: 12px;
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--ws-ink);
  background: #fff;
  white-space: pre-wrap;
  word-break: break-word;
}

.ic-prompt:focus {
  outline: none;
  border-color: var(--ws-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.ic-prompt.is-empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
}

.ic-ann {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  margin: 0 0.12rem;
  padding: 0.02rem 0.18rem 0.02rem 0.42rem;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
  user-select: none;
  vertical-align: baseline;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.ic-ann-label {
  pointer-events: none;
}

.ic-ann-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  opacity: 0.72;
}

.ic-ann-x:hover {
  opacity: 1;
  background: rgba(15, 23, 42, 0.12);
}

.ic-ann.is-scribble {
  background: #fee2e2;
  color: #b91c1c;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.2);
}

.ic-ann.is-active {
  background: #1d4ed8;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.28);
}

.ic-ann.is-scribble.is-active {
  background: #b91c1c;
  color: #fff;
}

.ic-ann.is-active .ic-ann-x:hover,
.ic-ann.is-scribble.is-active .ic-ann-x:hover {
  background: rgba(255, 255, 255, 0.22);
}

.ic-fig-tag {
  position: absolute;
  left: 1rem;
  top: 1rem;
  z-index: 5;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  pointer-events: none;
}

.ic-fig-tag[hidden] {
  display: none !important;
}

.ic-fig-badge {
  position: absolute;
  left: 3px;
  bottom: 3px;
  z-index: 2;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1.35;
  pointer-events: none;
}

.ic-mark-chip.is-active {
  background: #1d4ed8;
  color: #fff;
}

.ic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.ic-chip {
  border: 1px solid var(--ws-line);
  background: #fff;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  color: var(--ws-muted);
  cursor: pointer;
}

.ic-chip:hover {
  border-color: #bfdbfe;
  color: var(--ws-primary);
}

.ic-size-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}

.ic-size-row.is-split {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ic-size-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  padding: 0.5rem 0.2rem;
  border: 1px solid var(--ws-line);
  border-radius: 10px;
  background: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ws-ink);
  cursor: pointer;
}

.ic-size-btn span {
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--ws-muted);
}

.ic-size-btn.is-selected {
  border-color: var(--ws-primary);
  background: var(--ws-primary-soft);
}

.ic-check-row {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.ic-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  cursor: pointer;
}

.ic-info {
  flex: 0 0 auto;
}

.ic-info-tip {
  max-width: 260px;
  word-break: break-word;
}

.ic-cost-box {
  margin-top: auto;
}

.ic-cost-line {
  font-size: 0.72rem;
  color: var(--ws-muted);
  line-height: 1.5;
  margin: 0 0 0.7rem;
}

.ic-cost-line[hidden] {
  display: none !important;
}

.ic-submit-hint {
  margin: -0.35rem 0 0.55rem;
  font-size: 0.72rem;
  line-height: 1.45;
  color: #b45309;
}

.ic-submit-hint[hidden] {
  display: none !important;
}

.ic-empty-sub {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--ws-muted);
}

.ic-composer {
  position: absolute;
  inset: 0;
  display: flex;
  background: #f8fafc;
  z-index: 40;
}

.ic-composer[hidden] {
  display: none !important;
}

.ai-ws-canvas-area.is-guide > .ic-composer:not([hidden]) {
  visibility: visible;
}

.ai-ws-canvas-area.is-composing > .ws-float-status,
.ai-ws-canvas-area.is-composing > .ws-float-filmstrip,
.ai-ws-canvas-area.is-composing > .ws-canvas-empty,
.ai-ws-canvas-area.is-composing > .ws-canvas-guide,
.ai-ws-canvas-area.is-composing > .ic-canvas-hint,
.ai-ws-canvas-area.is-composing > .ic-canvas-tools,
.ai-ws-canvas-area.is-composing > .ic-fig-tag {
  display: none !important;
}

.ai-ws-canvas-area.is-composing > .ws-float-export,
.ws-float-export.is-composer-download {
  display: flex !important;
}

.ai-ws-canvas-area.is-composing > .ws-float-export {
  right: calc(312px + 1rem);
  z-index: 50;
}

.ai-ws-canvas-area.is-composing .ws-original-toggle,
.ai-ws-canvas-area.is-composing .ws-compare-hold {
  display: none !important;
}

.ic-composer-stage {
  flex: 1;
  min-width: 0;
  height: 100%;
  background-color: #f8fafc;
  background-image:
    linear-gradient(45deg, #eef2f6 25%, transparent 25%),
    linear-gradient(-45deg, #eef2f6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef2f6 75%),
    linear-gradient(-45deg, transparent 75%, #eef2f6 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.ic-stage-hint {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 2;
  margin: 0;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #64748b;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  font-size: 0.68rem;
  pointer-events: none;
  letter-spacing: 0.02em;
}

.ic-layer-dock {
  width: 312px;
  min-width: 312px;
  background: #fff;
  color: #0f172a;
  border-left: 1px solid #e2e8f0;
  box-shadow: -12px 0 32px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  padding: 0.85rem 0.8rem 0.95rem;
  gap: 0.6rem;
}

.ic-dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.ic-dock-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.ic-dock-title svg {
  width: 16px;
  height: 16px;
  color: #2563eb;
}

.ic-dock-title strong {
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  font-weight: 650;
}

.ic-layer-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.2rem;
  padding: 0 0.38rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.68rem;
  font-weight: 700;
}

.ic-text-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
  height: 28px;
  padding: 0 0.5rem 0 0.3rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 0.72rem;
  cursor: pointer;
}

.ic-text-icon-btn svg {
  width: 14px;
  height: 14px;
}

.ic-text-icon-btn:hover {
  border-color: #bfdbfe;
  color: #1d4ed8;
  background: #eff6ff;
}

.ic-layer-hint {
  margin: 0;
  font-size: 0.68rem;
  color: #94a3b8;
  line-height: 1.5;
}

.ic-layer-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding-right: 0.15rem;
}

.ic-layer-list::-webkit-scrollbar {
  width: 6px;
}

.ic-layer-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 99px;
}

.ic-layer-item {
  display: grid;
  grid-template-columns: 28px 42px minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
  padding: 0.38rem 0.42rem 0.38rem 0.28rem;
  border: 1px solid transparent;
  border-radius: 11px;
  background: #f8fafc;
  cursor: pointer;
  position: relative;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.ic-layer-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: transparent;
}

.ic-layer-item:hover {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.ic-layer-item.is-active {
  border-color: #bfdbfe;
  background: #eff6ff;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.ic-layer-item.is-active::before {
  background: #60a5fa;
}

.ic-layer-item.is-hidden {
  opacity: 0.46;
}

.ic-layer-item img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 8px;
  background: repeating-conic-gradient(#eef2f6 0% 25%, #f8fafc 0% 50%) 50% / 8px 8px;
  box-shadow: inset 0 0 0 1px #e2e8f0;
}

.ic-layer-title {
  display: flex;
  align-items: center;
  gap: 0.32rem;
  min-width: 0;
}

.ic-layer-item strong {
  flex: 1;
  min-width: 0;
  font-size: 0.76rem;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ic-layer-item small {
  display: block;
  color: #94a3b8;
  font-size: 0.64rem;
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ic-layer-kind {
  display: inline-flex;
  align-items: center;
  height: 1.05rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.ic-layer-item.is-base .ic-layer-kind {
  background: #dbeafe;
  color: #1d4ed8;
}

.ic-layer-lock {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
}

.ic-layer-lock svg {
  width: 13px;
  height: 13px;
}

.ic-layer-item .ic-layer-ops {
  display: contents;
}

.ic-icon-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  padding: 0;
}

.ic-icon-btn svg {
  width: 15px;
  height: 15px;
}

.ic-icon-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.ic-icon-btn.is-off {
  color: #64748b;
}

.ic-icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.ic-layer-toolbar {
  display: flex;
  align-items: center;
  gap: 0.12rem;
  padding: 0.2rem;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.ic-toolbar-gap {
  flex: 1;
}

.ic-layer-actions {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

.ic-dock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font-size: 0.78rem;
  cursor: pointer;
}

.ic-dock-btn svg {
  width: 14px;
  height: 14px;
}

.ic-dock-btn:hover {
  border-color: #93c5fd;
  color: #1d4ed8;
}

.ic-dock-btn.primary {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  border-color: #2563eb;
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.28);
}

.ic-dock-btn.primary:hover {
  filter: brightness(1.06);
}

.ic-dock-btn.ghost {
  background: transparent;
  color: #475569;
}

.ic-layer-solo {
  margin: 0 0 0.2rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  font-size: 0.68rem;
  line-height: 1.45;
  border: 1px solid rgba(245, 158, 11, 0.18);
}

.ic-app.is-compose-edit .ai-ws-stage-wrap {
  cursor: crosshair;
}

.ic-app.is-compose-pan .ai-ws-stage-wrap {
  cursor: grab;
}

.ic-app.is-over-ann .ai-ws-stage-wrap,
.ic-app.is-compose-edit.is-over-ann .ai-ws-stage-wrap,
.ic-app.is-compose-pan.is-over-ann .ai-ws-stage-wrap {
  cursor: pointer;
}

@media (max-width: 992px) {
  .ic-size-row {
    grid-template-columns: 1fr 1fr;
  }

  .ic-canvas-tools {
    top: 12px;
    transform: none;
    width: auto;
    flex-direction: row;
    align-items: center;
    padding: 4px;
    border-radius: 14px;
  }

  .ic-canvas-tools .ic-tool-row {
    flex-direction: row;
  }

  .ic-canvas-tool,
  .ic-canvas-tool-aux {
    width: 48px;
    min-height: 44px;
  }

  .ic-canvas-tool-divider {
    width: 1px;
    height: 28px;
    margin: 0 4px;
  }

  .ic-brush-flyout {
    left: 0;
    right: 0;
    bottom: auto;
    top: calc(100% + 8px);
    width: 220px;
  }

  .ic-composer {
    flex-direction: column;
  }

  .ic-layer-dock {
    width: 100%;
    min-width: 0;
    max-height: 42%;
  }

  .ai-ws-canvas-area.is-composing > .ws-float-export {
    right: 1rem;
    top: 0.75rem;
  }
}
