.mcw-builder {
  --mcw-bg: #f3f8fc;
  --mcw-panel: #ffffff;
  --mcw-line: #d3dce5;
  --mcw-ink: #142635;
  --mcw-primary: #0b6ea8;
  --mcw-alt: #5f6f7f;
  max-width: 1320px;
  margin: 1.5rem auto;
  padding: 1rem;
  border: 1px solid var(--mcw-line);
  border-radius: 12px;
  background: var(--mcw-bg);
  color: var(--mcw-ink);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.mcw-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.mcw-topbar h3 {
  margin: 0;
}

.mcw-topbar-actions {
  display: flex;
  gap: 0.45rem;
}

.mcw-alert {
  display: none;
  margin-bottom: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  background: #fff9d6;
  border: 1px solid #ddca64;
  color: #4c430f;
}

.mcw-alert.is-visible {
  display: block;
}

.mcw-layout {
  display: grid;
  grid-template-columns: 320px 1fr 260px;
  gap: 0.8rem;
  align-items: start;
}

.mcw-layout.tools-collapsed {
  grid-template-columns: 1fr 260px;
}

.mcw-layout.tools-collapsed .mcw-sidebar {
  display: none;
}

.mcw-sidebar,
.mcw-summary,
.mcw-stage {
  background: var(--mcw-panel);
  border: 1px solid var(--mcw-line);
  border-radius: 10px;
}

.mcw-sidebar {
  padding: 0.65rem;
  max-height: calc(100vh - 120px);
  overflow: auto;
}

.mcw-panel {
  border: 1px solid #dfE6ee;
  border-radius: 8px;
  padding: 0.65rem;
  margin-bottom: 0.65rem;
  background: #fbfdff;
}

.mcw-panel h4,
.mcw-summary h4 {
  margin: 0 0 0.5rem;
}

.mcw-collapsible summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.mcw-collapsible summary::-webkit-details-marker {
  display: none;
}

.mcw-collapsible summary::after {
  content: ' +';
  color: #35536a;
}

.mcw-collapsible[open] summary::after {
  content: ' -';
}

.mcw-collapsible[open] > :not(summary) {
  margin-top: 0.45rem;
}

.mcw-panel label,
.mcw-summary label {
  display: block;
  margin-top: 0.45rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.mcw-mini-note {
  margin-top: 0.45rem;
  font-size: 0.82rem;
  color: #4a6272;
}

.mcw-panel input[type='text'],
.mcw-panel input[type='file'],
.mcw-panel select,
.mcw-summary input[type='number'] {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid #bdcbd9;
  border-radius: 7px;
  background: #fff;
}

.mcw-panel input[type='range'] {
  width: 100%;
}

.mcw-check {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.6rem;
  font-weight: 600;
}

.mcw-clipart-row {
  margin-top: 0.55rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.mcw-chip {
  border: 1px solid #b7c7d7;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  background: #edf3f8;
  cursor: pointer;
  font-size: 0.82rem;
}

.mcw-stage {
  padding: 0.65rem;
}

.mcw-canvas-wrap {
  border: 1px solid #cad6e2;
  border-radius: 10px;
  background: #e8f0f6;
  overflow: hidden;
}

#mcw-design-canvas,
#mcw-preview-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 72vh;
}

#mcw-design-canvas {
  cursor: grab;
}

#mcw-design-canvas:active {
  cursor: grabbing;
}

.mcw-stage-actions {
  margin: 0.65rem 0;
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.mcw-preview-wrap {
  margin-top: 0.4rem;
}

.mcw-summary {
  padding: 0.75rem;
}

.mcw-summary p {
  margin: 0.35rem 0;
}

.mcw-summary .mcw-total {
  font-size: 1.1rem;
}

.mcw-btn {
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  background: var(--mcw-primary);
  color: #fff;
  font-weight: 600;
}

.mcw-btn:hover {
  filter: brightness(1.02);
}

.mcw-btn.mcw-btn-alt {
  background: var(--mcw-alt);
}

.mcw-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 1100px) {
  .mcw-layout,
  .mcw-layout.tools-collapsed {
    grid-template-columns: 1fr;
  }

  .mcw-layout.tools-collapsed .mcw-sidebar {
    display: block;
  }

  .mcw-sidebar {
    max-height: none;
  }
}
