.otp-veil,
.otp-veil *,
.otp-veil button,
.otp-veil input {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

.otp-veil {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(6, 10, 8, 0.72);
  backdrop-filter: blur(12px);
}

.otp-veil[hidden] {
  display: none !important;
}

.otp-modal {
  position: relative;
  width: min(100%, 460px);
  padding: 36px 24px 28px;
  overflow: visible;
  border: 1px solid rgba(31, 122, 77, 0.28);
  border-radius: 28px;
  background: rgba(16, 20, 18, 0.92);
  color: #f4f7f5;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
  text-align: center;
  backdrop-filter: blur(10px);
}

.otp-modal::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(from var(--edge, 0deg), transparent 0 62%, #1f7a4d 78%, #7dffb0 90%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  animation: edge-run 2s linear infinite;
}

.otp-modal h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.otp-lead {
  margin: 8px 0 0;
  color: rgba(244, 247, 245, 0.58);
  font-size: 13px;
}

.otp-stage {
  --orbit: 78px;
  --gap: 54px;
  position: relative;
  width: min(100%, 360px);
  height: 236px;
  margin: 22px auto 4px;
}

.otp-glow {
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(31, 122, 77, 0.22), transparent 68%);
  filter: blur(18px);
  pointer-events: none;
  opacity: 0.35;
}

.otp-stage.is-gather .otp-glow,
.otp-stage.is-spin .otp-glow,
.otp-stage.is-inward .otp-glow,
.otp-stage.is-ok .otp-glow {
  opacity: 0.85;
}

.otp-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--orbit) * 2);
  height: calc(var(--orbit) * 2);
  margin: calc(var(--orbit) * -1) 0 0 calc(var(--orbit) * -1);
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  pointer-events: none;
  opacity: 0.35;
}

.otp-stage.is-gather .otp-ring,
.otp-stage.is-spin .otp-ring,
.otp-stage.is-inward .otp-ring {
  opacity: 1;
  border-color: rgba(255, 255, 255, 0.34);
}

.otp-stage.is-spin .otp-ring {
  animation: otp-ring-pulse 0.3s ease-in-out 3;
}

.otp-stage.is-ok .otp-ring {
  border-color: #1f7a4d;
  box-shadow: 0 0 24px rgba(31, 122, 77, 0.45);
  opacity: 1;
}

.otp-stage.is-bad .otp-ring {
  border-style: dashed;
  border-color: #c24141;
  opacity: 1;
  animation: otp-ring-break 0.7s ease forwards;
}

.otp-orbit {
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
}

.otp-stage.is-spin .otp-orbit {
  animation: otp-spin 0.3s linear 3;
}

.otp-stage.is-bad {
  animation: otp-vibrate 0.16s linear 6;
}

.otp-box {
  --turn: calc(var(--i) * 60deg - 90deg);
  --up: calc(90deg - var(--i) * 60deg);
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 52px;
  margin: -26px 0 0 -23px;
  border: 1.5px solid rgba(31, 122, 77, 0.55);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  color: #f4f7f5;
  font: 700 20px/1 Inter, Segoe UI, system-ui, sans-serif;
  text-align: center;
  caret-color: #fff;
  outline: none;
  transform: translateX(calc((var(--i) - 2.5) * var(--gap)));
  transition: transform 0.48s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

.otp-box:focus {
  border-color: #1f7a4d;
  box-shadow: 0 0 18px rgba(31, 122, 77, 0.35);
}

.otp-stage.is-gather .otp-box,
.otp-stage.is-spin .otp-box {
  transform: rotate(var(--turn)) translateY(calc(var(--orbit) * -1)) rotate(var(--up));
}

.otp-stage.is-inward .otp-box,
.otp-stage.is-ok .otp-box {
  pointer-events: none;
  animation: otp-merge 0.48s cubic-bezier(0.2, 0.85, 0.25, 1) forwards;
}

.otp-stage.is-ok .otp-box {
  border-color: #1f7a4d;
  background: #1f7a4d;
  color: #fff;
}

.otp-stage.is-bad .otp-box {
  border-color: #c24141;
  background: #c24141;
  color: #fff;
  pointer-events: none;
  animation: otp-burst 0.78s cubic-bezier(0.36, 0.04, 0.68, 0.4) forwards;
}

.otp-stage.is-gather .otp-box,
.otp-stage.is-spin .otp-box,
.otp-stage.is-inward .otp-box {
  pointer-events: none;
}

.otp-slot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.4);
  pointer-events: none;
}

.otp-stage.is-ok .otp-slot {
  animation: otp-slot-lock 0.45s 0.2s cubic-bezier(0.2, 0.85, 0.25, 1) forwards;
  background: #1f7a4d;
  color: #fff;
  box-shadow: 0 0 28px rgba(31, 122, 77, 0.55);
}

.otp-stage.is-bad .otp-slot {
  display: none;
}

