/* ============================================================
   Circle Crop Image Tool — style.css  (v2 — bulk-ready)
   Classes  : cc-circle-crop-*
   Approach : Mobile-first (base = mobile, @media min-width = desktop)
   Brand    : #42B5A4 (teal) — protected as the default; frames can
              now be recolored per-style via --cc-frame-color(-2/-soft),
              set from JS (main.js) whenever the frame/color changes.
   ============================================================ */


/* ══════════════════════════════════════════
   0. BASE / RESET / BRAND TOKENS
   ══════════════════════════════════════════ */
.cc-circle-crop-wrap,
.cc-circle-crop-wrap * {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

.cc-circle-crop-wrap {
  /* ── Brand color — single source of truth, never hardcoded elsewhere ── */
  --cc-brand: #42B5A4;
  --cc-brand-dark: #2E8577;
  --cc-brand-soft: #E8F8F6;

  --cc-ink: #1a1a22;
  --cc-ink-soft: #55555f;
  --cc-line: #e4e4ee;
  --cc-line-strong: #c4c4d4;
  --cc-bg: #f5f5fa;
  --cc-error: #c0392b;

  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 56px;
  touch-action: manipulation;
  overscroll-behavior-y: contain;
}


/* ══════════════════════════════════════════
   1. HEADER
   ══════════════════════════════════════════ */
.cc-circle-crop-header {
  text-align: center;
  margin-bottom: 24px;
}

.cc-circle-crop-header__title {
  font-weight: 800;
  font-size: clamp(1.5rem, 6vw, 2.2rem);
  letter-spacing: -0.8px;
  color: var(--cc-ink);
  margin: 0 0 8px;
}

.cc-circle-crop-header__title strong {
  font-weight: 900;
  color: var(--cc-brand);
}

.cc-circle-crop-header__subtitle {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--cc-ink-soft);
  line-height: 1.6;
  margin: 0;
}

.cc-circle-crop-header__subtitle a {
  color: var(--cc-brand);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(66, 181, 164, 0.35);
  text-underline-offset: 2px;
}

.cc-circle-crop-header__subtitle a:hover,
.cc-circle-crop-header__subtitle a:focus-visible {
  color: var(--cc-brand-dark);
  text-decoration-color: currentColor;
}

.cc-circle-crop-header__note {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--cc-ink-soft);
  opacity: 0.75;
  margin: 10px 0 0;
}


/* ══════════════════════════════════════════
   2. STEPPER
   ══════════════════════════════════════════ */
.cc-circle-crop-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 28px;
}

.cc-circle-crop-stepper__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.cc-circle-crop-stepper__dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #9999a2;
  background: #fff;
  border: 1.5px solid var(--cc-line);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.cc-circle-crop-stepper__step.is-active .cc-circle-crop-stepper__dot {
  background: var(--cc-brand);
  border-color: var(--cc-brand);
  color: #fff;
}

.cc-circle-crop-stepper__step.is-done .cc-circle-crop-stepper__dot {
  background: var(--cc-brand-soft);
  border-color: var(--cc-brand);
  color: var(--cc-brand);
}

.cc-circle-crop-stepper__dot--export {
  width: auto;
  border-radius: 9999px;
  padding: 0 16px;
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.cc-circle-crop-stepper__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--cc-ink-soft);
}

.cc-circle-crop-stepper__line {
  width: 28px;
  height: 2px;
  background: var(--cc-line);
  margin-top: -18px;
}


/* ══════════════════════════════════════════
   3. PANELS
   ══════════════════════════════════════════ */
.cc-circle-crop-panel {
  display: none;
}

.cc-circle-crop-panel.is-active {
  display: block;
  animation: ccFadeIn 0.28s ease both;
}

@keyframes ccFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ══════════════════════════════════════════
   4. STEP 1 — UPLOAD SECTION (premium, minimal)
   ══════════════════════════════════════════ */
.cc-circle-crop-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 480px;
  margin: 8px auto 0;
  padding: 40px 24px;
  border-radius: 24px;
  cursor: pointer;
}

/* Drag-over affordance: a soft brand-colored halo behind the whole
   card, not a color swap — reads as "drop here" without shouting. */
