.cps {
  --cps-accent: var(--cps-accent-color, #ff7fae);
  --cps-text: var(--cps-text-color, #222);
  --cps-muted: #8a8088;
  --cps-border: #e6dfe2;
  display: grid;
  gap: 18px;
  margin: 0 0 20px;
  color: var(--cps-text);
  font-size: 15px;
}
.cps, .cps * { box-sizing: border-box; }
.cps { grid-template-columns: minmax(0, 1fr); max-width: 100%; min-width: 0; }
.cps > *, .cps-controls > *, .cps-text-panel > * { min-width: 0; }
.cps { position: relative; }
.cps-stage {
  z-index: 40;
  width: 100%;
  padding: 6px 0 8px;
  background: var(--cps-stage-bg, #fff);
  display: flex;
  justify-content: center;
}
.cps-canvas {
  display: block;
  max-width: 100%;
  border-radius: 14px;
  background: #f4efef;
  cursor: grab;
  touch-action: none;
}
.cps-canvas:active { cursor: grabbing; }
.cps-canvas.is-drop { outline: 3px dashed var(--cps-accent); outline-offset: -6px; }
.cps-controls { display: grid; gap: 12px; }
.cps-row { display: flex; gap: 10px; flex-wrap: wrap; }
.cps-file { display: none; }
.cps-btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.cps-btn--primary { background: var(--cps-accent); color: #fff; }
.cps-btn--ghost {
  background: transparent;
  color: var(--cps-text);
  border: 1.5px solid var(--cps-border);
  justify-self: start;
}
.cps-label { display: block; font-weight: 600; font-size: 13px; margin: 6px 0 4px; }
.cps-hint { font-size: 12px; color: var(--cps-muted); }
.cps-zoom { display: grid; gap: 4px; }
.cps-range { width: 100%; accent-color: var(--cps-accent); }
.cps-input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  border: 1.5px solid var(--cps-border);
  border-radius: 10px;
  font: inherit;
}
.cps-input:focus { outline: none; border-color: var(--cps-accent); }
.cps-text-panel { display: grid; gap: 4px; padding: 14px; border: 1.5px solid var(--cps-border); border-radius: 14px; }
.cps-panel-title { font-weight: 700; font-size: 16px; margin-bottom: 2px; }
.cps-fonts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 290px;
  overflow-y: auto;
  padding: 2px;
}
.cps-font {
  appearance: none;
  border: 1.5px solid var(--cps-border);
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px 6px;
  cursor: pointer;
  color: var(--cps-text);
  display: grid;
  gap: 2px;
  text-align: center;
  min-width: 0;
}
.cps-font__sample {
  font-size: 20px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cps-font__label { font-size: 11px; color: var(--cps-muted); font-family: inherit; }
.cps-font.is-active { border-color: var(--cps-accent); box-shadow: 0 0 0 2px var(--cps-accent) inset; }
.cps-colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(32px, 1fr)); gap: 8px; max-width: 420px; }
.cps-color {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--cps-border);
  cursor: pointer;
  padding: 0;
}
.cps-color.is-active { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--cps-accent); }
.cps-color--custom {
  position: relative;
  overflow: hidden;
  background: conic-gradient(red, orange, yellow, lime, cyan, blue, magenta, red);
  display: inline-block;
}
.cps-color--custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }
.cps-toggles { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; }
.cps-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.cps-toggle input { accent-color: var(--cps-accent); width: 18px; height: 18px; }
.cps-status { font-size: 14px; min-height: 1em; }
.cps-status.is-warn { color: #b3261e; }
.cps-styles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}
.cps-style {
  appearance: none;
  border: 1.5px solid var(--cps-border);
  border-radius: 10px;
  background: #fff;
  padding: 4px 4px 4px;
  cursor: pointer;
  display: grid;
  gap: 2px;
  justify-items: center;
}
.cps-style__canvas { width: 100%; height: auto; aspect-ratio: 24 / 11; border-radius: 6px; display: block; }
.cps-style.is-active { border-color: var(--cps-accent); box-shadow: 0 0 0 2px var(--cps-accent) inset; }
@media (max-width: 749px) {
  .cps-fonts { max-height: 240px; }
  .cps-font__sample { font-size: 18px; }
}
.cps-stage.is-pinned {
  position: fixed;
  box-shadow: 0 10px 14px -12px rgba(0, 0, 0, 0.35);
  border-radius: 0 0 14px 14px;
}
.cps-stage-spacer[hidden] { display: none; }
@media (max-width: 749px) {
  /* smaller while pinned on phones so the options stay usable */
  .cps-stage.is-pinned .cps-canvas { width: min(100%, 30vh) !important; height: auto !important; }
}
/* Desktop: the preview takes the place of the product photos */
.cps-gallery-host > :not(.cps-stage):not(.cps-stage-spacer) { display: none !important; }
.cps-gallery-host .cps-stage { padding: 20px; border-radius: 4px; }
.cps--waiting .cps-stage { display: none; }
.cps-gallery-host .cps-stage.is-pinned { box-shadow: none; }

