.bead-studio {
  --bs-ink: #241e2c;
  --bs-muted: #655c6d;
  --bs-purple: #7448da;
  --bs-purple-dark: #5d32be;
  --bs-line: #e8e0eb;
  --bs-card: #fffdfa;
  --bs-focus: #976bf4;
  width: 100%;
  color: var(--bs-ink);
  font: 400 14px/1.45 "DM Sans", sans-serif;
  padding: 10px 0 42px;
}
.bead-studio *, .bead-studio *::before, .bead-studio *::after { box-sizing: border-box; }
.bead-studio [hidden] { display: none !important; }
.bead-studio button, .bead-studio input, .bead-studio textarea, .bead-studio select { font: inherit; }
.bead-studio button { cursor: pointer; }
.bead-studio :focus-visible { outline: 3px solid var(--bs-focus); outline-offset: 3px; }
.bead-studio button:disabled { cursor: default; opacity: .42; }
.bead-studio svg { display: block; width: 19px; height: 19px; flex: 0 0 auto; }
.bs-heading { display: flex; align-items: center; gap: 15px; margin: 0 0 21px; }
.bs-heading-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  color: var(--bs-purple-dark);
  background: #e9dcfe;
  border: 1px solid #d8c4f8;
  border-radius: 21px;
}
.bs-heading-icon svg { width: 29px; height: 29px; }
.bs-heading[data-studio-mode="image"] .bs-heading-icon { background: #d9f3df; border-color: #c1e6cd; color: #327659; }
.bs-heading[data-studio-mode="ai"] .bs-heading-icon { background: #ffdfeb; border-color: #f4cadd; color: #a33665; }
.bs-heading h1 {
  font: 750 clamp(30px, 4.2vw, 47px)/1.02 "Bricolage Grotesque", "DM Sans", sans-serif;
  letter-spacing: -.045em;
  margin: 0 0 4px;
}
.bs-heading p { color: var(--bs-muted); margin: 0; font-size: 15px; }
.bs-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.bs-mode {
  min-width: 0;
  min-height: 62px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  color: var(--bs-ink);
  border: 1px solid var(--bs-line);
  background: var(--bs-card);
  border-radius: 17px;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.bs-mode:hover { border-color: #c9b4e9; }
.bs-mode[aria-pressed="true"] { border-color: #9b75e9; box-shadow: inset 0 0 0 1px #9b75e9; background: #f8f2ff; }
.bs-mode-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #6942bd;
  background: #ebdfff;
  border-radius: 14px;
}
.bs-mode-image .bs-mode-icon { background: #d9f3df; color: #327659; }
.bs-mode-ai .bs-mode-icon { background: #ffdfeb; color: #a33665; }
.bs-mode strong { display: block; font-size: 15px; line-height: 1.22; }
.bs-workspace { display: grid; grid-template-columns: minmax(245px, 295px) minmax(0, 1fr); align-items: start; gap: 14px; }
.bs-controls { display: grid; gap: 14px; }
.bs-panel, .bs-editor { border: 1px solid var(--bs-line); border-radius: 20px; background: var(--bs-card); }
.bs-panel { padding: 17px; }
.bs-panel h2 {
  margin: 0 0 13px;
  color: var(--bs-ink);
  font: 740 19px/1.2 "Bricolage Grotesque", "DM Sans", sans-serif;
  letter-spacing: -.025em;
}
.bs-settings { display: grid; gap: 10px; margin: 0; }
.bs-settings label { display: grid; gap: 5px; font-size: 13px; font-weight: 650; color: var(--bs-ink); }
.bs-settings-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bs-settings input:not([type="file"], [type="checkbox"]), .bs-settings select, .bs-settings textarea {
  background: #fff;
  border: 1px solid #e4dbe8;
  color: var(--bs-ink);
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border-radius: 10px;
  padding: 7px 10px;
}
.bs-settings textarea { resize: vertical; min-height: 88px; }
.bs-settings .bs-check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.bs-check input { width: 15px; height: 15px; accent-color: var(--bs-purple); margin: 0; }
.bs-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  min-height: 39px;
  padding: 7px 12px;
  color: var(--bs-ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 700 !important;
  text-align: center;
  line-height: 1.25 !important;
  transition: background .16s ease, border-color .16s ease;
}
.bs-button svg { width: 17px; height: 17px; }
.bs-primary { color: #fff; background: var(--bs-purple); border-color: var(--bs-purple); }
.bs-primary:hover { background: var(--bs-purple-dark); border-color: var(--bs-purple-dark); }
.bs-secondary { color: #4e3b66; background: #fff; border-color: #e3d9ec; }
.bs-secondary:hover { background: #f5eefb; border-color: #d4c2e6; }
.bs-new { color: var(--bs-purple-dark); width: 100%; margin-top: 8px; }
.bs-new:hover { background: #f3ebfc; }
.bs-drop {
  position: relative;
  justify-items: center;
  text-align: center;
  min-height: 100px;
  padding: 12px 10px;
  border: 1px dashed #ba9dea;
  border-radius: 13px;
  cursor: pointer;
  background: #f7f0ff;
}
.bs-drop:hover, .bs-drop.is-dragging { background: #efe4fd; }
.bs-drop:focus-within { outline: 3px solid var(--bs-focus); outline-offset: 2px; }
.bs-drop svg { color: var(--bs-purple); width: 22px; height: 22px; }
.bs-drop span { color: var(--bs-muted); font-size: 11px; font-weight: 500; overflow-wrap: anywhere; }
.bs-help { color: var(--bs-muted); font-size: 12px; margin: 10px 0 0; }
.bs-visually-hidden {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.bs-suggestions { display: flex; gap: 6px; flex-wrap: wrap; }
.bs-suggestions button {
  padding: 4px 8px;
  color: #67449a;
  background: #f7efff;
  border: 1px solid #ebdbf9;
  border-radius: 100px;
  font-size: 11px;
}
.bs-suggestions button:hover { background: #ede0ff; }
.bs-palette-heading { display: flex; justify-content: space-between; align-items: center; gap: 7px; margin: 0 0 12px; }
.bs-palette-heading h2 { margin: 0; }
.bs-pattern-colors h3 { margin: 0 0 7px; color: var(--bs-muted); font: 650 12px/1.3 "DM Sans", sans-serif; }
.bs-pattern-colors + .bs-studio-palette { margin-top: 12px; }
.bs-studio-palette summary { cursor: pointer; padding: 8px 0; font-weight: 650; }
.bs-studio-palette summary span { float: right; color: var(--bs-muted); font-size: 12px; font-weight: 500; }
.bs-studio-palette[open] summary { margin-bottom: 5px; }
.bs-custom {
  position: relative;
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  color: var(--bs-purple-dark);
  border: 1px solid #dfd2ee;
  background: #f7efff;
  border-radius: 9px;
  flex: 0 0 auto;
}
.bs-custom svg { width: 17px; height: 17px; }
.bs-custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; border: 0; }
.bs-custom:focus-within { outline: 3px solid var(--bs-focus); outline-offset: 2px; }
.bs-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(26px, 1fr)); gap: 5px; }
.bs-swatch {
  background: var(--bs-swatch);
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid #49385524;
  border-radius: 8px;
  position: relative;
  padding: 0;
}
.bs-swatch:hover { box-shadow: inset 0 0 0 1px #fff9; }
.bs-swatch[aria-pressed="true"] { outline: 2px solid var(--bs-purple); outline-offset: 1px; }
.bs-color-stats { font-size: 12px; margin-top: 11px; color: var(--bs-muted); }
.bs-editor { min-width: 0; }
.bs-toolbar, .bs-editor-foot { display: flex; justify-content: space-between; align-items: center; gap: 9px; padding: 10px 13px; }
.bs-tools, .bs-history, .bs-export { display: flex; align-items: center; gap: 5px; }
.bs-toolbar { border-bottom: 1px solid var(--bs-line); }
.bs-tool {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 6px 8px;
  min-width: 34px;
  min-height: 34px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  color: #544963;
  background: transparent;
  font-weight: 650 !important;
  font-size: 13px !important;
}
.bs-tool:not(:disabled):hover, .bs-tool[aria-pressed="true"] { color: var(--bs-purple-dark); background: #f3ebff; }
.bs-tool[aria-pressed="true"] { border-color: #e6d8fb; }
.bs-stage {
  min-height: 385px;
  background-color: #f4eff8;
  background-image: radial-gradient(#88739d30 1px, transparent 1px);
  background-size: 12px 12px;
  padding: 24px 15px 21px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
}
.bs-stage canvas {
  display: block;
  height: auto;
  image-rendering: pixelated;
  border: 1px solid #d4c6df;
  box-shadow: 0 7px 20px #47295a1a;
  cursor: crosshair;
  touch-action: none;
}
.bs-stage canvas.is-erasing { cursor: cell; }
.bs-empty { color: var(--bs-muted); text-align: center; font-size: 12px; margin: 0; }
.bs-editor-foot { border-top: 1px solid var(--bs-line); }
.bs-editor-foot > span { color: var(--bs-muted); font-size: 12px; font-weight: 650; }
.bs-export { justify-content: flex-end; flex-wrap: wrap; }
.bs-status {
  grid-column: 1 / -1;
  padding: 8px 13px;
  margin: 0;
  background: #efe8fa;
  color: #63418d;
  border-radius: 10px;
  font-weight: 600;
}
.bs-status:empty { display: none; }
.bs-status.is-error { color: #95345b; background: #fceaf0; }

@media (max-width: 800px) {
  .bs-mode { padding: 10px; gap: 8px; }
  .bs-mode-icon { width: 34px; height: 34px; border-radius: 11px; }
  .bs-mode strong { font-size: 13px; }
  .bs-mode { min-height: 62px; }
  .bs-workspace { grid-template-columns: minmax(220px, 240px) minmax(0, 1fr); }
  .bs-stage { min-height: 310px; }
}

@media (max-width: 650px) {
  .bead-studio { padding-top: 18px; }
  .bs-heading { gap: 11px; margin-bottom: 18px; }
  .bs-heading-icon { width: 49px; height: 49px; border-radius: 16px; }
  .bs-heading-icon svg { width: 24px; height: 24px; }
  .bs-modes { gap: 7px; }
  .bs-mode { align-items: start; flex-direction: column; padding: 8px 8px 9px; min-height: 74px; border-radius: 12px; }
  .bs-mode-icon { width: 30px; height: 30px; border-radius: 10px; }
  .bs-mode-icon svg { width: 16px; height: 16px; }
  .bs-mode strong { font-size: 12px; }
  .bs-workspace { grid-template-columns: minmax(0, 1fr); }
  .bs-controls { display: contents; }
  .bs-editor { grid-row: 4; }
  .bs-status { grid-row: 3; }
  .bs-palette { grid-row: 2; }
  .bs-panel { padding: 13px; }
  .bs-toolbar, .bs-editor-foot { padding: 7px; gap: 5px; }
  .bs-tools, .bs-history, .bs-export { gap: 3px; }
  .bs-tool { min-width: 30px; padding: 5px 6px; }
  .bs-tool span { display: none; }
  .bs-button { padding: 6px 8px; }
  .bs-stage { min-height: 240px; padding: 13px 10px; }
  .bs-swatches { grid-template-columns: repeat(auto-fill, minmax(24px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .bead-studio *, .bead-studio *::before, .bead-studio *::after { transition: none !important; }
}

.bs-color-stats summary { cursor: pointer; }
.bs-color-stats ul { list-style: none; display: grid; gap: 4px; margin: 7px 0 0; padding: 0; }
.bs-color-stats li { display: flex; align-items: center; gap: 6px; }
.bs-color-stats li strong { margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.bs-count-color { width: 13px; height: 13px; border-radius: 4px; border: 1px solid #49385524; }
