.cde-wrap {
  border: 1px solid #d8dde8;
  border-radius: 14px;
  padding: 16px;
  margin: 12px 0;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 40, 70, 0.04);
}

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

.cde-badge {
  display: inline-block;
  background: #eef5ff;
  color: #1e4c8f;
  border: 1px solid #bfd7ff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

.cde-assistant {
  color: #50667d;
  font-size: 12px;
}

.cde-svg,
.cde-img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 10px 0;
  border-radius: 10px;
  overflow: hidden;
}

.cde-summary {
  margin: 0 0 10px;
  color: #23364a;
}

.cde-notes summary,
.cde-source summary {
  cursor: pointer;
  font-weight: 600;
}

.cde-notes ul {
  margin: 8px 0 0 18px;
}

.cde-source p {
  margin: 8px 0 0;
  white-space: pre-wrap;
}


.cde-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}

.cde-toolbar-btn {
  appearance: none;
  border: 1px solid #bfd7ff;
  background: #eef5ff;
  color: #1e4c8f;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
  cursor: pointer;
}

.cde-toolbar-btn:hover,
.cde-toolbar-btn:focus-visible {
  background: #dfeeff;
  outline: none;
}

.cde-toolbar-status {
  min-height: 1em;
  font-size: 12px;
  color: #50667d;
}

.cde-toolbar-status.is-error {
  color: #8f2d2d;
}

.cde-scene-caption {
  margin-top: 2px;
  color: #50667d;
  font-size: 12px;
}

.cde-editor-modal {
  position: fixed;
  inset: 0;
  background: rgba(14, 26, 42, 0.68);
  z-index: 99999;
  display: none;
  padding: 20px;
}

.cde-editor-modal.is-open {
  display: block;
}

.cde-editor-open {
  overflow: hidden;
}

.cde-editor-dialog {
  width: min(1400px, 100%);
  height: min(92vh, 900px);
  margin: 0 auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(17, 36, 58, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cde-editor-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid #dbe5f0;
  background: #f7fbff;
}

.cde-editor-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cde-editor-title {
  color: #17324d;
  font-size: 18px;
}

.cde-editor-subtitle,
.cde-editor-help {
  color: #50667d;
  font-size: 13px;
}

.cde-editor-close {
  border: 0;
  background: transparent;
  font-size: 30px;
  line-height: 1;
  color: #35506c;
  cursor: pointer;
}

.cde-editor-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: 0;
  flex: 1;
}

.cde-editor-sidebar {
  border-right: 1px solid #dbe5f0;
  padding: 16px;
  overflow: auto;
  background: #fcfdff;
}

.cde-editor-stage-wrap {
  padding: 14px;
  overflow: auto;
  background: #eef4f9;
}

.cde-editor-stage-wrap .canvas-container {
  position: relative !important;
  display: block !important;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 6px 24px rgba(14, 26, 42, 0.12);
  overflow: hidden;
}

.cde-editor-stage-wrap .canvas-container canvas,
.cde-editor-stage-wrap .lower-canvas,
.cde-editor-stage-wrap .upper-canvas,
.cde-editor-stage-wrap .cde-editor-canvas {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  background: transparent !important;
  max-width: none !important;
  max-height: none !important;
}

.cde-editor-section {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.cde-editor-section-title {
  color: #17324d;
  font-size: 14px;
}

.cde-editor-label {
  display: grid;
  gap: 6px;
  color: #35506c;
  font-size: 13px;
}

.cde-editor-label-compact {
  min-width: 0;
}

.cde-editor-label-compact > span {
  font-weight: 600;
}

.cde-editor-label input[type="color"] {
  width: 100%;
  height: 40px;
  padding: 0;
  border: 1px solid #d0deee;
  border-radius: 10px;
  background: #fff;
}

.cde-editor-control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.cde-editor-control-row-double {
  grid-template-columns: minmax(0, 1fr) auto;
}

.cde-editor-control-row .cde-editor-label input[type="color"],
.cde-editor-control-row .cde-editor-label input[type="range"] {
  width: min(132px, 100%);
}

.cde-editor-mini-actions-inline {
  align-items: flex-end;
  justify-content: flex-start;
}

.cde-editor-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.cde-editor-graph-section.is-hidden {
  display: none;
}

.cde-editor-help-compact {
  margin: 0;
}

.cde-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}