/* ---------------------------------------------------------- text balloon */
.cps--text { gap: 12px; }
.cps-addtext {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border: 2px dashed var(--cps-accent);
  border-radius: 14px;
  background: #fff6fa;
  color: var(--cps-text);
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  text-align: left;
  transition: transform .15s ease, background .15s ease;
}
.cps-addtext:hover { background: #ffe9f2; transform: translateY(-1px); }
.cps-addtext__icon { font-size: 20px; }
.cps-addtext__label { flex: 1; }
.cps-addtext__price { background: var(--cps-accent); color: #fff; border-radius: 999px; padding: 4px 10px; font-size: 13px; }
.cps-addtext[hidden], .cps-text-panel[hidden], .cps-stage[hidden], .cps-back[hidden], .cps-sides[hidden], .cps-input[hidden] { display: none !important; }
.cps-panel-head { display: flex; justify-content: space-between; align-items: baseline; }
.cps-link { appearance: none; background: none; border: 0; padding: 0; color: var(--cps-muted); text-decoration: underline; cursor: pointer; font: inherit; font-size: 13px; }
.cps-input--text { resize: none; line-height: 1.35; font-size: 16px; }
.cps-toggle--both { margin-top: 6px; }
.cps-back { display: grid; gap: 6px; padding-left: 26px; }
.cps-color--grad { border: 0; }
.cps-total { font-weight: 700; margin-top: 8px; }
.cps-sides { display: flex; gap: 6px; justify-content: center; margin-bottom: 6px; }
.cps-side { appearance: none; border: 1.5px solid var(--cps-border); background: #fff; border-radius: 999px; padding: 5px 14px; font: inherit; font-size: 13px; cursor: pointer; }
.cps-side.is-active { border-color: var(--cps-accent, #ff7fae); background: var(--cps-accent, #ff7fae); color: #fff; }
.cps-stage { flex-direction: column; align-items: center; }

/* ---- logo upload ---- */
.cps-logo{display:flex;flex-direction:column;gap:8px}
.cps-logo-row{display:flex;flex-wrap:wrap;align-items:center;gap:10px}
.cps-logo-btn{display:inline-flex;align-items:center;gap:10px;padding:10px 14px;border:1.5px dashed var(--cps-accent,#ff7fae);border-radius:10px;background:#fff;font:inherit;font-weight:600;cursor:pointer}
.cps-logo-btn:hover{background:#fff5f9}
.cps-logo-name{font-size:.9em;opacity:.8;word-break:break-all}
.cps-checks{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px;font-size:.88em;line-height:1.35}
.cps-check--ok{color:#1f7a3f}
.cps-check--warn{color:#9a6200}
.cps-check--block{color:#b3261e;font-weight:600}

/* ---- total price in the theme's price block ---- */
.cps-price-hidden{display:none!important}
.cps-price-total{display:flex;flex-direction:column;gap:2px}
.cps-price-total[hidden]{display:none}
.cps-price-total__sum{font-size:1.5em;font-weight:700;line-height:1.2}
.cps-price-total__note{font-size:.85em;opacity:.7}