.cc-circle-crop-dropzone__ring {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  border: 1.5px dashed transparent;
  box-shadow: 0 0 0 0 rgba(66, 181, 164, 0);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
  pointer-events: none;
}

.cc-circle-crop-dropzone.is-dragover .cc-circle-crop-dropzone__ring {
  border-color: rgba(66, 181, 164, 0.45);
  box-shadow: 0 0 0 8px rgba(66, 181, 164, 0.08);
}

/* ── The focal point: pill-shaped select button ── */
.cc-circle-crop-dropzone__button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 32px;
  border-radius: 9999px;
  background: var(--cc-brand);
  border: 1.5px solid var(--cc-brand);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.1px;
  box-shadow: 0 2px 10px rgba(66,181,164,0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.cc-circle-crop-dropzone__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #fff;
}

.cc-circle-crop-dropzone:hover .cc-circle-crop-dropzone__button {
  transform: translateY(-2px);
  background: var(--cc-brand-dark);
  border-color: var(--cc-brand-dark);
  box-shadow: 0 14px 32px rgba(66,181,164,0.28);
}

.cc-circle-crop-dropzone:active .cc-circle-crop-dropzone__button {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 6px 16px rgba(66,181,164,0.24);
}

.cc-circle-crop-dropzone:focus-visible {
  outline: none;
}

.cc-circle-crop-dropzone:focus-visible .cc-circle-crop-dropzone__button {
  box-shadow: 0 0 0 4px var(--cc-brand-soft), 0 8px 24px rgba(66,181,164,0.28);
}

.cc-circle-crop-dropzone.is-dragover .cc-circle-crop-dropzone__button {
  transform: translateY(-2px);
  background: var(--cc-brand-dark);
  border-color: var(--cc-brand-dark);
  box-shadow: 0 14px 32px rgba(66,181,164,0.32);
}

/* ── Refined divider: fading hairlines, not decoration ── */
.cc-circle-crop-dropzone__divider {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 300px;
  margin-top: 28px;
  color: #a3a3ae;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.cc-circle-crop-dropzone__divider::before,
.cc-circle-crop-dropzone__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--cc-line-strong));
}

.cc-circle-crop-dropzone__divider::after {
  background: linear-gradient(to left, transparent, var(--cc-line-strong));
}

/* ── Trust line ── */
.cc-circle-crop-dropzone__trust {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 22px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--cc-ink-soft);
}

.cc-circle-crop-dropzone__trust svg {
  width: 15px;
  height: 15px;
  color: var(--cc-brand);
  flex-shrink: 0;
}

.cc-circle-crop-dropzone__hint {
  margin: 10px 0 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--cc-ink-soft);
  opacity: 0.7;
  text-align: center;
}


/* ══════════════════════════════════════════
   5. STEP 2 — STAGE (canvas + circle mask + loading)
   ══════════════════════════════════════════ */
.cc-circle-crop-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 420px;
  margin: 0 auto 20px;
  border-radius: 16px;
  overflow: hidden;
  background:
    linear-gradient(45deg, #e9e9ef 25%, transparent 25%) -10px 0/ 20px 20px,
    linear-gradient(-45deg, #e9e9ef 25%, transparent 25%) -10px 0/ 20px 20px,
    linear-gradient(45deg, transparent 75%, #e9e9ef 75%) -10px 0/ 20px 20px,
    linear-gradient(-45deg, transparent 75%, #e9e9ef 75%) -10px 0/ 20px 20px,
    #fafafd;
  touch-action: pan-y;
}

.cc-circle-crop-canvas {
  display: block;
  width: 100%;
  height: 100%;
  /* pan-y (not none): a single finger is left free for native page
     scroll. Image panning now only happens with two fingers (see
     gestures.js), so one-finger touch never gets trapped by the
     canvas — the page scrolls immediately, mid-edit or not. */
  touch-action: pan-y;
  cursor: grab;
}

.cc-circle-crop-canvas:active {
  cursor: grabbing;
}

/* Locked: identical touch-action, kept as its own rule so intent stays
   documented — touches always pass through to the page for scroll. */
.cc-circle-crop-stage.is-locked,
.cc-circle-crop-stage.is-locked .cc-circle-crop-canvas {
  touch-action: pan-y;
}

.cc-circle-crop-stage.is-locked .cc-circle-crop-canvas {
  cursor: default;
}

.cc-circle-crop-lockbtn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.92);
  color: var(--cc-ink-soft);
  box-shadow: 0 2px 8px rgba(26,26,34,0.18);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.18s ease, color 0.18s ease, transform 0.15s ease;
}

.cc-circle-crop-lockbtn:active {
  transform: scale(0.92);
}

.cc-circle-crop-lockbtn__icon {
  width: 18px;
  height: 18px;
}

.cc-circle-crop-lockbtn__icon--locked {
  display: none;
}

.cc-circle-crop-lockbtn.is-locked {
  background: var(--cc-brand);
  color: #fff;
}

.cc-circle-crop-lockbtn.is-locked .cc-circle-crop-lockbtn__icon--unlocked {
  display: none;
}

.cc-circle-crop-lockbtn.is-locked .cc-circle-crop-lockbtn__icon--locked {
  display: block;
}

.cc-circle-crop-stage__mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 50%;
  box-shadow: 0 0 0 2000px rgba(26, 26, 34, 0.5);
  border: 2px solid #fff;
}