.cde-editor-mini-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cde-editor-order-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.cde-editor-btn-mini {
  padding: 7px 10px;
  font-size: 11px;
  min-width: 92px;
}

.cde-editor-btn-tiny {
  min-width: 74px;
  font-size: 10px;
  padding-inline: 8px;
}

.cde-editor-order-actions .cde-editor-btn {
  width: 100%;
}

.cde-editor-btn-danger {
  border-color: #f2c5c5;
  background: #fdecec;
  color: #b42318;
}

.cde-editor-btn-danger:hover,
.cde-editor-btn-danger:focus-visible {
  background: #fbd5d5;
}

.cde-editor-btn,
.cde-import-label {
  appearance: none;
  border: 1px solid #bfd7ff;
  background: #eef5ff;
  color: #1e4c8f;
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}

.cde-editor-btn:hover,
.cde-editor-btn:focus-visible,
.cde-import-label:hover,
.cde-import-label:focus-visible {
  background: #dfeeff;
  outline: none;
}

.cde-layer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid #e0e8f2;
  border-radius: 10px;
  background: #fff;
}

.cde-layer-name {
  color: #17324d;
  font-size: 13px;
  font-weight: 600;
}

.cde-layer-row label {
  white-space: nowrap;
  color: #50667d;
  font-size: 12px;
}

.cde-empty-note {
  padding: 10px 12px;
  border: 1px dashed #d0deee;
  border-radius: 10px;
  color: #5d7389;
  background: #fff;
  font-size: 12px;
}

.cde-editor-objects {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.cde-object-select {
  width: 100%;
  border: 1px solid #d0deee;
  border-radius: 10px;
  background: #fff;
  color: #17324d;
  font-size: 12px;
  padding: 10px 12px;
}

.cde-object-row {
  display: grid;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid #e0e8f2;
  border-radius: 10px;
  background: #fff;
}

.cde-object-row.is-active {
  border-color: #8fb8ff;
  box-shadow: 0 0 0 2px rgba(30, 76, 143, 0.08);
}

.cde-object-name,
.cde-object-tool {
  appearance: none;
  border: 1px solid #bfd7ff;
  background: #eef5ff;
  color: #1e4c8f;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.cde-object-name:hover,
.cde-object-name:focus-visible,
.cde-object-tool:hover,
.cde-object-tool:focus-visible,
.cde-object-select:focus-visible {
  background: #dfeeff;
  outline: none;
}

.cde-object-tool[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.cde-object-meta {
  color: #5d7389;
  font-size: 12px;
}

.cde-object-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

@media (max-width: 900px) {
  .cde-editor-layout {
    grid-template-columns: 1fr;
  }

  .cde-editor-sidebar {
    border-right: 0;
    border-bottom: 1px solid #dbe5f0;
  }

  .cde-editor-control-row,
  .cde-editor-control-row-double,
  .cde-editor-grid-2 {
    grid-template-columns: 1fr;
  }
}


.cde-editor-control-row-stacked {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

.cde-editor-mini-actions-background {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-start;
}

.cde-editor-label select,
.cde-editor-label input[type="number"],
.cde-editor-label input[type="text"] {
  width: 100%;
  min-height: 40px;
  border: 1px solid #d0deee;
  border-radius: 10px;
  background: #fff;
  color: #17324d;
  padding: 8px 10px;
  box-sizing: border-box;
}

.cde-editor-help-inline {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
}
