@keyframes slide-up-check {
  0% {
    opacity: 0;
    transform: translateY(1.875rem) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

main.captcha {
  align-items: stretch;
  background: white;
  border: 1px solid #f0f0f0;
  box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  width: 350px;
  font-family: system-ui, -apple-system, sans-serif;
}

main.captcha header {
  background: linear-gradient(180deg, #ffffff 0, #f4f5f7 100%);
  border-bottom: 1px solid #e5e7eb;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 0;
  position: relative;
  width: 100%;
}

main.captcha header > b:first-child {
  align-items: center;
  display: flex;
  justify-content: space-between;
  padding: 1rem 1.25rem 0;
}

main.captcha header > b:first-child > b:first-child {
  color: #333;
  display: block;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

main.captcha header .refresh {
  align-items: center;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
  height: 2rem;
  justify-content: center;
  margin-left: 1rem;
  outline: none;
  padding: 0;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 2rem;
}

main.captcha header .refresh::before {
  background: linear-gradient(135deg, #64748b, #94a3b8);
  content: '';
  display: block;
  height: 1.125rem;
  mask: url('/refresh.svg') no-repeat center / contain;
  -webkit-mask: url('/refresh.svg') no-repeat center / contain;
  transition: all 0.3s;
  width: 1.125rem;
}

main.captcha header .refresh:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-color: #2563eb;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
  transform: rotate(90deg);
}

main.captcha header .refresh:hover::before {
  background: #fff;
}

main.captcha header .refresh:active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.25);
  transform: rotate(90deg) scale(0.9);
}

main.captcha header > b:last-child {
  border-top: 1px dashed #e5e7eb;
  display: flex;
  justify-content: space-around;
  margin-top: 0.875rem;
  padding: 1rem 0;
}

main.captcha header .icon-item {
  align-items: center;
  display: flex;
  gap: 0.5rem;
}

main.captcha header .icon-item .icon-box {
  background: linear-gradient(135deg, #fffdfa, #fff8f0);
  border: 1px solid #ffedd5;
  border-radius: 0.625rem;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.04), inset 0 1px 2px rgba(0, 0, 0, 0.02);
  box-sizing: content-box;
  height: 1.625rem;
  padding: 0.375rem;
  width: 1.625rem;
}

main.captcha header .icon-item .icon-box .icon-shape {
  background: linear-gradient(135deg, #fbbf24 0, #ea580c 100%);
  display: block;
  height: 100%;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  width: 100%;
}

main.captcha .click-box {
  background-size: cover;
  cursor: crosshair;
  display: block;
  height: 350px;
  position: relative;
  width: 350px;
}

main.captcha:not(.ready) .click-box .state-overlay {
  align-items: center;
  backdrop-filter: blur(2px);
  background: rgba(255, 255, 255, 0.7);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 50;
}

main.captcha:not(.ready) .click-box .state-overlay .spinner {
  background: url('/wait.svg') no-repeat center;
  background-size: contain;
  display: block;
  height: 2.25rem;
  width: 2.25rem;
}

main.captcha.ing header .refresh::before {
  background: #94a3b8;
  mask-image: url('/wait.svg');
  -webkit-mask-image: url('/wait.svg');
}

main.captcha.ing header .icon-item .icon-box .icon-shape {
  background: url('/wait.svg') no-repeat 50% 50%;
  background-size: 60%;
  mask-image: none;
  -webkit-mask-image: none;
}

main.captcha.suc header > b:first-child > b:first-child {
  color: #059669;
}

main.captcha.fail header > b:first-child > b:first-child {
  color: #f00;
}

.state-overlay .result-mark {
  animation: slide-up-check 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  height: 3.5rem;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  width: 3.5rem;
}

.state-overlay .success-mark {
  background: linear-gradient(135deg, #10b981 0, #047857 100%);
  mask-image: url('/ok.svg');
  -webkit-mask-image: url('/ok.svg');
}

.state-overlay .fail-mark {
  background: linear-gradient(135deg, #f87171 0, #ef4444 100%);
  mask-image: url('/xs.svg');
  -webkit-mask-image: url('/xs.svg');
}

.badge {
  align-items: center;
  background: linear-gradient(135deg, #10b981, #059669);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
  color: #fff;
  display: flex;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  height: 1.5rem;
  justify-content: center;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
  width: 1.5rem;
}

.click-badge {
  border-width: 3px;
  cursor: pointer;
  font-size: 0.9375rem;
  position: absolute;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 10;
}

.click-badge:hover {
  background: linear-gradient(135deg, #34d399, #10b981);
  border-color: #fff;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.2);
  transform: scale(1.15);
}