/* The live-preview counterpart of frames.js's canvas-drawn ring. Every
   rule below reads its color(s)/width from CSS custom properties that
   main.js keeps in sync with the active image's frame settings:
     --cc-frame-width       px, the ring's thickness
     --cc-frame-color       the (possibly user-picked) base color
     --cc-frame-color-2     an auto-darkened second tone, for gradients
     --cc-frame-color-soft  an rgba() version of the color, for glows
   Chrome / Gold / Rainbow are intentionally fixed multi-tone gradients
   (not user-colorable), matching frames.js. Sparkle's scattered dots
   only render in the exported PNG — reproducing them in live CSS
   isn't worth the cost, so the preview shows its base ring only. */
.cc-circle-crop-stage__frame {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  box-sizing: border-box;
  border-style: solid;
  border-width: 0;
  border-color: transparent;
  background: none;
  transition: filter 0.15s ease;
}

.cc-circle-crop-stage__frame[data-frame="classic"] {
  border-width: var(--cc-frame-width, 0px);
  border-color: var(--cc-frame-color, var(--cc-brand));
}

.cc-circle-crop-stage__frame[data-frame="ink"] {
  border-width: var(--cc-frame-width, 0px);
  border-color: var(--cc-frame-color, var(--cc-ink));
}

.cc-circle-crop-stage__frame[data-frame="white"] {
  border-width: var(--cc-frame-width, 0px);
  border-color: var(--cc-frame-color, #fff);
  box-shadow: inset 0 0 0 1px var(--cc-frame-color-2, var(--cc-line-strong));
}

.cc-circle-crop-stage__frame[data-frame="dashed"] {
  border-width: var(--cc-frame-width, 0px);
  border-color: var(--cc-frame-color, var(--cc-brand));
  border-style: dashed;
}

.cc-circle-crop-stage__frame[data-frame="double"] {
  border-width: var(--cc-frame-width, 0px);
  border-color: var(--cc-frame-color, var(--cc-brand));
  border-style: double;
}

.cc-circle-crop-stage__frame[data-frame="gradient"] {
  border-width: 0;
  background: conic-gradient(from -90deg, var(--cc-frame-color, var(--cc-brand)), var(--cc-frame-color-2, var(--cc-brand-dark)), var(--cc-frame-color, var(--cc-brand)));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--cc-frame-width, 0px)), #000 calc(100% - var(--cc-frame-width, 0px)));
          mask: radial-gradient(farthest-side, transparent calc(100% - var(--cc-frame-width, 0px)), #000 calc(100% - var(--cc-frame-width, 0px)));
}

.cc-circle-crop-stage__frame[data-frame="vignette"] {
  border-width: 0;
  border-color: transparent;
  box-shadow: inset 0 0 calc(var(--cc-frame-width, 0px) * 1.6) var(--cc-frame-color-soft, rgba(26, 26, 34, 0.35));
}

