:root {
  --bg: #ffffff;
  --surface: #fafaf9;
  --border: #e7e5e4;
  --text: #1c1917;
  --text-muted: #78716c;
  --primary: #0f766e;
  --primary-hover: #115e59;
  --error: #b91c1c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  color: var(--text);
  background: transparent;
  -webkit-font-smoothing: antialiased;
}

.widget {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.widget__header h1 {
  font-size: 22px;
  margin: 0 0 6px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.widget__header p {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.widget__footer {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

.step { display: block; }
.step.hidden { display: none; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragging {
  border-color: var(--primary);
  background: #f0fdfa;
}
.dropzone__icon { font-size: 32px; margin-bottom: 10px; }
.dropzone__title { font-weight: 500; margin-bottom: 4px; }
.dropzone__hint { font-size: 12px; color: var(--text-muted); }

.preview {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  margin-bottom: 18px;
  max-height: 360px;
  display: flex;
  justify-content: center;
}
.preview img { max-width: 100%; max-height: 360px; object-fit: contain; display: block; }
.preview__change {
  position: absolute; top: 10px; right: 10px;
  background: rgba(0,0,0,.65); color: white;
  border: none; border-radius: 8px;
  padding: 6px 12px; font-size: 12px; cursor: pointer;
}

.colors__label { font-size: 13px; font-weight: 500; margin-bottom: 10px; }
.colors__list {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.color-swatch {
  aspect-ratio: 1;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform .1s, border-color .15s;
  position: relative;
}
.color-swatch:hover { transform: scale(1.06); }
.color-swatch.selected { border-color: var(--text); }
.color-swatch__name {
  position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%);
  font-size: 10px; color: var(--text-muted); white-space: nowrap;
}

.colors__custom {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; margin-bottom: 18px;
  padding-top: 12px;
}
.colors__custom input[type="color"] {
  width: 40px; height: 40px; border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; padding: 2px; background: white;
}

.consent {
  font-size: 12px; color: var(--text-muted);
  margin-bottom: 16px; line-height: 1.5;
}
.consent label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.consent input { margin-top: 2px; flex-shrink: 0; }
.consent a { color: var(--primary); }

.turnstile { margin: 0 0 14px; min-height: 0; }
.turnstile:not(:empty) { min-height: 65px; }

.cta, .btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  cursor: pointer; border: none;
  transition: background .15s, opacity .15s;
  text-decoration: none;
}
.cta {
  width: 100%;
  background: var(--primary); color: white;
}
.cta:hover:not(:disabled) { background: var(--primary-hover); }
.cta:disabled { opacity: .4; cursor: not-allowed; }

.btn--primary { background: var(--primary); color: white; }
.btn--primary:hover { background: var(--primary-hover); }
.btn--ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn--ghost:hover { background: var(--surface); }

.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 30px auto 16px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading__text { text-align: center; color: var(--text-muted); font-size: 14px; margin-bottom: 30px; }

.compare {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  user-select: none;
  background: var(--surface);
  margin-bottom: 16px;
  cursor: ew-resize;
}
.compare__img { display: block; width: 100%; height: auto; }
.compare__before {
  position: absolute; top: 0; left: 0; bottom: 0;
  width: 50%; overflow: hidden;
}
.compare__before .compare__img { width: 200%; max-width: none; }
.compare__handle {
  position: absolute; top: 0; bottom: 0; left: 50%;
  transform: translateX(-50%); pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.compare__handle-line {
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: 2px; background: white;
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(0,0,0,.3);
}
.compare__handle-grip {
  position: relative; z-index: 1;
  width: 36px; height: 36px;
  background: white; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.2);
  color: var(--text);
}

.result__actions {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.result__actions .btn { flex: 1; min-width: 110px; }

.error__icon { text-align: center; font-size: 32px; margin: 20px 0 10px; }
.error__text { text-align: center; color: var(--error); margin-bottom: 16px; font-size: 14px; }

@media (max-width: 600px) {
  .widget { padding: 18px; border-radius: 0; border-left: none; border-right: none; box-shadow: none; }
  .colors__list { grid-template-columns: repeat(4, 1fr); }
}