.otp-check {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.otp-wave {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}

.otp-stage.is-ok .otp-wave {
  border: 2px solid #1f7a4d;
  animation: otp-wave 1.15s ease-out 0.28s both;
}

.otp-stage.is-ok .otp-wave:nth-child(2) { animation-delay: 0.44s; }
.otp-stage.is-ok .otp-wave:nth-child(3) { animation-delay: 0.6s; }

.otp-stage.is-bad .otp-wave {
  border: 2px dashed #c24141;
  animation: otp-shatter 0.7s ease-out both;
}

.otp-hint {
  margin: 8px 0 0;
  color: rgba(244, 247, 245, 0.72);
  font-size: 13px;
  line-height: 1.45;
}

.otp-hint strong {
  letter-spacing: 0.18em;
  color: #fff;
  font-size: 16px;
}

.otp-timer {
  margin: 14px 0 0;
  width: min(100%, 280px);
  margin-left: auto;
  margin-right: auto;
}

.otp-timer-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.otp-timer-label {
  color: rgba(244, 247, 245, 0.55);
  font-size: 12px;
}

.otp-timer-value {
  color: #e8f5e9;
  font: 700 15px "Cascadia Mono", Consolas, "Segoe UI", monospace;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s ease;
}

.otp-timer[data-tone="yellow"] .otp-timer-value {
  color: #ffd54f;
}

.otp-timer[data-tone="red"] .otp-timer-value,
.otp-timer.is-expired .otp-timer-value {
  color: #ff8a8a;
}

.otp-progress {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.otp-progress-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1b5e20, #43a047);
  transition: width 0.25s linear, background 0.25s ease;
}

.otp-progress[data-tone="green"] .otp-progress-fill {
  background: linear-gradient(90deg, #1b5e20, #43a047);
  box-shadow: 0 0 10px rgba(67, 160, 71, 0.35);
}

.otp-progress[data-tone="yellow"] .otp-progress-fill {
  background: linear-gradient(90deg, #f9a825, #ffd54f);
  box-shadow: 0 0 10px rgba(255, 213, 79, 0.35);
}

.otp-progress[data-tone="red"] .otp-progress-fill,
.otp-timer.is-expired .otp-progress-fill {
  background: linear-gradient(90deg, #c62828, #ef5350);
  box-shadow: 0 0 10px rgba(239, 83, 80, 0.4);
}

.otp-error {
  margin: 8px 0 0;
  min-height: 18px;
  color: #ff8a8a;
  font-size: 12px;
}

.otp-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.otp-actions button {
  flex: 1;
  height: 42px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: rgba(244, 247, 245, 0.62);
  font: 600 13px Inter, Segoe UI, system-ui, sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.otp-actions button:hover:not(:disabled),
.otp-actions button:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.otp-actions button:disabled {
  opacity: 0.45;
  cursor: default;
}

.otp-actions .otp-btn-resend.is-ready:not(:disabled) {
  background: #2e7d32;
  color: #fff;
  opacity: 1;
  box-shadow: 0 0 0 1px rgba(76, 175, 80, 0.35), 0 8px 18px rgba(46, 125, 50, 0.28);
}

.otp-actions .otp-btn-resend.is-ready:not(:disabled):hover,
.otp-actions .otp-btn-resend.is-ready:not(:disabled):focus-visible {
  background: #388e3c;
  color: #fff;
}

@property --edge {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes edge-run {
  to { --edge: 360deg; }
}

@keyframes otp-spin {
  to { transform: rotate(360deg); }
}

@keyframes otp-merge {
  0% {
    transform: rotate(var(--turn)) translateY(calc(var(--orbit) * -1)) rotate(var(--up)) scale(1);
    opacity: 1;
  }
  100% {
    transform: rotate(var(--turn)) translateY(0) rotate(var(--up)) scale(0.12);
    opacity: 0;
  }
}

@keyframes otp-burst {
  0% {
    transform: rotate(var(--turn)) translateY(0) rotate(var(--up)) scale(0.45);
    opacity: 1;
  }
  42% {
    transform: rotate(var(--turn)) translateY(calc(var(--orbit) * -1.38)) rotate(calc(var(--up) + 16deg)) scale(1);
  }
  58% {
    transform: rotate(var(--turn)) translateY(calc(var(--orbit) * -1.18)) rotate(calc(var(--up) - 12deg));
  }
  74% {
    transform: rotate(var(--turn)) translateY(calc(var(--orbit) * -1.34)) rotate(calc(var(--up) + 9deg));
  }
  88% {
    transform: rotate(var(--turn)) translateY(calc(var(--orbit) * -1.22)) rotate(calc(var(--up) - 7deg));
  }
  100% {
    transform: rotate(var(--turn)) translateY(calc(var(--orbit) * -1.28)) rotate(calc(var(--up) + 5deg));
  }
}

@keyframes otp-vibrate {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-3px, 2px); }
  50% { transform: translate(3px, -2px); }
  75% { transform: translate(-2px, -3px); }
}

@keyframes otp-ring-pulse {
  50% { transform: scale(1.04); opacity: 0.9; }
}

@keyframes otp-ring-break {
  to { transform: scale(1.08); opacity: 0.55; }
}

@keyframes otp-slot-lock {
  to { opacity: 1; transform: scale(1); }
}

@keyframes otp-wave {
  from { opacity: 0.55; transform: scale(1); }
  to { opacity: 0; transform: scale(2.2); }
}

@keyframes otp-shatter {
  0% { opacity: 0.7; transform: scale(1) rotate(0deg); }
  100% { opacity: 0; transform: scale(1.85) rotate(-16deg); }
}

@media (max-width: 480px) {
  .otp-stage { --orbit: 68px; --gap: 46px; width: 300px; height: 210px; }
  .otp-box { width: 40px; height: 46px; margin: -23px 0 0 -20px; font-size: 18px; }
  .otp-modal { padding: 28px 14px 20px; }
}
