/* ==========================================================================
   SSC Captcha Widget — Public CSS  v1.0.0
   ========================================================================== */

.ssc-captcha-wrap   { margin: 16px 0; }
.ssc-captcha-error  { background: #fee2e2; border: 1px solid #ef4444; border-radius: 8px; padding: 10px 14px; font-size: 13px; color: #b91c1c; margin: 12px 0; }
.ssc-hp-wrap        { display: none !important; visibility: hidden !important; height: 0; overflow: hidden; }

/* ---- Widget shell ---- */
.ssc-captcha-widget {
  width: 100%;
  max-width: 340px;
  border: 1px solid #e2e2ee;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.04);
  overflow: hidden;
  user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: box-shadow .2s;
}
.ssc-captcha-widget:focus-within { box-shadow: 0 0 0 3px rgba(92,94,245,.15), 0 2px 12px rgba(0,0,0,.07); }

/* ---- Header ---- */
.ssc-captcha-header {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; background: #fafafa;
  border-bottom: 1px solid #ebebf8;
  font-size: 12px; font-weight: 600; color: #52527a;
}
.ssc-captcha-header-icon { font-size: 15px; }
.ssc-captcha-header-hint { margin-left: auto; font-size: 11px; font-weight: 400; color: #9898b8; }

/* ---- Puzzle area ---- */
.ssc-captcha-puzzle {
  position: relative; height: 110px; overflow: hidden;
  /* Geometric gradient background — the CAPTCHA canvas */
  background:
    linear-gradient(135deg, rgba(255,255,255,.07) 25%, transparent 25%) -10px 0,
    linear-gradient(225deg, rgba(255,255,255,.07) 25%, transparent 25%) -10px 0,
    linear-gradient(315deg, rgba(255,255,255,.07) 25%, transparent 25%),
    linear-gradient(45deg,  rgba(255,255,255,.07) 25%, transparent 25%),
    linear-gradient(135deg, #5c5ef5 0%, #818cf8 50%, #a78bfa 100%);
  background-size: 20px 20px, 20px 20px, 20px 20px, 20px 20px, 100% 100%;
}

/* ---- Notch (target hole) ---- */
.ssc-notch {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  width: 42px; height: 52px;
  margin-left: -21px; /* center on %-position */
  background: rgba(0,0,0,.28);
  border: 2px dashed rgba(255,255,255,.55);
  border-radius: 6px;
  pointer-events: none;
  transition: background .25s, border-color .25s;
}
.ssc-captcha-widget.ssc-solved .ssc-notch {
  background: rgba(34,197,94,.35);
  border-color: rgba(34,197,94,.8);
  border-style: solid;
}

/* ---- Draggable piece ---- */
.ssc-piece {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  left: 8px; /* starting position */
  width: 42px; height: 52px;
  background: linear-gradient(160deg, #ffffff 0%, #e8e8ff 100%);
  border: 2px solid rgba(255,255,255,.9);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.6);
  cursor: grab;
  transition: box-shadow .15s, transform .1s;
  will-change: left;
  touch-action: none;
}
.ssc-piece:active, .ssc-piece.ssc-dragging { cursor: grabbing; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.ssc-piece-arrows { font-size: 16px; color: #5c5ef5; pointer-events: none; }
.ssc-captcha-widget.ssc-solved .ssc-piece { background: linear-gradient(160deg, #dcfce7, #bbf7d0); border-color: #22c55e; }

/* ---- PoW overlay ---- */
.ssc-pow-overlay {
  display: none;
  position: absolute; inset: 0;
  background: rgba(22,22,42,.65); backdrop-filter: blur(2px);
  align-items: center; justify-content: center; gap: 10px;
  color: #fff; font-size: 12px; font-weight: 500;
}
.ssc-pow-overlay.ssc-visible { display: flex; }

.ssc-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ssc-spin .7s linear infinite;
}
@keyframes ssc-spin { to { transform: rotate(360deg); } }

/* ---- Slider track ---- */
.ssc-track-wrap {
  padding: 12px 14px 10px;
  background: #f8f8ff;
  border-top: 1px solid #ebebf8;
}
.ssc-track {
  position: relative;
  height: 8px; border-radius: 4px;
  background: #e2e2ee;
}
.ssc-fill {
  position: absolute;
  left: 0; top: 0; height: 100%; width: 0;
  background: linear-gradient(90deg, #5c5ef5, #818cf8);
  border-radius: 4px;
  transition: none;
  pointer-events: none;
}
.ssc-handle {
  position: absolute;
  top: 50%; left: 0; transform: translate(-50%, -50%);
  width: 32px; height: 32px;
  background: #5c5ef5;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 2px 8px rgba(92,94,245,.4);
  cursor: grab;
  touch-action: none;
  transition: background .15s, box-shadow .15s, transform .1s;
  will-change: left;
}
.ssc-handle:active, .ssc-handle.ssc-dragging {
  cursor: grabbing;
  background: #4244d4;
  box-shadow: 0 4px 14px rgba(92,94,245,.5);
  transform: translate(-50%, -50%) scale(1.1);
}
.ssc-captcha-widget.ssc-solved .ssc-handle { background: #22c55e; box-shadow: 0 2px 8px rgba(34,197,94,.4); }

/* ---- Status bar ---- */
.ssc-captcha-status {
  min-height: 30px;
  padding: 5px 14px;
  font-size: 12px;
  color: #9898b8;
  display: flex; align-items: center; gap: 6px;
  border-top: 1px solid #ebebf8;
  transition: color .2s, background .2s;
}
.ssc-captcha-status.ssc-ok      { color: #15803d; background: #f0fdf4; }
.ssc-captcha-status.ssc-error   { color: #b91c1c; background: #fff5f5; }
.ssc-captcha-status.ssc-working { color: #1d4ed8; background: #eff6ff; }

/* ---- Shake animation ---- */
@keyframes ssc-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}
.ssc-shake { animation: ssc-shake .45s ease; }

/* ---- Branding ---- */
.ssc-captcha-brand {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 4px; padding: 0 14px 8px;
  font-size: 10px; color: #c0c0d8;
}

/* ---- CAPTCHA unavailable notice ---- */
.ssc-captcha-unavailable {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 13px;
  color: #78350f;
  margin: 12px 0;
  line-height: 1.5;
}
.ssc-captcha-unavail-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