.cc-circle-crop-stage__frame[data-frame="neon"] {
  border-width: calc(var(--cc-frame-width, 0px) * 0.62);
  border-color: var(--cc-frame-color, #22E7F0);
  box-shadow:
    0 0 calc(var(--cc-frame-width, 0px) * 1.4) var(--cc-frame-color-soft, rgba(34,231,240,0.4)),
    inset 0 0 calc(var(--cc-frame-width, 0px) * 0.7) var(--cc-frame-color-soft, rgba(34,231,240,0.4));
}

.cc-circle-crop-stage__frame[data-frame="glass"] {
  border-width: var(--cc-frame-width, 0px);
  border-color: var(--cc-frame-color-soft, rgba(255,255,255,0.35));
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.cc-circle-crop-stage__frame[data-frame="dotted"] {
  border-width: var(--cc-frame-width, 0px);
  border-color: var(--cc-frame-color, var(--cc-brand));
  border-style: dotted;
}

.cc-circle-crop-stage__frame[data-frame="halo"] {
  border-width: 0;
  box-shadow:
    0 0 calc(var(--cc-frame-width, 0px) * 2.2) var(--cc-frame-color-soft, rgba(66,181,164,0.4)),
    inset 0 0 calc(var(--cc-frame-width, 0px) * 1.4) var(--cc-frame-color-soft, rgba(66,181,164,0.4));
}

.cc-circle-crop-stage__frame[data-frame="sparkle"] {
  border-width: calc(var(--cc-frame-width, 0px) * 0.55);
  border-color: var(--cc-frame-color, var(--cc-brand));
  box-shadow: 0 0 calc(var(--cc-frame-width, 0px) * 0.8) var(--cc-frame-color-soft, rgba(66,181,164,0.35));
}

.cc-circle-crop-stage__frame[data-frame="emboss"] {
  border-width: calc(var(--cc-frame-width, 0px) * 0.3);
  border-color: var(--cc-frame-color, var(--cc-ink));
  box-shadow: inset 2px 2px 3px rgba(0,0,0,0.35), inset -2px -2px 3px rgba(255,255,255,0.55);
}

.cc-circle-crop-stage__frame[data-frame="outline"] {
  border-width: min(3px, var(--cc-frame-width, 0px));
  border-color: var(--cc-frame-color, var(--cc-ink));
  opacity: 0.85;
}

.cc-circle-crop-stage__frame[data-frame="chrome"] {
  border-width: 0;
  background: conic-gradient(from -90deg, #8e9aa3, #f5f7fa, #7c8791, #ffffff, #5b6670, #8e9aa3);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--cc-frame-width, 0px)), #000 calc(100% - var(--cc-frame-width, 0px)));
          mask: radial-gradient(farthest-side, transparent calc(100% - var(--cc-frame-width, 0px)), #000 calc(100% - var(--cc-frame-width, 0px)));
}

.cc-circle-crop-stage__frame[data-frame="gold"] {
  border-width: 0;
  background: conic-gradient(from -90deg, #7a4c17, #f5d67c, #a3722c, #fdf1c9, #8a5a1e, #7a4c17);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--cc-frame-width, 0px)), #000 calc(100% - var(--cc-frame-width, 0px)));
          mask: radial-gradient(farthest-side, transparent calc(100% - var(--cc-frame-width, 0px)), #000 calc(100% - var(--cc-frame-width, 0px)));
}

.cc-circle-crop-stage__frame[data-frame="rainbow"] {
  border-width: 0;
  background: conic-gradient(from -90deg, #ff5f6d, #ffc371, #f9f871, #6dd5a7, #58a4ff, #a06cff, #ff5fa2, #ff5f6d);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--cc-frame-width, 0px)), #000 calc(100% - var(--cc-frame-width, 0px)));
          mask: radial-gradient(farthest-side, transparent calc(100% - var(--cc-frame-width, 0px)), #000 calc(100% - var(--cc-frame-width, 0px)));
}

/* Draggable, resizable, ROTATABLE "verified" sticker (badge.js) with
   its own delete / resize / rotate handles. The wrap is what gets
   positioned + rotated; the <img> just fills it. */
.cc-circle-crop-badge-wrap {
  position: absolute;
  z-index: 4;
  touch-action: none;
}

.cc-circle-crop-badge-wrap[hidden] {
  display: none;
}

.cc-circle-crop-badge {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
  filter: drop-shadow(0 2px 6px rgba(26, 26, 34, 0.35));
  user-select: none;
  -webkit-user-drag: none;
}

.cc-circle-crop-badge:active {
  cursor: grabbing;
}

.cc-circle-crop-badge-handle {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--cc-ink);
  color: #fff;
  box-shadow: 0 2px 6px rgba(26,26,34,0.35);
  touch-action: none;
  cursor: pointer;
}

.cc-circle-crop-badge-handle--delete {
  top: -9px;
  right: -9px;
  width: 22px;
  height: 22px;
  padding: 0;
  background: var(--cc-error);
}

.cc-circle-crop-badge-handle--delete svg {
  width: 11px;
  height: 11px;
}

.cc-circle-crop-badge-handle--resize {
  bottom: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  background: var(--cc-brand);
  cursor: nwse-resize;
}

.cc-circle-crop-badge-handle--rotate {
  top: -26px;
  left: calc(50% - 8px);
  width: 16px;
  height: 16px;
  background: var(--cc-brand);
  cursor: grab;
}

.cc-circle-crop-badge-handle--rotate::before {
  content: '';
  position: absolute;
  top: 16px;
  left: calc(50% - 1px);
  width: 2px;
  height: 12px;
  background: rgba(255,255,255,0.8);
}

.cc-circle-crop-stage__loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(250, 250, 253, 0.85);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 2;
}

.cc-circle-crop-stage__loading.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.cc-circle-crop-spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid var(--cc-line);
  border-top-color: var(--cc-brand);
  animation: ccSpin 0.7s linear infinite;
}

@keyframes ccSpin {
  to { transform: rotate(360deg); }
}


/* ══════════════════════════════════════════
   5b. FILMSTRIP (batch mode — 2+ images loaded)
   ══════════════════════════════════════════ */
.cc-circle-crop-filmstrip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  margin-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.cc-circle-crop-filmstrip::-webkit-scrollbar {
  display: none;
}

.cc-circle-crop-filmstrip[hidden] {
  display: none;
}

.cc-circle-crop-filmstrip__thumb {
  position: relative;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  padding: 0;
  border: 2px solid var(--cc-line);
  background: #fafafd;
  overflow: visible;
  cursor: pointer;
  touch-action: manipulation;
}

.cc-circle-crop-filmstrip__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 9px;
  display: block;
}

.cc-circle-crop-filmstrip__thumb.is-active {
  border-color: var(--cc-brand);
  box-shadow: 0 0 0 2px var(--cc-brand-soft);
}

.cc-circle-crop-filmstrip__num {
  position: absolute;
  left: 3px;
  bottom: 3px;
  min-width: 14px;
  padding: 0 3px;
  border-radius: 6px;
  background: rgba(26,26,34,0.65);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
}

.cc-circle-crop-filmstrip__remove {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cc-error);
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(26,26,34,0.3);
}

.cc-circle-crop-filmstrip__add {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  border: 1.5px dashed var(--cc-line-strong);
  background: #fff;
  color: var(--cc-ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
}

.cc-circle-crop-filmstrip__add svg {
  width: 18px;
  height: 18px;
}

.cc-circle-crop-batch-note {
  font-size: 12px;
  font-weight: 600;
  color: var(--cc-ink-soft);
  text-align: center;
  margin: 0 0 14px;
}

.cc-circle-crop-batch-note[hidden] {
  display: none;
}


/* ══════════════════════════════════════════
   6. CONTROLS (zoom + background + frame + badge)
   ══════════════════════════════════════════ */
.cc-circle-crop-controls {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 20px;
}

.cc-circle-crop-controls__row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cc-circle-crop-controls__row[hidden] {
  display: none;
}

.cc-circle-crop-controls__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--cc-ink);
}

.cc-circle-crop-controls__val {
  font-weight: 700;
  color: var(--cc-brand);
  margin-left: 4px;
}

.cc-circle-crop-slider {
  width: 100%;
  height: 40px;
  accent-color: var(--cc-brand);
  touch-action: manipulation;
}

.cc-circle-crop-slider:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.cc-circle-crop-stepper-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cc-circle-crop-stepper-row .cc-circle-crop-slider {
  flex: 1;
}

.cc-circle-crop-stepbtn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--cc-line);
  background: #fff;
  color: var(--cc-ink);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.cc-circle-crop-stepbtn:active {
  background: var(--cc-bg);
}

.cc-circle-crop-controls__row--bg {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.cc-circle-crop-bgmode {
  display: flex;
  gap: 8px;
  position: relative;
}

.cc-circle-crop-bgmode__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-radius: 9999px;
  border: 1.5px solid var(--cc-line);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--cc-ink-soft);
  cursor: pointer;
}

