

.auth-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
        max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.auth-modal-overlay.active {
    display: flex;
    animation: auth-overlay-in 0.18s ease forwards;
}

@keyframes auth-overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.auth-modal {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: min(92vh, 740px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;

    background: linear-gradient(160deg, #1c2033 0%, #151820 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04),
        0 32px 80px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);

    animation: auth-modal-in 0.24s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes auth-modal-in {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)     scale(1); }
}

.auth-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: rgba(200, 215, 245, 0.42);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
    font-family: inherit;
}

.auth-modal-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(225, 238, 255, 0.85);
}

.auth-modal-header {
    padding: 30px 28px 0;
}

.auth-modal-title {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.2;
    color: rgba(238, 244, 255, 0.95);
    margin-bottom: 10px;
}

.auth-modal-subtitle {
    font-size: 0.875rem;
    line-height: 1.65;
    color: rgba(175, 196, 235, 0.68);
    font-weight: 400;
    margin: 0;
}

.auth-step {
    padding: 24px 28px 28px;
}

.auth-form-group {
    margin-bottom: 18px;
}

.auth-label {
    display: block;
    font-size: 0.71rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: rgba(165, 188, 228, 0.65);
    margin-bottom: 8px;
    font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
}

.auth-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.925rem;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.055);
    color: rgba(228, 240, 255, 0.88);
    font-family: inherit;
    transition: border-color 0.15s ease, background 0.15s ease;
    box-sizing: border-box;
}

.auth-input::placeholder { color: rgba(160, 182, 220, 0.3); }

.auth-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
}

.auth-code-container {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin: 20px 0 16px;
}

@media (max-width: 380px) {
    .auth-code-container { gap: 5px; }
}

.auth-code-input {
    width: 100%;
    min-height: 52px;
    text-align: center;
    font-size: 1.15rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 9px;
    color: rgba(228, 240, 255, 0.92);
    background: rgba(255, 255, 255, 0.055);
    transition: border-color 0.15s ease, background 0.15s ease;
    font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
}

.auth-code-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.09);
}

.auth-btn-submit {
    width: 100%;
    padding: 13px 22px;
    font-size: 0.925rem;
    font-weight: 600;
    color: #151820;
    background: rgba(228, 238, 255, 0.92);
    border: none;
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.15s ease;
    font-family: inherit;
    letter-spacing: -0.01em;
}

.auth-btn-submit:hover { background: #eaf2ff; }
.auth-btn-submit:active { background: rgba(212, 228, 255, 0.88); }

.auth-btn-submit:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.auth-link-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.84rem;
    font-weight: 500;
    color: rgba(178, 200, 240, 0.62);
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: color 0.15s ease;
}

.auth-link-btn:hover {
    color: rgba(205, 222, 252, 0.85);
    text-decoration: underline;
}

.auth-link-btn.auth-link-danger { color: rgba(252, 165, 165, 0.75); }
.auth-link-btn.auth-link-danger:hover { color: #fca5a5; }

.auth-error-msg {
    display: none;
    padding: 11px 14px;
    margin: 0 28px 4px;
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.5;
    color: rgba(252, 165, 165, 0.92);
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.22);
    border-radius: 8px;
}

.auth-error-msg.active { display: block; }

.auth-countdown-row {
    text-align: center;
    font-size: 0.82rem;
    font-weight: 500;
    color: rgba(165, 188, 228, 0.52);
}

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

    .auth-modal {
        max-width: 100%;
        border-radius: 18px 18px 0 0;
        max-height: 90dvh;
    }
}
