html.captcha-open {
  overflow: hidden;
}

.captcha-modal {
  --captcha-primary: #2f66ea;
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 18, 38, 0.58);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  animation: captcha-fade-in 180ms ease-out;
}

.captcha-modal[hidden] {
  display: none;
}

.captcha-dialog {
  width: min(390px, 100%);
  overflow: hidden;
  border: 1px solid rgba(208, 222, 243, 0.96);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(8, 24, 54, 0.28);
  animation: captcha-dialog-in 220ms cubic-bezier(.22, .8, .26, 1);
}

.captcha-header {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 0 20px;
  border-bottom: 1px solid #e9eef6;
  color: #17243a;
  background: linear-gradient(135deg, #fff, #f6f9ff);
}

.captcha-header > div,
.captcha-header > div > div {
  display: flex;
  align-items: center;
}

.captcha-header > div {
  gap: 11px;
}

.captcha-header > div > div {
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
}

.captcha-header strong {
  font-size: 17px;
  letter-spacing: .02em;
}

.captcha-header small {
  color: #7a889f;
  font-size: 11px;
}

.captcha-shield {
  width: 34px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px 11px 15px 15px;
  color: #fff;
  background: linear-gradient(145deg, var(--captcha-primary), #7358f6);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--captcha-primary) 28%, transparent);
  font-size: 13px;
}

.captcha-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  color: #64748b;
  background: transparent;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}

.captcha-close:hover,
.captcha-close:focus-visible {
  color: #1e293b;
  background: #edf2f8;
  outline: none;
}

.captcha-body {
  padding: 18px 20px 16px;
}

.captcha-intro {
  margin: 0 0 11px;
  color: #43516a;
  font-size: 13px;
  font-weight: 700;
}

.captcha-click-prompt {
  margin: -2px 0 10px;
  border: 1px solid color-mix(in srgb, var(--captcha-primary) 26%, white);
  border-radius: 9px;
  padding: 7px 9px;
  color: var(--captcha-primary);
  background: color-mix(in srgb, var(--captcha-primary) 7%, white);
  font-size: 12px;
  font-weight: 750;
}

.captcha-click-prompt[hidden] {
  display: none;
}

.captcha-picture {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  display: block;
  border: 1px solid #d4deed;
  border-radius: 12px;
  padding: 0;
  background: #edf3fb;
  cursor: default;
  touch-action: manipulation;
}

.captcha-picture.requires-click {
  cursor: crosshair;
}

.captcha-background {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
  user-select: none;
  -webkit-user-drag: none;
}

.captcha-piece {
  position: absolute;
  left: 0;
  z-index: 2;
  display: block;
  filter: drop-shadow(0 3px 4px rgba(5, 22, 52, 0.38));
  pointer-events: none;
  user-select: none;
  will-change: transform;
}

.captcha-click-marker {
  position: absolute;
  z-index: 4;
  width: 24px;
  height: 24px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: color-mix(in srgb, var(--captcha-primary) 78%, transparent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--captcha-primary) 23%, transparent);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: captcha-marker 320ms ease-out;
}

.captcha-click-marker::after {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: #fff;
  content: "";
}

.captcha-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  color: #63728a;
  background: linear-gradient(110deg, #edf3fb 20%, #f9fbff 42%, #edf3fb 65%);
  background-size: 220% 100%;
  font-size: 13px;
  animation: captcha-loading 1.2s linear infinite;
}

.captcha-loading[hidden] {
  display: none;
}

.captcha-track {
  position: relative;
  height: 48px;
  overflow: hidden;
  margin-top: 13px;
  border: 1px solid #d5dfed;
  border-radius: 12px;
  background: #f2f5f9;
  touch-action: none;
}

.captcha-progress {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-right: 1px solid color-mix(in srgb, var(--captcha-primary) 45%, transparent);
  background: color-mix(in srgb, var(--captcha-primary) 12%, white);
  will-change: width;
}

.captcha-handle {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 3;
  width: 52px;
  border: 0;
  border-right: 1px solid color-mix(in srgb, var(--captcha-primary) 52%, white);
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, var(--captcha-primary), color-mix(in srgb, var(--captcha-primary) 70%, #7658f6));
  box-shadow: 4px 0 12px rgba(15, 37, 76, 0.14);
  cursor: grab;
  font-size: 25px;
  font-weight: 800;
  will-change: transform;
}

.captcha-handle:active {
  cursor: grabbing;
}

.captcha-handle:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--captcha-primary) 24%, transparent);
  outline-offset: -3px;
}

.captcha-handle:disabled {
  cursor: not-allowed;
  filter: grayscale(.2);
  opacity: .48;
}

.captcha-track-copy {
  position: absolute;
  inset: 0 10px 0 62px;
  display: grid;
  place-items: center;
  color: #78869b;
  font-size: 13px;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.captcha-status {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #66758c;
  font-size: 12px;
}

.captcha-status-icon {
  color: #a7b2c2;
  font-size: 8px;
}

.captcha-refresh {
  margin-left: auto;
  border: 0;
  padding: 5px 0 5px 8px;
  color: var(--captcha-primary);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}

.captcha-privacy {
  margin: 2px 0 0;
  color: #9aa6b7;
  font-size: 10px;
  text-align: center;
}

.captcha-modal[data-state="dragging"] .captcha-status-icon,
.captcha-modal[data-state="checking"] .captcha-status-icon {
  color: var(--captcha-primary);
}

.captcha-modal[data-state="success"] .captcha-track {
  border-color: #74d5b3;
  background: #edfdf7;
}

.captcha-modal[data-state="success"] .captcha-progress,
.captcha-modal[data-state="success"] .captcha-handle {
  border-color: #1b9b73;
  background: #18a97d;
}

.captcha-modal[data-state="success"] .captcha-status,
.captcha-modal[data-state="success"] .captcha-status-icon {
  color: #07865f;
  font-weight: 750;
}

.captcha-modal[data-state="error"] .captcha-track {
  border-color: #ef9da0;
  background: #fff3f3;
}

.captcha-modal[data-state="error"] .captcha-status,
.captcha-modal[data-state="error"] .captcha-status-icon {
  color: #d13f47;
}

.captcha-modal[data-state="checking"] .captcha-handle span {
  display: inline-block;
  animation: captcha-pulse 700ms ease-in-out infinite alternate;
}

.captcha-shake {
  animation: captcha-shake 320ms ease;
}

@keyframes captcha-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes captcha-dialog-in {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes captcha-loading {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}

@keyframes captcha-marker {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.45); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes captcha-pulse {
  from { opacity: .4; transform: translateX(-2px); }
  to { opacity: 1; transform: translateX(2px); }
}

@keyframes captcha-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  55% { transform: translateX(7px); }
  80% { transform: translateX(-3px); }
}

@media (max-width: 480px) {
  .captcha-modal {
    align-items: end;
    padding: 0;
  }

  .captcha-dialog {
    width: 100%;
    border-radius: 20px 20px 0 0;
    animation-name: captcha-sheet-in;
  }

  .captcha-header {
    min-height: 64px;
  }

  .captcha-body {
    padding: 15px 16px max(16px, env(safe-area-inset-bottom));
  }
}

@keyframes captcha-sheet-in {
  from { opacity: 0; transform: translateY(28px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .captcha-modal,
  .captcha-dialog,
  .captcha-click-marker,
  .captcha-loading,
  .captcha-modal[data-state="checking"] .captcha-handle span {
    animation: none;
  }
}