.cc-circle-crop-bgmode__btn.is-active {
  border-color: var(--cc-brand);
  color: var(--cc-brand);
  background: var(--cc-brand-soft);
}

.cc-circle-crop-bgmode__swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--cc-line-strong);
  background: var(--cc-brand);
}

.cc-circle-crop-bgmode__swatch--checker {
  background:
    linear-gradient(45deg, #ccc 25%, transparent 25%) 0 0/8px 8px,
    linear-gradient(-45deg, #ccc 25%, transparent 25%) 0 0/8px 8px,
    linear-gradient(45deg, transparent 75%, #ccc 75%) 0 0/8px 8px,
    linear-gradient(-45deg, transparent 75%, #ccc 75%) 0 0/8px 8px,
    #fff;
}

.cc-circle-crop-colorinput {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Glow on/off switch */
.cc-circle-crop-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 28px;
  flex-shrink: 0;
}

.cc-circle-crop-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.cc-circle-crop-switch__track {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: var(--cc-line-strong);
  transition: background 0.18s ease;
}

.cc-circle-crop-switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(26,26,34,0.3);
  transition: transform 0.18s ease;
}

.cc-circle-crop-switch input:checked + .cc-circle-crop-switch__track {
  background: var(--cc-brand);
}

.cc-circle-crop-switch input:checked + .cc-circle-crop-switch__track .cc-circle-crop-switch__thumb {
  transform: translateX(18px);
}

.cc-circle-crop-switch input:focus-visible + .cc-circle-crop-switch__track {
  box-shadow: 0 0 0 3px var(--cc-brand-soft);
}

/* Frame swatch picker — small circular previews, same visual language
   as the Background pills above */
.cc-circle-crop-frames {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 2px 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.cc-circle-crop-frames::-webkit-scrollbar {
  display: none;
}

.cc-circle-crop-frames__divider {
  flex: 0 0 auto;
  width: 1px;
  height: 36px;
  margin: 2px 2px 0;
  background: var(--cc-line);
}

.cc-circle-crop-frame-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  touch-action: manipulation;
}

.cc-circle-crop-frame-btn__swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--cc-line);
  box-sizing: border-box;
  transition: box-shadow 0.15s ease;
}

.cc-circle-crop-frame-btn__label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--cc-ink-soft);
  white-space: nowrap;
}

