/* ════════════════════════════════════════════════
   OTP 인증 — codexr 컴포넌트 포팅 (React/Framer → 바닐라)
   오렌지 액센트 → SH 브랜드 블루(#0066cc), 성공은 그린 유지
════════════════════════════════════════════════ */

.otp-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.otp-overlay--open { opacity: 1; pointer-events: auto; }

.otp-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 32px;
  background-color: #121212;
  border-radius: 40px;
  border: 1px solid #222;
  max-width: 420px;
  width: 100%;
  color: #fff;
  position: relative;
  overflow: hidden;
  transform: scale(0.92) translateY(12px);
  transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.otp-overlay--open .otp-container { transform: scale(1) translateY(0); }

/* 성공 시 배경 글로우 (verified green) */
.otp-container::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 150%; height: 150%;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.25) 0%, rgba(18, 18, 18, 0) 60%);
  opacity: 0;
  transition: opacity 1s ease-in-out 1.3s;
  z-index: 0;
  pointer-events: none;
}
.otp-container.is-complete::before { opacity: 1; }

.otp-header, .otp-inputs, .otp-footer, .otp-close { position: relative; z-index: 1; }

.otp-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s;
  z-index: 2;
}
.otp-close:hover { background: rgba(255,255,255,0.16); color: #fff; }

.otp-header {
  text-align: center;
  margin-bottom: 40px;
  margin-top: 10px;
}
.otp-header h1 {
  font-family: var(--font-display, "SF Pro Display", system-ui, sans-serif);
  font-size: 26px;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
  transition: all 0.3s ease;
}
.otp-header p {
  font-family: var(--font-text, "SF Pro Text", system-ui, sans-serif);
  font-size: 15px;
  color: #7a7a7a;
  line-height: 1.5;
  font-weight: 400;
  transition: all 0.3s ease;
  white-space: pre-line;
  min-height: 45px;
}

.otp-inputs {
  display: flex;
  gap: 16px;
  margin-bottom: 40px;
  position: relative;
  min-height: 64px;
  align-items: center;
  justify-content: center;
}

.input-wrapper {
  position: relative;
  width: 64px; height: 64px;
  border-radius: 16px;
  background-color: #333;
  overflow: hidden;
  flex-shrink: 0;
  will-change: transform, opacity, box-shadow;
}
.input-wrapper:focus-within { background-color: #0066cc; }

.input-wrapper::before {
  content: '';
  position: absolute;
  top: -100%; left: -100%;
  width: 300%; height: 300%;
  background: transparent;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
}

.is-complete .input-wrapper::before {
  opacity: 1;
  background: conic-gradient(from 0deg,
      transparent 0%,
      transparent 55%,
      rgba(0, 102, 204, 0.15) 70%,
      #0066cc 92%,
      #79c0ff 100%);
  animation: otp-rotate 1.0s linear 1 forwards, otp-morph-green 0.9s ease-in-out 1.0s forwards;
}

@keyframes otp-rotate {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes otp-morph-green {
  0%   { background: conic-gradient(from 0deg, #0066cc 0%, #2997ff 50%, #0066cc 100%); }
  32%  { background: conic-gradient(from 0deg, #0066cc 0%, #2997ff 50%, #0066cc 100%); }
  33%  { background: conic-gradient(from 0deg, #22c55e 0%, #16a34a 50%, #22c55e 100%); }
  100% { background: conic-gradient(from 0deg, #22c55e 0%, #16a34a 50%, #22c55e 100%); }
}

.otp-input {
  position: absolute;
  top: 2.5px; left: 2.5px;
  width: calc(100% - 5px);
  height: calc(100% - 5px);
  background-color: #161616;
  border: none;
  border-radius: 13.5px;
  color: #fff;
  font-size: 28px;
  font-weight: 500;
  text-align: center;
  outline: none;
  font-family: var(--font-text, "SF Pro Text", system-ui, sans-serif);
  z-index: 1;
  transition: background-color 0.4s ease;
}

.is-complete .otp-input { animation: otp-fade-text 0.2s ease 1.0s forwards; }
@keyframes otp-fade-text {
  to { color: transparent; background-color: #161616; }
}

/* 박스 합치기 애니메이션 */
.is-complete .input-wrapper:nth-child(1) {
  z-index: 4;
  animation: otp-merge-1 0.9s ease-in-out 1.0s forwards,
             otp-glow-green 1.5s infinite alternate 1.9s;
}
@keyframes otp-merge-1 {
  0%   { transform: translateX(0)     scale(1)    rotate(0deg); }
  33%  { transform: translateX(120px) scale(1)    rotate(12deg); }
  66%  { transform: translateX(120px) scale(1.22) rotate(0deg); }
  100% { transform: translateX(120px) scale(1)    rotate(0deg); }
}

.is-complete .input-wrapper:nth-child(2) {
  z-index: 3;
  animation: otp-merge-2 0.9s ease-in-out 1.0s forwards;
}
@keyframes otp-merge-2 {
  0%   { transform: translateX(0)    scale(1) rotate(0deg);  opacity: 1; }
  32%  { transform: translateX(40px) scale(1) rotate(6deg);  opacity: 1; }
  33%  { transform: translateX(40px) scale(1) rotate(6deg);  opacity: 0; }
  100% { transform: translateX(40px) scale(1) rotate(6deg);  opacity: 0; }
}

.is-complete .input-wrapper:nth-child(3) {
  z-index: 2;
  animation: otp-merge-3 0.9s ease-in-out 1.0s forwards;
}
@keyframes otp-merge-3 {
  0%   { transform: translateX(0)     scale(1) rotate(0deg);  opacity: 1; }
  32%  { transform: translateX(-40px) scale(1) rotate(-6deg); opacity: 1; }
  33%  { transform: translateX(-40px) scale(1) rotate(-6deg); opacity: 0; }
  100% { transform: translateX(-40px) scale(1) rotate(-6deg); opacity: 0; }
}

.is-complete .input-wrapper:nth-child(4) {
  z-index: 1;
  animation: otp-merge-4 0.9s ease-in-out 1.0s forwards;
}
@keyframes otp-merge-4 {
  0%   { transform: translateX(0)      scale(1) rotate(0deg);   opacity: 1; }
  32%  { transform: translateX(-120px) scale(1) rotate(-12deg); opacity: 1; }
  33%  { transform: translateX(-120px) scale(1) rotate(-12deg); opacity: 0; }
  100% { transform: translateX(-120px) scale(1) rotate(-12deg); opacity: 0; }
}

@keyframes otp-glow-green {
  0%   { box-shadow: 0 0 8px  rgba(34, 197, 94, 0.4); }
  100% { box-shadow: 0 0 24px rgba(34, 197, 94, 1); }
}

.final-tick {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  width: 32px; height: 32px;
  opacity: 0;
  z-index: 10;
  pointer-events: none;
}
.is-complete .final-tick { animation: otp-tick-pop 0.6s ease-in-out 1.3s forwards; }
@keyframes otp-tick-pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  50%  { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* 에러 흔들림 */
.otp-inputs.is-error .input-wrapper {
  animation: otp-shake 0.4s ease;
}
@keyframes otp-shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-6px); }
  40%,80% { transform: translateX(6px); }
}

.otp-footer {
  font-family: var(--font-text, "SF Pro Text", system-ui, sans-serif);
  font-size: 15px;
  color: #666;
  min-height: 20px;
}
.otp-footer button {
  background: none; border: none;
  color: #fff; font-weight: 600;
  cursor: pointer; padding: 0; margin-left: 6px;
  font-family: inherit; font-size: inherit;
  transition: color 0.2s ease;
}
.otp-footer button:hover { color: #ddd; }
.otp-footer--error { color: #ff6b6b; }
