.purpl-otp-shell {
    position: relative;
    margin: 0 0 0.35rem;
}

.me-field-group .purpl-otp-shell {
    margin: 0;
}

.purpl-otp {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.purpl-otp__slot {
    position: relative;
    flex: 1 1 0;
    width: 46px;
    max-width: 46px;
    min-width: 0;
    height: 48px;
}

.purpl-otp__slot.is-gap {
    margin-left: 6px;
}

.purpl-otp__cell {
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 1.5px solid #e8edf5;
    border-radius: 12px;
    background: #f4f6fb;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
    color: transparent;
    caret-color: transparent;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1;
    outline: none;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.purpl-otp__cell::selection {
    background: transparent;
    color: transparent;
}

.purpl-otp__slot.is-filled .purpl-otp__cell {
    background: #fff;
    border-color: #e5e7eb;
    box-shadow: none;
}

.purpl-otp__slot.is-active .purpl-otp__cell {
    background: #fff;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.purpl-otp.is-error .purpl-otp__cell,
.purpl-otp.is-error .purpl-otp__slot.is-active .purpl-otp__cell,
.purpl-otp.is-error .purpl-otp__slot.is-filled .purpl-otp__cell {
    background: #fff;
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.purpl-otp.is-success .purpl-otp__cell,
.purpl-otp.is-success .purpl-otp__slot.is-active .purpl-otp__cell,
.purpl-otp.is-success .purpl-otp__slot.is-filled .purpl-otp__cell {
    background: #fff;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}

.purpl-otp.is-disabled {
    opacity: 0.5;
}

.purpl-otp.is-shake {
    animation: purplOtpShake 0.32s cubic-bezier(0.23, 1, 0.32, 1);
}

.purpl-otp__face {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
    overflow: hidden;
    border-radius: 12px;
}

.purpl-otp__glyph,
.purpl-otp__caret {
    grid-area: 1 / 1;
}

.purpl-otp__glyph {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    color: #0f172a;
}

.purpl-otp__glyph.is-in {
    animation: purplOtpIn 0.22s cubic-bezier(0.23, 1, 0.32, 1) both;
}

.purpl-otp__glyph.is-out {
    position: absolute;
    animation: purplOtpOut 0.22s cubic-bezier(0.23, 1, 0.32, 1) both;
}

.purpl-otp__caret {
    display: block;
    width: 1.5px;
    height: 17px;
    border-radius: 1px;
    background: #7c3aed;
    animation: purplOtpCaret 1.06s linear infinite;
}

.purpl-otp__caret[hidden] {
    display: none !important;
}

.purpl-otp-msg-in {
    animation: purplOtpMsg 0.28s cubic-bezier(0.23, 1, 0.32, 1);
}

input.purpl-otp-source {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    box-shadow: none !important;
}

@keyframes purplOtpIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.97);
        filter: blur(6px);
    }
    to {
        opacity: 1;
        transform: none;
        filter: blur(0);
    }
}

@keyframes purplOtpOut {
    to {
        opacity: 0;
        transform: translateY(-6px) scale(0.98);
        filter: blur(3px);
    }
}

@keyframes purplOtpCaret {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

@keyframes purplOtpShake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-3px); }
    100% { transform: translateX(0); }
}

@keyframes purplOtpMsg {
    from {
        opacity: 0;
        transform: translateY(3px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 420px) {
    .purpl-otp {
        gap: 6px;
    }

    .purpl-otp__slot {
        width: 40px;
        max-width: 40px;
        height: 44px;
    }

    .purpl-otp__slot.is-gap {
        margin-left: 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .purpl-otp.is-shake,
    .purpl-otp__glyph.is-in,
    .purpl-otp__glyph.is-out,
    .purpl-otp__caret,
    .purpl-otp-msg-in {
        animation: none;
    }

    .purpl-otp__glyph.is-out {
        display: none;
    }
}