.cc-circle-crop-frame-btn.is-active .cc-circle-crop-frame-btn__swatch {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--cc-brand);
}

.cc-circle-crop-frame-btn.is-active .cc-circle-crop-frame-btn__label {
  color: var(--cc-brand);
}

.cc-circle-crop-frame-btn__swatch[data-swatch="none"] {
  border: 1.5px dashed var(--cc-line-strong);
}

.cc-circle-crop-frame-btn__swatch[data-swatch="classic"] {
  border-color: var(--cc-brand);
}

.cc-circle-crop-frame-btn__swatch[data-swatch="ink"] {
  border-color: var(--cc-ink);
}

.cc-circle-crop-frame-btn__swatch[data-swatch="white"] {
  border-color: #fff;
  box-shadow: 0 0 0 1.5px var(--cc-line-strong);
}

.cc-circle-crop-frame-btn__swatch[data-swatch="dashed"] {
  border-color: var(--cc-brand);
  border-style: dashed;
}

.cc-circle-crop-frame-btn__swatch[data-swatch="double"] {
  border-color: var(--cc-brand);
  border-style: double;
  border-width: 4px;
}

.cc-circle-crop-frame-btn__swatch[data-swatch="vignette"] {
  border-color: #fff;
  box-shadow: 0 3px 8px rgba(26, 26, 34, 0.3), 0 0 0 1px var(--cc-line);
}

.cc-circle-crop-frame-btn__swatch[data-swatch="gradient"] {
  border-color: transparent;
  background: conic-gradient(from -90deg, var(--cc-brand), var(--cc-brand-dark), var(--cc-brand));
}

.cc-circle-crop-frame-btn__swatch[data-swatch="neon"] {
  border-color: #22E7F0;
  box-shadow: 0 0 8px rgba(34,231,240,0.7), 0 0 2px rgba(34,231,240,0.9);
}

.cc-circle-crop-frame-btn__swatch[data-swatch="glass"] {
  border-color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.25);
  box-shadow: 0 2px 6px rgba(26,26,34,0.2), inset 0 0 0 1px rgba(255,255,255,0.5);
  backdrop-filter: blur(1px);
}

.cc-circle-crop-frame-btn__swatch[data-swatch="dotted"] {
  border-color: var(--cc-brand);
  border-style: dotted;
  border-width: 4px;
}

.cc-circle-crop-frame-btn__swatch[data-swatch="halo"] {
  border-color: transparent;
  background: #fff;
  box-shadow: 0 0 10px 3px rgba(66,181,164,0.55);
}

.cc-circle-crop-frame-btn__swatch[data-swatch="sparkle"] {
  border-color: var(--cc-brand);
  background:
    radial-gradient(circle 2px at 18% 20%, #fff 90%, transparent 100%),
    radial-gradient(circle 2px at 78% 30%, #fff 90%, transparent 100%),
    radial-gradient(circle 2px at 30% 80%, #fff 90%, transparent 100%),
    #fff;
}

.cc-circle-crop-frame-btn__swatch[data-swatch="emboss"] {
  border-color: var(--cc-ink);
  box-shadow: inset 1px 1px 2px rgba(0,0,0,0.4), inset -1px -1px 2px rgba(255,255,255,0.6);
}

.cc-circle-crop-frame-btn__swatch[data-swatch="outline"] {
  border-color: var(--cc-ink);
  border-width: 1.5px;
}

.cc-circle-crop-frame-btn__swatch[data-swatch="chrome"] {
  border-color: transparent;
  background: conic-gradient(from -90deg, #8e9aa3, #f5f7fa, #7c8791, #ffffff, #5b6670, #8e9aa3);
}

.cc-circle-crop-frame-btn__swatch[data-swatch="gold"] {
  border-color: transparent;
  background: conic-gradient(from -90deg, #7a4c17, #f5d67c, #a3722c, #fdf1c9, #8a5a1e, #7a4c17);
}

.cc-circle-crop-frame-btn__swatch[data-swatch="rainbow"] {
  border-color: transparent;
  background: conic-gradient(from -90deg, #ff5f6d, #ffc371, #f9f871, #6dd5a7, #58a4ff, #a06cff, #ff5fa2, #ff5f6d);
}

/* Verified-badge chips (toggle + upload) */
.cc-circle-crop-badge-toggle {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cc-circle-crop-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: 9999px;
  border: 1.5px solid var(--cc-line);
  background: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--cc-ink-soft);
  cursor: pointer;
  touch-action: manipulation;
}

.cc-circle-crop-chip.is-active {
  border-color: var(--cc-brand);
  color: var(--cc-brand);
  background: var(--cc-brand-soft);
}

/* Apply-to-all (batch) button */
.cc-circle-crop-applyall {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 18px;
  border-radius: 9999px;
  border: 1.5px dashed var(--cc-brand);
  background: var(--cc-brand-soft);
  color: var(--cc-brand-dark);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.cc-circle-crop-applyall svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.cc-circle-crop-applyall[hidden] {
  display: none;
}

.cc-circle-crop-applyall:active {
  transform: scale(0.98);
}


/* ══════════════════════════════════════════
   7. STEP 3 — EXPORT PREVIEW
   ══════════════════════════════════════════ */
.cc-circle-crop-preview {
  display: flex;
  justify-content: center;
  margin: 8px 0 14px;
}

.cc-circle-crop-preview__canvas {
  width: 220px;
  height: 220px;
  max-width: 60vw;
  max-height: 60vw;
  border-radius: 50%;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  background:
    linear-gradient(45deg, #e9e9ef 25%, transparent 25%) 0 0/16px 16px,
    linear-gradient(-45deg, #e9e9ef 25%, transparent 25%) 0 0/16px 16px,
    linear-gradient(45deg, transparent 75%, #e9e9ef 75%) 0 0/16px 16px,
    linear-gradient(-45deg, transparent 75%, #e9e9ef 75%) 0 0/16px 16px,
    #fafafd;
}

.cc-circle-crop-select {
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1.5px solid var(--cc-line);
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--cc-ink);
  width: 100%;
}


/* ══════════════════════════════════════════
   8. ACTION BUTTONS
   ══════════════════════════════════════════ */
.cc-circle-crop-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.cc-circle-crop-btn {
  flex: 1;
  height: 48px;
  border-radius: 9999px;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  border: 1.5px solid transparent;
  cursor: pointer;
  touch-action: manipulation;
}

.cc-circle-crop-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cc-circle-crop-btn--primary {
  background: var(--cc-brand);
  color: #fff;
  box-shadow: 0 2px 10px rgba(66,181,164,0.28);
}

.cc-circle-crop-btn--primary:active {
  transform: scale(0.98);
}

.cc-circle-crop-btn--ghost {
  background: #fff;
  border-color: var(--cc-line);
  color: var(--cc-ink);
}

.cc-circle-crop-btn--ghost:active {
  background: var(--cc-bg);
}


/* ══════════════════════════════════════════
   9. TOAST
   ══════════════════════════════════════════ */
.cc-circle-crop-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: var(--cc-ink);
  color: #fff;
  padding: 12px 22px;
  border-radius: 9999px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 999;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  max-width: 90vw;
  text-align: center;
}

.cc-circle-crop-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.cc-circle-crop-toast.is-error {
  background: var(--cc-error);
}


/* ══════════════════════════════════════════
   10. DESKTOP ENHANCEMENTS (≥768px)
   ══════════════════════════════════════════ */
@media (min-width: 768px) {
  .cc-circle-crop-wrap {
    padding: 40px 24px 72px;
  }

  .cc-circle-crop-header__subtitle {
    font-size: 16px;
  }

  .cc-circle-crop-stepper {
    gap: 10px;
    margin-bottom: 36px;
  }

  .cc-circle-crop-stepper__line {
    width: 56px;
  }

  .cc-circle-crop-dropzone {
    max-width: 520px;
    padding: 56px 24px;
  }

  .cc-circle-crop-dropzone__button {
    height: 60px;
    padding: 0 36px;
    font-size: 16.5px;
  }

  .cc-circle-crop-stage {
    max-width: 460px;
  }

  .cc-circle-crop-filmstrip__thumb:hover,
  .cc-circle-crop-filmstrip__add:hover {
    border-color: var(--cc-brand);
  }

  .cc-circle-crop-bgmode__btn:hover {
    border-color: var(--cc-brand);
    color: var(--cc-brand);
  }

  .cc-circle-crop-applyall:hover {
    background: #ddf3ef;
  }

  .cc-circle-crop-btn--ghost:hover {
    border-color: var(--cc-ink);
  }

  .cc-circle-crop-btn--primary:hover {
    box-shadow: 0 4px 16px rgba(66,181,164,0.36);
  }

  .cc-circle-crop-actions {
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
  }
}


/* ══════════════════════════════════════════
   11. ACCESSIBILITY
   ══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .cc-circle-crop-panel.is-active,
  .cc-circle-crop-spinner {
    animation: none;
  }

  .cc-circle-crop-dropzone__button {
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
  }

  .cc-circle-crop-dropzone:hover .cc-circle-crop-dropzone__button,
  .cc-circle-crop-dropzone:active .cc-circle-crop-dropzone__button,
  .cc-circle-crop-dropzone.is-dragover .cc-circle-crop-dropzone__button {
    transform: none;
  }
}
